From 9346d68aab1a19cbedcc7e9ff0d322bcf8dbfe5e Mon Sep 17 00:00:00 2001 From: "benjamin.franksen" <benjamin.franksen@helmholtz-berlin.de> Date: Wed, 9 Oct 2013 20:31:11 +0000 Subject: [PATCH] cleaned up compatibility macros and moved them to one place in seqCom.h --- src/seq/seqCom.h | 27 +++++++++++++-------------- src/snc/gen_code.c | 2 +- src/snc/gen_code.h | 4 ++-- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/seq/seqCom.h b/src/seq/seqCom.h index 6fae624a..3aaa6e0a 100644 --- a/src/seq/seqCom.h +++ b/src/seq/seqCom.h @@ -41,8 +41,6 @@ extern "C" { #define NOEVFLAG 0 /* argument to pvSync to remove sync */ -#define DEFAULT_QUEUE_SIZE 100 /* default queue size (elements) */ - #define DEFAULT_TIMEOUT 10.0 /* default timeout for SYNC operations */ /* I/O completion type (extra argument passed to seq_pvGet() and seq_pvPut()) */ @@ -53,17 +51,15 @@ enum compType { }; typedef struct state_set *const SS_ID; /* state set id, opaque */ -typedef struct UserVar SEQ_VARS; /* defined by program, opaque */ -typedef char string[MAX_STRING_SIZE]; /* the string typedef */ - -typedef SEQ_VARS USER_VAR; /* for compatibility */ +typedef struct _seq_vars SEQ_VARS; /* struct defined in generated code */ +typedef char string[MAX_STRING_SIZE]; /* representation of SNL string type */ /* these typedefs make the code more self documenting */ typedef unsigned EV_ID; /* identifier for an event */ typedef unsigned VAR_ID; /* identifier for a pv */ typedef int seqBool; -typedef struct seqProgram seqProgram; /* program object, opaque */ +typedef struct seqProgram seqProgram; /* struct defined in generated code */ /* * Function declarations for interface between state program & sequencer. @@ -82,8 +78,6 @@ epicsShareFunc pvStat seq_pvGetMultiple(SS_ID, VAR_ID, unsigned, enum compType); epicsShareFunc seqBool seq_pvGetQ(SS_ID, VAR_ID); epicsShareFunc void seq_pvFlushQ(SS_ID, VAR_ID); -/* retain seq_pvFreeQ for compatibility */ -#define seq_pvFreeQ seq_pvFlushQ epicsShareFunc pvStat seq_pvPut(SS_ID, VAR_ID, enum compType, double tmo); epicsShareFunc pvStat seq_pvPutMultiple(SS_ID, VAR_ID, unsigned, enum compType); @@ -109,11 +103,7 @@ epicsShareFunc seqBool seq_pvConnected(SS_ID, VAR_ID); #define seq_pvIndex(ssId, varId) varId #define seq_ssId(ssId) _seq_ss -#define seq_pVar(ssId) _seq_vars - -/* for backwards compatibility */ -#define ssId _seq_ss -#define pVar _seq_vars +#define seq_pVar(ssId) _seq_var /* global operations */ epicsShareFunc void seq_pvFlush(SS_ID); @@ -135,6 +125,15 @@ epicsShareFunc void seqQueueShow(epicsThreadId); epicsShareFunc void seqStop(epicsThreadId); epicsShareFunc epicsThreadId seq(seqProgram *, const char *, unsigned); +/* backwards compatibility macros */ +/* DEPRECATED don't use in new code */ +#define ssId _seq_ss +#define pVar _seq_var +#define USER_VAR SEQ_VARS +#define UserVar _seq_vars +#define seq_pvFreeQ seq_pvFlushQ +#define DEFAULT_QUEUE_SIZE 100 /* number of elements */ + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/snc/gen_code.c b/src/snc/gen_code.c index 5d1a09af..302d70a0 100644 --- a/src/snc/gen_code.c +++ b/src/snc/gen_code.c @@ -152,7 +152,7 @@ static void gen_func_decls(Expr *prog) } } -/* Generate the UserVar struct containing all program variables with +/* Generate the struct containing all program variables with 'infinite' (global) lifetime. These are: variables declared at the top-level, inside a state set, and inside a state. Note that state set and state local variables are _visible_ only inside the block diff --git a/src/snc/gen_code.h b/src/snc/gen_code.h index ca7eb033..fdbecfc1 100644 --- a/src/snc/gen_code.h +++ b/src/snc/gen_code.h @@ -20,8 +20,8 @@ void gen_defn_c_code(Expr *scope, int level); void gen_var_decl(Var *vp); void indent(int level); -#define NM_VARS "UserVar" -#define NM_VARS_ARG "_seq_vars" +#define NM_VARS "_seq_vars" +#define NM_VARS_ARG "_seq_var" #define NM_INITVAR "_seq_initvar_" #define NM_CHANS "_seq_chans" #define NM_STATES "_seq_states" -- GitLab