diff --git a/smoldyn-2.38/source/lib/SimCommand.c b/smoldyn-2.38/source/lib/SimCommand.c index f7bbf2173..7641d309f 100644 --- a/smoldyn-2.38/source/lib/SimCommand.c +++ b/smoldyn-2.38/source/lib/SimCommand.c @@ -451,7 +451,7 @@ int scmdnextcmdtime(cmdssptr cmds,double time,Q_LONGLONG iter,enum CMDcode type, /* scmdoutput */ void scmdoutput(cmdssptr cmds) { int fid,i; - queue cmdq; + queue_c cmdq; cmdptr cmd; void* voidptr; char string[STRCHAR],string2[STRCHAR]; diff --git a/smoldyn-2.38/source/lib/SimCommand.h b/smoldyn-2.38/source/lib/SimCommand.h index e7a4836a5..3ea9960b8 100644 --- a/smoldyn-2.38/source/lib/SimCommand.h +++ b/smoldyn-2.38/source/lib/SimCommand.h @@ -32,8 +32,8 @@ typedef struct cmdstruct { } *cmdptr; typedef struct cmdsuperstruct { - queue cmd; // queue of normal run-time commands - queue cmdi; // queue of integer time commands + queue_c cmd; // queue of normal run-time commands + queue_c cmdi; // queue of integer time commands enum CMDcode (*cmdfn)(void*,cmdptr,char*); // function that runs commands void *cmdfnarg; // function argument (e.g. sim) int iter; // number of times integer commands have run diff --git a/smoldyn-2.38/source/lib/queue.c b/smoldyn-2.38/source/lib/queue.c index 9607d4509..7bd3196b6 100644 --- a/smoldyn-2.38/source/lib/queue.c +++ b/smoldyn-2.38/source/lib/queue.c @@ -9,12 +9,12 @@ of the Gnu Lesser General Public License (LGPL). */ #define CHECK(A) if(!(A)) {goto failure;} else (void)0 -queue q_alloc(int n,enum Q_types type,int (*keycmp)(void *,void *)) { - queue q; +queue_c q_alloc(int n,enum Q_types type,int (*keycmp)(void *,void *)) { + queue_c q; int i; if(n<0) return NULL; - q=(queue) malloc(sizeof(struct qstruct)); + q=(queue_c) malloc(sizeof(struct qstruct)); if(!q) return NULL; q->type=type; @@ -52,7 +52,7 @@ queue q_alloc(int n,enum Q_types type,int (*keycmp)(void *,void *)) { -int q_expand(queue q,int addspace) { +int q_expand(queue_c q,int addspace) { int i,j,num,nnew; void **xnew,**kvnew; int *kinew; @@ -111,7 +111,7 @@ int q_expand(queue q,int addspace) { -void q_free(queue q,int freek,int freex) { +void q_free(queue_c q,int freek,int freex) { int i; if(!q) return; @@ -128,12 +128,12 @@ void q_free(queue q,int freek,int freex) { -void q_null(queue q) { +void q_null(queue_c q) { q->f=q->b=0; } -int q_enqueue(void *kv,int ki,double kd,Q_LONGLONG kl,void *x,queue q) { +int q_enqueue(void *kv,int ki,double kd,Q_LONGLONG kl,void *x,queue_c q) { int sp; if(q->type==Qvoid) q->kv[q->b]=kv; @@ -148,7 +148,7 @@ int q_enqueue(void *kv,int ki,double kd,Q_LONGLONG kl,void *x,queue q) { -int q_push(void *kv,int ki,double kd,Q_LONGLONG kl,void *x,queue q) { +int q_push(void *kv,int ki,double kd,Q_LONGLONG kl,void *x,queue_c q) { int sp; q->f=(q->n+q->f-1)%q->n; @@ -163,7 +163,7 @@ int q_push(void *kv,int ki,double kd,Q_LONGLONG kl,void *x,queue q) { -int q_insert(void *kv,int ki,double kd,Q_LONGLONG kl,void *x,queue q) { +int q_insert(void *kv,int ki,double kd,Q_LONGLONG kl,void *x,queue_c q) { int i,n,sp,im1; n=q->n; @@ -197,7 +197,7 @@ int q_insert(void *kv,int ki,double kd,Q_LONGLONG kl,void *x,queue q) { -void q_front(queue q,void **kvptr,int *kiptr,double *kdptr,Q_LONGLONG *klptr,void **xptr) { +void q_front(queue_c q,void **kvptr,int *kiptr,double *kdptr,Q_LONGLONG *klptr,void **xptr) { if(q->f==q->b) { if(kvptr) *kvptr=NULL; if(kiptr) *kiptr=0; @@ -214,7 +214,7 @@ void q_front(queue q,void **kvptr,int *kiptr,double *kdptr,Q_LONGLONG *klptr,voi -int q_pop(queue q,void **kvptr,int *kiptr,double *kdptr,Q_LONGLONG *klptr,void **xptr) { +int q_pop(queue_c q,void **kvptr,int *kiptr,double *kdptr,Q_LONGLONG *klptr,void **xptr) { if(q->f==q->b) { if(kvptr) *kvptr=NULL; if(kiptr) *kiptr=0; @@ -233,17 +233,17 @@ int q_pop(queue q,void **kvptr,int *kiptr,double *kdptr,Q_LONGLONG *klptr,void * -int q_length(queue q) { +int q_length(queue_c q) { return (q->n+q->b-q->f)%q->n; } -int q_maxlength(queue q) { +int q_maxlength(queue_c q) { return q->n-1; } -int q_next(int i,void **kvptr,int *kiptr,double *kdptr,Q_LONGLONG *klptr,void **xptr,queue q) { +int q_next(int i,void **kvptr,int *kiptr,double *kdptr,Q_LONGLONG *klptr,void **xptr,queue_c q) { int f,b; f=q->f; diff --git a/smoldyn-2.38/source/lib/queue.h b/smoldyn-2.38/source/lib/queue.h index 80909c640..f4828445e 100644 --- a/smoldyn-2.38/source/lib/queue.h +++ b/smoldyn-2.38/source/lib/queue.h @@ -30,25 +30,25 @@ typedef struct qstruct{ void **x; int n; int f; - int b; } *queue; + int b; } *queue_c; #define q_frontkeyV(q) ((q)->b==(q)->f?NULL:(q)->kv[(q)->f]) #define q_frontkeyI(q) ((q)->b==(q)->f?0:(q)->ki[(q)->f]) #define q_frontkeyD(q) ((q)->b==(q)->f?0:(q)->kd[(q)->f]) #define q_frontkeyL(q) ((q)->b==(q)->f?0:(q)->kl[(q)->f]) -queue q_alloc(int n,enum Q_types type,int (*keycmp)(void *,void *)); -int q_expand(queue q,int addspace); -void q_free(queue q,int freek,int freex); -void q_null(queue q); -int q_enqueue(void *kv,int ki,double kd,Q_LONGLONG kl,void *x,queue q); -int q_push(void *kv,int ki,double kd,Q_LONGLONG kl,void *x,queue q); -int q_insert(void *kv,int ki,double kd,Q_LONGLONG kl,void *x,queue q); -void q_front(queue q,void **kvptr,int *kiptr,double *kdptr,Q_LONGLONG *klptr,void **xptr); -int q_pop(queue q,void **kvptr,int *kiptr,double *kdptr,Q_LONGLONG *klptr,void **xptr); -int q_length(queue q); -int q_maxlength(queue q); -int q_next(int i,void **kvptr,int *kiptr,double *kdptr,Q_LONGLONG *klptr,void **xptr,queue q); +queue_c q_alloc(int n,enum Q_types type,int (*keycmp)(void *,void *)); +int q_expand(queue_c q,int addspace); +void q_free(queue_c q,int freek,int freex); +void q_null(queue_c q); +int q_enqueue(void *kv,int ki,double kd,Q_LONGLONG kl,void *x,queue_c q); +int q_push(void *kv,int ki,double kd,Q_LONGLONG kl,void *x,queue_c q); +int q_insert(void *kv,int ki,double kd,Q_LONGLONG kl,void *x,queue_c q); +void q_front(queue_c q,void **kvptr,int *kiptr,double *kdptr,Q_LONGLONG *klptr,void **xptr); +int q_pop(queue_c q,void **kvptr,int *kiptr,double *kdptr,Q_LONGLONG *klptr,void **xptr); +int q_length(queue_c q); +int q_maxlength(queue_c q); +int q_next(int i,void **kvptr,int *kiptr,double *kdptr,Q_LONGLONG *klptr,void **xptr,queue_c q); #endif