瀏覽代碼

documented ActiveCellsRuntime.Execute;
give access to the top-most CELLNET context-specific object after execution of ActiveCellsRuntime.Execute, appears as a field of Context

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@6582 8c9fc860-2736-0410-a75d-ab315db34111

eth.morozova 9 年之前
父節點
當前提交
3bb9b9f957
共有 1 個文件被更改,包括 16 次插入4 次删除
  1. 16 4
      source/ActiveCellsRuntime.mod

+ 16 - 4
source/ActiveCellsRuntime.mod

@@ -1,5 +1,5 @@
 (** Active Cells Runtime Base Code for Variations of ActiveCellsRuntime Implementations  
-	Felix Friedrich, ETH Zürich, 2015
+	Felix Friedrich, ETH Zürich, 2015
 *)
 module ActiveCellsRuntime;
 
@@ -17,7 +17,9 @@ type
 	end Cell;
 
 	Context*= object
-	
+	var
+		topNet-: any; (** top-level CELLNET object specific to this runtime context *)
+		
 		procedure Allocate*(scope: any; var c: any; t: Modules.TypeDesc; const name: array of char; isCellNet, isEngine: boolean);
 		end Allocate;
 		
@@ -124,8 +126,11 @@ type
 	
 
 	procedure Allocate*(scope: Cell; var c: Cell; tag: address; const name: array of char; isCellnet, isEngine: boolean);
+	var ctx: Context;
 	begin
-		AllocateOnContext(GetContext(), scope, c, tag, name, isCellnet, isEngine);
+		ctx := GetContext();
+		AllocateOnContext(ctx, scope, c, tag, name, isCellnet, isEngine);
+		if scope = nil then ctx.topNet := c.c; end;
 	end Allocate;
 
 	procedure AddPort*(c: Cell; var p: any; const name: array of char; inout: set; width: longint);
@@ -298,7 +303,14 @@ type
 		return nbrOfUnloadedModules;
 	end FreeDownTo;
 	
-	procedure Execute*( const cellNet: array of char; context: Context; diagnostics: Diagnostics.Diagnostics);
+	(**
+		Execute ActiveCells CELLNET code
+		
+		cellNet: name of a CELLNET type in the format "ModuleName.TypeName", e.g. TestActiveCells.TestCellNet
+		context: runtime context used for executing the code
+		diagnostics: interface for generation of diagnostic messages (see Diagnostics.Mod)
+	*)
+	procedure Execute*(const cellNet: array of char; context: Context; diagnostics: Diagnostics.Diagnostics);
 	type
 		StartProc = procedure{DELEGATE}();