home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / id-utils-3.2-src.tgz / tar.out / fsf / id-utils / libidu / scanners.h < prev    next >
C/C++ Source or Header  |  1996-09-28  |  2KB  |  71 lines

  1. /* scanners.h -- defs for interface to scanners.c
  2.    Copyright (C) 1986, 1995, 1996 Free Software Foundation, Inc.
  3.    Written by Greg McGary <gkm@gnu.ai.mit.edu>
  4.  
  5.    This program is free software; you can redistribute it and/or modify
  6.    it under the terms of the GNU General Public License as published by
  7.    the Free Software Foundation; either version 2, or (at your option)
  8.    any later version.
  9.  
  10.    This program is distributed in the hope that it will be useful,
  11.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.    GNU General Public License for more details.
  14.  
  15.    You should have received a copy of the GNU General Public License
  16.    along with this program; if not, write to the Free Software
  17.    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  18.  
  19. #ifndef _scanners_h_
  20. #define _scanners_h_
  21.  
  22. #include "xobstack.h"
  23.  
  24. #define MAX_LEVELS 5        /* log_8 of the max # of files: log_8 (32768) == 5 */
  25.  
  26. struct token
  27. {
  28.   unsigned short tok_count;
  29.   unsigned char tok_flags;
  30.   unsigned char tok_hits[MAX_LEVELS];
  31.   char tok_name[1];
  32. };
  33.  
  34. typedef struct token *(*get_token_func_t) __P((FILE *in_FILE, void const *args, int *flags));
  35. typedef void *(*parse_args_func_t) __P((char **argv, int argc));
  36. typedef void (*help_me_func_t) __P((void));
  37.  
  38. struct language
  39. {
  40.   char const *lg_name;
  41.   parse_args_func_t lg_parse_args;
  42.   get_token_func_t lg_get_token;
  43.   help_me_func_t lg_help_me;
  44.   int lg_argc;
  45.   char *lg_argv[16];
  46. };
  47.  
  48. struct lang_args
  49. {
  50.   struct language const *la_language;
  51.   char const *la_pattern;    /* fnmatch(3) pattern */
  52.   char *la_args_string;    /* human-readable scanner args */
  53.   void const *la_args_digested;    /* pre-parsed scanner args */
  54.   int la_index;
  55.   struct lang_args *la_next;
  56. };
  57.  
  58. extern void language_help_me __P((void));
  59. extern void language_getopt __P((void));
  60. extern void language_save_arg __P((char *arg));
  61. extern struct language *get_language __P((char const *lang_name));
  62. extern void parse_language_map __P((char const *file_name));
  63. extern void set_default_language __P((char const *lang_name));
  64.  
  65. extern struct lang_args *lang_args_default;
  66. extern struct lang_args *lang_args_list;
  67.  
  68. extern struct obstack tokens_obstack;
  69.  
  70. #endif /* not _scanners_h_ */
  71.