home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / APPS / DVI_MGR / dvimgr_s.lzh / dvimgr / fatal.h < prev    next >
Text File  |  1993-08-06  |  3KB  |  90 lines

  1. /* -*-C-*- fatal.h */
  2. /*-->fatal*/
  3. /**********************************************************************/
  4. /******************************* fatal ********************************/
  5. /**********************************************************************/
  6.  
  7. /*--------------------------------------------------------------------*/
  8. /* Modified for use with DVIDECW driver     (30.06.89)              */
  9. /*--------------------------------------------------------------------*/
  10.  
  11.  
  12. void
  13. fatal(msg)                /* issue a fatal error message */
  14. char *msg;                /* message string */
  15. {
  16.     if (g_dolog && (g_logfp == (FILE *)NULL) && g_logname[0])
  17.     {
  18.     g_logfp = fopen(g_logname,"w+");
  19.     DEBUG_OPEN(g_logfp,g_logname,"w+");
  20.     if (g_logfp == (FILE *)NULL)
  21.     {
  22.         (void)fprintf(stderr,"Cannot open log file [%s]",g_logname);
  23.         NEWLINE(stderr);
  24.     }
  25.     else
  26.     {
  27.         (void)fprintf(stderr,"[Log file [%s] created]",g_logname);
  28.         NEWLINE(stderr);
  29.  
  30. #if    OS_TOPS20
  31. #if    PCC_20
  32.         /* Because of the PCC-20 arithmetic (instead of */
  33.         /* logical) shift bug wherein a constant expression */
  34.         /* (1<<35) evaluates to 0 instead of 400000,,000000, */
  35.         /* we must set CF_nud using a variable, instead of */
  36.         /* just using a constant "ac1 = makefield(CF_nud,1);" */
  37.         ac1 = 1;
  38.         ac1 = makefield(CF_nud,ac1);
  39.         setfield(ac1,CF_jfn,jfnof(fileno(g_logfp)));    /* jfn */
  40.         setfield(ac1,CF_dsp,FBbyv);    /* generation number index in fdb */
  41.         ac2 = makefield(FB_ret,-1);
  42.         ac3 = makefield(FB_ret,0);/* set generation count to 0 (infinite) */
  43.         (void)jsys(JSchfdb,acs);    /* ignore any errors */
  44. #endif /* PCC_20 */
  45. #endif
  46.  
  47.     }
  48.     }
  49.     if (g_dolog && (g_logfp != (FILE *)NULL) && g_logname[0])
  50.     {
  51.     NEWLINE(g_logfp);
  52.  
  53. #if    (OS_TOPS20 | OS_VAXVMS)
  54.     (void)putc('?',g_logfp);        /* query at start of line */
  55. #endif
  56.  
  57.     (void)fputs(g_progname,g_logfp);
  58.     (void)fputs(": FATAL--",g_logfp);
  59.     (void)fputs(msg,g_logfp);
  60.     NEWLINE(g_logfp);
  61.     (void)fprintf(g_logfp,"Current TeX page counters: [%s]",tctos());
  62.     NEWLINE(g_logfp);
  63.     }
  64.  
  65. #if    DECWINDOWS                 /* No resetterm with DECWINDOWS    */
  66. #else
  67. #if    BBNBITGRAPH
  68.     rsetterm();
  69. #endif
  70. #endif
  71.  
  72.     NEWLINE(stderr);
  73.  
  74. #if    (OS_TOPS20 | OS_VAXVMS)
  75.     (void)putc('?',stderr);        /* query at start of line */
  76. #endif
  77.  
  78.     (void)fputs(g_progname,stderr);
  79.     (void)fputs(": FATAL--",stderr);
  80.     (void)fputs(msg,stderr);
  81.     NEWLINE(stderr);
  82.     (void)fprintf(stderr,"Current TeX page counters: [%s]",tctos());
  83.     NEWLINE(stderr);
  84.     NEWLINE(stderr);
  85.  
  86.     g_errenc = 1;            /* set global fatal exit code */
  87.     alldone();
  88. }
  89.  
  90.