version 1.8, 2010/04/07 13:45:00
|
version 1.22, 2010/07/13 13:01:21
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.0.14 |
RPL/2 (R) version 4.0.17 |
Copyright (C) 1989-2010 Dr. BERTRAND Joël |
Copyright (C) 1989-2010 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
Line 46 creation_instruction(struct_processus *s
|
Line 46 creation_instruction(struct_processus *s
|
|
|
unsigned char *ptr; |
unsigned char *ptr; |
|
|
|
BUG(strlen(instruction) >= d_longueur_maximale_instruction, |
|
printf("%s -> %d >= %d\n", instruction, (int) strlen(instruction), |
|
d_longueur_maximale_instruction)); |
|
|
if ((*s_etat_processus).arbre_instructions == NULL) |
if ((*s_etat_processus).arbre_instructions == NULL) |
{ |
{ |
if (((*s_etat_processus).arbre_instructions = |
if (((*s_etat_processus).arbre_instructions = |
Line 710 initialisation_instructions(struct_proce
|
Line 714 initialisation_instructions(struct_proce
|
|
|
INSTRUCTION("APPEND", instruction_append); |
INSTRUCTION("APPEND", instruction_append); |
INSTRUCTION("ARRY->", instruction_array_fleche); |
INSTRUCTION("ARRY->", instruction_array_fleche); |
|
INSTRUCTION("ATEXIT", instruction_atexit); |
INSTRUCTION("BESSEL", instruction_bessel); |
INSTRUCTION("BESSEL", instruction_bessel); |
INSTRUCTION("CLRERR", instruction_clrerr); |
INSTRUCTION("CLRERR", instruction_clrerr); |
INSTRUCTION("CLRMTX", instruction_clrmtx); |
INSTRUCTION("CLRMTX", instruction_clrmtx); |
Line 736 initialisation_instructions(struct_proce
|
Line 741 initialisation_instructions(struct_proce
|
INSTRUCTION("LOGGER", instruction_logger); |
INSTRUCTION("LOGGER", instruction_logger); |
INSTRUCTION("MCLRIN", instruction_mclrin); |
INSTRUCTION("MCLRIN", instruction_mclrin); |
INSTRUCTION("NRPROC", instruction_nrproc); |
INSTRUCTION("NRPROC", instruction_nrproc); |
|
INSTRUCTION("PROCID", instruction_procid); |
INSTRUCTION("PROMPT", instruction_prompt); |
INSTRUCTION("PROMPT", instruction_prompt); |
INSTRUCTION("RCLSWI", instruction_rclswi); |
INSTRUCTION("RCLSWI", instruction_rclswi); |
INSTRUCTION("RECALL", instruction_recall); |
INSTRUCTION("RECALL", instruction_recall); |
Line 788 initialisation_instructions(struct_proce
|
Line 794 initialisation_instructions(struct_proce
|
//f(x,y)=fnct complexe évaluée sur la grille (x,y) et affichée comme une |
//f(x,y)=fnct complexe évaluée sur la grille (x,y) et affichée comme une |
//fonction paramétrique. |
//fonction paramétrique. |
INSTRUCTION("INQUIRE", instruction_inquire); |
INSTRUCTION("INQUIRE", instruction_inquire); |
|
INSTRUCTION("MEMLOCK", instruction_memlock); |
INSTRUCTION("MTXLOCK", instruction_mtxlock); |
INSTRUCTION("MTXLOCK", instruction_mtxlock); |
INSTRUCTION("PERSIST", instruction_persist); |
INSTRUCTION("PERSIST", instruction_persist); |
INSTRUCTION("PLOTTER", instruction_plotter); |
INSTRUCTION("PLOTTER", instruction_plotter); |
Line 827 initialisation_instructions(struct_proce
|
Line 834 initialisation_instructions(struct_proce
|
|
|
INSTRUCTION("AUTOSCALE", instruction_autoscale); |
INSTRUCTION("AUTOSCALE", instruction_autoscale); |
INSTRUCTION("BACKSPACE", instruction_backspace); |
INSTRUCTION("BACKSPACE", instruction_backspace); |
|
INSTRUCTION("BACKTRACE", instruction_backtrace); |
|
INSTRUCTION("CLRATEXIT", instruction_clratexit); |
INSTRUCTION("COPYRIGHT", instruction_copyright); |
INSTRUCTION("COPYRIGHT", instruction_copyright); |
//INSTRUCTION("CYLINDRIC"); |
//INSTRUCTION("CYLINDRIC"); |
INSTRUCTION("DAEMONIZE", instruction_daemonize); |
INSTRUCTION("DAEMONIZE", instruction_daemonize); |
INSTRUCTION("DROPCNTXT", instruction_dropcntxt); |
INSTRUCTION("DROPCNTXT", instruction_dropcntxt); |
INSTRUCTION("EXTERNALS", instruction_externals); |
INSTRUCTION("EXTERNALS", instruction_externals); |
INSTRUCTION("HISTOGRAM", instruction_histogram); |
INSTRUCTION("HISTOGRAM", instruction_histogram); |
|
INSTRUCTION("MEMUNLOCK", instruction_memunlock); |
INSTRUCTION("MTXSTATUS", instruction_mtxstatus); |
INSTRUCTION("MTXSTATUS", instruction_mtxstatus); |
INSTRUCTION("MTXUNLOCK", instruction_mtxunlock); |
INSTRUCTION("MTXUNLOCK", instruction_mtxunlock); |
INSTRUCTION("PARAMETER", instruction_parameter); |
INSTRUCTION("PARAMETER", instruction_parameter); |
Line 872 initialisation_instructions(struct_proce
|
Line 882 initialisation_instructions(struct_proce
|
} |
} |
|
|
|
|
inline void * |
extern inline void * |
analyse_instruction(struct_processus *s_etat_processus, unsigned char *ptr) |
analyse_instruction(struct_processus *s_etat_processus, unsigned char *ptr) |
{ |
{ |
int pointeur; |
int pointeur; |
Line 939 analyse(struct_processus *s_etat_process
|
Line 949 analyse(struct_processus *s_etat_process
|
|
|
unsigned char *position; |
unsigned char *position; |
unsigned char *bibliotheque_candidate; |
unsigned char *bibliotheque_candidate; |
unsigned char *instruction_majuscule; |
unsigned char instruction_majuscule |
|
[d_longueur_maximale_instruction]; |
unsigned char registre_instruction_valide; |
unsigned char registre_instruction_valide; |
|
|
void (*instruction)(); |
void (*instruction)(); |
Line 956 analyse(struct_processus *s_etat_process
|
Line 967 analyse(struct_processus *s_etat_process
|
* On autorise l'exécution d'un fork() dans un thread concurrent. |
* On autorise l'exécution d'un fork() dans un thread concurrent. |
*/ |
*/ |
|
|
|
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
Line 970 analyse(struct_processus *s_etat_process
|
Line 982 analyse(struct_processus *s_etat_process
|
return; |
return; |
} |
} |
} |
} |
|
# else |
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
scrutation_injection(s_etat_processus); |
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
|
if (fonction == NULL) |
|
{ |
{ |
if ((instruction_majuscule = conversion_majuscule( |
if (errno != EINTR) |
(*s_etat_processus).instruction_courante)) == NULL) |
|
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
} |
|
# endif |
|
|
|
scrutation_injection(s_etat_processus); |
|
|
|
if (fonction == NULL) |
|
{ |
|
conversion_majuscule_limitee((*s_etat_processus).instruction_courante, |
|
instruction_majuscule, d_longueur_maximale_instruction); |
instruction = analyse_instruction(s_etat_processus, |
instruction = analyse_instruction(s_etat_processus, |
instruction_majuscule); |
instruction_majuscule); |
|
|
Line 1010 analyse(struct_processus *s_etat_process
|
Line 1033 analyse(struct_processus *s_etat_process
|
profilage(s_etat_processus, NULL); |
profilage(s_etat_processus, NULL); |
} |
} |
} |
} |
|
|
free(instruction_majuscule); |
|
} |
} |
else |
else |
{ |
{ |
Line 1212 analyse(struct_processus *s_etat_process
|
Line 1233 analyse(struct_processus *s_etat_process
|
((*s_etat_processus).erreur_systeme != d_es) || |
((*s_etat_processus).erreur_systeme != d_es) || |
((*s_etat_processus).exception != d_ep)) |
((*s_etat_processus).exception != d_ep)) |
{ |
{ |
if ((*s_etat_processus).instruction_derniere_erreur != NULL) |
|
{ |
|
free((*s_etat_processus).instruction_derniere_erreur); |
|
(*s_etat_processus).instruction_derniere_erreur = NULL; |
|
} |
|
|
|
(*s_etat_processus).niveau_derniere_erreur = |
(*s_etat_processus).niveau_derniere_erreur = |
(*s_etat_processus).niveau_courant; |
(*s_etat_processus).niveau_courant; |
|
|
if ((*s_etat_processus).mode_execution_programme == 'Y') |
if ((*s_etat_processus).mode_execution_programme == 'Y') |
{ |
{ |
|
if ((*s_etat_processus).instruction_derniere_erreur != NULL) |
|
{ |
|
free((*s_etat_processus).instruction_derniere_erreur); |
|
(*s_etat_processus).instruction_derniere_erreur = NULL; |
|
} |
|
|
if ((*s_etat_processus).instruction_courante == NULL) |
if ((*s_etat_processus).instruction_courante == NULL) |
{ |
{ |
if (((*s_etat_processus).instruction_derniere_erreur = |
if (((*s_etat_processus).instruction_derniere_erreur = |
Line 1254 analyse(struct_processus *s_etat_process
|
Line 1275 analyse(struct_processus *s_etat_process
|
} |
} |
else |
else |
{ |
{ |
if (((*s_etat_processus).instruction_derniere_erreur = |
if ((*s_etat_processus).objet_courant != NULL) |
formateur(s_etat_processus, 0, |
|
(*s_etat_processus).objet_courant)) == NULL) |
|
{ |
{ |
return; |
if ((*s_etat_processus).instruction_derniere_erreur != NULL) |
|
{ |
|
free((*s_etat_processus).instruction_derniere_erreur); |
|
(*s_etat_processus).instruction_derniere_erreur = NULL; |
|
} |
|
|
|
if (((*s_etat_processus).instruction_derniere_erreur = |
|
formateur(s_etat_processus, 0, |
|
(*s_etat_processus).objet_courant)) == NULL) |
|
{ |
|
return; |
|
} |
|
|
|
(*s_etat_processus).objet_courant = NULL; |
} |
} |
} |
} |
} |
} |