Home
STELLA manual - Information Sciences Institute
Contents
1. 104 SCarCh cOnsS treee fic 2c ere eerta 39 search for objeCct sees ere e di 105 second on CONS ve teens Pe deeed Seen 3T second On MST ceceseebexyereevenfesieyn ips 42 second on MUTABLE STRING esses 33 second on STRING ecc ee prede es 33 second on VECTOR ai viechs ce Re rr He PES 50 seed random number generator 105 SCQUCNCE sococese pk zi Reo fescue are Bee 105 c n 46 set call log break point 105 set configuration property 105 Set current date on DECODED DATE TIME 105 set current date time on DECODED DATE TIME EE E dep Teo dud REeee NE ed dera 105 set current time on DECODED DATE TIME 105 s t global value o i eens eee la es 105 set log le6v6el 49 9l Sre pahi RIA LOS 105 set logging parameters 105 set optimization levels 105 set stella feat re 2 ome bed 105 set translator output language 106 SOC Cis sli mede tediisedarns s maus Cile 106 shadowed symbol 2212 2 9 b Re RRLEY es 106 shift right on INTEGER sss 106 shift right on LONG INTEGER 106 Signal 422s cot onl inlet ard eeu nose dar aid 106 sipnal read error i e124xea dada kin 106 SUM is repii donee iud cse edu iie besar 29 Sleep Tece ppap We rese dee satis ae reacties aelem Lane 71 sort OM CONS inso Reed dar Seen Rp Ede 40 SOrt Oh HEAP 2 sende A Lire ide qud 106 S rt On
2. ITERATOR OF Function METHOD SLOT Iterate over all methods visible from module If local return only methods interned in module If module is null return all methods interned everywhere all modules ITERATOR OF MODULE Function Return an iterator that generates all modules Chapter 6 Library Functions 76 all public functions module MODULE local BOOLEAN Function ITERATOR OF FUNCTION Iterate over all functions visible from module If local return only functions bound to symbols interned in module If module is null return all functions defined everywhere all public methods module MODULE local BOOLEAN ITERATOR Function OF METHOD SLOT Iterate over all public methods visible from module If local return only methods interned in module If module is null return all methods interned everywhere all required systems system name STRING CONS OF Function STRING WRAPPER Returns a CONS of all of the systems required by system name all slots module MODULE local BOOLEAN ITERATOR OF SLOT Function Iterate over all slots visible from module If local return only methods interned in module If module is null return all methods interned everywhere all subcontexts context CONTEXT traversal KEYWORD Function ALL PURPOSE ITERATOR OF CONTEXT Return an iterator that generates all subcontexts of self not including self in the order specified by traversal one of preorde
3. case expression clause Statement Each case clause has to be of one of the following forms key statement key statement case selects the first clause whose key or one of the listed key s matches the result of expression and executes the clause s statement s Each case key has to be a constant such as a number character string symbol keyword or surrogate Keys are compared with eq1 or string eql for strings All keys in a case statement have to be of the same type The special key otherwise can be used to catch everything It is a run time error if no clause with a matching key exists Therefore a STELLA case without an otherwise clause corresponds to a Common Lisp ecase An empty otherwise clause can always be specified via otherwise NULL Example case car make Yugo setq price cheap yw Chapter 3 The STELLA Language 10 setq price medium Ferrari Rolls Royce setq price expensive otherwise setq price unknown typecase expression clause Statement Each typecase clause has to be of one of the following forms type statement type statement typecase selects the first clause whose type or one of the listed type s equals or is a supertype of the run time type of the result of expression and then executes the clause s statement s Therefore typecase can be used to implement a type dispatch for cases where the run time type of an expression
4. printreadably BOOLEAN Special Variable If true conses will be printed as readable Stella code Chapter 6 Library Functions 41 printprettycode BOOLEAN Special Variable When true pretty print Stella and translated code Since Lisp pretty printing is somewhat slow turning this off speeds up file translation but it also makes translated output very unreadable 6 5 1 CONS Lists as Sets subset self otherList CONS BOOLEAN Method on CONS Return true if every element of self also occurs in otherList Uses an eql test and a simple quadratic time algorithm Note that this does not check whether self and otherList actually are sets equivalent sets self otherList CONS BOOLEAN Method on CONS Return true if every element of self occurs in otherList and vice versa Uses an eq1 test and a simple quadratic time algorithm Note that this does not check whether self and otherList actually are sets union self otherList CONS CONS Method on cons Return the set union of self and otherList Uses an eq1 test and a simple quadratic time algorithm Note that the result is only guaranteed to be a set if both self and otherList are sets intersection self otherList CONS CONS Method on cons Return the set intersection of self and otherList Uses an eql test and a simple quadratic time algorithm Note that the result is only guaranteed to be a set if both self and otherList are sets difference self oth
5. amp rest arguments NUMBER NUMBER Function Return the product of all arguments Chapter 6 Library Functions 28 x NUMBER amp rest arguments NUMBER NUMBER Function If only x was supplied return the result of 1 x Otherwise return the result of x argl arg2 argN 1 expression OBJECT OBJECT Macro Add 1 to expression and return the result 1 expression OBJECT OBJECT Macro Subtract 1 from expression and return the result place OBJECT amp body increment CONS OBJECT Macro Increment the value of place and return the result place can be either a variable name or a slot reference Increment by the optional increment which can be a float or 1 otherwise place OBJECT amp body decrement CONS OBJECT Macro Decrement the value of place and return the result place can be either a variable name or a slot reference Decrement by the optional decrement which can be a float or 1 otherwise x NUMBER y NUMBER BOOLEAN Function Return true if x and y are numbers of exactly the same magnitude lt x NUMBER y NUMBER BOOLEAN Function Return true if x is less than y lt x NUMBER y NUMBER BOOLEAN Function Return true if x is less than or equal to y gt x NUMBER y NUMBER BOOLEAN Function Return true if x is greater than or equal to y gt x NUMBER y NUMBER BOOLEAN Function Return true if x i
6. get stella module pathName STRING error BOOLEAN MODULE Function Return the module located at pathName or null if no such module exists The search looks at ancestors and top most cardinal modules If error is true throw an exception if no module is found find or create module pathname STRING MODULE Function Return a module located at pathname if one exists otherwise create one Chapter 6 Library Functions 65 clear module rest name NAME N Command Destroy all objects belonging to module name or any of its children If no name is supplied the current module will be cleared after confirming with the user Important modules such as STELLA are protected against accidental clearing destroy module self MODULE Function Destroy the module self and recursively destroy all contexts that inherit self destroy context self Method on MODULE Destroy the context self and recursively destroy all contexts that inherit self visible modules from MODULE CONS OF MODULE Function Return a list of all modules visible from module from or module if from is NULL The generated modules are generated from most to least specific and will start with the module from within module moduleForm OBJECT amp body body CONS OBJECT Macro Execute body within the module resulting from moduleForm module is an ac ceptable moduleForm It will locally rebind module and context and shield the outer
7. TYPE Method on SURROGATE Return the wrapped type for the type self or self if it is not a bare literal type unbound surrogates module MODULE local BOOLEAN Function ITERATOR OF SURROGATE Iterate over all unbound surrogates visible from module Look at all modules if module is nu11 If local only consider surrogates interned in module unbump log indent Command Decrease the indentation level for subsequent log messages unescape html string input STRING STRING Function Replaces HTML escape sequences such as amp amp with their associated characters unescape url string input STRING STRING Function Takes a string and replaces 96 format URL escape sequences with their real character equivalent according to RFC 2396 unset stella feature amp rest features KEYWORD Command Disable all listed STELLA features Chapter 6 Library Functions 112 unsigned shift right by 1 arg INTEGER Method on INTEGER Shift arg to the right by 1 position and 0 extend from the left This does not preserve the sign of arg and shifts the sign bit just like a regular bit In Common Lisp we can t do that directly and need to do some extra masking unsigned shift right by 1 arg LONG INTEGER Method on LONG INTEGER Shift arg to the right by 1 position and 0 extend from the left This does not preserve the sign of arg and shifts the sign bit just like a regular bit In Common Lisp we can t do that directly a
8. insert at self key INTEGER value OBJECT Method on INTEGER HASH TABLE Not documented insert at self key FLOAT value OBJECT Method on FLOAT HASH TABLE Not documented STELLA provides its own implementation of hash tables for cases where language native implementations are not available or where additional features are needed STELLA HASH TABLE ABSTRACT HASH TABLE Class Not documented any key OBJECT Class Parameter of Not documented any value OBJECT Class Parameter of Not documented the table ARRAY SIZE OF KV CONS Slot of Not documented Size INTEGER Slot of Not documented initial size INTEGER Slot of If supplied the initial hash table will be sized to hold at least that many elements free elements INTEGER Slot of Not documented equal test BOOLEAN Slot of If true use equal as the equality test and equal hash code as the hash func tion otherwise use eq1 and hash code the default lookup self key LIKE ANY KEY SELF LIKE Method on STELLA HASH TABLE ANY VALUE SELF Lookup the entry identified by key in self and return its value or NULL if no such entry exists Uses an eq1 test by default or equal if equal test of self is TRUE insert at self key LIKE ANY KEY SELF Method on STELLA HASH TABLE value LIKE ANY VALUE SELF Set the value of the entry identified by key in self to value or add a new entry if no ent
9. sees member on LIST 2 2ene et hi3 e RR member on SEQUENCE lessen member on STRING 0e cece sees member on VECTOR essere me molz8 scene pa Edna ede ies me rpe file nameS ico oso d xb aa merge null fields on DECODED DATE TIME merge superior null fields on DECODED DATE TIME eee MIN ON FLOAT oe 3 233 Jedi sce nee PARU apd ees MIN ON INTEGER derese 22r sot aud SIR LER min on LONG INTEGER 6466268056555 wn 00 min on NUMBER WRAPPER s s mod on INTEGER w exco hen eee eles mod on LONG INTEGER sen nnn modified julian day to julian day multiple parents on CLASS multiple parents on MODULE multiple parents on WORLD mutable string to string N name to Strlinf siisa er f e bg Od Fe new native read lin6 ois sd deeaes oe IRR DI pes next on ALL PURPOSE ITERATOR next on CONS ITERATOR eee eee next on KV LIST ITERATOR next on LIST ITERATOR next on MEMOIZABLE ITERATOR next on PROPERTY LIST ITERATOR nll 2ooszsneccneweede usd pP debe no duplicates on COLLECTION non empty on CONS erbe bai reg ai non empty on KEY VALUE LIST non empty on KEY VALUE MAP non empty On LIST secs dds oad pau rh eres non empty on PROPERTY LIST ss non empty on STELLA HAS
10. subset self otherList LIST BOOLEAN Method on LIST Return true if every element of self also occurs in otherList Uses an eq1 test and a simple quadratic time algorithm Note that this does not check whether self and otherList actually are sets equivalent sets self otherList LIST BOOLEAN Method on LIST Return true if every element of self occurs in otherList and vice versa Uses an eql test and a simple quadratic time algorithm Note that this does not check whether self and otherList actually are sets union self otherList LIST LIST Method on LIST Return the set union of self and otherList Uses an eq1 test and a simple quadratic time algorithm Note that the result is only guaranteed to be a set if both self and otherList are sets intersection self otherList LIST LIST Method on LIST Return the set intersection of self and otherList Uses an eql test and a simple quadratic time algorithm Note that the result is only guaranteed to be a set if both self and otherList are sets difference self otherList LIST LIST Method on LIST Return the set difference of self and otherList i e all elements that are in self but not in otherSet Uses an eql test and a simple quadratic time algorithm Note that the result is only guaranteed to be a set if both self and otherList are sets subtract self otherList LIST LIST Method on LIST Return the set difference of self and otherList by destructively
11. Apply the stored next function to self 6 13 Symbols lookup symbol name STRING SYMBOL Function Return the first symbol with name visible from the current module intern symbol name STRING SYMBOL Function Return a newly created or existing symbol with name name unintern symbol self SYMBOL Function Remove self from its home module and the symbol table lookup symbol in module name STRING module MODULE Function local BOOLEAN SYMBOL Return the first symbol with name visible from module If local only consider symbols directly interned in module If module is null use MODULE instead intern symbol in module name STRING module MODULE Function local BOOLEAN SYMBOL Look for a symbol named name in module if local do not consider inherited mod ules If none exists intern it locally in module Return the existing or newly created symbol intern derived symbol baseSymbol GENERALIZED SYMBOL Function newName STRING SYMBOL Return a newly created or existing symbol with name newName which is interned in the same module as baseSymbol visible symbol self SYMBOL BOOLEAN Function Return true if self is visible from the current module lookup visible symbols in module name sTRING Function module MODULE enforceShadowing BOOLEAN CONS OF SYMBOL Return the list of symbols with name visible from module More specific symbols relative to the module precedence ord
12. Function Function Function Function Function Function Chapter 6 Library Functions 30 acos n FLOAT FLOAT Function Return the arccosine of n in radians atan n FLOAT FLOAT Function Return the arc tangent of n in radians atan2 x FLOAT y FLOAT FLOAT Function Return the arc tangent of x y in radians random n INTEGER INTEGER Function Generate a random integer in the interval 0 n 1 integer to string i LONG INTEGER STRING Function Convert i to its string representation and return the result This is more efficient than using a string stream string to integer string STRING LONG INTEGER Function Convert a string representation of an integer into an integer float to string f FLOAT STRING Function Convert f to its string representation and return the result This is more efficient than using a string stream string to float string STRING FLOAT Function Convert a string representation of a float into a float format float f FLOAT nDecimals INTEGER STRING Function Print f in fixed point format with nDecimals behind the decimal point and return the result as a string wrap integer value INTEGER INTEGER WRAPPER Function Return a literal object whose value is the INTEGER value unwrap integer wrapper INTEGER WRAPPER INTEGER Function Unwrap wrapper and return the result Return NULL if wrapper is NULL wrap float value FLO
13. True if slot values are collections command method METHOD SLOT BOOLEAN Function Return true if method is an evaluable command component self BOOLEAN Method on STORAGE SLOT True if fillers of this slot are components of the owner slot and therefore should be deleted if the owner is deleted compose namestring Function name components CONS OF STRING WRAPPER amp rest options OBJECT STRING name components is a cons to be processed into a namestring prefix and suffix are strings that will NOT be case converted case is one of UPCASE TitleCase titleCaseX downcase Capitalize default is TitleCase separator is a string that should separate word elements It does not separate the prefix or suffix Default is translation table should be a STRING HASH TABLE hash table that strings into their desired printed representation as a string In general the argument will be strings but that is not strictly necessary Chapter 6 Library Functions 81 compose namestring full strings CONS OF STRING WRAPPER Function prefix STRING suffix STRING outputcase KEYWORD outputseparator STRING translationtable STRING HASH TABLE useacronymheuristics BOOLEAN STRING Non keyword version of compose namestring which will probably be easier to use when called from non Lisp languages compute module and bare name name STRING MODULE Function STRING Compute the module indicated by the STELLA name
14. clear self Method on VECTOR SEQUENCE Clear self by setting its active length to zero clear self Method on HEAP Clear self by setting its active length to zero clear configuration property property STRING Function configuration CONFIGURATION TABLE OBJECT Remove property in configuration and return the previous value Use the global system configuration table if configuration is NULL clear recycle list list RECYCLE LIST Function Reset list to its empty state clear recycle lists Function Reset all currently active recycle lists to their empty state clear system name STRING Function Clears out the system definition named name If name is null then clear out all system definitions This function is useful when changes have been made to the system definition and one wants to have it reloaded from the standard location in the file system clear trace Command Disable all tracing previously enabled with add trace clone memoized iterator self MEMOIZABLE ITERATOR Function ITERATOR OF LIKE ANY VALUE SELF Clone the memoized iterator self so it can be used to iterate over the collection represented by self while allowing to iterate over it multiple times via multiple clones clv code OBJECT OBJECT Macro Convenience macro to splice Lisp expressions into STELLA expressions without up setting the translator during interactive sessions If code is a currently bound Li
15. default true if true the system startup function will be called once all files have been loaded log level level OBJECT module STRING BOOLEAN Function Return TRUE if level is lower than or equal to the current log level of module Return FALSE if any of them are undefined log message module STRING logLevel OBJECT message CONS Function Log all elements of message to modules log stream if logLevel is the same or lower than the modules log level Interprets EOL or EOL to print a line terminator logmsg module srRING logLevel OBJECT amp rest message OBJECT Function Log all elements of message to modules log stream if logLevel is the same or lower than the modules log level Interprets EOL or EOL to print a line terminator lookup class name CLASS Method on SYMBOL Return a class with name name Scan all visible surrogates looking for one that has a class defined for it lookup class name CLASS Method on STRING Return a class with name name Scan all visible surrogates looking for one that has a class defined for it lookup command name SYMBOL METHOD SLOT Function If name names an evaluable command return its associated command object other wise return null Currently commands are not polymorphic i e they can only be implemented by functions lookup configuration property property STRING Function default Value WRAPPER configuration CONFIGURATION TABLE OBJECT
16. even x BOOLEAN Method on INTEGER Return true if x is an even number even x BOOLEAN Method on LONG INTEGER Return true if x is an even number exception message e NATIVE EXCEPTION STRING Function Accesses the error message of the exception e extension self CLASS EXTENSION Method on CLASS Return the nearest class extension that records instances of the class self external id head attribute OBJECT BOOLEAN Function Checks to see if this attribute is the literal marking either a PUBLIC or SYSTEM literal for an XML Elternal ID See 4 2 2 fast heap root self LIKE ANY VALUE SELF Method on HEAP Return the root of self which is assumed to be non empty fill in date substitution Function substitution list KEY VALUE LIST OF STRING WRAPPER STRING WRAPPER Fill in substitution list with template variable substitions for the names YEAR and DATE which correspond to the current year and date These substitutions can then be used with substitute template variables in string finalize classes Function Finalize all currently unfinalized classes finalize classes and slots Function Finalize all currently unfinalized classes and slots finalize slots Function Finalize all currently unfinalized slots find matching prefix length string1 STRING start1 INTEGER Function end1 INTEGER string2 STRING start2 INTEGER end2 INTEGER INTEGER Finds the length of the match
17. file name without extension file FILE NAME FILE NAME Function Remove files extension or type if there is any and return the result file extension file FILE NAME STRING Function Return files extension or type if it has any including the separator character file base name file FILE NAME FILE NAME Function Remove files directory including logical host and extension components and return the result absolute pathname pathname STRING BOOLEAN Function Not documented logical host host STRING BOOLEAN Function Not documented logical pathname pathname STRING BOOLEAN Function Not documented translate logical pathname pathname STRING STRING Function Not documented directory separator CHARACTER Function Not documented directory separator string STRING Function Not documented Chapter 6 Library Functions 69 6 17 Dates and Times get current date time INTEGER INTEGER INTEGER KEYWORD Function INTEGER INTEGER INTEGER INTEGER Returns the current time in UTC as multiple values of year month day day of week hour minute second millisecond Currently millisecond will always be zero even in Java where it is technically available get local time zone FLOAT Function Returns the current time zone offset from UTC as a float considering the effects of daylight savings time make current date time CALENDAR DATE Function Create a ca
18. self object OBJECT BOOLEAN Method on CONS Return true iff object is a member of the cons list self uses an eq1 test Chapter 6 Library Functions 38 memb self object OBJECT BOOLEAN Method on CONS Return true iff object is a member of the cons list self uses an eq test position self object OBJECT start INTEGER INTEGER Method on CONS Return the position of object within the cons list self counting from zero or return null if object does not occur within self uses an eq1 test If start was supplied as non null only consider the sublist starting at start however the returned position will always be relative to the entire list last position self object OBJECT end INTEGER INTEGER Method on CONS Return the position of object within the cons list self counting from zero or return null if object does not occur within self uses an eq1 test If start was supplied as non null only consider the sublist ending at end however the returned position will always be relative to the entire list reverse self LIKE SELF Method on cons Destructively reverse the members of the cons list self remove self value OBJECT LIKE SELF Method on CONS Destructively remove all entries in the cons list self that match value Unless the remaining list is nil insure that the cons that heads the list is unchanged remove duplicates self LIKE SELF Method on CONS Destructively rem
19. xij tmp stella 3 1 0 native lisp bin acl7 0 hello world startup system faslfl Fasl write complete Fast loading tmp stella 3 1 0 native lisp bin acl7 0 hello world startup system faslf CL T STELLA 4 After the system is loaded you can call its main function STELLA 10 main Hello World A Hello World B bye O STELLA 11 Using main in the Lisp version will not always make sense since you can call any function directly at the Lisp top level but both C and Java always need a main function as a top level entry point Chapter 4 Programming in STELLA 14 While this would be somewhat unusual you could also generate the Lisp translation using the C or Java version of STELLA The easiest way to do that is to run the stella script in the STELLA directory like this stella e make system hello world common lisp Running C version of STELLA Welcome to STELLA 3 4 0 Processing sources hello world file a ste Pass 1 generating objects Processing sources hello world file b ste Pass 1 generating objects Translating sources hello world file a ste to Common Lisp Writing native lisp hello world file a lisp Translating sources hello world startup system ste to Common Lisp Writing native lisp hello world startup system lisp The e command line option is used to evaluate an evaluable STELLA command Con veniently make sy
20. CHARACTER Function Return the capitalized character for ch This is generally the same as the uppercase character except for obscure non English characters in Java It should be used if only the first character of a sequence of characters is to be capitalized character to string c CHARACTER STRING Function Convert c into a one element string and return the result wrap character value CHARACTER CHARACTER WRAPPER Function Return a literal object whose value is the CHARACTER value unwrap character wrapper CHARACTER WRAPPER CHARACTER Function Unwrap wrapper and return the result Return NULL if wrapper is NULL 6 4 Strings string eql x STRING y STRING BOOLEAN Function Return true if x and y are equal strings or are both undefined This test is substituted automatically by the STELLA translator if eq1 is applied to strings string equal x STRING y STRING BOOLEAN Function Return true if x and y are equal strings ignoring character case or are both undefined empty x BOOLEAN Method on STRING Return true if x is the empty string non empty x BOOLEAN Method on STRING Return true if x is not the empty string Chapter 6 Library Functions 32 string compare x STRING y STRING case sensitive BOOLEAN Function INTEGER Compare x and y lexicographically and return 1 0 or 1 depending on whether x is less than equal or greater than y If case sensitive is true
21. Chapter 6 Library Functions 74 It is assumed that the xml expression is a well formed CONS list representation of an XML form It expects a form like that form returned by read XML expression Also handles a list of xml forms such as that returned by XML expressions In that case each of the forms is indented by indent spaces reset xml hash tables Function Resets Hashtables used for interning XML elements and global attribute objects This will allow garbage collection of no longer used objects but will also mean that newly parsed xml elements and global attributes will not be eq to already existing ones with the same name 6 19 Miscellaneous This is a catch all section for functions and methods that haven t been categorized yet into any of the previous sections They are in random order and many of them will never be part of the official STELLA interface So beware operating system KEYWORD Function Not documented 1d aref self i INTEGER LIKE Method on DIMENSIONAL ARRAY MIXIN ANY VALUE SELF Return the element of self at position i 1d aref address self i INTEGER Method on DIMENSIONAL ARRAY MIXIN INTEGER Return the 1D address of the element at position i This is useful for fast element wise iteration that doesn t need arithmetic ld aref setter self Method on DIMENSIONAL ARRAY MIXIN value LIKE ANY VALUE SELF i INTEGER LIKE ANY VALUE SELF Set the element of self at posi
22. EXISTS EXCEPTION is thrown with context supplying context for the error message ensure file exists filename STRING context STRING Function Ensures that filename exists If not an exception of type NO SUCH FILE EXCEPTION is thrown with context supplying context for the error message eql except in whitespace s1 STRING s2 STRING BOOLEAN Function Return true if the strings s1 and s2 are the same except for the amounts of whitespace separating words Leading or trailing whitespace is also not considered error amp body body coNs OBJECT Macro Signal error message placing non string arguments in quotes evaluate expression OBJECT OBJECT Function Evaluate the expression expression and return the result Currently only the evalu ation of possibly nested commands and global variables is supported The second return value indicates the actual type of the result which might have been wrapped and the third return value indicates whether an error occurred during the evaluation Chapter 6 Library Functions 86 Expressions are simple to program in Common Lisp since they are built into the language and relatively awkward in Java and C Users of either of those languages are more likely to want to call evaluate string evaluate string expression STRING OBJECT Function Evaluate the expression represented by expression and return the result This is equivalent to evaluate unstringify expression
23. Function Return true if form is a CONS headed by an XML PROCESSING INSTRUCTION tag xml processing instruction item OBJECT BOOLEAN Function Return true if item is an XML processing instruction object xml token list to s expression tokenList TOKENIZER TOKEN Function doctype XML DOCTYPE doctype definition BOOLEAN OBJECT Convert the XML tokenList using doctype for guidance into a representative s expression and return the result The doctype argument is currently only used for expansion of entity references It can be null The flag doctype definition should be true only when processing the DTD definition of a DOCTYPE tag since it enables substitution of parameter entity values Every XML tag is represented as a cons list starting with the tag as its header followed by a possibly empty list of keyword value pairs representing tag attributes followed by a possibly empty list of content expressions which might themselves be XML expressions For example the expression lt a al vl a2 v2 gt foo b a3 v3 gt bar lt a gt becomes lt a gt lt al gt yg lt a2 gt y2 foo lt b gt lt a3 gt yor bar when represented as an s expression The tag names are subtypes of XML OBJECT such as XML ELEMENT XML LOCAL ATTRIBUTE XML GLOBAL ATTRIBUTE etc 7 and prefixed tags are encoded as their own subtypes of XML OBJECT namely XML PROCESSING INSTRUCTION XML DECLARATION XML SPECIAL XML COMMENT
24. LIKE ANY VALUE SELF Method on ITERATOR Return a list of elements generated by self load configuration file file FILE NAME CONFIGURATION TABLE Function Read a configuration file and return its content as a configuration table Also enter each property read into the global system configuration table Assumes Java style property file syntax Each property name is represented as a wrapped string and each value as a wrapped string integer float or boolean load file file srRING Command Read STELLA commands from file and evaluate them The file should begin with an in module declaration that specifies the module within which all remaining com mands are to be evaluated The remaining commands are evaluated one by one ap plying the function evaluate to each of them load system systemName STRING Command amp rest language amp options OBJECT BOOLEAN Natively language compile out of date translated files of system systemName only supported for Lisp at the moment and then load them into the running system Return true if at least one file was compiled The following keyword value options are recognized language can be used as an alternative to the optional language argument If not specified the language of the running implementation is assumed Chapter 6 Library Functions 94 force recompilation default false if true files will be compiled whether or not their compilations are up to date startup
25. cc is a no op if the context reference cannot be successfully evaluated defmodule name NAME amp rest options OBJECT N Command Define or redefine a module named name The accepted syntax is defmodule module name documentation lt docstring gt includes lt module name gt lt module name gt uses lt module name gt lt module name gt EN lisp package lt package name string gt java package lt package specification string gt cpp namespace lt namespace name string gt java catchall class api TRUE FALSE case sensitive TRUE FALSE shadow symbol java catchall class lt class name string gt lt other options gt name can be a string or a symbol Modules include objects from other modules via two separate mechanisms 1 they inherit from their parents specified via the includes option and or a fully qualified module name and 2 they inherit from used modules specified via the uses option The main difference between the two mechanisms is that inheritance from parents is transitive while uses links are only followed one level deep I e a module A that uses B will see all objects of B and any of B s parents but not see anything from modules used by B Another difference is that only objects declared as public can be inherited via uses links this is not yet enforced Note that contrary to Lisp there are separate name spaces for c
26. etc CDATA is an XML SPECIAL tag with a name of CDATA The name is available using class accessors yield define stella class class CLASS CONS Function Return a cons tree that when evaluated constructs a Stella class object zero pad integer value INTEGER size INTEGER STRING Function Returns a string representing value of at least length size padded if necessary with 0 characters zero x BOOLEAN Method on INTEGER Return true if x is 0 zero x BOOLEAN Method on LONG INTEGER Return true if x is 0 Function Index Function Index Kadociebennezxgeuseduei e ud bbs X EROR Rp Rag 20 Hig prd icR DLbU beer eed ede hewn eed ied 27 MM cos Sadris S E de mecrsevree eu PE IE E LY gad nde 28 to at Bs Bee tS ara Gad can le ie leis ind eden Seaase ne ava bub 27 ML se hese ge ap ees See 28 V eae palace oe c Ud AD Ie IL ieee 28 lt Civi ERI P PURERGSET Rida Rede Yun 28 PE 28 E E SEENEN E x ent EAE Ede Ee e Seite 28 gt A EE A tu oh iue teles Anar A a eL 28 2 ES 28 D PER 28 d lenRbS6RPe TULERIT Mese 28 1d aref on DIMENSIONAL ARRAY MIXIN T4 id aref address on DIMENSIONAL ARRAY MIXIN IPTE T4 id aref setter on DIMENSIONAL ARRAY MIXIN T T4 2d aref on 2 DIMENSIONAL ARRAY MIXIN T4 2d aref address on 2 DIMENSIONAL ARRAY MIXIN cm T4 2d aref setter on 2 DIMENSIONAL ARRAY MIXIN Pana aaa a a E E E Sud aa ie aena TA 115 A abs On FLOAT opsagde arap haaa Peete
27. non matching position source STRING start INTEGER Function match STRING INTEGER Returns the index into source starting from start of the first character that is not included in match non matching position helper source STRING start INTEGER Function end INTEGER match STRING INTEGER Helper for non matching position that requires end to not be null nth self position INTEGER LIKE ANY VALUE Method on NATIVE VECTOR SELF Return the element in self at position null x BOOLEAN Method on LONG INTEGER Return true if x is undefined handled specially by all translators null x BOOLEAN Method on ARRAY Return true if x is undefined handled specially by all translators number less than x NUMBER WRAPPER y NUMBER WRAPPER Function BOOLEAN Generic number comparison that works with integers longs and floats Chapter 6 Library Functions 100 object equal x y OBJECT BOOLEAN Method on VECTOR SEQUENCE Return TRUE iff the sequences x and y are structurally equivalent Uses equal to test equality of elements odd x BOOLEAN Method on INTEGER Return true if x is an odd number odd x BOOLEAN Method on LONG INTEGER Return true if x is an odd number only if test OBJECT expression OBJECT OBJECT Macro If test is TRUE return the result of evaluating expression open network stream host STRING port INTEGER Function INPUT STREAM OUTPUT STREAM Op
28. olecceRREYRDwB4XGHDREGA 112 unwrap character e cg nre ro Eden 31 unwrap float 5 e fiie eR ERES 30 unwrap function code 00 112 MWnWHAp INbe Per seeds ieee ee bee 30 unwrap long integer cerere 112 unwrap method code ss esses eee 112 unwrap mutable string esses 35 unwrap String pepsine SEE Gd eee RR Es 35 upper case character sss 31 V value setter on ABSTRACT DICTIONARY ITERATOR 112 VECCOR E DERE EE 50 visible mod les 32 50122223 2 2 d wea at 65 visible surrogate ossis nens 61 visible symbol 2 e m e tbe cane 60 WALD godes aed id bibis uc qup shied Rip 112 When iobmsddccss EPEE SEDE DERE EAE DE e eee ee 8 white space character ess 31 with input file ys dick e RR ERR Lake Pe 67 with network stream sees sese 112 With output file oe geet ab and dn EE Pd 67 with permanent objects esses 112 with system definition 113 with transient objects 113 within Context ecesna m ux eed D ded eas 62 within module i224 9 RELIER ihe 65 within world 2 21 52 3 b pls desde equ 65 wrap boolean i ed qr nid eee dees 113 Wrap characte 22 2 i065 pr b EREURERTER 31 wrap float i es orasan ki eip a ded duces dle 30 vrap function codes osse iere esimi Re ber 113 124 Wrap iHteg r cog es eR du dst don hd 30 wrap integer value i oesase od 11
29. then case does matter for the comparison string lt x STRING y STRING BOOLEAN Function Return true if x is lexicographically lt y considering case string lt x STRING y STRING BOOLEAN Function Return true if x is lexicographically lt y considering case string gt x STRING y STRING BOOLEAN Function Return true if x is lexicographically gt y considering case string x STRING y STRING BOOLEAN Function Return true if x is lexicographically gt y considering case string less x STRING y STRING BOOLEAN Function Return true if x is lexicographically lt y ignoring case string less equal x STRING y STRING BOOLEAN Function Return true if x is lexicographically lt y ignoring case string greater equal x STRING y STRING BOOLEAN Function Return true if x is lexicographically gt y ignoring case string greater x STRING y STRING BOOLEAN Function Return true if x is lexicographically gt y ignoring case all upper case string s STRING BOOLEAN Function Return TRUE if all letters in s are upper case all lower case string s STRING BOOLEAN Function Return TRUE if all letters in s are lower case make string size INTEGER initchar CHARACTER STRING Function Return a new string filled with size initchars make mutable string size INTEGER initchar CHARACTER Function MUTABLE STRING Return a new mutable string fille
30. 116 elose ll fil 8 bs dis eater Rue xr 67 CLOSS SEXSAM sei5 assis hs ege or er tides aod ed 67 CU pr T9 code character ii ew e Lee ERA 30 coerce amp rest to cons eee eee sn 80 coerce to flo8t i eta gr Ea ees 80 coerce to hash 86t o ru e eb 80 Ccoerce t synbol cuius hp IS uhren 80 GOLLGO6t sno d E RP ELE eR acht Fui e pe as 80 collection valued on SLOT 80 COMMANA TO EN 80 component on STORAGE SLOT esses 80 compose namestring cece cence 80 compose namestring full 81 compute calendar date sss 70 compute day of week 2 sc00 snes eaten eee 70 compute day of week julian 70 compute julian day 2 oc iickcc e ee cates tae 70 compute module and bare name 81 compute next moon phase 70 concatenate ON CONS sees 38 concatenate On ITERATOR sese ee 59 concatenate On LIST i isse cece ene ned oe 44 concatenate On SET sees een 46 concatenate On STRING sees ees 34 CONG aep en EAR RECEIVER ee acd ds 9 configure stella i6 coll e ee pa 81 GODS Iu oer ed deat ke dus ice ale cadens Dando 37 CONS LIST bs etd cies Pede sk erede 39 cons tree mnabchT visi eisado iut Daas 40 cons tree nth i i debe erbe erise POPE 39 cons tree nth rest ii ci se br tiiin een 39 consify On CONS i2 nrusns de ced daca sau 40 consify On HASH SET aside RE RR eE geb ws 58 co
31. 3 1 0 native java hello world Startup Hello VOID STELLA 6 Alternatively you can generate the translation using the C or Java version of STELLA The easiest way to do that is to run the stella script in the STELLA directory like this stella e make system hello world java Running C version of STELLA Welcome to STELLA 3 4 0 Processing sources hello world file a ste Pass 1 generating objects Processing sources hello world file b ste Pass 1 generating objects Writing native java edu isi hello world HelloWorld java Writing native java edu isi hello_world StartupFileA java Writing native java edu isi hello_world StartupFileB java Chapter 4 Programming in STELLA 17 Writing native java edu isi hello_world StartupHelloWorldSystem java The e command line option is used to evaluate an evaluable STELLA command Con veniently make system is such a command so you can supply a make system form to the C or Java version of STELLA just as you would do in Lisp Note the extra quotes around the expression to protect the characters from interpretation by the Unix shell Different from Lisp neither of the above idioms will compile and load the generated C code Instead you have to use the Java compiler to compile and Java to run the compiled Java sources First change into the top level native Java directory native java and then compile and ru
32. 36 format with padding 2 04 87 fourth on CONS aor ERES Pau eG rd ed on fourth OM LIST 2m tenei Emea done E RaR 42 fourth on MUTABLE STRING esses 33 fourth onSTRING 2u 49er e 33 fourth on VECTOR 252 204 deep d 50 free on ACTIVE OBJECT ssese eese 87 free on OBJECT 2 2 o5 a0eeeg ic eve iRRRi3G enu 87 free hash table values on ABSTRACT HASH TABLE 87 fremo teeke wash des hada eae ae Re di i ese 87 ECU addo a tated ene bled E E Fri 29 generate random uuid 2 52 sede n 87 generate u uuid iose9e be ua tae adage d 88 PONS YM 2540s tele ug Deco eris QU a Ga dus oid 62 get calendar date on CALENDAR DATE 88 get current d te tim sess 69 118 get global valu iii2iien e abe her 88 get local standard time zone 88 get local time zone 2 sedan iori ep pans 69 get local time zone for date 88 get quoted tree i c isl esie und ERR 88 get slOt isi gea PERDS PEPEE RE e ER E 88 get stella class on STRING 88 get stella class on SURROGATE 88 get stella class on SYMBOL 88 get stella context 4 lee D IRL de lS 62 get stella module 2 2 acide teenie da 64 get ticktoCk 222220 Dad grob ped e saad 71 get time on CALENDAR DATE 89 et token f10at eerror scc anpii tenes 89 get token integer lisedcadagdhe ee seeds 89 get token long integer 89 get xml attri
33. BOOLEAN Function Return true if the STELLA feature is currently disabled Chapter 6 Library Functions 85 div x y INTEGER INTEGER Method on INTEGER Return the integer quotient from dividing x by y div x y LONG INTEGER LONG INTEGER Method on LONG INTEGER Return the integer quotient from dividing x by y drop hook hookList HOOK LIST hookFunction SYMBOL Function Remove the function named hookFunction from hookList drop trace amp rest keywords GENERALIZED SYMBOL LIST N Command Disable trace messages identified by any of the listed keywords After calling drop trace lt keyword gt code guarded by trace if keyword will not be executed when it is encountered either valuel OBJECT value2 OBJECT OBJECT Macro If valuel is defined return that else return value2 empty x BOOLEAN Method on STRING WRAPPER Return true if x is the wrapped empty string empty self BOOLEAN Method on VECTOR SEQUENCE Return true if self has length 0 empty self BOOLEAN Method on HEAP Return TRUE if self is empty enable memoization Command Enable memoization and use of memoized expression results enabled stella feature feature KEYWORD BOOLEAN Function Return true if the STELLA feature is currently enabled ensure file does not exist filename STRING context STRING Function Ensures that filename does not exist If it does an exception of type FILE ALREADY
34. Java s eql x OBJECT y OBJECT BOOLEAN Function Return true if x and y are eq or equivalent literals such as strings that also might be wrapped in non identical wrappers For the case where x or y are plain literals such as strings or integers the STELLA translator substitutes the equality test appropriate for the particular target language and does not actually call this function For cases where x or y are known to be of type STANDARD OBJECT the STELLA translator substitutes the faster eq test inline equal x OBJECT y OBJECT BOOLEAN Function Return true if x and y are eq1 or considered equal by a user defined object equal method This implements a fully extensible equality test similar to Java s equals method Note that writers of custom object equal methods must also implement 8 corresponding equal hash code method object equal x y OBJECT BOOLEAN Method on OBJECT Return true if x and y are eq object equal x y OBJECT BOOLEAN Method on WRAPPER Return true if x and y are literal wrappers whose literals are considered eq17 6 2 Numbers pi FLOAT Constant A float approximation of the mathematical constant pi amp rest arguments NUMBER NUMBER Function Return the sum of all arguments x NUMBER amp rest arguments NUMBER NUMBER Function If only x was supplied return the result of 0 x Otherwise return the result of x argl arg2 argN
35. Local variables are lexically scoped but dynamically scoped variables specials are also supported STELLA has an elegant uniform and efficient iteration mechanism plus a built in protocol for iterators An exception mechanism can be used for error handling and non local exits Symbolic programming Symbols are first class objects and extensive support for dy namic datatypes such as cons trees lists sets association lists hash tables extensible vectors etc is available A backquote mechanism facilitates macro writing and code gen eration Interpreted function call method call slot access and object creation is supported and a restricted evaluator is also available Chapter 3 The STELLA Language 8 Name spaces Functions methods variables and classes occupy separate name spaces i e the same name can be used for a function and a class A hierarchical module system compartmentalizes symbol tables and supports large scale programming Memory management STELLA relies on automatic memory management via a garbage collector For Lisp and Java the native garbage collector is used For the C version of STELLA we use the Boehm Weiser conservative garbage collector with good results Various built in support for explicit memory management is also available The Common Lisp features most prominently absent from STELLA are anonymous functions via lambda abstraction lexical closures multi methods full fledged eval a re stricte
36. STRING ls esee 63 destroy context on WORLD sese 65 destroy mod le teii fopra aain dete tose a 65 destructure defmethod tree 84 dictionary d4nbeIPPeRr beeches dt tees 84 difference on CONS rosd ibenia 41 difference on HASH SET 000 ee eee 59 difference on LIST i kets eee aces 45 digit Character ek ed daa xr dnd 30 direct super classes on CLASS 84 directory file name ci oe Rs 68 directory parent directory 68 directory separator ossis cciiekaaeseeeesans 68 117 directory separator string 68 disable memoization esses ss 84 disabled stella feature 84 Dh rr 28 diy on INTEGER oeeie arestesis ERE RR OR dores 85 div on LONG INTEGER lessen ene 85 drop hook 2 bk Re hSRREROPURU seperate 85 drop trace ec s EERTE EErEE EEA E EE S 85 E either Qaem a began epi Eads E d 85 empty On CONS totic tener head E Pe e ate 36 empty ON HEAP icio ei PERE PERET RETES 85 empty On ITERATOR cc rblcdeebeP a vues 59 empty on KEY VALUE LIST esee 48 empty on KEY VALUE MAP seen 5T empty Oh LIST wee PIG REQUE padre 42 empty on PROPERTY LIST eee 46 empty on STELLA HASH TABLE 54 empty on STRING u s eR c eI EEERESR 31 empty on STRING WRAPPER seee nnne 85 empty on VECTOR ee redor RET cee 49 empty on VECTOR SEQUENCE 85 enable
37. be treated as 10 integer valued x FLOAT BOOLEAN Function Returns true if x is the floating point representation of an integer intern stella name name STRING GENERALIZED SYMBOL Function Parse name which is assumed to be the printed representation of a STELLA symbol surrogate or keyword intern it into the current or specified module and return the result This is identical to calling unstringify on name but 10 15 times faster interpret command line arguments count INTEGER Function arguments ARRAY OF STRING Interpret any STELLA relevant command line arguments isa object OBJECT type TYPE BOOLEAN Function Return true iff object is an instance of the class named type java translate system systemName STRING Function Translate the system systemName to Java jptrans statement OBJECT N Command Translate statement to C and print the result keyword name name STRING BOOLEAN Function Return TRUE if name is prefixed by kvlist to plist self KEY VALUE LIST PROPERTY LIST OF LIKE Function ANY KEY SELF LIKE ANY VALUE SELF Convert self into a property list with identical and identically ordered keys and values last self LIKE ANY VALUE SELF Method on VECTOR SEQUENCE Return the last item in the vector self length self INTEGER Method on CONS ITERATOR Iterate over self and count how many items there are length self INTEGER Method on H
38. can generate duplicate entries for key remove entry self key LIKE ANY KEY SELF Method on KEY VALUE LIST value LIKE ANY VALUE SELF Remove the entry that matches lt key value gt Assumes that more than one entry can match key Chapter 6 Library Functions 49 push self value KV CONS Method on KEY VALUE LIST Make value be the new first element of self Note that the rest slot of value should be null since it will be overwritten This might duplicate an existing entry If a previous entry existed with the same key as value that entry is retained but shadowed by this new entry kv push self key LIKE ANY KEY SELF Method on KEY VALUE LIST value LIKE ANY VALUE SELF Add a new entry lt key value to the front of the association self This might duplicate an existing entry If a previous entry existed with key key that entry is retained but shadowed by this new entry pop self LIKE ANY VALUE SELF Method on KEY VALUE LIST Remove and return the value of the first element of the kv list self It does NOT return the KV CONS object Return null if the list is empty copy self LIKE SELF Method on KEY VALUE LIST Return a copy of the kv list self The kv conses in the copy are freshly allocated clear self Method on KEY VALUE LIST Make self an empty dictionary consify self CONS OF LIKE ANY VALUE SELF Method on KEY VALUE LIST Return a list of key value pai
39. can be different from the static type known at translation time Currently the static type of expression is required to be a subtype of OBJECT Each type expression has to be a symbol describing a simple type i e parametric or anchored types are not allowed Similar to case the special key otherwise can be used to catch everything It is a run time error if no clause with a matching type exists Therefore a STELLA typecase without an otherwise clause corresponds to a Common Lisp etypecase An empty otherwise clause can always be specified via otherwise NULL typecase does allow the value of expression to be undefined in which case the otherwise clause is selected Example typecase first list CONS print it is a cons SYMBOL KEYWORD print it is a symbol STANDARD OBJECT print it is a regular object otherwise NULL Note that in the example above it is important to list STANDARD OBJECT after SYMBOL and CONS since it subsumes the preceding types Otherwise it would always shadow the clauses with the more specific types The semantics of typecase is slightly extended for the case where expression is a local variable In that case each reference to the variable within a typecase clause is automatically casted to the appropriate narrower type For example in the code snippet below method calls such as first or slot accesses such as symbol name are translated correctly without needing to explicitly downcast x which
40. code for self Note that this is O N in the number of elements of self 6 12 Iterators empty self BOOLEAN Method on ITERATOR Return TRUE if the sequence represented by self has no elements Side effect free member self value OBJECT BOOLEAN Method on ITERATOR Iterate over values of self returning TRUE if one of them is eql to value length self INTEGER Method on ABSTRACT ITERATOR Iterate over self and count how many items there are Bad idea if self iterates over an infinite collection since in that case it will run forever pop self LIKE ANY VALUE SELF Method on ITERATOR Return the first item of the sequence represented by self or NULL if it is empty Destructively uses up the first iteration element advance self n INTEGER LIKE SELF Method on ITERATOR Return self after skipping over the first n elements in the remainder of the iteration concatenate iteratorl iterator2 ITERATOR Method on ITERATOR amp rest otherIterators ITERATOR ALL PURPOSE ITERATOR Return an iterator that first generates all values of iteratorl then those of iterator2 and then those of all otherIterators The generated values can be filtered by supplying a filter function to the resulting iterator Chapter 6 Library Functions 60 consify self CONS OF LIKE ANY VALUE SELF Method on ITERATOR Return a list of elements generated by self next self BOOLEAN Method on ALL PURPOSE ITERATOR
41. context reference cannot be successfully evaluated In CommonLisp if the new context is case sensitive then change the readtable case to INVERT otherwise to UPCASE cl slot value object OBJECT slotName STRING Function dontConvert BOOLEAN LISP CODE Lookup slot slotName on object and return the lispified slot value see lispify If dontConvert is TRUE the returned slot value will not be lispified Generate a warning if no such slot exists on object In a call directly from Lisp slotName can also be supplied as a Lisp symbol cl slot value setter object OBJECT slotName STRING Function value LISP CODE dontConvert BOOLEAN LISP CODE Lookup slot slotName on object and set its value to the stellafied value see stellafy If dontConvert is TRUE value will not be stellafied before it gets Chapter 6 Library Functions 79 assigned Generate a warning if no such slot exists on object or if value has the wrong type In a call directly from Lisp slotName can also be supplied as a Lisp symbol cl translate file file FILE NAME relative BOOLEAN Function Translate a Stella file to Common Lisp If relative concatenate root directory to file cl translate system system name STRING Function Translate a Stella system named system name to Common Lisp cleanup unfinalized classes Function Remove all finalized classes from UNFINALIZED CLASSES and set NEWLY UNFINALIZED CLASSES to false
42. copy of the vector self clear self Method on VECTOR Not documented resize vector self VECTOR size INTEGER Function Change the size of self to size If size is smaller than the current size of self the vector will be truncated Otherwise the internal array of self will be grown to size and unused elements will be initialized to NULL consify self CONS OF LIKE ANY VALUE SELF Method on VECTOR Return a list of elements in self insert at self offset INTEGER Method on EXTENSIBLE VECTOR value LIKE ANY VALUE SELF Not documented insert self value LIKE ANY VALUE SELF Method on VECTOR SEQUENCE Append value to the END of the sequence self Resize the array if necessary remove self value LIKE ANY VALUE SELF Method on VECTOR SEQUENCE VECTOR SEQUENCE Remove value from the sequence self and left shift the values after it to close the gap length self INTEGER Method on VECTOR SEQUENCE Not documented 6 9 Hash Tables HASH TABLE ABSTRACT HASH TABLE Class Not documented any key OBJECT Class Parameter of Not documented any value OBJECT Class Parameter of Not documented STRING HASH TABLE ABSTRACT HASH TABLE Class Not documented any key STRING Class Parameter of Not documented any value OBJECT Class Parameter of Not documented Chapter 6 Library Functions STRING TO INTEGER HASH TABLE ABSTRACT HASH TABLE Not documented an
43. fileName for input and return the resulting input stream By default signal an error if the file does not exist The only legal option so far is IF NOT EXISTS or IF NOT EXISTS ACTION which specifies what to do in case the file does not exist If its value is ERROR then an error will be signaled If it is ABORT or PROBE the opening operation will be aborted and NULL will be returned Chapter 6 Library Functions 67 open output file fileName STRING amp rest options KEYWORD Function FILE OUTPUT STREAM Open file fileName for output and return the resulting output stream By default the file will be created or overwritten if it already exists If IF EXISTS or IF EXISTS ACTION is one of the options its value specifies what to do in case the file already exists If the value is SUPERSEDE the pre existing file will be overwritten If the value is APPEND the preexisting file will be appended to if the file did not yet exist the file will simply be created If the value is ERROR then an error will be signaled If it is ABORT or PROBE the opening operation will be aborted and NULL will be returned If IF NOT EXISTS or IF NOT EXISTS ACTION is one of the options its value spec ifies what to do in case the file does not already exist If the value is CREATE the file will simply be created If the value is ERROR then an error will be signaled If it is ABORT or PROBE the opening operation will be aborted and NULL
44. gt lt value gt lt expression gt and have the status of an expression The following options are supported timestamps A single or list of keywords specifying the names of timestamps which when bumped should invalidate all entries currently memoized in this table name Names the memoization table so it can be shared by other memoization sites By default a gensymed name is used CAUTION IT IS ASSUMED THAT ALL EN TRIES IN A MEMOZATION TABLE DEPEND ON THE SAME NUMBER OF ARGUMENTS max values The maximum number of values to be memoized Only the max values most recently used values will be kept in the memoization table Chapter 6 Library Functions 98 older values will be discarded and recomputed if needed Without a max values specification the memoization table will grow indefinitely PERFORMANCE NOTES For most efficient lookup input arguments that vary the most should be listed first Also arguments of type STANDARD OBJECT and all its subtypes can be memoized more efficiently than arguments of type OBJECT or wrapped literals with the exception of BOOLEANSs merge file names baseFile FILE NAME defaults FILE NAME Function FILE NAME Parse baseFile supply any missing components from defaults if supplied and return the result merge null fields self Method on DECODED DATE TIME default DECODED DATE TIME Replace any null valued fields in self with values from default The day of the week will be set consi
45. in the number of entries of self allocate iterator self Method on STELLA HASH TABLE STELLA HASH TABLE ITERATOR OF LIKE ANY KEY SELF LIKE ANY VALUE SELF Allocate an iterator for self Hashing objects into STELLA hash tables is accomplished via hash code and equal hash code methods These methods are implemented for all built in STELLA types but are user extensible for cases where special functionality on user defined objects is needed Defining new hash code methods should only be necessary if new wrapper types are de fined since for all types descending from STANDARD OBJECT the built in method should be adequate object hash code self oBJECT INTEGER Function Return a hash code for self can be negative Two objects that are eq are guaran teed to generate the same hash code Two objects that are not eq do not necessarily generate different hash codes Similar to hash code but always hashes on the address of self even if it is a wrapper Chapter 6 Library Functions 55 hash code self INTEGER Method on OBJECT Return a hash code for self can be negative Two objects that are eq1 are guaran teed to generate the same hash code Two objects that are not eq1 do not necessarily generate different hash codes hash code self INTEGER Method on STANDARD OBJECT Not documented hash code self INTEGER Method on STRING WRAPPER Not documented hash code self INTEGER Method on INTEGER WRAPPER N
46. insert entry on KEY VALUE LIST 48 insert if better on HEAP sss 91 insert last on LIST eie e ee eed 43 insert last on SET sedem e eris 45 insert new on LIST oie ccs neige ore mh 43 insert String l ossa deerat ede ek s 35 instantiate string template 35 integer length d ner nb es 91 integer to hex sString orrir rereset ese 91 integer to string 000 30 35 integer to string in base 92 integer valued sisse dad acd 92 intern derived surrogate 61 intern derived sSymbol 2 2 eee ee 60 intern keywOorfd ez jh dans ha ante ISI 62 intern stella name sese ss 92 intern Surrogat 2 iac 0ER Rar 61 intern surrogate in module 61 intern symbol 2424 0021s pieke at Re 60 intern symbol in module 60 interpret command line arguments 92 intersection on CONS cece eee eee 41 119 intersection on HASH SET 05 59 intersection on LIST eese reias 45 DL T 92 J java translate system s 92 JPPraBS i di oDgcdaseedeeae d OR Ra RE ag dd 92 julian day to modified julian day TO K keyword name Ed ERST as 92 VA CONS espera atus qe a aT ak tha AT kv push on KEY VALUE LIST eee 49 kvilist to pLiSt c2 299 1212 0 eR ITE 92 L last On CONS s 2 ice bee cede cline cites eens UT US 37 l st On LIST
47. is symbol name cast x SYMBOL EOL Chapter 3 The STELLA Language 9 unless condition statement Statement Evaluate the boolean expression condition Only if the result is false execute the statement s in the body Therefore unless test is equivalent to when not test Example unless symbol x print x is not a symbol print hence its name is unknown EOL cond clause Statement cond is a conditional with an arbitrary number of conditions each represented by a clause Each cond clause has to be of the following form condition statement The first clause whose condition evaluates to true will be selected and its statement s will be executed Each clause can have 0 or more statements The special condition otherwise always evaluates to true and can be used for the catch all case Example cond symbol x print x is a symbol EOL Ccons x print x is a cons EOL otherwise print x is an object EOL choose condition true expression false expression Expression Evaluate the boolean expression condition If the result is true return the value of true expression otherwise return the value of false expression STELLA computes the most specific common supertype of true expression and false expression and uses that as the type returned by the choose expression If no such type exists a trans lation error will be signaled Example setq face choose happy smile frown
48. is assumed to be of type OBJECT typecase x CONS print it is a cons with value first x SYMBOL KEYWORD print it is a symbol with name symbol name x STANDARD OBJECT Chapter 3 The STELLA Language 11 print it is a regular object otherwise NULL Since the typecase expression has to be a subtype of OBJECT a typecase cannot be used to test against literal types such as STRING or INTEGER If such type names are encountered as keys in a typecase they are automatically converted to their wrapped version e g STRING WRAPPER INTEGER WRAPPER etc 3 4 Functions tbw To be written 3 5 Classes tbw To be written 3 6 Methods tbw To be written 3 7 Macros tbw To be written 3 8 Modules tbw To be written Chapter 4 Programming in STELLA 12 4 Programming in STELLA 4 1 Hello World in STELLA Included with the STELLA distribution is a simple Hello World application that shows you how to organize your own STELLA code and build a working STELLA application The sources for the Hello World system consist of the following files sources systems hello world system ste sources hello world file a ste sources hello world file b ste STELLA organizes code modules with a simple system facility Translation always op erates on a complete system so you always need to create a system definition for the STELLA files comprising your application somewhat similar to what you would put in a Un
49. lptrans cpptrans and jptrans are evaluable STELLA commands that can also be evaluated by the C and Java version of STELLA For example to generate a Java trans lation of a little STELLA code fragment you could run the stella script in the STELLA directory like this the output below has been additionally indented by hand for clarity stella e jptrans foreach element in list 1 2 3 N do print element EOL Running C version of STELLA Welcome to STELLA 3 4 0 Stella Object element null Cons iter001 Stella list Stella_Object cons IntegerWrapper wrapInteger 1 Stella_Object cons IntegerWrapper wrapInteger 2 Stella_Object cons IntegerWrapper wrapInteger 3 Stella NIL theConsList while iter001 Stella NIL i element iterOO1 value iterOO1 iterOO1 rest java lang System out println element 4 3 Performance Hints Here are a few things to watch out for once you get serious about the performance of your translated STELLA programs Safety checks The STELLA variable safety controls whether certain safety code is added to your translated STELLA program For Lisp translations it also controls whether cast s will be translated into run time type checks or not There is no run time type checking performed in C In Java native casts will always perform runtime type tests Chapter 4 Programming in STELLA 22 The default safety level is 3 which enables the translation of
50. memoization sess es s 85 enabled stella feature 85 encode calendar date on DECODED DATE TIME uM Sad wie E neue OR Re weed 69 ensure file does not exist 85 ensure file existS 2 ss kr ee eee e 85 eq aus sies ec q esu Utopia E 27 egl except in whitespace 85 Cop rM P 27 equal cons trees o pr RR n 36 equal hash code On CONS esses 3T equal hash code on HASH SET 59 equal hash code on KEY VALUE LIST 48 equal hash code on KEY VALUE MAP 5T equal hash code On LIST seeeess 42 equal hash code on OBJECT sess 55 equal hash code on PROPERTY LIST 46 equal hash code On SET sees 46 equal hash code on STELLA HASH TABLE 54 equal hash code on VECTOR esses 50 equal zsiereesesbesdadoaabePeg dodi eek 27 equivalent sets on CONS sss A1 equivalent sets on HASH SET 58 equivalent sets on LIST sees 45 s ETT 85 evaluate idu coe FURIA IER 85 ey luate string i22d e pure decade 86 uu PT 28 eyen on INTEGER occ essaie eget 86 even on LONG INTEGER sse 86 exception mesSage i 4o gage RE be 86 OXDiciiewdaguesse eI nada dhar e nue BPA kiio 29 Zp es iorotan irena aida iaa i paid ii BEE israp 29 extension On CLASS seen eanas 86 Function Index external id head 2 sso ssa b r
51. milliseconds for the calendar date date in timezone timezone is the number of hours added to UTC to get local time It is in the range 12 0 to 14 0 where UTC is zone 0 0 get token float OBJECT Macro User level macro to access the most recently parsed token as a float This assumes correct signed float syntax and only checks for overflows The main benefit for this is that it doesn t generate strings and wrappers Float parsing and conversion is generally hairy and we are probably not covering all special cases here but we are fast get token integer oBJECT Macro User level macro to access the most recently parsed token as an integer This assumes correct signed integer syntax and only checks for overflows get token long integer oBJECT Macro User level macro to access the most recently parsed token as a long integer This assumes correct signed long integer syntax and only checks for overflows global variable type spec global GLOBAL VARIABLE TYPE SPEC Function Return the type spec for the global variable global hash string string STRING seedCode INTEGER INTEGER Function Generate a hash code for string and return it Two strings that are equal but not eq will generate the same code The hash code is based on seedCode which usually will be 0 However seedCode can also be used to supply the result of a previous hash operation to achieve hashing on sequences of strings without actually having to concat
52. removing elements from self that also occur in otherList Uses an eq1 test and a simple quadratic time algorithm Note that the result is only guaranteed to be a set if self is a set SET is a subclass of LIST that overrides certain LIST operations to prevent duplicate elements The following additional or modified operations are supported SET LIST SET MIXIN Class Not documented any value OBJECT Class Parameter of Not documented insert self value LIKE ANY VALUE SELF Method on SET Add value to the set self unless it is already a member push self value LIKE ANY VALUE SELF Method on SET Add value to the front of set self unless it is already a member insert last self value LIKE ANY VALUE SELF Method on SET Add value to the end of set self unless it is already a member substitute self new OBJECT old OBJECT LIKE SELF Method on SET Destructively replace old with new in the set self unless new is already a member Chapter 6 Library Functions 46 concatenate setl set2 LIST amp rest otherSets LIST SET Method on SET Union set2 and all otherSets onto the end of seti The operation is destructive wrt setl but leaves all other sets intact The two mandatory parameters allow us to optimize the common binary case by not relying on the somewhat less efficient variable arguments mechanism object equal x y OBJECT BOOLEAN Method on SET Return TRUE iff x and y are SET
53. s into a regular string with the same content In Lisp and C this is a no op integer to string i LONG INTEGER STRING Function Convert i to its string representation and return the result This is more efficient than using a string stream string to integer string STRING LONG INTEGER Function Convert a string representation of an integer into an integer float to string f FLOAT STRING Function Convert f to its string representation and return the result This is more efficient than using a string stream string to float string STRING FLOAT Function Convert a string representation of a float into a float Chapter 6 Library Functions 36 format float f FLOAT nDecimals INTEGER STRING Function Print f in fixed point format with nDecimals behind the decimal point and return the result as a string character to string c CHARACTER STRING Function Convert c into a one element string and return the result stringify expression OBJECT STRING Function Print expression onto a string and return the result Printing is done with printReadably set to true and with printPretty set to false stringify in module tree OBJECT module MODULE STRING Function Stringify a parse tree relative to module or module if no module is specified unstringify string STRING OBJECT Function Read a STELLA expression from string and return the result This is identical to read s expre
54. s with equivalent members Uses equal to test equality of elements This is more general than equivalent sets since that only uses an eql test equal hash code self INTEGER Method on SET Return an equal hash code for self Note that this is O N in the number of elements of self set amp rest values OBJECT SET Function Return a set containing values in order 6 7 Property and Key Value Lists PROPERTY LIST DICTIONARY Class Not documented any key OBJECT Class Parameter of Not documented any value OBJECT Class Parameter of Not documented the plist cows Slot of Not documented empty self BOOLEAN Method on PROPERTY LIST Not documented non empty self BOOLEAN Method on PROPERTY LIST Not documented object equal x y OBJECT BOOLEAN Method on PROPERTY LIST Return TRUE if x and y represent the same set of key value pairs equal hash code self INTEGER Method on PROPERTY LIST Return an equal hash code for self Note that this is O N in the number of entries of self length self INTEGER Method on PROPERTY LIST Not documented lookup self key LIKE ANY KEY SELF LIKE Method on PROPERTY LIST ANY VALUE SELF Not documented Chapter 6 Library Functions 47 insert at self key LIKE ANY KEY SELF Method on PROPERTY LIST value LIKE ANY VALUE SELF Insert the entry lt key value gt into the property list self If a pre
55. store the new predicate in self and then sort the heap Note that a sorted array automatically satisfies the heap property This is slightly different than a regu lar heap sort due to the way HEAP s are maintained however the complexity is the same split string input STRING separator CHARACTER CONS OF Function STRING WRAPPER Split input into separate strings based on the separator character start function call logging fileName STRING Command Start function call logging to fileName Chapter 6 Library Functions 107 starts with string STRING prefix STRING start INTEGER Function BOOLEAN Return TRUE if string starts with prefix starting from start which defaults to 0 if it is supplied as NULL stella collection self OBJECT BOOLEAN Function Return true if self is a native collection stella information STRING Command Returns information about the current Stella implementation Useful when reporting problems stella object self OBJECT BOOLEAN Function Return true if self is a member of the STELLA class OBJECT stella version string STRING Function Return a string identifying the current version of STELLA stellafy thing LISP CODE targetType TYPE OBJECT Function Partial inverse to lispify Convert the Lisp object thing into a Stella analogue of type targetType Note See also stellify it is similar but guesses target Type on its own and makes somewhat
56. than what can be repre sented by a STELLA integer copy file fromFile FILE NAME toFile FILE NAME Function Copy file fromFile to file toFile clobbering any data already in toFile delete file fileName FILE NAME Function Delete the file fileName Chapter 6 Library Functions 68 directory file name directory FILE NAME FILE NAME Function Return directory as a file name i e without a terminating directory separator directory parent directory directory FILE NAME level INTEGER Function FILE NAME Return the leve th parent directory component of directory including the final direc tory separator or the empty string if directory does not have that many parents file name as directory file FILE NAME FILE NAME Function Return file interpreted as a directory i e with a terminating directory separator If file is the empty string simply return the empty string i e interpret it as the current directory instead of the root directory file name directory file FILE NAME FILE NAME Function Return the directory component of file including the final directory separator or the empty string if file does not include a directory Note that for purposes of this function a logical host is considered part of the directory portion of file file name without directory file FILE NAME FILE NAME Function Return the file name portion of file by removing any directory and logical host com ponents
57. top stream OUTPUT STREAM Method on OBJECT current depth INTEGER depth INTEGER named BOOLEAN Helper method for print outline help print outline top stream OUTPUT STREAM Method on sLoT current depth INTEGER depth INTEGER named BOOLEAN Helper method for print outline help print outline top stream OUTPUT STREAM Method on CONTEXT current depth INTEGER depth INTEGER named BOOLEAN Helper method for print outline home module self MODULE Method on OBJECT Return the home module of self if output language language KEYWORD thenForm OBJECT Macro elseForm OBJECT OBJECT Expand to thenForm if the current translator output language equals language Oth erwise expand to elseForm This can be used to conditionally translate Stella code if stella feature feature KEYWORD thenForm OBJECT Macro elseForm OBJECT OBJECT Expand to thenForm if feature is a currently enabled STELLA environment feature Otherwise expand to elseForm This can be used to conditionally translate Stella code ignore amp body variables CONS OBJECT Macro Ignore unused variables with NoOp setq statements incrementally translate tree OBJECT OBJECT Function Translate a single Stella expression tree and return the result For C and Java print the translation to standard output and return NIL instead indent outline current depth INTEGER stream OUTPUT STREAM Function Helper functio
58. unwind protected form which opens a network socket stream to a host and port for input and output and closes it afterwards Separate variables as provided in the call are bound to the input and output streams Syntax is WITH NETWORK STREAM varIn varOut hostname port body with permanent objects amp body body CONS OBJECT Macro Allocate permanent as opposed to transient objects within the scope of this dec laration Chapter 6 Library Functions 113 with system definition systemnameexpression OBJECT Macro amp body body CONS oBJECT Set currentSystemDefinition to the system definition named system Set cur rentSystemDefinitionSubdirectory to match Execute body within that scope with transient objects amp body body coNs OBJECT Macro Allocate transient as opposed to permanent objects within the scope of this dec laration CAUTION The default assumption is the allocation of permanent objects The scope of with transient objects should be as small as possible and the user has to make sure that code that wasn t explicitly written to account for transient objects will continue to work correctly wrap boolean value BOOLEAN BOOLEAN WRAPPER Function Return a literal object whose value is the BOOLEAN value wrap function code value FUNCTION CODE Function FUNCTION CODE WRAPPER Return a literal object whose value is the FUNCTION CODE value wrap integer value value LONG INTEGER NUMBER
59. will be returned close stream self STREAM Function Close the stream self close all files Function Close all currently open file streams Use for emergencies or for cleanup with input file binding CONS amp body body CONS oBJECT Macro Sets up an unwind protected form which opens a file for input and closes it afterwards The stream for reading is bound to the variable provided in the macro form Syntax is WITH INPUT FILE var filename options body where options can be any that are legal for open input file which see with output file binding CONS amp body body coNs OBJECT Macro Sets up an unwind protected form which opens a file for output and closes it afterwards The stream for writing is bound to the variable provided in the macro form Syntax is WITH OUTPUT FILE var filename options body where options can be any that are legal for open output file which see probe file fileName FILE NAME BOOLEAN Function Return true if file fileName exists Note that this does not necessarily mean that the file can also be read file write date fileName FILE NAME CALENDAR DATE Function Return the time at which file fileName was last modified or NULL if that cannot be determined file length fileName FILE NAME LONG INTEGER Function Return the length of file fileName in bytes or NULL if that cannot be determined Note that this will currently overrun for files that are longer
60. 0 translate to common lisp 110 translate to Cpp ooexedemeeiet enmt 110 translate to java s ive breeds 111 LIrO6 8JZ0 1 925 2192498 89e 03 dete e Edited ne 39 gp E 26 truncate 66 because deere ER ESERE 111 try to evaluate 22 21 28 B9 BI d E RH 111 two argument least common superclass 111 two argument least common supertype bi type on SUOT i meae ede er mbEREE TP iG 111 type specifier on SLOT esses E type to symbol 240 erae RS 111 type to wrapped type on SURROGATE ER Ey peca Sei nenori d ke reseeerdccc uh eregbresb 10 U unbound surrogateS lesse idat 111 unbumnp log indent ls memes ee 111 unescape html string esses 114 unescape url string sss esss ses TII unintern sSUrrog te oces aetti epa n eg 61 unintern symb l esri ostaen 60 union on CONG seit sce tcai de uin erena ib ES 41 union on HASH SET 0 eee eee cece eee ee 59 Function Index UNION on MST sesers asotea de eb Hee cease enna es 45 GALOS Saaai ii paa chad eee bu ere RP Yes 9 thread characte reisrerpi beanii t awaria Ee os 66 unset stella feature 0 005 111 unsigned shift right by 1 on INTEGER 112 unsigned shift right by 1 on LONG INTEGER sin bb und Chose ee eoe bee ee duse ped 112 unstringlfy oo ieee ead ge gode eee RE ERa i 36 unstringify in module 36 unstringify stella source 112 unwrap b ol an
61. 05 Stella list Stella_Object cons IntegerWrapper wrapInteger 1 Stella_Object cons IntegerWrapper wrapInteger 2 Stella_Object cons Chapter 4 Programming in STELLA 20 IntegerWrapper wrapInteger 3 Stella NIL theConsList while iter005 Stella NIL 1 element iter005 value iter005 iter005 rest java lang System out println element h VOID The use of lptrans is really necessary here since there is no Lisp macro foreach that knows how to translate STELLA foreach loops those Lisp macros only exist for top level definition commands such as defun In order to translate such code fragments without error messages they need to be self contained i e all referenced variables have to be either bound by a surrounding let or they must be globally defined variables Otherwise the STELLA translator will generate various undefined variable error messages You can use the STELLA Lisp macro eval i e stella eval not CL eval to actually execute such a code fragment For example STELLA 11 eval foreach element in list 1 2 3 do print element EOL IL 1 ILI2 ILI3 O This translates the loop and executes the result which prints the wrapped numbers hence the L prefix to standard output The at the end is the resulting Lisp value returned by the loop in Lisp everything returns a value even though for STELLA foreach is a statement not an expression Make it a habit to wrap eval a
62. 2 onto the front of the list self The operation is destructive wrt self but leaves list2 intact copy self LIST OF LIKE ANY VALUE SELF Method on LIST Return a copy of the list self The conses in the copy are freshly allocated clear self Method on LIST Make self an empty list consify self CONS OF LIKE ANY VALUE SELF Method on LIST Return a list of elements in self allocate iterator self LIST ITERATOR OF LIKE ANY VALUE Method on LIST SELF Not documented next self BOOLEAN Method on LIST ITERATOR Not documented sort self predicate FUNCTION CODE LIST OF LIKE Method on LIST ANY VALUE SELF Perform a stable destructive sort of self according to predicate and return the result If predicate has a lt semantics the result will be in ascending order If predicate is NULL a suitable lt predicate is chosen depending on the first element of self and it is assumed that all elements of self have the same type supported element types are GENERALIZED SYMBOL STRING INTEGER and FLOAT map null to nil list self LIST LIST Function Return NIL LIST iff self is NULL or self otherwise 6 6 1 Lists as Sets Similar to CONS lists LIST s can also be treated as sets and support the set manipula tions below Note that LIST constructors do not check for proper set hood and may have surprising results if a list contains duplicate elements Chapter 6 Library Functions 45
63. 3 wrap long integer cc beg eau 113 wrap method code icilef ee ae s 113 wrap mutable string sees esse 35 Wrap String l s4vxgodereepx aere Ded ekia 35 wrapped type to type esses 113 wrapper value type i2 RR 4 eee 113 write html escaping url special characters PUT 113 writer on STORAGE SLOT sees 113 X xml attribute match on XML ATTRIBUTE 72 xml attribute match on XML GLOBAL ATTRIBUTE lessen 72 xml attribute match on XML LOCAL ATTRIBUTE m 72 xml attribute f ielss aes reper Yon dedd T2 xml cd t form 1 22 2 2 PEE RNESR 72 xml cdat 2 cs argh epee 20 0 hea hb a a Beals 72 xml declaration form 113 xml declaration 5 44 222 0 waa nb es 72 smi doctype form ois sac guo cadences 113 xml element form esses 114 xml element match on XML ELEMENT re xml element 0 2 12 94 eked Reed Ee 72 xml expressjOnS o 262680 2 8 9 eb eet T3 xml local attribute match 73 xml lookup attribute6 oneeebeoun cde d T3 xml processing instruction form 114 xml processing instruction 114 SM tag Case acti sea 49 a aE T3 xml token list to s expression 114 y 0E nfcsosdedimoagusiteeranferdfs hoes E EE 66 yes oOr noT cles asd bre pr ERR pp 66 yield define stella class 114 Z zero pad integer sels 114 ZrO T aeaiee Se parias Rue AUC Bac
64. AT FLOAT WRAPPER Function Return a literal object whose value is the FLOAT value unwrap float wrapper FLOAT WRAPPER FLOAT Function Unwrap wrapper and return the result Return NULL if wrapper is NULL 6 3 Characters character code ch CHARACTER INTEGER Function Return the 8 bit ASCII code of ch as an integer code character code INTEGER CHARACTER Function Return the character encoded by code 0 lt code lt 255 digit character ch CHARACTER BOOLEAN Function Return TRUE if ch represents a digit Chapter 6 Library Functions 31 letter character ch CHARACTER BOOLEAN Function Return TRUE if ch represents a letter upper case character ch CHARACTER BOOLEAN Function Return TRUE if ch represents an upper case character lower case character ch CHARACTER BOOLEAN Function Return TRUE if ch represents a lower case character white space character ch CHARACTER BOOLEAN Function Return TRUE if ch is a white space character character downcase ch CHARACTER CHARACTER Function If ch is lowercase return its uppercase version otherwise return ch unmodified character upcase ch CHARACTER CHARACTER Function If ch is uppercase return its lowercase version otherwise return ch unmodified If only the first character of a sequence of characters is to be capitalized character capitalize should be used instead character capitalize ch CHARACTER
65. CONS OBJECT Define a demon name and attach it to a class or slot define demon name STRING amp rest options OBJECT DEMON Function Define a class or slot demon Options are create destroy class slot guard code method inherit and documentation Chapter 6 Library Functions 83 define logical host property host STRING property KEYWORD Function value OBJECT Define property with value for the logical host host As a side effect this also defines host as a logical host both property and value can be supplied as NULL If ROOT DIRECTORY is specified all pathnames with host are assumed to be relative to that directory even if they are absolute and will be rerooted upon translation ROOT DIRECTORY can be a logical or physical pathname If LISP TRANSLATIONS is specified those will be used verbatimely as the value of CL 1ogical pathname translations host if we are running in Lisp which allows us to depend on the native CL translate logical pathname for more complex translation operations define module name STRING options CONS MODULE Function Define or redefine a module named name having the options options Return the new module define stella class name TYPE supers LIST OF TYPE Function slots LIST OF SLOT options KEYWORD KEY VALUE LIST CLASS Return a Stella class with name name Caution If the class already exists the Stella class object gets redefined but the
66. EAP Return the length of the currently filled portion of self length self INTEGER Method on DIMENSIONAL ARRAY MIXIN Return the total number of elements in self length self INTEGER Method on 2 DIMENSIONAL ARRAY MIXIN Return the total number of elements in self Chapter 6 Library Functions 93 lispify thing UNKNOWN LISP CODE Function Convert a Stella thing as much as possible into a Common Lisp analogue The cur rently supported thing types are CONS LIST KEY VALUE LIST ITERATOR SYMBOL KEYWORD and all wrapped and unwrapped literal types BOOLEANs are translated into Lisp s CL T and CL NIL logic Unsupported types are left un changed lispify boolean thing UNKNOWN LISP CODE Function Lispify thing which is assumed to be a possibly wrapped Stella boolean list modules kb only BOOLEAN CONS OF MODULE Command Returns a cons of all modules defined in PowerLoom If kb only is true then any modules which are code only or just namespaces are not returned listify self LIST OF LIKE ANY VALUE SELF Method on CONS Return a list of elements in self listify self LIST OF LIKE ANY VALUE SELF Method on LIST Return self listify self LIST OF LIKE ANY VALUE SELF Method on KEY VALUE LIST Return a list of key value pairs in self listify self LIST OF LIKE ANY VALUE SELF Method on VECTOR Return a list of elements in self listify self LIST OF
67. EY GER ea ane Hard 63 COC od ver pr IS CSE I ges eRe peas 78 COMIN Hest aes pees Wits ae eee tee 29 change context on CONTEXT 63 change context On STRING se esses 63 change module on MODULE 44 65 change module on STRING essere 65 character capijtalize c 9 4e 31 character cod vices o e rete ete res 30 character downcase riit teresas 31 charact r to string mas 31 36 character u pcasG con e pu e A RS 3l CHOOSE iii ii db pa ex RR RET RE RUE S dur dU 9 cl slot valu6 2ee re wb er a hp Rueda 78 cl slot value setter 000000 78 cl translate filG6 i e o re OE Rege 79 clI translate system e ose pe ens 79 cleanup unfinalized classes 79 Clear On HEAP 2 bild ers eR ERE ever uds 19 clear on KEY VALUE LIST esee 49 clear on KEY VALUE MAP l l sese 57 CIear onLISTiceieix Med ete see Sees a 44 clear on PROPERTY LIST 2 00 6s bese eee n 4T clear on STELLA HASH TABLE 4 54 clear on VEOTOR e6seseeiessteewadpE e dunes 51 clear on VECTOR SEQUENCE sse eee 79 clear configuration property 79 clear Context esed irosun erem ere 62 clear module emac det RES penni 65 clear recycle 118t 2s hd Re bes 19 clear recycle li8t8 usn dae seeds ges 19 Clear syStem i senii a bet e 19 clear trace ase cease ene Reb ERRAT ERE 79 clone memoized iterator 79
68. Function Not documented cons tree nth tree CONS amp rest index INTEGER OBJECT Function Access an arbitrary element of tree identified by a path specified as a list of index values The first index specifies the index th element of tree the second index the index th subelement of that element etc Example cons tree nth quote a b cde f g 112 gt e cons tree nth rest tree CONS amp rest index INTEGER CONS Function Access an arbitrary sublist of tree identified by a path specified as a list of index values The first index specifies the index th element of tree the second index the index th subelement of that element the last index specifies the nth rest of the previous element different from cons tree nth Example cons tree nth rest quote a b cd e f g 11 1 gt d e Chapter 6 Library Functions 40 match cons tree tree OBJECT pattern OBJECT Function bindings KEY VALUE LIST KEY VALUE LIST Match pattern against tree and return a list of variable bindings if they match or NULL otherwise bindings can be NULL or an initial list of bindings to consider Pattern variables use KIF syntax i e they need to start with a character A single question mark is interpreted as the anonymous variable Example match cons tree quote a b ad e ad f g quote a x y y g NULL gt kv Y A D gt lt X B gt Variables can t be quoted but quoting can effec
69. Function into hookList add trace amp rest keywords GENERALIZED SYMBOL LIST N Command Enable trace messages identified by any of the listed keywords After calling add trace lt keyword gt code guarded by trace if lt keyword gt will be executed when it is encountered advance past whitespace source STRING start INTEGER Function INTEGER Returns the first index into source starting from start of the first character that is not white space all classes module MODULE local BOOLEAN ITERATOR OF CLASS Function Iterate over all classes visible from module If local return only classes interned in module If module is null return all classes interned everywhere all contexts ITERATOR OF CONTEXT Function Return an iterator that generates all contexts all defined amp body forms CONS OBJECT Macro Evaluate each of the forms in forms and return TRUE if none of them are NULL all functions module MODULE local BOOLEAN ITERATOR OF Function FUNCTION Iterate over all functions visible from module If local return only functions bound to symbols interned in module If module is null return all functions defined everywhere all included modules self MODULE ITERATOR OF MODULE Function Generate a sequence of all modules included by self inclusive starting from the highest ancestor and working down to self which is last all methods module MODULE local BOOLEAN
70. Functions 62 safe import surrogate surrogate SURROGATE module MODULE Function SURROGATE Safe version of import surrogate which see Only imports surrogate if no surrogate with that name is currently interned or visible in module Returns surrogate if it was imported or the conflicting surrogate in module otherwise lookup keyword name STRING KEYWORD Function Return the keyword with name if it exists intern keyword name STRING KEYWORD Function Return a newly created or existing keyword with name name Storage note a COPY of name is stored in the keyword gensym prefix STRING SYMBOL Function Return a transient symbol with a name beginning with prefix and ending with a globally gensym d integer local gensym prefix STRING SYMBOL Function Not documented symbol plist symbol SYMBOL CONS Function Return the property list of symbol The symbol plist of a symbol can be set with setf IMPORTANT Property list are modified destructively hence if you supply it as a whole make sure to always supply a modfiable copy e g by using bquote symbol property symbol SYMBOL key STANDARD OBJECT Function OBJECT Return the property of symbol whose key is eq to key Symbol properties can be set with setf symbol value symbol SYMBOL OBJECT Function Return the value of symbol Note that this value is not visible to code that references a variable with the same name as symbol The sy
71. H TABLE non empty on STRING ass ser ar rena non empty on STRING WRAPPER non empty on VECTOR sss rmn non empty on VECTOR SEQUENCE 120 98 36 Function Index non matching position 99 non matching position helper 99 nth on CONS ec Leer REG S REOR adhd cae eal On nth on LIST 4a nca aad ebat RE dE doy bane 42 nth on MUTABLE STRING sese 33 nth on NATIVE VECTOR 00cceeeeeeees 99 nth On STRING 52 2242322 22 eR ne aaa Rao pu hu 33 nth on VECTOR ceros vse cedi EAE deb 50 nth rest on CONS is wicca re sane a ber eee on null li8t 4 5 2 2 24 p E Eua ect nes dE oe 42 null On BRRAY sedent pii Peg oS EE LR 99 null on OHARAGCTERN 22232244 4d ere kuderw eriek 26 null OnoOQODE s 3 2 nre Epp US dani 26 null on FLOWT 55i 6E be tea kb EE 26 null on INTEGER 25352222 p ur LR cad 26 null on LONG INTEGER sees 99 null on MUTABLE STRING sees 26 null on NATIVE VECTOR lese 26 pull on OBJYECT 2 22b ores Ree 26 null on SECOND CLASS OBJECT s 26 null on STRING 22 2222 dalek Pee aed Seopa 26 number less than lees 99 O object equal n CONS cine eere 37 object equal on HASH SET 59 object equal on KEY VALUE LIST 48 object equal on KEY VALUE MAP 57 object equal om LIST eae bs ete mee 42 object equal on OBJET ss
72. LIST aerer 2d pi e eibi se aos 44 sort on VECTOR cece cece ieri eee 106 sort t ples On CONS ic ec edn ge bee eee 40 SPLTCHStra ng orce ct ead ce tne ns ees cee ae 106 Cp ced hare ee sae alee Ste a 29 start function call logging 106 Starts with dies e bLeree dete es 107 stella collection 2 49 m gne 107 stella informati n 36e beb eds bae 107 Stella o bject iie s agp Suas 107 stella version string 107 Stellafy ceci d ifie oboe bets 107 Stellify 2 ics tecabe t Dies edet oue 107 stop function call logging 107 stream position on INPUT FILE STREAM 107 Function Index stream position on OUTPUT FILE STREAM 107 stream position setter on INPUT FILE STREAM UnY su uc eR OCPRISUP DE ERN TOR BREEI EG e 107 stream position setter on OUTPUT FILE STREAM 0 e nnne 107 stream to string on INPUT STREAM 107 String capitaliz8 2 04 9 aa nna irasas 34 String compare oc de dern ree aad 32 string downt se i e dele aan eed eb S 34 String qlf uikiisessbema 4e nee s Rede 31 sString equal 4 2i e bru a nade ed 31 string greater qual olsssss se doa 32 string greater 2 2 3 emia tias is 32 String less equal lco cerreresrereroneep isu 32 String lesSsT wpeprbi rar resiti niant 32 String SearCh esr irienn reniri Bea gus 34 string to calendar date ss 69 string to calendar date with default 108 s
73. Lookup property in configuration and return its value Use the global system configu ration table if configuration is NULL Return default Value if property is not defined lookup configuration property values property STRING Function default Value OBJECT configuration CONFIGURATION TABLE CONS Lookup property in configuration assume it is a multi valued property and return its value s as a list Use the global system configuration table if configuration is NULL Return default Value if property is not defined or NIL is no default value is specified lookup demon name STRING DEMON Function Return the demon named name lookup function functionSymbol SYMBOL FUNCTION Function Return the function defined for functionSymbol if it exists lookup function by name name STRING FUNCTION Function Return a function with name name visible from the current module Scan all visible symbols looking for one that has a function defined for it Chapter 6 Library Functions 95 lookup global variable self GLOBAL VARIABLE Method on SURROGATE Return a global variable with name self lookup global variable self Method on GENERALIZED SYMBOL GLOBAL VARIABLE Return a global variable with name self lookup global variable self GLOBAL VARIABLE Method on STRING Return a global variable with name self lookup local slot class CLASS slot name SYMBOL SLOT Function Lookup a local slot with slot name o
74. NTEGER Method on LIST Return an equal hash code for self Note that this is O N in the number of elements of self list amp rest values OBJECT LIST Return a list containing values in order first self LIKE ANY VALUE SELF Return the first item in the list self or NULL if empty second self LIKE ANY VALUE SELF Return the second item in the list self or NULL if empty third self LIKE ANY VALUE SELF Return the third item in the list self or NULL if empty fourth self LIKE ANY VALUE SELF Return the fourth item in the list self or NULL if empty fifth self LIKE ANY VALUE SELF Return the fifth item in the list self or NULL if empty nth self position INTEGER LIKE ANY VALUE SELF Return the nth item in the list self or NULL if empty rest self CONS OF LIKE ANY VALUE SELF Return a cons list of all but the first item in the list self last self LIKE ANY VALUE SELF Return the last element of self but last self ITERATOR OF LIKE ANY VALUE SELF Generate all but the last element of the list self Function Method on LIST Method on LIST Method on LIST Method on LIST Method on LIST Method on LIST Method on LIST Method on LIST Method on LIST Chapter 6 Library Functions 43 length self INTEGER Method on LIST Not documented member self object OBJECT BOOLEAN Method on LIST Return TRUE iff obj
75. ODULE instead intern surrogate in module name STRING module MODULE Function local BOOLEAN SURROGATE Look for a symbol named name in module if local do not consider inherited mod ules If none exists intern it locally in module Return the existing or newly created symbol intern derived surrogate baseSymbol GENERALIZED SYMBOL Function newName STRING SURROGATE Return a newly created or existing surrogate with name newName which is interned in the same module as baseSymbol visible surrogate self SURROGATE BOOLEAN Function Return true if self is visible from the current module lookup visible surrogates in module name STRING Function module MODULE enforceShadowing BOOLEAN CONS OF SURROGATE Return the list of surrogates with name visible from module More specific surrogates relative to the module precedence order defined by visible modules come earlier in the list If module is null start from MODULE instead If enforceShadowing is true do not return any surrogates that are shadowed due to some SHADOW declaration import surrogate surrogate SURROGATE module MODULE Function SURROGATE Import surrogate into module and return the imported surrogate Signal an error if a different surrogate with the same name already exists locally in module Any surrogate with the same name visible in module by inheritance will be shadowed by the newly imported surrogate Chapter 6 Library
76. OLEAN Function Return true if form is a CONS headed by a CDATA tag xml element match tag name STRING Method on XML ELEMENT namespace STRING BOOLEAN Returns true if tag is an XML element with the name name in namespace namespace Note that namespace is the full URI not an abbreviation Also namespace may be null in which case tag must not have a namespace associated with it xml attribute match attribute name STRING Method on XML ATTRIBUTE namespace STRING BOOLEAN Return true if attribute is an XML attribute with name name in namespace names pace Note that namespace is the full URI not an abbreviation Also namespace may be null in which case attribute must not have a namespace associated with it xml attribute match attribute Method on XML GLOBAL ATTRIBUTE name STRING namespace STRING BOOLEAN Return true if attribute is a global XML attribute with name name in namespace namespace Note that namespace is the full URI not an abbreviation Also names pace may be null in which case attribute must not have a namespace associated with it xml attribute match attribute Method on XML LOCAL ATTRIBUTE name STRING namespace STRING BOOLEAN Return true if attribute is a local XML attribute with name name Note that names pace must be null and that the attributes parent element element is not considered by the match To take the parent element into account use xml local attribute match Chapte
77. RAGE SLOT Iterate over all private storage slots attached to class private self BOOLEAN Method on RELATION Return true if self is not public process doctype doctype declaration CONS XML DOCTYPE Function Takes an S Expression representing a doctype and processes into a DOCTYPE object ptrans statement OBJECT N Command Translate statement to Common Lisp and print the result public class methods class CLASS ITERATOR OF METHOD SLOT Function Iterate over all private methods attached to class public class storage slots class CLASS ITERATOR OF Function STORAGE SLOT Iterate over all public storage slots attached to class public slots self ITERATOR OF SLOT Method on cLass Return an iterator over public slots of self public slots self ITERATOR OF SLOT Method on OBJECT Return an iterator over public slots of self Chapter 6 Library Functions 103 public self BOOLEAN Method on SLOT True if self or one it its ancestors is marked public pushf place CONS value OBJECT OBJECT Macro Push value onto the cons list place qualified stella name name STRING BOOLEAN Function Return TRUE if name is a symbol or surrogate qualified with a module pathname or a module pathname ending with a Assumes that name is the printed representation of a STELLA symbol potentially containing escape characters read line2 stream INPUT STREAM STRING KEYWORD Function
78. Read one line from stream and return the result and a keyword that indicates the ter minator for that line ending CR LF CRLF or EOF This is not platform dependent and differs from read line by returning a second value It may hang when used on interactive streams such as terminal or network streams with only CR line endings It should only be used on file or string input streams reader self SYMBOL Method on STORAGE SLOT Name of a method called to read the value of the slot self regular integer valued x LoNG INTEGER BOOLEAN Function Return true if x can be represented by a regular integer rem x y INTEGER INTEGER Method on INTEGER Return the remainder from dividing x by y The sign of the result is always the same as the sign of x This has slightly different behavior than the mod function and has less overhead in C and Java which don t have direct support for a true modulus function rem x y LONG INTEGER LONG INTEGER Method on LONG INTEGER Return the remainder from dividing x by y The sign of the result is always the same as the sign of x This has slightly different behavior than the mod function and has less overhead in C and Java which don t have direct support for a true modulus function remove configuration property property STRING value OBJECT Function configuration CONFIGURATION TABLE OBJECT Remove value from property in configuration and return it Use the global system confi
79. STELLA Manual Painless symbolic programming with delivery in Common Lisp C and Java Version 1 24 This manual describes STELLA 3 4 or later The STELLA Development Team Hans Chalupsky Robert M MacGregor Thomas A Russ fhans tar isi edu USC Information Sciences Institute Copyright C 2006 University of Southern California Information Sciences Institute 4676 Admiralty Way Marina Del Rey CA 90292 Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies Table of Contents 1 IntrodgucilODgss4ev p EPRAYd OP XAR REOR RR OOES 1 l l Credits and History 4 422 ce Pere E eher de 2 2 Tnstallati n 4 ox ert xo RR Xe AR RES 3 2 1 System Requirements 000 c cee cece ees 3 2 2 Unpacking the Sources 00 eee eee eee seen 4 2 3 Lisp Installation 0 n cece nnn 4 2 4 O Installationes 2 se eae Gen ike be bee RR takes 4 2 5 Java Installation 0 0 nn 5 20 X Emacs Setup eodeni adda E UID Ad qu CPU epe S dS 6 2 7 Removing Unneeded Files 000 ee eee eee eee 6 3 The STELLA Language 7 3 1 Language OvervieW 00 hn fi 3 2 Basic Data Types 6DW ess iupiek tineri ie ERR er PARERE 8 3 3 Control Structure tbe psnceoso posit cerra qd at ed ne E a des 8 3 8 1 Conditionals 0 0 0 leere 8 3 4 Functions LW eee eaxu d itx eode es
80. UPCASE TitleCase titleCaseX downcase Capitalize preserve default is TitleCase separator string default is add prefix string add suffix string MAKE MATCHING NAME returns a matching name a string for the input name a string A matching name is constructed by breaking the input into words and then applying appropriate transforms The arguments are used as follows original is the input name It is a string break on cap is a keyword controlling whether Chapter 6 Library Functions 96 changes in capitalization is used to indicate word boundaries If YES then all cap italization changes delineate words If CLEVER then unbroken runs of capitalized letters are treated as acronyms and remain grouped If NO or NULL there is no breaking of words based on capitalization break on number is a flag controlling whether encountering a number indicates a word boundary If Y ES then each run of numbers is treated as a word separate from surrounding words If CLEVER then an attempt is made to recognize ordinal numbers ie 101st and treat them as separate words If NO or NULL there is no breaking of words when numbers are encountered break on separators A string of characters which constitute word delimiters in the input word This is used to determine how to break the name into individual words Defaults are space and _ remove prefix Specifies a prefix or suffix that is stripped from the input remove suffix name before any oth
81. WRAPPER Function Return a literal object whose value is value Choose a regular integer wrapper unless value is too large and needs to be stored in a long wrapper wrap long integer value LONG INTEGER LONG INTEGER WRAPPER Function Return a literal object whose value is the LONG INTEGER value wrap method code value METHOD CODE Function METHOD CODE WRAPPER Return a literal object whose value is the METHOD CODE value wrapped type to type self TYPE TYPE Function Return the unwrapped type for the wrapped type self or self if it is not a wrapped type wrapper value type self WRAPPER TYPE Function Return the type of the value stored in the wrapper self write html escaping url special characters Function stream NATIVE OUTPUT STREAM input STRING Writes a string and replaces unallowed URL characters according to RFC 2396 with format URL escape sequences writer self SYMBOL Method on STORAGE SLOT Name of a method called to write the value of the slot self xml declaration form form OBJECT BOOLEAN Function Return true if form is a CONS headed by an XML DECLARATION tag xml doctype form form oBJECT BOOLEAN Function Return true if form is a CONS headed by a DOCTYPE tag Chapter 6 Library Functions 114 xml element form form OBJECT BOOLEAN Function Return true if form is a CONS headed by an XML ELEMENT tag xml processing instruction form form OBJECT BOOLEAN
82. a ee Fei Dok ieu 28 zero on INTEGER eslseese lere 114 zero on LONG INTEGER esee 114 Variable Index Variable Index printpretty 2 01 ie 7e t9 EY Lathes 40 printprettycode ee eee eee eee 41 printreadably 4 2 2 2a segs ei 40 A any key of 0000 46 47 51 52 53 any value of 36 41 45 46 47 48 49 51 52 53 array size Ol acces erase aves Tien uhai ai 49 C erossover point Of 2 e ux t us 56 E equal test Of sese ett Re hrs 53 56 F free elements of sssssss esses 53 I initial size Of 202 nero PR 53 56 K 125 N nll csaseeige a pre te EG ORG eked seeded 36 nlli li8t0 i0 0 Etappe one ale asd dettes 42 P Pd 220 sects bee a eed AMO AM Rte ttle M is 27 R rest of 204 Medes ths Pauw Sat ee dete 36 47 Size OL epidemien nia etsi tdt cedem 53 T the array of y pet ERREUR ee aes 49 the consslist Of isi SER uA tepien ie 41 the kv list Of ne gua eere peRR st 48 the napot c nea ret tacnnn naan pera 56 the plist ol c ese RD AERE RS EROS 46 the table of 2 2 2220 BI IeI4 44e AREAS 53 V val eu 2122022990 9 Wei o UbUR Oei ieee 36 AT Concept Index 126 Concept Index Index is nonexistent
83. a featuress coccinea er e rt a 90 XgHOr 2isida dodo REEE pep sada by PERRE PU rd acs 90 import SUurrogat i ris3g d nep y Ri ah ud 61 3mport SymDOol 2 dies vete ASTE ease ra 60 in mod le secreti pired Ein REF P Powe ada ES 65 incrementally translate 90 indent ou tline eeri 994 prO ERO 90 lnfOIH ok 4er ens REP E eo PR bes 91 initial value On CLASS cre m es 91 initial value on STORAGE SLOT 91 initialize array on DIMENSIONAL ARRAY MIXIN die eb anys era E praster Sun T E 91 initialize hash table on STELLA HASH TABLE ped ae E Gant des testi e OPES 91 initially on STORAGE SLOT 4 91 insert on CUSTOM VECTOR SEQUENCE 91 insert on HASH SET 2 vii ep ru Rene SY 58 insert on HBAPc c i lberceebefie4edqelxbe n 91 insert on LIST 2 oe tee 4b See ese RI RENE 43 insert On SET voit g dt cere Re ESQ SPI TRES 45 insert on VECTOR SEQUENCE lesse 51 insert at on EXTENSIBLE VECTOR 51 insert at on FLOAT HASH TABLE 53 insert at on HASH TABLE sese 52 insert at on INTEGER HASH TABLE 53 insert at on KEY VALUE LIST 48 insert at on KEY VALUE MAP 56 insert at on PROPERTY LIST lle es 4T insert at on STELLA HASH TABLE 53 insert at on STRING HASH TABLE 52 insert at on STRING TO INTEGER HASH TABLE waddcaduteea mda du deae SERIE RES 53 inseft at on VECTOR ene tapi euraen 51
84. all safety clauses with level 3 or lower A safety level of 1 or lower disables the generation of calls to the cast function in Lisp cast performs run time type checks which are somewhat expensive However you should not disable run time type checking in Lisp until you have fully debugged your program Once you are confident that your program works correctly you can set safety to 0 before you translate it That way you will avoid the generation and execution of any safety code at all All of the core STELLA system was translated with safety set to 1 Quoted cons trees Access to quoted constants that are not symbols is somewhat slow since it currently uses hashing to find them in a table Hence access to quoted constants such as quote foo bar fum should be avoided in inner loops Access to quoted symbols such as quote foo is fast and does not cause any performance problems The use of quote for constant cons trees is rare in STELLA and somewhat deprecated which is the reason why this mechanism is not all that well supported Future versions of STELLA might re implement the handling of constants and alleviate this performance problem Equality tests The standard equality test in STELLA is eq1 which the translator will translate into the most efficient equality test for the particular types of operands eq1 is somewhat similar to the Lisp function CL eq1 with the exception of comparing strings If the translator can determine that at
85. allocate iterator on MEMOIZABLE ITERATOR 4 76 allocate iterator on PROPERTY LIST 47 allocate iterator on STELLA HASH TABLE 54 allocation on STORAGE SLOT sls 76 append ionem e oe a btedy aE PEE PEE 38 cupere 16 apply boolean method esses TT apply float method cl d nae pets 77 apply integer method esses TT apply long integer method 77 apply method i 9d ne ber eeepepad TT apply string method ekpu ie weeks oes i TT ASIN E eta E E EE T E 29 atanan es Sad anes a bcd aa e a ale 30 AND EEE E E ba E E SEE 30 Function Index B b se60 tosfloat e em ere v vp PET 77 break prograli c eleee stan dped 77 bump log indent 4v 2 ees eed ee tay Dr but Last On OONS cLesemenbBee e eif eri aSa 37 put last om MSP ici cee EE d WES 42 but last on VECTOR 0 66 ccc cece een eeee 50 byte array read sequence s Us byte array write sequence 271 C calendar date to date string on CALENDAR DATE sseeseee eee 77 calendar date to iso8601 string on CALENDAR DATE lees 78 calendar date to string 69 calendar date to string on CALENDAR DATE Pn 78 calendar date to time string on CALENDAR DATE lesse nee 78 call clear module 2 4 o rn aes 78 p LI eb ba cee HS ase er oboe eee ees eae eS 9 DII PPM 78 CC iene dnp da b dep PE ere an
86. as been enabled with add trace print all the elements in body to standard output Otherwise do nothing keyword can also be a list of keywords in which case printing is done if one or more of them are trace enabled translate system systemName STRING Command amp rest language amp options OBJECT BOOLEAN Translate all of the STELLA source files in system systemName into language the optional first argument The following keyword value options are recognized language can be used as an alternative to the optional language argument If not specified the language of the running implementation is assumed two pass default false if true all files will be scanned twice once to load the signatures of objects defined in them and once to actually translate the definitions force translation default false if true files will be translated whether or not their translations are up to date development settings default false if true translation will favor safe read able and debuggable code over efficiency according to the value of development settings on the system definition If false efficiency will be favored instead ac cording to the value of production settings on the system definition production settings default true inverse to development settings translate to common lisp BOOLEAN Function Return true if current output language is Common Lisp translate to cpp BOOLEAN Function Return t
87. as follows namestring is the input string break on cap is a keyword controlling whether changes in capital ization is used to indicate word boundaries If YES then all capitalization changes delineate words If CLEVER then unbroken runs of capitalized letters are treated as acronyms and remain grouped If NO or NULL there is no breaking of words based on capitalization break on number is a flag controlling whether encountering a number indicates a word boundary If YES then each run of numbers is treated as a word separate from surrounding words If CLEVER then an attempt is made to recognize ordinal numbers ie 101st and treat them as separate words If NO or NULL there is no breaking of words when numbers are encountered break on separators A string of characters which constitute word delimiters in the input word This is used to determine how to break the name into individual words Defaults are space and _ decompose namestring full namestring STRING Function break on cap KEYWORD break on number KEYWORD break on separators STRING CONS OF STRING WRAPPER Non keyword version of decompose namestring which will probably be easier to use when called from non Lisp languages default form self oBJECT Method on STORAGE SLOT Returns the current value of default expression when the slot has not been assigned a value defdemon name STRING WRAPPER parameterstree CONS Macro amp body optionsandbody
88. ash codes Chapter 6 Library Functions 56 rotate hash code arg INTEGER INTEGER Function Rotate arg to the right by 1 position This means shift arg to the right by one and feed in args bit zero from the left In Lisp the result will stay in positive FIXNUM range In C and Java this might return a negative value which might be equal to NULL INTEGER Important to make this inlinable it must be called with an atom i e constant or variable as its argument This function is primarily useful for hashing sequences of items where the hash code should take the sequential order of elements into account e g lists 6 10 Key Value Maps KEY VALUE MAP is a full featured dictionary class that supports eql or extensible equal equality tests O 1 access operations even for large numbers of entries by using a hash table light weight KV CONS representation for small tables and iteration even if the dictionary is represented by a hash table note that in STELLA we cannot iterate over regular HASH TABLE s since native Lisp hash tables do not allow us to implement a hash table iterator Since large KEY VALUE MAP s are implemented via STELLA HASH TABLE s we can support iteration KEY VALUE MAP DICTIONARY Class Full featured dictionary class that supports eq1 or equal equality tests O 1 ac cess operations even for large numbers of entries by using a hash table light weight KV CONS representation for small tables and iteration even i
89. bindings from changes in module name NAME MODULE N Command Change the current module to the module named name change module module MODULE Method on MODULE Change the current module to be the module module change module moduleName MODULE Method on STRING Change the current module to be the module named moduleName create world parentContext CONTEXT name STRING WORLD Function Create a new world below the world or module parentContext Optionally specify a name push world WORLD Function Spawn a new world that is a child of the current context and change the current context to the new world pop world CONTEXT Function Destroy the current world and change the current context to be its parent Return the current context Nothing happens if there is no current world destroy context self Method on WORLD Destroy the context self and recursively destroy all contexts that inherit self within world worldForm OBJECT amp body body CONS OBJECT Macro Execute body within the world resulting from worldForm Chapter 6 Library Functions 66 6 15 Input and Output read s expression stream INPUT STREAM OBJECT BOOLEAN Function Read one STELLA s expression from stream and return the result Return true as the second value on EOF read s expression from string string STRING OBJECT Function Read one STELLA s expression from string and return the result read line s
90. butes i i ss m nera 72 get xml cdata content 5 ek is 72 get xml content he seeder adnan dedi dd 72 Pet mml tag en nst easiest 9 aga ii REA Rd 71 global variable type spec 89 H hash code on BOOLEAN WRAPPER 55 hash code on CHARACTER llis 55 hash code on CHARACTER WRAPPER 55 hash code on FLOAT 6 065260 beer een eee eens 55 hash code on FLOAT WRAPPER 55 hash code on INTEGER lessen 55 hash code on INTEGER WRAPPER 55 hash code on OBJECT 0 0 c cece eee n 55 hash code on STANDARD OBJECT 55 hash code on STRING 2 26 e be her gus 55 hash code on STRING WRAPPER 55 hash S6t i e e eR n YS aA a 58 hash string ii dole ae eae b ENEE EES 89 haghlmod 222 epitope der EIE edes 55 heap root Oti HEAP csi tome pRIdGu4u A pers 89 heapity on HEAP i nLibtboeIBRere ws aed tae 89 help advance past whitespace 89 help find matching prefix length 89 help get stella modul e 2 deed es 90 help print outline on CLASS 90 help print outline on CONTEXT 90 help print outline on MODULE 90 help print outline on OBJECT 90 help print outline on SLOT 90 home module on OBJECT sse 90 Function Index I DE P Soe 8 if output language ci nea e e ees 90 Af stell
91. calendar date object representing the date and time parsed from the input string If no valid parse is found null is returned relative date to string Not yet implemented Chapter 6 Library Functions 70 compute calendar date julian day INTEGER INTEGER INTEGER Function INTEGER KEYWORD Returns the YEAR MONTH DAY DAY OF WEEK on which the given julian day begins at noon compute day of week yyyy INTEGER mm INTEGER dd INTEGER Function KEYWORD Returns the day of the week for yyyy mm dd compute day of week julian julian day INTEGER KEYWORD Function Returns the day of the week for julian day compute julian day yyyy INTEGER mm INTEGER dd INTEGER Function INTEGER Returns the Julian day that starts at noon on yyyy mm dd yyyy is the year mm is the month dd is the day of month Negative years are B C Remember there is no year zero compute next moon phase n INTEGER phase KEYWORD Function INTEGER FLOAT Returns the Julian Day and fraction of day of the Nth occurence since January 1 1900 of moon PHASE PHASE is one of NEW MOON FIRST QUARTER FULL MOON LAST QUARTER decode time in millis time INTEGER INTEGER INTEGER INTEGER Function INTEGER Returns multiple values of hours minutes seconds milliseconds for time specified in milliseconds julian day to modified julian day julian day INTEGER INTEGER Function Returns the modified Julian day during which julia
92. configuration file 93 Toad file i oii ede he e eta see ee 93 load system sc ligas ehh Rene Rd 93 local gensym ien Mead REESE 62 Function Index DD IH 29 log level o i e ce ree edi 94 log message esses ep or ita i RR ea 94 OPI MEER NIE PETENTE PNIS 29 logical hoSt eee eb RR 68 logical pathname oi jc secede os trn 68 logmsg iiewpeskkegenr aded ee hp CQ amare RU 94 lookup on HASH TABLE leen 52 lookup on INTEGER HASH TABLE 53 lookup on KEY VALUE LIST sene 48 lookup on KEY VALUE MAP lesen ne 56 lookup on PROPERTY LIST esee 46 lookup on STELLA HASH TABLE 53 lookup on STRING HASH TABLE 52 lookup on STRING TO INTEGER HASH TABLE 52 lookup class On STRING laci exeun 94 lookup class on SYMBOL esee 94 Iookup command nue blade REI UAM 94 lookup configuration property 94 lookup configuration property values 94 Look p demon ue med ween eee 94 lookup funCtion Rb i DaT igea 94 lookup function by n me ei ek ba Rs 94 lookup global variable on GENERALIZED SYMBOL 000 ee eeee 95 lookup global variable on STRING 95 lookup global variable on SURROGATE 95 LOOkUp K6Y WOR 25 ue peak ach RED 62 Lookup l60Ccal 810t 22 2 ee rts 95 lookup logging parameter 95 LOOKUP MACKO eder eae e oe eae 95 lookup sSlOot 219 e fe it esed ea aaa 95 lookup surro
93. ctory stella java Running Java version of STELLA Welcome to STELLA 3 4 0 Running kernel startup code Initializing symbol tables Initializing quoted constants Initializing global variables Chapter 2 Installation 6 Creating class objects Finalizing classes Creating method objects Finalizing methods Running non phased startup code Starting up translators Bye Similar to the C executable this will simply run various STELLA startup code and exit See Section 4 1 3 Hello World in Java page 16 to see how you can use the STELLA Java executable to translate STELLA code 2 6 X Emacs Setup STELLA development is very similar to Lisp development and it is best done in an X Emacs based Lisp development environment such as the Allegro CL Emacs interface plus Allegro Composer or ILISP If you do use X Emacs with the Allegro CL interface add the following to your emacs or xemacs init el file setq auto mode alist cons ste fi common lisp mode auto mode alist If you are using the Allegro CL interface you might want to install the file emacs fi stella el since it sets up proper indentation for STELLA code and makes looking up STELLA definitions via the C c or M commands work better Look at the file emacs fi stella el for specific installation instructions 2 7 Removing Unneeded Files To save disk space you can remove files that you don t n
94. d evaluator is available optional and keyword arguments and a modifiable readtable STELLA does also not allow dynamic re definition of functions and classes even though the Lisp based development environment provides this facility similar to Dylan The main in fluences of C and Java onto STELLA are the strong typing limited multiple inheritance first argument polymorphism and the distinction between statements and expressions 3 2 Basic Data Types tbw To be written 3 3 Control Structure tbc To be completed 3 3 1 Conditionals STELLA conditionals are very similar to those found in Common Lisp The main differ ence is that most STELLA conditionals are statements and therefore do not return a value For this reason a C style choose directive has been added to the language to allow value conditionalization based on a boolean expression if condition then statement else statement Statement Evaluate the boolean expression condition If the result is true execute then statement otherwise execute else statement Note that unlike the Common Lisp version of if the else statement is not optional in STELLA Example if gt x y print x is greater than y EOL print x is less than or equal to y EOL when condition statement Statement Evaluate the boolean expression condition Only if the result is true execute the statement s in the body Example when symbol x print x is a symbol print its name
95. d with size initchars make raw mutable string size INTEGER MUTABLE STRING Function Return a new uninitialized mutable string of size first self CHARACTER Method on STRING Return the first character of self first self CHARACTER Method on MUTABLE STRING Return the first character of self settable via setf Chapter 6 Library Functions 33 second self CHARACTER Method on STRING Return the second character of self second self CHARACTER Method on MUTABLE STRING Return the second character of self settable via setf third self CHARACTER Method on STRING Return the third character of self third self CHARACTER Method on MUTABLE STRING Return the third character of self settable via setf fourth self CHARACTER Method on STRING Return the fourth character of self fourth self CHARACTER Method on MUTABLE STRING Return the fourth character of self settable via setf fifth self CHARACTER Method on STRING Return the fifth character of self fifth self CHARACTER Method on MUTABLE STRING Return the fifth character of self settable via setf nth self position INTEGER CHARACTER Method on STRING Return the character in self at position nth self position INTEGER CHARACTER Method on MUTABLE STRING Return the character in self at position rest self STRING Method on STRING Not documented length self INTEGER Method on STRING Return the
96. different translations stellify self OBJECT OBJECT Function Convert a Lisp object into a STELLA object stop function call logging Command Stop function call logging and close the current log file stream position self LONG INTEGER Method on OUTPUT FILE STREAM Return the current position of the file input cursor in self stream position self LONG INTEGER Method on INPUT FILE STREAM Return the current position of the file input cursor in self stream position setter self Method on OUTPUT FILE STREAM newpos LONG INTEGER LONG INTEGER Set the current position of the file input cursor in self to newpos stream position setter self Method on INPUT FILE STREAM newpos LONG INTEGER LONG INTEGER Set the current position of the file input cursor in self to newpos If self has any tokenizer state associated with it this will also reset to the start state of the tokenizer table otherwise behavior would be unpredictable unless the character class of the new position is exactly the same as the one following the most recent token stream to string from srRING Method on INPUT STREAM Read all of the input from stream and return it as a string Chapter 6 Library Functions 108 string to calendar date with default input date STRING Function default date DECODED DATE TIME CALENDAR DATE Returns a calendar date object representing the date and time parsed from the input date string Default va
97. dulus for floats Return the result of x mod modulo Note In C and Java mod has more overhead than the similar function rem The answers returned by mod and rem are only different when the signs of x and modulo are different format with padding input srRING length INTEGER Function padchar CHARACTER align KEYWORD truncate BOOLEAN STRING Formats input to be at least length long using padchar to fill if necessary align must be one of LEFT RIGHT CENTER and will control how input will be justified in the resulting string If truncate is true then then an overlength string will be truncated using the opposite of align to pick the truncation direction free self Method on ACTIVE OBJECT Remove all pointers between self and other objects and then deallocate the storage for self free self Method on OBJECT Default method Deallocate storage for self free hash table values self Method on ABSTRACT HASH TABLE Call free on each value in the hash table self frem x FLOAT y FLOAT FLOAT Function Return the floating point remainder from dividing x by y The sign of the result is always the same as the sign of x This has slightly different behavior than the mod function and has less overhead in C and Java which don t have direct support for a true modulus function generate random uuid srRING Function Generates a random UUID Type 4 according to the guidelines of IETF RFC 4122 s
98. e If the current OS Language combination does not sup port measuring of CPU time return real time instead Use ticktock difference to measure the time difference between values returned by this function This is an attempt to provide some platform independent support to measure at least approx imately consumed CPU time ticktock difference t1 TICKTOCK t2 TICKTOCK FLOAT Function The difference in two TICK TOCK time values in seconds where t1 is the earlier time The resolution is implementation dependent but will normally be some fractional value of a second ticktock resolution FLOAT Function The minimum theoretically detectable resolution of the difference in two TICKTOCK time values in seconds This resolution is implementation dependent It may also not be realizable in practice since the timing grain size may be larger than this resolution sleep seconds FLOAT Function The program will sleep for the indicated number of seconds Fractional values are al lowed but the results are implementation dependent Common Lisp uses the fractions natively Java with a resolution of 0 001 and C can only use integral values 6 18 XML Support make xml element name STRING namespace name STRING Function namespace STRING XML ELEMENT Creates and interns an XML element object name using namespace name to refer to namespace If namespace is null then the element will be interned in the null namespace namespace m
99. e out of the argument date time string and returns a time structure if successful If not it returns null If error on mismatch is true parse date time will signal an error instead of returning null Default values are passed in via base date time If the timezone field that is passed in is NULL then the local time zone for the parsed date time will be used If merge null fields is true then default values from base time date will be merged into missing components Chapter 6 Library Functions 101 If false then they won t be merged in for null components but can still be used as a basis for interpreatation of relative time strings like now or yesterday parse stella name name STRING enableCaseConversion BOOLEAN Function STRING STRING KEYWORD Parse the printed representation name of a STELLA symbol surrogate or keyword and return its symbol name module name and type which is either SYMBOL SURROGATE or KEYWORD name can be qualified and must use the exact same syntax and escape characters that would be used if it were to be read by read s expression from string or unstringify If enableCaseConversion is TRUE the returned symbol name will be upcased if the current module is case insensitive otherwise it will be returned as is Raises a read exception if name does not represent a symbol This function is available primarily for efficiency since it is about 10 15 times faster than unstringify pick hash tab
100. eam stream mode can be terse verbose or source The terse mode is often equivalent to the standard print function destroy class self Method on CLASS Destroy the Stella class self Unfinalize its subclasses if it has any destroy class and subclasses self CLASS Function Destroy the Stella class self and all its subclasses destructure defmethod tree method tree CONS Function options table KEY VALUE LIST OBJECT CONS CONS Return three parse trees representing the name parameters and code body of the parse tree method tree Fill options table with a dictionary of method options Stor age note Options are treated specially because the other return values are subtrees of method tree while options table is a newly created cons tree Note also the pa rameter and body trees are destructively removed from method tree dictionary collectionType TYPE Function amp rest alternatingkeysandvalues OBJECT ABSTRACT DICTIONARY OF OBJECT OBJECT Return a dictionary of collectionType containing values in order Currently supported collectionTypes are HASH TABLE GSTELLA HASH TABLE KEY VALUE LIST eKEY VALUE MAP and PROPERTY LIST direct super classes self ITERATOR OF CLASS Method on CLASS Returns an iterator that generates all direct super classes of self disable memoization Command Enable memoization and use of memoized expression results disabled stella feature feature KEYWORD
101. ecompose namestring ss ssses 82 decompose namestring full 82 default form on STORAGE SLOT 82 defdemomn iioi paie doa Pind d He Rh 82 defin d emon c222 4 a le cu ESI 82 define logical host property 83 define modul 212 22 5 122 dde weh ded 83 define stella class 0c eee eae 83 define stella method slot 83 d fined List i122 9g ve ERA eue 42 defined On ARRAY c uripo iE Erie 83 defined on CHARACTER eee eene 27 defined On CODE cie cs2c 0se Sed deen dew bao 27 defin d On FLOAT e ER RR ded 27 defined on INTEGER 0 2 000 eee 21 defined on LONG INTEGER 0 83 defined on MUTABLE STRING 26 defined on NATIVE VECTOR 4 26 defined On OBJECT 20 205 094 3 br 26 defined on SECOND CLASS OBJECT 26 defined on STRING eleseeeeees 26 defmaln l2ziede3db Rue Qa ERROR dub eot 83 defmodul 20 23a wd bre E ad eae ane 63 defsystem ce Reg en EIE Edu cog al 83 delet file 2 22 ees ee eR s 67 deleted on OBJECT 0 02002 ee nenei ees 84 deS6rib6 2i11423aee egeris agn a NDS He end 84 describe object on OBJECT sss 84 destroy class On CLASS eese sel 84 destroy class and subclasses 84 destroy context on CONTEXT eese 63 destroy context on MODULE 65 destroy context on
102. ect is a member of the list self uses an eql test memb self object LIKE ANY VALUE SELF BOOLEAN Method on LIST Return TRUE iff object is a member of the cons list self uses an eq test position self object OBJECT start INTEGER INTEGER Method on LIST Return the position of object within the list self counting from zero or return NULL if object does not occur within self uses an eq1 test If start was supplied as non NULL only consider the sublist starting at start however the returned position will always be relative to the entire list last position self object OBJECT end INTEGER INTEGER Method on LIST Return the position of object within the list self counting from zero or return NULL if object does not occur within self uses an eq1 test If end was supplied as non NULL only consider the sublist ending at end however the returned position will always be relative to the entire list insert self value LIKE ANY VALUE SELF Method on LIST Add value to the front of the list self push self value LIKE ANY VALUE SELF Method on LIST Add value to the front of the list self insert new self value LIKE ANY VALUE SELF Method on LIST Add value to the front of the list self unless its already a member insert last self value LIKE ANY VALUE SELF Method on LIST Insert value as the last entry in the list self reverse self LIKE SELF M
103. ee http www ietf org rfc rfc4122 txt Chapter 6 Library Functions 88 Take 16 random bytes octets put them all behind each other for the description the numbering starts with byte 1 most significant first to byte 16 least significant last Then put in the version and variant To put in the version take the 7th byte and perform an and operation using OxO0f followed by an or operation with 0x40 To put in the variant take the 9th byte and perform an and operation using Ox3f followed by an or operation with 0x80 To make the string representation take the hexadecimal presentation of bytes 1 4 without Ox in front of it let them follow by a then take bytes 5 and 6 bytes 7 and 8 bytes 9 and 10 then followed by bytes 11 16 generate uuid uuid type KEYWORD STRING Function Generates a UUID of the specified type Legal types are a subset of the IETF RFC 4122 see http www ietf org rfc rfcA122 txt UUID types Currently supported are TYPE 4 RANDOM A type 4 random UUID These are synonyms get calendar date date timezone FLOAT Method on CALENDAR DATE INTEGER INTEGER INTEGER KEYWORD Returns multiple values of year month day and day of week for date in timezone timezone is the number of hours added to UTC to get local time It is in the range 12 0 to 14 0 where UTC is zone 0 0 get global value self SURROGATE OBJECT Function Return the possibly wrapped value of the global variable for the
104. ee iuis 29 abs on INTEGER c 4 5 99 3 achk e gud ndr ace anh 29 abs on LONG INTEGER lesen 74 absolute pathnuame orir ke e Rr 68 Cien er 30 activat demon 2 nd bp RR EORR RO T5 active on POLYMORPHIC RELATION 75 add configuration property 75 add ho k 212 iih ede ded rait d Detar 75 AGA H ELAGCE i oos dade eu de me d dase rd ade T advance on ITERATOR 0 6 600000 sre n 59 advance past whitespace sess 75 all clasSes 2 220 er eee aot rx tends To all c mntexts cassmandu e dure halter dina ee T5 allsdefined e mI BRE RR eee 15 all fu ncti BS 2222 9 2 09 9494 d me yes TO all included modules usu 75 all lower case string 6 esas ee eed idees 32 abll methodsS o ctIpe ook fore awa RE 75 all modul sS 222 eB l9 pXWega4eRERLRC xa T5 all publve unet ions soirs iare ei sad ias 76 all public methods 2o RR nr eee 16 all required Systens i mee Re ers 16 all slo ts i2 09i ve 92 bURIEe bee 94g 76 all subco nt xtsS 22 22 2292 e Rog AR 76 all surrogatesS il iic g deca REA EE PE 76 all symbols 641b ea tee ee ees 76 all upper case string ce gx ea ces 32 all variabl S 4 32252 ce gr acea os 76 allocate iterator on ABSTRACT ITERATOR 76 allocate iterator on CONS 40 allocate iterator on KEY VALUE LIST 49 allocate iterator on KEY VALUE MAP E allocate iterator on LIST 44
105. eed For example if you are not interested in the C version of STELLA you can delete the directory native cpp Similarly you can remove native java to eliminate all Java related files You could do the same thing for the Lisp directory native lisp but in our opinion that would make it less convenient for you to develop new STELLA code Finally if you don t need any of the STELLA sources you can delete the directory sources stella If you don t need local copies of the STELLA documentation you can delete parts or all of the sources stella doc directory Chapter 3 The STELLA Language 7 3 The STELLA Language 3 1 Language Overview STELLA is a strongly typed object oriented Lisp like language STELLA programs are first translated into either Common Lisp C or Java and then compiled with any conventional compiler for the chosen target language to generate executable code Over 95 of the STELLA system is written in STELLA itself the rest is written in target language specific native code The design of STELLA borrows from a variety of programming languages most promi nently from Common Lisp and to a lesser degree from other object oriented languages such as Eiffel Sather and Dylan Since STELLA has to be translatable into C and Java various restrictions of these languages also influenced its design In the following we assume that the reader is familiar with basic Common Lisp concepts a
106. eee eens 56 6 11 Hasi Sete edet de eevee cee eel eee ee ee hee Uns ae 57 6 12 Iterator Smenn apsenin ce te a CR a han a es 59 0 13 SymbolS dte eed ead ere ge rh ede 60 6 14 Context and Modules seeeeee en 62 6 15 Input and Output 0 0 eee eee 65 BINE PE tt teense see ieee ich eee eset ne gamed ens 66 6 17 Dates and Times Rr eR en tetas eds 68 0 18 XML Supports sero ebbe RR aea ai OL One eru oe ee 71 6 19 Miscellaneous er eee bec ids dhe Ra eee OA eel ek 74 Function IndeX 2 425 5 4 9 4060 R3 25CRCPAEROE tc ec Ane 115 Variable Indies i542 ceo Grow Jer ce 116 Concept Index 4 222v er n 117 ii Chapter 1 Introduction 1 1 Introduction This document describes the STELLA programming language STELLA stands for Strongly TypEd Lisp like LAnguage It is an object oriented language that strongly sup ports symbolic programming tasks We developed it since none of the currently healthy languages such as C or Java adequately support symbolic programming While Common Lisp would probably still be today s language of choice for many symbolic programming applications its dwindling vendor support and user base make it more and more difficult to justify its use When we started the development of the PowerLoom knowledge representation system in 1995 we were faced with exactly this problem PowerLoom had to be delivered in C but it was simply incoceivable to write such a large symbolic pro
107. em default true if true compiled files will be loaded into the current STELLA image only supported in Lisp and Java right now startup default true if true the system startup function will be called once all files have been loaded max x y INTEGER INTEGER Method on INTEGER Return the maximum of x and y If either is NULL return the other max x y LONG INTEGER LONG INTEGER Method on LONG INTEGER Return the maximum of x and y If either is NULL return the other max x y FLOAT FLOAT Method on FLOAT Return the maximum of x and y If either is NULL return the other max x y NUMBER WRAPPER Method on NUMBER WRAPPER NUMBER WRAPPER Return the maximum of x and y If y is NULL return x member self value OBJECT BOOLEAN Method on CONS ITERATOR Iterate over values of self and return TRUE if one of them is eq1 to value member self object OBJECT BOOLEAN Method on COLLECTION Return true iff object is a member of the collection self member self value OBJECT BOOLEAN Method on SEQUENCE Return TRUE if value is a member of the sequence self memoize inputArgs CONS amp body body CONS OBJECT Macro Compute the value of an expression and memoize it relative to the values of inputArgs inputArgs should characterize the complete set of values upon which the computation of the result depended Calls to memoize should be of the form memoize lt arg gt lt option
108. en a TCP IP network stream to host at port and return the result as an in put output stream pair ordered self BOOLEAN Method on COLLECTION Return true if the collection self is ordered outline depth exceeded current depth INTEGER Function depth limit INTEGER BOOLEAN Helper function that returns true if current depth exceeds depth limit This functions uses the convention that a null or negative value of depth limit means the depth is unlimited In those cases it always returns false parameters self LisT OF SYMBOL Method on CLASS Returns the list of parameters names of self parse date time in time zone date time string STRING Function time zone FLOAT start INTEGER end INTEGER error on mismatch BOOLEAN DECODED DATE TIME Tries very hard to make sense out of the argument date time string and returns a time structure if successful If not it returns null If error on mismatch is true parse date time will signal an error instead of returning null Default values are 00 00 00 in the given timezone on the current date If the given time zone value is null then the local time zone for the given date and time will be used as determined by the operating system parse date time relative to base date time string STRING Function base date time DECODED DATE TIME start INTEGER end INTEGER error on mismatch BOOLEAN merge null fields BOOLEAN DECODED DATE TIME Tries very hard to make sens
109. enate them heap root self LIKE ANY VALUE SELF Method on HEAP Return the root of self NULL if self is empty heapify self Method on HEAP Restore the heap property of self according to its predicate Normally this is not needed since insert operations preserve the heap property However this can be useful after bulk insertion of values or if predicate has been changed help advance past whitespace source STRING start INTEGER Function end INTEGER INTEGER Helper for advance past whitespace that requires end to be properly set help find matching prefix length string1 STRING Function startl INTEGER end1 INTEGER string2 STRING start2 INTEGER end2 INTEGER INTEGER Helping function for find matching prefix that requires end1 and end2 to be prop erly set up Chapter 6 Library Functions 90 help get stella module pathName STRING error BOOLEAN Function MODULE Return the module located at pathName or null if no such module exists The search looks at ancestors and top most cardinal modules If error is true throw an exception if no module is found help print outline top stream OUTPUT STREAM Method on CLASS current depth INTEGER depth INTEGER named BOOLEAN Helper method for print outline help print outline top stream OUTPUT STREAM Method on MODULE current depth INTEGER depth INTEGER named BOOLEAN Helper method for print outline help print outline
110. er defined by visible modules come earlier in the list If module is nu11 start from MODULE instead If enforceShadowing is true do not return any symbols that are shadowed due to some SHADOW declaration import symbol symbol SYMBOL module MODULE SYMBOL Function Import symbol into module and return the imported symbol Signal an error if a different symbol with the same name already exists locally in module Any symbol with the same name visible in module by inheritance will be shadowed by the newly imported symbol Chapter 6 Library Functions 61 safe import symbol symbol SYMBOL module MODULE SYMBOL Function Safe version of import symbol which see Only imports symbol if no symbol with that name is currently interned or visible in module Returns symbol if it was im ported or the conflicting symbol in module otherwise lookup surrogate name STRING SURROGATE Function Return the first surrogate with name visible from the current module intern surrogate name STRING SURROGATE Function Return a newly created or existing surrogate with name name unintern surrogate self SURROGATE Function Remove self from its home module and the surrogate table lookup surrogate in module name STRING module MODULE Function local BOOLEAN SURROGATE Return the first surrogate with name visible from module If local only consider surrogates directly interned in module If module is null use M
111. er processing This allows the re moval of any naming convention dictated prefixes or suffixes add prefix Specifies a prefix or suffix that is added to the output name add suffix after all other processing This allows the addition of any naming convention dictated prefixes or suffixes case The case of the resulting name This is applied to the name before adding prefixes or suffixes The two title case options differ only in how the first word of the name is treated TitleCase capitalizes the first letter of the first word and also the first letter of all other words TitleCaseX does not capitalizes the first letter of the first word but capitalizes the first letter of all subsequent words preserve results in no change in case separator This is a string specifying the word separator to use in the returned name An empty string the default means that the resulting words are concatenated without any separation This normally only makes sense when using one of the title case values for the case keyword make matching name full originalname STRING Function breakoncap KEYWORD breakonnumber KEYWORD breakonseparators STRING removeprefix STRING removesuffix STRING addprefix STRING addsuffix STRING outputcase KEYWORD outputseparator STRING STRING Non keyword version of make matching name which will probably be easier to use when called from non Lisp languages make system systemName STRING Command amp rest lang
112. erList CONS CONS Method on cons Return the set difference of self and otherList i e all elements that are in self but not in otherSet Uses an eql test and a simple quadratic time algorithm Note that the result is only guaranteed to be a set if both self and otherList are sets subtract self otherList CONS CONS Method on Cons Return the set difference of self and otherList by destructively removing elements from self that also occur in otherList Uses an eq1 test and a simple quadratic time algorithm Note that the result is only guaranteed to be a set if self is a set 6 6 Lists LIST SEQUENCE Class Not documented any value OBJECT Class Parameter of Not documented the cons list CONS OF LIKE ANY VALUE SELF Slot of Not documented Chapter 6 Library Functions nil list LIST Not documented defined list self LIST BOOLEAN Return TRUE unless self is NULL or the NIL LIST null list self LIST BOOLEAN Return TRUE iff self is NULL or the NIL LIST empty self BOOLEAN Return TRUE if the list self has no members non empty self BOOLEAN Return TRUE if the list self has at least one member object equal x y OBJECT BOOLEAN 42 Variable Function Function Method on LIST Method on LIST Method on LIST Return TRUE iff the lists x and y are structurally equivalent Uses equal to test equality of elements equal hash code self I
113. et up properly See section on how to setup your own system Make sure the Hello World system is loaded into Lisp by doing the following make system hello world common lisp This will make sure that the system definition is loaded and the necessary module defi nition is evaluated Now suppose you add the following function to file a ste Chapter 4 Programming in STELLA 18 defun factorial INTEGER n INTEGER if eql n 0 return 1 return n factorial 1 n There are various options for translating and evaluating this definition For example you can simply remake the complete system similar to what you would do for a C or Java program make system hello world common lisp This will retranslate the modified files recompile them and reload them into your Lisp image Instead of retranslating and recompiling everything you can incrementally evaluate the definition of factorial from your Emacs to Lisp interface Simply put your cursor some where inside the definition in the source buffer and evaluate it by typing M C x This translates the STELLA code into Lisp and compiles or evaluates the resulting Lisp code Now you can actually try it out in the Lisp buffer for example STELLA 4 factorial 6 720 Finally instead of evaluating the definition in the source buffer you can also enter it directly at the Lisp prompt with the same effect The way this works is that the Lisp symbol
114. ethod on LIST Reverse the members of self in place remove self value LIKE ANY VALUE SELF LIKE SELF Method on LIST Destructively remove all entries in self that match value remove duplicates self LIKE SELF Method on LIST Destructively remove duplicates from self and return the result Preserves the original order of the remaining members remove deleted members self LIKE SELF Method on LIST Not documented remove if self test FUNCTION CODE LIKE SELF Method on LIST Destructively remove all members of the list self for which test evaluates to TRUE test takes a single argument of type OBJECT and returns TRUE or FALSE Returns self Chapter 6 Library Functions 44 pop self LIKE ANY VALUE SELF Method on LIST Remove and return the first element in the list self Return NULL if the list is empty substitute self inValue OBJECT outValue OBJECT LIKE Method on LIST SELF Destructively replace each appearance of out Value by in Value in the list self concatenate list1 list2 LIST amp rest otherLists LIST LIST Method on LIST Copy list2 and all otherLists onto the end of list1 The operation is destructive wrt list1 but leaves all other lists intact The two mandatory parameters allow us to optimize the common binary case by not relying on the somewhat less efficient variable arguments mechanism prepend self list2 LIST LIKE SELF Method on LIST Copy list
115. f NULL stands for the rest of the string substitute characters self new chars STRING Method on STRING old chars STRING STRING Substitute all occurences of of a member of old chars with the corresponding member of new chars in the string self Returns a new string substitute characters self new chars STRING Method on MUTABLE STRING old chars STRING MUTABLE STRING Substitute all occurences of of a member of old chars with the corresponding member of new chars in the string self IMPORTANT The return value should be used instead of relying on destructive substitution since the substitution will not be destructive in all translated languages subtype of sub type TYPE super type TYPE BOOLEAN Function Return true iff the class named sub type is a subclass of the class named super type super classes self ITERATOR OF CLASS Method on cLass Returns an iterator that generates all super classes of self Non reflexive Chapter 6 Library Functions 109 surrogate name name STRING BOOLEAN Function Return TRUE if name is prefixed by SURROGATE PREFIX CHARACTER surrogatify self SURROGATE Method on SURROGATE Converts self into a surrogate surrogatify self SURROGATE Method on SYMBOL Converts self into a surrogate same semantics as symbol to surrogate which see surrogatify self SURROGATE Method on STRING Converts self into a surrogate sweep self Method on OBJECT Default me
116. f has at least 1 entry copy self LIKE SELF Method on KEY VALUE MAP Return a copy of the map self All entries are freshly allocated however the keys and values of entries are not copied themselves similar to what we do for lists etc clear self Method on KEY VALUE MAP Reset self to have zero entries allocate iterator self DICTIONARY ITERATOR OF Method on KEY VALUE MAP LIKE ANY KEY SELF LIKE ANY VALUE SELF Allocate an iterator for self The only modifying operations allowed during iteration are removal of the current element or changing its value All other removal or insertion operations might lead to corruption or undefined results consify self CONS Method on KEY VALUE MAP Collect all entries of self into a cons list of lt key gt lt value gt pairs and return the result object equal x y OBJECT BOOLEAN Method on KEY VALUE MAP Return TRUE if x and y represent the same set of key value pairs equal hash code self INTEGER Method on KEY VALUE MAP Return an equal hash code for self Note that this is O N in the number of entries of self 6 11 Hash Sets HASH SET is a full featured set class that supports eq1 or extensible equal equality tests O 1 insert and member operations O N intersection etc operations even for large numbers of entries by using a STELLA hash table light weight KV CONS representation for small sets and iteration even if the set is re
117. f the dictionary is rep resented by a hash table the map OBJECT Slot of Not documented equal test BOOLEAN Slot of If true use equal as the equality test and equal hash code as the hash function otherwise use eq1 and hash code the default initial size INTEGER Slot of If supplied the initial table will be sized to hold at least that many elements crossover point INTEGER Slot of Not documented lookup self key LIKE ANY KEY SELF LIKE Method on KEY VALUE MAP ANY VALUE SELF Lookup the entry identified by key in self and return its value or NULL if no such entry exists Uses an eq1 test by default or equal if equal test of self is TRUE insert at self key LIKE ANY KEY SELF Method on KEY VALUE MAP value LIKE ANY VALUE SELF Set the value of the entry identified by key in self to value or add a new entry if no entry with key exists yet Uses an eql test by default or equal if equal test of self is TRUE Chapter 6 Library Functions 57 remove at self key LIKE ANY KEY SELF Method on KEY VALUE MAP Remove the entry identified by key from self Uses an eq1 test by default or equal if equal test of self is TRUE length self INTEGER Method on KEY VALUE MAP Return the number of entries in self empty self BOOLEAN Method on KEY VALUE MAP Return TRUE if self has zero entries non empty self BOOLEAN Method on KEY VALUE MAP Return TRUE if sel
118. file in the directory native cpp lib which can later be linked with your own C translated STELLA or other code To test whether the compilation was successful you can run STELLA from the top level STELLA directory using the stella script or stella bat under a Windows command prompt stella c Running C version of STELLA Welcome to STELLA 3 4 0 Running kernel startup code Initializing symbol tables Initializing quoted constants Initializing global variables Creating class objects Finalizing classes Creating method objects Finalizing methods Running non phased startup code Starting up translators Bye This will simply run various STELLA startup code and exit See Section 4 1 2 Hello World in C page 14 to see how you can use the STELLA C executable to translate STELLA code The c argument tells the script to run the C version of STELLA If the argument is omitted and the C version is installed it will be run automatically Otherwise the Java version will be run 2 5 Java Installation Nothing needs to be done to install the Java version Since Java class files are platform independent they are already shipped with the STELLA distribution and can be found in the directory native java and its subdirectories Additionally they have been collected into the file native java lib stella jar To try out the Java version of STELLA run the stella script in the STELLA dire
119. form to the C or Java version of STELLA just as you would do in Lisp Note the extra quotes around the expression to protect the characters from interpretation by the Unix shell Different from Lisp neither of the above idioms will compile and load the generated C code Instead you have to use the Unix make facility to compile and link the C sources First change into the native hello world directory and then call make important the generated Makefiles currently require the GNU version of make cd native cpp hello world make g w g 02 DSTELLA USE GC I stella cpp lib gc include c I main cc g w g 02 DSTELLA USE GC I stella cpp lib gc include C I file a cc g w g 02 DSTELLA USE GC I stella cpp lib gc include c I file b cc g w g 02 DSTELLA USE GC I stella cpp lib gc include c I startup system cc gt dynamic L stella cpp lib gc Xlinker rpath Xlinker gt lib tmp stella 3 1 0 native cpp lib main o o hello world L lib lhello world L lib lstella lgc lm The first time around this will also compile the C version of STELLA and the C garbage collector and create a STELLA library file Future builds of the Hello World and Chapter 4 Programming in STELLA 16 other systems will use the STELLA library file directly To run the Hello World system simply run the hello world executable that was built in the previous step hel
120. gat ossia kenir 4 pn 61 lookup surrogate in module 61 lookup symbol eek is ae eee eR Rn 60 lookup symbol in module 60 lookup visible surrogates in module 61 lookup visible symbols in module 60 lookup with default on KEY VALUE LIST 95 lookup with default on PROPERTY LIST 95 lower case char cter 2 seed nee 31 IDUtDADS seppa tals ket cutee UM edd E dads 95 make current date time 000 69 make date time e ne iriri eed 69 make matching name lesse sss 95 make matching name full 96 make mut ble string ss s de e ea 32 make raw mutable string 32 make String opps dana es dod nde RU EI Rok sore 32 make SyStem e rResbbpptperpL IH EE PPS 96 make xml element ede ens ra make xml global attribute 71 make xml local attribute ral Map nulI toana Ds cs pen adediainie eani nE saved d 40 map nuull to nil list 222 2238 eme 44 MAX On FLOAT i222 a puppe ue TRU shud dub aed max on INTEGER 6e Roten eben max on LONG INTEGER 2 mmm ele max on NUMBER WRAPPER s memb ON CONS s n pup RR EUR PICS memb On LIST x neasa a nei E ES abe dane OR member on COLLECTION seeeeee member on CONS esse member on CONS ITERATOR sess member on HASH SET lessen member on ITERATOR
121. gramming application directly in C The solution was to invent a new programming language we called STELLA and write PowerLoom in STELLA instead STELLA is a strongly typed object oriented Lisp like language specifically geared to support artificial intelligence applications STELLA preserves those features of Common Lisp deemed essential for symbolic programming such as built in support for dynamic data structures heterogeneous collections first class symbols powerful iteration constructs name spaces an object oriented type system with a simple meta object protocol excep tion handling language extensibility through macros and automatic memory management Maybe the biggest difference between STELLA and Common Lisp is that STELLA is strongly typed All externally visible interfaces such as slots function parameters and return values etc have to be explicitly typed Internal objects such as local variables however are mostly typed implicitly supported by type inference This in conjunction with a powerful type coercion mechanism significantly reduces the number of explicit type infor mation that needs to be supplied by the programmer compared to languages such as C or Java STELLA programs are first translated into a target language such as Common Lisp C or Java and then compiled with the native target language compiler to generate executable code The language constructs of STELLA are restricted to those that can be translated fai
122. guration table if configuration is NULL remove duplicates self LIKE SELF Method on COLLECTION Return self with duplicates removed Preserves the original order of the remaining members replace heap root self value LIKE ANY VALUE SELF Method on HEAP Replace the current root of self with value and restore the heap property Signal an error if self is empty Maintains self as a Min heap if selfs predicate has lt semantics otherwise as a Max heap Chapter 6 Library Functions 104 required slots self LIST OF SYMBOL Method on CLASS Returns a list of names of required slots for self required self BOOLEAN Method on STORAGE SLOT True if a value must be assigned to this slot at creation time reset stella features Command Reset STELLA features to their default settings reverse interval lowerbound INTEGER upperbound INTEGER Function REVERSE INTEGER INTERVAL ITERATOR Create a reverse interval object run hooks hooklist HOOK LIST argument OBJECT Function Run all hook functions in hooklist applying each one to argument running as lisp BOOLEAN Function Return true if the executable code is a Common Lisp application running in language KEYWORD Function Returns the keyword for the language the current implementation is running in running system information STRING Function Returns an information string about the current running system environment safe eq
123. he kv list Kv CONS Slot of Not documented empty self BOOLEAN Method on KEY VALUE LIST Not documented non empty self BOOLEAN Method on KEY VALUE LIST Not documented object equal x y OBJECT BOOLEAN Method on KEY VALUE LIST Return TRUE if x and y represent the same set of key value pairs equal hash code self INTEGER Method on KEY VALUE LIST Return an equal hash code for self Note that this is O N in the number of entries of self length self INTEGER Method on KEY VALUE LIST Not documented lookup self key LIKE ANY KEY SELF LIKE Method on KEY VALUE LIST ANY VALUE SELF Not documented reverse self LIKE SELF Method on KEY VALUE LIST Destructively reverse the members of the list self insert at self key LIKE ANY KEY SELF Method on KEY VALUE LIST value LIKE ANY VALUE SELF Insert the entry lt key value into the association self If a previous entry existed with key key that entry is replaced remove at self key LIKE ANY KEY SELF Method on KEY VALUE LIST OBJECT Remove the entry that matches the key key Return the value of the matching entry or NULL if there is no matching entry Assumes that at most one entry matches key insert entry self key LIKE ANY KEY SELF Method on KEY VALUE LIST value LIKE ANY VALUE SELF Insert an entry lt key value gt to self unless an identical entry already exists This
124. hing doesn t have a hierarchical structure it will just be printed Chapter 6 Library Functions 102 print recycle lists Function Print the current state of all recycle lists print spaces amp body body coNs OBJECT Macro print spaces stream N prints N spaces onto stream If no stream form is provided then STANDARD OUTPUT will be used print stella features Command Print the list of enabled and disabled STELLA features print unbound surrogates amp rest args OBJECT N Command Print all unbound surrogates visible from the module named by the first argument a symbol or string Look at all modules if no module name or null was supplied If the second argument is true only consider surrogates interned in the specified module print undefined methods module MODULE local BOOLEAN Function Print all declared but not yet defined functions and methods in module If local is true do not consider any parent modules of module If module is NULL look at all modules in the system This is handy to pinpoint forward declarations that haven t been followed up by actual definitions print undefined super classes class NAME N Command Print all undefined or bad indirect super classes of class private class methods class CLASS ITERATOR OF METHOD SLOT Function Iterate over all private methods attached to class private class storage slots class CLASS ITERATOR OF Function STO
125. in you disable the above feature with unset stella feature use common lisp structs Otherwise subsequent incremental translations in that Lisp image might fail since dif ferent translation schemes cannot be mixed If you already are using the struct version of STELLA all systems will be translated in struct mode by default To use the struct translation of your system you have to use the struct version of STELLA To do so do the following Chapter 4 Programming in STELLA 24 CL setq cl user load cl struct stella CL t CL 1oad load stella lisp Alternatively you can edit the initial value of the variable load cl struct stella in the file load stella lisp see also Section 2 3 Lisp Installation page 4 The reasons why the struct translation scheme is not enabled by default are the following Incremental redefinition of STELLA classes does not redefine any objects created with the old definition and hence slot accessors might simply break or retrieve the value of a different slot when applied to such an old object The programmer therefore has to be very careful when redefining a STELLA class while in struct mode This means that you should view the usage of the struct translation scheme for Lisp as a kind of delivery option similar to translating into C Part of the reason why slot access on CLOS object is expensive is the indirection machinery that allows redefinition of classes and their associated ins
126. ing prefix strings of string and string2 starting at position start1 and start2 respectively The search will end when end1 or end2 is reached If either end1 or end2 is null then they will be set to the length of their respective strings Chapter 6 Library Functions 87 find mismatch string1 STRING start1 INTEGER end1 INTEGER Function string2 STRING start2 INTEGER end2 INTEGER INTEGER INTEGER Finds the first position in each of string and string2 where they mismatch starting at position start1 and start2 respectively The search will end when end1 or end2 is reached If either endl or end2 is null then they will be set to the length of their respective strings If there is no mismatch then null values are returned first defined amp body forms coNS OBJECT Macro Return the result of the first form in forms whose value is defined or NULL otherwise float to base60 x FLOAT all integers BOOLEAN CONS OF Function NUMBER WRAPPER Returns a cons of x in a base 60 form That means the first value will be the integer part of x the next value the iteger value of the fraction part of x times 60 and the third value the fraction part of x time 3600 If all integers is true then the last value will be rounded to an integer This can be used to convert from decimal degree values to Degree Minute Second or from decimal hours to Hour Minute Second format fmod x FLOAT modulus FLOAT FLOAT Function True mo
127. it the initial value of the variable load cl struct stella in the file load stella lisp Using structs instead of CLOS objects greatly improves slot access speed however it may cause problems with incremental re definition of STELLA classes It is therefore recommended to only use this for systems that are in or near the production stage Once all the files are loaded you should see a message like this Initializing STELLA STELLA 3 4 0 loaded Type in package STELLA to execute STELLA commands USER 2 To reduce startup time you might want to create a Lisp image that has all of STELLA preloaded Now type in package STELLA to enter the STELLA Lisp package where all the STELLA code resides IMPORTANT All unqualified Lisp symbols in this document are assumed to be in the STELLA Lisp package Moreover the STELLA package does NOT inherit anything from the COMMON LISP package see the file sources stella cl lib cl setup lisp for the few exceptions hence you have to explicitly qualify every Lisp symbol you want to use with CL For example to get the result of the previous evaluation you have to type CL instead of Chapter 2 Installation 5 2 4 C Installation To compile the C version of STELLA change to the native C directory and run make cd native cpp stella make This will compile all STELLA files the garbage collector and generate a static or dynamic libstella library
128. ix Makefile For the Hello World system the system definition already exists and resides in the file sources systems hello world system ste By default STELLA looks in the directory sources systems to find the definition of a particular system hello world system ste defines two things 1 The HELLO WORLD module which defines a namespace for all objects in the Hello World systems STELLA modules are mapped onto corresponding native namespace constructs i e Lisp packages C namespaces or Java packages The exact mapping for each language can be defined via the keyword options lisp package cpp package and java package in the module definition for example defmodule HELLO WORLD lisp package STELLA cpp package hello_world java package edu isi hello world uses STELLA The uses directive tells STELLA from what other modules this one inherits 2 The actual system definitions defining what source files comprise the system and what parent systems this one depends on plus a variety of other options defsystem HELLO WORLD directory hello world required systems stella cardinal module HELLO WORLD production settings 1 0 3 3 development settings 3 2 3 3 files file a file b Chapter 4 Programming in STELLA 13 4 1 1 Hello World in Lisp To generate a Lisp translation of Hello World you can use either the Lisp C or Java version of STELLA Before you can translate y
129. ize string STRING STRING Function Return a capitalized version of string concatenate string string2 STRING Method on STRING amp rest otherStrings STRING STRING Return a new string representing the concatenation of stringl string2 and other Strings The two mandatory parameters allow us to optimize the common binary case by not relying on the somewhat less efficient variable arguments mechanism subsequence string start INTEGER end INTEGER STRING Method on STRING Return a substring of string beginning at position start and ending up to but not including position end counting from zero An end value of NULL stands for the rest of the string remove string char CHARACTER STRING Method on STRING Remove all occurences of char from string substitute self new char CHARACTER Method on STRING old char CHARACTER STRING Substitute all occurences of old char with new char in the string self substitute self new char CHARACTER Method on MUTABLE STRING old char CHARACTER MUTABLE STRING Substitute all occurences of old char with new char in the string self replace substrings string STRING new STRING old STRING Function STRING Replace all occurrences of old in string with new Chapter 6 Library Functions 35 instantiate string template template STRING Function amp rest vars amp values STRING STRING For each occurrence of a var string from vars amp values in tem
130. lasses functions and variables For example a module could inherit the class CONS from the STELLA module but shadow the function of the same name The above discussion of includes and uses semantics keyed on the inheri tance visibility of symbols The PowerLoom system makes another very important distinction If a module A is inherited directly or indirectly via includes specification s by a submodule B then all definitions and facts asserted in A are Chapter 6 Library Functions 64 visible in B This is not the cases for uses the uses options does not impact inheritance of propositions at all The list of modules specified in the includes option plus if supplied the parent in the path used for name become the new module s parents If no uses option was supplied the new module will use the STELLA module by default otherwise it will use the set of specified modules If case sensitive is supplied as TRUE symbols in the module will be interned case sensitively otherwise the default they will be converted to uppercase before they get interned That means that any reference from inside a case sensitive module to a non case sensitive module will have to use uppercase names for symbols in the non case sensitive module The standard system modules are all NOT case sensitive Modules can shadow definitions of functions and classes inherited from parents or used modules Shadowing is done automatically but generates a warni
131. lators null x BOOLEAN Method on INTEGER Return true if x is undefined handled specially by all translators null x BOOLEAN Method on FLOAT Return true if x is undefined handled specially by all translators defined x BOOLEAN Method on OBJECT Return true if x is defined handled specially by all translators defined x BOOLEAN Method on SECOND CLASS OBJECT Return true if x is defined handled specially by all translators defined x BOOLEAN Method on NATIVE VECTOR Return true if x is defined handled specially by all translators defined x BOOLEAN Method on STRING Return true if x is defined handled specially by all translators defined x BOOLEAN Method on MUTABLE STRING Return true if x is defined handled specially by all translators Chapter 6 Library Functions 27 defined x BOOLEAN Method on CHARACTER Return true if x is defined handled specially by all translators defined x BOOLEAN Method on CODE Return true if x is defined handled specially by all translators defined x BOOLEAN Method on INTEGER Return true if x is defined handled specially by all translators defined x BOOLEAN Method on FLOAT Return true if x is defined handled specially by all translators eq x UNKNOWN y UNKNOWN BOOLEAN Function Return true if x and y are literally the same object or simple number Analogue to the Common Lisp EQL and C and
132. ld use J28DK 1 4 or 1 5 We ve run the Java version of STELLA on a variety of platforms without any problems Any one of the Lisp C or Java implementations of STELLA can be used to develop your own STELLA code and translate it into all three languages but the most convenient Chapter 2 Installation 4 development environment is the one based on Lisp If you use the C or Java version translating and using your own STELLA macros is possible but not yet very well supported 2 2 Unpacking the Sources Uncompress and untar the file stella X Y Z tar gz or unzip the file stella X Y Z zip in the parent directory of where you want to install STELLA X Y Z are place holders for the actual version numbers This will create the STELLA tree in the directory stella X Y Z All pathnames mentioned below will be relative to that directory which we will usually refer to as the STELLA directory 2 3 Lisp Installation To install the Lisp version startup Lisp and load the file load stella lisp with CL load load stella lisp The first time around this will compile all Lisp translated STELLA files before they are loaded During subsequent sessions the compiled files will be loaded right away If you want to use the version that uses Lisp structs instead of CLOS objects to implement STELLA objects do the following CL setq cl user load cl struct stella CL t CL 1oad load stella lisp Alternatively you can ed
133. le The supported parameters are LOG LEVELS a cons list of legal levels in ascending log level order for example NONE LOW MEDIUM HIGH or 0 1 2 3 LEVEL the current log level for module STREAM the stream to log to defaults to STANDARD OUTPUT PREFIX the prefix to use to identify the module defaults to module MAX WIDTH logging output lines will be kept to approximately this width defaults to 10000 minimum width of about 30 is used to print line header information set optimization levels safety INTEGER debug INTEGER Function speed INTEGER space INTEGER Set optimization levels for the qualities safety debug speed and space set stella feature amp rest features KEYWORD Command Enable all listed STELLA features Chapter 6 Library Functions 106 set translator output language new language KEYWORD Command KEYWORD Set output language to new language Return previous language setq variable SYMBOL expression CONS OBJECT Macro Assign variable the result of evaluating expression and return TRUE if expression is not NULL else return FALSE shadowed symbol symbol GENERALIZED SYMBOL BOOLEAN Function Return true if symbol is shadowed in its home module shift right arg count INTEGER INTEGER Method on INTEGER Shift arg to the right by count positions and 0 extend from the left if arg is positive or l extend if it is negative This is an arithmetic shift that pre
134. le size prime minSize INTEGER INTEGER Function Return a hash table prime of at least minSize plist to kvlist self PROPERTY LIST KEY VALUE LIST OF LIKE Function ANY KEY SELF LIKE ANY VALUE SELF Convert self into a key value list with identical and identically ordered keys and values plus x BOOLEAN Method on INTEGER Return true if x is greater than 0 plus x BOOLEAN Method on LONG INTEGER Return true if x is greater than 0 primary type self TYPE Method on OBJECT Returns the primary type of self Gets defined automatically for every non abstract subclass of OBJECT primitive self BOOLEAN Method on RELATION Return true if self is not a defined relation print amp body body CONS OBJECT Macro Print arguments to the standard output stream print exception context e NATIVE EXCEPTION Function stream OUTPUT STREAM Prints a system dependent information about the context of the specified exception For example in Java it prints a stack trace In Lisp it is vendor dependent print outline thing OBJECT stream OUTPUT STREAM Command depth INTEGER named BOOLEAN Print an outline of thing and its subparts on stream If depth is non negative only depth levels will be printed If named is TRUE then only named entities will be printed This function is intended to be used on things like modules contexts concepts etc that have hierarchical structure If t
135. lean method code METHOD CODE Function arguments CONS OF OBJECT BOOLEAN Apply code to arguments returning a value of type BOOLEAN apply float method code METHOD CODE Function arguments CONS OF OBJECT FLOAT Apply code to arguments returning a value of type FLOAT apply integer method code METHOD CODE Function arguments CONS OF OBJECT INTEGER Apply code to arguments returning a value of type INTEGER apply long integer method code METHOD CODE Function arguments CONS OF OBJECT LONG INTEGER Apply code to arguments returning a value of type LONG INTEGER apply method code METHOD CODE arguments CONS OF OBJECT Function OBJECT Apply code to arguments returning a value of type OBJECT apply string method code METHOD CODE Function arguments CONS OF OBJECT STRING Apply code to arguments returning a value of type STRING base60 to float CONS OF NUMBER WRAPPER FLOAT Function Converts x y z into a float The return value is x y 60 z 3600 This can be used to convert from Degree Minute Second to decimal degrees or from Hour Minute Second format to decimal hours break program message STRING Function Interrupt the program and print message Continue after confirmation with the user bump log indent Command Increase the indentation level for subsequent log messages byte array read sequence buffer TOKENIZER BYTE ARRAY Function strea
136. least one of the operands is a subtype of STANDARD OBJECT it will translate the test into a fast pointer comparison with the Lisp function CL eq or the C Java operator However if both operands are of type OBJECT they might be wrapped literals such as wrapped integers or strings In that case the equality test translates into a call to the function eq1 which in turn uses method calls to handle comparison of different types of wrapped literals two wrapped literals are equal if their wrapped content is equal This is of course a lot less efficient than a simple pointer comparison It also means that if you can restrict the type of a variable that will be tested with eql to STANDARD OBJECT you probably should do so for performance reasons Type tests Run time type tests as used implicitly within a typecase or explicitly with functions such as cons have to use a call to the method primary type Hence in performance critical portions of your code you should try to keep the number of such tests as small as possible Wrapping and unwrapping literals The STELLA translator automatically wraps or objectifies literals such as numbers or strings when they are stored in a variable or slot of type OBJECT Similarly it unwraps wrapped literals automatically to operate on the literal directly This is very convenient since it relieves the programmer from having to perform these conversions by hand and makes the code less cluttered For example con
137. lendar date with current time and date make date time year INTEGER month INTEGER day INTEGER Function hour INTEGER minute INTEGER second INTEGER millis INTEGER timezone FLOAT CALENDAR DATE Create a calendar date with the specified components year must be the complete year i e a year of 98 is 98 A D in the 1st century timezone is a real number in the range 12 0 to 14 0 where UTC is zone 0 0 The number is the number of hours to add to U TC to arrive at local time parse date time date time string STRING start INTEGER Function end INTEGER error on mismatch BOOLEAN DECODED DATE TIME Tries very hard to make sense out of the argument date time string and returns a time structure if successful If not it returns null If error on mismatch is true parse date time will signal an error instead of returning null Default values are 00 00 00 local time on the current date decode calendar date date timezone FLOAT Method on CALENDAR DATE DECODED DATE TIME Returns a decoded time object for date interpreted in timezone timezone is the num ber of hours added to UTC to get local time It is in the range 12 0 to 14 0 where UTC is zone 0 0 encode calendar date time structure Method on DECODED DATE TIME CALENDAR DATE Returns a calendar date object for time structure calendar date to string 7 Not yet implemented string to calendar date input STRING CALENDAR DATE Function Returns a
138. length of the string self length self INTEGER Method on MUTABLE STRING Return the length of the string self member self char CHARACTER BOOLEAN Method on STRING Not documented position string character CHARACTER start INTEGER Method on STRING INTEGER Return the position of character within string counting from zero or return NULL if character does not occur within string If start was supplied as non NULL only consider the substring starting at start however the returned position will always be relative to the entire string Chapter 6 Library Functions 34 last position string character CHARACTER end INTEGER Method on STRING INTEGER Return the last position of character within string counting from zero or return NULL if character does not occur within string If end was supplied as non NULL only consider the substring ending at end however the returned position will always be relative to the entire string string search string STRING substring STRING start INTEGER Function INTEGER Return start position of the left most occurrence of substring in string beginning from start Return NULL if it is not a substring copy string STRING Method on STRING Return a copy of string string upcase string STRING STRING Function Return an upper case copy of string string downcase string STRING STRING Function Return a lower case copy of string string capital
139. llowing it In the Lisp buffer you can achieve a similar effect with the 1ptrans macro For example executing 1ptrans defun factorial INTEGER n INTEGER Chapter 4 Programming in STELLA 19 if eql n 0 return 1 return n factorial 1 n in the Lisp buffer first Lisp translates the definition and then prints the translation To see the C translation you can use cpptrans calling jptrans will generate the Java translation You can also use 1ptrans cpptrans jptrans to translate code fragments that are not top level definitions such as defun and its friends For example STELLA 8 lptrans foreach element in list 1 2 3 do print element EOL CL LET ELEMENT NULL ITER 003 THE CONS LIST LIST WRAP INTEGER 1 WRAP INTEGER 2 WRAP INTEGER 3 CL LOOP WHILE CL NOT CL EQ ITER 003 NIL DO CL PROGN SETQ ELEMENT A4VALUE ITER 003 SETQ ITER 003 4ZREST ITER 003 AAPRINT STREAM ANATIVE STREAM STANDARD OUTPUT ELEMENT EOL O STELLA 9 cpptrans foreach element in list 1 2 3 do print element EOL Object element NULL Cons iter004 list 3 wrapInteger 1 wrapInteger 2 wrapInteger 3 gt theConsList while iter004 NIL element iter004 gt value iter004 iter004 gt rest cout lt lt element lt lt endl VOID STELLA 10 jptrans foreach element in list 1 2 3 do print element EOL Stella_Object element null Cons iter0
140. lo world Hello World A Hello World B bye 4 1 3 Hello World in Java To generate a Java translation of Hello World you can use either the Lisp C or Java version of STELLA Before you can translate you have to make sure the following native directory exists native java edu isi hello world The directory native java edu isi hello world will hold the Java translations of the corresponding STELLA source files If you create your own system you will need to create this directory by hand future versions of STELLA might do that automatically For the Hello World system the directory already exist Note that following Java convention we use the package edu isi hello world to hold the Hello World system This was specified via the java package option in the definition of the HELLO WORLD module Also note that we use hello world instead of hello world as the package name since a dash cannot legally appear as part of a Java identifier To generate a Java translation of Hello World using Lisp startup a Lisp version of STELLA see Section 2 3 Lisp Installation page 4 The following idiom will then translate the system into Java The first argument to make system is the name of the system and the second argument indicates into what language it should be translated STELLA 5 make system hello world java Processing tmp stella 3 1 0 sources hello world file a ste Pass 1 generating objects Writing tmp stella
141. lues for missing fields and the interpretation of relative refer ences come from default date If the default date is null the current date will be used If a null set of defaults is desired use NULL DECODED DATE TIME If no valid parse is found null is returned string to decoded date time input STRING Function DECODED DATE TIME Returns a decoded date time object representing the date and time parsed from the input string If no valid parse is found null is returned string to surrogate self STRING SURROGATE Function Return a surrogate with the name self visible in the current module Very tricky The logic is designed to avoid returning an inherited surrogate that has no value In that case a new local surrogate is created that shadows the inherited surrogate string to time duration duration STRING TIME DURATION Function Parses and returns an time duration object corresponding to duration The syntax for time duration strings is plus minus N days M ms where N and M are integer values for days and milliseconds If no valid parse is found null is returned subclass of subClass CLASS superClass CLASS BOOLEAN Function Return true if subClass is a subclass of superClass subsequence string start INTEGER Method on MUTABLE STRING end INTEGER STRING Return a substring of string beginning at position start and ending up to but not including position end counting from zero An end value o
142. m INPUT STREAM start INTEGER end INTEGER INTEGER Read from stream filing buffer between start and end depending on how many characters are available Return the actual end pointer to the input read into buffer EOF is indicated by the return value being equal to start byte array write sequence buffer TOKENIZER BYTE ARRAY Function stream NATIVE OUTPUT STREAM start INTEGER end INTEGER Write from buffer to stream using data in the buffer starting at position start stopping just before end calendar date to date string date Method on CALENDAR DATE timezone FLOAT numeric month BOOLEAN STRING Returns the date part of the string representation of date adjusted for timezone Format is Y Y Y Y MMM DD where MMM is a three letter English abbreviation of the month if numeric month is false and a two digit numeric value if numeric month is true The value false is recommended Chapter 6 Library Functions 78 calendar date to iso8601 string date Method on CALENDAR DATE timezone FLOAT include timezone BOOLEAN STRING Returns an ISO 8601 string representation of date adjusted for timezone The Format is YYYY MM DDThh mm ss z zz The timezone as an offset hh mm is included if include timezone is true Recommended values for the flag is true calendar date to string date timezone FLOAT Method on CALENDAR DATE numeric month BOOLEAN include timezone BOOLEAN STRING Returns a string representation
143. mbol value is simply a special property that can always be accessed in constant time The symbol value of a symbol can be changed with setf symbolize surrogate SURROGATE SYMBOL Function Convert surrogate into a symbol with the same name and module 6 14 Context and Modules get stella context pathName STRING error BOOLEAN CONTEXT Function Return the context located at pathName or null if no such context exists If error is true throw an exception if no context is found otherwise silently return null clear context self CONTEXT Function Destroy all objects belonging to self or any of its subcontexts within context contextForm OBJECT amp body body CONS OBJECT Macro Execute body within the context resulting from contextForm Chapter 6 Library Functions 63 destroy context self Method on CONTEXT Make the translator happy destroy context self Method on STRING Destroy the context self and recursively destroy all contexts that inherit self change context context CONTEXT Method on CONTEXT Change the current context to be the context context change context contextName CONTEXT Method on STRING Change the current context to be the context named contextName cc amp rest name NAME CONTEXT N Command Change the current context to the one named name Return the value of the new current context If no name is supplied return the pre existing value of the current context
144. modulo Note In C and Java mod has more overhead than the similar function rem The answers returned by mod and rem are only different when the signs of x and modulo are different multiple parents class BOOLEAN Method on CLASS Return true if class has more than one direct superclass Chapter 6 Library Functions 99 multiple parents module BOOLEAN Method on MODULE Return TRUE if module has more than one parent multiple parents world BOOLEAN Method on WORLD Return FALSE always since worlds never have more than one parent name to string name OBJECT STRING Function Return the string represented by name Return null if name is undefined or does not represent a string native read line inputStream INPUT STREAM STRING Function Read one line from inputStream using the native language readline algorithm and return the result On EOF return null next self BOOLEAN Method on MEMOIZABLE ITERATOR Generate the next value of the memoized iterator self or one of its clones by either using one of the values generated so far or by generating and saving the next value of the base iterator no duplicates self BOOLEAN Method on COLLECTION Return true if the collection self forbids duplicate values non empty x BOOLEAN Method on STRING WRAPPER Return true if x is not the wrapped empty string non empty self BOOLEAN Method on VECTOR SEQUENCE Return true if self has length gt 0
145. n 2 7 Removing Unneeded Files page 6 To run the Lisp version of STELLA you need an ANSI Common Lisp or at least one that supports CLOS and logical pathnames We have successfully tested STELLA with Allegro CL 4 2 4 3 5 0 6 0 and 7 0 Macintosh MCL 3 0 4 0 and 5 1 OpenMCL 1 0 SBCL 0 9 4 CMUCL 19c LispWorks 4 4 6 CLisp 2 37 Lucid CL 4 1 plus the necessary ANSI extensions and Mark Kantrowitz s logical pathnames implementation and various others Our main development platform is Allegro CL running under Sun Solaris and Linux so the closer your environment is to ours the higher are the chances that everything will work right out of the box Lisp development under Windows should also be no problem To run the C version of STELLA you need a C compiler such as g that supports templates and exception handling We have successfully compiled and run STELLA with g 3 2 and later under Linux Redhat 8 0 amp 9 0 SunOS and MacOS X and with CygWin 5 0 and MinGW 5 0 under Windows 2000 and XP Both CygWin and MinGW provide a GNU Unix environment but MinGW can generate Windows executables that are fully standalone We ve also managed to compile STELLA under MS Visual C however we never got the Boehm garbage collector to work The GC claims to be very portable so this should be solvable for somebody with good knowledge of MS Visual C For the Java version you will need Java JDK 1 2 or later To get reasonable performance you shou
146. n be set with setf Note that first NIL null second self LIKE ANY VALUE SELF Method on CONS Return the second element of self The second element of self can be set with setf Note that second NIL null third self LIKE ANY VALUE SELF Method on cons Return the third element of self The third element of self can be set with setf Note that third NIL null fourth self LIKE ANY VALUE SELF Method on CONS Return the fourth element of self The fourth element of self can be set with setf Note that fourth NIL null fifth self LIKE ANY VALUE SELF Method on CONS Return the fifth element of self The fifth element of self can be set with setf Note that fifth NIL null nth self position INTEGER LIKE ANY VALUE SELF Method on CONS Return the element of self at position The nth element of self can be set with setf Note that nth NIL lt pos gt null nth rest self position INTEGER LIKE SELF Method on CONS Apply rest position times to self last self LIKE ANY VALUE SELF Method on CONS Return the last element of self but last self ITERATOR OF LIKE ANY VALUE SELF Method on CONS Generate all but the last element of the cons list self last cons self coNs CONS OF LIKE ANY VALUE SELF Function Return the last cons of self length self INTEGER Method on CONS Return the length of the CONS list self member
147. n class lookup logging parameter module STRING parameter KEYWORD Function default OBJECT OBJECT Lookup logging parameter for module Use default if no value is defined lookup macro name SYMBOL METHOD SLOT Function If name has a macro definition return the method object holding its expander func tion lookup slot class CLASS slot name SYMBOL SLOT Function Return a slot owned by the class class with name slot name Multiply inherited slots are disambiguated by a left to right class precedence order for classes with multiple parents similar to CLOS lookup with default self Method on PROPERTY LIST key LIKE ANY KEY SELF default LIKE ANY VALUE SELF LIKE ANY VALUE SELF Lookup key in self and return the result Return default if no value was found lookup with default self Method on KEY VALUE LIST key LIKE ANY KEY SELF default LIKE ANY VALUE SELF LIKE ANY VALUE SELF Lookup key in self and return the result Return default if no value was found Iptrans statement OBJECT N Command Translate statement to Common Lisp and print the result make matching name original STRING amp rest options OBJECT Function STRING Keyword options break on cap one of YES NO CLEVER default is CLEVER break on number one of YES NO CLEVER default is CLEVER break on separators string default is _ remove prefix string remove suffix string case one of
148. n daystarts at noon modified julian day to julian day modified julian day INTEGER Function INTEGER Returns the modified Julian day during which julian daystarts at noon time add t1 DATE TIME OBJECT t2 DATE TIME OBJECT Function DATE TIME OBJECT Add t1 to t2 If one of t1 or t2 is a calendar date then the result is a calendar date If both t1 and t2 are relative dates then the result is a relative date t1 and t2 cannot both be calendar dates time divide t1 TIME DURATION t2 OBJECT OBJECT Function Divides the relative date t1 by t2 t2 must be either a relative date or a wrapped number If t2 is a relative date then the return value will be a wrapped float If t2 is a wrapped number then the reutrn value will be a relative date time multiply t1 OBJECT t2 OBJECT TIME DURATION Function Multiplies a relative date by a wrapped number One of t1 or t2 must be a relative date and the other a wrapped number Chapter 6 Library Functions 71 time subtract t1 DATE TIME OBJECT t2 DATE TIME OBJECT Function DATE TIME OBJECT Subtract t2 from t1 If t1 is a calendar date then t2 can be either a calendar date in which case the return value is a relative date or it can be a relative date in which case the return value is a calendar date If t1 is a relative date then 2 must also be a relative date and a relative date is returned get ticktock TICKTOCK Function Return the current CPU tim
149. n that indents outline printings for level current depth on stream using the value of the global variable OUTLINE INDENT STRING Chapter 6 Library Functions 91 inform amp body body cons OBJECT Macro Print informative message placing non string arguments in quotes and terminating with a newline initial value self oBJECT Method on cLass Return an initial value for the class self initial value self oBJECT Method on STORAGE SLOT Return an initial value for self or null The initial value can be defined by the slot itself inherited from an equivalent slot or inherit from the initial value option for the class representing the type of self initialize array self Method on DIMENSIONAL ARRAY MIXIN initialValue LIKE ANY VALUE SELF Initialize the elements of self with initial Value initialize hash table self Method on STELLA HASH TABLE Initialize the STELLA hash table self This is a no op and primarily exists to shadow the standard initializer inherited from ABSTRACT HASH TABLE STELLA hash tables are initialized at the first insertion operation initially self OBJECT Method on STORAGE SLOT Defines the value of a slot before it has been assigned a value insert self Method on CUSTOM VECTOR SEQUENCE value LIKE ANY VALUE SELF Append value to the END of the sequence self Resize the array if necessary insert self value LIKE ANY VALUE SELF Method on HEAP Insert val
150. n the Hello World system like this cd native java javac edu isi hello world java java edu isi hello world HelloWorld Hello World A Hello World B bye It is not necessary to Java compile STELLA first since STELLA already ships with a Java compilation of the STELLA system 4 2 Incrementally Developing STELLA Code The preferred method of STELLA code development is to use a Lisp based version of STELLA for all the prototyping and testing since that allows you to exploit most or all of the rapid prototyping advantages of Lisp Once a system has reached a certain point of stability it can be translated into C or Java for delivery or to interface it with other C or Java code In the following we assume an X Emacs based Lisp development environment such as the Allegro CL Emacs interface where Lisp is run in an Emacs subprocess and Lisp source can be compiled and evaluated directly from the source buffers By Lisp buffer we mean the listener buffer in which Lisp is actually running and by source buffer we mean a buffer that is used to edit a file that contains STELLA source Included in the distribution is the Hello World system comprised of the files sources systems hello world system ste sources hello world file a ste sources hello world file b ste To get started simply add your code to either file a ste or file b ste since all the necessary definitions and directories for these files are already s
151. name and return it Return the bare symbol name as the second value name does not necessarily have to be qualified in which case the current module is returned name is assumed to be the printed representation of a STELLA symbol surrogate or keyword configure stella file FILE NAME Function Perform STELLA run time configuration If supplied load the configuration file file first which should be supplied with a physical pathname consify self CONS Method on OBJECT If object is a CONS return it Otherwise return a singleton cons list containing it consify command line arguments count INTEGER Function arguments ARRAY OF STRING CONS OF STRING WRAPPER Convert count command line arguments into a CONS list continuable error amp body body CONS OBJECT Macro Signal error message placing non string arguments in quotes copy self VECTOR SEQUENCE OF LIKE Method on VECTOR SEQUENCE ANY VALUE SELF Return a copy of the vector sequence self copy self CUSTOM VECTOR SEQUENCE Method on CUSTOM VECTOR SEQUENCE OF LIKE ANY VALUE SELF Return a copy of the vector sequence self cpp translate system systemName STRING Function Translate the system systemName to C cpptrans statement OBJECT N Command Translate statement to C and print the result create derived list self LIsT LIST Function Create a new list object with the same type as self create object ty
152. native C class is not redefined define stella method slot inputname SYMBOL returntypes CONS Function function BOOLEAN inputParameters CONS options KEYWORD KEY VALUE LIST METHOD SLOT Define a new Stella method object a slot and attach it to the class identified by the first parameter in inputParameters defined x BOOLEAN Method on LONG INTEGER Return true if x is defined handled specially by all translators defined x BOOLEAN Method on ARRAY Return true if x is defined handled specially by all translators defmain varList CONS amp body body CONS OBJECT Macro Defines a function called MAIN which will have the appropriate signature for the tar get translation language The signature will be C public static int main int v1 char v2 lt body gt Java public static void main String v2 lt body gt Lisp de fun main amp rest args lt body gt The argument varList must have two symbols which will be the names for the INTEGER argument count and an array of STRINGs with the argument values It can also be empty to indicate that no command line arguments will be handled The startup function for the containing system will auto matically be called before body is executed unless the option STARTUP SYSTEM was supplied as FALSE There can only be one DEFMAIN per module defsystem name SYMBOL amp rest options OBJECT N Command SYSTEM DEFINITION Define a system of files
153. nction Switch between Common Lisp and C as output languages Chapter 6 Library Functions 110 tokenize string string STRING punctuationchars STRING Function quotechars STRING escapechars STRING CONS OF CONS Simple tokenizer that is somewhere between Java s StringTokenizer and StreamTo kenizer in functionality It doens t specially support number tokens nor comment strings sequences even though this could be added at the expense of some extra com plexity Returns a list of lt token string gt lt token type gt pairs where the token type is one of TEXT PUNCTUATION or QUOTE i e all white space is ignored and escape characters are handled and removed For example tokenize string for i fo o0 i 0 i e4 4 me gt for TEXT PUNCTUATION i TEXT PUNCTUATION QUOTE fo o TEXT QUOTE PUNCTUATION i TEXT PUNCTUATION O TEXT PUNCTUATION i TEXT PUNCTUATION NOTE this aggregates multiple punctuation characters that immediately follow each other into a single token which is generally useful to pickup multi character operators such as gt etc It s still easy to pick them apart in a post processing step if necessary e g for the case above so we leave this for now as a feature trace if keyword oBJECT amp body body CONS OBJECT Macro If keyword is a trace keyword that h
154. nd has at least some familiarity with C or Java Let us start with a cursory overview of STELLA s main features Syntax STELLA uses a parenthesized uniform expression syntax similar to Lisp Most definitional constructs and control structures are similar to their Common Lisp analogues with variations to support types Type system STELLA is strongly typed and supports efficient static compilation similar to C Types are required for the arguments and return values of functions and methods for global variables and for slot definitions Local lexically scoped variables can be typed implicitly by relying on type inference Object system Types are organized into a single inheritance class hierarchy Restricted multiple inheritance is allowed via mixin classes Dynamic method dispatch is based on the runtime type of the first argument similar to C and Java Slots can be static native or dynamic Dynamic slots can be defined at runtime and do not occupy any space until they are filled Slots can have both initial and default values and demons can be triggered by slot accesses A meta object protocol allows the control of object creation initialization termination and destruction Control structure Functions and methods are distinguished They can have multiple zero or more return values and a variable number of arguments Lisp style macros are supported to facilitate syntax extensions Expressions and statements are distinguished
155. nd need to do some extra masking unstringify stella source source STRING module MODULE Function OBJECT Unstringify a STELLA source string relative to module or MODULE if no module is specified This function allocates transient objects as opposed to unstringify in module or the regular unstringify unwrap boolean wrapper BOOLEAN WRAPPER BOOLEAN Function Unwrap wrapper and return its values as a regular BOOLEAN Map NULL onto FALSE unwrap function code wrapper FUNCTION CODE WRAPPER Function FUNCTION CODE Unwrap wrapper and return the result Return NULL if wrapper is NULL unwrap long integer wrapper LONG INTEGER WRAPPER Function LONG INTEGER Unwrap wrapper and return the result Return NULL if wrapper is NULL unwrap method code wrapper METHOD CODE WRAPPER Function METHOD CODE Unwrap wrapper and return the result Return NULL if wrapper is NULL value setter self Method on ABSTRACT DICTIONARY ITERATOR value LIKE ANY VALUE SELF LIKE ANY VALUE SELF Abstract method needed to allow application of this method on abstract iterator classes that do not implement it By having this here all next methods of dictionary iterators MUST use the slot value paradigm to set the iterator value warn amp body body CONS OBJECT Macro Signal warning message placing non string arguments in quotes with network stream binding CONS amp body body CONS OBJECT Macro Sets up an
156. ng of self to avoid this self should not be pointed to by anything other than the tail of the prepended copy Chapter 6 Library Functions 39 pushq variable SYMBOL value OBJECT OBJECT Macro Push value onto the cons list variable pushq new variable SYMBOL value OBJECT OBJECT Macro Push value onto the cons list variable unless value is already a member of the list popq variable SYMBOL OBJECT Macro Pops a value from the cons list variable cons list amp rest values OBJECT CONS Function Return a cons list containing values in order list amp rest values OBJECT CONS Function Return a list of conses that make up the list values terminated by the last value rather than by nil Assumes that at least one value is passed in copy cons list self CONS LIKE SELF Function Return a copy of the cons list self copy cons tree self OBJECT LIKE SELF Function Return a copy of the cons tree self substitute cons tree tree OBJECT newValue OBJECT Function old Value OBJECT OBJECT Destructively replace each appearance of old Value by newValue in the cons tree tree Return the tree Uses an eql test search cons tree tree OBJECT value OBJECT BOOLEAN Function Return true iff the value value is embedded within the cons tree tree Uses an eq1 test tree size self OBJECT INTEGER Function Not documented safe tree size tree CONS INTEGER STRING
157. ng unless the shadowed type or function name is listed in the shadow option of the module definition Examples defmodule PL KERNEL PL USER uses LOGIC STELLA package PL USER defmodule PL USER GENEALOGY The remaining options are relevant only for modules that contain STELLA code Modules used only to contain knowledge base definitions and assertions have no use for them The keywords lisp package java package and cpp package specify the name of a native package or name space in which symbols of the module should be allocated when they get translated into one of Lisp Java or C By default Lisp symbols are allocated in the STELLA package and C names are translated without any prefixes The rules that the STELLA translator uses to attach translated Java objects to classes and packages are somewhat complex Use java package option to specify a list of package names separated by periods that prefix the Java object in this module Use java catchall class to specify the name of the Java class to contain all global amp special variables parameter less functions and functions defined on arguments that are not classes in the current module The default value will be the name of the module When set to TRUE the api option tells the PowerLoom User Manual generator that all functions defined in this module should be included in the API section Ad ditionally the Java translator makes all API functions synchronized
158. ni 86 falS6lr46 otitis eaddas Pees EM HERE 26 fast heap root on HEAP 2 zia eo pie 86 fifth On CONS ceon Sens bade aes aot eer S 3T frfth orn EIST 55e xetnvedb5esenscteUMeenD E 42 fifth on MUTABLE STRING lesse 33 fifth orb STRING oenina b 9RIpG UR EY eae team 39 fifth on VECTOR 3iii oIisere ree sees 50 file base name 2 2 2 44d ed red RR 68 file xtensiOn g s dau deg RRREGUE E 68 file length 502exne md Rh dcs hand 67 file name as directory ss 68 file name directory ou rs 68 file name without directory 68 file name without extension 68 file write d te 2 aitaa rne 67 fill in date substitution 86 finaliz classSesS 2 ca ga f d p ae sarees 86 finalize classes and slots 86 finaljze sSLotg8 22223322222 e daca hn UNS and 86 find matching prefix length 86 find mismatch i ibe A Xa awe bera 87 find or create module 64 first ON ICONS 22222229 tes cde CERE he es or first On LIST zv ewe 3b EX EBORE YES 3E 42 first on MUTABLE STRING esses 32 first On STRING errien aerei aeea kep a iG 32 first On VECTOR o receret raag Er E 50 first defuined ccu reeeRIDPCIReY eva teat 87 float to base60 iie Ter ECRIRE 87 float to string i i i s sac hbE T Pea ds 30 35 EO O56 PEU 29 flush output 2 ieri PR RR 66 EMO TTE 87 format float o veda e wwe ede teas 30
159. nsify On ITERATOR crocie dreni tnnt rinni 60 consify on KEY VALUE LIST see 49 consify on KEY VALUE MAP s n 5T consify On LIST ez er e rep b RE ER e 44 consify on OBJECT cd ken 81 consify on STELLA HASH TABLE 54 consify On VECTOR iie Ree is ESAE 51 consify command line arguments 81 continuable error i eder need es 81 copy on CUSTOM VECTOR SEQUENCE 81 copy On HASH SET vci gs e rrr Rr d eee 58 copy on KEY VALUE LIST seen 49 copy on KEY VALUE MAP een nn 5T CODy OH LIST cnecnrepebgeenerestueeeererierv 44 copy On PROPERTY LIST i i io eere S AT copy on STELLA HASH TABLE esee 54 COPY ON STRING ca sce uianga u epia i 34 copy OD VECTOR zres ivp6eqemebpeeRP MT ay dee RE 51 copy on VECTOR SEQUENCE eene 81 COpy ConS lISt 4 eu Da hx e ERU bd 39 COPY CONS TTS e ainiai ni Aran pd dt teense bs 39 COpy file de itar uem Hee ed ee 67 copy kv con8 liSt i x oggi ere bee 47 COS sob doa des ora deene DRTE GR or a Pe d ab dip 29 Function Index cpp translate system rer se ces 81 Cpptfa8ng icomerss espere ena sek pibe Vs 81 cre te derived li3st as 81 creat obJe6t soon Lb ede edges 81 Greate world m jc RD RIS pev 65 D deactivate demon lil else 82 decode calendar date on CALENDAR DATE 69 decode time in millis 70 decoded date time to iso8601 string on DECODED DATE TIME esee 82 d
160. nted nth self position INTEGER LIKE ANY VALUE SELF Method on VECTOR Not documented last self LIKE ANY VALUE SELF Method on VECTOR Return the last item in the vector self but last self ITERATOR OF LIKE ANY VALUE SELF Method on VECTOR Generate all but the last element of the vector self length self INTEGER Method on VECTOR Not documented member self object OBJECT BOOLEAN Method on VECTOR Not documented position self object OBJECT start INTEGER INTEGER Method on VECTOR Return the position of object within the vector self counting from zero or return null if object does not occur within self uses an eq1 test If start was supplied as non null only consider the portion starting at start however the returned position will always be relative to the entire vector last position self object OBJECT end INTEGER INTEGER Method on VECTOR Return the position of object within the vector self counting from zero or return null if object does not occur within self uses an eql test If end was supplied as non null only consider the portion ending at index end however the returned position will always be relative to the entire vector Chapter 6 Library Functions 51 insert at self offset INTEGER Method on VECTOR value LIKE ANY VALUE SELF Not documented copy self VECTOR OF LIKE ANY VALUE SELF Method on VECTOR Return a
161. o s expression If startTagName is non null skip all tags until a start tag matching start tag is encountered XML namespaces are ignored for outside of the start tag Use s expression representation to specify start tag e g KIF version 1 0 The tag can be an XML element object a symbol a string or a cons If the tag is a cons the first element can also be name namespace pair Return true as the second value on EOF CHANGE WARNING It is anticipated that this function will change to a Properly take XML namespaces into account and b require XML element objects instead of strings as the second argument This change will not be backwards compatible xml expressions stream INPUT STREAM regionTag OBJECT Function XML EXPRESSION ITERATOR Return an XML expression iterator which see reading from stream regionTag can be used to define delimited regions from which expressions should be considered Use s expression representation to specify region Tag e g KIF version 1 0 The tag can be an XML element object a symbol a string or a cons If the tag is a cons the first element can also be name namespace pair print xml expression stream OUTPUT STREAM Function xml expression CONS indent INTEGER Prints xml expression on stream Indentation begins with the value of indent If this is the null integer no indentation is performed Otherwise it should normally be specified as 0 zero for top level calls
162. object return it seed random number generator Function Seeds the random number generator with the current time sequence collectiontype TYPE amp rest values OBJECT SEQUENCE OF Function OBJECT Return a sequence containing values in order set call log break point count INTEGER Command Set a call log break point to count Execution will be interrupted right at the entry of the countth logged function call set configuration property property STRING value OBJECT Function configuration CONFIGURATION TABLE OBJECT Set property in configuration to value and return it Use the global system configu ration table if configuration is NULL set current date values structure Method on DECODED DATE TIME Sets the current date into values structure set current date time values structure Method on DECODED DATE TIME Sets the current date and time into values structure set current time values structure Method on DECODED DATE TIME Sets the current time into values structure set global value self SURROGATE value OBJECT OBJECT Function Set the value of the global variable for the surrogate self to value set log level module sTRING level OBJECT Command Set the log level for module to level This is a convenience function for this common operation set logging parameters module STRING Command amp rest params amp values OBJECT Set logging parameters for modu
163. of date adjusted for timezone The Format is Y Y Y Y MMM DD hh mm ss z z where MMM is a three letter English abbreviation of the month if numeric month is false and a two digit numeric value if numeric month is true The timezone as a float offset z z is included if include timezone is true Recommended values for the flags are false and true respectively calendar date to time string date Method on CALENDAR DATE timezone FLOAT include timezone BOOLEAN include millis BOOLEAN pad hours BOOLEAN STRING Returns the time part of the string representation of date adjusted for timezone The timezone is included in the string if include timezone is true The value true is recommended Milliseconds will be included if include millis is true Hours will be zero padded to length 2 if pad hours is true call clear module amp rest name NAME Command Destroy all objects belonging to module name or any of its children If no name is supplied the current module will be cleared after confirming with the user Important modules such as STELLA are protected against accidental clearing cast value OBJECT type TYPE OBJECT Function Perform a run time type check and then return value ccc amp rest name NAME CONTEXT N Command Change the current context to the one named name Return the value of the new current context If no name is supplied return the pre existing value of the current context cc is a no op if the
164. ogate nam T 2s cine dared age dbi 109 surrogatify on STRING 05 109 surrogatify on SURROGATE 109 surrogatify on SYMBOL s s serere eresas s 109 sweep on OBJECT 0 cece n nnn 109 symbol plist i mau me pe b n 62 123 symbol property ck e db peres 62 Symbol to surrogat lese eios es 109 Symbol to type 2 6 ee et REPRRRDDE 109 Symbol value iig eser uer b RAP aces 62 SYMDOVIUZS E MEE 62 system default value on SLOT 109 system default value on STORAGE SLOT 109 system loaded or started up 109 system loaded salei o ne e ei EDI 109 T pru TT 29 terminate program s rts 109 third On CONS ides xe ERR CHR Pape 37 third On LIST 5 beri gs eR ERRARE 42 third on MUTABLE STRING sese 33 third on STRING esee 33 third on VECTOR lesse eee 50 ticktock difference losa en 71 ticktock resolution sg etr 71 time add ut epe eh cae hee neces 70 GAME HGIVAS meiden b ve nti estu hee 70 time duration to string on TIME DURATION dunque Wadi EEEE RERE EERE bed d ies 109 time m ltipby ceieid e drkueb ed qe ace 70 time subtracto o46 2006 cs nade bas PEE 71 time zone forma t60 202v ne ree r9 es 109 toggle output language 109 tokenize Strihg oe i iedo s e eet 3a dog 110 vtrace if ici c bg derer RE EE E 110 translate logical pathname 68 translate Systemn 2 een een ts 11
165. ot documented hash code self INTEGER Method on FLOAT WRAPPER Not documented hash code self INTEGER Method on CHARACTER WRAPPER Not documented hash code self INTEGER Method on BOOLEAN WRAPPER Not documented hash code self INTEGER Method on STRING Not documented hash code self INTEGER Method on INTEGER Not documented hash code self INTEGER Method on FLOAT Not documented hash code self INTEGER Method on CHARACTER Not documented equal hash code self INTEGER Method on OBJECT Return a hash code for self can be negative Two objects that are equal are guaranteed to generate the same hash code provided that writers of object equal methods also implemented the appropriate equal hash code method Two objects that are not equal do not necessarily generate different hash codes The following low level utilities are available to implement specialized hashing schemes or for defining new versions of equal hash code hashmod code INTEGER size INTEGER INTEGER Function Map the hash code code onto a bucket index for a hash table of size i e onto the interval 0 size 1 This is just like rem for positive hash codes but also works for negative hash codes by mapping those onto a positive number first Note that the sign conversion mapping is not equivalent to calling the abs function it simply masks the sign bit for speed and therefore really only makes sense for h
166. ou have to make sure the following native directories exist native lisp hello world bin acl7 0 hello world The directory native lisp hello world will hold the Lisp translations of the cor responding STELLA source files The directory bin acl7 0 hello world will hold the compiled Lisp files if you are using Allegro CL 7 0 If you are using a different Lisp one of the other binary directories as defined in the top level file translations lisp will be used The directory bin lisp hello world will be used as a fall back if your version of Lisp is not yet handled in translations lisp If you create your own system you will need to create those directories by hand future versions of STELLA might do that automatically For the Hello World system these directories already exist To generate a Lisp translation of Hello World using Lisp startup a Lisp version of STELLA see Section 2 3 Lisp Installation page 4 The following idiom will then translate the system into Lisp and also Lisp compile and load it The first argument to make system is the name of the system and the second argument indicates into what language it should be translated STELLA 3 make system hello world common lisp Processing tmp stella 3 1 0 sources hello world file a ste Pass 1 generating objects Processing tmp stella 3 1 0 sources hello world file b ste Pass 1 generating objects Writing fasl file
167. ources hello world file a ste Pass 1 generating objects Processing tmp stella 3 1 0 sources hello world file b ste Pass 1 generating objects Writing tmp stella 3 1 0 native cpp hello world file b hh Writing tmp stella 3 1 0 native cpp hello world file b cc Chapter 4 Programming in STELLA 15 Translating tmp stella 3 1 0 sources hello world startup system ste Writing tmp stella 3 1 0 native cpp hello world startup system hh Writing tmp stella 3 1 0 native cpp hello world startup system cc VOID STELLA 5 Alternatively you can generate the translation using the C or Java version of STELLA The easiest way to do that is to run the stella script in the STELLA directory like this stella e make system hello world cpp Running C version of STELLA Welcome to STELLA 3 4 0 Processing sources hello world file a ste Pass 1 generating objects Processing sources hello world file b ste Pass 1 generating objects Writing native cpp hello world file b hh Writing native cpp hello world file b cc Translating sources hello world startup system ste Writing native cpp hello world startup system hh Writing native cpp hello world startup system cc The e command line option is used to evaluate an evaluable STELLA command Con veniently make system is such a command so you can supply a make system
168. ove duplicates from self and return the result Removes all but the first occurrence of items in the list Preserves the original order of the remaining members Runs in linear time remove if self test FUNCTION CODE LIKE SELF Method on CONS Destructively removes all members of the cons list self for which test evaluates to true test takes a single argument of type OBJECT and returns true or false Returns a cons list In case the first element is removed the return result should be assigned to a variable substitute self inValue OBJECT outValue OBJECT CONS Method on CONS Destructively replace each appearance of out Value by in Value in the cons list self concatenate list1 list2 CONS amp rest otherLists CONS CONS Method on CONS Return a cons list consisting of the concatenation of list1 list2 and otherLists The operation is destructive wrt all but the last list argument which is left intact The two mandatory parameters allow us to optimize the common binary case by not relying on the somewhat less efficient variable arguments mechanism append consList1 CONS consList2 CONS CONS Function Return a cons list representing the concatenation of consList1 and consList2 The concatenation is NOT destructive prepend self list CONS CONS Method on CONS Return a cons list consisting of the concatenation of list1 and self A copy of list1 is prepended to self This operation results in structure shari
169. pe TYPE amp rest initial value pairs OBJECT OBJECT Function Funcallable version of the new operator Return an instance of the class named by type If initial value pairs is supplied it has to be a key value list similar to what s accepted by new and the named slots will be initialized with the supplied values Similar to new all required arguments for type must be included Since all the slot Chapter 6 Library Functions 82 initialization etc is handled dynamically at run time create object is much slower than new therefore it should only be used if type cannot be known at translation time deactivate demon demon DEMON Function Detach demon from the location s specified by its internal structure decoded date time to iso8601 string Method on DECODED DATE TIME date STRING Returns an ISO 8601 string representation of date The Format is YYYY MM DD Thh mm ss zz zz with the string stopping at when a null value is first encountered The time zone will only be included if present if a time value is given decompose namestring namestring STRING Function amp rest options OBJECT CONS OF STRING WRAPPER Keyword options break on cap one of YES NO CLEVER default is CLEVER break on number one of YES NO CLEVER default is CLEVER break on separators string default is _ DECOMPOSE NAMESTRING returns a cons of STRING WRAPPERS that are the decomposition of the input STRING The arguments are used
170. plate replace it with its corresponding value string Replacement is done in sequence which means part of a value might be replaced further with a later var and value insert string source STRING start INTEGER end INTEGER Function target MUTABLE STRING target index INTEGER case conversion KEYWORD INTEGER Inserts characters from source begining at start and ending at end into target starting at target index If end is null then the entire length of the string is used The copy of characters is affected by the case conversion keyword which should be one of UPCASE DOWNCASE CAPITALIZE PRESERVE The final value of target index is returned wrap string value STRING STRING WRAPPER Function Return a literal object whose value is the STRING value wrap mutable string value MUTABLE STRING Function MUTABLE STRING WRAPPER Return a literal object whose value is the MUTABLE STRING value unwrap string wrapper STRING WRAPPER STRING Function Unwrap wrapper and return the result Return NULL if wrapper is NULL unwrap mutable string wrapper MUTABLE STRING WRAPPER Function MUTABLE STRING Unwrap wrapper and return the result Return NULL if wrapper is NULL string to mutable string s srRING MUTABLE STRING Function Copy s into a mutable string with the same content In Lisp and C this simply copies s mutable string to string s MUTABLE STRING STRING Function Convert
171. position on GONS c z2c4Rd vk RR quU 38 POSTELON ON MIST sie 20 mee de RAD epus 43 position on STRING esp pens RR 38 position on VECTOR 221229 64 LE rep 50 prepend on CONS 2 sdccsduieadsaiee shan deed ea 38 prepend on TWIST ose ge eens ideni Da oa 44 primary type on OBJECT sees 101 primitive on RELATION esee 101 print 2snseiseR uenis pei duda brane ues 101 print exception context ss 101 print outlin8 i enu iboiseee eden pii 101 print recycle 1i8t8 2 00 etiri inkes 102 print spacesS 2 22 i e ue REDE Herd R deem 102 print stella feat res 2 dede 102 print unbound surrogates 102 print undefined methods 102 print undefined super classes 102 print xml expressiOn c pe bee bes 73 private class methods i osse 102 private class storage slots 102 private on RELATION essen 102 probecfile 2 2 9 b RR BR ends 67 process doctype icc cess secede comin eee 102 ptrang 2 e dbi REPRE E op ag dees 102 public class methods sees 102 public class storage slots 102 public slots on CLASS igi ences RD s 102 public slots on OBJECT idu re wes 102 p blic on SLOT scancerie eaten ELI 103 push on KEY VALUE LIST sosio dsi esee ee 49 push On LIST ceres repii rper de Re ERR 43 push oon SET be6Ibereete Tue 4e DERRETE 45 push world i eet ews hetero hee EAE be tiny 65 PUBHE ec eidid se a
172. presented by a hash table The only minor drawback right now is that we waste one value slot per entry since we piggy back off KEY VALUE MAP s however that wastes at most 25 space HASH SET KEY VALUE MAP SET MIXIN Class Full featured set class that supports eql or equal equality tests O 1 insert and member operations amp O N intersection etc operations even for large numbers of entries by using a hash table light weight KV CONS representation for small sets Chapter 6 Library Functions 58 and iteration even if the set is represented by a hash table The only minor drawback right now is that this wastes a value slot per entry since we piggy back off KEY VALUE MAP s however that wastes at most 25 space hash set amp rest values OBJECT HASH SET Function Return an eq1 HASH SET containing values member self object OBJECT BOOLEAN Method on HASH SET Return TRUE iff object is a member of the set self Uses an eql test by default or equal if equal test of self is TRUE insert self value LIKE ANY VALUE SELF Method on HASH SET Add value to the set self unless it is already a member Uses an eq1 test by default or equal if equal test of self is TRUE remove self value LIKE ANY VALUE SELF LIKE SELF Method on HASH SET Destructively remove value from the set self if it is a member and return self Uses an eql test by default or equal if equal test of self is TRUE remove if
173. r inorder postorder or topdown all surrogates module MODULE local BOOLEAN ITERATOR OF Function SURROGATE Iterate over all surrogates visible from module If local return only surrogates interned in module If module is null return all surrogates interned everywhere all symbols module MODULE local BOOLEAN ITERATOR OF Function SYMBOL Iterate over all symbols visible from module If local return only symbols interned in module If module is null return all symbols interned everywhere all variables module MODULE local BOOLEAN ITERATOR OF Function GLOBAL VARIABLE Iterate over all variables visible from module If local return only variables bound to symbols interned in module If module is null return all variables defined everywhere allocate iterator self LIKE SELF Method on ABSTRACT ITERATOR Iterator objects return themselves when asked for an iterator they occupy the same position as a collection within a foreach statement allocate iterator self ITERATOR OF LIKE Method on MEMOIZABLE ITERATOR ANY VALUE SELF Alias for clone memoized iterator allocation self KEYWORD Method on STORAGE SLOT Return the most specific allocation facet or instance if all inherited values are NULL apply code FUNCTION CODE arguments CONS OF OBJECT OBJECT Function Apply code to arguments returning a value of type OBJECT Chapter 6 Library Functions 77 apply boo
174. r 6 Library Functions 73 xml local attribute match attribute XML LOCAL ATTRIBUTE Function name STRING element name STRING element namespace STRING BOOLEAN Return true if attribute is a local attribute with name and whose parent element matches element name and element namespace xml lookup attribute attributes CONS name STRING Function namespace STRING STRING Find the XML attribute in attributes with name and namespace and return its value Note that it is assumed that all attributes come from the same known tag hence the parent elements of any local attributes are not considered by the lookup xml tag case item OBJECT amp body clauses CONS OBJECT Macro A case form for matching item against XML element tags Each element of clauses should be a clause with the form tagname or tagname namespace uri The clause heads can optionally be symbols instead of strings The key forms the parameters to the method xm1 element match with a missing namespace argument passed as NULL The namespace argument will be evaluated so one can use bound variables in place of a fixed string As a special case if the namespace argument is ANY then the test will be done for a match on the tag name alone read xml expression stream INPUT STREAM start tag OBJECT Function OBJECT BOOLEAN Read one balanced XML expression from stream and return its s expression repre sentation see xml token list t
175. rSet HASH SET BOOLEAN Method on HASH SET Return true if every element of self occurs in otherSet and vice versa Uses an eq1 test by default or equal if equal test of self is TRUE Chapter 6 Library Functions 59 intersection self otherSet HASH SET HASH SET Method on HASH SET Return the set intersection of self and otherSet as a new set Uses an eql test by default or equal if equal test of self is TRUE union self otherSet HASH SET HASH SET Method on HASH SET Return the set union of self and otherSet as a new set Uses an eql test by default or equal if equal test of self is TRUE difference self otherSet HASH SET HASH SET Method on HASH SET Return the set difference of self and otherSet as a new set i e all elements that are in self but not in otherSet Uses an eq1 test by default or equal if equal test of self is TRUE subtract self otherSet HASH SET HASH SET Method on HASH SET Return the set difference of self and otherSet by destructively removing elements from self that also occur in otherSet Uses an eql test by default or equal if equal test of self is TRUE object equal x y OBJECT BOOLEAN Method on HASH SET Return TRUE iff sets x and y are HASH SET s with equivalent members Uses an eql test by default or equal if equal test of self is TRUE This is equivalent to calling equivalent sets equal hash code self INTEGER Method on HASH SET Return an equal hash
176. rly directly into native constructs of the intended target languages This allows STELLA to be translated into efficient conventional and readable Lisp C and Java code The resulting native code can be understood and to some extent even maintained by programmers who don t know STELLA and it can easily be interfaced with other programs not written in STELLA As of Fall 2000 we have programmed approximately 100 000 lines of STELLA code about 50 for the STELLA kernel itself and the other 50 for the PowerLoom knowledge representation system and related systems Our subjective experience has been that it is only slightly more difficult to write and debug a STELLA program than a Lisp program and that the inconvenience of having to supply some type information is much outweighed by the benefits such as catching many errors during compile time instead of at run time The biggest benefit however seems to be that we can still leverage all the incremental code development benefits of Lisp since we use the Common Lisp based version of STELLA for prototyping This allows us to incrementally define and redefine functions methods and classes and to inspect debug and fix incorrect code on the fly Even the most sophisticated C or Java IDE s don t yet seem to support this fully incremental development style i e Chapter 1 Introduction 2 a change in a class every change in Java is a change to a class still requires recompilation and restar
177. rmance results In particular using high optimization settings with the Lisp compiler can greatly improve slot access time on STELLA objects 4 3 1 Lisp Performance Hints The standard Lisp implementation for STELLA objects are CLOS objects since CLOS provides the most natural Lisp implementation for the STELLA object system However there is a price to pay since in Lisp slot access on CLOS objects is a lot slower than slot access on structs For example in Allegro CL 4 3 the access to the value slot of a STELLA CONS cell takes about 4 times longer on a CLOS object implementation of CONS than on a struct implementation Unfortunately the struct implementation itself takes about 3 times longer than calling CL car on a Lisp cons which is why we are actually using Lisp conses as the Lisp implementation for STELLA CONSes Note that in the C and Java translation these slot access performance problems are nonexistent In order to get the maximum performance out of the Lisp version of STELLA you can tell the translator to use structs as the implementation for STELLA objects It does so by using CL defstruct instead of CL defclass and dispatches methods directly on the structure object To use the struct translation scheme evaluate set stella feature use common lisp structs before you translate a STELLA system This will generate translated files with a slisp extension Make sure that after you translated all the files you are interested
178. round any STELLA code you incrementally evaluate in the Lips buffer This makes sure that all the arguments to a function etc are translated into the appropriate STELLA objects For example evaluating eval list a b c in the Lisp buffer generates a STELLA list that points to the STELLA keywords a b and c If you don t use eval for example list a b c a STELLA list containing the Lisp keywords a b and c will be created Lisp key words are a completely different data structure than STELLA keywords and any STELLA code expecting a STELLA keyword but finding a Lisp keyword will break since Lisp key words are not a legal STELLA data structure Unfortunately such cases can be very confusing since Lisp and STELLA keywords look print exactly alike Chapter 4 Programming in STELLA 21 eval is also necessary to access STELLA symbols and surrogates in the Lisp buffer For example to access a STELLA symbol you can use quote again this is the STELLA quote not CL quote eval quote foo This returns the STELLA symbol foo We explicitly used quote here since code typed at the Lisp prompt is first passed through the Lisp reader before the STELLA translator sees it and the default Lisp reader interprets the character differently than the STELLA reader Within a STELLA file you can use the syntax foo since it will be read directly by the STELLA reader that knows how to interpret it correctly
179. rs in self allocate iterator self Kv LIST ITERATOR OF Method on KEY VALUE LIST LIKE ANY KEY SELF LIKE ANY VALUE SELF Not documented next self BOOLEAN Method on KV LIST ITERATOR Not documented 6 8 Vectors VECTOR SEQUENCE Class Not documented any value OBJECT Class Parameter of Not documented array size INTEGER Slot of Not documented the array NATIVE VECTOR OF LIKE ANY VALUE SELF Slot of Not documented EXTENSIBLE VECTOR VECTOR Class Not documented empty self BOOLEAN Method on VECTOR Return true if self has length 0 Chapter 6 Library Functions 50 non empty self BOOLEAN Method on VECTOR Return true if self has length gt 0 object equal x y OBJECT BOOLEAN Method on VECTOR Return TRUE iff the vectors x and y are structurally equivalent Uses equal to test equality of elements equal hash code self INTEGER Method on VECTOR Return an equal hash code for self vector amp rest values OBJECT VECTOR Function Return a vector containing values in order first self LIKE ANY VALUE SELF Method on VECTOR Not documented second self LIKE ANY VALUE SELF Method on VECTOR Not documented third self LIKE ANY VALUE SELF Method on VECTOR Not documented fourth self LIKE ANY VALUE SELF Method on VECTOR Not documented fifth self LIKE ANY VALUE SELF Method on VECTOR Not docume
180. rue if current output language is C Chapter 6 Library Functions 111 translate to java BOOLEAN Function Return true if current output language is Java truncate n NUMBER INTEGER Function Truncate n toward zero and return the result try to evaluate tree OBJECT OBJECT Function Variant of evaluate that only evaluates tree if it represents an evaluable expression If it does not tree is returned unmodified This can be used to implement commands with mixed argument evaluation strategies two argument least common superclass class1 CLASS Function class2 CLASS CLASS Return the most specific class that is a superclass of both class and class2 If there is more than one arbitrarily pick one If there is none return null two argument least common supertype typel TYPE SPEC Function type2 TYPE SPEC TYPE SPEC Return the most specific type that is a supertype of both typel and type2 If there is more than one arbitrarily pick one If there is none return VOID If one or both types are parametric also try to generalize parameter types if necessary type self TYPE Method on SLOT The type of a storage slot is its base type type specifier self TyPE SPEC Method on SLOT If self has a complex type return its type specifier otherwise return type of self type to symbol type TYPE SYMBOL Function Convert type into a symbol with the same name and module type to wrapped type self
181. ry with key exists yet Uses an eq1 test by default or equal if equal test of self is TRUE Chapter 6 Library Functions 54 remove at self key LIKE ANY KEY SELF Method on STELLA HASH TABLE Remove the entry identified by key from self Uses an eq1 test by default or equal if equal test of self is TRUE length self INTEGER Method on STELLA HASH TABLE Return the number of entries in self empty self BOOLEAN Method on STELLA HASH TABLE Return TRUE if self has zero entries non empty self BOOLEAN Method on STELLA HASH TABLE Return TRUE if self has at least 1 entry copy self LIKE SELF Method on STELLA HASH TABLE Return a copy of the hash table self The bucket table and buckets are freshly allo cated however the keys and values of entries are not copied themselves similar to what we do for lists etc clear self Method on STELLA HASH TABLE Remove all entries from self l his will result in a re initialization of the table upon the first insertion into self consify self CONS OF CONS Method on STELLA HASH TABLE Collect all entries of self into a cons list of lt key gt lt value gt pairs and return the result object equal x y OBJECT BOOLEAN Method on STELLA HASH TABLE Return TRUE if x and y represent the same set of key value pairs equal hash code self INTEGER Method on STELLA HASH TABLE Return an equal hash code for self Note that this is O N
182. s greater than y zero Not yet implemented plus Not yet implemented even Not yet implemented odd Not yet implemented div Not yet implemented rem Not yet implemented Chapter 6 Library Functions mod Not yet implemented gcd x LONG INTEGER y LONG INTEGER LONG INTEGER Return the greatest common divisor of x and y ceiling n NUMBER INTEGER Return the smallest integer n floor n NUMBER INTEGER Return the biggest integer n round n NUMBER INTEGER Round n to the closest integer and return the result abs x INTEGER Return the absolute value of x abs x FLOAT Return the absolute value of x min Not yet implemented max Not yet implemented sqrt n FLOAT FLOAT Return the square root of n exp n FLOAT FLOAT Return the e to the power n expt x FLOAT y FLOAT FLOAT Return x y log n FLOAT FLOAT Return the natural logarithm base e of n log10 n FLOAT FLOAT Return the logarithm base 10 of n sin n FLOAT FLOAT Return the sine of n radians cos n FLOAT FLOAT Return the cosine of n radians tan n FLOAT FLOAT Return the tangent of n radians asin n FLOAT FLOAT Return the arcsine of n in radians 29 222 Function Function Function Function Method on INTEGER Method on FLOAT 222 222 Function Function Function
183. self test FUNCTION CODE LIKE SELF Method on HASH SET Destructively remove all elements of the set self for which test evaluates to TRUE test takes a single argument of type OBJECT and returns TRUE or FALSE Returns self pop self LIKE ANY VALUE SELF Method on HASH SET Remove and return an arbitrary element of the set self Return NULL if the set is empty Performance note for large sets implemented via hash tables it takes O N to empty out the set with repeated calls to pop since the emptier the table gets the longer it takes to find an element Therefore it is usually better to use iteration with embedded removals for such cases substitute self new OBJECT old OBJECT LIKE SELF Method on HASH SET Destructively replace old with new in the set self unless new is already a member Uses an eql test by default or equal if equal test of self is TRUE copy self LIKE SELF Method on HASH SET Return a copy of the set self All entries are freshly allocated however the values are not copied themselves similar to what we do for lists etc consify self CONS OF LIKE ANY VALUE SELF Method on HASH SET Collect all entries of self into a cons list and return the result subset self otherSet HASH SET BOOLEAN Method on HASH SET Return true if every element of self also occurs in otherSet Uses an eql test by default or equal if equal test of self is TRUE equivalent sets self othe
184. serve the sign of arg and is equivalent to dividing arg by 2 count shift right arg count INTEGER LONG INTEGER Method on LONG INTEGER Shift arg to the right by count positions and 0 extend from the left if arg is positive or l extend if it is negative This is an arithmetic shift that preserve the sign of arg and is equivalent to dividing arg by 2 count signal type SYMBOL amp body body CONS OBJECT Macro Signal error message placing non string arguments in quotes signal read error amp body body CONS oBJECT Macro Specialized version of signal that throws a READ EXCEPTION sort self predicate FUNCTION CODE VECTOR OF LIKE Method on VECTOR ANY VALUE SELF Perform a destructive sort of self according to predicate and return the result If predicate has a lt semantics the result will be in ascending order If predicate is null a suitable lt predicate is chosen depending on the first element of self and it is assumed that all elements of self have the same type supported element types are GENERALIZED SYMBOL STRING INTEGER and FLOAT sort self predicate FUNCTION CODE HEAP OF LIKE Method on HEAP ANY VALUE SELF Sort the heap self according to predicate in ascending order if predicate has lt se mantics If predicate is NULL simply use selfs internal predicate the normal case If it is different from selfs internal predicate heapify self first according to the new predicate
185. si bbws 27 object equal on PROPERTY LIST 46 object equal on SET ric gr exe 46 object equal on STELLA HASH TABLE 54 object equal on VECTOR ss 50 object equal on VECTOR SEQUENCE 100 object equal on WRAPPER sess 27 object hash tod6e c noli e rr ER amen 54 OUD is M 28 odd on INTEGER isses nnne 100 odd on LONG INTEGER eene 100 ODL YH heehee gat beams eee Pep par roe cece 100 OPeN INpPUtHLI Les costae yer sed eee eee ee 66 open network stream ccccces e RE ed 100 open o tput file I xe v RES ERA 67 operating SyStem emd EP prei ninia 74 ordered on COLLECTION 000000 100 outline depth exceeded 100 P parameters On CLASS 0 cece eee 100 parse date time c ser ee nm ng 69 parse date time in time zone 100 parse date time relative to base 100 parse stella name oc ten n 101 pick hash table size prime 101 plist to kvlist uc e Rn 101 121 plus i edge eR iuc dein pede TELE 28 plus on INTEGER Perder e gos 101 plus on LONG INTEGER esse 101 pop on HASH SET i add ce br EAE d n 58 POP OM ITERATOR es MP Roeser 9 E caches e 59 pop on KEY VALUE LIST eir repii baras 49 pop OD DIST ilsebeIto02 amp 4ecevvbeepiewebees 44 pop world li Neb hee ea e RR EXE SETS 65 pOpdesleeee ee j4ee ieben Rb aded ee eei 39
186. sider the following code fragment let 1 cons foo nil x concatenate bar first 1 print x EOL Here is its C translation Cons 1 cons wrapString foo NIL char x stringConcatenate bar StringWrapper 1 gt value gt wrapperValue 0 std cout lt lt x lt lt std endl Chapter 4 Programming in STELLA 23 Notice how the string literal foo is first wrapped so it can be inserted into the CONS list 1 and then automatically unwrapped in the call to concatenate While this is very convenient it does cause a certain overhead that should be avoided in performance critical loops etc In such situations it often helps to use auxiliary variables of the appropriate literal type to avoid unnecessary wrap unwrap operations Lisp style property lists Lisp programs often use property lists for fast retrieval of information that is linked to symbols To support the easy translation of existing Lisp pro grams that use this paradigm into STELLA a similar mechanism implemented by the func tions symbol value symbol plist and symbol property is available that preserves the performance benefits of this storage scheme see the file sources stella symbols ste However property lists do not fit the object oriented programming paradigm supported by STELLA and hence are frowned upon Compiler optimization The optimization settings used with the native Lisp or C compiler can greatly influence perfo
187. sp variable this tries to infer the type of the resulting expression from the object code is bound to and generates an appropriate cast clv stands for Common Lisp Value or Verbatim Chapter 6 Library Functions 80 coerce amp rest to cons rest Variable SYMBOL OBJECT Macro Coerce the argument list variable rest Variable into a CONS list containing all its elements uses argument list iteration to do so If restVariable already is a CONS due to argument listification this is a no op coerce to float number NUMBER WRAPPER FLOAT Function Coerce number to a float value coerce to hash set self OBJECT equalTest BOOLEAN HASH SET Function Coerce the collection self into a HASH SET Use an equal test if equal Test is TRUE equalTest will be ignored if self already is a HASH SET coerce to symbol name NAME GENERALIZED SYMBOL Function Return the generalized symbol represented by name Return null if name is unde fined or does not represent a string collect amp body body cons OBJECT Macro Use a VRLET to collect values Input can have one of the following forms collect var in expression where lt test gt lt var gt collect lt collect expression gt foreach var in expression fas where lt test gt lt var gt do s The second form really accepts an arbitrary foreach expression following the foreach keyword collection valued self BOOLEAN Method on SLOT
188. ssion from string unstringify in module string srRING module MODULE OBJECT Function Unstringify relative to module or MODULE if no module is specified 6 5 CONS Lists and Trees CONS STANDARD OBJECT Class Not documented any value OBJECT Class Parameter of Not documented value LIKE ANY VALUE SELF Slot of Not documented rest CONS OF LIKE ANY VALUE SELF Slot of Not documented nil CONS Variable Not documented empty self BOOLEAN Method on CONS Return true iff self equals ni1 non empty self BOOLEAN Method on CONS Return true iff self is not equal to nil nil x oBJECT BOOLEAN Function Return true iff x equals ni1 equal cons trees treel OBJECT tree2 OBJECT BOOLEAN Function Return true iff the cons trees treel and tree2 are structurally equivalent Uses an eq1 test Chapter 6 Library Functions 37 object equal treel tree2 OBJECT BOOLEAN Method on CONS Return true iff the cons trees tree and tree2 are structurally equivalent Uses equal to test equality of subtrees equal hash code self INTEGER Method on CONS Return an equal hash code for self Note that this is O N in the number of elements of self cons value OBJECT rest CONS CONS Function Return a cons record that points to value and rest first self LIKE ANY VALUE SELF Method on cons Return the first element of self The first element of self ca
189. stella defun is actually bound to a Lisp macro that calls all the necessary translation machinery to convert the STELLA defun into Lisp code Look at the file sources stella cl lib stella to cl ste for the complete set of such macros This might be a bit confusing since there are now three different bindings or meanings of defun 1 The STELLA operator defun used to define STELLA functions 2 The Lisp macro stella defun that resides in the STELLA Lisp package and is only available for convenience in Lisp versions of STELLA 3 The Lisp macro CL defun which is the standard Common Lisp macro used to define Lisp functions We ll try to explicitly qualify which meaning is used wherever there might be some doubt which one is meant In general every unqualified symbol mentioned below is either part of the STELLA language or resides in the STELLA Lisp package Since a newly written STELLA function might have errors it is prudent to first only translate it without actually executing the result of the translation In the source buffer you can do that by macro expanding the defun For example if you use the Allegro CL interface you would position the cursor on the opening parenthesis of the defun and then type M M Any errors discovered by the STELLA translator are reported in the Lisp buffer window The expansion will be a CL progn that contains the translated definition as the first element plus various startup time initialization code fo
190. stem is such a command so you can supply a make system form to the C or Java version of STELLA just as you would do in Lisp Note the extra quotes around the expression to protect the characters from interpretation by the Unix shell To compile and load the translated Lisp files into Lisp you then have to startup a Lisp version of STELLA and call make system again which now will only compile and load the necessary files since the translations have already been generated in the previous step 4 1 2 Hello World in C To generate a C translation of Hello World you can use either the Lisp C or Java version of STELLA Before you can translate you have to make sure the following native directory exists native cpp hello world The directory native cpp hello world will hold the C translations of the corre sponding STELLA source files If you create your own system you will need to create this directory by hand future versions of STELLA might do that automatically For the Hello World system the directory already exist To generate a C translation of Hello World using Lisp startup a Lisp version of STELLA see Section 2 3 Lisp Installation page 4 The following idiom will then trans late the system into C The first argument to make system is the name of the system and the second argument indicates into what language it should be translated STELLA 4 make system hello world cpp Processing tmp stella 3 1 0 s
191. stently if possible merge superior null fields self Method on DECODED DATE TIME default DECODED DATE TIME Replace only null valued fields in self that represent larger time units than the smallest non null in self with values from default The day of the week will be set consistently if possible Example if self just has the month being non null then only the year will be filled in from default If the day and minute were non null then hour month and year will be filled This can be useful when one doesn t want to extend the precision of the answer min x y INTEGER INTEGER Method on INTEGER Return the minimum of x and y If either is NULL return the other min x y LONG INTEGER LONG INTEGER Method on LONG INTEGER Return the minimum of x and y If either is NULL return the other min x y FLOAT FLOAT Method on FLOAT Return the minimum of x and y If either is NULL return the other min x y NUMBER WRAPPER NUMBER WRAPPER Method on NUMBER WRAPPER Return the minimum of x and y If y is NULL return x mod x modulus INTEGER INTEGER Method on INTEGER True modulus Return the result of x mod modulo Note In C and Java mod has more overhead than the similar function rem The answers returned by mod and rem are only different when the signs of x and modulo are different mod x modulus LONG INTEGER LONG INTEGER Method on LONG INTEGER True modulus Return the result of x mod
192. surrogate self get local standard time zone FLOAT Function Returns the standard time zone offset from UTC as a float without considering the effects of daylight savings time get local time zone for date year INTEGER month INTEGER Function day INTEGER hour INTEGER minute INTEGER second INTEGER FLOAT Returns the time zone offset from UTC as a float that is applicable to the given date Assumes that the date is one that is valid for the underlying programming language If not then returns 0 0 get quoted tree tree name STRING modulename STRING CONS Function Return the quoted tree with name tree name get slot self STANDARD OBJECT slot name SYMBOL SLOT Function Return the slot named slot name on the class representing the type of self get stella class class name error BOOLEAN CLASS Method on SURROGATE Return a class with name class name If none exists break if error else return null get stella class class name error BOOLEAN CLASS Method on SYMBOL Return a class with name class name If non exists break if error else return null get stella class class name error BOOLEAN CLASS Method on STRING Return a class with name class name If none exists break if error else return null Chapter 6 Library Functions 89 get time date timezone FLOAT INTEGER Method on CALENDAR DATE INTEGER INTEGER INTEGER Returns multiple values of hours minutes seconds
193. t of the application But it is the restart that can be the most time consuming if one debugs a complex application that takes a significant time to reach a certain state Once a STELLA program has matured it can be translated into C or Java to gain extra efficiency to deliver it as a stand alone application or to link it with other programs 1 1 Credits and History Bob MacGregor invented STELLA in 1995 to implement the PowerLoom knowledge representation system He wrote most of the first Lisp based kernel system of STELLA and still occasionally writes extensions or provides fixes Today he is primarily a STELLA user writing his own applications Hans Chalupsky completed the first full STELLA bootstrap STELLA translating itself in Spring 1996 and then went on to deal with all the changes necessary to handle the many C and Java idiosyncrasies that were discovered when the first versions of these translators came online He is currently one of the principal maintainers of STELLA supporting the STELLA code analyzer and the Lisp and C translators Eric Melz wrote the first version of the C translator under very trying circumstances i e at a stage where the STELLA language changed under him on a daily basis He got the first C version of STELLA running in the Fall of 1996 Tom Russ wrote the Java translator and got the first Java version of STELLA running in Spring 1999 He is currently one of the principal maintainers of STELLA s
194. tances This is great for code development but the flexibility and expense is usually not needed or warranted for delivered code The performance trade offs between CLOS and struct versions might be different in different versions of Lisp For example in older version of Allegro CL slot access on structs was fast but method dispatch was significantly slower than for CLOS objects which eliminated some all of the performance gains Chapter 5 Library Classes tbw 5 Library Classes tbw To be written 25 Chapter 6 Library Functions 26 6 Library Functions 6 1 Basic Constants and Predicates true Not yet implemented false Not yet implemented null x BOOLEAN Method on OBJECT Return true if x is undefined handled specially by all translators null x BOOLEAN Method on SECOND CLASS OBJECT Return true if x is undefined handled specially by all translators null x BOOLEAN Method on NATIVE VECTOR Return true if x is undefined handled specially by all translators null x BOOLEAN Method on STRING Return true if x is undefined handled specially by all translators null x BOOLEAN Method on MUTABLE STRING Return true if x is undefined handled specially by all translators null x BOOLEAN Method on CHARACTER Return true if x is undefined handled specially by all translators null x BOOLEAN Method on CODE Return true if x is undefined handled specially by all trans
195. tence 6 diene sae bina ote 42 last on VECTOR cn she dea mh eh ria ee doe 50 last on VECTOR SEQUENCE sse sees 92 Tast cons dived di ebbe Revaerey rere Een 3T l st position on CONS sz Rem erg 38 last position on LISY 2 2 299 21599 265 43 last position on STRING oise 0222 aeres es 34 last position on VECTOR sese 50 length on 2 DIMENSIONAL ARRAY MIXIN 92 length on ABSTRACT ITERATOR 59 length on CONS oec ss sce de dme Ph aes 37 length on CONS ITERATOR lesse 92 length on DIMENSIONAL ARRAY MIXIN 92 length on HBEAP ji need bor Rer edad ois 92 length on KEY VALUE LIST 0005 48 length on KEY VALUE MAP sese 57 length On LIST 2s one her dur ehe ad aad 43 length on MUTABLE STRING sees 33 length on PROPERTY LIST llle sees 46 length on STELLA HASH TABLE 54 length On STRING i4 cs4emeIt ied e br oe 33 length on VEOTOR i iduc9 kb Rd rud ER 50 length on VECTOR SEQUENCE sse Oil letter character u2 iach RE HS 31 liSpify edo wena d tre ronme ariane iS 93 lispify booleam c b RR RIEN 93 hr P 42 DUS CF oo 39 list modules 6c er p NERIS RPS 93 listify OH CONS ru tease REPE pee 93 listify On ITERATOR 0 250 eer pPRES 93 listify on KEY VALUE LIST lsessse 93 lisStify On bIST 22x322c4 3 denda edes pas 93 listify om VECTOR ls d ach ern 93 load
196. ter sae hed eeteded chess 103 pusbqdesi 5iReeeIiesc merebatur ius 39 pushd n8w ecce d acd do erc bees dde 39 Q qualified stella name 103 Function Index Fandom 50 disk ERG aee EDPIMLerad uu 30 read character cocebccd leere IE ELEM 66 read line t 12e 4b peer IE RENDIR 66 read line2 2 20 AbOIIdqe eae Sey ura 103 read s expressioh wer es 66 read s expression from string 66 read xml expressiOn dv e eps 73 reader on STORAGE SLOT esses 103 regular integer valued osse 103 relative date to string sss sessi 69 TEM PE 28 rem Oii INTEGER ezicwReswr eda dE ERU E 103 rem on LONG INTEGER esee nn 103 remove On CONS slnsnsekee B 3GD eX eden eus 38 remove On HASH SET eosssc lle 58 remove on LIST ercer sen tA eR ERI ERE 43 remove On STRING selisccecc decedRkab ei ed 34 remove on VECTOR SEQUENCE sees 51 remove at on HASH TABLE seen 52 remove at on KEY VALUE LIST 48 remove at on KEY VALUE MAP eese 5T remove at on PROPERTY LIST 47 remove at on STELLA HASH TABLE 54 remove at on STRING HASH TABLE 52 remove configuration property 103 remove deleted members on LIST 43 remove duplicates on COLLECTION 103 remove duplicates on CONS esse 38 remove duplicates on LIST esee 43 remo
197. that collectively define a Stella application Required options are directory the relative path from the respective source native binary root di rectory to the directory containing the system files Can be a string or a list of strings do not include directory separators files a list of files in the system containing Chapter 6 Library Functions 84 strings and lists of strings the latter defines exploded paths to files in subdirecto ries Optional options are required systems a list of systems strings that should be loaded prior to loading this system cardinal module the name a string of the principal module for this system copyright header string with a header for inclusion into all translated files produced by Stella lisp only files Like the files keyword but these are only included cpp only files in the translation for the specific language namely java only files Common Lisp C or Java deleted self BOOLEAN Method on OBJECT Default deleted method which always returns FALSE Objects that in herit DYNAMIC SLOTS MIXIN also inherit the dynamically allocated slot deleted object which is read writable with specializations of this method describe name OBJECT amp rest mode OBJECT N Command Print a description of an object in verbose terse or source modes describe object self stream OUTPUT STREAM Method on OBJECT mode KEYWORD Prints a description of self to str
198. thod Sweep up all selftype objects symbol to surrogate self SYMBOL SURROGATE Function Return a surrogate with the same name as self Very tricky The logic is designed to avoid returning an inherited surrogate that has no value In that case a new local surrogate is created that shadows the inherited surrogate Unlike string to surrogate the search starts first from the home context of self and if that fails then it restarts in module symbol to type self SYMBOL SURROGATE Function Convert self into a surrogate with the same name and module system default value self OBJECT Method on STORAGE SLOT Return a default value expression or if self has dynamic storage an initial value expression system default value self OBJECT Method on SLOT Return a default value expression or if self has dynamic storage an initial value expression system loaded or started up name STRING BOOLEAN Function Return true if system name has either been loaded or initialized with its startup function system loaded name STRING BOOLEAN Function Return true if system name has been loaded terminate program Function Terminate and exit the program with normal exit code time duration to string date STRING Method on TIME DURATION Returns a string representation of date time zone format60 timezone FLOAT STRING Function Format zone as an hh mm string toggle output language KEYWORD Fu
199. tion i to value and return the result 2d aref self i INTEGER j INTEGER Method on 2 DIMENSIONAL ARRAY MIXIN LIKE ANY VALUE SELF Return the element of self at position i jl 2d aref address self i INTEGER Method on 2 DIMENSIONAL ARRAY MIXIN j INTEGER INTEGER Return the 1D address of the element at position i jl This is useful for fast element wise iteration that doesn t need arithmetic 2d aref setter self Method on 2 DIMENSIONAL ARRAY MIXIN value LIKE ANY VALUE SELF i INTEGER j INTEGER LIKE ANY VALUE SELF Set the element of self at position i j to value and return the result abs x LONG INTEGER Method on LONG INTEGER Return the absolute value of x Chapter 6 Library Functions 75 activate demon demon DEMON Function Install demon in the location s specified by its internal structure active self BOOLEAN Method on POLYMORPHIC RELATION True if self or a superslot of self is marked active add configuration property property STRING value OBJECT Function configuration CONFIGURATION TABLE OBJECT Add value to property in configuration and return it If a previous value exists add value to the end listify the old value if it is not yet a list Otherwise create a new list containing value Use the global system configuration table if configuration is NULL add hook hookList HOOK LIST hookFunction SYMBOL Function Insert the function named hook
200. tively be achieved by inserting to be quoted variables bound to themselves into bindings cons tree match tree OBJECT pattern OBJECT BOOLEAN Function Predicate version of match cons tree which see consify self CONS OF LIKE ANY VALUE SELF Method on CONS Return self allocate iterator self CONS ITERATOR OF LIKE Method on CONS ANY VALUE SELF Not documented next self BOOLEAN Method on CONS ITERATOR Not documented sort self predicate FUNCTION CODE CONS OF LIKE Method on cons ANY VALUE SELF Perform a stable destructive sort of self according to predicate and return the re sult If predicate has a lt semantics the result will be in ascending order It is not guaranteed that self will point to the beginning of the sorted result If predicate is null a suitable lt predicate is chosen depending on the first element of self and it is assumed that all elements of self have the same type supported element types are GENERALIZED SYMBOL STRING INTEGER and FLOAT sort tuples self n INTEGER predicate FUNCTION CODE Method on CONS CONS OF LIKE ANY VALUE SELF Just like sort but assumes each element of self is a tuple a cons whose n th element 0 based will be used for comparison map null to nil self coNs LIKE SELF Function Return nil iff self is null or self otherwise printpretty BOOLEAN Special Variable If true conses will be pretty printed
201. tream INPUT STREAM STRING Function Read one line from stream and return the result This differs from native read line in that it is not platform dependent It recognizes any of the three common line ending formats CR LF CR LF in any combination It is not as fast as native read line however read character inputStream INPUT STREAM CHARACTER BOOLEAN Function Read one character from inputStream and return the result Return true as the second value on EOF unread character ch CHARACTER inputStream INPUT STREAM Function Unread ch from inputStream Signal an error if ch was not the last character read y or n message STRING BOOLEAN Function Read a line of input from STANDARD INPUT and return true if the input was y or false if the input was n Loop until either y or n was entered If message is non null prompt with it before the input is read See also special variable USER QUERY ACTION yes or no message STRING BOOLEAN Function Read a line of input from STANDARD INPUT and return true if the input was yes or false if the input was no Loop until either yes or no was entered If message is non null prompt with it before the input is read See also special variable USER QUERY ACTION flush output self OUTPUT STREAM Function Flush all buffered output of self 6 16 Files open input file fileName STRING amp rest options KEYWORD Function FILE INPUT STREAM Open file
202. tring to decoded date time 108 sString to float e hiri ERR 30 35 String to integer e ge s 30 35 string to mutable string 35 String to Surrogates 2 cede nsec wend ns 108 String to time d rati n 6 108 String upcasei secos RA RETO tea ees 34 String ne tee cede auod deu tae Bee Rena 32 String S orreee cae ae bd ep i aie eects 32 String u liieivdasgueadose deb ed meds Prid erus 32 String SE olet e PRU P darker pedes 32 Striugify sty peeve pees rieni E edges bed 36 stringify in module 2 c ere ses 36 S bClass of e Ree hn dab add iiS 108 subsequence on MUTABLE STRING 108 subsequence On STRING 0 cece eee eee 34 subset On CONS iia re ka dade da vedas 41 subset on HASH SET 000s cece nee 58 Subset ON LIST oscopbbedbnesnesi pee pede s 45 substitute on CONS creiria ie n erac 38 substitute on HASH SET esee 58 substitute on LIST 222212139 4m bens 44 substitute on MUTABLE STRING 34 substitute ON SET 2142 4 b u iesus 45 Substitute on STRING 6 sc nde 4c ee a wend 34 substitute characters on MUTABLE STRING TEE 108 substitute characters on STRING 108 substitute cons tree eese 39 subtract On CONS icee pe area ke reda 41 subtract on HASH SET ccl ue se d e en 59 Subtract On LIST ce lbereeee se Yd dde teen 45 Subtype Of 2 0 e e er bred 108 super classes ON CLASS sss es ense 108 s rr
203. u end eg Seb sed Es 11 3 5 Classes DW qucsequiexae udarati adane uaea ie dag ed ee 11 3 6 Methods DW sese cte tov E ER Erbe ere che dece d 11 Dur Macros DW 2ssdxsus tuns ees oe wot Pu axe ad d SHE e d 11 3 5 Modules 10W caede Cond Ridbededese bbeanh are ey E eal 11 4 Programming in STELLA 12 4 1 Hello World in STELLA sseeesnnn BA 12 4 1 4 Hello World in Lisp 000000 12 4 1 2 Hello World in C Lsselulsesssleeenn 14 4 1 8 Hello World in Java 0 0 00 seien 16 4 2 Incrementally Developing STELLA Code 17 4 8 Performance Hints imbre det i er bebo pe 21 4 3 1 Lisp Performance Hints 00 29 amp Library Classes DDW wow ed rc rd 25 6 Library EuncilohsS z 44 9 mw mk em 26 6 1 Basic Constants and Predicates 00 00 e cece nee 26 0 2 Numbers eser orenetan ERE De dan EPOR aah eae 2T 0 9 IBFAGUOTS s det osten beet eI eye ovii dos olde ed e mies 30 GA STINES iid ech edt d a on E e RR e e Ue i ela 31 6 5 CONS Lists and Trees ur eee i Tei Tonita aN DR epa 36 6 5 1 CONS Lists as Sets ule 41 6O DI StS aeia aeaa iia A en th ee a ke Jte HR a GR ESA 41 OGA Lists sels c r P E oi ese 44 6 7 Property and Key Value Lists 0 00 000 e ee eens 46 0 8 MeGLOES cesse iren doo HO pH Ro e e er du 49 629 Hash Tables rer UTERIS DRE Gee edhe ae 51 6 10 Key Value Maps 0 c cece
204. uage amp options OBJECT BOOLEAN Translate all out of date files of system systemName into language the first optional argument of language amp options and then compile and load them the latter is only possible for Lisp right now The following keyword value options are recognized language can be used as an alternative to the optional language argument If not specified the language of the running implementation is assumed two pass if true all files will be scanned twice once to load the signatures of objects defined in them and once to actually translate the definitions Otherwise the translator will make one pass in the case that the system is already loaded and is being remade and two passes otherwise development settings default false if true translation will favor safe read able and debuggable code over efficiency according to the value of development Chapter 6 Library Functions 97 settings on the system definition If false efficiency will be favored instead ac cording to the value of production settings on the system definition production settings default true inverse to development settings force translation default false if true files will be translated whether or not their translations are up to date force recompilation default false if true translated files will be recompiled whether or not their compilations are up to date only supported in Lisp right now load syst
205. ual hash code self oBJECT INTEGER Function Return a hash code for self Just like equal hash code which see but also works for NULL equal hash code methods that expect to handle NULL components should use this function for recursive calls safe hash code self oBJECT INTEGER Function Return a hash code for self Just like hash code which see but also works for NULL safe lookup slot class CLASS slot name SYMBOL SLOT Function Alias for lookup slot Kept for backwards compatibility safety level INTEGER WRAPPER test OBJECT amp body body Cons Macro OBJECT Signal warning message placing non string arguments in quotes save configuration file table CONFIGURATION TABLE Function file FILE NAME title STRING Save table as a configuration file Uses a Java style property file syntax save configuration value stream OUTPUT STREAM value OBJECT Function Save value to stream as a properly formatted configuration value search cons tree with filter tree OBJECT value OBJECT Function filter CONS BOOLEAN Return true iff the value value is embedded within the cons tree tree Uses an eql test Does not descend into any cons whose first element matches an element of filter Chapter 6 Library Functions 105 search for object self OBJECT typeref OBJECT OBJECT Function If self is a string or a symbol search for an object named self of type type Otherwise if self is an
206. ue into self and restore the heap property Signal an error if there is no more room in self Maintains self as a Min heap if selfs predicate has lt semantics otherwise as a Max heap insert if better self value LIKE ANY VALUE SELF Method on HEAP Insert value into self and restore the heap property If self has available room simply insert value If the heap is full only insert value if it is better than the current root i e the minimum of self if selfs predicate has lt semantics In that case replace the root of self and restore the heap property This is useful to build and maintain a heap with some top N elements relative to predicate where the root or minimum of self is the currently weakest element at the end of the list integer length x LONG INTEGER INTEGER Function Return the 1 based position of the left most bit in x If x is negative we only count the value bits not the sign integer to hex string i LONG INTEGER STRING Function Convert i to a string representation in hexadecimal notation and return the result Chapter 6 Library Functions 92 integer to string in base i LONG INTEGER base INTEGER Function STRING Convert i to a string representation in base and return the result base must be positive and not more than 36 Note that in the C version only 8 10 and 16 will work as base arguments since that is all the underlying implementation supports Other argument values will
207. upporting the STELLA code analyzer and the Lisp and Java translators He is also still active writing occasional extensions such as the STELLA XML parser Chapter 2 Installation 3 2 Installation 2 1 System Requirements To install and use STELLA you approximately need the following amounts of disk space 8 MB for the tar red or zip ped archive file 35 MB for the untarred sources tanslations compiled Java files and documentation 8 MB to compile a Lisp version 11 MB to compile the C version without g 3 MB to compile the Java version already included This means that you will need approximately 55 MB to work with one Lisp one C and one Java version of STELLA in parallel If you also want to experiment with the Lisp translation variant that uses structures instead of CLOS instances to implement STELLA objects then you will need an extra 8 MB to compile that The full STELLA development tree is quite large since for every STELLA source file there are three to four translated versions and as many compiled versions thereof The actual STELLA libraries that you have to ship with an application however are quite small For example the Java jar file stella jar is only about 1 3 MB in size The dynamic C library 1ibstella so compiled on a Linux platform is about 4 MB Additionally if you don t need all the different translations of STELLA you can delete some of the versions to keep your development tree smaller See Sectio
208. ust otherwise be a URI make xml global attribute name srRING Function namespace name STRING namespace STRING XML GLOBAL ATTRIBUTE Creates and interns an XML global attribute object with name using namespace name to refer to namespace namespacemust be a URI make xml local attribute name STRING element XML ELEMENT Function XML LOCAL ATTRIBUTE Make an XML LOCAL ATTRIBUTE named name associated with element get xml tag expression CONS XML ELEMENT Function Return the XML tag object of an XML expression Chapter 6 Library Functions 72 get xml attributes expression CONS CONS Function Return the list of attributes of an XML expression may be empty get xml content expression CONS CONS Function Return the list of content elements of an XML expression may be empty get xml cdata content form CONS STRING Function Return the CDATA content of a CDATA form Does NOT make sure that form actually is a CDATA form so bad things can happen if it is given wrong input xml declaration item OBJECT BOOLEAN Function Return true if item is an XML declaration object xml element item OBJECT BOOLEAN Function Return true if item is an XML element object xml attribute item OBJECT BOOLEAN Function Return true if item is an XML attribute object xml cdata item OBJECT BOOLEAN Function Return true if item is an XML CDATA tag object xml cdata form form OBJECT BO
209. ve entry on KEY VALUE LIST 48 Yemove if on CONS c else Rl Ibn einen 38 remove if on HASH SET sese 58 remoye ilf on LIST 322 IY ied eee eae 43 replace heap root on HEAP 103 replace substrihgsS laus dise na 34 required slots on CLASS esses 104 required on STORAGE SLOT 104 reset stella features 104 reset xml hash tables 74 TeSiZO VECEOR vj ci vaca le der PLI yes 51 Fest On LIST i12 iikejp setae e Ree 42 rest on STRING vx err Re Y Fara 33 reverse on CONS 22 4 cen aiciesecsee hep hued eed 38 reverse on KEY VALUE LIST esses 48 reverse Ol LIST i ecew re REP CREADA REIS 43 reverse interyval i2 2 2 rai e s 104 rotate hash 66d6 22 usa e ua 56 rfound l22124 mcd ERR um IURE ae Pere RE 29 I n hoOkS as ae M ea PR ubi Dom i AEA 104 running aS liSp amp 4 een ernia srini 104 running in language lesse 104 running system information 104 122 S safe equal hash code ese esee 104 saf hash Code qo ola oli e RLRPD deaths 104 safe import surrogate ss 62 safe import symbol i lill4 4 4e 61 safe look p Slot c4i0i e3 3 ee uo wanes 104 Safd treo SIZG0 renga Atri n dede n 39 Safety os bob RP eG heeded p 104 save configuration file 104 save configuration value 104 search cons tree with filter
210. vious entry existed with key key that entry is replaced remove at self key LIKE ANY KEY SELF Method on PROPERTY LIST OBJECT Remove the entry that matches the key key Return the value of the matching entry or NULL if there is no matching entry Assumes that at most one entry matches key copy self LIKE SELF Method on PROPERTY LIST Return a copy of the list self The conses in the copy are freshly allocated clear self Method on PROPERTY LIST Make self an empty property list allocate iterator self PROPERTY LIST ITERATOR Method on PROPERTY LIST OF LIKE ANY KEY SELF LIKE ANY VALUE SELF Not documented next self BOOLEAN Method on PROPERTY LIST ITERATOR Not documented KV CONS STANDARD OBJECT Class Not documented any key OBJECT Class Parameter of Not documented any value OBJECT Class Parameter of Not documented key OBJECT Slot of Not documented value OBJECT Slot of Not documented rest KV CONS Slot of Not documented kv cons key OBJECT value OBJECT rest KV CONS KV CONS Function Create fill in and return a new KV CONS copy kv cons list kvconslist KV CONS KV CONS Function Return a copy of the cons list consList KEY VALUE LIST DICTIONARY Class Not documented any key OBJECT Class Parameter of Not documented Chapter 6 Library Functions 48 any value OBJECT Class Parameter of Not documented t
211. y key STRING Not documented any value INTEGER Not documented INTEGER HASH TABLE ABSTRACT HASH TABLE Not documented any key INTEGER Not documented any value OBJECT Not documented FLOAT HASH TABLE ABSTRACT HASH TABLE Not documented any key FLOAT Not documented any value OBJECT Not documented lookup self key LIKE ANY KEY SELF LIKE ANY VALUE SELF Not documented insert at self key LIKE ANY KEY SELF value LIKE ANY VALUE SELF Not documented remove at self key LIKE ANY KEY SELF Not documented 52 Class Class Parameter of Class Parameter of Class Class Parameter of Class Parameter of Class Class Parameter of Class Parameter of Method on HASH TABLE Method on HASH TABLE Method on HASH TABLE lookup self key STRING LIKE ANY VALUE Method on STRING HASH TABLE SELF Not documented insert at self key STRING value OBJECT Method on STRING HASH TABLE Not documented remove at self key STRING Method on STRING HASH TABLE Not documented lookup self key STRING INTEGER Method on STRING TO INTEGER HASH TABLE Not documented Chapter 6 Library Functions 53 insert at self key STRING Method on STRING TO INTEGER HASH TABLE value INTEGER Not documented lookup self key INTEGER LIKE ANY VALUE Method on INTEGER HASH TABLE SELF Not documented
Download Pdf Manuals
Related Search
Related Contents
Philips SHL1700PP Model 3410 Torque Display Philips PAL coax cable SWV2195T Adapti ive Secon ndary M Mirror U ser Man nual Manual del propietario Skimmer Elektrim TVB PACA Guide méthodologique - Parc naturel régional des Alpilles Uniden APPCAM25HD Owner's Manual Velleman vdl15uvy Mellanox Technologies VLT-30111 network switch Copyright © All rights reserved.
Failed to retrieve file