Monday, November 08, 2010 at 12:02 AM.
system.verbs.builtins.card.details.iowafrontier
<<this script is embedded in the MacBird program <<it's in 'scpt' resource 128 <<it's called in iowafrontier.c <<card-runtime support scripts on init (tablename, packedtable, fsapp, filelist) { <<start a card <<create a table for the card, run the startCard script <<we unpack the table as a sub-table in system.compiler.cards <<or create an empty one if packedtable is empty <<dmb 9/30/96: we don't call startcard anymore <<it's too soon. the runtime will call it directly after <<doing all of its default setup. <<also, startcard needs to run in the card context, which <<none of these event handlers require. <<dmb 9/13/96: we no longer support cards as apps: <<set up two items in the table: files and path <<files is a list, containing the files dropped onto the app <<you can refer to these as files [1], files [2], etc. <<path is a file spec for the application that opened the card <<if there's a startup script in the table, we run it <<returns the name of the table we created for the card <<make sure the base table exists local (adrBaseTable = @system.compiler.cards); if not defined (adrBaseTable^) { new (tableType, adrBaseTable)}; if sizeOf (tablename) == 0 { <<Iowa Runtime doesn't have a name, make one up tablename = nameOf (table.uniqueName ("card", adrBaseTable)^)}; <<unpack the card's table, or create an empty one if it doesn't have one local (adrTable = @adrBaseTable^.[tablename]); if sizeOf (packedtable) > 0 { unpack (@packedtable, adrTable)} else { new (tableType, adrTable)}; <<initialize the contents of the table if defined (adrTable^.path) { <<get rid of old field delete (@adrTable^.path)}; if defined (adrTable^.files) { <<transition from a table to a list delete (@adrTable^.files)}; <<adrTable^.path = fsapp <<it's still called a path, just like desktop scripts & droplets <<if filelist == nil <<adrTable^.files = {} <<else <<adrTable^.files = filelist <<patch Frontier's paths table, switch in this card's menu bar if it has one card.setGlobalTable (adrTable, true); <<if defined (adrTable^.startCard) <<if runmode <<adrTable^.startCard () <<else <<try <<adrTable^.startCard () <<else <<adrTable^.startCardError = tryError return (tablename)}; on clos (tablename) { <<close a card local (adrTable = @system.compiler.cards); if defined (adrTable^) { local (adrTable = @adrTable^.[tablename]); if defined (adrTable^) { if defined (adrTable^.parentPath) { card.bringCardToFront (file.fileFromPath (adrTable^.parentPath))}; delete (adrTable)}; return (true)}}; on edtb (tablename, windowtitle) { <<edit the table embedded in the card local (adrTable = @system.compiler.cards.[tablename]); target.set (adrTable); window.setTitle (adrTable, windowtitle); edit (adrTable); Frontier.bringToFront (); return (true)}; on gett (tablename) { <<return the packed table local (data); pack (system.compiler.cards.[tablename], @data); return (data)}; on sett (tablename, majorswitch) { <<the table becomes the current table <<dmb 9/6/96: after making sure the table exists, let card.setGlobalTable do the work <<also, handle empty string for when a card is switching out local (adrTable); if tablename == "" { adrTable = nil} else { adrTable = @system.compiler.cards.[tablename]; if not defined (adrTable^) { new (tableType, adrTable)}}; return (card.setGlobalTable (adrTable, majorswitch))}; <<clay basket macro language support scripts on dosc (s) { <<runs a macro, for Clay Basket try { clay.data.macros.lastmacrocall = s; with clay.data.macros { return (string (evaluate (s)))}} else { scriptError (toys.cleanForExport (tryError))}}; on addg (name, value, type) { <<add a name/value to the glossary local (adrsubtable = @clay.data.glossary [name]); if defined (adrsubtable^) { if not dialog.confirm ("OK to replace existing glossary entry named \"" + name + "\"?") { return (false)}} else { new (tabletype, adrsubtable)}; adrsubtable^.v = value; adrsubtable^.t = type; filemenu.save (); return (true)}; on refg (name) { <<turn a glossary entry name into a string for insertion into HTML text local (adrsubtable = @clay.data.glossary [name]); if not defined (adrsubtable^) { scriptError ("There is no glossary entry named \"" + name + "\"")}; with adrsubtable^ { case t { 0 { return (v)}; 1 { return ("<a href=\""+ v + "\">" + name + "</a>")}; 2 { return ("<a href=\"mailto:"+ v + "\">" + name + "</a>")}} else { scriptError ("Unsupported glossary type, number = " + t)}}}; on edtg () { <<bring Frontier to the front and edit the glossary table frontier.bringtofront (); edit (@clay.data.glossary); return (true)}
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.