mg_load.html
NAME
mg_load, mg_clear, mg_file, mg_err - load MGF file, clear data structures
SYNOPSIS
#include "parser.h"int mg_load( char *filename )
void mg_clear( void )
extern MG_FCTXT *mg_file
extern char *mg_err[MG_NERRS]
DESCRIPTION
The mg_load function loads the named file, or standard input if filename is the NULL pointer. Calls back to the appropriate MGF handler routines are made through the mg_ehand dispatch table.The global mg_file variable points to the current file context structure, which may be useful for the interpretation of certain entities, such as ies, which must know the directory path of the enclosing file. This structure is of the defined type MG_FCTXT, given in "parser.h" as:
typedef struct mg_fctxt { char fname[96]; /* file name */ FILE *fp; /* stream pointer */ int fid; /* unique file context id */ char inpline[4096]; /* input line */ int lineno; /* line number */ struct mg_fctxt *prev; /* previous context */ } MG_FCTXT; /* file context */
DIAGNOSTICS
If an error is encountered during parsing, mg_load will print an appropriate error message to the standard error stream and return one of the non-zero values from "parser.h" listed below:
#define MG_OK 0 /* normal return value */ #define MG_EUNK 1 /* unknown entity */ #define MG_EARGC 2 /* wrong number of arguments */ #define MG_ETYPE 3 /* argument type error */ #define MG_EILL 4 /* illegal argument value */ #define MG_EUNDEF 5 /* undefined reference */ #define MG_ENOFILE 6 /* cannot open input file */ #define MG_EINCL 7 /* error in included file */ #define MG_EMEM 8 /* out of memory */ #define MG_ESEEK 9 /* file seek error */ #define MG_EBADMAT 10 /* bad material specification */ #define MG_ELINE 11 /* input line too long */ #define MG_ECNTXT 12 /* unmatched context close */ #define MG_NERRS 13If it is inappropriate to send output to standard error, the calling program should use the routines listed under mg_open for better control over the parsing process.
The mg_err array contains error messages corresponding to each of the values listed above in the native country's language.
SEE ALSO
mg_fgetpos, mg_handle, mg_init, mg_open
by
admin
—
last modified
Apr 21, 2025 09:12 PM