version 1.46, 2013/03/28 16:15:09
|
version 1.53, 2013/06/21 14:15:57
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.13 |
RPL/2 (R) version 4.1.15 |
Copyright (C) 1989-2013 Dr. BERTRAND Joël |
Copyright (C) 1989-2013 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
Line 39
|
Line 39
|
================================================================================ |
================================================================================ |
*/ |
*/ |
|
|
|
#define __RPL__ struct_rpl_arguments *rpl_arguments; \ |
|
rpl_arguments = &__static_rpl_arguments; |
|
|
|
#define __CATCH_SYSTEM_ERROR__ \ |
|
do { if (((*rpl_arguments).erreur != 0) && \ |
|
((*rpl_arguments).type_erreur == 'S')) \ |
|
return 0; } while(0) |
|
#define leave do { return(0); } while(0) |
#define allocation(a) librpl_allocation((*rpl_arguments).s_etat_processus, a) |
#define allocation(a) librpl_allocation((*rpl_arguments).s_etat_processus, a) |
#define copie_objet(a, b) librpl_copie_objet( \ |
#define copie_objet(a, b) librpl_copie_objet( \ |
(*rpl_arguments).s_etat_processus, a, b) |
(*rpl_arguments).s_etat_processus, a, b) |
#define liberation(a) librpl_liberation((*rpl_arguments).s_etat_processus, a) |
#define liberation(a) librpl_liberation((*rpl_arguments).s_etat_processus, a) |
|
|
|
#ifdef __RPLC_MAIN |
|
struct_rpl_arguments __static_rpl_arguments; |
|
# define global |
|
# define initialize(a, b) a = b |
|
# define declarePersistantObject(object) declareObject(object) |
|
#else |
|
extern struct_rpl_arguments __static_rpl_arguments; |
|
# define global extern |
|
# define initialize(a, b) a; |
|
# define declarePersistantObject(object) extern struct_objet *object; |
|
#endif |
|
|
|
#define empty int |
|
|
/* |
/* |
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
Types |
Types |
Line 56
|
Line 78
|
#define declareComplex(complex) complex16 complex |
#define declareComplex(complex) complex16 complex |
#define declareDaisyChain(daisyChain) struct_liste_chainee *daisyChain = NULL |
#define declareDaisyChain(daisyChain) struct_liste_chainee *daisyChain = NULL |
|
|
#define getDaisyChainFromList(list, daisyChain) do { \ |
#define getDaisyChainFromList(list, daisyChain) \ |
|
__CATCH_SYSTEM_ERROR__; \ |
|
do { \ |
typeof(list) __list = list; \ |
typeof(list) __list = list; \ |
daisyChain = NULL; \ |
daisyChain = NULL; \ |
ifIsList(__list) { daisyChain = (*__list).objet; } \ |
ifIsList(__list) { daisyChain = (*__list).objet; } \ |
else executionError("Type mistmatch error"); } while(0) |
else executionError("Type mistmatch error"); } while(0) |
|
|
#define fetchElementFromDaisyChain(daisyChain) \ |
#define fetchElementFromDaisyChain(daisyChain) \ |
({ typeof(daisyChain) __daisyChain = daisyChain; \ |
({ __CATCH_SYSTEM_ERROR__; typeof(daisyChain) __daisyChain = daisyChain; \ |
if (__daisyChain == NULL) executionError("End of daisy chain"); \ |
if (__daisyChain == NULL) executionError("End of daisy chain"); \ |
(__daisyChain == NULL) ? NULL : (*__daisyChain).donnee; }) |
(__daisyChain == NULL) ? NULL : (*__daisyChain).donnee; }) |
|
|
#define replaceElementIntoDaisyChain(daisyChain, element) \ |
#define replaceElementIntoDaisyChain(daisyChain, element) \ |
|
__CATCH_SYSTEM_ERROR__; \ |
do { typeof(daisyChain) __daisyChain = daisyChain; \ |
do { typeof(daisyChain) __daisyChain = daisyChain; \ |
if (__daisyChain == NULL) executionError("Nullified daisy chain"); \ |
if (__daisyChain == NULL) executionError("Nullified daisy chain"); \ |
freeObject((*__daisyChain).donnee); \ |
freeObject((*__daisyChain).donnee); \ |
(*__daisyChain).donnee = element; } while(0) |
(*__daisyChain).donnee = element; } while(0) |
|
|
#define nextElementOfDaisyChain(daisyChain) \ |
#define nextElementOfDaisyChain(daisyChain) \ |
({ typeof(daisyChain) __daisyChain = daisyChain; \ |
({ __CATCH_SYSTEM_ERROR__; typeof(daisyChain) __daisyChain = daisyChain; \ |
if (__daisyChain == NULL) executionError("End of daisy chain"); \ |
if (__daisyChain == NULL) executionError("End of daisy chain"); \ |
(__daisyChain == NULL) ? NULL : (*__daisyChain).suivant; }) |
(__daisyChain == NULL) ? NULL : (*__daisyChain).suivant; }) |
|
|
#define null NULL |
#define null NULL |
#define nullify(ptr) do { ptr = NULL; } while(0) |
#define nullify(ptr) __CATCH_SYSTEM_ERROR__; do { ptr = NULL; } while(0) |
#define nullified(ptr) ((ptr) == NULL) |
#define nullified(ptr) ((ptr) == NULL) |
|
|
#define postIncr(x) (x++) |
#define postIncr(x) (x++) |
Line 111
|
Line 136
|
#define declareUnion typedef union { |
#define declareUnion typedef union { |
#define as(name) } name; |
#define as(name) } name; |
|
|
#define __RPL__ struct_rpl_arguments rpl_arguments |
|
|
|
#define target(a) (*a) |
#define target(a) (*a) |
#define address(a) (&a) |
#define address(a) (&a) |
|
|
#define beginGroup { |
#define beginGroup { __CATCH_SYSTEM_ERROR__; |
#define endGroup } |
#define endGroup __CATCH_SYSTEM_ERROR__; } |
#define beginMacro do beginGroup |
#define beginMacro do beginGroup |
#define endMacro endGroup while(0) |
#define endMacro endGroup while(0) |
#define stopRequest test_arret((*rpl_arguments).s_etat_processus) |
#define stopRequest __CATCH_SYSTEM_ERROR__; \ |
|
test_arret((*rpl_arguments).s_etat_processus) |
|
|
/* |
/* |
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
Line 128
|
Line 152
|
--------------------------------------------------------------------------------*/ |
--------------------------------------------------------------------------------*/ |
|
|
#define blockSignals \ |
#define blockSignals \ |
{ sigset_t set, oldset; sigfillset(&set); \ |
{ __CATCH_SYSTEM_ERROR__; sigset_t set, oldset; sigfillset(&set); \ |
pthread_sigmask(SIG_BLOCK, &set, &oldset); |
pthread_sigmask(SIG_BLOCK, &set, &oldset); |
#define unblockSignals \ |
#define unblockSignals \ |
pthread_sigmask(SIG_SETMASK, &oldset, NULL); } |
pthread_sigmask(SIG_SETMASK, &oldset, NULL); __CATCH_SYSTEM_ERROR__; } |
|
|
/* |
/* |
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
Line 165
|
Line 189
|
DISABLE_SET_BUT_NOT_USED_WARNING(__masque); |
DISABLE_SET_BUT_NOT_USED_WARNING(__masque); |
|
|
#define FUNCTION \ |
#define FUNCTION \ |
if (__validation_instruction == d_vrai) return; \ |
if (__validation_instruction == d_vrai) return 0; \ |
if (__presence_aide == d_faux) \ |
if (__presence_aide == d_faux) \ |
{ \ |
{ \ |
systemError("Help string not defined"); \ |
systemError("Help string not defined"); \ |
Line 185
|
Line 209
|
strcpy((char *) __function_name, ""); \ |
strcpy((char *) __function_name, ""); \ |
if (__constante != 0) \ |
if (__constante != 0) \ |
systemError("Constant definition error"); \ |
systemError("Constant definition error"); \ |
|
__CATCH_SYSTEM_ERROR__; \ |
} } \ |
} } \ |
return; |
leave; |
|
|
/* |
/* |
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
Line 195
|
Line 220
|
*/ |
*/ |
|
|
#define freeObject(object) \ |
#define freeObject(object) \ |
|
__CATCH_SYSTEM_ERROR__; \ |
do { \ |
do { \ |
if (object == NULL) \ |
if (object == NULL) \ |
systemError("Nullified object"); \ |
systemError("Nullified object"); \ |
Line 209
|
Line 235
|
*/ |
*/ |
|
|
#define dupObject(object) \ |
#define dupObject(object) \ |
|
__CATCH_SYSTEM_ERROR__; \ |
do { if (copie_objet(object, 'P') != object) \ |
do { if (copie_objet(object, 'P') != object) \ |
systemError("Memory allocation error"); } while(0) |
systemError("Memory allocation error"); } while(0) |
|
|
Line 218
|
Line 245
|
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
*/ |
*/ |
|
|
#define declareInternalFunction(name, ...) \ |
#define CONCAT(a, b) __CONCAT(a, b) |
__internal_##name(struct_rpl_arguments *rpl_arguments, __VA_ARGS__) { |
#define __CONCAT(a, b) a##b |
|
#define FIRST(...) FIRST_HELPER(__VA_ARGS__, throwaway) |
|
#define FIRST_HELPER(first, ...) first |
|
#define REST(...) REST_HELPER(NUM(__VA_ARGS__), __VA_ARGS__) |
|
#define REST_HELPER(qty, ...) REST_HELPER2(qty, __VA_ARGS__) |
|
#define REST_HELPER2(qty, ...) REST_HELPER_##qty(__VA_ARGS__) |
|
#define REST_HELPER_ONE(first) |
|
#define REST_HELPER_TWOORMORE(first, ...) , __VA_ARGS__ |
|
#define NUM(...) \ |
|
SELECT_10TH(__VA_ARGS__, TWOORMORE, TWOORMORE, TWOORMORE, TWOORMORE,\ |
|
TWOORMORE, TWOORMORE, TWOORMORE, TWOORMORE, ONE, throwaway) |
|
#define SELECT_10TH(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, ...) a10 |
|
|
|
#define declareInternalFunction(type, ...) \ |
|
type CONCAT(__internal_, FIRST(__VA_ARGS__)) \ |
|
(struct_rpl_arguments *rpl_arguments REST(__VA_ARGS__)) { \ |
|
type __internal_return; __internal_return = 0; int __type; \ |
|
DISABLE_SET_BUT_NOT_USED_WARNING(__type); |
|
|
|
#define endInternalFunction return(__internal_return); } |
|
|
|
#define useInternalFunction(type, ...) \ |
|
type CONCAT(__internal_, FIRST(__VA_ARGS__)) \ |
|
(struct_rpl_arguments *rpl_arguments REST(__VA_ARGS__)) |
|
|
#define endInternalFunction } |
#define callInternalFunction(...) \ |
|
CONCAT(__internal_, FIRST(__VA_ARGS__))(rpl_arguments REST(__VA_ARGS__)) |
|
|
#define useInternalFunction(name, ...) \ |
/* |
__internal_##name(struct_rpl_arguments *rpl_arguments, __VA_ARGS__) |
-------------------------------------------------------------------------------- |
|
Déclaration des fonctions C |
|
-------------------------------------------------------------------------------- |
|
*/ |
|
|
|
#define declareCFunction(type, name, ...) \ |
|
type name(__VA_ARGS__) { __RPL__ type __c_return; |
|
#define endCFunction return(__c_return); } |
|
|
#define callInternalFunction(name, ...) \ |
#define useCFunction(type, name, ...) type name(__VA_ARGS__) |
__internal_##name(rpl_arguments, __VA_ARGS__) |
|
|
|
/* |
/* |
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
Line 236
|
Line 293
|
*/ |
*/ |
|
|
#define declareExternalFunction(name) \ |
#define declareExternalFunction(name) \ |
void __external_##name(struct_rpl_arguments *rpl_arguments) { \ |
int __external_##name(struct_rpl_arguments *rpl_arguments) { \ |
char __function_name[] = "__external_"#name; \ |
char __function_name[] = "__external_"#name; \ |
__static_rpl_arguments = (*rpl_arguments); |
__static_rpl_arguments = (*rpl_arguments); |
|
|
#define useExternalFunction(function) \ |
#define useExternalFunction(function) \ |
void __external_##function(struct_rpl_arguments *rpl_arguments) |
int __external_##function(struct_rpl_arguments *rpl_arguments) |
|
|
#define libraryName(name) char __library_name[] = #name; |
#define libraryName(name) char __library_name[] = #name; |
|
|
#define __onLoading void __runOnLoading(struct_rpl_arguments *rpl_arguments) |
#define __onLoading int __runOnLoading(struct_rpl_arguments *rpl_arguments) |
#define __onClosing void __runOnClosing(struct_rpl_arguments *rpl_arguments) |
#define __onClosing int __runOnClosing(struct_rpl_arguments *rpl_arguments) |
#define declareSubroutine(when) __##when { \ |
#define declareSubroutine(when) __##when { \ |
char __function_name[] = #when; \ |
char __function_name[] = #when; \ |
__static_rpl_arguments = (*rpl_arguments); \ |
__static_rpl_arguments = (*rpl_arguments); \ |
Line 256
|
Line 313
|
FUNCTION |
FUNCTION |
#define endSubroutine END } |
#define endSubroutine END } |
|
|
#define notice(s, ...) do { ufprintf(s, __VA_ARGS__); fflush(s); } while(0) |
#define notice(s, ...) __CATCH_SYSTEM_ERROR__; \ |
#define logger(...) do { syslog(LOG_NOTICE, __VA_ARGS__); } while(0) |
do { ufprintf(s, __VA_ARGS__); fflush(s); } while(0) |
|
#define logger(...) __CATCH_SYSTEM_ERROR__; \ |
|
do { syslog(LOG_NOTICE, __VA_ARGS__); } while(0) |
|
|
#define exportExternalFunctions(...) \ |
#define exportExternalFunctions(...) \ |
char **__external_symbols(unsigned long *nb_symbols, \ |
char **__external_symbols(struct_rpl_arguments *rpl_arguments, \ |
|
integer8 *nb_symbols, \ |
const char *version) { \ |
const char *version) { \ |
char arguments[] = #__VA_ARGS__; \ |
char arguments[] = #__VA_ARGS__; \ |
char **tableau; \ |
char **tableau; \ |
Line 308
|
Line 368
|
return(tableau); \ |
return(tableau); \ |
} |
} |
|
|
#define endExternalFunction return; } |
#define endExternalFunction leave; } |
|
|
#define callExternalFunction(function) do { \ |
#define callExternalFunction(function) do { \ |
|
__CATCH_SYSTEM_ERROR__; \ |
__taille_bloc = sizeof(t_8_bits) * 8; \ |
__taille_bloc = sizeof(t_8_bits) * 8; \ |
__indice_bloc = (35 - 1) / __taille_bloc; \ |
__indice_bloc = (35 - 1) / __taille_bloc; \ |
__indice_bit = (35 - 1) % __taille_bloc; \ |
__indice_bit = (35 - 1) % __taille_bloc; \ |
Line 342
|
Line 403
|
if ((*rpl_arguments).affichage_arguments == 'Y') \ |
if ((*rpl_arguments).affichage_arguments == 'Y') \ |
{ \ |
{ \ |
uprintf("%s\n", h); \ |
uprintf("%s\n", h); \ |
return; \ |
return 0; \ |
} } while(0) |
} } while(0) |
|
|
#define declareSymbolicConstant do { \ |
#define declareSymbolicConstant do { \ |
Line 379
|
Line 440
|
*/ |
*/ |
|
|
#define loop(b, e, s) for(b; e; s) { |
#define loop(b, e, s) for(b; e; s) { |
#define endLoop } |
#define endLoop __CATCH_SYSTEM_ERROR__; } |
|
|
#define repeatWhile(c) while(c) { |
#define repeatWhile(c) while(c) { |
#define endWhile } |
#define endWhile __CATCH_SYSTEM_ERROR__; } |
|
|
#define doUntil do { |
#define doUntil do { |
#define repeatUntil(c) } while(!(c)); |
#define repeatUntil(c) __CATCH_SYSTEM_ERROR__; } while(!(c)); |
|
|
#define select(s) switch(s) { |
#define select(s) switch(s) { |
#define endSelect } |
#define endSelect __CATCH_SYSTEM_ERROR__; } |
#define nonExclusiveCase(c) case c: { |
#define nonExclusiveCase(c) case c: { |
#define endNonExclusiveCase } |
#define endNonExclusiveCase __CATCH_SYSTEM_ERROR__; } |
#define exclusiveCase(c) case c: { |
#define exclusiveCase(c) case c: { |
#define endExclusiveCase break; } |
#define endExclusiveCase break; __CATCH_SYSTEM_ERROR__; } |
#define defaultCase default: |
#define defaultCase default: |
#define endDefaultCase break; } |
#define endDefaultCase break; __CATCH_SYSTEM_ERROR__; } |
|
|
/* |
/* |
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
Line 406
|
Line 467
|
if ((*rpl_arguments).erreur != 0) \ |
if ((*rpl_arguments).erreur != 0) \ |
{ \ |
{ \ |
__VA_ARGS__; \ |
__VA_ARGS__; \ |
return; \ |
return 0; \ |
} } while(0) |
} } while(0) |
|
|
#define systemError(message) do { \ |
#define systemError(message) do { \ |
(*rpl_arguments).erreur = __LINE__; \ |
(*rpl_arguments).erreur = __LINE__; \ |
(*rpl_arguments).type_erreur = 'S'; \ |
(*rpl_arguments).type_erreur = 'S'; \ |
(*rpl_arguments).message_erreur = (unsigned char *) message; \ |
(*rpl_arguments).message_erreur = (unsigned char *) message; \ |
return; } while(0) |
return 0; } while(0) |
|
|
#define executionError(message) do { \ |
#define executionError(message) do { \ |
(*rpl_arguments).erreur = __LINE__; \ |
(*rpl_arguments).erreur = __LINE__; \ |
Line 421
|
Line 482
|
(*rpl_arguments).message_erreur = (unsigned char *) message; } while(0) |
(*rpl_arguments).message_erreur = (unsigned char *) message; } while(0) |
|
|
#define onSystemError(...) do { \ |
#define onSystemError(...) do { \ |
if ((*rpl_arguments).erreur != 0) \ |
if (((*rpl_arguments).erreur != 0) && \ |
|
((*rpl_arguments).type_erreur == 'S')) \ |
{ \ |
{ \ |
__VA_ARGS__; \ |
|
blockSignals; \ |
blockSignals; \ |
kill(getpid(), SIGTERM); \ |
kill(getpid(), SIGTERM); \ |
unblockSignals; \ |
unblockSignals; \ |
|
__VA_ARGS__; \ |
} } while(0) |
} } while(0) |
|
|
#define onError(...) \ |
#define onError(...) \ |
|
__CATCH_SYSTEM_ERROR__; \ |
do { if (((*rpl_arguments).type_erreur == 'E') && \ |
do { if (((*rpl_arguments).type_erreur == 'E') && \ |
((*rpl_arguments).erreur != 0)) { __VA_ARGS__; \ |
((*rpl_arguments).erreur != 0)) { __VA_ARGS__; \ |
(*rpl_arguments).erreur = 0; } } while(0) |
(*rpl_arguments).erreur = 0; } } while(0) |
|
|
#define onExecution(...) \ |
#define onExecution(...) \ |
|
__CATCH_SYSTEM_ERROR__; \ |
do { if (((*rpl_arguments).type_erreur == 'E') && \ |
do { if (((*rpl_arguments).type_erreur == 'E') && \ |
((*rpl_arguments).erreur == 0)) { __VA_ARGS__; } } while(0) |
((*rpl_arguments).erreur == 0)) { __VA_ARGS__; } } while(0) |
|
|
Line 445
|
Line 509
|
*/ |
*/ |
|
|
#define pushOnStack(object) do { \ |
#define pushOnStack(object) do { \ |
|
__CATCH_SYSTEM_ERROR__; \ |
if (((*rpl_arguments).l_base_pile = \ |
if (((*rpl_arguments).l_base_pile = \ |
empilement_pile_operationnelle(rpl_arguments, object)) == NULL) \ |
empilement_pile_operationnelle(rpl_arguments, object)) == NULL) \ |
systemError("Memory allocation error"); \ |
systemError("Memory allocation error"); \ |
if ((*object).nombre_occurrences == 1) object = NULL; } while(0) |
if ((*object).nombre_occurrences == 1) object = NULL; } while(0) |
|
|
#define pullFromStack(object, ...) do { \ |
#define pullFromStack(object, ...) do { \ |
|
__CATCH_SYSTEM_ERROR__; \ |
(*rpl_arguments).l_base_pile = \ |
(*rpl_arguments).l_base_pile = \ |
depilement_pile_operationnelle(rpl_arguments, &object); \ |
depilement_pile_operationnelle(rpl_arguments, &object); \ |
if (object == NULL) \ |
if (object == NULL) \ |
Line 492
|
Line 558
|
*/ |
*/ |
|
|
#define then { |
#define then { |
#define endIf } |
#define endIf __CATCH_SYSTEM_ERROR__; } |
#define elseIf } else if |
#define elseIf __CATCH_SYSTEM_ERROR__; } else if |
#define orElse } else { |
#define orElse __CATCH_SYSTEM_ERROR__; } else { |
|
|
// Constantes symboliques |
// Constantes symboliques |
|
|
Line 508
|
Line 574
|
if (((*rpl_arguments).drapeaux_etat[__indice_bloc] & __masque) != 0) \ |
if (((*rpl_arguments).drapeaux_etat[__indice_bloc] & __masque) != 0) \ |
{ \ |
{ \ |
createNameObject(object); \ |
createNameObject(object); \ |
|
__CATCH_SYSTEM_ERROR__; \ |
{ \ |
{ \ |
char *__constant_name; \ |
char *__constant_name; \ |
if ((__constant_name = malloc((strlen(__library_name) + \ |
if ((__constant_name = malloc((strlen(__library_name) + \ |
Line 524
|
Line 591
|
if (strcmp(#type, "integer") == 0) \ |
if (strcmp(#type, "integer") == 0) \ |
{ \ |
{ \ |
createIntegerObject(object); \ |
createIntegerObject(object); \ |
|
__CATCH_SYSTEM_ERROR__; \ |
setInteger(object, value); \ |
setInteger(object, value); \ |
} \ |
} \ |
else if (strcmp(#type, "real") == 0) \ |
else if (strcmp(#type, "real") == 0) \ |
{ \ |
{ \ |
createRealObject(object); \ |
createRealObject(object); \ |
|
__CATCH_SYSTEM_ERROR__; \ |
setReal(object, value); \ |
setReal(object, value); \ |
} \ |
} \ |
} \ |
} \ |
|
__CATCH_SYSTEM_ERROR__; \ |
__constante--; } while(0) |
__constante--; } while(0) |
|
|
#define createSymbolicComplexConstant(object, rp, ip) do { \ |
#define createSymbolicComplexConstant(object, rp, ip) do { \ |
Line 542
|
Line 612
|
if (((*rpl_arguments).drapeaux_etat[__indice_bloc] & __masque) != 0) \ |
if (((*rpl_arguments).drapeaux_etat[__indice_bloc] & __masque) != 0) \ |
{ \ |
{ \ |
createNameObject(object); \ |
createNameObject(object); \ |
|
__CATCH_SYSTEM_ERROR__; \ |
{ \ |
{ \ |
char *__constant_name; \ |
char *__constant_name; \ |
if ((__constant_name = malloc((strlen(__library_name) + \ |
if ((__constant_name = malloc((strlen(__library_name) + \ |
Line 556
|
Line 627
|
else \ |
else \ |
{ \ |
{ \ |
createComplexObject(object); \ |
createComplexObject(object); \ |
|
__CATCH_SYSTEM_ERROR__; \ |
setComplex(object, rp, im); \ |
setComplex(object, rp, im); \ |
} \ |
} \ |
|
__CATCH_SYSTEM_ERROR__; \ |
__constante--; } while(0) |
__constante--; } while(0) |
|
|
// Integer |
// Integer |
Line 924
|
Line 997
|
#define setString(object, string) do { \ |
#define setString(object, string) do { \ |
ifIsString(object) \ |
ifIsString(object) \ |
{ \ |
{ \ |
if ((*object).nombre_occurrences > 1) \ |
if (string == NULL) executionError("Nullified string"); else \ |
{ \ |
{ \ |
struct_objet *__tmp_object; \ |
if ((*object).nombre_occurrences > 1) \ |
if ((__tmp_object = copie_objet(object, 'O')) == NULL) \ |
{ \ |
|
struct_objet *__tmp_object; \ |
|
if ((__tmp_object = copie_objet(object, 'O')) == NULL) \ |
|
systemError("Memory allocation error"); \ |
|
liberation(object); \ |
|
object = __tmp_object; \ |
|
} \ |
|
free((unsigned char *) (*object).objet); \ |
|
if (((*object).objet = malloc((strlen(string) + 1) * \ |
|
sizeof(unsigned char))) == NULL) \ |
systemError("Memory allocation error"); \ |
systemError("Memory allocation error"); \ |
liberation(object); \ |
strcpy((char *) (*object).objet, string); \ |
object = __tmp_object; \ |
|
} \ |
} \ |
free((unsigned char *) (*object).objet); \ |
|
if (((*object).objet = malloc((strlen(string) + 1) * \ |
|
sizeof(unsigned char))) == NULL) \ |
|
systemError("Memory allocation error"); \ |
|
strcpy((char *) (*object).objet, string); \ |
|
} \ |
} \ |
else executionError("Type mistmatch error"); } while(0) |
else executionError("Type mistmatch error"); } while(0) |
|
|
Line 1035
|
Line 1111
|
#define removeObjectFromList(list, object) do { \ |
#define removeObjectFromList(list, object) do { \ |
ifIsList(list) \ |
ifIsList(list) \ |
{ \ |
{ \ |
if ((*object).objet == NULL) \ |
if ((*list).objet != NULL) \ |
{ \ |
{ \ |
struct_objet *__tmp_object; \ |
struct_liste_chainee *__current; \ |
if ((__tmp_object = copie_objet(list, 'N')) == NULL) \ |
struct_liste_chainee *__previous; \ |
systemError("Memory allocation error"); \ |
__current = (*list).objet; \ |
liberation(object); \ |
__previous = NULL; \ |
object = __tmp_object; \ |
if ((*__current).donnee == object) \ |
\ |
{ \ |
\ |
(*list).objet = (*__current).suivant; \ |
\ |
} \ |
\ |
else \ |
} \ |
{ \ |
|
while(__current != NULL) \ |
|
{ \ |
|
if ((*__current).donnee == object) \ |
|
{ \ |
|
(*__previous).suivant = (*__current).suivant; \ |
|
break; \ |
|
} \ |
|
__previous = __current; \ |
|
__current = (*__current).suivant; \ |
|
} \ |
|
} \ |
|
liberation((*__current).donnee); \ |
|
free(__current); \ |
|
} \ |
} \ |
} \ |
else executionError("Type mistmatch error"); } while(0) |
else executionError("Type mistmatch error"); } while(0) |
|
|
Line 1092
|
Line 1182
|
*/ |
*/ |
|
|
#define pollSignalsAndInterrupts() \ |
#define pollSignalsAndInterrupts() \ |
|
__CATCH_SYSTEM_ERROR__; \ |
do { scrutation_injection((*rpl_arguments).s_etat_processus); } while(0) |
do { scrutation_injection((*rpl_arguments).s_etat_processus); } while(0) |
|
|
/* |
/* |
Line 1102
|
Line 1193
|
|
|
#define intrinsic(function) do { \ |
#define intrinsic(function) do { \ |
int __status; \ |
int __status; \ |
|
__CATCH_SYSTEM_ERROR__; \ |
__status = wrapper_instruction_intrinseque( \ |
__status = wrapper_instruction_intrinseque( \ |
instruction_##function, rpl_arguments); \ |
instruction_##function, rpl_arguments); \ |
if (__status == 1) executionError(#function); \ |
if (__status == 1) executionError(#function); \ |
Line 1110
|
Line 1202
|
|
|
#endif |
#endif |
|
|
static struct_rpl_arguments __static_rpl_arguments; |
|
#define __RPL__ struct_rpl_arguments *rpl_arguments; \ |
|
rpl_arguments = &__static_rpl_arguments; |
|
|
|
// vim: ts=4 |
// vim: ts=4 |