aboutsummaryrefslogtreecommitdiff
path: root/ntpd/ntp_scanner.h
diff options
context:
space:
mode:
Diffstat (limited to 'ntpd/ntp_scanner.h')
-rw-r--r--ntpd/ntp_scanner.h56
1 files changed, 34 insertions, 22 deletions
diff --git a/ntpd/ntp_scanner.h b/ntpd/ntp_scanner.h
index 67976371d8ff..11bbfe914be5 100644
--- a/ntpd/ntp_scanner.h
+++ b/ntpd/ntp_scanner.h
@@ -83,22 +83,28 @@ typedef enum {
typedef u_int32 scan_state;
+struct LCPOS {
+ int nline;
+ int ncol;
+};
-/* Structure to hold a filename, file pointer and positional info */
+/* Structure to hold a filename, file pointer and positional info.
+ * Instances are dynamically allocated, and the file name is copied by
+ * value into a dynamic extension of the 'fname' array. (Which *must* be
+ * the last field for that reason!)
+ */
struct FILE_INFO {
- const char * fname; /* Path to the file */
- FILE * fd; /* File Descriptor */
- int line_no; /* Line Number */
- int col_no; /* Column Number */
- int prev_line_col_no; /* Col No on the
- previous line when a
- '\n' was seen */
- int prev_token_line_no; /* Line at start of
- token */
- int prev_token_col_no; /* Col No at start of
- token */
- int err_line_no;
- int err_col_no;
+ struct FILE_INFO * st_next; /* next on stack */
+ FILE * fpi; /* File Descriptor */
+ int force_eof; /* locked or not */
+ int backch; /* ungetch buffer */
+
+ struct LCPOS curpos; /* current scan position */
+ struct LCPOS bakpos; /* last line end for ungetc */
+ struct LCPOS tokpos; /* current token position */
+ struct LCPOS errpos; /* error position */
+
+ char fname[1]; /* (formal only) buffered name */
};
@@ -106,25 +112,31 @@ struct FILE_INFO {
* ------------------------
*/
extern config_tree cfgt; /* Parser output stored here */
-extern int curr_include_level; /* The current include level */
/* VARIOUS EXTERNAL DECLARATIONS
* -----------------------------
*/
extern int old_config_style;
-extern int input_from_file;
-extern struct FILE_INFO *fp[];
/* VARIOUS SUBROUTINE DECLARATIONS
* -------------------------------
*/
extern const char *keyword(int token);
extern char *quote_if_needed(char *str);
-int yylex(struct FILE_INFO *);
+int yylex(void);
+
+/* managing the input source stack itself */
+extern int/*BOOL*/ lex_init_stack(const char * path, const char * mode);
+extern void lex_drop_stack(void);
+extern int/*BOOL*/ lex_flush_stack(void);
+
+/* add/remove a nested input source */
+extern int/*BOOL*/ lex_push_file(const char * path, const char * mode);
+extern int/*BOOL*/ lex_pop_file(void);
-struct FILE_INFO *F_OPEN(const char *path, const char *mode);
-int FGETC(struct FILE_INFO *stream);
-int UNGETC(int ch, struct FILE_INFO *stream);
-int FCLOSE(struct FILE_INFO *stream);
+/* input stack state query functions */
+extern size_t lex_level(void);
+extern int/*BOOL*/ lex_from_file(void);
+extern struct FILE_INFO * lex_current(void);
#endif /* NTP_SCANNER_H */