Skip to content

Commit

Permalink
rename smoldyn queue to queue_c to avoid conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
jcschaff committed May 25, 2024
1 parent 89a5810 commit 06d3c07
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion smoldyn-2.38/source/lib/SimCommand.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
4 changes: 2 additions & 2 deletions smoldyn-2.38/source/lib/SimCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 14 additions & 14 deletions smoldyn-2.38/source/lib/queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
26 changes: 13 additions & 13 deletions smoldyn-2.38/source/lib/queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 06d3c07

Please sign in to comment.