]> gitweb.factorcode.org Git - factor.git/commitdiff
use +foo+ as symbol names
authorDoug Coleman <doug.coleman@gmail.com>
Tue, 17 Feb 2009 18:36:27 +0000 (12:36 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Tue, 17 Feb 2009 18:36:27 +0000 (12:36 -0600)
basis/tools/files/files.factor
basis/tools/files/unix/unix.factor
basis/tools/files/windows/windows.factor

index 7508c37cac456ff15469ce89745c1647ef629334..8d882099def92089f74227cfceeb87411f39b382 100755 (executable)
@@ -35,9 +35,10 @@ IN: tools.files
 
 PRIVATE>
 
-SYMBOLS: file-name file-name/type permissions file-type nlinks file-size
-file-date file-time file-datetime uid gid user group link-target unix-datetime
-directory-or-size ;
+SYMBOLS: +file-name+ +file-name/type+ +permissions+ +file-type+
++nlinks+ +file-size+ +file-date+ +file-time+ +file-datetime+
++uid+ +gid+ +user+ +group+ +link-target+ +unix-datetime+
++directory-or-size+ ;
 
 TUPLE: listing-tool path specs sort ;
 
@@ -48,10 +49,10 @@ C: <file-listing> file-listing
 : <listing-tool> ( path -- listing-tool )
     listing-tool new
         swap >>path
-        { file-name } >>specs ;
+        { +file-name+ } >>specs ;
 
 : list-slow? ( listing-tool -- ? )
-    specs>> { file-name } sequence= not ;
+    specs>> { +file-name+ } sequence= not ;
 
 ERROR: unknown-file-spec symbol ;
 
@@ -59,12 +60,12 @@ HOOK: file-spec>string os ( file-listing spec -- string )
 
 M: object file-spec>string ( file-listing spec -- string )
     {
-        { file-name [ directory-entry>> name>> ] }
-        { directory-or-size [ file-info>> dir-or-size ] }
-        { file-size [ file-info>> size>> number>string ] }
-        { file-date [ file-info>> modified>> listing-date ] }
-        { file-time [ file-info>> modified>> listing-time ] }
-        { file-datetime [ file-info>> modified>> timestamp>ymdhms ] }
+        { +file-name+ [ directory-entry>> name>> ] }
+        { +directory-or-size+ [ file-info>> dir-or-size ] }
+        { +file-size+ [ file-info>> size>> number>string ] }
+        { +file-date+ [ file-info>> modified>> listing-date ] }
+        { +file-time+ [ file-info>> modified>> listing-time ] }
+        { +file-datetime+ [ file-info>> modified>> timestamp>ymdhms ] }
         [ unknown-file-spec ]
     } case ;
 
@@ -85,22 +86,22 @@ HOOK: (directory.) os ( path -- lines )
 
 : directory. ( path -- ) (directory.) simple-table. ;
 
-SYMBOLS: device-name mount-point type
-available-space free-space used-space total-space
-percent-used percent-free ;
+SYMBOLS: +device-name+ +mount-point+ +type+
++available-space+ +free-space+ +used-space+ +total-space+
++percent-used+ +percent-free+ ;
 
 : percent ( real -- integer ) 100 * >integer ; inline
 
 : file-system-spec ( file-system-info obj -- str )
     {
-        { device-name [ device-name>> "" or ] }
-        { mount-point [ mount-point>> "" or ] }
-        { type [ type>> "" or ] }
-        { available-space [ available-space>> 0 or ] }
-        { free-space [ free-space>> 0 or ] }
-        { used-space [ used-space>> 0 or ] }
-        { total-space [ total-space>> 0 or ] }
-        { percent-used [
+        { +device-name+ [ device-name>> "" or ] }
+        { +mount-point+ [ mount-point>> "" or ] }
+        { +type+ [ type>> "" or ] }
+        { +available-space+ [ available-space>> 0 or ] }
+        { +free-space+ [ free-space>> 0 or ] }
+        { +used-space+ [ used-space>> 0 or ] }
+        { +total-space+ [ total-space>> 0 or ] }
+        { +percent-used+ [
             [ used-space>> ] [ total-space>> ] bi
             [ 0 or ] bi@ dup 0 =
             [ 2drop 0 ] [ / percent ] if
@@ -116,8 +117,8 @@ percent-used percent-free ;
 
 : file-systems. ( -- )
     {
-        device-name available-space free-space used-space
-        total-space percent-used mount-point
+        +device-name+ +available-space+ +free-space+ +used-space+
+        +total-space+ +percent-used+ +mount-point+
     } print-file-systems ;
 
 {
index e63ab09076fdd1f99cec080effa7705f09812851..90e91529a1388925ca6ec2bb269022692304bfc4 100755 (executable)
@@ -47,21 +47,24 @@ IN: tools.files.unix
 
 M: unix (directory.) ( path -- lines )
     <listing-tool>
-        { permissions nlinks user group file-size file-date file-name } >>specs
+        {
+            +permissions+ +nlinks+ +user+ +group+
+            +file-size+ +file-date+ +file-name+
+        } >>specs
         { { directory-entry>> name>> <=> } } >>sort
     [ [ list-files ] with-group-cache ] with-user-cache ;
 
 M: unix file-spec>string ( file-listing spec -- string )
     {
-        { file-name/type [
+        { +file-name/type+ [
             directory-entry>> [ name>> ] [ file-type>trailing ] bi append
         ] }
-        { permissions [ file-info>> permissions-string ] }
-        { nlinks [ file-info>> nlink>> number>string ] }
-        { user [ file-info>> uid>> user-name ] }
-        { group [ file-info>> gid>> group-name ] }
-        { uid [ file-info>> uid>> number>string ] }
-        { gid [ file-info>> gid>> number>string ] }
+        { +permissions+ [ file-info>> permissions-string ] }
+        { +nlinks+ [ file-info>> nlink>> number>string ] }
+        { +user+ [ file-info>> uid>> user-name ] }
+        { +group+ [ file-info>> gid>> group-name ] }
+        { +uid+ [ file-info>> uid>> number>string ] }
+        { +gid+ [ file-info>> gid>> number>string ] }
         [ call-next-method ]
     } case ;
 
index f321c2fc7f4507ffa2807c4777bff49e99a9fb60..874b2ef5c1faf89af6d7348b04d70a0a9c92ecd6 100755 (executable)
@@ -9,7 +9,7 @@ IN: tools.files.windows
 
 M: windows (directory.) ( entries -- lines )
     <listing-tool>
-        { file-datetime directory-or-size file-name } >>specs
+        { +file-datetime+ +directory-or-size+ +file-name+ } >>specs
         { { directory-entry>> name>> <=> } } >>sort
     list-files ;