version 1.35, 2012/03/01 10:14:08
|
version 1.46, 2013/03/28 16:15:09
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.7 |
RPL/2 (R) version 4.1.13 |
Copyright (C) 1989-2012 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 56
|
Line 56
|
#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) { \ |
#define getDaisyChainFromList(list, daisyChain) do { \ |
typeof(list) __list = list; \ |
typeof(list) __list = list; \ |
daisyChain = NULL; \ |
daisyChain = NULL; \ |
ifIsList(__list) { daisyChain = (*__list).objet; } \ |
ifIsList(__list) { daisyChain = (*__list).objet; } \ |
Line 70
|
Line 70
|
#define replaceElementIntoDaisyChain(daisyChain, element) \ |
#define replaceElementIntoDaisyChain(daisyChain, element) \ |
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); \ |
(*__daisyChain).donnee = element; } while(0) |
(*__daisyChain).donnee = element; } while(0) |
|
|
#define nextElementOfDaisyChain(daisyChain) \ |
#define nextElementOfDaisyChain(daisyChain) \ |
Line 78
|
Line 79
|
(__daisyChain == NULL) ? NULL : (*__daisyChain).suivant; }) |
(__daisyChain == NULL) ? NULL : (*__daisyChain).suivant; }) |
|
|
#define null NULL |
#define null NULL |
#define nullify(ptr) { ptr = NULL; } while(0) |
#define nullify(ptr) do { ptr = NULL; } while(0) |
#define nullified(ptr) ((ptr) == NULL) |
#define nullified(ptr) ((ptr) == NULL) |
|
|
#define postIncr(x) (x++) |
#define postIncr(x) (x++) |
Line 104
|
Line 105
|
#define logical int |
#define logical int |
#define string char * |
#define string char * |
#define integer int |
#define integer int |
|
#define object struct_objet * |
|
|
#define declareStructure typedef struct { |
#define declareStructure typedef struct { |
#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 { |
#define endGroup } |
#define endGroup } |
#define beginMacro 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 test_arret((*rpl_arguments).s_etat_processus) |
|
|
/* |
/* |
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
|
Signaux |
|
--------------------------------------------------------------------------------*/ |
|
|
|
#define blockSignals \ |
|
{ sigset_t set, oldset; sigfillset(&set); \ |
|
pthread_sigmask(SIG_BLOCK, &set, &oldset); |
|
#define unblockSignals \ |
|
pthread_sigmask(SIG_SETMASK, &oldset, NULL); } |
|
|
|
/* |
|
-------------------------------------------------------------------------------- |
Constructeurs |
Constructeurs |
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
*/ |
*/ |
Line 175
|
Line 190
|
|
|
/* |
/* |
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
|
Destruction d'un objet |
|
-------------------------------------------------------------------------------- |
|
*/ |
|
|
|
#define freeObject(object) \ |
|
do { \ |
|
if (object == NULL) \ |
|
systemError("Nullified object"); \ |
|
liberation(object); \ |
|
object = NULL; \ |
|
} while(0) |
|
|
|
/* |
|
-------------------------------------------------------------------------------- |
|
Copie d'un objet |
|
-------------------------------------------------------------------------------- |
|
*/ |
|
|
|
#define dupObject(object) \ |
|
do { if (copie_objet(object, 'P') != object) \ |
|
systemError("Memory allocation error"); } while(0) |
|
|
|
/* |
|
-------------------------------------------------------------------------------- |
|
Déclaration des fonctions internes |
|
-------------------------------------------------------------------------------- |
|
*/ |
|
|
|
#define declareInternalFunction(name, ...) \ |
|
__internal_##name(struct_rpl_arguments *rpl_arguments, __VA_ARGS__) { |
|
|
|
#define endInternalFunction } |
|
|
|
#define useInternalFunction(name, ...) \ |
|
__internal_##name(struct_rpl_arguments *rpl_arguments, __VA_ARGS__) |
|
|
|
#define callInternalFunction(name, ...) \ |
|
__internal_##name(rpl_arguments, __VA_ARGS__) |
|
|
|
/* |
|
-------------------------------------------------------------------------------- |
Déclaration des fonctions externes |
Déclaration des fonctions externes |
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
*/ |
*/ |
|
|
#define declareExternalFunction(name) \ |
#define declareExternalFunction(name) \ |
void __external_##name(struct_rpl_arguments *rpl_arguments) { \ |
void __external_##name(struct_rpl_arguments *rpl_arguments) { \ |
char __function_name[] = "__external_"#name; |
char __function_name[] = "__external_"#name; \ |
|
__static_rpl_arguments = (*rpl_arguments); |
|
|
#define useExternalFunction(function) \ |
#define useExternalFunction(function) \ |
void __external_##function(struct_rpl_arguments *rpl_arguments) |
void __external_##function(struct_rpl_arguments *rpl_arguments) |
Line 192
|
Line 249
|
#define __onClosing void __runOnClosing(struct_rpl_arguments *rpl_arguments) |
#define __onClosing void __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); \ |
HEADER \ |
HEADER \ |
declareHelpString(""); \ |
declareHelpString(""); \ |
numberOfArguments(0); \ |
numberOfArguments(0); \ |
Line 252
|
Line 310
|
|
|
#define endExternalFunction return; } |
#define endExternalFunction return; } |
|
|
#define callExternalFunction(function) { \ |
#define callExternalFunction(function) do { \ |
__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 279
|
Line 337
|
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
*/ |
*/ |
|
|
#define declareHelpString(h) { \ |
#define declareHelpString(h) do { \ |
__presence_aide = d_vrai; \ |
__presence_aide = d_vrai; \ |
if ((*rpl_arguments).affichage_arguments == 'Y') \ |
if ((*rpl_arguments).affichage_arguments == 'Y') \ |
{ \ |
{ \ |
Line 287
|
Line 345
|
return; \ |
return; \ |
} } while(0) |
} } while(0) |
|
|
#define declareSymbolicConstant { \ |
#define declareSymbolicConstant do { \ |
numberOfArguments(0); \ |
numberOfArguments(0); \ |
(*rpl_arguments).constante_symbolique = 'Y'; \ |
(*rpl_arguments).constante_symbolique = 'Y'; \ |
__constante++; } while(0) |
__constante++; } while(0) |
|
|
#define numberOfArguments(n) { \ |
#define numberOfArguments(n) do { \ |
__presence_validation = d_vrai; \ |
__presence_validation = d_vrai; \ |
if ((*rpl_arguments).test_instruction == 'Y') \ |
if ((*rpl_arguments).test_instruction == 'Y') \ |
{ \ |
{ \ |
Line 344
|
Line 402
|
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
*/ |
*/ |
|
|
#define returnOnError(...) { \ |
#define returnOnError(...) do { \ |
if ((*rpl_arguments).erreur != 0) \ |
if ((*rpl_arguments).erreur != 0) \ |
{ \ |
{ \ |
__VA_ARGS__; \ |
__VA_ARGS__; \ |
return; \ |
return; \ |
} } while(0) |
} } while(0) |
|
|
#define systemError(message) { \ |
#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; } while(0) |
|
|
#define executionError(message) { \ |
#define executionError(message) do { \ |
(*rpl_arguments).erreur = __LINE__; \ |
(*rpl_arguments).erreur = __LINE__; \ |
(*rpl_arguments).type_erreur = 'E'; \ |
(*rpl_arguments).type_erreur = 'E'; \ |
(*rpl_arguments).message_erreur = (unsigned char *) message; } while(0) |
(*rpl_arguments).message_erreur = (unsigned char *) message; } while(0) |
|
|
|
#define onSystemError(...) do { \ |
|
if ((*rpl_arguments).erreur != 0) \ |
|
{ \ |
|
__VA_ARGS__; \ |
|
blockSignals; \ |
|
kill(getpid(), SIGTERM); \ |
|
unblockSignals; \ |
|
} } while(0) |
|
|
#define onError(...) \ |
#define onError(...) \ |
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__; \ |
Line 377
|
Line 444
|
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
*/ |
*/ |
|
|
#define pushOnStack(object) { \ |
#define pushOnStack(object) do { \ |
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, ...) { \ |
#define pullFromStack(object, ...) do { \ |
(*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 431
|
Line 498
|
|
|
// Constantes symboliques |
// Constantes symboliques |
|
|
#define createSymbolicConstant(object, type, value) { \ |
#define createSymbolicConstant(object, type, value) do { \ |
if ((strcmp(#type, "integer") != 0) && (strcmp(#type, "real") != 0)) \ |
if ((strcmp(#type, "integer") != 0) && (strcmp(#type, "real") != 0)) \ |
systemError("Type not allowed for symbolic constant"); \ |
systemError("Type not allowed for symbolic constant"); \ |
__taille_bloc = sizeof(t_8_bits) * 8; \ |
__taille_bloc = sizeof(t_8_bits) * 8; \ |
Line 467
|
Line 534
|
} \ |
} \ |
__constante--; } while(0) |
__constante--; } while(0) |
|
|
#define createSymbolicComplexConstant(object, rp, ip) { \ |
#define createSymbolicComplexConstant(object, rp, ip) do { \ |
__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 495
|
Line 562
|
|
|
// Integer |
// Integer |
|
|
#define setInteger(object, value) { \ |
#define setInteger(object, value) do { \ |
ifIsInteger(object) \ |
ifIsInteger(object) \ |
{ \ |
{ \ |
if ((*object).nombre_occurrences > 1) \ |
if ((*object).nombre_occurrences > 1) \ |
Line 516
|
Line 583
|
#define ifIsInteger(object) if (isInteger(object)) |
#define ifIsInteger(object) if (isInteger(object)) |
#define elseIfIsInteger(object) } else ifIsInteger(object) |
#define elseIfIsInteger(object) } else ifIsInteger(object) |
|
|
#define getInteger(object, value) { \ |
#define getInteger(object, value) do { \ |
value = 0; \ |
value = 0; \ |
ifIsInteger(object) value = (*((integer8 *) (*object).objet)); \ |
ifIsInteger(object) value = (*((integer8 *) (*object).objet)); \ |
else executionError("Type mismatch error"); } while(0) |
else executionError("Type mismatch error"); } while(0) |
|
|
#define createIntegerObject(object) { \ |
#define createIntegerObject(object) do { \ |
if (object != NULL) \ |
if (object != NULL) \ |
systemError("Reallocated object"); \ |
systemError("Reallocated object"); \ |
if ((object = allocation(INT)) == NULL) \ |
if ((object = allocation(INT)) == NULL) \ |
Line 530
|
Line 597
|
|
|
// Real |
// Real |
|
|
#define setReal(object, value) { \ |
#define setReal(object, value) do { \ |
ifIsReal(object) \ |
ifIsReal(object) \ |
{ \ |
{ \ |
if ((*object).nombre_occurrences > 1) \ |
if ((*object).nombre_occurrences > 1) \ |
Line 551
|
Line 618
|
#define ifIsReal(object) if (isReal(object)) |
#define ifIsReal(object) if (isReal(object)) |
#define elseIfIsReal(object) } else ifIsReal(object) |
#define elseIfIsReal(object) } else ifIsReal(object) |
|
|
#define getReal(object, value) { \ |
#define getReal(object, value) do { \ |
value = 0; \ |
value = 0; \ |
ifIsReal(object) value = (*((real8 *) (*object).objet)); \ |
ifIsReal(object) value = (*((real8 *) (*object).objet)); \ |
else executionError("Type mismatch error"); } while(0) |
else executionError("Type mismatch error"); } while(0) |
|
|
#define createRealObject(object) { \ |
#define createRealObject(object) do { \ |
if (object != NULL) \ |
if (object != NULL) \ |
systemError("Reallocated object"); \ |
systemError("Reallocated object"); \ |
if ((object = allocation(REL)) == NULL) \ |
if ((object = allocation(REL)) == NULL) \ |
Line 565
|
Line 632
|
|
|
// Complex |
// Complex |
|
|
#define setComplex(object, rp, ip) { \ |
#define setComplex(object, rp, ip) do { \ |
typeof(rp) __rp = rp; \ |
typeof(rp) __rp = rp; \ |
typeof(ip) __ip = ip; \ |
typeof(ip) __ip = ip; \ |
ifIsComplex(object) \ |
ifIsComplex(object) \ |
Line 583
|
Line 650
|
} \ |
} \ |
else executionError("Type mismatch error"); } while(0) |
else executionError("Type mismatch error"); } while(0) |
|
|
#define setRealPartOfComplex(object, value) { \ |
#define setRealPartOfComplex(object, value) do { \ |
if ((*object).nombre_occurrences > 1) \ |
if ((*object).nombre_occurrences > 1) \ |
{ \ |
{ \ |
struct_objet *__tmp_object; \ |
struct_objet *__tmp_object; \ |
Line 596
|
Line 663
|
value; \ |
value; \ |
else executionError("Type mismatch error"); } while(0) |
else executionError("Type mismatch error"); } while(0) |
|
|
#define setImaginaryPartOfComplex(object, value) { \ |
#define setImaginaryPartOfComplex(object, value) do { \ |
if ((*object).nombre_occurrences > 1) \ |
if ((*object).nombre_occurrences > 1) \ |
{ \ |
{ \ |
struct_objet *__tmp_object; \ |
struct_objet *__tmp_object; \ |
Line 620
|
Line 687
|
#define ifIsComplex(object) if (isComplex(object)) |
#define ifIsComplex(object) if (isComplex(object)) |
#define elseIfIsComplex(object) } else ifIsComplex(object) |
#define elseIfIsComplex(object) } else ifIsComplex(object) |
|
|
#define getComplex(object, value) { \ |
#define getComplex(object, value) do { \ |
value.partie_reelle = 0; \ |
value.partie_reelle = 0; \ |
value.partie_imaginaire = 0; \ |
value.partie_imaginaire = 0; \ |
ifIsComplex(object) value = (*((complex16 *) (*object).objet)); \ |
ifIsComplex(object) value = (*((complex16 *) (*object).objet)); \ |
else systemError("Not a complex"); } while(0) |
else systemError("Not a complex"); } while(0) |
|
|
#define createComplexObject(object) { \ |
#define createComplexObject(object) do { \ |
if (object != NULL) \ |
if (object != NULL) \ |
systemError("Reallocated object"); \ |
systemError("Reallocated object"); \ |
if ((object = allocation(CPL)) == NULL) \ |
if ((object = allocation(CPL)) == NULL) \ |
Line 635
|
Line 702
|
|
|
// Generalized vectors |
// Generalized vectors |
|
|
#define createVectorObject(object, size, otype, structure, cat) { \ |
#define createVectorObject(object, size, otype, structure, cat) do { \ |
integer8 i; \ |
integer8 i; \ |
if (object != NULL) \ |
if (object != NULL) \ |
systemError("Reallocated object"); \ |
systemError("Reallocated object"); \ |
Line 668
|
Line 735
|
|
|
// Integer vector |
// Integer vector |
|
|
#define setIntegerIntoVector(object, value, position) { \ |
#define setIntegerIntoVector(object, value, position) do { \ |
typeof(position) __position = position; \ |
typeof(position) __position = position; \ |
ifIsIntegerVector(object) \ |
ifIsIntegerVector(object) \ |
{ \ |
{ \ |
Line 696
|
Line 763
|
#define ifIsIntegerVector(object) if (isIntegerVector(object)) |
#define ifIsIntegerVector(object) if (isIntegerVector(object)) |
#define elseIfIsIntegerVector(object) } else ifIsIntegerVector(object) |
#define elseIfIsIntegerVector(object) } else ifIsIntegerVector(object) |
|
|
#define getIntegerFromVector(object, value, position) { \ |
#define getIntegerFromVector(object, value, position) do { \ |
typeof(position) __position = position; \ |
typeof(position) __position = position; \ |
value = 0; \ |
value = 0; \ |
ifIsIntegerVector(object) \ |
ifIsIntegerVector(object) \ |
Line 716
|
Line 783
|
|
|
// Real vector |
// Real vector |
|
|
#define setRealIntoVector(object, value, position) { \ |
#define setRealIntoVector(object, value, position) do { \ |
typeof(position) __position = position; \ |
typeof(position) __position = position; \ |
ifIsRealVector(object) \ |
ifIsRealVector(object) \ |
{ \ |
{ \ |
Line 744
|
Line 811
|
#define ifIsRealVector(object) if (isRealVector(object)) |
#define ifIsRealVector(object) if (isRealVector(object)) |
#define elseIfIsRealVector(object) } else ifIsRealVector(object) |
#define elseIfIsRealVector(object) } else ifIsRealVector(object) |
|
|
#define getRealFromVector(object, value, position) { \ |
#define getRealFromVector(object, value, position) do { \ |
typeof(position) __position = position; \ |
typeof(position) __position = position; \ |
value = 0; \ |
value = 0; \ |
ifIsRealVector(object) \ |
ifIsRealVector(object) \ |
Line 773
|
Line 840
|
|
|
// Binary integer |
// Binary integer |
|
|
#define setBinaryInteger(object, value) { \ |
#define setBinaryInteger(object, value) do { \ |
ifIsBinaryInteger(object) \ |
ifIsBinaryInteger(object) \ |
{ \ |
{ \ |
if ((*object).nombre_occurrences > 1) \ |
if ((*object).nombre_occurrences > 1) \ |
Line 794
|
Line 861
|
#define ifIsBinaryInteger(object) if (isBinaryInteger(object)) |
#define ifIsBinaryInteger(object) if (isBinaryInteger(object)) |
#define elseIfIsBinaryInteger(object) } else ifIsBinaryInteger(object) |
#define elseIfIsBinaryInteger(object) } else ifIsBinaryInteger(object) |
|
|
#define getBinaryInteger(object, value) { \ |
#define getBinaryInteger(object, value) do { \ |
value = 0; \ |
value = 0; \ |
ifIsBinaryInteger(object) value = (*((integer8 *) (*object).objet)); \ |
ifIsBinaryInteger(object) value = (*((integer8 *) (*object).objet)); \ |
else executionError("Type mismatch error"); } while(0) |
else executionError("Type mismatch error"); } while(0) |
|
|
#define createBinaryIntegerObject(object) { \ |
#define createBinaryIntegerObject(object) do { \ |
if (object != NULL) \ |
if (object != NULL) \ |
systemError("Reallocated object"); \ |
systemError("Reallocated object"); \ |
if ((object = allocation(BIN)) == NULL) \ |
if ((object = allocation(BIN)) == NULL) \ |
Line 814
|
Line 881
|
#define ifIsName(object) if (isName(object)) |
#define ifIsName(object) if (isName(object)) |
#define elseIfIsName(object) } else if (isName(object)) |
#define elseIfIsName(object) } else if (isName(object)) |
|
|
#define setName(object, value) { \ |
#define setName(object, value) do { \ |
ifIsName(object) \ |
ifIsName(object) \ |
{ \ |
{ \ |
if ((*object).nombre_occurrences > 1) \ |
if ((*object).nombre_occurrences > 1) \ |
Line 835
|
Line 902
|
} \ |
} \ |
else executionError("Type mistmatch error"); } while(0) |
else executionError("Type mistmatch error"); } while(0) |
|
|
#define createNameObject(object) { \ |
#define createNameObject(object) do { \ |
if (object != NULL) \ |
if (object != NULL) \ |
systemError("Reallocated object"); \ |
systemError("Reallocated object"); \ |
if ((object = allocation(NOM)) == NULL) \ |
if ((object = allocation(NOM)) == NULL) \ |
Line 854
|
Line 921
|
#define ifIsString(object) if (isString(object)) |
#define ifIsString(object) if (isString(object)) |
#define elseIfIsString(object) else if (isString(objet)) |
#define elseIfIsString(object) else if (isString(objet)) |
|
|
#define setString(object, string) { \ |
#define setString(object, string) do { \ |
ifIsString(object) \ |
ifIsString(object) \ |
{ \ |
{ \ |
if ((*object).nombre_occurrences > 1) \ |
if ((*object).nombre_occurrences > 1) \ |
Line 873
|
Line 940
|
} \ |
} \ |
else executionError("Type mistmatch error"); } while(0) |
else executionError("Type mistmatch error"); } while(0) |
|
|
#define getString(object, string) { \ |
#define getString(object, string) do { \ |
string = NULL; \ |
string = NULL; \ |
ifIsString(object) string = (char *) (*object).objet; \ |
ifIsString(object) string = (char *) (*object).objet; \ |
else executionError("Type mismatch error"); } while(0) |
else executionError("Type mismatch error"); } while(0) |
|
|
#define createStringObject(object) { \ |
#define createStringObject(object) do { \ |
if (object != NULL) \ |
if (object != NULL) \ |
systemError("Reallocated object"); \ |
systemError("Reallocated object"); \ |
if ((object = allocation(CHN)) == NULL) \ |
if ((object = allocation(CHN)) == NULL) \ |
Line 895
|
Line 962
|
#define ifIsList(object) if (isList(object)) |
#define ifIsList(object) if (isList(object)) |
#define elseIfIsList(object) else if (isList(object)) |
#define elseIfIsList(object) else if (isList(object)) |
|
|
#define createListObject(object) { \ |
#define createListObject(object) do { \ |
if (object != NULL) \ |
if (object != NULL) \ |
systemError("Reallocated object"); \ |
systemError("Reallocated object"); \ |
if ((object = allocation(LST)) == NULL) \ |
if ((object = allocation(LST)) == NULL) \ |
systemError("Memory allocation error"); \ |
systemError("Memory allocation error"); \ |
(*object).objet = NULL; } while(0) |
(*object).objet = NULL; } while(0) |
|
|
#define addObjectToList(list, object) { \ |
#define addObjectToList(list, object) do { \ |
ifIsList(list) \ |
ifIsList(list) \ |
{ \ |
{ \ |
struct_objet *__tmp_object; \ |
struct_objet *__tmp_object; \ |
Line 935
|
Line 1002
|
} \ |
} \ |
else executionError("Type mistmatch error"); } while(0) |
else executionError("Type mistmatch error"); } while(0) |
|
|
#define insertObjectIntoList(list, object) { \ |
#define insertObjectIntoList(list, object) do { \ |
ifIsList(list) \ |
ifIsList(list) \ |
{ \ |
{ \ |
struct_objet *__tmp_object; \ |
struct_objet *__tmp_object; \ |
Line 965
|
Line 1032
|
} \ |
} \ |
else executionError("Type mistmatch error"); } while(0) |
else executionError("Type mistmatch error"); } while(0) |
|
|
#define removeObjectFromList(list, object) \ |
#define removeObjectFromList(list, object) do { \ |
ifIsList(list) \ |
ifIsList(list) \ |
{ \ |
{ \ |
if ((*object).objet == NULL) \ |
if ((*object).objet == NULL) \ |
Line 989
|
Line 1056
|
|
|
#define getListFromList(list, position1, position2, object) |
#define getListFromList(list, position1, position2, object) |
|
|
#define listLength(list, length) { \ |
#define listLength(list, length) do { \ |
if (list == NULL) executionError("Nullified object"); \ |
if (list == NULL) executionError("Nullified object"); \ |
if ((*list).type != LST) \ |
if ((*list).type != LST) \ |
executionError("Type mistmatch error"); \ |
executionError("Type mistmatch error"); \ |
Line 1004
|
Line 1071
|
} \ |
} \ |
} } while(0) |
} } while(0) |
|
|
|
|
/* |
|
-------------------------------------------------------------------------------- |
|
Destruction d'un objet |
|
-------------------------------------------------------------------------------- |
|
*/ |
|
|
|
#define freeObject(object) \ |
|
{ \ |
|
if (object == NULL) \ |
|
systemError("Nullified object"); \ |
|
liberation(object); \ |
|
object = NULL; \ |
|
} while(0) |
|
|
|
/* |
|
-------------------------------------------------------------------------------- |
|
Copie d'un objet |
|
-------------------------------------------------------------------------------- |
|
*/ |
|
|
|
#define dupObject(object) \ |
|
{ if (copie_objet(object, 'P') != object) \ |
|
systemError("Memory allocation error"); } while(0) |
|
|
|
/* |
/* |
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
Allocation mémoire |
Allocation mémoire |
Line 1050
|
Line 1092
|
*/ |
*/ |
|
|
#define pollSignalsAndInterrupts() \ |
#define pollSignalsAndInterrupts() \ |
{ scrutation_injection((*rpl_arguments).s_etat_processus); } while(0) |
do { scrutation_injection((*rpl_arguments).s_etat_processus); } while(0) |
|
|
/* |
/* |
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
Line 1058
|
Line 1100
|
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
*/ |
*/ |
|
|
#define intrinsic(function) { \ |
#define intrinsic(function) do { \ |
int __status; \ |
int __status; \ |
__status = wrapper_instruction_intrinseque( \ |
__status = wrapper_instruction_intrinseque( \ |
instruction_##function, rpl_arguments); \ |
instruction_##function, rpl_arguments); \ |
Line 1068
|
Line 1110
|
|
|
#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 |