OSDN Git Service

* c-lex.c (read_escape, read_ucs): Delete.
[pf3gnuchains/gcc-fork.git] / gcc / cpplib.h
index 6100633..bfc6a3f 100644 (file)
@@ -20,10 +20,11 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  In other words, you are welcome to use, share and improve this program.
  You are forbidden to forbid anyone else to use, share and improve
  what you give them.   Help stamp out software-hoarding!  */
-#ifndef __GCC_CPPLIB__
-#define __GCC_CPPLIB__
+#ifndef GCC_CPPLIB_H
+#define GCC_CPPLIB_H
 
 #include <sys/types.h>
+#include "hashtable.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -37,7 +38,7 @@ typedef struct cpp_buffer cpp_buffer;
 typedef struct cpp_options cpp_options;
 typedef struct cpp_token cpp_token;
 typedef struct cpp_string cpp_string;
-typedef struct c_common_identifier cpp_hashnode;
+typedef struct cpp_hashnode cpp_hashnode;
 typedef struct cpp_macro cpp_macro;
 typedef struct cpp_lexer_pos cpp_lexer_pos;
 typedef struct cpp_lookahead cpp_lookahead;
@@ -45,6 +46,7 @@ typedef struct cpp_callbacks cpp_callbacks;
 
 struct answer;
 struct file_name_map_list;
+struct ht;
 
 /* The first two groups, apart from '=', can appear in preprocessor
    expressions.  This allows a lookup table to be implemented in
@@ -466,19 +468,20 @@ enum builtin_type
   BT_STDC                      /* `__STDC__' */
 };
 
-#include "c-rid.h"
-
-#define C_RID_CODE(id) (((struct c_common_identifier *) (id))->rid_code)
+#define CPP_HASHNODE(HNODE)    ((cpp_hashnode *) (HNODE))
+#define HT_NODE(NODE)          ((ht_identifier *) (NODE))
+#define NODE_LEN(NODE)         HT_LEN (&(NODE)->ident)
+#define NODE_NAME(NODE)                HT_STR (&(NODE)->ident)
 
 /* The common part of an identifier node shared amongst all 3 C front
    ends.  Also used to store CPP identifiers, which are a superset of
    identifiers in the grammatical sense.  */
-struct c_common_identifier
+struct cpp_hashnode
 {
-  struct tree_identifier ident;                /* See tree-core.h.  */
+  struct ht_identifier ident;
   unsigned short arg_index;            /* Macro argument index.  */
   unsigned char directive_index;       /* Index into directive table.  */
-  ENUM_BITFIELD(rid) rid_code : 8;     /* Rid code - for front ends.  */
+  unsigned char rid_code;              /* Rid code - for front ends.  */
   ENUM_BITFIELD(node_type) type : 8;   /* CPP node type.  */
   unsigned char flags;                 /* CPP flags.  */
 
@@ -491,8 +494,12 @@ struct c_common_identifier
   } value;
 };
 
-/* Call this first to get a handle to pass to other functions.  */
-extern cpp_reader *cpp_create_reader PARAMS ((enum c_lang));
+/* Call this first to get a handle to pass to other functions.  If you
+   want cpplib to manage its own hashtable, pass in a NULL pointer.
+   Or you can pass in an initialised hash table that cpplib will use;
+   this technique is used by the C front ends.  */
+extern cpp_reader *cpp_create_reader PARAMS ((struct ht *,
+                                             enum c_lang));
 
 /* Call this to release the handle.  Any use of the handle after this
    function returns is invalid.  Returns cpp_errors (pfile).  */
@@ -594,15 +601,22 @@ extern int cpp_ideq                       PARAMS ((const cpp_token *,
 extern void cpp_output_line            PARAMS ((cpp_reader *, FILE *));
 extern void cpp_output_token           PARAMS ((const cpp_token *, FILE *));
 extern const char *cpp_type2name       PARAMS ((enum cpp_ttype));
+extern unsigned int cpp_parse_escape   PARAMS ((cpp_reader *,
+                                                const unsigned char **,
+                                                const unsigned char *,
+                                                unsigned HOST_WIDE_INT, int));
 
 /* In cpphash.c */
+
+/* Lookup an identifier in the hashtable.  Puts the identifier in the
+   table if it is not already there.  */
 extern cpp_hashnode *cpp_lookup                PARAMS ((cpp_reader *,
-                                                const unsigned char *, size_t));
+                                                const unsigned char *,
+                                                unsigned int));
+
+typedef int (*cpp_cb) PARAMS ((cpp_reader *, cpp_hashnode *, void *));
 extern void cpp_forall_identifiers     PARAMS ((cpp_reader *,
-                                                int (*) PARAMS ((cpp_reader *,
-                                                                 cpp_hashnode *,
-                                                                 void *)),
-                                                void *));
+                                                cpp_cb, void *));
 
 /* In cppmacro.c */
 extern void cpp_scan_buffer_nooutput   PARAMS ((cpp_reader *, int));
@@ -617,4 +631,4 @@ extern void cpp_make_system_header PARAMS ((cpp_reader *, int, int));
 #ifdef __cplusplus
 }
 #endif
-#endif /* __GCC_CPPLIB__ */
+#endif /* GCC_CPPLIB_H */