summaryrefslogtreecommitdiff
path: root/support/lametex/src/FileInput.h
blob: 73e042576eca9723225f5654260a8d8d3617a4c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* FileInput.h
 *
 * The text to be parsed is broken into fundamental units called tokens.
 * This file defines the Token class.
 *
 * Copyright 1992 Jonathan Monsarrat. Permission given to freely distribute,
 * edit and use as long as this copyright statement remains intact.
 *
 */

#include <fstream.h>
#include "Token.h"
const MAXFILES = 10;
const MAXPAGES = 100;

class TextFile {
   int valid;                // Is file ready & open for reading, not at EOF?
   int token_on_this_line;
   int linenum;
   char filename[MAXSTRING];
   char token_text[MAXSTRING];
   ifstream current_file;    // The stream pointer from the input file
   int just_got_a_newline;
   int just_got_whitespace;
   int previous_got_whitespace;

   void handle_comment();
 public:
   TextFile(char *);
   ~TextFile();
   void get_token(Token& token);
   int isvalid();
   int match(char *);
   void fatal_error(char *);
   void warning(char *);
   void got_whitespace();
   int whitespace_next();
   int whitespace_prev();
};

class FileInput {
   char filename[MAXSTRING]; // Main LaTeX file to read input from.
   int filenum;
   TextFile *file[MAXFILES];
   void add_pagedir(char *);
   char pspage[MAXSTRING];         // Next pspage to use
   char current_pspage[MAXSTRING]; // Current pspage being used.
   char *pagedir[MAXPAGES];
   int num_pagedirs;

public:   
   ofstream outfile;
   char outfileroot[MAXSTRING];
   int blankline_area;
   int newline_in_this_blankline_area;
   float vspace_in_this_blankline_area;
   float readjust_vspace;
   char outfilename[MAXSTRING];
   int plain_text_output;

   FileInput(int argc, char *argv[]);
   void get_token(Token &token);   // Prepare to parse tokens.
   void include_file(char *);
   void fatal_error(char *);
   void warning(char *);
   void comma_delimiter(int);
   void set_parsing_length(int);
   void use_pspage(char *);
   void force_space();
   void force_start_page();
   void include_file_ps(char *, int);
   void got_whitespace();
   int whitespace_next();
   int whitespace_prev();
};