C-PLOT

Scientific Graphics and Data Analysis

E.1.7. - Miscellaneous macros



These macros provide some status information and allow you to break the plot program out of a command file if that is appropriate.

 Name   What it Does 
 is_bgnd()   Nonzero if running in the background 
 is_quiet()   Nonzero if quiet mode is on (see zq
 get_fun_num()   Value is function number, as in f1, f2, f3 
 set_error()   When function returns, plot program resets to command level 

The last macro sets a flag that makes the plot program behave just as if the user typed ^C at the keyboard, but the action doesn't occur until the user function returns control to the plot program.

For example, if the user function is reading a data file and has reached the end of that file, you might have code such as,
user4() {
        ...
        if (fgets(buf, 128, fd) == NULL) {
                printf("Reached end of file.\n");
                set_error();
                return;
        }
        ...

}