/*1Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.2All rights reserved.3Copyright (C) 2007-2016, Gabriel Dos Reis.4All rights reserved.56Redistribution and use in source and binary forms, with or without7modification, are permitted provided that the following conditions are8met:910- Redistributions of source code must retain the above copyright11notice, this list of conditions and the following disclaimer.1213- Redistributions in binary form must reproduce the above copyright14notice, this list of conditions and the following disclaimer in15the documentation and/or other materials provided with the16distribution.1718- Neither the name of The Numerical Algorithms Group Ltd. nor the19names of its contributors may be used to endorse or promote products20derived from this software without specific prior written permission.2122THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS23IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED24TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A25PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER26OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,27EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,28PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR29PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF30LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING31NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS32SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.33*/3435#ifndef _PARSE_H_36#define _PARSE_H_ 13738#include "openaxiom-c-macros.h"3940#ifdef SUNplatform41#include <sys/types.h>42#endif4344#include <sys/stat.h>45#include <fcntl.h>46#include <sys/errno.h>47#include <ctype.h>48#include "hyper.h"4950#include <setjmp.h>5152extern void display_page(HyperDocPage * page);53extern void init_parse_patch(HyperDocPage * page);54extern void load_page(HyperDocPage * page);55extern void parse_HyperDoc(void );56extern void parse_from_string(char * str);57extern HyperDocPage * parse_page_from_socket(void );58extern HyperDocPage * parse_page_from_unixfd(void );59extern HyperLink * make_input_window(InputItem * item);60extern HyperLink * make_box_window(InputBox * box , int type);61extern void initialize_default(InputItem * item , char * buff);62extern void parse_inputstring();63extern void parse_simplebox();64extern void parse_radiobox();65extern void init_paste_item(InputItem * item);66extern void repaste_item();67extern InputItem * current_item();68extern int already_there(char * name);69extern void parse_radioboxes();70extern void add_dependencies(void );71extern FILE * find_fp(FilePosition fp);72extern char * get_input_string(void );73extern HyperLink * make_link_window(TextNode * link_node , int type , int isSubWin);74extern HyperLink * make_paste_window(PasteNode * paste);75extern void make_special_pages(HashTable * pageHashTable);76extern int window_code(Window * w , int size);77extern int window_equal(Window * w1 , Window * w2);78extern char * window_id(Window w);79extern void read_ht_db(HashTable * page_hash , HashTable * macro_hash , HashTable * patch_hash);80extern int get_filename();81extern int is_number(const char * str);82extern void parser_error(char * str);83extern SourceInputKind get_where();84extern void scan_HyperDoc();85extern int number(const char * str);86extern ParameterList init_parameter_elem(int number);87extern int push_parameters(ParameterList);88extern int pop_parameters();89extern int parse_macro();90extern void parse_parameters();9192extern jmp_buf jmpbuf;93extern int vbuff;9495extern TextNode *cur_spadcom; /* spad command being parsed *** */96extern TextNode *curr_node;97extern long page_start_fpos;/* tells the character position of the start98* of the page, needed to find the current99* position when restoring the scanner */100101/*102* Default sizes of hash tables103*/104105#define LinkHashSize 25106#define DependHashSize 20107108extern HashTable *gLinkHashTable; /* the hash table of active link windows */109110/*111* Flags and defines for the modes the parser can be in112*/113114#define AllMode 0115#define NoVerticalMode 1116#define SimpleMode 2117118extern short int gParserMode;119120/*121* Flags and defines for telling us what part of the page is being parsed.122*/123124extern short int gParserRegion;125extern short int gStringValueOk;126extern bool gEndedPage;127128extern int line_number;129130/*131* Things for handling macro parameters132*/133134135136extern ParameterList parameters;137138139/*140* The error buffer141*/142143extern char ebuffer[];144145#endif146147148