~ubuntu-branches/ubuntu/warty/aqsis/warty

« back to all changes in this revision

Viewing changes to slpp/pp7.c

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-08-24 07:25:04 UTC
  • Revision ID: james.westby@ubuntu.com-20040824072504-zf993vnevvisdsvb
Tags: upstream-0.9.1
ImportĀ upstreamĀ versionĀ 0.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/************************************************************************/
 
2
/*                                                                      */
 
3
/*      File:   pp7.c                                                   */
 
4
/*                                                                      */
 
5
/*      Error message routines.                                         */
 
6
/*                                                                      */
 
7
/*      Written by:                                                     */
 
8
/*                      Gary Oliver                                     */
 
9
/*                      3420 NW Elmwood Dr.                             */
 
10
/*                      PO Box 826                                      */
 
11
/*                      Corvallis, Oregon 97339                         */
 
12
/*                      (503)758-5549                                   */
 
13
/*      Maintained by:                                                  */
 
14
/*                      Kirk Bailey                                     */
 
15
/*                      Logical Systems                                 */
 
16
/*                      P.O. Box 1702                                   */
 
17
/*                      Corvallis, OR 97339                             */
 
18
/*                      (503)753-9051                                   */
 
19
/*                                                                      */
 
20
/*      This program is hereby placed in the public domain.  In         */
 
21
/*      contrast to other claims of "public domain", this means no      */
 
22
/*      copyright is claimed and you may do anything you like with PP,  */
 
23
/*      including selling it!  As a gesture of courtesy, please retain  */
 
24
/*      the authorship information in the source code and               */
 
25
/*      documentation.                                                  */
 
26
/*                                                                      */
 
27
/*      Functions contained within this module:                         */
 
28
/*                                                                      */
 
29
/*              end_of_file             Fatal for Unexpected EOF.       */
 
30
/*              fatal                   Print FATAL diagnostic.         */
 
31
/*              illegal_symbol          Print illegal symbol diagnostic.*/
 
32
/*              non_fatal               Print normal error message.     */
 
33
/*              out_of_memory           Fatal for out of memory.        */
 
34
/*              prmsg                   Print a error/warning message.  */
 
35
/*              warning                 Print a warning message.        */
 
36
/*                                                                      */
 
37
/************************************************************************/
 
38
 
 
39
#include        "pp.h"
 
40
#include        "ppext.h"
 
41
 
 
42
/************************************************************************/
 
43
/*                                                                      */
 
44
/*      end_of_file                                                     */
 
45
/*                                                                      */
 
46
/*      Print fatal "Unexpected EOF" message.                           */
 
47
/*                                                                      */
 
48
/************************************************************************/
 
49
 
 
50
void
 
51
end_of_file()
 
52
        {
 
53
        fatal("Unexpected EOF","");
 
54
        }
 
55
 
 
56
/************************************************************************/
 
57
/*                                                                      */
 
58
/*      fatal                                                           */
 
59
/*                                                                      */
 
60
/*      Print error message to standard error and abort.                */
 
61
/*                                                                      */
 
62
/************************************************************************/
 
63
 
 
64
void
 
65
fatal(s1,s2)
 
66
        char                    *s1;
 
67
        char                    *s2;
 
68
        {
 
69
        fprintf(STDERR,"FATAL: %s%s\n",s1,s2);  /* Print message */
 
70
        exit(TRUE);
 
71
        }
 
72
 
 
73
/************************************************************************/
 
74
/*                                                                      */
 
75
/*      illegal_symbol                                                  */
 
76
/*                                                                      */
 
77
/*      Print error message with Token as illegal symbol name.          */
 
78
/*                                                                      */
 
79
/************************************************************************/
 
80
 
 
81
void
 
82
illegal_symbol()
 
83
        {
 
84
        non_fatal("Illegal symbol name: ",Token);
 
85
        }
 
86
 
 
87
/************************************************************************/
 
88
/*                                                                      */
 
89
/*      non_fatal                                                       */
 
90
/*                                                                      */
 
91
/*      Print error message to standard error and count it.             */
 
92
/*                                                                      */
 
93
/************************************************************************/
 
94
 
 
95
void
 
96
non_fatal(s1,s2)
 
97
        char                    *s1;
 
98
        char                    *s2;
 
99
        {
 
100
        prmsg("",s1,s2);
 
101
        Errors++;                       /* Count the error */
 
102
        }
 
103
 
 
104
/************************************************************************/
 
105
/*                                                                      */
 
106
/*      out_of_memory                                                   */
 
107
/*                                                                      */
 
108
/*      Print fatal "Out of memory" message.                            */
 
109
/*                                                                      */
 
110
/************************************************************************/
 
111
 
 
112
void
 
113
out_of_memory()
 
114
        {
 
115
        fatal("Out of memory","");
 
116
        }
 
117
 
 
118
/************************************************************************/
 
119
/*                                                                      */
 
120
/*      prmsg                                                           */
 
121
/*                                                                      */
 
122
/*      Print a non_fatal/warning message to standard error.            */
 
123
/*                                                                      */
 
124
/*      Note:   If the file stack is < 0, then all files have been      */
 
125
/*              popped off the stack.  Use 0 (the original file name.)  */
 
126
/*                                                                      */
 
127
/************************************************************************/
 
128
 
 
129
void
 
130
prmsg(s1,s2,s3)
 
131
        char                    *s1;
 
132
        char                    *s2;
 
133
        char                    *s3;
 
134
        {
 
135
        fprintf(STDERR,"<%s> @ %u: %s%s%s\n",
 
136
                Filestack[Filelevel >= 0 ? Filelevel : 0]->f_name,LLine,
 
137
                        s1,s2,s3);
 
138
        }
 
139
 
 
140
/************************************************************************/
 
141
/*                                                                      */
 
142
/*      warning                                                         */
 
143
/*                                                                      */
 
144
/*      Print standard warning message to standard error.               */
 
145
/*                                                                      */
 
146
/************************************************************************/
 
147
 
 
148
void
 
149
warning(s1,s2)
 
150
        char                    *s1;
 
151
        char                    *s2;
 
152
        {
 
153
        prmsg("WARNING: ",s1,s2);
 
154
        }