PDA

View Full Version : ASH changes in 7.7



Veracity
05-27-2006, 04:22 AM
Bug fixes:

- Variables always get initialized to a default value when the scope
* they are defined is entered, unless the script initializes them at
* time of declaration. The following two declarations are therefore now
* always equivalent (and so on for all other datatypes):

* * int a;
* * int a = 0;

- Float variables now correctly coerce into strings when you are trying
* to concatenate strings (for the argument to print, for example).

- The "exit" command, just like pressing the "abort" button, will stop a
* script immediately, cleanly unwinding and cease execution.

New functions:

* * string url_encode( string text );
* * string url_decode( string text );
* * int random( int range );
* * int round( float arg );
* * int truncate( float arg );
* * int floor( float arg );
* * int ceil( float arg );
* * int current_mind_control_level();

New features:

- Unary minus. You can now say:

* * x = -1;

* rather than having to workaround the lack by saying:

* * x = 0 - 1;

- ASH will only import a particular file once during script parsing. You
* can safely import library files as often as you want and ASH will
* silently ignore the second and subsequent attempts to import.

Debugging:

- If you turn on the debug log, ASH will verbosely trace the execution
* of your script. I attempted to make it self explanatory to anybody
* capable of writing a script...

Internal efficiency improvements. Warning: the following is quite technical, so
don't be intimidated, but they represent a huge amount of code-whackage, so
I feel like taking credit. :)

- Former linked-list implementations have been replaced with standard
* "library" list types. This takes the pointer to the elements out of
* the elements themselves and moves it to the list implementation, so
* there is no memory benefit as a result, but it frees elements to
* appear on more than one list, which does reduce memory usage by
* allowing sharing of common constants, like "true" and "false".

* Additionally, each "library" implementation provides some efficiency
* improvements over the simple linked list used before"

* 1) Symbol tables of variables and functions are now in a SortedListModel.

* * *Add element: O(log n) rather than O(n)
* * *Find element: O(log n) rather than O(n)
* * *Count elements: O(1) rather than O(n)

* 2) Sequential lists are now in an ArrayList

* * *Add element: O(1) rather than O(n)
* * *Find element: still O(n)
* * *Count elements: O(1) rather than O(n)

- Symbol table of built-in functions is created only the first time you
* execute an ASH script, rather than every time you do so.

* * *Lower dynamic memory usage, better performance

- Each built-in function is now a Method, rather than code in a big
* if-then-else tree of function name comparisons. The Method is found
* and associated with the symbol when the built-in function symbol table
* is created.

* * *No execution time required to find method, compared to O(n) string
* * *comparisons.

* * *Improved maintainability: trivial to add new built-in functions.