add weak sets
[bpt/guile.git] / libguile / snarf.h
index 9bb998e..1c072ba 100644 (file)
@@ -30,7 +30,7 @@
 #define SCM_FUNC_CAST_ARBITRARY_ARGS  scm_t_subr
 
 
-#if (defined SCM_ALIGNED) && (SCM_DEBUG_TYPING_STRICTNESS <= 1)
+#ifdef SCM_ALIGNED
 /* We support static allocation of some `SCM' objects.  */
 # define SCM_SUPPORT_STATIC_ALLOCATION
 #endif
  * The SCM_SNARF_INIT text goes into the corresponding .x file
  * up through the first occurrence of SCM_SNARF_DOC_START on that
  * line, if any.
+ *
+ * Some debugging options can cause the preprocessor to echo #define
+ * directives to its output. Keeping the snarfing markers on separate
+ * lines prevents guile-snarf from inadvertently snarfing the definition
+ * of SCM_SNARF_INIT if those options are in effect.
  */
 
 #ifdef SCM_MAGIC_SNARF_INITS
 # define SCM_SNARF_HERE(X)
-# define SCM_SNARF_INIT(X) ^^ X ^:^
+# define SCM_SNARF_INIT_PREFIX ^^
+# define SCM_SNARF_INIT(X) SCM_SNARF_INIT_PREFIX X ^:^
 # define SCM_SNARF_DOCS(TYPE, CNAME, FNAME, ARGLIST, REQ, OPT, VAR, DOCSTRING)
 #else
 # ifdef SCM_MAGIC_SNARF_DOCS
@@ -353,7 +359,7 @@ SCM_SNARF_INIT(scm_set_smob_apply((tag), (c_name), (req), (opt), (rest));)
                             (scm_t_bits) &scm_i_paste (c_name,         \
                                                        _stringbuf),    \
                             (scm_t_bits) 0,                            \
-                            (scm_t_bits) sizeof (contents) - 1)
+                             (scm_t_bits) (sizeof (contents) - 1))
 
 #define SCM_IMMUTABLE_POINTER(c_name, ptr)             \
   SCM_IMMUTABLE_CELL (c_name, scm_tc7_pointer, ptr)
@@ -366,14 +372,19 @@ SCM_SNARF_INIT(scm_set_smob_apply((tag), (c_name), (req), (opt), (rest));)
     SCM_PACK (0),                                                       \
     foreign,                                                            \
     SCM_BOOL_F, /* the name */                                          \
-  };                                                                   \
+  }
 
 #define SCM_STATIC_PROGRAM(c_name, objcode, objtable, freevars)         \
-  SCM_STATIC_DOUBLE_CELL (c_name,                                       \
-                          scm_tc7_program | SCM_F_PROGRAM_IS_PRIMITIVE,        \
-                          (scm_t_bits) objcode,                         \
-                          (scm_t_bits) objtable,                        \
-                          (scm_t_bits) freevars)
+  static SCM_ALIGNED (8) SCM_UNUSED SCM                                 \
+       scm_i_paste (c_name, _raw_cell)[] =                              \
+  {                                                                     \
+    SCM_PACK (scm_tc7_program | SCM_F_PROGRAM_IS_PRIMITIVE),            \
+    objcode,                                                            \
+    objtable,                                                           \
+    freevars                                                            \
+  };                                                                    \
+  static SCM_UNUSED const SCM c_name =                                  \
+    SCM_PACK (& scm_i_paste (c_name, _raw_cell))
 
 #endif /* SCM_SUPPORT_STATIC_ALLOCATION */