--- rpl/src/instructions_o1.c 2012/12/19 09:58:26 1.62 +++ rpl/src/instructions_o1.c 2015/02/19 11:01:25 1.81 @@ -1,7 +1,7 @@ /* ================================================================================ - RPL/2 (R) version 4.1.12 - Copyright (C) 1989-2012 Dr. BERTRAND Joël + RPL/2 (R) version 4.1.21 + Copyright (C) 1989-2015 Dr. BERTRAND Joël This file is part of RPL/2. @@ -210,7 +210,7 @@ instruction_or(struct_processus *s_etat_ struct_objet *s_objet_argument_2; struct_objet *s_objet_resultat; - unsigned long nombre_elements; + integer8 nombre_elements; (*s_etat_processus).erreur_execution = d_ex; @@ -907,6 +907,7 @@ instruction_open(struct_processus *s_eta int buffer_reception; int drapeau; int priorite; + int prochain_descripteur; int protocole_numerique; int timeout_emission; int timeout_reception; @@ -973,7 +974,6 @@ instruction_open(struct_processus *s_eta unsigned long i; unsigned long nombre_elements; - unsigned long prochain_descripteur; unsigned long unite; # define d_BIND_TO_DEVICE 0 @@ -1028,7 +1028,8 @@ instruction_open(struct_processus *s_eta "\"file name\" } \"protection\" } OPEN\n"); printf(" { \"filetype\" \"access\" \"format\" { \"name\" " "\"file name\" } \n" - " { \"stty\" { \"stty parameters\" ... } } } OPEN\n"); + " { \"stty\" \"speed,bits,parity,stop\"\n" + " { \"stty parameters\" ... } } } OPEN\n"); printf(" { \"sockettype\" { \"name\" \"local name\" } } OPEN\n"); printf(" { \"sockettype\" \"socketdomain\" \"protection\" } OPEN\n"); printf(" \"/semaphore\" OPEN\n\n"); @@ -1078,7 +1079,7 @@ instruction_open(struct_processus *s_eta printf(" { \"STREAM\" \"READWRITE\" } OPEN\n"); printf(" { \"FOREIGN\" \"DATAGRAM\" } OPEN\n"); printf(" { \"LOCAL\" { \"NAME\" \"socket.sock\" } } OPEN\n"); - printf(" { { \"NAME\" \"/dev/ttyS1\" } { \"STTY\" { \"9600,8,N,1\" " + printf(" { { \"NAME\" \"/dev/ttyS1\" } { \"STTY\" \"9600,8,N,1\" " "\n { \"NO ICANON\" \"IGNBRK\" } } } OPEN\n"); return; @@ -1148,8 +1149,9 @@ instruction_open(struct_processus *s_eta { if ((*(*l_element_courant).donnee).type == CHN) { - if ((argument_majuscule = conversion_majuscule((unsigned char *) - (*(*l_element_courant).donnee).objet)) == NULL) + if ((argument_majuscule = conversion_majuscule(s_etat_processus, + (unsigned char *) (*(*l_element_courant).donnee).objet)) + == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1763,7 +1765,7 @@ instruction_open(struct_processus *s_eta if ((*(*l_element_courant_sous_objet).donnee).type == CHN) { if ((argument_majuscule = conversion_majuscule( - (unsigned char *) + s_etat_processus, (unsigned char *) (*(*l_element_courant_sous_objet) .donnee).objet)) == NULL) { @@ -1829,7 +1831,7 @@ instruction_open(struct_processus *s_eta free(argument_majuscule); if ((argument_majuscule = conversion_majuscule( - (unsigned char *) + s_etat_processus, (unsigned char *) (*(*l_element_courant_sous_objet) .donnee).objet)) == NULL) { @@ -1998,7 +2000,9 @@ instruction_open(struct_processus *s_eta if ((protocole_socket[i] >= 'a') && (protocole_socket[i] <= 'z')) { - protocole_socket[i] -= 'a' - 'A'; + protocole_socket[i] = (unsigned char) + (protocole_socket[i] + - ('a' - 'A')); } } } @@ -2141,7 +2145,6 @@ instruction_open(struct_processus *s_eta { type_arguments = 'S'; } - else if (type_arguments == 'F') { liberation(s_etat_processus, s_objet_argument); @@ -2318,7 +2321,7 @@ instruction_open(struct_processus *s_eta if ((*(*l_element_courant_sous_objet).donnee).type == CHN) { if ((argument_majuscule = conversion_majuscule( - (unsigned char *) + s_etat_processus, (unsigned char *) (*(*l_element_courant_sous_objet) .donnee).objet)) == NULL) { @@ -2359,7 +2362,7 @@ instruction_open(struct_processus *s_eta } if ((argument_majuscule = conversion_majuscule( - (unsigned char *) + s_etat_processus, (unsigned char *) (*(*l_element_courant_sous_objet) .donnee).objet)) == NULL) { @@ -3620,7 +3623,8 @@ instruction_open(struct_processus *s_eta } if ((parametre_courant_majuscule = conversion_majuscule( - (*(*parametre_courant).donnee).objet)) == NULL) + s_etat_processus, (*(*parametre_courant).donnee).objet)) + == NULL) { liberation(s_etat_processus, s_objet_argument); liberation(s_etat_processus, s_objet_resultat); @@ -3657,7 +3661,7 @@ instruction_open(struct_processus *s_eta // Vitesse unsigned char *vitesses[] = - { "0", "50", "75", "110", "134", "150", + { "50", "75", "110", "134", "150", "200", "300", "600", "1200", "1800", "2400", "4800", "9600", "19200", "38400", #ifdef B57600 @@ -3670,8 +3674,8 @@ instruction_open(struct_processus *s_eta "230400", #endif NULL }; - int vitesses_constantes[] = - { B0, B50, B75, B110, B134, B150, B200, B300, B600, + tcflag_t vitesses_constantes[] = + { B50, B75, B110, B134, B150, B200, B300, B600, B1200, B1800, B2400, B4800, B9600, B19200, B38400, #ifdef B57600 B57600, @@ -3696,7 +3700,7 @@ instruction_open(struct_processus *s_eta d_code_espace) { #ifdef CBAUD - tc.c_cflag &= ~CBAUD; + tc.c_cflag &= ~((tcflag_t) CBAUD); tc.c_cflag |= vitesses_constantes[vitesse_courante]; #else // POSIX cfsetispeed(&tc, @@ -3742,28 +3746,28 @@ instruction_open(struct_processus *s_eta { case '5': { - tc.c_cflag &= ~CSIZE; + tc.c_cflag &= ~((tcflag_t) CSIZE); tc.c_cflag |= CS5; break; } case '6': { - tc.c_cflag &= ~CSIZE; + tc.c_cflag &= ~((tcflag_t) CSIZE); tc.c_cflag |= CS6; break; } case '7': { - tc.c_cflag &= ~CSIZE; + tc.c_cflag &= ~((tcflag_t) CSIZE); tc.c_cflag |= CS7; break; } case '8': { - tc.c_cflag &= ~CSIZE; + tc.c_cflag &= ~((tcflag_t) CSIZE); tc.c_cflag |= CS8; break; } @@ -3809,7 +3813,7 @@ instruction_open(struct_processus *s_eta { case 'N': { - tc.c_cflag &= ~PARENB; + tc.c_cflag &= ~((tcflag_t) PARENB); break; } @@ -3823,7 +3827,7 @@ instruction_open(struct_processus *s_eta case 'E': { tc.c_cflag |= PARENB; - tc.c_cflag &= ~PARODD; + tc.c_cflag &= ~((tcflag_t) PARODD); break; } @@ -3868,7 +3872,7 @@ instruction_open(struct_processus *s_eta { case '1': { - tc.c_cflag &= ~CSTOPB; + tc.c_cflag &= ~((tcflag_t) CSTOPB); break; } @@ -3934,7 +3938,8 @@ instruction_open(struct_processus *s_eta } if ((parametre_courant_majuscule = conversion_majuscule( - (*(*parametre_courant).donnee).objet)) == NULL) + s_etat_processus, (*(*parametre_courant).donnee) + .objet)) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -3962,7 +3967,7 @@ instruction_open(struct_processus *s_eta #endif "ISIG", "ICANON", "ECHO", "ECHOE", "ECHOK", "ECHONL", "NOFLSH", "TOSTOP", "IEXTEN", NULL }; - int fonctions_constantes[] = + tcflag_t fonctions_constantes[] = { /* c_iflag */ 1, IGNBRK, 1, BRKINT, 1, IGNPAR, 1, PARMRK, 1, INPCK, 1, ISTRIP, 1, INLCR, 1, IGNCR, 1, ICRNL, @@ -4307,7 +4312,7 @@ instruction_open(struct_processus *s_eta return; } - prochain_descripteur = i; + prochain_descripteur = (int) i; /* * Ajout d'un élément à la fin de la liste chaînée @@ -4397,7 +4402,8 @@ instruction_open(struct_processus *s_eta # ifdef SO_BINDTODEVICE if (setsockopt((*((struct_socket *) (*s_objet_resultat) .objet)).socket, SOL_SOCKET, SO_BINDTODEVICE, - peripherique, strlen(peripherique)) != 0) + peripherique, (socklen_t) strlen(peripherique)) + != 0) { liberation(s_etat_processus, s_objet_argument); liberation(s_etat_processus, s_objet_resultat); @@ -4691,7 +4697,7 @@ instruction_open(struct_processus *s_eta for(i = 0; i < 16; adresse[i++] = 0); type_adresse = '6'; } - else + else if (strcmp(protocole, "UNIX") != 0) { liberation(s_etat_processus, s_objet_argument); @@ -5251,7 +5257,8 @@ instruction_open(struct_processus *s_eta adresse_ipv4 = 0; for(i = 0; i < 4; adresse_ipv4 = - (256 * adresse_ipv4) + adresse[i++]); + (256 * adresse_ipv4) + + ((unsigned char) adresse[i++])); socket_ipv4.sin_addr.s_addr = htonl(adresse_ipv4); @@ -5840,7 +5847,8 @@ instruction_open(struct_processus *s_eta adresse_ipv4 = 0; for(i = 0; i < 4; adresse_ipv4 = - (256 * adresse_ipv4) + adresse[i++]); + (256 * adresse_ipv4) + + ((unsigned char) adresse[i++])); socket_ipv4.sin_addr.s_addr = htonl(adresse_ipv4);