present code as an external function (for security & style)
authorClaus Gittinger <cg@exept.de>
Thu, 07 May 1998 19:45:56 +0200
changeset 3421 78a276e71115
parent 3420 4dc6667afda9
child 3422 09c13ab58bb2
present code as an external function (for security & style)
ExecFunc.st
ExecutableFunction.st
--- a/ExecFunc.st	Wed May 06 13:49:51 1998 +0200
+++ b/ExecFunc.st	Thu May 07 19:45:56 1998 +0200
@@ -113,11 +113,15 @@
     unsigned INT addr;
 
     if (__INST(code_) != nil) {
-	addr = (unsigned INT)__INST(code_);
-	if (addr <= _MAX_INT) {
-	    RETURN ( __MKSMALLINT(addr) );
-	}
-	RETURN ( __MKUINT(addr));
+        
+        RETURN (__MKEXTERNALADDRESS(__INST(code_)));
+#ifdef OLD
+        addr = (unsigned INT)__INST(code_);
+        if (addr <= _MAX_INT) {
+            RETURN ( __MKSMALLINT(addr) );
+        }
+        RETURN ( __MKUINT(addr));
+#endif
     }
 %}.
     ^ nil
@@ -200,14 +204,18 @@
 
 %{  /* NOCONTEXT */
 
-    if (__isSmallInteger(anAddress))
-	__INST(code_) = (OBJ)(__intVal(anAddress));
-    else {
-	if (anAddress == nil) {
-	    __INST(code_) = nil;
-	} else {
-	    __INST(code_) = (OBJ)(__longIntVal(anAddress));
-	}
+    if (__isExternalAddress(anAddress)) {
+        __INST(code_) = (OBJ)(__externalAddressVal(anAddress));
+    } else {
+        if (__isSmallInteger(anAddress))
+            __INST(code_) = (OBJ)(__intVal(anAddress));
+        else {
+            if (anAddress == nil) {
+                __INST(code_) = nil;
+            } else {
+                __INST(code_) = (OBJ)(__longIntVal(anAddress));
+            }
+        }
     }
 %}
 ! !
@@ -336,6 +344,6 @@
 !ExecutableFunction class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Attic/ExecFunc.st,v 1.35 1998-01-20 18:18:55 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Attic/ExecFunc.st,v 1.36 1998-05-07 17:45:56 cg Exp $'
 ! !
 ExecutableFunction initialize!
--- a/ExecutableFunction.st	Wed May 06 13:49:51 1998 +0200
+++ b/ExecutableFunction.st	Thu May 07 19:45:56 1998 +0200
@@ -113,11 +113,15 @@
     unsigned INT addr;
 
     if (__INST(code_) != nil) {
-	addr = (unsigned INT)__INST(code_);
-	if (addr <= _MAX_INT) {
-	    RETURN ( __MKSMALLINT(addr) );
-	}
-	RETURN ( __MKUINT(addr));
+        
+        RETURN (__MKEXTERNALADDRESS(__INST(code_)));
+#ifdef OLD
+        addr = (unsigned INT)__INST(code_);
+        if (addr <= _MAX_INT) {
+            RETURN ( __MKSMALLINT(addr) );
+        }
+        RETURN ( __MKUINT(addr));
+#endif
     }
 %}.
     ^ nil
@@ -200,14 +204,18 @@
 
 %{  /* NOCONTEXT */
 
-    if (__isSmallInteger(anAddress))
-	__INST(code_) = (OBJ)(__intVal(anAddress));
-    else {
-	if (anAddress == nil) {
-	    __INST(code_) = nil;
-	} else {
-	    __INST(code_) = (OBJ)(__longIntVal(anAddress));
-	}
+    if (__isExternalAddress(anAddress)) {
+        __INST(code_) = (OBJ)(__externalAddressVal(anAddress));
+    } else {
+        if (__isSmallInteger(anAddress))
+            __INST(code_) = (OBJ)(__intVal(anAddress));
+        else {
+            if (anAddress == nil) {
+                __INST(code_) = nil;
+            } else {
+                __INST(code_) = (OBJ)(__longIntVal(anAddress));
+            }
+        }
     }
 %}
 ! !
@@ -336,6 +344,6 @@
 !ExecutableFunction class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ExecutableFunction.st,v 1.35 1998-01-20 18:18:55 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ExecutableFunction.st,v 1.36 1998-05-07 17:45:56 cg Exp $'
 ! !
 ExecutableFunction initialize!