version 1.29, 2010/08/26 17:49:34
|
version 1.56, 2011/09/20 09:51:42
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.0.18 |
RPL/2 (R) version 4.1.3 |
Copyright (C) 1989-2010 Dr. BERTRAND Joël |
Copyright (C) 1989-2011 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
Line 35
|
Line 35
|
================================================================================ |
================================================================================ |
*/ |
*/ |
|
|
|
|
static void |
static void |
creation_instruction(struct_processus *s_etat_processus, |
creation_instruction(struct_processus *s_etat_processus, |
unsigned char *instruction, void (*routine)()) |
unsigned char *instruction, void (*routine)()) |
Line 61 creation_instruction(struct_processus *s
|
Line 60 creation_instruction(struct_processus *s
|
|
|
(*(*s_etat_processus).arbre_instructions).feuille = NULL; |
(*(*s_etat_processus).arbre_instructions).feuille = NULL; |
|
|
if (((*(*s_etat_processus).arbre_instructions).noeud = |
if (((*(*s_etat_processus).arbre_instructions).noeuds = |
malloc((*s_etat_processus).nombre_caracteres |
malloc((*s_etat_processus).nombre_caracteres |
* sizeof(struct_instruction))) == NULL) |
* sizeof(struct_instruction))) == NULL) |
{ |
{ |
Line 71 creation_instruction(struct_processus *s
|
Line 70 creation_instruction(struct_processus *s
|
|
|
for(i = 0; i < (*s_etat_processus).nombre_caracteres; i++) |
for(i = 0; i < (*s_etat_processus).nombre_caracteres; i++) |
{ |
{ |
(*(*s_etat_processus).arbre_instructions).noeud[i] = NULL; |
(*(*s_etat_processus).arbre_instructions).noeuds[i] = NULL; |
} |
} |
} |
} |
|
|
Line 84 creation_instruction(struct_processus *s
|
Line 83 creation_instruction(struct_processus *s
|
printf("Instruction=\"%s\", (*ptr)='%c'\n", |
printf("Instruction=\"%s\", (*ptr)='%c'\n", |
instruction, *ptr)); |
instruction, *ptr)); |
|
|
if ((*l_instruction_courante).noeud[(*s_etat_processus) |
if ((*l_instruction_courante).noeuds[(*s_etat_processus) |
.pointeurs_caracteres[*ptr]] == NULL) |
.pointeurs_caracteres[*ptr]] == NULL) |
{ |
{ |
// Le noeud suivant n'existe pas, on le crée. |
// Le noeud suivant n'existe pas, on le crée. |
|
|
if (((*l_instruction_courante).noeud[(*s_etat_processus) |
if (((*l_instruction_courante).noeuds[(*s_etat_processus) |
.pointeurs_caracteres[*ptr]] = |
.pointeurs_caracteres[*ptr]] = |
malloc(sizeof(struct_instruction))) == NULL) |
malloc(sizeof(struct_instruction))) == NULL) |
{ |
{ |
Line 97 creation_instruction(struct_processus *s
|
Line 96 creation_instruction(struct_processus *s
|
return; |
return; |
} |
} |
|
|
(*(*l_instruction_courante).noeud[(*s_etat_processus) |
(*(*l_instruction_courante).noeuds[(*s_etat_processus) |
.pointeurs_caracteres[*ptr]]).feuille = NULL; |
.pointeurs_caracteres[*ptr]]).feuille = NULL; |
|
|
if (((*(*l_instruction_courante).noeud[(*s_etat_processus) |
if (((*(*l_instruction_courante).noeuds[(*s_etat_processus) |
.pointeurs_caracteres[*ptr]]).noeud = |
.pointeurs_caracteres[*ptr]]).noeuds = |
malloc((*s_etat_processus).nombre_caracteres |
malloc((*s_etat_processus).nombre_caracteres |
* sizeof(struct_instruction))) == NULL) |
* sizeof(struct_instruction))) == NULL) |
{ |
{ |
Line 111 creation_instruction(struct_processus *s
|
Line 110 creation_instruction(struct_processus *s
|
|
|
for(i = 0; i < (*s_etat_processus).nombre_caracteres; i++) |
for(i = 0; i < (*s_etat_processus).nombre_caracteres; i++) |
{ |
{ |
(*(*l_instruction_courante).noeud[(*s_etat_processus) |
(*(*l_instruction_courante).noeuds[(*s_etat_processus) |
.pointeurs_caracteres[*ptr]]).noeud[i] = NULL; |
.pointeurs_caracteres[*ptr]]).noeuds[i] = NULL; |
} |
} |
} |
} |
|
|
l_instruction_courante = (*l_instruction_courante).noeud |
l_instruction_courante = (*l_instruction_courante).noeuds |
[(*s_etat_processus).pointeurs_caracteres[*ptr]]; |
[(*s_etat_processus).pointeurs_caracteres[*ptr]]; |
ptr++; |
ptr++; |
} |
} |
Line 138 liberation_arbre_instructions(struct_pro
|
Line 137 liberation_arbre_instructions(struct_pro
|
|
|
for(i = 0; i < (*s_etat_processus).nombre_caracteres; i++) |
for(i = 0; i < (*s_etat_processus).nombre_caracteres; i++) |
{ |
{ |
if ((*arbre).noeud[i] != NULL) |
if ((*arbre).noeuds[i] != NULL) |
{ |
{ |
liberation_arbre_instructions(s_etat_processus, (*arbre).noeud[i]); |
liberation_arbre_instructions(s_etat_processus, (*arbre).noeuds[i]); |
} |
} |
} |
} |
|
|
free((*arbre).noeud); |
free((*arbre).noeuds); |
free(arbre); |
free(arbre); |
|
|
return; |
return; |
Line 468 initialisation_instructions(struct_proce
|
Line 467 initialisation_instructions(struct_proce
|
INSTRUCTION("LINE", instruction_line); |
INSTRUCTION("LINE", instruction_line); |
INSTRUCTION("LNP1", instruction_lnp1); |
INSTRUCTION("LNP1", instruction_lnp1); |
INSTRUCTION("LOCK", instruction_lock); |
INSTRUCTION("LOCK", instruction_lock); |
|
INSTRUCTION("L->T", instruction_l_vers_t); |
INSTRUCTION("MANT", instruction_mant); |
INSTRUCTION("MANT", instruction_mant); |
INSTRUCTION("MARK", instruction_mark); |
INSTRUCTION("MARK", instruction_mark); |
//INSTRUCTION("MAXR") |
//INSTRUCTION("MAXR") |
Line 544 initialisation_instructions(struct_proce
|
Line 544 initialisation_instructions(struct_proce
|
INSTRUCTION("SPAR", instruction_spar); |
INSTRUCTION("SPAR", instruction_spar); |
INSTRUCTION("SQRT", instruction_sqrt); |
INSTRUCTION("SQRT", instruction_sqrt); |
//INSTRUCTION("SRAD"); |
//INSTRUCTION("SRAD"); |
|
INSTRUCTION("SREV", instruction_srev); |
//INSTRUCTION("SRNM") |
//INSTRUCTION("SRNM") |
//Instruction HP48 (renvoie la norme spectrale d'un tableau. Pour une |
//Instruction HP48 (renvoie la norme spectrale d'un tableau. Pour une |
//matrice, |
//matrice, |
Line 571 initialisation_instructions(struct_proce
|
Line 572 initialisation_instructions(struct_proce
|
INSTRUCTION("TRNC", instruction_trnc); |
INSTRUCTION("TRNC", instruction_trnc); |
INSTRUCTION("TRUE", instruction_true); |
INSTRUCTION("TRUE", instruction_true); |
INSTRUCTION("TYPE", instruction_type); |
INSTRUCTION("TYPE", instruction_type); |
|
INSTRUCTION("T->L", instruction_t_vers_l); |
INSTRUCTION("UTPC", instruction_utpc); |
INSTRUCTION("UTPC", instruction_utpc); |
INSTRUCTION("UTPF", instruction_utpf); |
INSTRUCTION("UTPF", instruction_utpf); |
INSTRUCTION("UTPN", instruction_utpn); |
INSTRUCTION("UTPN", instruction_utpn); |
Line 591 initialisation_instructions(struct_proce
|
Line 593 initialisation_instructions(struct_proce
|
//de coordonnées courant) |
//de coordonnées courant) |
//INSTRUCTION("->V3") |
//INSTRUCTION("->V3") |
|
|
# ifndef OS2 |
|
INSTRUCTION("ABORT", instruction_abort); |
INSTRUCTION("ABORT", instruction_abort); |
# endif |
|
INSTRUCTION("ACOSH", instruction_acosh); |
INSTRUCTION("ACOSH", instruction_acosh); |
INSTRUCTION("ALARM", instruction_alarm); |
INSTRUCTION("ALARM", instruction_alarm); |
INSTRUCTION("ASINH", instruction_asinh); |
INSTRUCTION("ASINH", instruction_asinh); |
Line 653 initialisation_instructions(struct_proce
|
Line 653 initialisation_instructions(struct_proce
|
INSTRUCTION("LCASE", instruction_lcase); |
INSTRUCTION("LCASE", instruction_lcase); |
INSTRUCTION("LCHOL", instruction_lchol); |
INSTRUCTION("LCHOL", instruction_lchol); |
INSTRUCTION("LCD->", instruction_lcd_fleche); |
INSTRUCTION("LCD->", instruction_lcd_fleche); |
|
INSTRUCTION("LIMIT", instruction_limit); |
//INSTRUCTION("NDIST") |
//INSTRUCTION("NDIST") |
//Instruction HP48 (distribution normale, prend la moyenne au niveau 3, |
//Instruction HP48 (distribution normale, prend la moyenne au niveau 3, |
//la variance au niveau 2, un réel x au niveau 1 et renvoie la probabilité |
//la variance au niveau 2, un réel x au niveau 1 et renvoie la probabilité |
Line 834 initialisation_instructions(struct_proce
|
Line 835 initialisation_instructions(struct_proce
|
INSTRUCTION("DUPCNTXT", instruction_dupcntxt); |
INSTRUCTION("DUPCNTXT", instruction_dupcntxt); |
INSTRUCTION("FUNCTION", instruction_function); |
INSTRUCTION("FUNCTION", instruction_function); |
INSTRUCTION("IMPLICIT", instruction_implicit); |
INSTRUCTION("IMPLICIT", instruction_implicit); |
|
INSTRUCTION("INFINITY", instruction_sensible_infinity); |
INSTRUCTION("KEYLABEL", instruction_keylabel); |
INSTRUCTION("KEYLABEL", instruction_keylabel); |
INSTRUCTION("KEYTITLE", instruction_keytitle); |
INSTRUCTION("KEYTITLE", instruction_keytitle); |
INSTRUCTION("LOGSCALE", instruction_logscale); |
INSTRUCTION("LOGSCALE", instruction_logscale); |
Line 898 initialisation_instructions(struct_proce
|
Line 900 initialisation_instructions(struct_proce
|
} |
} |
|
|
|
|
#ifndef OS2 |
|
extern inline |
|
#endif |
|
void * |
void * |
analyse_instruction(struct_processus *s_etat_processus, unsigned char *ptr) |
analyse_instruction(struct_processus *s_etat_processus, unsigned char *ptr) |
{ |
{ |
Line 921 analyse_instruction(struct_processus *s_
|
Line 920 analyse_instruction(struct_processus *s_
|
return(NULL); |
return(NULL); |
} |
} |
|
|
if ((*l_instruction_courante).noeud[pointeur] == NULL) |
if ((*l_instruction_courante).noeuds[pointeur] == NULL) |
{ |
{ |
// Le chemin de l'instruction candidate n'existe pas. |
// Le chemin de l'instruction candidate n'existe pas. |
|
|
return(NULL); |
return(NULL); |
} |
} |
|
|
l_instruction_courante = (*l_instruction_courante).noeud[pointeur]; |
l_instruction_courante = (*l_instruction_courante).noeuds[pointeur]; |
ptr++; |
ptr++; |
|
|
if ((l_instruction_courante == NULL) && ((*ptr) != d_code_fin_chaine)) |
if ((l_instruction_courante == NULL) && ((*ptr) != d_code_fin_chaine)) |
Line 986 analyse(struct_processus *s_etat_process
|
Line 985 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; |
return; |
return; |
} |
} |
|
|
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) |
{ |
|
if (errno != EINTR) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
} |
|
# else |
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
|
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 1016 analyse(struct_processus *s_etat_process
|
Line 999 analyse(struct_processus *s_etat_process
|
return; |
return; |
} |
} |
} |
} |
# endif |
|
|
|
scrutation_injection(s_etat_processus); |
scrutation_injection(s_etat_processus); |
|
|