summaryrefslogtreecommitdiff
path: root/gcc/melt
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2013-10-14 08:07:35 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2013-10-14 08:07:35 +0000
commitbd4564e2cce3f4d1e54c3228ddd8c0a8c7aff4c3 (patch)
tree2d7f00c5cc3ebef5e8962697acf1b65877788bda /gcc/melt
parent643facd9f6a214663d088c7441b8c44196177d88 (diff)
downloadgcc-bd4564e2cce3f4d1e54c3228ddd8c0a8c7aff4c3.tar.gz
2013-10-14 Basile Starynkevitch <basile@starynkevitch.net>
* melt/warmelt-first.melt (class_module_context): New mocx_macroenv field. * melt/warmelt-outobj.melt (compile_list_sexpr) (compile_first_bootstrap_list_sexpr) (melt_translate_run_macroexpansions_list): Fill it to a fresh environment. * melt/warmelt-modes.melt (makedoc_docmd): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@203512 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/melt')
-rw-r--r--gcc/melt/warmelt-first.melt16
-rw-r--r--gcc/melt/warmelt-modes.melt2
-rw-r--r--gcc/melt/warmelt-outobj.melt12
3 files changed, 22 insertions, 8 deletions
diff --git a/gcc/melt/warmelt-first.melt b/gcc/melt/warmelt-first.melt
index 0904b8343fb..6b24b5200cb 100644
--- a/gcc/melt/warmelt-first.melt
+++ b/gcc/melt/warmelt-first.melt
@@ -876,6 +876,7 @@ subclasses are produced by macro expanders.}# )
mocx_expfieldict ;dict of exported fields
mocx_expclassdict ;dict of exported classes
mocx_initialenv ;the initial environment
+ mocx_macroenv ;the macro environment
mocx_funcount ;a boxed counter for defined functions
mocx_filetuple ;vector for different generated files
mocx_cflags ;cflags of generated module
@@ -895,13 +896,14 @@ subclasses are produced by macro expanders.}# )
module or extension context of a translation. $MOCX_MODULENAME gives
the module name, $MOCX_EXPFIELDICT gives the dictionnary of exported
fields, $MOCX_EXPCLASSDICT gives the dictionnary of exported classes,
-and $MOCX_INITIALENV the initial environment. $MOCX_FUNCOUNT is a
-boxed integer counting the defined functions (excluding $LAMBDA-s,
-counting only $DEFUN), used to help generate C code in several files,
-described in $MOCX_FILETUPLE. $MOCX_CFLAGS is for the C compilation
-flags of the module. $MOCX_LINKFLAGS is for the linking
-flags. $MOCX_CHEADERLIST is the list of cheaders. $MOCX_CIMPLEMENTLIST
-is the list of cimplements. $MOCX_STARTCOMMENT is the initial comment.
+and $MOCX_INITIALENV the initial environment. $MOCX_MACROENV is the
+environment for macros. $MOCX_FUNCOUNT is a boxed integer counting the
+defined functions (excluding $LAMBDA-s, counting only $DEFUN), used to
+help generate C code in several files, described in
+$MOCX_FILETUPLE. $MOCX_CFLAGS is for the C compilation flags of the
+module. $MOCX_LINKFLAGS is for the linking flags. $MOCX_CHEADERLIST is
+the list of cheaders. $MOCX_CIMPLEMENTLIST is the list of
+cimplements. $MOCX_STARTCOMMENT is the initial comment.
$MOCX_GENDEVLIST is the list of instances of
$CLASS_SOURCE_GENERATOR_DEVICE. $MOCX_ERRORHANDLER is the closure, if
any, to call on errors. $MOCX_VARCOUNT is the counter for
diff --git a/gcc/melt/warmelt-modes.melt b/gcc/melt/warmelt-modes.melt
index d03602f19a6..5f07a178774 100644
--- a/gcc/melt/warmelt-modes.melt
+++ b/gcc/melt/warmelt-modes.melt
@@ -1720,12 +1720,14 @@ has basic debug support thru DEBUG, ASSERT_MSG..."
(add2out sbuf "meltmakedoc_")
(add2out_cident sbuf (make_string_nakedbasename discr_string outarg))
(strbuf2string discr_string sbuf)))
+ (macroenv (fresh_env curenv (tuple 'macro modnam)))
(mdinfo
(instance class_makedoc_module_context
:mocx_modulename modnam
:mocx_expfieldict (make_mapstring discr_map_strings 71)
:mocx_expclassdict (make_mapstring discr_map_strings 19)
:mocx_initialenv curenv
+ :mocx_macroenv macroenv
:mocx_funcount (make_integerbox discr_integer 0)
:mocx_filetuple ()
:mocx_cheaderlist (make_list discr_list)
diff --git a/gcc/melt/warmelt-outobj.melt b/gcc/melt/warmelt-outobj.melt
index f398a46061b..e96160fd9c8 100644
--- a/gcc/melt/warmelt-outobj.melt
+++ b/gcc/melt/warmelt-outobj.melt
@@ -6937,11 +6937,13 @@ if (1) return;
(not (string_suffixed modnamstr ".cc")) modnamstr)
(let (
(modnakedname (make_string_nakedbasename discr_string modnamstr))
+ (macroenv (fresh_env inienv (tuple 'macro-compile modnamstr)))
(modctx (instance class_module_context
:mocx_modulename modnakedname
:mocx_expfieldict (make_mapstring discr_map_strings 390)
:mocx_expclassdict (make_mapstring discr_map_strings 140)
:mocx_initialenv inienv
+ :mocx_macroenv macroenv
:mocx_funcount (make_integerbox discr_integer 0)
:mocx_filetuple ()
:mocx_cheaderlist (make_list discr_list)
@@ -7017,11 +7019,13 @@ if (1) return;
}#)
(let (
(modnakedname (make_string_nakedbasename discr_string modnamstr))
+ (macroenv (fresh_env initial_environment (tuple 'macro-first modnamstr)))
(modctx (instance class_first_module_context
:mocx_modulename modnakedname
:mocx_expfieldict (make_mapstring discr_map_strings 490)
:mocx_expclassdict (make_mapstring discr_map_strings 240)
:mocx_initialenv ()
+ :mocx_macroenv macroenv
:mocx_funcount (make_integerbox discr_integer 0)
:mocx_filetuple ()
:mocx_cheaderlist (make_list discr_list)
@@ -7266,12 +7270,15 @@ if (1) return;
(set_ref referr (or v :true))))
(litvalist
(list ())) ;first element of list is ignored, so null
+ (macroenv
+ (fresh_env env (tuple 'macro-extension nakedbasnam)))
(modctx
(instance class_running_extension_module_context
:mocx_modulename nakedbasnam
:mocx_expfieldict (make_mapstring discr_map_strings 71)
:mocx_expclassdict (make_mapstring discr_map_strings 19)
:mocx_initialenv env
+ :mocx_macroenv macroenv
:mocx_funcount (make_integerbox discr_integer 0)
:mocx_filetuple ()
:mocx_cheaderlist (make_list discr_list)
@@ -7544,13 +7551,16 @@ if (1) return;
)
(set_ref referr (or v :true))))
(litvalist
- (list ())) ;first element of list is ignored, so null
+ (list ())) ;first element of list is ignored, so null
+ (macroenv
+ (fresh_env env (tuple 'macro-extension nakedbasnam)))
(newmodctx
(instance class_running_extension_module_context
:mocx_modulename nakedbasnam
:mocx_expfieldict (make_mapstring discr_map_strings 71)
:mocx_expclassdict (make_mapstring discr_map_strings 19)
:mocx_initialenv env
+ :mocx_macroenv macroenv
:mocx_funcount (make_integerbox discr_integer 0)
:mocx_filetuple ()
:mocx_cheaderlist (make_list discr_list)