# HG changeset patch # User Me@portablequad # Date 1329020833 28800 # Node ID 500d0e2fabfb2fe81a183dde075129c3ba9ad2b0 # Parent 4d8a1e0f4336935d1ffdbc0bebfeb73293615e22 made pure C and added .brch__defaul and eol handling diff -r 4d8a1e0f4336 -r 500d0e2fabfb .brch__default --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.brch__default Sat Feb 11 20:27:13 2012 -0800 @@ -0,0 +1,1 @@ +The default branch is for use with normal C code. Other branches specialize the library for use with VMS.. they may need VMS header files, and the working directory may be located at various different positions relative to the VMS implementation. \ No newline at end of file diff -r 4d8a1e0f4336 -r 500d0e2fabfb .hgeol --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgeol Sat Feb 11 20:27:13 2012 -0800 @@ -0,0 +1,14 @@ + +[patterns] +**.py = native +**.txt = native +**.c = native +**.h = native +**.cpp = native +**.java = native +**.class = bin +**.jar = bin +**.sh = native +**.pl = native +**.jpg = bin +**.gif = bin diff -r 4d8a1e0f4336 -r 500d0e2fabfb PriorityQueue.c --- a/PriorityQueue.c Thu Feb 09 15:55:54 2012 +0100 +++ b/PriorityQueue.c Sat Feb 11 20:27:13 2012 -0800 @@ -5,25 +5,12 @@ * Author: hausers@cs.tu-berlin.de */ -#include -#include -#include - #include "PriorityQueue.h" -#ifndef DEBUG -#include "../../VMS_Implementations/VMS_impl/vmalloc.h" -#endif #define left(i) 2*i #define right(i) 2*i+1 #define parent(i) i/2 -#ifdef DEBUG -#include -#define VMS__malloc malloc -#define VMS__free free -#endif - void swap (PrioQueueStruc *Q, int a, int b) { void *valTmp; int keyTmp; @@ -69,21 +56,21 @@ newSize= 2*oldSize; Q->maxSize= newSize; - newData= VMS__malloc(Q->maxSize*sizeof(heapNode)); + newData= malloc(Q->maxSize*sizeof(heapNode)); oldData= Q->data; memcpy(newData,oldData,Q->maxSize*sizeof(heapNode)); Q->data= newData; - VMS__free(oldData); + free(oldData); } -PrioQueueStruc* makeVMSPrioQ () { +PrioQueueStruc* makePrioQ () { PrioQueueStruc *retQ; - retQ= VMS__malloc(sizeof(PrioQueueStruc)); + retQ= malloc(sizeof(PrioQueueStruc)); retQ->maxSize= 1024; - retQ->data= VMS__malloc(retQ->maxSize*sizeof(heapNode)); + retQ->data= malloc(retQ->maxSize*sizeof(heapNode)); retQ->size= 0; return retQ; } @@ -124,6 +111,6 @@ } void freePrioQ (PrioQueueStruc *Q) { - VMS__free(Q->data); - VMS__free(Q); + free(Q->data); + free(Q); } diff -r 4d8a1e0f4336 -r 500d0e2fabfb PriorityQueue.h --- a/PriorityQueue.h Thu Feb 09 15:55:54 2012 +0100 +++ b/PriorityQueue.h Sat Feb 11 20:27:13 2012 -0800 @@ -10,6 +10,10 @@ #include +#include +#include +#include + typedef struct _PrioQueueStruc PrioQueueStruc; typedef struct _heapNode heapNode; @@ -25,7 +29,7 @@ heapNode *data; }; -PrioQueueStruc* makeVMSPrioQ(); +PrioQueueStruc* makePrioQ(); void* getFirstPrioQ (PrioQueueStruc *Q); void* popPrioQ (PrioQueueStruc *Q); bool insertPrioQ (void *val, int key, PrioQueueStruc *Q); diff -r 4d8a1e0f4336 -r 500d0e2fabfb TestPriorityQueue.c --- a/TestPriorityQueue.c Thu Feb 09 15:55:54 2012 +0100 +++ b/TestPriorityQueue.c Sat Feb 11 20:27:13 2012 -0800 @@ -14,7 +14,7 @@ static char *first,*second,*third; int init_suite (void) { - if (NULL == (Q= makeVMSPrioQ())) return -1; + if (NULL == (Q= makePrioQ())) return -1; else return 0; }