Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Latest library loader script

 [1/1] from: andrew::martin::colenso::school::nz at: 24-Dec-2003 22:46


Plus, it uses a dialect (sort-of), and has no infinite loops! Thanks to Anton, Gregg and Volker. [ Rebol [ Name: 'Values Title: "Values" File: %"Values.r" Author: "A J Martin" Owner: "Aztecnology" Rights: "Copyright (c) 2003 A J Martin, Aztecnology." eMail: [Rebol--orcon--net--nz] Web: http://www.rebol.it/Valley/ Tabs: 4 Purpose: {Loads Values into Rebol. Interprets 'Requires field in header.} Language: 'English Acknowledgements: ["Anton Rolls" "Gregg Irwin" "Volker Nitsch"] Date: 13/November/2003 Version: 4.1.0 ] use [Patches Files Provided Required Do_Script Provides Do_or_Defer_Script Header Requires Script Error Previous] [ do Patches: %Patches.r system/error/user: make system/error/user [ No_Header: [ "The script:" :arg1 "in directory:" :arg2 doesn't have a script header! ] Lacks_Content: [ "The script:" :arg1 "in directory:" :arg2 doesn't have any script content! ] No_Provider: [ "The scripts:" :arg1 "in directory:" :arg2 require words which no other script provides! ] ] Files: exclude read %./ reduce [Rebol/script/header/File Patches] Provided: make block! 100 Required: make block! 100 Do_Script: [ do Script Provides: in Header 'Provides Required: exclude Required to block! Requires if all [ not none? Provides Provides: get Provides any [ word? Provides block? Provides ] ] [ insert tail Provided Provides ] ] Do_or_Defer_Script: func [Script [block!] File [file!]] [ Header: first Script either none? Requires: in Header 'Requires Do_Script [ either empty? exclude Requires: to block! get Requires Provided Do_Script [ Required: union Required Requires insert/only tail Files reduce [Script File] ] ] ] parse Files [ some [ set File file! ( if found? find/last File %.r [ if any [ error? try [ Error: 'No_Header Script: load/header File Error: 'Lacks_Content ] not block? Script ] [ make error! compose [ user (Error) (mold File) (mold system/script/path) ] ] Do_or_Defer_Script Script File ] ) | into [set Script block! set File file!] ( insert tail Files length? Required Do_or_Defer_Script Script File ) | set Previous integer! ( if Previous <= length? Required [ Script: make block! 10 foreach Script_File find Files Previous [ if block? Script_File [ insert tail Script mold last Script_File ] ] make error! compose/deep [ user No_Provider [(Script)] (mold system/script/path) ] ] ) ] end ] ] ] Andrew J Martin Attendance Officer Speaking in tongues and performing miracles. Colenso High School Arnold Street, Napier. Tel: 64-6-8310180 ext 826 Fax: 64-6-8336759 http://colenso.net/scripts/Wiki.r?AJM http://www.colenso.school.nz/ DISCLAIMER: Colenso High School and its Board of Trustees is not responsible (or legally liable) for materials distributed to or acquired from user e-mail accounts. You can report any misuse of an e-mail account to our ICT Manager and the complaint will be investigated. (Misuse can come in many forms, but can be viewed as any material sent/received that indicate or suggest pornography, unethical or illegal solicitation, racism, sexism, inappropriate language and/or other issues described in our Acceptable Use Policy.) All outgoing messages are certified virus-free by McAfee GroupShield Exchange 5.10.285.0 Phone: +64 6 843 5095 or Fax: +64 6 833 6759 or E-mail: [postmaster--colenso--school--nz]