Next: , Previous: , Up: Graphics setup   [Contents][Index]


5.2.9 Error handling

Normally user should set it to zero by SetWarn(0); before plotting and check if GetWarn() or Message() return non zero after plotting. Only last warning will be saved. All warnings/errors produced by MathGL is not critical – the plot just will not be drawn. By default, all warnings are printed in stderr. You can disable it by using mgl_suppress_warn(true);.

Method on mglGraph: void SetWarn (int code, const char *info="")
C function: void mgl_set_warn (HMGL gr, int code, const char *info)

Set warning code. Normally you should call this function only for clearing the warning state, i.e. call SetWarn(0);. Text info will be printed as is if code<0.

Method on mglGraph: const char *Message ()
C function only: const char *mgl_get_mess (HMGL gr)
Fortran subroutine: mgl_get_mess (long gr, char *out, int len)

Return messages about matters why some plot are not drawn. If returned string is empty then there are no messages.

Method on mglGraph: int GetWarn ()
C function: int mgl_get_warn (HMGL gr)

Return the numerical ID of warning about the not drawn plot. Possible values are:

mglWarnNone=0

Everything OK

mglWarnDim

Data dimension(s) is incompatible

mglWarnLow

Data dimension(s) is too small

mglWarnNeg

Minimal data value is negative

mglWarnFile

No file or wrong data dimensions

mglWarnMem

Not enough memory

mglWarnZero

Data values are zero

mglWarnLeg

No legend entries

mglWarnSlc

Slice value is out of range

mglWarnCnt

Number of contours is zero or negative

mglWarnOpen

Couldn’t open file

mglWarnLId

Light: ID is out of range

mglWarnSize

Setsize: size(s) is zero or negative

mglWarnFmt

Format is not supported for that build

mglWarnTern

Axis ranges are incompatible

mglWarnNull

Pointer is NULL

mglWarnSpc

Not enough space for plot

mglScrArg

Wrong argument(s) of a command in MGL script

mglScrCmd

Wrong command in MGL script

mglScrLong

Too long line in MGL script

mglScrStr

Unbalanced ’ in MGL script

mglScrTemp

Change temporary data in MGL script

Method on mglGraph: void SuppressWarn (bool state) static
C function: void mgl_suppress_warn (int state)

Disable printing warnings to stderr if state is nonzero.

Method on mglGraph: void SetGlobalWarn (const char *info) static
C function: void mgl_set_global_warn (const char *info)

Set warning message info for global scope.

Method on mglGraph: const char * GlobalWarn () static
C function: const char * mgl_get_global_warn ()

Get warning message(s) for global scope.

Method on mglGraph: void ClearGlobalWarn () static
C function: void mgl_clear_global_warn ()

Clears global warning messages.


Next: , Previous: , Up: Graphics setup   [Contents][Index]