GNU PROLOG with UTF8 support
wam_parser.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------*
2  * GNU Prolog *
3  * *
4  * Part : WAM to mini-assembler translator *
5  * File : wam_parser.h *
6  * Descr.: parser - header file *
7  * Author: Daniel Diaz *
8  * *
9  * Copyright (C) 1999-2015 Daniel Diaz *
10  * *
11  * This file is part of GNU Prolog *
12  * *
13  * GNU Prolog is free software: you can redistribute it and/or *
14  * modify it under the terms of either: *
15  * *
16  * - the GNU Lesser General Public License as published by the Free *
17  * Software Foundation; either version 3 of the License, or (at your *
18  * option) any later version. *
19  * *
20  * or *
21  * *
22  * - the GNU General Public License as published by the Free *
23  * Software Foundation; either version 2 of the License, or (at your *
24  * option) any later version. *
25  * *
26  * or both in parallel, as here. *
27  * *
28  * GNU Prolog is distributed in the hope that it will be useful, *
29  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
30  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
31  * General Public License for more details. *
32  * *
33  * You should have received copies of the GNU General Public License and *
34  * the GNU Lesser General Public License along with this program. If *
35  * not, see http://www.gnu.org/licenses/. *
36  *-------------------------------------------------------------------------*/
37 
38 
39 /*---------------------------------*
40  * Constants *
41  *---------------------------------*/
42 
43 /*---------------------------------*
44  * Type Definitions *
45  *---------------------------------*/
46 
47 typedef enum
48 { /* skip 256 to specify a given char */
49  ATOM = 256, /* an atom */
50  INTEGER, /* an integer */
51  FLOAT, /* a double */
52  X_Y, /* x(X) or y(Y) */
53  F_N, /* a ATOM / INTEGER */
54  MP_N, /* a [ATOM :] ATOM / INTEGER (optional module qualif) */
55  LABEL, /* a label */
56  ANY, /* ATOM or INTEGER or F_N or FLOAT or X_Y */
57  LIST_INST /* a list of instructions */
58 }
59 ArgTyp;
60 
61 
62 #define L1(t) L2(t, 0)
63 #define L2(t1, t2) ((t1 << 16) | (t2))
64 #define DECODE_L2(a, t1, t2) t1 = (a) >> 16; t2 = (a) & ((1 << 16) - 1)
65 
66 typedef double ArgVal; /* to ensure double alignment */
67 
68 
69 
70 
71 /*---------------------------------*
72  * Global Variables *
73  *---------------------------------*/
74 
75 /*---------------------------------*
76  * Function Prototypes *
77  *---------------------------------*/
78 
79 int Parse_Wam_File(char *file_name_in, int comment);
80 
81 void Syntax_Error(char *s);
82 
83 
84 
85 #define Add_Arg(ptr, type, val) (*((type *) (ptr)) = (val) , (ptr)++)
86 
87 #define Get_Arg(ptr, type, val) ((val) = *((type *) (ptr)) , (ptr)++)
Definition: wam_parser.h:53
Definition: wam_parser.h:50
Definition: wam_parser.h:57
Definition: wam_parser.h:52
double ArgVal
Definition: wam_parser.h:66
int Parse_Wam_File(char *file_name_in, int comment)
Definition: wam_parser.c:219
int comment
Definition: ma2asm.c:100
Definition: wam_parser.h:55
Definition: wam_parser.h:51
char * file_name_in
Definition: ma2asm.c:95
void Syntax_Error(char *s)
Definition: ma_parser.c:826
Definition: wam_parser.h:49
ArgTyp
Definition: wam_parser.h:47
Definition: wam_parser.h:54
Definition: wam_parser.h:56