static void dumpFic(char *L) { int fd; struct DumpEnt E; char * F; dropTrSuite(); F = DumpRest_ext(L); if ((fd = open(F,O_CREAT|O_WRONLY,0600)) == -1) { perror(F); messErr(58); } else { strncpy(E.L,"Nblf010", 7); E.V=atof(VERSION); E.Scs=(long)getScs(); if ((write(fd,(void*)&E, LENT)) == LENT) { dump_marque(fd, 'N'); dump_stackN(fd); dump_marque(fd, 'C'); dump_stackC(fd); dump_marque(fd, 'L'); dump_stackL(fd); dump_marque(fd, 'V'); dump_stackV(fd); dump_marque(fd, 'F'); dump_stackF(fd); dump_marque(fd, 'X'); close(fd); } else messErr(58); } free((void*)F); }
static void newVar(char * S) { char Lib[LDFLT+1]; strncpy(Lib,S,LDFLT); Lib[LDFLT]='\0'; initVar(Lib); dropTrSuite(); }
static void lectFic(char *L) { int fd; dropTrSuite(); if ((fd = open(L,O_RDONLY)) == -1) { perror(L); messErr(16); } else addFD(fd,L); }
void suiteString(char *S) { int end=0; if ((strlen(bufC)+strlen(S)+1) > MAXSTRING) { dropTrSuite(); _MODIF_stringEnCours_(0); messErr(9); return; } if (S[strlen(S)-1] == '"') { S[strlen(S)-1] = '\0'; end=1; } strcat(bufC,S); if (end) { dropTrSuite(); _MODIF_stringEnCours_(0); putString(bufC); } }
static void newFct2(char * S, int U) { char Lib[LDFLT+1]; strncpy(Lib,S,LDFLT); Lib[LDFLT]='\0'; initFct(Lib, U); _MODIF_fctEnCours_(1); dropTrSuite(); i_cod = 0; i_adr = 0; i_adB = 0; i_adD = 0; }
void helpStd(char * L) { dropTrSuite(); if (fctExists(L)==0) { printf("%s is not a User System function !\n",L); return; } if (*L == '_') { printf("%s :\n",L); printf("The same as '%s', but with all displays in the log file.\n", L+1); L++; } helpShow(L); }
static void rmAFct(char * L) { void ** PNext; struct Fct * N; dropTrSuite(); PNext = &stackF; while (*PNext != VIDE) { N = (struct Fct*) *PNext; if ((N->typ==0) && (strncmp(N->l,L,strlen(L))==0)) { *PNext = N->n; eraseFct(N); } else PNext = &N->n; } }
static void delVar(char * L) { void ** PNext; struct Var * N; dropTrSuite(); PNext = &stackV; while (*PNext != VIDE) { N = (struct Var*) *PNext; if (strcmp(N->l,L)==0) { rmVar(PNext, N); return; } PNext = &N->n; } messErr(24); }
static void scanFonc(char * Lib) { void ** PNext; struct Fct * N; dropTrSuite(); PNext = &stackF; while (*PNext != VIDE) { N = (struct Fct*) *PNext; if (strcmp(N->l,Lib)==0) break; PNext = &N->n; } if (strcmp(N->l,Lib)!=0) { messErr(21); return; } scanFoncI((void*)N ,0); }
static void rmFct(char * L) { void ** PNext; struct Fct * N; dropTrSuite(); PNext = &stackF; while (*PNext != VIDE) { N = (struct Fct*) *PNext; if (N->typ==0) if (strcmp(N->l,L)==0) { *PNext = N->n; eraseFct(N); return; } PNext = &N->n; } messErr(21); }
void suiteBackC1(char *S) { void * M; dropTrSuite(); if (strlen(S) > LDFLT) { messErr(9); return; } if (S[strlen(S)-1] != '`') { messErr(44); return; } S[strlen(S)-1] = '\0'; if ((M = malloc(strlen(S)+1)) == NULL) stopErr("suiteBackC1","malloc"); #ifdef DEBUG_M printf("New String address : %lu \n",(unsigned long)M); #endif strcpy((char*)M,S); if (fctEnCours) makeFct(T_BKC1,M); else messErr(13); }
static void restoreFic(char *L) { int fd; struct DumpEnt E; char * F; dropTrSuite(); F = DumpRest_ext(L); if ((fd = open(F,O_RDONLY)) == -1) { perror(F); messErr(43); } else { if (read(fd,(void*)&E, LENT) != LENT) { printf("File too small !\n"); messErr(59); } else { if (strncmp(E.L,"Nblf010", 7) == 0) { if (E.Scs == (long)getScs()) { if (E.V == atof(VERSION)) { restore_marque(fd, 'N'); restore_stackN(fd); restore_marque(fd, 'C'); restore_stackC(fd); restore_marque(fd, 'L'); restore_stackL(fd); restore_marque(fd, 'V'); restore_stackV(fd); restore_links_stackN(); restore_marque(fd, 'F'); restore_stackF(fd); restore_marque(fd, 'X'); restore_links_stackV(); } else printf("This file is just available for Nife v %g !\n",E.V); } else printf("This file have another SCS !\n"); } else printf("Not a NBLF File !\n"); close(fd); } } free((void*)F); }
static void rmOFct(char * L) { void ** PNext, ** FP; struct Fct * N, * F; dropTrSuite(); F = VIDE; PNext = &stackF; while (*PNext != VIDE) { N = (struct Fct*) *PNext; if (N->typ==0) if (strcmp(N->l,L)==0) { FP = PNext; F = N; } PNext = &N->n; } if (F != VIDE) { *FP = F->n; eraseFct(F); } else messErr(21); }