Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

open-axiom repository from github

24005 views
1
/*
2
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
3
All rights reserved.
4
Copyright (C) 2007-2016, Gabriel Dos Reis.
5
All rights reserved.
6
7
Redistribution and use in source and binary forms, with or without
8
modification, are permitted provided that the following conditions are
9
met:
10
11
- Redistributions of source code must retain the above copyright
12
notice, this list of conditions and the following disclaimer.
13
14
- Redistributions in binary form must reproduce the above copyright
15
notice, this list of conditions and the following disclaimer in
16
the documentation and/or other materials provided with the
17
distribution.
18
19
- Neither the name of The Numerical Algorithms Group Ltd. nor the
20
names of its contributors may be used to endorse or promote products
21
derived from this software without specific prior written permission.
22
23
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
24
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
26
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
27
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
*/
35
36
#ifndef _PARSE_H_
37
#define _PARSE_H_ 1
38
39
#include "openaxiom-c-macros.h"
40
41
#ifdef SUNplatform
42
#include <sys/types.h>
43
#endif
44
45
#include <sys/stat.h>
46
#include <fcntl.h>
47
#include <sys/errno.h>
48
#include <ctype.h>
49
#include "hyper.h"
50
51
#include <setjmp.h>
52
53
extern void display_page(HyperDocPage * page);
54
extern void init_parse_patch(HyperDocPage * page);
55
extern void load_page(HyperDocPage * page);
56
extern void parse_HyperDoc(void );
57
extern void parse_from_string(char * str);
58
extern HyperDocPage * parse_page_from_socket(void );
59
extern HyperDocPage * parse_page_from_unixfd(void );
60
extern HyperLink * make_input_window(InputItem * item);
61
extern HyperLink * make_box_window(InputBox * box , int type);
62
extern void initialize_default(InputItem * item , char * buff);
63
extern void parse_inputstring();
64
extern void parse_simplebox();
65
extern void parse_radiobox();
66
extern void init_paste_item(InputItem * item);
67
extern void repaste_item();
68
extern InputItem * current_item();
69
extern int already_there(char * name);
70
extern void parse_radioboxes();
71
extern void add_dependencies(void );
72
extern FILE * find_fp(FilePosition fp);
73
extern char * get_input_string(void );
74
extern HyperLink * make_link_window(TextNode * link_node , int type , int isSubWin);
75
extern HyperLink * make_paste_window(PasteNode * paste);
76
extern void make_special_pages(HashTable * pageHashTable);
77
extern int window_code(Window * w , int size);
78
extern int window_equal(Window * w1 , Window * w2);
79
extern char * window_id(Window w);
80
extern void read_ht_db(HashTable * page_hash , HashTable * macro_hash , HashTable * patch_hash);
81
extern int get_filename();
82
extern int is_number(const char * str);
83
extern void parser_error(char * str);
84
extern SourceInputKind get_where();
85
extern void scan_HyperDoc();
86
extern int number(const char * str);
87
extern ParameterList init_parameter_elem(int number);
88
extern int push_parameters(ParameterList);
89
extern int pop_parameters();
90
extern int parse_macro();
91
extern void parse_parameters();
92
93
extern jmp_buf jmpbuf;
94
extern int vbuff;
95
96
extern TextNode *cur_spadcom; /* spad command being parsed *** */
97
extern TextNode *curr_node;
98
extern long page_start_fpos;/* tells the character position of the start
99
* of the page, needed to find the current
100
* position when restoring the scanner */
101
102
/*
103
* Default sizes of hash tables
104
*/
105
106
#define LinkHashSize 25
107
#define DependHashSize 20
108
109
extern HashTable *gLinkHashTable; /* the hash table of active link windows */
110
111
/*
112
* Flags and defines for the modes the parser can be in
113
*/
114
115
#define AllMode 0
116
#define NoVerticalMode 1
117
#define SimpleMode 2
118
119
extern short int gParserMode;
120
121
/*
122
* Flags and defines for telling us what part of the page is being parsed.
123
*/
124
125
extern short int gParserRegion;
126
extern short int gStringValueOk;
127
extern bool gEndedPage;
128
129
extern int line_number;
130
131
/*
132
* Things for handling macro parameters
133
*/
134
135
136
137
extern ParameterList parameters;
138
139
140
/*
141
* The error buffer
142
*/
143
144
extern char ebuffer[];
145
146
#endif
147
148