home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / fontutils-0.6-base.tgz / fontutils-0.6-base.tar / fsf / fontutils / charspace / symtab.h < prev    next >
C/C++ Source or Header  |  1992-06-14  |  2KB  |  79 lines

  1. /* symtab.h: declarations for our symbol table manipulations.
  2.  
  3. Copyright (C) 1992 Free Software Foundation, Inc.
  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., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  18.  
  19. #ifndef SYMTAB_H
  20. #define SYMTAB_H
  21.  
  22. #include "char.h"
  23. #include "types.h"
  24. #include "realstrval.h"
  25.  
  26.  
  27. /* What a single symbol looks like.  */
  28.  
  29. typedef struct
  30. {
  31.   symval_tag_type tag;
  32.   
  33.   union
  34.   {
  35.     real_string_val_type real_string_val;
  36.     char_type char_val;
  37.   } value;
  38. } symval_type;
  39.  
  40. /* Accessor macros.  */
  41. #define SYMVAL_TAG(s)    ((s).tag)
  42. #define SYMVAL_CHAR(s)    ((s).value.char_val)
  43. #define SYMVAL_REAL(s)    ((s).value.real_string_val.real_val)
  44. #define SYMVAL_REAL_STRING(s) ((s).value.real_string_val)
  45. #define SYMVAL_STRING(s)((s).value.real_string_val.string_val)
  46.  
  47.  
  48. /* Create new value nodes of the various types.  */
  49. extern symval_type symtab_char_node (symval_type lsb, symval_type rsb);
  50. extern symval_type symtab_real_node (real);
  51. extern symval_type symtab_real_string_node (real, string);
  52. extern symval_type symtab_string_node (string);
  53.  
  54. /* Define the identifier KEY to be the value V.  Overwrite any
  55.    previous definition of KEY.  */
  56. extern void symtab_define (string key, symval_type v);
  57.  
  58. /* Define a kern K between the characters named LEFT and RIGHT.  */
  59. extern void symtab_define_kern (string left, string right, symval_type k);
  60.  
  61.  
  62. /* Return the value of KEY, or NULL.  */
  63. extern symval_type *symtab_lookup (string key);
  64.  
  65. /* Resolve KEY to a real if possible and return the result.  If it
  66.    cannot be resolved, give a fatal error.  */
  67. extern real symtab_lookup_real (string key);
  68.  
  69.  
  70. /* Resolve the definition of SV to a real, if possible.  Return success.  */
  71. extern boolean symval_resolve (symval_type *sv);
  72.  
  73.  
  74. /* Return a string describing SV (e.g., for error messages).  The string
  75.    is allocated with malloc.  */
  76. extern string symval_as_string (symval_type sv);
  77.  
  78. #endif /* not SYMTAB_H */
  79.