From a7e41c9fef2e475bafdc5aaf50bffd02bab295ab Mon Sep 17 00:00:00 2001 From: "benjamin.franksen" <benjamin.franksen@helmholtz-berlin.de> Date: Wed, 2 Oct 2013 01:23:41 +0000 Subject: [PATCH] restore compatibility of C code (UserVar, ssId, pVar) --- src/seq/seqCom.h | 10 +++++++--- src/snc/gen_code.h | 3 ++- src/snc/gen_ss_code.c | 8 ++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/seq/seqCom.h b/src/seq/seqCom.h index ae2743b1..555b71e9 100644 --- a/src/seq/seqCom.h +++ b/src/seq/seqCom.h @@ -53,7 +53,7 @@ enum compType { }; typedef struct state_set *const SS_ID; /* state set id, opaque */ -typedef struct _seq_var SEQ_VARS; /* defined by program, 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 */ @@ -108,8 +108,12 @@ epicsShareFunc seqBool seq_pvAssigned(SS_ID, VAR_ID); epicsShareFunc seqBool seq_pvConnected(SS_ID, VAR_ID); #define seq_pvIndex(ssId, varId) varId -#define seq_ssId(ssId) ssId -#define seq_pVar(ssId) _seq_var +#define seq_ssId(ssId) _seq_ss +#define seq_pVar(ssId) _seq_vars + +/* for backwards compatibility */ +#define ssId _seq_ss +#define pVar _seq_vars /* global operations */ epicsShareFunc void seq_pvFlush(SS_ID); diff --git a/src/snc/gen_code.h b/src/snc/gen_code.h index b24583a1..ca7eb033 100644 --- a/src/snc/gen_code.h +++ b/src/snc/gen_code.h @@ -20,7 +20,8 @@ void gen_defn_c_code(Expr *scope, int level); void gen_var_decl(Var *vp); void indent(int level); -#define NM_VARS "_seq_var" +#define NM_VARS "UserVar" +#define NM_VARS_ARG "_seq_vars" #define NM_INITVAR "_seq_initvar_" #define NM_CHANS "_seq_chans" #define NM_STATES "_seq_states" diff --git a/src/snc/gen_ss_code.c b/src/snc/gen_ss_code.c index 243d50ca..3c773735 100644 --- a/src/snc/gen_ss_code.c +++ b/src/snc/gen_ss_code.c @@ -187,7 +187,7 @@ static void gen_state_func( { gen_code("\n/* %s function for state \"%s\" in state set \"%s\" */\n", title, state_name, ss_name); - gen_code("static %s %s_%s_%d_%s(SS_ID " NM_SS ", SEQ_VARS *const " NM_VARS "%s)\n{\n", + gen_code("static %s %s_%s_%d_%s(SS_ID " NM_SS ", SEQ_VARS *const " NM_VARS_ARG "%s)\n{\n", rettype, prefix, ss_name, ss_num, state_name, extra_args); gen_body(xp, context); gen_code("}\n"); @@ -298,7 +298,7 @@ static void gen_event_body(Expr *xp, int context) static void gen_var_access(Var *vp) { - const char *pre = global_opt_reent ? NM_VARS "->" : ""; + const char *pre = global_opt_reent ? NM_VARS_ARG "->" : ""; assert(vp); assert(vp->scope); @@ -875,7 +875,7 @@ static void gen_prog_func( assert(prog->type == D_PROG); gen_code("\n/* Program %s func */\n", doc); gen_code("static void %s(PROG_ID "NM_PROG - ", struct "NM_VARS" *const "NM_VARS")\n{\n", + ", SEQ_VARS *const "NM_VARS_ARG")\n{\n", name); gen_body(prog); gen_code("}\n"); @@ -890,7 +890,7 @@ static void gen_prog_entex_func( { assert(prog->type == D_PROG); gen_code("\n/* Program %s func */\n", doc); - gen_code("static void %s(SS_ID " NM_SS ", SEQ_VARS *const " NM_VARS ")\n{\n", + gen_code("static void %s(SS_ID " NM_SS ", SEQ_VARS *const " NM_VARS_ARG ")\n{\n", name); if (prog && gen_body) gen_body(prog); gen_code("}\n"); -- GitLab