pic.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* This file is part of the GNU plotutils package. Copyright (C) 1995,
  2. 1996, 1997, 1998, 1999, 2000, 2005, 2008, Free Software Foundation, Inc.
  3. The GNU plotutils package is free software. You may redistribute it
  4. and/or modify it under the terms of the GNU General Public License as
  5. published by the Free Software foundation; either version 2, or (at your
  6. option) any later version.
  7. The GNU plotutils package is distributed in the hope that it will be
  8. useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. General Public License for more details.
  11. You should have received a copy of the GNU General Public License along
  12. with the GNU plotutils package; see the file COPYING. If not, write to
  13. the Free Software Foundation, Inc., 51 Franklin St., Fifth Floor,
  14. Boston, MA 02110-1301, USA. */
  15. // include system headers: stdio, string, math (+ M_PI, M_SQRT2), stdlib, errno
  16. #include "sys-defines.h"
  17. // include all libgroff headers in ./include.
  18. #include "cset.h"
  19. #include "errarg.h"
  20. #include "error.h"
  21. #include "lib.h"
  22. #include "position.h"
  23. #include "ptable.h"
  24. #include "stringclass.h"
  25. #include "text.h"
  26. // declare input and file_input classes
  27. class input
  28. {
  29. public:
  30. // ctor, dtor
  31. input ();
  32. virtual ~input ();
  33. // public functions (all virtual)
  34. virtual int get (void) = 0;
  35. virtual int peek (void) = 0;
  36. virtual int get_location (const char **filenamep, int *linenop);
  37. // friend classes
  38. friend class input_stack;
  39. friend class copy_rest_thru_input;
  40. private:
  41. input *next;
  42. };
  43. class file_input : public input
  44. {
  45. public:
  46. // ctor, dtor
  47. file_input (FILE *, const char *);
  48. ~file_input ();
  49. // public functions
  50. int get (void);
  51. int peek (void);
  52. int get_location(const char **filenamep, int *linenop);
  53. private:
  54. FILE *fp;
  55. const char *filename;
  56. int lineno;
  57. string line;
  58. const char *ptr;
  59. int read_line (void);
  60. };
  61. // External functions
  62. // interface to lexer in lex.cc
  63. extern int yylex (void);
  64. extern void copy_file_thru (const char *filename, const char *body, const char *until);
  65. extern void copy_rest_thru (const char *body, const char *until);
  66. extern void do_copy (const char *filename);
  67. extern void do_for (char *var, double from, double to, int by_is_multiplicative, double by, char *body);
  68. extern void do_lookahead (void);
  69. extern void lex_cleanup (void);
  70. extern void lex_error (const char *message, const errarg &arg1 = empty_errarg, const errarg &arg2 = empty_errarg, const errarg &arg3 = empty_errarg);
  71. extern void lex_init (input *top);
  72. extern void lex_warning (const char *message, const errarg &arg1 = empty_errarg, const errarg &arg2 = empty_errarg, const errarg &arg3 = empty_errarg);
  73. extern void push_body (const char *s);
  74. extern void yyerror (const char *s);
  75. // interface to parser in gram.cc
  76. extern int yyparse();
  77. extern void parse_init (void);
  78. extern void parse_cleanup (void);
  79. extern int delim_flag; // read-only variable
  80. // Command-line flags in main.cc, used by lexer, parser, or driver
  81. extern int command_char;
  82. extern int compatible_flag;
  83. extern int safer_flag;
  84. extern int no_centering_flag;