--- rpl/src/rplexternals.h 2013/03/27 15:47:36 1.45 +++ rpl/src/rplexternals.h 2013/03/28 16:15:09 1.46 @@ -56,7 +56,7 @@ #define declareComplex(complex) complex16 complex #define declareDaisyChain(daisyChain) struct_liste_chainee *daisyChain = NULL -#define getDaisyChainFromList(list, daisyChain) { \ +#define getDaisyChainFromList(list, daisyChain) do { \ typeof(list) __list = list; \ daisyChain = NULL; \ ifIsList(__list) { daisyChain = (*__list).objet; } \ @@ -79,7 +79,7 @@ (__daisyChain == NULL) ? NULL : (*__daisyChain).suivant; }) #define null NULL -#define nullify(ptr) { ptr = NULL; } while(0) +#define nullify(ptr) do { ptr = NULL; } while(0) #define nullified(ptr) ((ptr) == NULL) #define postIncr(x) (x++) @@ -118,7 +118,7 @@ #define beginGroup { #define endGroup } -#define beginMacro beginGroup +#define beginMacro do beginGroup #define endMacro endGroup while(0) #define stopRequest test_arret((*rpl_arguments).s_etat_processus) @@ -195,7 +195,7 @@ */ #define freeObject(object) \ - { \ + do { \ if (object == NULL) \ systemError("Nullified object"); \ liberation(object); \ @@ -209,7 +209,7 @@ */ #define dupObject(object) \ - { if (copie_objet(object, 'P') != object) \ + do { if (copie_objet(object, 'P') != object) \ systemError("Memory allocation error"); } while(0) /* @@ -310,7 +310,7 @@ #define endExternalFunction return; } -#define callExternalFunction(function) { \ +#define callExternalFunction(function) do { \ __taille_bloc = sizeof(t_8_bits) * 8; \ __indice_bloc = (35 - 1) / __taille_bloc; \ __indice_bit = (35 - 1) % __taille_bloc; \ @@ -337,7 +337,7 @@ -------------------------------------------------------------------------------- */ -#define declareHelpString(h) { \ +#define declareHelpString(h) do { \ __presence_aide = d_vrai; \ if ((*rpl_arguments).affichage_arguments == 'Y') \ { \ @@ -345,12 +345,12 @@ return; \ } } while(0) -#define declareSymbolicConstant { \ +#define declareSymbolicConstant do { \ numberOfArguments(0); \ (*rpl_arguments).constante_symbolique = 'Y'; \ __constante++; } while(0) -#define numberOfArguments(n) { \ +#define numberOfArguments(n) do { \ __presence_validation = d_vrai; \ if ((*rpl_arguments).test_instruction == 'Y') \ { \ @@ -402,25 +402,25 @@ -------------------------------------------------------------------------------- */ -#define returnOnError(...) { \ +#define returnOnError(...) do { \ if ((*rpl_arguments).erreur != 0) \ { \ __VA_ARGS__; \ return; \ } } while(0) -#define systemError(message) { \ +#define systemError(message) do { \ (*rpl_arguments).erreur = __LINE__; \ (*rpl_arguments).type_erreur = 'S'; \ (*rpl_arguments).message_erreur = (unsigned char *) message; \ return; } while(0) -#define executionError(message) { \ +#define executionError(message) do { \ (*rpl_arguments).erreur = __LINE__; \ (*rpl_arguments).type_erreur = 'E'; \ (*rpl_arguments).message_erreur = (unsigned char *) message; } while(0) -#define onSystemError(...) { \ +#define onSystemError(...) do { \ if ((*rpl_arguments).erreur != 0) \ { \ __VA_ARGS__; \ @@ -444,13 +444,13 @@ -------------------------------------------------------------------------------- */ -#define pushOnStack(object) { \ +#define pushOnStack(object) do { \ if (((*rpl_arguments).l_base_pile = \ empilement_pile_operationnelle(rpl_arguments, object)) == NULL) \ systemError("Memory allocation error"); \ if ((*object).nombre_occurrences == 1) object = NULL; } while(0) -#define pullFromStack(object, ...) { \ +#define pullFromStack(object, ...) do { \ (*rpl_arguments).l_base_pile = \ depilement_pile_operationnelle(rpl_arguments, &object); \ if (object == NULL) \ @@ -498,7 +498,7 @@ // Constantes symboliques -#define createSymbolicConstant(object, type, value) { \ +#define createSymbolicConstant(object, type, value) do { \ if ((strcmp(#type, "integer") != 0) && (strcmp(#type, "real") != 0)) \ systemError("Type not allowed for symbolic constant"); \ __taille_bloc = sizeof(t_8_bits) * 8; \ @@ -534,7 +534,7 @@ } \ __constante--; } while(0) -#define createSymbolicComplexConstant(object, rp, ip) { \ +#define createSymbolicComplexConstant(object, rp, ip) do { \ __taille_bloc = sizeof(t_8_bits) * 8; \ __indice_bloc = (35 - 1) / __taille_bloc; \ __indice_bit = (35 - 1) % __taille_bloc; \ @@ -562,7 +562,7 @@ // Integer -#define setInteger(object, value) { \ +#define setInteger(object, value) do { \ ifIsInteger(object) \ { \ if ((*object).nombre_occurrences > 1) \ @@ -583,12 +583,12 @@ #define ifIsInteger(object) if (isInteger(object)) #define elseIfIsInteger(object) } else ifIsInteger(object) -#define getInteger(object, value) { \ +#define getInteger(object, value) do { \ value = 0; \ ifIsInteger(object) value = (*((integer8 *) (*object).objet)); \ else executionError("Type mismatch error"); } while(0) -#define createIntegerObject(object) { \ +#define createIntegerObject(object) do { \ if (object != NULL) \ systemError("Reallocated object"); \ if ((object = allocation(INT)) == NULL) \ @@ -597,7 +597,7 @@ // Real -#define setReal(object, value) { \ +#define setReal(object, value) do { \ ifIsReal(object) \ { \ if ((*object).nombre_occurrences > 1) \ @@ -618,12 +618,12 @@ #define ifIsReal(object) if (isReal(object)) #define elseIfIsReal(object) } else ifIsReal(object) -#define getReal(object, value) { \ +#define getReal(object, value) do { \ value = 0; \ ifIsReal(object) value = (*((real8 *) (*object).objet)); \ else executionError("Type mismatch error"); } while(0) -#define createRealObject(object) { \ +#define createRealObject(object) do { \ if (object != NULL) \ systemError("Reallocated object"); \ if ((object = allocation(REL)) == NULL) \ @@ -632,7 +632,7 @@ // Complex -#define setComplex(object, rp, ip) { \ +#define setComplex(object, rp, ip) do { \ typeof(rp) __rp = rp; \ typeof(ip) __ip = ip; \ ifIsComplex(object) \ @@ -650,7 +650,7 @@ } \ else executionError("Type mismatch error"); } while(0) -#define setRealPartOfComplex(object, value) { \ +#define setRealPartOfComplex(object, value) do { \ if ((*object).nombre_occurrences > 1) \ { \ struct_objet *__tmp_object; \ @@ -663,7 +663,7 @@ value; \ else executionError("Type mismatch error"); } while(0) -#define setImaginaryPartOfComplex(object, value) { \ +#define setImaginaryPartOfComplex(object, value) do { \ if ((*object).nombre_occurrences > 1) \ { \ struct_objet *__tmp_object; \ @@ -687,13 +687,13 @@ #define ifIsComplex(object) if (isComplex(object)) #define elseIfIsComplex(object) } else ifIsComplex(object) -#define getComplex(object, value) { \ +#define getComplex(object, value) do { \ value.partie_reelle = 0; \ value.partie_imaginaire = 0; \ ifIsComplex(object) value = (*((complex16 *) (*object).objet)); \ else systemError("Not a complex"); } while(0) -#define createComplexObject(object) { \ +#define createComplexObject(object) do { \ if (object != NULL) \ systemError("Reallocated object"); \ if ((object = allocation(CPL)) == NULL) \ @@ -702,7 +702,7 @@ // Generalized vectors -#define createVectorObject(object, size, otype, structure, cat) { \ +#define createVectorObject(object, size, otype, structure, cat) do { \ integer8 i; \ if (object != NULL) \ systemError("Reallocated object"); \ @@ -735,7 +735,7 @@ // Integer vector -#define setIntegerIntoVector(object, value, position) { \ +#define setIntegerIntoVector(object, value, position) do { \ typeof(position) __position = position; \ ifIsIntegerVector(object) \ { \ @@ -763,7 +763,7 @@ #define ifIsIntegerVector(object) if (isIntegerVector(object)) #define elseIfIsIntegerVector(object) } else ifIsIntegerVector(object) -#define getIntegerFromVector(object, value, position) { \ +#define getIntegerFromVector(object, value, position) do { \ typeof(position) __position = position; \ value = 0; \ ifIsIntegerVector(object) \ @@ -783,7 +783,7 @@ // Real vector -#define setRealIntoVector(object, value, position) { \ +#define setRealIntoVector(object, value, position) do { \ typeof(position) __position = position; \ ifIsRealVector(object) \ { \ @@ -811,7 +811,7 @@ #define ifIsRealVector(object) if (isRealVector(object)) #define elseIfIsRealVector(object) } else ifIsRealVector(object) -#define getRealFromVector(object, value, position) { \ +#define getRealFromVector(object, value, position) do { \ typeof(position) __position = position; \ value = 0; \ ifIsRealVector(object) \ @@ -840,7 +840,7 @@ // Binary integer -#define setBinaryInteger(object, value) { \ +#define setBinaryInteger(object, value) do { \ ifIsBinaryInteger(object) \ { \ if ((*object).nombre_occurrences > 1) \ @@ -861,12 +861,12 @@ #define ifIsBinaryInteger(object) if (isBinaryInteger(object)) #define elseIfIsBinaryInteger(object) } else ifIsBinaryInteger(object) -#define getBinaryInteger(object, value) { \ +#define getBinaryInteger(object, value) do { \ value = 0; \ ifIsBinaryInteger(object) value = (*((integer8 *) (*object).objet)); \ else executionError("Type mismatch error"); } while(0) -#define createBinaryIntegerObject(object) { \ +#define createBinaryIntegerObject(object) do { \ if (object != NULL) \ systemError("Reallocated object"); \ if ((object = allocation(BIN)) == NULL) \ @@ -881,7 +881,7 @@ #define ifIsName(object) if (isName(object)) #define elseIfIsName(object) } else if (isName(object)) -#define setName(object, value) { \ +#define setName(object, value) do { \ ifIsName(object) \ { \ if ((*object).nombre_occurrences > 1) \ @@ -902,7 +902,7 @@ } \ else executionError("Type mistmatch error"); } while(0) -#define createNameObject(object) { \ +#define createNameObject(object) do { \ if (object != NULL) \ systemError("Reallocated object"); \ if ((object = allocation(NOM)) == NULL) \ @@ -921,7 +921,7 @@ #define ifIsString(object) if (isString(object)) #define elseIfIsString(object) else if (isString(objet)) -#define setString(object, string) { \ +#define setString(object, string) do { \ ifIsString(object) \ { \ if ((*object).nombre_occurrences > 1) \ @@ -940,12 +940,12 @@ } \ else executionError("Type mistmatch error"); } while(0) -#define getString(object, string) { \ +#define getString(object, string) do { \ string = NULL; \ ifIsString(object) string = (char *) (*object).objet; \ else executionError("Type mismatch error"); } while(0) -#define createStringObject(object) { \ +#define createStringObject(object) do { \ if (object != NULL) \ systemError("Reallocated object"); \ if ((object = allocation(CHN)) == NULL) \ @@ -962,14 +962,14 @@ #define ifIsList(object) if (isList(object)) #define elseIfIsList(object) else if (isList(object)) -#define createListObject(object) { \ +#define createListObject(object) do { \ if (object != NULL) \ systemError("Reallocated object"); \ if ((object = allocation(LST)) == NULL) \ systemError("Memory allocation error"); \ (*object).objet = NULL; } while(0) -#define addObjectToList(list, object) { \ +#define addObjectToList(list, object) do { \ ifIsList(list) \ { \ struct_objet *__tmp_object; \ @@ -1002,7 +1002,7 @@ } \ else executionError("Type mistmatch error"); } while(0) -#define insertObjectIntoList(list, object) { \ +#define insertObjectIntoList(list, object) do { \ ifIsList(list) \ { \ struct_objet *__tmp_object; \ @@ -1032,7 +1032,7 @@ } \ else executionError("Type mistmatch error"); } while(0) -#define removeObjectFromList(list, object) \ +#define removeObjectFromList(list, object) do { \ ifIsList(list) \ { \ if ((*object).objet == NULL) \ @@ -1056,7 +1056,7 @@ #define getListFromList(list, position1, position2, object) -#define listLength(list, length) { \ +#define listLength(list, length) do { \ if (list == NULL) executionError("Nullified object"); \ if ((*list).type != LST) \ executionError("Type mistmatch error"); \ @@ -1092,7 +1092,7 @@ */ #define pollSignalsAndInterrupts() \ - { scrutation_injection((*rpl_arguments).s_etat_processus); } while(0) + do { scrutation_injection((*rpl_arguments).s_etat_processus); } while(0) /* -------------------------------------------------------------------------------- @@ -1100,7 +1100,7 @@ -------------------------------------------------------------------------------- */ -#define intrinsic(function) { \ +#define intrinsic(function) do { \ int __status; \ __status = wrapper_instruction_intrinseque( \ instruction_##function, rpl_arguments); \