Merging with Laurent's repository.
--- a/lib/accessor.h Tue Sep 27 00:07:16 2011 +0200
+++ b/lib/accessor.h Wed Feb 01 13:01:08 2012 +0000
@@ -32,6 +32,8 @@
type* __GET_GLOBAL_##name(void) {\
return (*GLOBAL__##name).value;\
}
+#define __DECLARE_GLOBAL_PROTOTYPE(type, name)\
+ extern type* __GET_GLOBAL_##name();
#define __DECLARE_EXTERNAL(type, name)\
__IEC_##type##_p name;
#define __DECLARE_LOCATED(type, name)\
@@ -55,7 +57,6 @@
__INIT_RETAIN(domain##__##name, retained)
#define __INIT_EXTERNAL(type, global, name, retained)\
{\
- extern type* __GET_GLOBAL_##global();\
name.value = __GET_GLOBAL_##global();\
__INIT_RETAIN(name, retained)\
}
@@ -73,15 +74,15 @@
#define __GET_VAR(name, ...)\
name.value __VA_ARGS__
#define __GET_EXTERNAL(name, ...)\
- ((name.flags & __IEC_FORCE_FLAG) ? name.fvalue __VA_ARGS__ : *(name.value) __VA_ARGS__)
+ ((name.flags & __IEC_FORCE_FLAG) ? name.fvalue __VA_ARGS__ : (*(name.value)) __VA_ARGS__)
#define __GET_LOCATED(name, ...)\
- ((name.flags & __IEC_FORCE_FLAG) ? name.fvalue __VA_ARGS__ : *(name.value) __VA_ARGS__)
+ ((name.flags & __IEC_FORCE_FLAG) ? name.fvalue __VA_ARGS__ : (*(name.value)) __VA_ARGS__)
#define __GET_VAR_BY_REF(name, ...)\
((name.flags & __IEC_FORCE_FLAG) ? &(name.fvalue __VA_ARGS__) : &(name.value __VA_ARGS__))
#define __GET_EXTERNAL_BY_REF(name, ...)\
- ((name.flags & __IEC_FORCE_FLAG) ? &(name.fvalue __VA_ARGS__) : &(*(name.value) __VA_ARGS__))
+ ((name.flags & __IEC_FORCE_FLAG) ? &(name.fvalue __VA_ARGS__) : &((*(name.value)) __VA_ARGS__))
#define __GET_LOCATED_BY_REF(name, ...)\
- ((name.flags & __IEC_FORCE_FLAG) ? &(name.fvalue __VA_ARGS__) : &(*(name.value) __VA_ARGS__))
+ ((name.flags & __IEC_FORCE_FLAG) ? &(name.fvalue __VA_ARGS__) : &((*(name.value)) __VA_ARGS__))
// variable setting macros
#define __SET_VAR(prefix, name, new_value, ...)\
--- a/lib/iec_std_lib.h Tue Sep 27 00:07:16 2011 +0200
+++ b/lib/iec_std_lib.h Wed Feb 01 13:01:08 2012 +0000
@@ -631,10 +631,9 @@
/* some helpful __move_[ANY] functions, used in the *_TO_** and MOVE standard functions */
/* e.g. __move_BOOL, __move_BYTE, __move_REAL, __move_TIME, ... */
-#define __iec_(TYPENAME)\
+#define __move_(TYPENAME)\
static inline TYPENAME __move_##TYPENAME(TYPENAME op1) {return op1;}
-__ANY(__iec_)
-#undef __iec_
+__ANY(__move_)
@@ -692,6 +691,7 @@
/********************/
#define EN_ENO_PARAMS BOOL EN, BOOL *ENO
+#define EN_ENO EN, ENO
#define TEST_EN(TYPENAME)\
if (!EN) {\
@@ -939,9 +939,14 @@
#define __numeric(fname,TYPENAME, FUNC) \
+/* explicitly typed function */\
static inline TYPENAME fname##TYPENAME(EN_ENO_PARAMS, TYPENAME op){\
TEST_EN(TYPENAME)\
return FUNC(op);\
+}\
+/* overloaded function */\
+static inline TYPENAME fname##_##TYPENAME##__##TYPENAME(EN_ENO_PARAMS, TYPENAME op) {\
+ return fname##TYPENAME(EN_ENO, op);\
}
/******************************************************************/
@@ -951,172 +956,108 @@
/**************/
/* ABS */
/**************/
-/* explicitly typed function */
-#define __iec_(TYPENAME) \
+#define __abs_signed(TYPENAME) \
+/* explicitly typed function */\
static inline TYPENAME ABS_##TYPENAME(EN_ENO_PARAMS, TYPENAME op){\
TEST_EN(TYPENAME)\
if (op < 0)\
return -op;\
return op;\
-}
-__ANY_REAL(__iec_)
-__ANY_SINT(__iec_)
-#undef __iec_
-
-#define __iec_(TYPENAME) \
+}\
+/* overloaded function */\
+static inline TYPENAME ABS__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS, TYPENAME op) {\
+ return ABS_##TYPENAME(EN_ENO, op);\
+}
+
+#define __abs_unsigned(TYPENAME) \
+/* explicitly typed function */\
static inline TYPENAME ABS_##TYPENAME(EN_ENO_PARAMS, TYPENAME op){\
TEST_EN(TYPENAME)\
return op;\
-}
-__ANY_UINT(__iec_)
-#undef __iec_
-
-/* overloaded function */
-#define __iec_(TYPENAME) \
-static inline TYPENAME ABS__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS, TYPENAME op){\
- TEST_EN(TYPENAME)\
- if (op < 0)\
- return -op;\
- return op;\
-}
-__ANY_REAL(__iec_)
-__ANY_SINT(__iec_)
-#undef __iec_
-
-#define __iec_(TYPENAME) \
-static inline TYPENAME ABS__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS, TYPENAME op){\
- TEST_EN(TYPENAME)\
- return op;\
-}
-__ANY_UINT(__iec_)
-#undef __iec_
+}\
+/* overloaded function */\
+static inline TYPENAME ABS__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS, TYPENAME op) {\
+ return ABS_##TYPENAME(EN_ENO, op);\
+}
+
+__ANY_REAL(__abs_signed)
+__ANY_SINT(__abs_signed)
+__ANY_UINT(__abs_unsigned)
/**************/
/* SQRT */
/**************/
-/* explicitly typed function */
-#define __iec_(TYPENAME) \
-__numeric(SQRT_, TYPENAME, sqrt) /* explicitly typed function */\
-__numeric(SQRT__##TYPENAME##__, TYPENAME, sqrt) /* overloaded function */
-__ANY_REAL(__iec_)
-#undef __iec_
-
- /**************/
+#define __sqrt(TYPENAME) __numeric(SQRT_, TYPENAME, sqrt)
+__ANY_REAL(__sqrt)
+
+
+/**************/
/* LN */
/**************/
-#define __iec_(TYPENAME) \
-__numeric(LN_, TYPENAME, log) /* explicitly typed function */\
-__numeric(LN__##TYPENAME##__, TYPENAME, log) /* overloaded function */
-__ANY_REAL(__iec_)
-#undef __iec_
+#define __ln(TYPENAME) __numeric(LN_, TYPENAME, log)
+__ANY_REAL(__ln)
/**************/
/* LOG */
/**************/
-#define __iec_(TYPENAME) \
-__numeric(LOG_, TYPENAME, log10) /* explicitly typed function */\
-__numeric(LOG__##TYPENAME##__, TYPENAME, log10) /* overloaded function */
-__ANY_REAL(__iec_)
-#undef __iec_
+#define __log(TYPENAME) __numeric(LOG_, TYPENAME, log10)
+__ANY_REAL(__log)
+
/**************/
/* EXP */
/**************/
-#define __iec_(TYPENAME) \
-__numeric(EXP_, TYPENAME, exp) /* explicitly typed function */\
-__numeric(EXP__##TYPENAME##__, TYPENAME, exp) /* overloaded function */
-__ANY_REAL(__iec_)
-#undef __iec_
+#define __exp(TYPENAME) __numeric(EXP_, TYPENAME, exp)
+__ANY_REAL(__exp)
/**************/
/* SIN */
/**************/
-#define __iec_(TYPENAME) \
-__numeric(SIN_, TYPENAME, sin) /* explicitly typed function */\
-__numeric(SIN__##TYPENAME##__, TYPENAME, sin) /* overloaded function */
-__ANY_REAL(__iec_)
-#undef __iec_
+#define __sin(TYPENAME) __numeric(SIN_, TYPENAME, sin)
+__ANY_REAL(__sin)
/**************/
/* COS */
/**************/
-#define __iec_(TYPENAME) \
-__numeric(COS_, TYPENAME, cos) /* explicitly typed function */\
-__numeric(COS__##TYPENAME##__, TYPENAME, cos) /* overloaded function */
-__ANY_REAL(__iec_)
-#undef __iec_
+#define __cos(TYPENAME) __numeric(COS_, TYPENAME, cos)
+__ANY_REAL(__cos)
/**************/
/* TAN */
/**************/
-#define __iec_(TYPENAME) \
-__numeric(TAN_, TYPENAME, tan) /* explicitly typed function */\
-__numeric(TAN__##TYPENAME##__, TYPENAME, tan) /* overloaded function */
-__ANY_REAL(__iec_)
-#undef __iec_
+#define __tan(TYPENAME) __numeric(TAN_, TYPENAME, tan)
+__ANY_REAL(__tan)
/**************/
/* ASIN */
/**************/
-#define __iec_(TYPENAME) \
-__numeric(ASIN_, TYPENAME, asin) /* explicitly typed function */\
-__numeric(ASIN__##TYPENAME##__, TYPENAME, asin) /* overloaded function */
-__ANY_REAL(__iec_)
-#undef __iec_
+#define __asin(TYPENAME) __numeric(ASIN_, TYPENAME, asin)
+__ANY_REAL(__asin)
/**************/
/* ACOS */
/**************/
-#define __iec_(TYPENAME) \
-__numeric(ACOS_, TYPENAME, acos) /* explicitly typed function */\
-__numeric(ACOS__##TYPENAME##__, TYPENAME, acos) /* overloaded function */
-__ANY_REAL(__iec_)
-#undef __iec_
+#define __acos(TYPENAME) __numeric(ACOS_, TYPENAME, acos)
+__ANY_REAL(__acos)
/**************/
/* ATAN */
/**************/
-#define __iec_(TYPENAME) \
-__numeric(ATAN_, TYPENAME, atan) /* explicitly typed function */\
-__numeric(ATAN__##TYPENAME##__, TYPENAME, atan) /* overloaded function */
-__ANY_REAL(__iec_)
-#undef __iec_
+#define __atan(TYPENAME) __numeric(ATAN_, TYPENAME, atan)
+__ANY_REAL(__atan)
/*****************************************************/
/*** Table 24 - Standard arithmetic functions ***/
/*****************************************************/
-/*
- Unfortunately, the following does not work!!
-
-#define NUMARGS(...) (sizeof((int[]){__VA_ARGS__})/sizeof(int))
-
-#define __arith_expand(fname,TYPENAME, OP) \
-#define fname(EN, ENO, ...) fname__(EN, ENO, NUMARGS(__VA_ARGS__), __VA_ARGS__)\
-static inline TYPENAME fname__(EN_ENO_PARAMS, UINT param_count, TYPENAME op1, ...){\
- va_list ap;\
- UINT i;\
- TEST_EN(TYPENAME)\
- \
- va_start (ap, op1); \
- \
- for (i = 0; i < param_count - 1; i++){\
- op1 = op1 OP va_arg (ap, VA_ARGS_##TYPENAME);\
- }\
- \
- va_end (ap); \
- return op1;\
-}
-*/
-
-
-#define __arith_expand(fname,TYPENAME, OP) \
+
+#define __arith_expand(fname,TYPENAME, OP)\
static inline TYPENAME fname(EN_ENO_PARAMS, UINT param_count, TYPENAME op1, ...){\
va_list ap;\
UINT i;\
@@ -1132,69 +1073,72 @@
return op1;\
}
-#define __arith_static(fname,TYPENAME, OP) \
-static inline TYPENAME fname(EN_ENO_PARAMS, TYPENAME op1, TYPENAME op2){\
+#define __arith_static(fname,TYPENAME, OP)\
+/* explicitly typed function */\
+static inline TYPENAME fname##TYPENAME(EN_ENO_PARAMS, TYPENAME op1, TYPENAME op2){\
TEST_EN(TYPENAME)\
return op1 OP op2;\
+}\
+/* overloaded function */\
+static inline TYPENAME fname##_##TYPENAME##__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS, TYPENAME op1, TYPENAME op2){\
+ return fname##TYPENAME(EN_ENO, op1, op2);\
}
/**************/
/* ADD */
/**************/
-#define __iec_(TYPENAME) \
+#define __add(TYPENAME) \
__arith_expand(ADD_##TYPENAME, TYPENAME, +) /* explicitly typed function */\
__arith_expand(ADD__##TYPENAME##__##TYPENAME, TYPENAME, +) /* overloaded function */
-__ANY_NUM(__iec_)
-#undef __iec_
+__ANY_NUM(__add)
+
/**************/
/* MUL */
/**************/
-#define __iec_(TYPENAME) \
+#define __mul(TYPENAME) \
__arith_expand(MUL_##TYPENAME, TYPENAME, *) /* explicitly typed function */\
__arith_expand(MUL__##TYPENAME##__##TYPENAME, TYPENAME, *) /* overloaded function */
-__ANY_NUM(__iec_)
-#undef __iec_
+__ANY_NUM(__mul)
+
/**************/
/* SUB */
/**************/
-#define __iec_(TYPENAME) \
-__arith_expand(SUB_##TYPENAME, TYPENAME, -) /* explicitly typed function */\
-__arith_expand(SUB__##TYPENAME##__##TYPENAME##__##TYPENAME, TYPENAME, -) /* overloaded function */
-__ANY_NUM(__iec_)
-#undef __iec_
+#define __sub(TYPENAME) __arith_static(SUB_, TYPENAME, -)
+__ANY_NUM(__sub)
+
/**************/
/* DIV */
/**************/
-/* The explicitly typed standard functions */
-#define __iec_(TYPENAME)\
+#define __div(TYPENAME)\
+/* The explicitly typed standard functions */\
static inline TYPENAME DIV_##TYPENAME(EN_ENO_PARAMS, TYPENAME op1, TYPENAME op2){\
TEST_EN_COND(TYPENAME, op2 == 0)\
return op1 / op2;\
-}
-__ANY_NUM(__iec_)
-#undef __iec_
-
-/* The overloaded standard functions */
-#define __iec_(TYPENAME)\
+}\
+/* The overloaded standard functions */\
static inline TYPENAME DIV__##TYPENAME##__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS, TYPENAME op1, TYPENAME op2){\
+ return DIV_##TYPENAME(EN_ENO, op1, op2);\
+}
+__ANY_NUM(__div)
+
+
+ /**************/
+ /* MOD */
+ /**************/
+#define __mod(TYPENAME)\
+/* The explicitly typed standard functions */\
+static inline TYPENAME MOD_##TYPENAME(EN_ENO_PARAMS, TYPENAME op1, TYPENAME op2){\
TEST_EN_COND(TYPENAME, op2 == 0)\
- return op1 / op2;\
-}
-__ANY_NUM(__iec_)
-#undef __iec_
-
- /**************/
- /* MOD */
- /**************/
-/* The explicitly typed standard functions */
-#define __iec_(TYPENAME)\
-__arith_expand(MOD_##TYPENAME, TYPENAME, %) /* explicitly typed function */\
-__arith_expand(MOD__##TYPENAME##__##TYPENAME##__##TYPENAME, TYPENAME, %) /* overloaded function */
-__ANY_INT(__iec_)
-#undef __iec_
+ return op1 % op2;\
+}\
+/* The overloaded standard functions */\
+static inline TYPENAME MOD__##TYPENAME##__##TYPENAME##__##TYPENAME(EN_ENO_PARAMS, TYPENAME op1, TYPENAME op2){\
+ return DIV_##TYPENAME(EN_ENO, op1, op2);\
+}
+__ANY_INT(__mod)
/**************/
/* EXPT */
--- a/lib/iec_types_all.h Tue Sep 27 00:07:16 2011 +0200
+++ b/lib/iec_types_all.h Wed Feb 01 13:01:08 2012 +0000
@@ -97,6 +97,7 @@
typedef struct {\
type *value;\
IEC_BYTE flags;\
+ type fvalue;\
} __IEC_##type##_p;
#define __DECLARE_ENUMERATED_TYPE(type, ...)\
--- a/stage4/generate_c/generate_c.cc Tue Sep 27 00:07:16 2011 +0200
+++ b/stage4/generate_c/generate_c.cc Wed Feb 01 13:01:08 2012 +0000
@@ -104,6 +104,7 @@
#define DECLARE_GLOBAL_LOCATED "__DECLARE_GLOBAL_LOCATED"
#define DECLARE_EXTERNAL "__DECLARE_EXTERNAL"
#define DECLARE_LOCATED "__DECLARE_LOCATED"
+#define DECLARE_GLOBAL_PROTOTYPE "__DECLARE_GLOBAL_PROTOTYPE"
/* Variable declaration symbol for accessor macros */
#define INIT_VAR "__INIT_VAR"
@@ -126,6 +127,8 @@
#define SET_EXTERNAL "__SET_EXTERNAL"
#define SET_LOCATED "__SET_LOCATED"
+/* Variable initial value symbol for accessor macros */
+#define INITIAL_VALUE "__INITIAL_VALUE"
/* Generate a name for a temporary variable.
* Each new name generated is appended a different number,
@@ -1558,11 +1561,13 @@
class generate_c_config_c: public generate_c_typedecl_c {
private:
stage4out_c *s4o_ptr;
-
+ stage4out_c *s4o_incl_ptr;
+
public:
- generate_c_config_c(stage4out_c *s4o_ptr)
- : generate_c_typedecl_c(s4o_ptr) {
+ generate_c_config_c(stage4out_c *s4o_ptr, stage4out_c *s4o_incl_ptr)
+ : generate_c_typedecl_c(s4o_ptr, s4o_incl_ptr) {
generate_c_config_c::s4o_ptr = s4o_ptr;
+ generate_c_config_c::s4o_incl_ptr = s4o_incl_ptr;
};
virtual ~generate_c_config_c(void) {}
@@ -1581,8 +1586,17 @@
/********************/
/* 2.1.6 - Pragmas */
/********************/
-void *visit(enable_code_generation_pragma_c * symbol) {s4o_ptr->enable_output(); return NULL;}
-void *visit(disable_code_generation_pragma_c * symbol) {s4o_ptr->disable_output(); return NULL;}
+void *visit(enable_code_generation_pragma_c * symbol) {
+ s4o_ptr->enable_output();
+ s4o_incl_ptr->enable_output();
+ return NULL;
+}
+
+void *visit(disable_code_generation_pragma_c * symbol) {
+ s4o_ptr->disable_output();
+ s4o_incl_ptr->disable_output();
+ return NULL;
+}
/********************************/
@@ -1626,6 +1640,15 @@
delete vardecl;
s4o.print("\n");
+ /* (A.3) Declare global prototypes in include file */
+ vardecl = new generate_c_vardecl_c(&s4o_incl,
+ generate_c_vardecl_c::globalprototype_vf,
+ generate_c_vardecl_c::global_vt,
+ symbol->configuration_name);
+ vardecl->print(symbol);
+ delete vardecl;
+ s4o_incl.print("\n");
+
/* (B) Initialisation Function */
/* (B.1) Ressources initialisation protos... */
wanted_declaretype = initprotos_dt;
@@ -1755,20 +1778,24 @@
private:
/* The name of the resource curretnly being processed... */
+ symbol_c *current_configuration;
symbol_c *current_resource_name;
symbol_c *current_task_name;
symbol_c *current_global_vars;
+ bool configuration_name;
stage4out_c *s4o_ptr;
public:
generate_c_resources_c(stage4out_c *s4o_ptr, symbol_c *config_scope, symbol_c *resource_scope, unsigned long time)
: generate_c_typedecl_c(s4o_ptr) {
+ current_configuration = config_scope;
search_config_instance = new search_var_instance_decl_c(config_scope);
search_resource_instance = new search_var_instance_decl_c(resource_scope);
common_ticktime = time;
current_resource_name = NULL;
current_task_name = NULL;
current_global_vars = NULL;
+ configuration_name = false;
generate_c_resources_c::s4o_ptr = s4o_ptr;
};
@@ -1821,6 +1848,20 @@
return NULL;
}
+ /*************************/
+ /* B.1 - Common elements */
+ /*************************/
+ /*******************************************/
+ /* B 1.1 - Letters, digits and identifiers */
+ /*******************************************/
+
+ void *visit(identifier_c *symbol) {
+ if (configuration_name)
+ s4o.print(symbol->value);
+ else
+ generate_c_base_c::visit(symbol);
+ return NULL;
+ }
/********************/
/* 2.1.6 - Pragmas */
@@ -1848,9 +1889,13 @@
return NULL;
}
-/********************************/
-/* B 1.7 Configuration elements */
-/********************************/
+ /********************************/
+ /* B 1.7 Configuration elements */
+ /********************************/
+
+ void *visit(configuration_declaration_c *symbol) {
+ return symbol->configuration_name->accept(*this);
+ }
/*
RESOURCE resource_name ON resource_type_name
@@ -1893,8 +1938,13 @@
s4o.print("extern unsigned long long common_ticktime__;\n\n");
- s4o.print("#include \"accessor.h\"\n\n");
+ s4o.print("#include \"accessor.h\"\n");
s4o.print("#include \"POUS.h\"\n\n");
+ s4o.print("#include \"");
+ configuration_name = true;
+ current_configuration->accept(*this);
+ configuration_name = false;
+ s4o.print(".h\"\n");
/* (A.2) Global variables... */
if (current_global_vars != NULL) {
@@ -2329,7 +2379,10 @@
generate_var_list_c generate_var_list(&variables_s4o, symbol);
generate_var_list.generate_programs(symbol);
generate_var_list.generate_variables(symbol);
-
+ variables_s4o.print("\n// Ticktime\n");
+ variables_s4o.print_long_long_integer(common_ticktime, false);
+ variables_s4o.print("\n");
+
generate_location_list_c generate_location_list(&located_variables_s4o);
symbol->accept(generate_location_list);
return NULL;
@@ -2446,9 +2499,10 @@
}
symbol->configuration_name->accept(*this);
-
+
stage4out_c config_s4o(current_builddir, current_name, "c");
- generate_c_config_c generate_c_config(&config_s4o);
+ stage4out_c config_incl_s4o(current_builddir, current_name, "h");
+ generate_c_config_c generate_c_config(&config_s4o, &config_incl_s4o);
symbol->accept(generate_c_config);
config_s4o.print("unsigned long long common_ticktime__ = ");
--- a/stage4/generate_c/generate_c_vardecl.cc Tue Sep 27 00:07:16 2011 +0200
+++ b/stage4/generate_c/generate_c_vardecl.cc Wed Feb 01 13:01:08 2012 +0000
@@ -811,7 +811,8 @@
localinit_vf,
init_vf,
constructorinit_vf,
- globalinit_vf
+ globalinit_vf,
+ globalprototype_vf,
} varformat_t;
@@ -1991,14 +1992,29 @@
symbol->global_var_name->accept(*this);
else
symbol->location->accept(*this);
- s4o.print(",__INITIAL_VALUE(");
+ s4o.print(",");
+ s4o.print(INITIAL_VALUE);
+ s4o.print("(");
this->current_var_init_symbol->accept(*this);
s4o.print(")");
print_retain();
s4o.print(")");
}
break;
-
+
+ case globalprototype_vf:
+ s4o.print(s4o.indent_spaces);
+ s4o.print(DECLARE_GLOBAL_PROTOTYPE);
+ s4o.print("(");
+ this->current_var_type_symbol->accept(*this);
+ s4o.print(",");
+ if (symbol->global_var_name != NULL)
+ symbol->global_var_name->accept(*this);
+ else
+ symbol->location->accept(*this);
+ s4o.print(")\n");
+ break;
+
default:
ERROR;
} /* switch() */
@@ -2052,7 +2068,9 @@
this->current_var_type_symbol->accept(*this);
s4o.print(",");
list->elements[i]->accept(*this);
- s4o.print(",__INITIAL_VALUE(");
+ s4o.print(",");
+ s4o.print(INITIAL_VALUE);
+ s4o.print("(");
this->current_var_init_symbol->accept(*this);
s4o.print(")");
print_retain();
@@ -2084,6 +2102,18 @@
}
break;
+ case globalprototype_vf:
+ for(int i = 0; i < list->n; i++) {
+ s4o.print(s4o.indent_spaces);
+ s4o.print(DECLARE_GLOBAL_PROTOTYPE);
+ s4o.print("(");
+ this->current_var_type_symbol->accept(*this);
+ s4o.print(",");
+ list->elements[i]->accept(*this);
+ s4o.print(")\n");
+ }
+ break;
+
default:
ERROR; /* not supported, and not needed either... */
}
--- a/stage4/stage4.cc Tue Sep 27 00:07:16 2011 +0200
+++ b/stage4/stage4.cc Wed Feb 01 13:01:08 2012 +0000
@@ -127,15 +127,17 @@
return NULL;
}
-void *stage4out_c::print_long_integer(unsigned long l_integer) {
- if (!allow_output) return NULL;
- *out << l_integer << "UL";
- return NULL;
-}
-
-void *stage4out_c::print_long_long_integer(unsigned long long ll_integer) {
- if (!allow_output) return NULL;
- *out << ll_integer << "ULL";
+void *stage4out_c::print_long_integer(unsigned long l_integer, bool suffix) {
+ if (!allow_output) return NULL;
+ *out << l_integer;
+ if (suffix) *out << "UL";
+ return NULL;
+}
+
+void *stage4out_c::print_long_long_integer(unsigned long long ll_integer, bool suffix) {
+ if (!allow_output) return NULL;
+ *out << ll_integer;
+ if (suffix) *out << "ULL";
return NULL;
}
--- a/stage4/stage4.hh Tue Sep 27 00:07:16 2011 +0200
+++ b/stage4/stage4.hh Wed Feb 01 13:01:08 2012 +0000
@@ -61,8 +61,8 @@
void *print(std::string str);
void *print_integer(int integer);
- void *print_long_integer(unsigned long l_integer);
- void *print_long_long_integer(unsigned long long ll_integer);
+ void *print_long_integer(unsigned long l_integer, bool suffix=true);
+ void *print_long_long_integer(unsigned long long ll_integer, bool suffix=true);
void *printupper(const char *str);
void *printupper(std::string str);