Sun Microsystems 800-1256-04 — Sun Microsystems 800-1256-04 SunCGI Reference Manual PDF (EN)

22 SunCGI Reference Manual 0 Cerror set_error_warning_mask(action) Cerrtype action; /* Action on receipt of an error *I set_error_warning_mask3 determines the action taken by SunCGI when an error occurs. Three types of action are possible: NO_ACTION, POLL, INTER- RUPT. If the action argument is set to NO_ACTION, errors are detected internally, but not reported. The error number is returned to the caller of a CG! routine. The user is advised not to set the action argument to NO_ ACTION. POLL and INTERRUPT actions print an error message on the terminal, but also return the error number (see Appendix D) so the program can perform exception handling. The default error_warning_mask is INTERRUPT.

Errors ENOTOPOP [5] CGI not in proper state CGI shall be either in state CGOP, VSOP, or VSAC. Table 2-4 Error Warning Masks Error Message Program Error Warning Mask Printed Aborted Number Returned NO ACTION No No Yes POLL Yes No Yes INTERRUPT Yes FATAL errorst Non-FATAL errors t SunCGI defines no errors as FATAL. All errors are non-fatal so the appli- o cation has complete control to abort or perform other processing as desired. ' · Therefore, POLL and INTERRUPT are the same in SunCGI. 2.3. Running SunCGI with Sun View SunCGI always traps five signals: SIGINT, SIGCHLD, SIGIO, SIGHUP and SIGWINCH. The first four of these cause SunCGI cleanup and program termina- tion.

When using a Graphics Processor option, SunCGI also traps SIGXCPU. Previous signal handlers, if any, are saved. When one of these signals occurs, SunCGI's signal handler will call the previous signal handler as well as perform- ing its own processing. The actions of the previous (user installed) signal handler may interfere with SunCGI's signal responses, and are hence unsupported. Unless a SunCGI application program has opened a retained view surface, over- lapping another window onto a graphics subwindow will destroy the picture below. SunCGI programs can regenerate a display surface by trapping the SIGWINCH (SIGnal WINdow CHange) signal.

It is possible (though unsupported) to install a signal handler for signals after cal- ling open _pw _ cgi (see Appendix F). Since these signal handlers replace SunCGI's handler, the application should save SunCGI's signal handler (returned by signal), and call the saved handler when the signal occurs (amid the user's own processing). Because the response of the program to the signal then depends on the place in the user's own signal handling that SunCGI's handler is 3 The syntax of set_error_warning_mask in SunCGI is slightly different from the proposed ANSI O· standard in that the ANSI definition allows different actions fa different classes of errors. Version C of 17 March 1986