12.07.2015 Views

JYACC FORMAKER C Programmer's Guide Contents 1 ... - Prolifics

JYACC FORMAKER C Programmer's Guide Contents 1 ... - Prolifics

JYACC FORMAKER C Programmer's Guide Contents 1 ... - Prolifics

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

to standard error. Combining the mode with MSG_QUIET suppresses error reportingaltogether.If you or MSG_DSK with the mode, the messages are not read into memory. Insteadthe file is left open, and sm_msg_get and sm_msgfind fetch them from disk whenrequested. If your message file is large, this can save substantial memory; butyou should remember to account for operating system file buffers in yourcalculations.Arg contains the environment variable name for MSG_ENVIRON; the file name forMSG_FILENAME; or the address of the memory-resident file for MSG_MEMORY. It maybe passed as zero for other modes.RETURNS0 if the operation completed successfully; 1 if the message class wasalready in memory and the mode included MSG_NOREPLACE; 2 if the modewas MSG_DELETE and the message file was not in memory; -1 if the modewas MSG_ENVIRON or MSG_DEFAULT and the environment variable wasundefined; -2 if the mode was MSG_ENVIRON, MSG_FILENAME, orMSG_DEFAULT and the message file could not be read from disk; othernegative values if the message file was bad or insufficient memory wasavailable.VARIANTS AND RELATED FUNCTIONSEXAMPLEsm_msg_get (number);sm_msgfind (number);#include "smdefs.h"#include "smerror.h"/****************** Example 1 *********************** These calls are issued by sm_initcrt() to load* standard messages and one set of user messages. */sm_msgread ("SM", SM_MSGS, MSG_DEFAULT, (char *)0);sm_msgread ("", 0, MSG_DEFAULT, (char *)0);/***************** Example 2 ************************ This code fragment duplicates the Release 3 routine* sm_msginit(). */int sm_msginit (memfile)char memfile[];{int sm_msginit (msg_file)char * msg_file;{int mode = (msg_file ? MSG_MEMORY : MSG_DEFAULT | MSG_NOREPLACE)| MSG_INIT;}if ( sm_msgread ("SM", SM_MSGS, mode, msg_file) < 0 ||sm_msgread ("JM", JM_MSGS, mode, msg_file) < 0 ||sm_msgread ("FM", FM_MSGS, mode, msg_file) < 0 ||sm_msgread ("JX", JX_MSGS, mode, msg_file) < 0){exit (RET_FATAL);}sm_msgread ((char *)0, 0, mode & ~MSG_INIT | MSG_QUIET, msg_file);return (0);

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!