examples
authorClaus Gittinger <cg@exept.de>
Sat, 27 Apr 1996 20:11:33 +0200
changeset 1317 cc737e0fdf48
parent 1316 248a8cb2ae3b
child 1318 25b5f52aa644
examples
ExtAddr.st
ExtBytes.st
ExtFunc.st
ExternalAddress.st
ExternalBytes.st
ExternalFunction.st
Filename.st
--- a/ExtAddr.st	Sat Apr 27 20:02:36 1996 +0200
+++ b/ExtAddr.st	Sat Apr 27 20:11:33 1996 +0200
@@ -46,7 +46,7 @@
 
     There is not much you can do with ExternalAddresses on the smalltalk level;
     creation/use is mostly in primitive C-code via 
-    __MKEXTERNALADDRESS(voidPtr) and __ExternalAddressVal(obj).
+       __MKEXTERNALADDRESS(voidPtr) and __ExternalAddressVal(obj).
 
     ExternallAddresses are much like ExternalBytes - however, the latter
     allow you to access bytes via indexed at:/at:put: messages.
@@ -55,6 +55,11 @@
 
     [author:]
         Claus Gittinger
+
+    [see also:]
+        ByteArray
+        ExternalBytes ExternalFunction
+        ( how to write primitive code :html: programming/primitive.html )
 "
 !
 
@@ -162,5 +167,5 @@
 !ExternalAddress class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Attic/ExtAddr.st,v 1.4 1996-04-25 16:01:18 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Attic/ExtAddr.st,v 1.5 1996-04-27 18:11:26 cg Exp $'
 ! !
--- a/ExtBytes.st	Sat Apr 27 20:02:36 1996 +0200
+++ b/ExtBytes.st	Sat Apr 27 20:11:33 1996 +0200
@@ -286,6 +286,11 @@
 
     [author:]
         Claus Gittinger
+
+    [see also:]
+        ExternalAddress ExternalFunction
+        ByteArray
+        ( how to write primitive code :html: programming/primitive.html )
 "
 !
 
@@ -1065,6 +1070,6 @@
 !ExternalBytes class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Attic/ExtBytes.st,v 1.7 1996-04-25 16:01:23 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Attic/ExtBytes.st,v 1.8 1996-04-27 18:11:33 cg Exp $'
 ! !
 ExternalBytes initialize!
--- a/ExtFunc.st	Sat Apr 27 20:02:36 1996 +0200
+++ b/ExtFunc.st	Sat Apr 27 20:11:33 1996 +0200
@@ -97,6 +97,10 @@
 
     [author:]
         Claus Gittinger
+
+    [see also:]
+        ExternalAddress ExternalBytes
+        ( how to write primitive code :html: programming/primitive.html )
 "
 ! !
 
@@ -415,6 +419,6 @@
 !ExternalFunction class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Attic/ExtFunc.st,v 1.8 1996-04-25 15:59:43 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Attic/ExtFunc.st,v 1.9 1996-04-27 18:10:49 cg Exp $'
 ! !
 ExternalFunction initialize!
--- a/ExternalAddress.st	Sat Apr 27 20:02:36 1996 +0200
+++ b/ExternalAddress.st	Sat Apr 27 20:11:33 1996 +0200
@@ -46,7 +46,7 @@
 
     There is not much you can do with ExternalAddresses on the smalltalk level;
     creation/use is mostly in primitive C-code via 
-    __MKEXTERNALADDRESS(voidPtr) and __ExternalAddressVal(obj).
+       __MKEXTERNALADDRESS(voidPtr) and __ExternalAddressVal(obj).
 
     ExternallAddresses are much like ExternalBytes - however, the latter
     allow you to access bytes via indexed at:/at:put: messages.
@@ -55,6 +55,11 @@
 
     [author:]
         Claus Gittinger
+
+    [see also:]
+        ByteArray
+        ExternalBytes ExternalFunction
+        ( how to write primitive code :html: programming/primitive.html )
 "
 !
 
@@ -162,5 +167,5 @@
 !ExternalAddress class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ExternalAddress.st,v 1.4 1996-04-25 16:01:18 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ExternalAddress.st,v 1.5 1996-04-27 18:11:26 cg Exp $'
 ! !
--- a/ExternalBytes.st	Sat Apr 27 20:02:36 1996 +0200
+++ b/ExternalBytes.st	Sat Apr 27 20:11:33 1996 +0200
@@ -286,6 +286,11 @@
 
     [author:]
         Claus Gittinger
+
+    [see also:]
+        ExternalAddress ExternalFunction
+        ByteArray
+        ( how to write primitive code :html: programming/primitive.html )
 "
 !
 
@@ -1065,6 +1070,6 @@
 !ExternalBytes class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ExternalBytes.st,v 1.7 1996-04-25 16:01:23 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ExternalBytes.st,v 1.8 1996-04-27 18:11:33 cg Exp $'
 ! !
 ExternalBytes initialize!
--- a/ExternalFunction.st	Sat Apr 27 20:02:36 1996 +0200
+++ b/ExternalFunction.st	Sat Apr 27 20:11:33 1996 +0200
@@ -97,6 +97,10 @@
 
     [author:]
         Claus Gittinger
+
+    [see also:]
+        ExternalAddress ExternalBytes
+        ( how to write primitive code :html: programming/primitive.html )
 "
 ! !
 
@@ -415,6 +419,6 @@
 !ExternalFunction class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ExternalFunction.st,v 1.8 1996-04-25 15:59:43 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ExternalFunction.st,v 1.9 1996-04-27 18:10:49 cg Exp $'
 ! !
 ExternalFunction initialize!
--- a/Filename.st	Sat Apr 27 20:02:36 1996 +0200
+++ b/Filename.st	Sat Apr 27 20:11:33 1996 +0200
@@ -73,123 +73,125 @@
 "
     does a file/directory exist ?:
 
-	|f|
+        |f|
 
-	f := 'foobar' asFilename.
-	^ f exists  
+        f := 'foobar' asFilename.
+        ^ f exists  
 
 
     is it a directory ?:
 
-	|f|
+        |f|
 
-	f := '/tmp' asFilename.
-	^ f isDirectory.   
+        f := '/tmp' asFilename.
+        ^ f isDirectory.   
 
         
     get the working directory:
 
-	^ Filename defaultDirectory
+        ^ Filename defaultDirectory
 
 
     get a files full pathname 
     (caring for relative names or symbolic links):
 
-	|f|
+        |f|
 
-	f := '..' asFilename.
-	^ f pathName  
+        f := '..' asFilename.
+        ^ f pathName  
 
 
     get a directories directory:
 
-	|f|
+        |f|
 
-	f := Filename defaultDirectory.
-	^ f directory 
+        f := Filename defaultDirectory.
+        ^ f directory 
 
 
     get a files directory:
 
-	|f|
+        |f|
 
-	f := './smalltalk' asFilename.
-	^ f directory 
+        f := './smalltalk' asFilename.
+        ^ f directory 
 
 
     getting access & modification times:
 
 
-	|f|
+        |f|
 
-	f := '/tmp' asFilename.
-	^ f dates
+        f := '/tmp' asFilename.
+        ^ f dates
 
     access time only:
 
-	|f|
+        |f|
 
-	f := '/tmp' asFilename.
-	^ f dates at:#accessed  
+        f := '/tmp' asFilename.
+        ^ f dates at:#accessed  
         
 
     getting all information on a file/directory:
 
 
-	|f|
+        |f|
 
-	f := '/tmp' asFilename.
-	^ f info
+        f := '/tmp' asFilename.
+        ^ f info
 
 
     getting a temporary file (unique name):
 
-	|f|
+        |f|
 
-	f := Filename newTemporary.
-	^ f    
+        f := Filename newTemporary.
+        ^ f    
 
 
     creating, writing, reading and removing a temporary file:
-
-
-	|f writeStream readStream|
+                                                                        [exBegin]
+        |f writeStream readStream|
 
-	f := Filename newTemporary.
-	writeStream := f writeStream.
-	writeStream nextPutAll:'hello world'.
-	writeStream cr.
-	writeStream close.
+        f := Filename newTemporary.
+        writeStream := f writeStream.
+        writeStream nextPutAll:'hello world'.
+        writeStream cr.
+        writeStream close.
 
-	'contents (as seen by unix''s cat command:' printNL.
-	OperatingSystem executeCommand:('cat ' , f pathName).
+        'contents (as seen by unix''s cat command:' printNL.
+        OperatingSystem executeCommand:('cat ' , f pathName).
 
-	readStream := f readStream.
-	Transcript showCr:'contents as seen by smalltalk:'.
-	Transcript showCr:(readStream upToEnd).
-	readStream close.
+        readStream := f readStream.
+        Transcript showCr:'contents as seen by smalltalk:'.
+        Transcript showCr:(readStream upToEnd).
+        readStream close.
 
-	f delete.
+        f delete.
+                                                                        [exEnd]
         
 
     getting a directories contents:
-
-	|f files|
+                                                                        [exBegin]
+        |f files|
 
-	f := '.' asFilename.
-	files := f directoryContents.
-	Transcript showCr:'the files are:'.
-	Transcript showCr:(files printString).
+        f := '.' asFilename.
+        files := f directoryContents.
+        Transcript showCr:'the files are:'.
+        Transcript showCr:(files printString).
+                                                                        [exEnd]
 
 
     editing a file:
-
-	|f|
+                                                                        [exBegin]
+        |f|
 
-	f := '/tmp/fooBar' asFilename.
-	(f writeStream) nextPutAll:'hello world'; close.
+        f := '/tmp/fooBar' asFilename.
+        (f writeStream) nextPutAll:'hello world'; close.
 
-	f edit
+        f edit
+                                                                        [exEnd]
 "
 ! !
 
@@ -1762,28 +1764,33 @@
 
 pathName
     "return the full pathname of the file represented by the receiver,
-     as a string. This will not include ..'s. See also: name"
+     as a string. This will not include ..'s. 
+     If the path represented by the receiver does NOT represent a valid path,
+     no compression will be done (for now; this may change).
+     See also: name"
 
-    |parentName sep|
+    |p|
 
-    sep := self class separator.
-    (nameString startsWith:sep) ifTrue:[
-	parentName := self class parentDirectoryName.
-	(nameString findString:parentName) == 0 ifTrue:[
-	    ^ nameString
-	]
-    ].
-    ^ (FileDirectory directoryNamed:nameString) pathName
+"/    sep := self class separator.
+"/    (nameString startsWith:sep) ifTrue:[
+"/        parentName := self class parentDirectoryName.
+"/        (nameString findString:parentName) == 0 ifTrue:[
+"/            ^ nameString
+"/        ]
+"/    ].
+    p := OperatingSystem pathNameOf:nameString.
+    ^ p
 
     "
-     '/foo/bar' asFilename pathName
-     '.' asFilename pathName 
-     '../..' asFilename pathName 
-     '../..' asFilename name 
-     '/tmp/../usr' asFilename pathName  
+     '/foo/bar' asFilename pathName  
+     '.' asFilename pathName         
+     '../..' asFilename pathName     
+     '../..' asFilename name           
+     '/tmp/../usr' asFilename pathName   
+     '/././usr' asFilename pathName     
     "
 
-    "Modified: 18.1.1996 / 21:36:46 / cg"
+    "Modified: 27.4.1996 / 18:19:52 / cg"
 !
 
 suffix
@@ -1900,5 +1907,5 @@
 !Filename class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.56 1996-04-25 16:01:07 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.57 1996-04-27 18:11:11 cg Exp $'
 ! !