Now, the promised improved FRUTs (Framstags' Utilities): (Faster, less consumption of memory ... and neater :-) LOAD: to copy objects from your RAM-Disk ( := the dir ZZZ in HOME ) SAVE: to copy objects to your RAM-Disk COPY: to copy objects from your current directory to another dir (the selected objects remain in your current dir) MOVE: to replace objects from your current directory to another dir (the selected objects are deleted in your current dir) OBSI: shows the size of objects in Bytes. You can determin the size of any object, but not of system objects and directories. REPL: replace a substring with another substring in an object (the object can als be a none-string: a program etc) INS: Insert a program in another program Z: jump one directory up -------------------------------------------------------------------------- LOAD << 8 CF ! indicates copy_objects PATH -> p ! current dir << ZZZ ! jump to RAM-Disk ->CML ! subprg load_objects_into_stack p ->DIR ! recall dir ->CMS >> ! subprg store_objects_from_stack >> SAVE << 8 CF ! indicates copy_objects PATH -> p ! current dir << ->CML ! subprg load_objects_into_stack ZZZ ! jump to RAM-Disk ->CMS ! subprg store_objects_from_stack p ->DIR >> ! recall dir >> usage: ====== [ First make the RAM-Disk-directory ZZZ: HOME 'ZZZ' CRDIR ] LOAD LOAD SAVE SAVE eg: 'TEST' SAVE { 'TEST1' 'NEXT' 'ANOTHER' } SAVE 'TEST' LOAD { 'TEST1' 'NEXT' 'ANOTHER' } LOAD You can also load/save whole subdir-trees! -------------------------------------------------------------------------- COPY << 8 CF ! indicates copy_objects ->CML ! subprg load_objects_into_stack HALT ! HALT for changing the dir ->CMS ! subprg store_objects_from_stack >> MOVE << 8 SF ! indicates move_objects ->CML ! subprg load_objects_into_stack HALT ! HALT for changing the dir ->CMS ! subprg store_objects_from_stack >> usage: COPY ====== [now travel to the destination directory] CONT [:= SHIFT 1] COPY [now travel to the destination directory] CONT [:= SHIFT 1] MOVE [now travel to the destination directory] CONT [:= SHIFT 1] MOVE [now travel to the destination directory] CONT [:= SHIFT 1] eg: { 'TEST1' 'NEXT' 'SUBDIR1' } COPY HOME CONT VARS MOVE Z CONT You can also copy/move whole subdir-trees! -------------------------------------------------------------------------- The subprgs to LOAD/SAVE/COPY/MOVE : ->CML ! subprg load_objects_into_stack << ->O->L ! make a list 1 ol SIZE FOR i ! loop from 1 to # of objects to load ol i GET DUP ! get object name IFERR RCL ! and contence IF 8 FS? ! MOVE? THEN OVER PURGE END ! then delete object in the source dir SWAP ! THEN ! IF ERRN #12Ah == THEN ! if the object was a dir then EVAL -> dir ! jump to subdir and store the name of the subdir << VARS DUP ! all objects in that subdir IF { } <> ! if the subdir is not empty THEN ->CML ! then call subprg ->CML (rekursion) ELSE DROP END ! else do nothing dir DUP ! put name of subdir onto stack << CRDIR >> ! preparing for making a dir Z ! one dir up IF 8 FS? THEN ! MOVE? OVER PURGE END ! then delete the object in the source-dir >> ELSE KILL END ! stop program END NEXT 1 ol SIZE ! from 1 to # of objects; loop-# for ->CMS subprg 'ol' PURGE ! delete no more longer needed object-list >> ->CMS ! store_objects_to_stack << IFERR ! Error-tracking if an directory occurs START ! Loop from 1 to # of ojects in the subdir IFERR ! Error-tracking if an directory occurs STO ! store the object THEN EVAL EVAL ! if it was an dir-object then create the dir ->CMS ! call the prg again (recursion) Z ! jump up one dir END NEXT THEN END >> ->O->L << IFERR LIST-> THEN 1 END ! out of the list ->LIST 'ol' STO ! into a list and store it >> ->DIR ! evaluate a dir-path << DUP SIZE 1 1 ROT START GETI EVAL NEXT DROP2 >> Z ! jump up one dir << PATH DUP SIZE 1 - 1 MAX GET EVAL >> -------------------------------------------------------------------------- OBSI ! object-sizes << ->O->L ! subroutine to make a list 1 DROP ! set the LAST-buffer to a constant value MEM 'm0' STO ! store mem-size ol LIST-> ! put the list on the stack 1 SWAP ! from 1 to list-size (# of specified objects) FOR i ! loop IFERR ! error-trapping for the case of an directory RCL ! dir is speciefied in the object-list "'m" i ->STR + STR-> ! create name of the next dummy-object STO ! and store it THEN DROP END ! is the object a dir then next NEXT 1 DROP ! set the LAST-buffer to a constant value MEM m0 - NEG ! difference in memory before/after doubling 0 ol SIZE FOR i ! loop from 0 to # of objects "'m" i ->STR + STR-> ! name of the dummy-object PURGE ! delete it NEXT ol ->STR SIZE + ! add mem-size of the name of the objects ol SIZE 3 * - 20 - ! and subtract the mem-size of the dummy-names 'ol' PURGE ! delete no more needed list >> !How it works: ! The prg doubles the objects: they are stored in dummy objects. The difference ! in MEM before and after that doubling is the memory-size of the objects. ->O->L << IFERR LIST-> THEN 1 END ! out of the list ->LIST 'ol' STO ! into a list and store it >> usage: OBSI ====== OBSI eg: 1: 'OBSI' OBSI VARS OBSI -------------------------------------------------------------------------- REPL ! replace a string with another one << IF DUP TYPE 6 <> THEN ! is it not a (global) name? 'rep' SWAP OVER STO ! then store it DUP 4 ROLLD ->REPL ! call subprg RCL LAST PURGE ! delete the dummy-object 'repl' ELSE ->REPL END ! else call subprg >> ->REPL ! subprg replace a string with another one << 0 -> a b p z ! make local variables << p RCL ->STR ! recall the object and change it to a string WHILE ! loop DUP DUP a POS DUP 'z' STO! the string to change and his size REPEAT 1 z 1 - SUB ! from start to occurence of the string b + ! add new string SWAP z a SIZE + ! new size OVER SIZE SUB + ! add the rest of old string END p RCL ! recall the object IF TYPE 2 <> THEN STR-> END! out of string (if it was originally no one) p STO DROP ! store it >> >> Usage: 3: ====== 2: 1: REPL eg: "^" 33 CHR "That's it^^" REPL "DUP OVER +" "SWAP -" 'doit' REPL INS ! Insert programs << RCL ->STR ! recall the 1st prg and make a string "@" SWAP ROT ! prepare for REPL RCL REPL ! recall 2nd prg and replace "@" with prg #2 >> [ <> is the not-equal-sign ] [ @ is the micro-sign (shift-x) ] Usage: First mark the place, where the 2nd prg should be inserted ====== with a @. 2: 1: INS eg: 2: << "this is a test" @ HOME >> 1: << 1 DISP >> INS 'MAIN' 'SUB' INS