mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-07-04 08:40:21 +02:00
Add macros-internal.h
* libguile/macros-internal.h: New file. * libguile/Makefile.am (noinst_HEADERS): Add file. * libguile/macros.h: Remove internal definitions. * libguile/init.c: * libguile/macros.c: * libguile/print.c: Use internal file.
This commit is contained in:
parent
db13048459
commit
cce7a04e55
7 changed files with 78 additions and 47 deletions
|
@ -525,6 +525,7 @@ noinst_HEADERS = atomic.h \
|
||||||
gc-internal.h \
|
gc-internal.h \
|
||||||
gsubr-internal.h \
|
gsubr-internal.h \
|
||||||
keywords-internal.h \
|
keywords-internal.h \
|
||||||
|
macros-internal.h \
|
||||||
posix-w32.h \
|
posix-w32.h \
|
||||||
private-options.h \
|
private-options.h \
|
||||||
programs.h \
|
programs.h \
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include "hashtab.h"
|
#include "hashtab.h"
|
||||||
#include "keywords.h"
|
#include "keywords.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "macros.h"
|
#include "macros-internal.h"
|
||||||
#include "memoize.h" /* for the SCM_API declarations of 'scm_sym_' */
|
#include "memoize.h" /* for the SCM_API declarations of 'scm_sym_' */
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
#include "pairs.h"
|
#include "pairs.h"
|
||||||
|
|
|
@ -91,7 +91,7 @@
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "load.h"
|
#include "load.h"
|
||||||
#include "loader.h"
|
#include "loader.h"
|
||||||
#include "macros.h"
|
#include "macros-internal.h"
|
||||||
#include "memoize.h"
|
#include "memoize.h"
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
#include "net_db.h"
|
#include "net_db.h"
|
||||||
|
|
73
libguile/macros-internal.h
Normal file
73
libguile/macros-internal.h
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
#ifndef SCM_MACROS_INTERNAL_H
|
||||||
|
#define SCM_MACROS_INTERNAL_H
|
||||||
|
|
||||||
|
/* Copyright 1998,2000-2003,2006,2008-2010,2018,2025
|
||||||
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of Guile.
|
||||||
|
|
||||||
|
Guile is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Lesser General Public License as published
|
||||||
|
by the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
Guile is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with Guile. If not, see
|
||||||
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "libguile/macros.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
struct scm_syntax_transformer
|
||||||
|
{
|
||||||
|
scm_t_bits tag;
|
||||||
|
scm_t_macro_primitive primitive;
|
||||||
|
SCM name;
|
||||||
|
SCM type;
|
||||||
|
SCM binding;
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
scm_is_syntax_transformer (SCM x)
|
||||||
|
{
|
||||||
|
return SCM_HAS_TYP16 (x, scm_tc16_syntax_transformer);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline struct scm_syntax_transformer*
|
||||||
|
scm_to_syntax_transformer (SCM x)
|
||||||
|
{
|
||||||
|
if (!scm_is_syntax_transformer (x))
|
||||||
|
abort ();
|
||||||
|
return (struct scm_syntax_transformer *)SCM_UNPACK_POINTER (x);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline SCM
|
||||||
|
scm_from_syntax_transformer (struct scm_syntax_transformer *m)
|
||||||
|
{
|
||||||
|
return SCM_PACK_POINTER (m);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SCM_MACROP(x) scm_is_syntax_transformer (x)
|
||||||
|
#define SCM_VALIDATE_MACRO(p,v) SCM_MAKE_VALIDATE ((p), (v), MACROP)
|
||||||
|
|
||||||
|
typedef SCM (*scm_t_macro_primitive) (SCM, SCM);
|
||||||
|
|
||||||
|
SCM_INTERNAL int scm_i_print_syntax_transformer (SCM macro, SCM port,
|
||||||
|
scm_print_state *pstate);
|
||||||
|
SCM_INTERNAL
|
||||||
|
SCM scm_i_make_primitive_syntax_transformer (const char *name,
|
||||||
|
scm_t_macro_primitive fn);
|
||||||
|
SCM_INTERNAL scm_t_macro_primitive scm_i_primitive_syntax_transformer (SCM m);
|
||||||
|
|
||||||
|
SCM_INTERNAL void scm_init_macros (void);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* SCM_MACROS_INTERNAL_H */
|
|
@ -35,40 +35,7 @@
|
||||||
#include "threads-internal.h"
|
#include "threads-internal.h"
|
||||||
#include "variable.h"
|
#include "variable.h"
|
||||||
|
|
||||||
#include "macros.h"
|
#include "macros-internal.h"
|
||||||
|
|
||||||
|
|
||||||
struct scm_syntax_transformer
|
|
||||||
{
|
|
||||||
scm_t_bits tag;
|
|
||||||
scm_t_macro_primitive primitive;
|
|
||||||
SCM name;
|
|
||||||
SCM type;
|
|
||||||
SCM binding;
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
scm_is_syntax_transformer (SCM x)
|
|
||||||
{
|
|
||||||
return SCM_HAS_TYP16 (x, scm_tc16_syntax_transformer);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline struct scm_syntax_transformer*
|
|
||||||
scm_to_syntax_transformer (SCM x)
|
|
||||||
{
|
|
||||||
if (!scm_is_syntax_transformer (x))
|
|
||||||
abort ();
|
|
||||||
return (struct scm_syntax_transformer *)SCM_UNPACK_POINTER (x);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline SCM
|
|
||||||
scm_from_syntax_transformer (struct scm_syntax_transformer *m)
|
|
||||||
{
|
|
||||||
return SCM_PACK_POINTER (m);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SCM_MACROP(x) scm_is_syntax_transformer (x)
|
|
||||||
#define SCM_VALIDATE_MACRO(p,v) SCM_MAKE_VALIDATE ((p), (v), MACROP)
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -36,14 +36,4 @@ SCM_API SCM scm_macro_name (SCM m);
|
||||||
SCM_API SCM scm_macro_binding (SCM m);
|
SCM_API SCM scm_macro_binding (SCM m);
|
||||||
SCM_API SCM scm_macro_transformer (SCM m);
|
SCM_API SCM scm_macro_transformer (SCM m);
|
||||||
|
|
||||||
SCM_INTERNAL int scm_i_print_syntax_transformer (SCM macro, SCM port,
|
|
||||||
scm_print_state *pstate);
|
|
||||||
SCM_INTERNAL
|
|
||||||
SCM scm_i_make_primitive_syntax_transformer (const char *name,
|
|
||||||
scm_t_macro_primitive fn);
|
|
||||||
SCM_INTERNAL scm_t_macro_primitive scm_i_primitive_syntax_transformer (SCM m);
|
|
||||||
|
|
||||||
SCM_INTERNAL void scm_init_macros (void);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* SCM_MACROS_H */
|
#endif /* SCM_MACROS_H */
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
#include "gsubr.h"
|
#include "gsubr.h"
|
||||||
#include "hashtab.h"
|
#include "hashtab.h"
|
||||||
#include "keywords.h"
|
#include "keywords.h"
|
||||||
#include "macros.h"
|
#include "macros-internal.h"
|
||||||
#include "numbers.h"
|
#include "numbers.h"
|
||||||
#include "pairs.h"
|
#include "pairs.h"
|
||||||
#include "ports-internal.h"
|
#include "ports-internal.h"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue