diff --git a/docs/core-test/1-pc.html b/docs/core-test/1-pc.html index 7a3d7d5ff..550c56a3a 100644 --- a/docs/core-test/1-pc.html +++ b/docs/core-test/1-pc.html @@ -36,7 +36,7 @@ but on others it's compiled into the body of an application. So:

-

The function main is used in 2/pt (§52), 2/pl2 (§3.1), 2/pck (§3), 3/rst (§6), 4/am (§26.1), 8/ef (§26), 8/ed2 (§3.2), 10/varc (§14), 19/tb (§27, §27.1, §27.1.3, §29), 21/rl2 (§23), 26/uo (§11.1), 27/hr (§5), 27/cm (§1), 1/ppl (§5), 2/res (§1), 4/fc (§1), 2/hf (§6).

+

The function main is used in 2/pt (§52), 2/pl2 (§3.1), 2/pck (§3), 2/cnn (§1), 3/rst (§6), 4/am (§26.1), 8/ef (§26), 8/ed2 (§3.2), 10/varc (§14), 19/tb (§27, §27.1, §27.1.3, §29), 21/rl2 (§23), 26/uo (§11.1), 27/hr (§5), 27/cm (§1), 1/ppl (§5), 2/res (§1), 4/fc (§1), 2/hf (§6).

§3. As a matter of policy, no module is allowed to start or stop the foundation module, not even the mighty core; so we take care of that with one more diff --git a/docs/inform7/1-mn.html b/docs/inform7/1-mn.html index 172a6a260..65a342398 100644 --- a/docs/inform7/1-mn.html +++ b/docs/inform7/1-mn.html @@ -43,7 +43,7 @@ when they want I7 to run.

-

The function main is used in 2/pt (§52), 2/pl2 (§3.1), 2/pck (§3), 3/rst (§6), 4/am (§26.1), 8/ef (§26), 8/ed2 (§3.2), 10/varc (§14), 19/tb (§27, §27.1, §27.1.3, §29), 21/rl2 (§23), 26/uo (§11.1), 27/hr (§5), 27/cm (§1), 1/ppl (§5), 2/res (§1), 4/fc (§1), 3/sm (§36, §36.1, §38), 3/em2 (§24), 4/ap (§2), 2/hf (§6).

+

The function main is used in 2/pt (§52), 2/pl2 (§3.1), 2/pck (§3), 2/cnn (§1), 3/rst (§6), 4/am (§26.1), 8/ef (§26), 8/ed2 (§3.2), 10/varc (§14), 19/tb (§27, §27.1, §27.1.3, §29), 21/rl2 (§23), 26/uo (§11.1), 27/hr (§5), 27/cm (§1), 1/ppl (§5), 2/res (§1), 4/fc (§1), 3/sm (§36, §36.1, §38), 3/em2 (§24), 4/ap (§2), 2/hf (§6).

§3. Either way, that brings us here. All our modules have to be started up and shut down, so we take care of that with one more intermediary. These modules diff --git a/docs/inter-module/2-bkm.html b/docs/inter-module/2-bkm.html index 137a71d69..debf7f9fe 100644 --- a/docs/inter-module/2-bkm.html +++ b/docs/inter-module/2-bkm.html @@ -193,13 +193,13 @@

The function Inter::Bookmarks::at_start_of_this_repository is used in 3/iibf (§1), 3/iitf (§1).

-

The function Inter::Bookmarks::at_end_of_this_package is used in 2/trn (§1.1).

+

The function Inter::Bookmarks::at_end_of_this_package is used in 2/cnn (§1), 2/trn (§1.1).

The function Inter::Bookmarks::after_this_node is used in 2/trn (§1.1).

The function Inter::Bookmarks::set_current_package is used in 3/dfn (§4), 4/tpc3 (§2).

-

The function Inter::Bookmarks::tree is used in 2/in (§4), 2/st (§8, §9), 2/cnn (§1), 3/dfn (§4), 4/tsc (§1), 4/tpc3 (§2), 4/tkc (§2), 4/tdc (§2), 4/tvc2 (§2), 4/tcc2 (§2), 4/trc (§2), 4/tic (§2), 4/tpc4 (§2), 4/tpc5 (§2), 4/tpc6 (§2), 5/tlc2 (§2), 5/tic (§2), 5/trc (§2), 5/tvc (§2), 5/tcc2 (§2).

+

The function Inter::Bookmarks::tree is used in 2/in (§4), 2/st (§8, §9), 3/dfn (§4), 4/tsc (§1), 4/tpc3 (§2), 4/tkc (§2), 4/tdc (§2), 4/tvc2 (§2), 4/tcc2 (§2), 4/trc (§2), 4/tic (§2), 4/tpc4 (§2), 4/tpc5 (§2), 4/tpc6 (§2), 5/tlc2 (§2), 5/tic (§2), 5/trc (§2), 5/tvc (§2), 5/tcc2 (§2).

The function Inter::Bookmarks::warehouse is used in 2/trn (§1.2), 3/dfn (§4), 4/tmc (§2), 4/tpc (§2), 4/tlc (§2), 4/tac (§2), 4/tpc3 (§2), 4/tkc (§2), 4/tcc2 (§2), 4/tic (§2), 4/tpc4 (§2), 4/tpc5 (§2), 4/tpc6 (§2), 5/tsc (§2).

@@ -219,9 +219,9 @@

The function Inter::Bookmarks::scope is used in 4/tmc (§2), 4/tsc (§1), 4/tpc (§2), 4/tac (§2), 4/tpc2 (§2), 4/tkc (§2), 4/tdc (§2), 4/tvc2 (§2), 4/tcc2 (§2), 4/trc (§2), 4/tic (§2), 4/tpc4 (§2), 4/tpc5 (§2), 4/tpc6 (§2), 4/tpc7 (§2), 5/tlc2 (§2), 5/tic (§2), 5/trc (§2), 5/tvc (§2), 5/tcc2 (§2).

-

The function Inter::Bookmarks::package is used in 2/in (§4), 2/st (§8, §9), 2/cnn (§1), 2/trn (§1.2, §2.1.1), 3/dfn (§4), 4/tnc (§1), 4/tcc (§1), 4/tmc (§2), 4/tsc (§1), 4/tvc (§2), 4/tpc (§2), 4/tlc (§2), 4/tac (§2), 4/tpc2 (§2), 4/tpc3 (§2), 4/tkc (§2), 4/tdc (§2), 4/tvc2 (§2), 4/tcc2 (§2), 4/trc (§2), 4/tic (§2), 4/tpc4 (§2), 4/tpc5 (§2), 4/tpc6 (§2), 4/tpc7 (§2), 5/tlc (§2), 5/tlc2 (§2), 5/tic (§2), 5/trc (§2), 5/tvc (§2), 5/tlc3 (§2), 5/tcc (§2), 5/tec (§2), 5/trc2 (§2), 5/tcc2 (§2), 5/tsc (§2).

+

The function Inter::Bookmarks::package is used in 2/in (§4), 2/st (§8, §9), 2/trn (§1.2, §3.1.1), 3/dfn (§4), 4/tnc (§1), 4/tcc (§1), 4/tmc (§2), 4/tsc (§1), 4/tvc (§2), 4/tpc (§2), 4/tlc (§2), 4/tac (§2), 4/tpc2 (§2), 4/tpc3 (§2), 4/tkc (§2), 4/tdc (§2), 4/tvc2 (§2), 4/tcc2 (§2), 4/trc (§2), 4/tic (§2), 4/tpc4 (§2), 4/tpc5 (§2), 4/tpc6 (§2), 4/tpc7 (§2), 5/tlc (§2), 5/tlc2 (§2), 5/tic (§2), 5/trc (§2), 5/tvc (§2), 5/tlc3 (§2), 5/tcc (§2), 5/tec (§2), 5/trc2 (§2), 5/tcc2 (§2), 5/tsc (§2).

-

The function Inter::Bookmarks::insert is used in 2/trn (§1.3, §2.1.1), 3/iibf (§1.6), 4/tnc (§1), 4/tcc (§1), 4/tmc (§2), 4/tvc (§2), 4/tpc (§2), 4/tlc (§2), 4/tac (§2), 4/tpc2 (§2), 4/tpc3 (§2), 4/tkc (§2), 4/tdc (§2), 4/tvc2 (§2), 4/tcc2 (§2), 4/trc (§2), 4/tic (§2), 4/tpc4 (§2), 4/tpc5 (§2), 4/tpc6 (§2), 4/tpc7 (§2), 5/tlc (§2), 5/tlc2 (§2), 5/tic (§2), 5/trc (§2), 5/tvc (§2), 5/tlc3 (§2), 5/tcc (§2), 5/tec (§2), 5/trc2 (§2), 5/tcc2 (§2), 5/tsc (§2).

+

The function Inter::Bookmarks::insert is used in 2/trn (§1.3, §3.1.1), 3/iibf (§1.6), 4/tnc (§1), 4/tcc (§1), 4/tmc (§2), 4/tvc (§2), 4/tpc (§2), 4/tlc (§2), 4/tac (§2), 4/tpc2 (§2), 4/tpc3 (§2), 4/tkc (§2), 4/tdc (§2), 4/tvc2 (§2), 4/tcc2 (§2), 4/trc (§2), 4/tic (§2), 4/tpc4 (§2), 4/tpc5 (§2), 4/tpc6 (§2), 4/tpc7 (§2), 5/tlc (§2), 5/tlc2 (§2), 5/tic (§2), 5/trc (§2), 5/tvc (§2), 5/tlc3 (§2), 5/tcc (§2), 5/tec (§2), 5/trc2 (§2), 5/tcc2 (§2), 5/tsc (§2).

The structure inter_bookmark is private to this section.

diff --git a/docs/inter-module/2-cnn.html b/docs/inter-module/2-cnn.html index bf89b1bf2..89832b0da 100644 --- a/docs/inter-module/2-cnn.html +++ b/docs/inter-module/2-cnn.html @@ -15,41 +15,47 @@
-    inter_symbol *Inter::Connectors::plug(inter_bookmark *IBM, text_stream *plug_name, text_stream *wanted, inter_package **package_cache) {
-        inter_package *connectors = Inter::Connectors::connectors_package(IBM, package_cache);
-        inter_symbol *plug = Inter::SymbolsTables::create_with_unique_name(Inter::Packages::scope(connectors), plug_name);
+    inter_symbol *Inter::Connectors::plug(inter_tree *I, text_stream *plug_name, text_stream *wanted) {
+        inter_package *connectors = Inter::Connectors::connectors_package(I);
+        inter_symbol *plug = Inter::SymbolsTables::create_with_unique_name(
+            Inter::Packages::scope(connectors), plug_name);
         Inter::SymbolsTables::make_plug(plug, wanted);
         return plug;
     }
 
-    inter_symbol *Inter::Connectors::socket(inter_bookmark *IBM, text_stream *socket_name, inter_symbol *wired_from, inter_package **package_cache) {
-        inter_package *connectors = Inter::Connectors::connectors_package(IBM, package_cache);
-        inter_symbol *socket = Inter::SymbolsTables::create_with_unique_name(Inter::Packages::scope(connectors), socket_name);
+    inter_symbol *Inter::Connectors::socket(inter_tree *I, text_stream *socket_name, inter_symbol *wired_from) {
+        inter_package *connectors = Inter::Connectors::connectors_package(I);
+        inter_symbol *socket = Inter::SymbolsTables::create_with_unique_name(
+            Inter::Packages::scope(connectors), socket_name);
         Inter::SymbolsTables::make_socket(socket, wired_from);
         return socket;
     }
 
-    inter_package *Inter::Connectors::connectors_package(inter_bookmark *IBM, inter_package **package_cache) {
-        inter_package *connectors = NULL;
-        if (package_cache) connectors = *package_cache;
+    inter_package *Inter::Connectors::connectors_package(inter_tree *I) {
+        if (I == NULL) internal_error("no tree for connectors");
+        inter_package *connectors = Inter::Tree::connectors_package(I);
         if (connectors == NULL) {
-            connectors = Inter::Packages::by_name(Inter::Bookmarks::package(IBM), I"connectors");
+            inter_package *main_package = Inter::Tree::main_package(I);
+            if (main_package == NULL) internal_error("tree without main");
+            connectors = Inter::Packages::by_name(main_package, I"connectors");
+            if (connectors == NULL) {
+                inter_symbol *linkage = Inter::SymbolsTables::url_name_to_symbol(I, NULL, I"/_linkage");
+                if (linkage == NULL) internal_error("no linkage ptype");
+                inter_bookmark IBM = Inter::Bookmarks::at_end_of_this_package(main_package);
+                Inter::Package::new_package(&IBM, I"connectors", linkage,
+                    (inter_t) Inter::Bookmarks::baseline(&IBM)+1, NULL, &(connectors));
+            }
+            if (connectors == NULL) internal_error("unable to create connector package");
+            Inter::Tree::set_connectors_package(I, connectors);
+            Inter::Packages::make_linklike(connectors);
         }
-        if (connectors == NULL) {
-            inter_symbol *linkage = Inter::SymbolsTables::url_name_to_symbol(Inter::Bookmarks::tree(IBM), NULL, I"/_linkage");
-            if (linkage == NULL) internal_error("no linkage ptype");
-            Inter::Package::new_package(IBM, I"connectors", linkage, (inter_t) Inter::Bookmarks::baseline(IBM)+1, NULL, &(connectors));
-        }
-        if (connectors == NULL) internal_error("unable to create connector package");
-        if (package_cache) *package_cache = connectors;
-        Inter::Packages::make_linklike(connectors);
         return connectors;
     }
 

-

The function Inter::Connectors::plug is used in 2/trn (§2.2.1, §3.1.1).

+

The function Inter::Connectors::plug is used in 2/trn (§3.2, §4.1).

The function Inter::Connectors::socket appears nowhere else.

diff --git a/docs/inter-module/2-in.html b/docs/inter-module/2-in.html index 4415c1ae1..fa8609480 100644 --- a/docs/inter-module/2-in.html +++ b/docs/inter-module/2-in.html @@ -268,7 +268,7 @@

The function Inter::Node::fill_0 is used in 4/tnc (§1), 4/tcc (§1).

-

The function Inter::Node::fill_1 is used in 2/trn (§2.1.1), 4/tvc (§2), 4/tpc2 (§2), 4/tpc7 (§2), 5/tcc (§2), 5/tec (§2), 5/trc2 (§2).

+

The function Inter::Node::fill_1 is used in 2/trn (§3.1.1), 4/tvc (§2), 4/tpc2 (§2), 4/tpc7 (§2), 5/tcc (§2), 5/tec (§2), 5/trc2 (§2).

The function Inter::Node::fill_2 is used in 4/tpc (§2), 4/tac (§2), 5/tlc (§2), 5/tlc3 (§2).

@@ -345,7 +345,7 @@

-

The function Inter::Node::extend is used in 2/trn (§2.1.1), 4/tkc (§2), 4/tcc2 (§2), 4/tpc7 (§2).

+

The function Inter::Node::extend is used in 2/trn (§3.1.1), 4/tkc (§2), 4/tcc2 (§2), 4/tpc7 (§2).

The function Inter::Node::vcount is used in 4/tac (§2), 4/tic (§2), 4/tpc5 (§2), 4/tpc6 (§2).

diff --git a/docs/inter-module/2-it.html b/docs/inter-module/2-it.html index 797564057..2f766fd46 100644 --- a/docs/inter-module/2-it.html +++ b/docs/inter-module/2-it.html @@ -20,6 +20,7 @@ struct inter_tree_node *root_node; struct inter_package *root_package; struct inter_package *main_package; + struct inter_package *connectors_package; MEMORY_MANAGEMENT } inter_tree; @@ -35,6 +36,7 @@ inter_tree *Inter::Tree::new(void) { inter_tree *I = CREATE(inter_tree); I->main_package = NULL; + I->connectors_package = NULL; I->housed = Inter::Warehouse::new(); inter_t N = Inter::Warehouse::create_symbols_table(I->housed); inter_symbols_table *globals = Inter::Warehouse::get_symbols_table(I->housed, N); @@ -59,11 +61,21 @@ return NULL; } + inter_package *Inter::Tree::connectors_package(inter_tree *I) { + if (I) return I->connectors_package; + return NULL; + } + void Inter::Tree::set_main_package(inter_tree *I, inter_package *M) { if (I == NULL) internal_error("no tree"); I->main_package = M; } + void Inter::Tree::set_connectors_package(inter_tree *I, inter_package *M) { + if (I == NULL) internal_error("no tree"); + I->connectors_package = M; + } + inter_warehouse *Inter::Tree::warehouse(inter_tree *I) { return I->housed; } @@ -159,13 +171,17 @@

The function Inter::Tree::root_package is used in 3/dfn (§3), 3/iibf (§1.4).

-

The function Inter::Tree::main_package is used in §5, 2/st (§4), 2/pck (§3).

+

The function Inter::Tree::main_package is used in §5, 2/st (§4), 2/pck (§3), 2/cnn (§1).

+ +

The function Inter::Tree::connectors_package is used in 2/cnn (§1).

The function Inter::Tree::set_main_package is used in 2/pck (§3).

+

The function Inter::Tree::set_connectors_package is used in 2/cnn (§1).

+

The function Inter::Tree::warehouse is used in 2/bkm (§1), 2/in (§4), 2/pck (§3), 2/sym (§4), 3/dfn (§3), 3/iibf (§1, §1.1), 3/idt (§3).

-

The function Inter::Tree::global_scope is used in 2/bkm (§1), 2/in (§3), 2/st (§8, §9, §11), 2/trn (§1.5), 3/iibf (§1.4), 4/tpc3 (§2), 5/tic (§2).

+

The function Inter::Tree::global_scope is used in 2/bkm (§1), 2/in (§3), 2/st (§8, §9, §11), 2/trn (§3, §3.1, §3.1.1), 3/iibf (§1.4), 4/tpc3 (§2), 5/tic (§2).

The function Inter::Tree::previous is used in §3.1, §3.5.

@@ -433,7 +449,7 @@

The function Inter::Tree::traverse_root_only is used in 3/iibf (§1.1.5), 3/iitf (§2).

-

The function Inter::Tree::traverse is used in 2/st (§10), 2/trn (§1.5, §1.6), 3/iibf (§1.1.5), 3/iitf (§1, §2).

+

The function Inter::Tree::traverse is used in 2/st (§10), 2/trn (§1.4, §1.5), 3/iibf (§1.1.5), 3/iitf (§1, §2).

The function Inter::Tree::traverse_r appears nowhere else.

diff --git a/docs/inter-module/2-pck.html b/docs/inter-module/2-pck.html index 69043caf6..d805b6750 100644 --- a/docs/inter-module/2-pck.html +++ b/docs/inter-module/2-pck.html @@ -67,6 +67,7 @@ inter_tree *Inter::Packages::tree(inter_package *pack) { if (default_ptree) return default_ptree; + if (pack == NULL) return NULL; return pack->package_head->tree; } @@ -316,7 +317,7 @@

The function Inter::Packages::definition is used in 2/it (§5), 2/bkm (§1).

-

The function Inter::Packages::tree is used in 2/bkm (§1), 2/st (§10), 3/iibf (§1.1.3, §1.1.4).

+

The function Inter::Packages::tree is used in 2/bkm (§1), 2/st (§10), 2/trn (§1), 3/iibf (§1.1.3, §1.1.4).

The function Inter::Packages::name is used in 2/st (§11), 2/trn (§1.2), 3/dfn (§4), 4/tpc3 (§2), 4/tcc2 (§2).

@@ -324,7 +325,7 @@

The function Inter::Packages::make_codelike is used in 3/iibf (§1.4.3), 4/tpc3 (§2).

-

The function Inter::Packages::is_linklike is used in 2/trn (§2, §3), 4/tsc (§1).

+

The function Inter::Packages::is_linklike is used in 2/trn (§3, §4), 4/tsc (§1).

The function Inter::Packages::make_linklike is used in 2/cnn (§1), 4/tpc3 (§2).

@@ -332,7 +333,7 @@

The function Inter::Packages::make_rootlike is used in 2/it (§2), 3/iibf (§1.4.3).

-

The function Inter::Packages::parent is used in 2/st (§11), 2/trn (§1, §1.3, §2, §3), 3/dfn (§4), 3/iibf (§1.1.3.3).

+

The function Inter::Packages::parent is used in 2/st (§11), 2/trn (§1, §1.3, §3, §4), 3/dfn (§4), 3/iibf (§1.1.3.3).

The function Inter::Packages::unmark_all appears nowhere else.

@@ -362,7 +363,7 @@

The function Inter::Packages::container is used in 3/dfn (§4), 3/vi (§1), 5/tlc (§2), 5/tlc2 (§2), 5/trc (§2), 5/tlc3 (§2).

-

The function Inter::Packages::scope is used in 2/it (§2), 2/bkm (§1), 2/st (§4, §7, §8, §9, §10, §11), 2/cnn (§1), 2/trn (§2, §3), 3/vi (§1), 4/tsc (§1), 4/tac (§2), 4/tpc3 (§2), 4/tkc (§2), 4/tcc2 (§2), 4/tic (§2), 4/tpc5 (§2), 4/tpc6 (§2), 5/tlc (§2), 5/tlc2 (§2), 5/trc (§2), 5/tvc (§2), 5/tlc3 (§2).

+

The function Inter::Packages::scope is used in 2/it (§2), 2/bkm (§1), 2/st (§4, §7, §8, §9, §10, §11), 2/cnn (§1), 2/trn (§3, §4), 3/vi (§1), 4/tsc (§1), 4/tac (§2), 4/tpc3 (§2), 4/tkc (§2), 4/tcc2 (§2), 4/tic (§2), 4/tpc5 (§2), 4/tpc6 (§2), 5/tlc (§2), 5/tlc2 (§2), 5/trc (§2), 5/tvc (§2), 5/tlc3 (§2).

The function Inter::Packages::scope_of is used in 2/st (§7), 4/tmc (§2), 4/tkc (§2), 4/tdc (§2), 4/tvc2 (§2), 4/tcc2 (§2), 4/trc (§2), 4/tic (§2), 4/tpc5 (§2), 5/tvc (§2), 5/tcc2 (§2).

diff --git a/docs/inter-module/2-st.html b/docs/inter-module/2-st.html index d4c7d4629..1de226a8e 100644 --- a/docs/inter-module/2-st.html +++ b/docs/inter-module/2-st.html @@ -223,11 +223,11 @@

-

The function Inter::SymbolsTables::symbol_from_name is used in §5, §11, 2/pck (§3), 2/trn (§2.1), 3/iitf (§1), 3/idt (§3), 4/tpc (§2), 4/tac (§2), 5/tlc (§2), 5/tic (§2), 5/tlc3 (§2).

+

The function Inter::SymbolsTables::symbol_from_name is used in §5, §11, 2/pck (§3), 2/trn (§3.1), 3/iitf (§1), 3/idt (§3), 4/tpc (§2), 4/tac (§2), 5/tlc (§2), 5/tic (§2), 5/tlc3 (§2).

The function Inter::SymbolsTables::symbol_from_name_not_equating appears nowhere else.

-

The function Inter::SymbolsTables::symbol_from_name_creating is used in §5, 2/trn (§2.1.1), 3/iitf (§1).

+

The function Inter::SymbolsTables::symbol_from_name_creating is used in §5, 2/trn (§3.1.1), 3/iitf (§1).

The function Inter::SymbolsTables::symbol_from_name_creating_at_ID is used in 3/iibf (§1.4.2).

@@ -298,7 +298,7 @@ to access this: one following equations, the other not.

The function Inter::SymbolsTables::unequated_symbol_from_id is used in 3/vi (§1).

-

The function Inter::SymbolsTables::symbol_from_id is used in §7, 2/sym (§4), 2/trn (§2), 3/iibf (§1.5), 3/vi (§1), 3/idt (§2, §3), 4/tac (§2), 4/tkc (§2), 4/tcc2 (§2), 4/tic (§2), 4/tpc5 (§2), 4/tpc6 (§2), 4/tpc7 (§2), 5/trc (§2), 5/tvc (§2).

+

The function Inter::SymbolsTables::symbol_from_id is used in §7, 2/sym (§4), 2/trn (§3), 3/iibf (§1.5), 3/vi (§1), 3/idt (§2, §3), 4/tac (§2), 4/tkc (§2), 4/tcc2 (§2), 4/tic (§2), 4/tpc5 (§2), 4/tpc6 (§2), 4/tpc7 (§2), 5/trc (§2), 5/tvc (§2).

§7. It's convenient to have some abbreviations for common ways to access the above.

@@ -433,7 +433,7 @@ a global symbol in any non-global context.

-

The function Inter::SymbolsTables::id_from_symbol_inner is used in 2/trn (§2.1, §2.1.1).

+

The function Inter::SymbolsTables::id_from_symbol_inner is used in 2/trn (§3.1, §3.1.1).

The function Inter::SymbolsTables::id_from_symbol is used in 2/sym (§3), 4/tpc3 (§2), 5/tic (§2).

@@ -571,9 +571,9 @@ a global symbol in any non-global context.

-

The function Inter::SymbolsTables::url_name_to_symbol is used in §10, 2/cnn (§1), 2/trn (§2.2), 4/tsc (§1).

+

The function Inter::SymbolsTables::url_name_to_symbol is used in §10, 2/cnn (§1), 2/trn (§3.2), 4/tsc (§1).

-

The function Inter::SymbolsTables::symbol_to_url_name is used in 2/sym (§2, §4), 2/trn (§2.2, §3.1.1).

+

The function Inter::SymbolsTables::symbol_to_url_name is used in 2/sym (§2, §4), 2/trn (§3.2, §4.1).



diff --git a/docs/inter-module/2-trn.html b/docs/inter-module/2-trn.html index 881291900..e357a3c43 100644 --- a/docs/inter-module/2-trn.html +++ b/docs/inter-module/2-trn.html @@ -28,21 +28,23 @@ void Inter::Transmigration::move(inter_package *migrant, inter_package *destination, int tidy_origin) { LOG("Move $5 to $5\n", migrant, destination); + inter_tree *origin_tree = Inter::Packages::tree(migrant); + inter_tree *destination_tree = Inter::Packages::tree(destination); inter_package *origin = Inter::Packages::parent(migrant); - inter_bookmark deletion_point, insertion_point, linkage_point, primitives_point; + inter_bookmark deletion_point, insertion_point, primitives_point; <Create these bookmarks 1.1>; <Mark the insertion and deletion points with comments 1.2>; <Physically move the subtree to its new home 1.3>; - <Correct any references from the migrant to the origin 1.5>; - if (tidy_origin) <Correct any references from the origin to the migrant 1.6>; + <Correct any references from the migrant to the origin 1.4>; + if (tidy_origin) <Correct any references from the origin to the migrant 1.5>; }

-

The function Inter::Transmigration::cache is used in §2.1, §2.2, §3.1.

+

The function Inter::Transmigration::cache is used in §3.1, §3.2, §4.1.

-

The function Inter::Transmigration::cached_equivalent is used in §2.1, §2.2, §3.1.

+

The function Inter::Transmigration::cached_equivalent is used in §3.1, §3.2, §4.1.

The function Inter::Transmigration::move appears nowhere else.

@@ -56,7 +58,6 @@ Inter::Bookmarks::after_this_node(migrant->package_head->tree, migrant->package_head); insertion_point = Inter::Bookmarks::at_end_of_this_package(destination); - linkage_point = Inter::Bookmarks::at_end_of_this_package(migrant); inter_tree_node *prims = NULL; LOOP_THROUGH_INTER_CHILDREN(F, destination->package_head->tree->root_node) if (F->W.data[ID_IFLD] == PRIMITIVE_IST) @@ -105,18 +106,16 @@

This code is used in §1.

-

§1.4.

+

§2.

     typedef struct ipct_state {
         inter_package *migrant;
         inter_package *destination;
-        inter_package *links;
-        inter_bookmark *linkage_point;
         inter_bookmark *primitives_point;
-        inter_symbols_table *origin_globals;
-        inter_symbols_table *destination_globals;
+        inter_tree *origin_tree;
+        inter_tree *destination_tree;
     } ipct_state;
 
@@ -124,21 +123,32 @@

The structure ipct_state is private to this section.

-

§1.5. -<Correct any references from the migrant to the origin 1.5> = +

§.1. +<Initialise the IPCT state .1> =

         ipct_cache_count++;
-        ipct_state ipct;
         ipct.migrant = migrant;
         ipct.destination = destination;
-        ipct.links = NULL;
-        ipct.origin_globals = Inter::Tree::global_scope(migrant->package_head->tree);
-        ipct.destination_globals = Inter::Tree::global_scope(destination->package_head->tree);
-        ipct.linkage_point = &linkage_point;
+        ipct.origin_tree = origin_tree;
+        ipct.destination_tree = destination_tree;
         ipct.primitives_point = &primitives_point;
+
+ +

+ +

This code is used in §1.4, §1.5.

+ +

§1.4. +<Correct any references from the migrant to the origin 1.4> = +

+ + +
+        ipct_state ipct;
+        <Initialise the IPCT state .1>;
         Inter::Tree::traverse(destination->package_head->tree,
             Inter::Transmigration::correct_migrant, &ipct, migrant, 0);
 
@@ -147,7 +157,7 @@

This code is used in §1.

-

§2.

+

§3.

@@ -156,8 +166,8 @@
         P->tree = I;
         if ((P->W.data[ID_IFLD] == INV_IST) && (P->W.data[METHOD_INV_IFLD] == INVOKED_PRIMITIVE)) {
             inter_symbol *primitive =
-                Inter::SymbolsTables::symbol_from_id(ipct->origin_globals, P->W.data[INVOKEE_INV_IFLD]);
-            if (primitive) <Correct the reference to this primitive 2.1>;
+                Inter::SymbolsTables::symbol_from_id(Inter::Tree::global_scope(ipct->origin_tree), P->W.data[INVOKEE_INV_IFLD]);
+            if (primitive) <Correct the reference to this primitive 3.1>;
         }
         if (P->W.data[ID_IFLD] == PACKAGE_IST) {
             inter_package *pack = Inter::Package::defined_by_frame(P);
@@ -175,7 +185,7 @@
                         target_package = Inter::Packages::parent(target_package);
                     }
                     if (target_package != ipct->migrant)
-                        <Correct the reference to this symbol 2.2>;
+                        <Correct the reference to this symbol 3.2>;
                 }
             }
         }
@@ -184,36 +194,36 @@
 
 

-

The function Inter::Transmigration::correct_migrant is used in §1.5.

+

The function Inter::Transmigration::correct_migrant is used in §1.4.

-

§2.1. -<Correct the reference to this primitive 2.1> = +

§3.1. +<Correct the reference to this primitive 3.1> =

         inter_symbol *equivalent_primitive = Inter::Transmigration::cached_equivalent(primitive);
         if (equivalent_primitive == NULL) {
-            equivalent_primitive = Inter::SymbolsTables::symbol_from_name(ipct->destination_globals, primitive->symbol_name);
-            if (equivalent_primitive == NULL) <Duplicate this primitive 2.1.1>;
+            equivalent_primitive = Inter::SymbolsTables::symbol_from_name(Inter::Tree::global_scope(ipct->destination_tree), primitive->symbol_name);
+            if (equivalent_primitive == NULL) <Duplicate this primitive 3.1.1>;
             if (equivalent_primitive) Inter::Transmigration::cache(primitive, equivalent_primitive);
         }
         if (equivalent_primitive)
-            P->W.data[INVOKEE_INV_IFLD] = Inter::SymbolsTables::id_from_symbol_inner(ipct->destination_globals, NULL, equivalent_primitive);
+            P->W.data[INVOKEE_INV_IFLD] = Inter::SymbolsTables::id_from_symbol_inner(Inter::Tree::global_scope(ipct->destination_tree), NULL, equivalent_primitive);
 

-

This code is used in §2.

+

This code is used in §3.

-

§2.1.1. -<Duplicate this primitive 2.1.1> = +

§3.1.1. +<Duplicate this primitive 3.1.1> =

-        equivalent_primitive = Inter::SymbolsTables::symbol_from_name_creating(ipct->destination_globals, primitive->symbol_name);
-        inter_tree_node *D = Inter::Node::fill_1(ipct->primitives_point, PRIMITIVE_IST, Inter::SymbolsTables::id_from_symbol_inner(ipct->destination_globals, NULL, equivalent_primitive), NULL, 0);
+        equivalent_primitive = Inter::SymbolsTables::symbol_from_name_creating(Inter::Tree::global_scope(ipct->destination_tree), primitive->symbol_name);
+        inter_tree_node *D = Inter::Node::fill_1(ipct->primitives_point, PRIMITIVE_IST, Inter::SymbolsTables::id_from_symbol_inner(Inter::Tree::global_scope(ipct->destination_tree), NULL, equivalent_primitive), NULL, 0);
         inter_tree_node *old_D = primitive->definition;
         for (int i=CAT_PRIM_IFLD; i<old_D->W.extent; i++) {
             if (Inter::Node::extend(D, (inter_t) 1) == FALSE) internal_error("can't extend");
@@ -230,10 +240,10 @@
 
 

-

This code is used in §2.1.

+

This code is used in §3.1.

-

§2.2. -<Correct the reference to this symbol 2.2> = +

§3.2. +<Correct the reference to this symbol 3.2> =

@@ -244,7 +254,7 @@ Inter::SymbolsTables::symbol_to_url_name(URL, target); equivalent = Inter::SymbolsTables::url_name_to_symbol(ipct->destination->package_head->tree, NULL, URL); if (equivalent == NULL) - <Create a link symbol to represent the unavailability of this symbol 2.2.1>; + equivalent = Inter::Connectors::plug(ipct->destination_tree, target->symbol_name, URL); DISCARD_TEXT(URL); Inter::Transmigration::cache(target, equivalent); } @@ -253,36 +263,16 @@

-

This code is used in §2.

+

This code is used in §3.

-

§2.2.1. -<Create a link symbol to represent the unavailability of this symbol 2.2.1> = +

§1.5. +<Correct any references from the origin to the migrant 1.5> =

-        equivalent = Inter::Connectors::plug(ipct->linkage_point, target->symbol_name, URL, &(ipct->links));
-
- -

- -

This code is used in §2.2.

- -

§1.6. -<Correct any references from the origin to the migrant 1.6> = -

- - -
-        ipct_cache_count++;
         ipct_state ipct;
-        ipct.migrant = migrant;
-        ipct.destination = destination;
-        ipct.links = NULL;
-        ipct.origin_globals = NULL;
-        ipct.destination_globals = NULL;
-        ipct.linkage_point = &deletion_point;
-        ipct.primitives_point = NULL;
+        <Initialise the IPCT state .1>;
         Inter::Tree::traverse(origin->package_head->tree,
             Inter::Transmigration::correct_origin, &ipct, NULL, 0);
 
@@ -291,7 +281,7 @@

This code is used in §1.

-

§3.

+

§4.

@@ -313,7 +303,7 @@
                         target_package = Inter::Packages::parent(target_package);
                     }
                     if (target_package == ipct->migrant)
-                        <Correct the origin reference to this migrant symbol 3.1>;
+                        <Correct the origin reference to this migrant symbol 4.1>;
                 }
             }
         }
@@ -322,17 +312,20 @@
 
 

-

The function Inter::Transmigration::correct_origin is used in §1.6.

+

The function Inter::Transmigration::correct_origin is used in §1.5.

-

§3.1. -<Correct the origin reference to this migrant symbol 3.1> = +

§4.1. +<Correct the origin reference to this migrant symbol 4.1> =

         inter_symbol *equivalent = Inter::Transmigration::cached_equivalent(target);
         if (equivalent == NULL) {
-            <Create a link symbol in the origin 3.1.1>;
+            TEMPORARY_TEXT(URL);
+            Inter::SymbolsTables::symbol_to_url_name(URL, target);
+            equivalent = Inter::Connectors::plug(ipct->origin_tree, target->symbol_name, URL);
+            DISCARD_TEXT(URL);
             Inter::Transmigration::cache(target, equivalent);
         }
         symb->equated_to = equivalent;
@@ -340,23 +333,7 @@
 
 

-

This code is used in §3.

- -

§3.1.1. -<Create a link symbol in the origin 3.1.1> = -

- - -
-        TEMPORARY_TEXT(URL);
-        Inter::SymbolsTables::symbol_to_url_name(URL, target);
-        equivalent = Inter::Connectors::plug(ipct->linkage_point, target->symbol_name, URL, &(ipct->links));
-        DISCARD_TEXT(URL);
-
- -

- -

This code is used in §3.1.

+

This code is used in §4.



diff --git a/docs/inter-module/3-dfn.html b/docs/inter-module/3-dfn.html index 27c3f6ea8..b0f424d75 100644 --- a/docs/inter-module/3-dfn.html +++ b/docs/inter-module/3-dfn.html @@ -376,7 +376,7 @@

-

The function Inter::Defn::verify_construct is used in 2/trn (§2.1.1), 3/iibf (§1.6), 4/tnc (§1), 4/tcc (§1), 4/tmc (§2), 4/tvc (§2), 4/tpc (§2), 4/tlc (§2), 4/tac (§2), 4/tpc2 (§2), 4/tpc3 (§2), 4/tkc (§2), 4/tdc (§2), 4/tvc2 (§2), 4/tcc2 (§2), 4/trc (§2), 4/tic (§2), 4/tpc4 (§2), 4/tpc5 (§2), 4/tpc6 (§2), 4/tpc7 (§2), 5/tlc (§2), 5/tlc2 (§2), 5/tic (§2), 5/trc (§2), 5/tvc (§2), 5/tlc3 (§2), 5/tcc (§2), 5/tec (§2), 5/trc2 (§2), 5/tcc2 (§2), 5/tsc (§2).

+

The function Inter::Defn::verify_construct is used in 2/trn (§3.1.1), 3/iibf (§1.6), 4/tnc (§1), 4/tcc (§1), 4/tmc (§2), 4/tvc (§2), 4/tpc (§2), 4/tlc (§2), 4/tac (§2), 4/tpc2 (§2), 4/tpc3 (§2), 4/tkc (§2), 4/tdc (§2), 4/tvc2 (§2), 4/tcc2 (§2), 4/trc (§2), 4/tic (§2), 4/tpc4 (§2), 4/tpc5 (§2), 4/tpc6 (§2), 4/tpc7 (§2), 5/tlc (§2), 5/tlc2 (§2), 5/tic (§2), 5/trc (§2), 5/tvc (§2), 5/tlc3 (§2), 5/tcc (§2), 5/tec (§2), 5/trc2 (§2), 5/tcc2 (§2), 5/tsc (§2).

The function Inter::Defn::transpose_construct is used in 3/iibf (§1.6).

diff --git a/docs/inter-module/3-ie.html b/docs/inter-module/3-ie.html index 6935b03ce..2889b3699 100644 --- a/docs/inter-module/3-ie.html +++ b/docs/inter-module/3-ie.html @@ -107,7 +107,7 @@

The function Inter::Errors::plain is used in 3/dfn (§3, §4), 3/iibf (§3), 4/tcc (§1), 4/tsc (§1), 4/tvc (§2), 4/tpc (§2), 4/tlc (§2), 4/tac (§2), 4/tpc2 (§2), 4/tkc (§2), 4/tcc2 (§2), 4/trc (§2), 4/tic (§2), 4/tpc5 (§2), 4/tpc6 (§2), 4/tpc7 (§2), 5/tlc (§2), 5/tlc2 (§2), 5/tic (§2), 5/trc (§2), 5/tvc (§2), 5/tlc3 (§2), 5/tcc (§2), 5/tec (§2), 5/trc2 (§2), 5/tcc2 (§2), 5/tsc (§2).

-

The function Inter::Errors::issue is used in 2/st (§10), 2/trn (§2.1.1), 3/iibf (§1.6, §3), 3/iitf (§1, §2).

+

The function Inter::Errors::issue is used in 2/st (§10), 2/trn (§3.1.1), 3/iibf (§1.6, §3), 3/iitf (§1, §2).

The function Inter::Errors::issue_to appears nowhere else.

diff --git a/docs/inter-module/4-tpc3.html b/docs/inter-module/4-tpc3.html index 6a4e08bfd..16355b0f9 100644 --- a/docs/inter-module/4-tpc3.html +++ b/docs/inter-module/4-tpc3.html @@ -214,7 +214,7 @@

The function Inter::Package::which appears nowhere else.

-

The function Inter::Package::defined_by_frame is used in 2/bkm (§1), 2/st (§10), 2/pck (§3), 2/trn (§2, §3).

+

The function Inter::Package::defined_by_frame is used in 2/bkm (§1), 2/st (§10), 2/pck (§3), 2/trn (§3, §4).

The function Inter::Package::type is used in 2/pck (§3).

diff --git a/docs/inter/1-mn.html b/docs/inter/1-mn.html index 00f3c331c..e34bf9175 100644 --- a/docs/inter/1-mn.html +++ b/docs/inter/1-mn.html @@ -80,7 +80,7 @@

-

The function main is used in 2/pck (§3), 1/ppl (§5), 2/res (§1), 4/fc (§1).

+

The function main is used in 2/pck (§3), 2/cnn (§1), 1/ppl (§5), 2/res (§1), 4/fc (§1).

§2.

diff --git a/inter/Tests/Duplex/_Results_Ideal/TransposeInOut+A.txt b/inter/Tests/Duplex/_Results_Ideal/TransposeInOut+A.txt index d05ed985d..95be34d9d 100644 --- a/inter/Tests/Duplex/_Results_Ideal/TransposeInOut+A.txt +++ b/inter/Tests/Duplex/_Results_Ideal/TransposeInOut+A.txt @@ -14,7 +14,7 @@ package main _plain kind K_number int32 kind K_func function K_number -> K_number # Exported my_fn here - package connectors _linkage - symbol plug misc secret --? /main/my_fn/secret constant awkward K_number = secret constant troublesome K_number = 12 + package connectors _linkage + symbol plug misc secret --? /main/my_fn/secret diff --git a/inter/Tests/Duplex/_Results_Ideal/TransposeInOut+B.txt b/inter/Tests/Duplex/_Results_Ideal/TransposeInOut+B.txt index 6ef062e61..6dae75be8 100644 --- a/inter/Tests/Duplex/_Results_Ideal/TransposeInOut+B.txt +++ b/inter/Tests/Duplex/_Results_Ideal/TransposeInOut+B.txt @@ -175,7 +175,7 @@ package main _plain symbol private misc x symbol private label .begin symbol external misc K_number --> /main/K_number - symbol external misc troublesome --> /main/my_fn/connectors/troublesome + symbol external misc troublesome --> /main/connectors/troublesome local x K_number __call_parameter code .begin @@ -186,5 +186,5 @@ package main _plain lab .begin constant R_101 K_func = R_101_B constant secret K_number = 7 - package connectors _linkage - symbol plug misc troublesome --? /main/troublesome + package connectors _linkage + symbol plug misc troublesome --? /main/troublesome diff --git a/inter/inter-module/Chapter 2/Connectors.w b/inter/inter-module/Chapter 2/Connectors.w index 8020e7426..8deb1a6db 100644 --- a/inter/inter-module/Chapter 2/Connectors.w +++ b/inter/inter-module/Chapter 2/Connectors.w @@ -3,33 +3,39 @@ To manage link symbols. @ = -inter_symbol *Inter::Connectors::plug(inter_bookmark *IBM, text_stream *plug_name, text_stream *wanted, inter_package **package_cache) { - inter_package *connectors = Inter::Connectors::connectors_package(IBM, package_cache); - inter_symbol *plug = Inter::SymbolsTables::create_with_unique_name(Inter::Packages::scope(connectors), plug_name); +inter_symbol *Inter::Connectors::plug(inter_tree *I, text_stream *plug_name, text_stream *wanted) { + inter_package *connectors = Inter::Connectors::connectors_package(I); + inter_symbol *plug = Inter::SymbolsTables::create_with_unique_name( + Inter::Packages::scope(connectors), plug_name); Inter::SymbolsTables::make_plug(plug, wanted); return plug; } -inter_symbol *Inter::Connectors::socket(inter_bookmark *IBM, text_stream *socket_name, inter_symbol *wired_from, inter_package **package_cache) { - inter_package *connectors = Inter::Connectors::connectors_package(IBM, package_cache); - inter_symbol *socket = Inter::SymbolsTables::create_with_unique_name(Inter::Packages::scope(connectors), socket_name); +inter_symbol *Inter::Connectors::socket(inter_tree *I, text_stream *socket_name, inter_symbol *wired_from) { + inter_package *connectors = Inter::Connectors::connectors_package(I); + inter_symbol *socket = Inter::SymbolsTables::create_with_unique_name( + Inter::Packages::scope(connectors), socket_name); Inter::SymbolsTables::make_socket(socket, wired_from); return socket; } -inter_package *Inter::Connectors::connectors_package(inter_bookmark *IBM, inter_package **package_cache) { - inter_package *connectors = NULL; - if (package_cache) connectors = *package_cache; +inter_package *Inter::Connectors::connectors_package(inter_tree *I) { + if (I == NULL) internal_error("no tree for connectors"); + inter_package *connectors = Inter::Tree::connectors_package(I); if (connectors == NULL) { - connectors = Inter::Packages::by_name(Inter::Bookmarks::package(IBM), I"connectors"); + inter_package *main_package = Inter::Tree::main_package(I); + if (main_package == NULL) internal_error("tree without main"); + connectors = Inter::Packages::by_name(main_package, I"connectors"); + if (connectors == NULL) { + inter_symbol *linkage = Inter::SymbolsTables::url_name_to_symbol(I, NULL, I"/_linkage"); + if (linkage == NULL) internal_error("no linkage ptype"); + inter_bookmark IBM = Inter::Bookmarks::at_end_of_this_package(main_package); + Inter::Package::new_package(&IBM, I"connectors", linkage, + (inter_t) Inter::Bookmarks::baseline(&IBM)+1, NULL, &(connectors)); + } + if (connectors == NULL) internal_error("unable to create connector package"); + Inter::Tree::set_connectors_package(I, connectors); + Inter::Packages::make_linklike(connectors); } - if (connectors == NULL) { - inter_symbol *linkage = Inter::SymbolsTables::url_name_to_symbol(Inter::Bookmarks::tree(IBM), NULL, I"/_linkage"); - if (linkage == NULL) internal_error("no linkage ptype"); - Inter::Package::new_package(IBM, I"connectors", linkage, (inter_t) Inter::Bookmarks::baseline(IBM)+1, NULL, &(connectors)); - } - if (connectors == NULL) internal_error("unable to create connector package"); - if (package_cache) *package_cache = connectors; - Inter::Packages::make_linklike(connectors); return connectors; } diff --git a/inter/inter-module/Chapter 2/Inter Trees.w b/inter/inter-module/Chapter 2/Inter Trees.w index 80e27419d..be7d9d13f 100644 --- a/inter/inter-module/Chapter 2/Inter Trees.w +++ b/inter/inter-module/Chapter 2/Inter Trees.w @@ -11,6 +11,7 @@ typedef struct inter_tree { struct inter_tree_node *root_node; struct inter_package *root_package; struct inter_package *main_package; + struct inter_package *connectors_package; MEMORY_MANAGEMENT } inter_tree; @@ -18,6 +19,7 @@ typedef struct inter_tree { inter_tree *Inter::Tree::new(void) { inter_tree *I = CREATE(inter_tree); I->main_package = NULL; + I->connectors_package = NULL; I->housed = Inter::Warehouse::new(); inter_t N = Inter::Warehouse::create_symbols_table(I->housed); inter_symbols_table *globals = Inter::Warehouse::get_symbols_table(I->housed, N); @@ -42,11 +44,21 @@ inter_package *Inter::Tree::main_package(inter_tree *I) { return NULL; } +inter_package *Inter::Tree::connectors_package(inter_tree *I) { + if (I) return I->connectors_package; + return NULL; +} + void Inter::Tree::set_main_package(inter_tree *I, inter_package *M) { if (I == NULL) internal_error("no tree"); I->main_package = M; } +void Inter::Tree::set_connectors_package(inter_tree *I, inter_package *M) { + if (I == NULL) internal_error("no tree"); + I->connectors_package = M; +} + inter_warehouse *Inter::Tree::warehouse(inter_tree *I) { return I->housed; } diff --git a/inter/inter-module/Chapter 2/Packages.w b/inter/inter-module/Chapter 2/Packages.w index ce37f4b75..aa1310d0c 100644 --- a/inter/inter-module/Chapter 2/Packages.w +++ b/inter/inter-module/Chapter 2/Packages.w @@ -45,6 +45,7 @@ inter_tree_node *Inter::Packages::definition(inter_package *pack) { inter_tree *Inter::Packages::tree(inter_package *pack) { if (default_ptree) return default_ptree; + if (pack == NULL) return NULL; return pack->package_head->tree; } diff --git a/inter/inter-module/Chapter 2/Transmigration.w b/inter/inter-module/Chapter 2/Transmigration.w index 9e8a2fc74..7d9cacb07 100644 --- a/inter/inter-module/Chapter 2/Transmigration.w +++ b/inter/inter-module/Chapter 2/Transmigration.w @@ -16,8 +16,10 @@ inter_symbol *Inter::Transmigration::cached_equivalent(inter_symbol *S) { void Inter::Transmigration::move(inter_package *migrant, inter_package *destination, int tidy_origin) { LOG("Move $5 to $5\n", migrant, destination); + inter_tree *origin_tree = Inter::Packages::tree(migrant); + inter_tree *destination_tree = Inter::Packages::tree(destination); inter_package *origin = Inter::Packages::parent(migrant); - inter_bookmark deletion_point, insertion_point, linkage_point, primitives_point; + inter_bookmark deletion_point, insertion_point, primitives_point; @; @; @; @@ -30,7 +32,6 @@ void Inter::Transmigration::move(inter_package *migrant, inter_package *destinat Inter::Bookmarks::after_this_node(migrant->package_head->tree, migrant->package_head); insertion_point = Inter::Bookmarks::at_end_of_this_package(destination); - linkage_point = Inter::Bookmarks::at_end_of_this_package(migrant); inter_tree_node *prims = NULL; LOOP_THROUGH_INTER_CHILDREN(F, destination->package_head->tree->root_node) if (F->W.data[ID_IFLD] == PRIMITIVE_IST) @@ -58,23 +59,22 @@ void Inter::Transmigration::move(inter_package *migrant, inter_package *destinat typedef struct ipct_state { inter_package *migrant; inter_package *destination; - inter_package *links; - inter_bookmark *linkage_point; inter_bookmark *primitives_point; - inter_symbols_table *origin_globals; - inter_symbols_table *destination_globals; + inter_tree *origin_tree; + inter_tree *destination_tree; } ipct_state; -@ = +@ = ipct_cache_count++; - ipct_state ipct; ipct.migrant = migrant; ipct.destination = destination; - ipct.links = NULL; - ipct.origin_globals = Inter::Tree::global_scope(migrant->package_head->tree); - ipct.destination_globals = Inter::Tree::global_scope(destination->package_head->tree); - ipct.linkage_point = &linkage_point; + ipct.origin_tree = origin_tree; + ipct.destination_tree = destination_tree; ipct.primitives_point = &primitives_point; + +@ = + ipct_state ipct; + @; Inter::Tree::traverse(destination->package_head->tree, Inter::Transmigration::correct_migrant, &ipct, migrant, 0); @@ -84,7 +84,7 @@ void Inter::Transmigration::correct_migrant(inter_tree *I, inter_tree_node *P, v P->tree = I; if ((P->W.data[ID_IFLD] == INV_IST) && (P->W.data[METHOD_INV_IFLD] == INVOKED_PRIMITIVE)) { inter_symbol *primitive = - Inter::SymbolsTables::symbol_from_id(ipct->origin_globals, P->W.data[INVOKEE_INV_IFLD]); + Inter::SymbolsTables::symbol_from_id(Inter::Tree::global_scope(ipct->origin_tree), P->W.data[INVOKEE_INV_IFLD]); if (primitive) @; } if (P->W.data[ID_IFLD] == PACKAGE_IST) { @@ -112,16 +112,16 @@ void Inter::Transmigration::correct_migrant(inter_tree *I, inter_tree_node *P, v @ = inter_symbol *equivalent_primitive = Inter::Transmigration::cached_equivalent(primitive); if (equivalent_primitive == NULL) { - equivalent_primitive = Inter::SymbolsTables::symbol_from_name(ipct->destination_globals, primitive->symbol_name); + equivalent_primitive = Inter::SymbolsTables::symbol_from_name(Inter::Tree::global_scope(ipct->destination_tree), primitive->symbol_name); if (equivalent_primitive == NULL) @; if (equivalent_primitive) Inter::Transmigration::cache(primitive, equivalent_primitive); } if (equivalent_primitive) - P->W.data[INVOKEE_INV_IFLD] = Inter::SymbolsTables::id_from_symbol_inner(ipct->destination_globals, NULL, equivalent_primitive); + P->W.data[INVOKEE_INV_IFLD] = Inter::SymbolsTables::id_from_symbol_inner(Inter::Tree::global_scope(ipct->destination_tree), NULL, equivalent_primitive); @ = - equivalent_primitive = Inter::SymbolsTables::symbol_from_name_creating(ipct->destination_globals, primitive->symbol_name); - inter_tree_node *D = Inter::Node::fill_1(ipct->primitives_point, PRIMITIVE_IST, Inter::SymbolsTables::id_from_symbol_inner(ipct->destination_globals, NULL, equivalent_primitive), NULL, 0); + equivalent_primitive = Inter::SymbolsTables::symbol_from_name_creating(Inter::Tree::global_scope(ipct->destination_tree), primitive->symbol_name); + inter_tree_node *D = Inter::Node::fill_1(ipct->primitives_point, PRIMITIVE_IST, Inter::SymbolsTables::id_from_symbol_inner(Inter::Tree::global_scope(ipct->destination_tree), NULL, equivalent_primitive), NULL, 0); inter_tree_node *old_D = primitive->definition; for (int i=CAT_PRIM_IFLD; iW.extent; i++) { if (Inter::Node::extend(D, (inter_t) 1) == FALSE) internal_error("can't extend"); @@ -142,25 +142,15 @@ void Inter::Transmigration::correct_migrant(inter_tree *I, inter_tree_node *P, v Inter::SymbolsTables::symbol_to_url_name(URL, target); equivalent = Inter::SymbolsTables::url_name_to_symbol(ipct->destination->package_head->tree, NULL, URL); if (equivalent == NULL) - @; + equivalent = Inter::Connectors::plug(ipct->destination_tree, target->symbol_name, URL); DISCARD_TEXT(URL); Inter::Transmigration::cache(target, equivalent); } symb->equated_to = equivalent; -@ = - equivalent = Inter::Connectors::plug(ipct->linkage_point, target->symbol_name, URL, &(ipct->links)); - @ = - ipct_cache_count++; ipct_state ipct; - ipct.migrant = migrant; - ipct.destination = destination; - ipct.links = NULL; - ipct.origin_globals = NULL; - ipct.destination_globals = NULL; - ipct.linkage_point = &deletion_point; - ipct.primitives_point = NULL; + @; Inter::Tree::traverse(origin->package_head->tree, Inter::Transmigration::correct_origin, &ipct, NULL, 0); @@ -192,13 +182,10 @@ void Inter::Transmigration::correct_origin(inter_tree *I, inter_tree_node *P, vo @ = inter_symbol *equivalent = Inter::Transmigration::cached_equivalent(target); if (equivalent == NULL) { - @; + TEMPORARY_TEXT(URL); + Inter::SymbolsTables::symbol_to_url_name(URL, target); + equivalent = Inter::Connectors::plug(ipct->origin_tree, target->symbol_name, URL); + DISCARD_TEXT(URL); Inter::Transmigration::cache(target, equivalent); } symb->equated_to = equivalent; - -@ = - TEMPORARY_TEXT(URL); - Inter::SymbolsTables::symbol_to_url_name(URL, target); - equivalent = Inter::Connectors::plug(ipct->linkage_point, target->symbol_name, URL, &(ipct->links)); - DISCARD_TEXT(URL);