home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / tex / lametex_.z / lametex_ / lametex / src / FileInput.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-19  |  2.0 KB  |  76 lines

  1. /* FileInput.h
  2.  *
  3.  * The text to be parsed is broken into fundamental units called tokens.
  4.  * This file defines the Token class.
  5.  *
  6.  * Copyright 1992 Jonathan Monsarrat. Permission given to freely distribute,
  7.  * edit and use as long as this copyright statement remains intact.
  8.  *
  9.  */
  10.  
  11. #include <fstream.h>
  12. #include "Token.h"
  13. const MAXFILES = 10;
  14. const MAXPAGES = 100;
  15.  
  16. class TextFile {
  17.    int valid;                // Is file ready & open for reading, not at EOF?
  18.    int token_on_this_line;
  19.    int linenum;
  20.    char filename[MAXSTRING];
  21.    char token_text[MAXSTRING];
  22.    ifstream current_file;    // The stream pointer from the input file
  23.    int just_got_a_newline;
  24.    int just_got_whitespace;
  25.    int previous_got_whitespace;
  26.  
  27.    void handle_comment();
  28.  public:
  29.    TextFile(char *);
  30.    ~TextFile();
  31.    void get_token(Token& token);
  32.    int isvalid();
  33.    int match(char *);
  34.    void fatal_error(char *);
  35.    void warning(char *);
  36.    void got_whitespace();
  37.    int whitespace_next();
  38.    int whitespace_prev();
  39. };
  40.  
  41. class FileInput {
  42.    char filename[MAXSTRING]; // Main LaTeX file to read input from.
  43.    int filenum;
  44.    TextFile *file[MAXFILES];
  45.    void add_pagedir(char *);
  46.    char pspage[MAXSTRING];         // Next pspage to use
  47.    char current_pspage[MAXSTRING]; // Current pspage being used.
  48.    char *pagedir[MAXPAGES];
  49.    int num_pagedirs;
  50.  
  51. public:   
  52.    ofstream outfile;
  53.    char outfileroot[MAXSTRING];
  54.    int blankline_area;
  55.    int newline_in_this_blankline_area;
  56.    float vspace_in_this_blankline_area;
  57.    float readjust_vspace;
  58.    char outfilename[MAXSTRING];
  59.    int plain_text_output;
  60.  
  61.    FileInput(int argc, char *argv[]);
  62.    void get_token(Token &token);   // Prepare to parse tokens.
  63.    void include_file(char *);
  64.    void fatal_error(char *);
  65.    void warning(char *);
  66.    void comma_delimiter(int);
  67.    void set_parsing_length(int);
  68.    void use_pspage(char *);
  69.    void force_space();
  70.    void force_start_page();
  71.    void include_file_ps(char *, int);
  72.    void got_whitespace();
  73.    int whitespace_next();
  74.    int whitespace_prev();
  75. };
  76.