/************************************************************************ ** ** FILE : filesteio.c ** ** ZWECK : ** ** AUTOR : Michael C. Ancutici ** Universitaet Stuttgart, Fakultaet Informatik ** ** DATUM : 14.03.93 ** *************************************************************************/ #include "filesteio.h" #include "ste.h" #include "misc.h" #include "hasteio.h" #include "netsize.h" #include #include /************************************************************************* ** FUNKTION: FileSaveSte ** ZWECK: ** EINGABE: ** AUSGABE: ** RETURN: ** ANMERK: *************************************************************************/ void FileSaveSte( f) FILE *f; { register int i; register STELLE **s; for (i=0, s=SteStelle; iName, (*s)->Marke, (*s)->PosStelle.x, (*s)->PosStelle.y, (*s)->PosName.x, (*s)->PosName.y, (*s)->BreakCond, (*s)->BreakValue); } /************************************************************************* ** FUNKTION: FileLoadSte ** ZWECK: laedt eine Stelle und installiert sie ** EINGABE: ** AUSGABE: ** RETURN: ** ANMERK: *************************************************************************/ #define RETURN_ON_ERROR() { free( s); return NOT_OK;} BOOLEAN FileLoadSte( b) char *b; { int SNr; int i; STELLE *s; char *p, *z; int h; s = (STELLE *)malloc( sizeof( STELLE)); if ( sscanf( b, "S%d", &SNr) != 1) RETURN_ON_ERROR(); for (i=0, p=b; ( (i<20) && (*p != '~') ); i++, p++); if (i==20) RETURN_ON_ERROR(); for (++p, z=s->Name; ( (i<40) && (*p != '~') ); i++, p++, z++) *z = *p; if (i==40) RETURN_ON_ERROR(); *z = EOL; i = sscanf( ++p, "%d %d %d %d %d %c %d\n", &(s->Marke), &(s->PosStelle.x), &(s->PosStelle.y), &(s->PosName.x), &(s->PosName.y), &(s->BreakCond), &(s->BreakValue) ); if (i != 7) RETURN_ON_ERROR(); HaSteInsertX( SNr, s); return OK; }