This is Info file js.info, produced by Makeinfo version 1.68 from the
input file js.texi.

INFO-DIR-SECTION NGS JavaScript Interpreter
START-INFO-DIR-ENTRY
* libjs: (js).			The JavaScript interpreter library.
* js: (js)The js Program.	JavaScript interpreter.
END-INFO-DIR-ENTRY

   This file documents NGS JavaScript interpreter 0.2.5

   Copyright (C) 1998 New Generation Software (NGS) Oy

   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.

   Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided that
the entire resulting derived work is distributed under the terms of a
permission notice identical to this one.

   Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that this permission notice may be stated in a
translation approved by the Foundation.


File: js.info,  Node: Top,  Next: Introduction,  Prev: (dir),  Up: (dir)

NGS JavaScript Interpreter
**************************

   This file documents the NGS JavaScript interpreter.  This edition
documents version 0.2.5.

* Menu:

* Introduction::
* NGS JavaScript Language::
* The js Program::
* The jsas Program::
* The jsdas Program::
* The jswrap Program::
* JavaScript API::
* Virtual Machine::
* JavaScript Compiler::
* GNU Library General Public License::
* Index::


File: js.info,  Node: Introduction,  Next: NGS JavaScript Language,  Prev: Top,  Up: Top

Introduction
************

   * overall

   * design goals

   * structure: virtual machine, JSC$, JS glue


File: js.info,  Node: NGS JavaScript Language,  Next: The js Program,  Prev: Introduction,  Up: Top

NGS JavaScript Language
***********************

* Menu:

* Language::
* Global Methods and Properties::
* Native Objects::
* Extensions::


File: js.info,  Node: Language,  Next: Global Methods and Properties,  Prev: NGS JavaScript Language,  Up: NGS JavaScript Language

Language
========

* Menu:

* Lexical Conventions::
* Function Definition::
* Statements::
* Expressions::


File: js.info,  Node: Lexical Conventions,  Next: Function Definition,  Prev: Language,  Up: Language

Lexical Conventions
-------------------

* Menu:

* White Space::
* Comments::
* Reserved Words::
* Identifiers::
* Punctuators::
* Literals::
* Automatic Semicolon Insertion::


File: js.info,  Node: White Space,  Next: Comments,  Prev: Lexical Conventions,  Up: Lexical Conventions

White Space
...........


File: js.info,  Node: Comments,  Next: Reserved Words,  Prev: White Space,  Up: Lexical Conventions

Comments
........


File: js.info,  Node: Reserved Words,  Next: Identifiers,  Prev: Comments,  Up: Lexical Conventions

Reserved Words
..............


File: js.info,  Node: Identifiers,  Next: Punctuators,  Prev: Reserved Words,  Up: Lexical Conventions

Identifiers
...........


File: js.info,  Node: Punctuators,  Next: Literals,  Prev: Identifiers,  Up: Lexical Conventions

Punctuators
...........


File: js.info,  Node: Literals,  Next: Automatic Semicolon Insertion,  Prev: Punctuators,  Up: Lexical Conventions

Literals
........


File: js.info,  Node: Automatic Semicolon Insertion,  Prev: Literals,  Up: Lexical Conventions

Automatic Semicolon Insertion
.............................

   Certain ECMAScript statements must be terminated with a semicolon.
Such a semicolon may always appear explicitly in the source text.  For
pain of the compiler implementator, however, such semicolons may be
omitted from the source text in certain situations.  These situations
are described in details in the ECMA-262 Version 2 draft 22-Apr-98
standard.  Here is <mtr@ngs.fi>'s interpretation of the rules:

   Insert semicolons as you would do in the C language.  Now, you can
omit them:

  1. before '`}'' character

  2. from the end of the line

  3. from the end of the file

The automatic semicolon insertion sets some restrictions how you can
insert whitespace to you code.  You can't insert line breaks:

  1. between LEFTHANDSIDEEXPRESSION and `++' or `--' operator

  2. between `return' and the returned EXPRESSION


File: js.info,  Node: Function Definition,  Next: Statements,  Prev: Lexical Conventions,  Up: Language

Function Definition
-------------------


File: js.info,  Node: Statements,  Next: Expressions,  Prev: Function Definition,  Up: Language

Statements
----------

* Menu:

* Block::
* Variable Statement::
* Empty Statement::
* The if Statement::
* The do...while Statement::
* The while Statement::
* The for Statement::
* The for...in Statement::
* The continue Statement::
* The break Statement::
* The return Statement::
* The with Statement::
* The switch Statement::
* Labeled Statements::
* The throw Statement::
* The try Statement::


File: js.info,  Node: Block,  Next: Variable Statement,  Prev: Statements,  Up: Statements

Block
.....


File: js.info,  Node: Variable Statement,  Next: Empty Statement,  Prev: Block,  Up: Statements

Variable Statement
..................


File: js.info,  Node: Empty Statement,  Next: The if Statement,  Prev: Variable Statement,  Up: Statements

Empty Statement
...............


File: js.info,  Node: The if Statement,  Next: The do...while Statement,  Prev: Empty Statement,  Up: Statements

The `if' Statement
..................


File: js.info,  Node: The do...while Statement,  Next: The while Statement,  Prev: The if Statement,  Up: Statements

The `do'...`while' Statement
............................


File: js.info,  Node: The while Statement,  Next: The for Statement,  Prev: The do...while Statement,  Up: Statements

The `while' Statement
.....................


File: js.info,  Node: The for Statement,  Next: The for...in Statement,  Prev: The while Statement,  Up: Statements

The `for' Statement
...................


File: js.info,  Node: The for...in Statement,  Next: The continue Statement,  Prev: The for Statement,  Up: Statements

The `for'...`in' Statement
..........................


File: js.info,  Node: The continue Statement,  Next: The break Statement,  Prev: The for...in Statement,  Up: Statements

The `continue' Statement
........................


File: js.info,  Node: The break Statement,  Next: The return Statement,  Prev: The continue Statement,  Up: Statements

The `break' Statement
.....................


File: js.info,  Node: The return Statement,  Next: The with Statement,  Prev: The break Statement,  Up: Statements

The `return' Statement
......................


File: js.info,  Node: The with Statement,  Next: The switch Statement,  Prev: The return Statement,  Up: Statements

The `with' Statement
....................

   The syntax of the `with'-statement is:

     with (EXPR) STATEMENT

     with (Math)
       {
         result = sin (PI);
         result -= tan (45);
       }


File: js.info,  Node: The switch Statement,  Next: Labeled Statements,  Prev: The with Statement,  Up: Statements

The `switch' Statement
......................


File: js.info,  Node: Labeled Statements,  Next: The throw Statement,  Prev: The switch Statement,  Up: Statements

Labeled Statements
..................


File: js.info,  Node: The throw Statement,  Next: The try Statement,  Prev: Labeled Statements,  Up: Statements

The `throw' Statement
.....................


File: js.info,  Node: The try Statement,  Prev: The throw Statement,  Up: Statements

The `try' Statement
...................


File: js.info,  Node: Expressions,  Prev: Statements,  Up: Language

Expressions
-----------

* Menu:

* Primary Expressions::
* Left-Hand-Side Expressions::
* Postfix Expressions::
* Unary Operators::
* Multiplicative Operators::
* Additive Operators::
* Bitwise Shift Operators::
* Relational Operators::
* Equality Operators::
* Binary Bitwise Operators::
* Binary Logical Operators::
* Conditional Operator::
* Assignment Operators::
* Comma Operator::


File: js.info,  Node: Primary Expressions,  Next: Left-Hand-Side Expressions,  Prev: Expressions,  Up: Expressions

Primary Expressions
...................


File: js.info,  Node: Left-Hand-Side Expressions,  Next: Postfix Expressions,  Prev: Primary Expressions,  Up: Expressions

Left-Hand-Side Expressions
..........................


File: js.info,  Node: Postfix Expressions,  Next: Unary Operators,  Prev: Left-Hand-Side Expressions,  Up: Expressions

Postfix Expressions
...................


File: js.info,  Node: Unary Operators,  Next: Multiplicative Operators,  Prev: Postfix Expressions,  Up: Expressions

Unary Operators
...............


File: js.info,  Node: Multiplicative Operators,  Next: Additive Operators,  Prev: Unary Operators,  Up: Expressions

Multiplicative Operators
........................


File: js.info,  Node: Additive Operators,  Next: Bitwise Shift Operators,  Prev: Multiplicative Operators,  Up: Expressions

Additive Operators
..................


File: js.info,  Node: Bitwise Shift Operators,  Next: Relational Operators,  Prev: Additive Operators,  Up: Expressions

Bitwise Shift Operators
.......................


File: js.info,  Node: Relational Operators,  Next: Equality Operators,  Prev: Bitwise Shift Operators,  Up: Expressions

Relational Operators
....................


File: js.info,  Node: Equality Operators,  Next: Binary Bitwise Operators,  Prev: Relational Operators,  Up: Expressions

Equality Operators
..................


File: js.info,  Node: Binary Bitwise Operators,  Next: Binary Logical Operators,  Prev: Equality Operators,  Up: Expressions

Binary Bitwise Operators
........................


File: js.info,  Node: Binary Logical Operators,  Next: Conditional Operator,  Prev: Binary Bitwise Operators,  Up: Expressions

Binary Logical Operators
........................


File: js.info,  Node: Conditional Operator,  Next: Assignment Operators,  Prev: Binary Logical Operators,  Up: Expressions

Conditional Operator
....................


File: js.info,  Node: Assignment Operators,  Next: Comma Operator,  Prev: Conditional Operator,  Up: Expressions

Assignment Operators
....................


File: js.info,  Node: Comma Operator,  Prev: Assignment Operators,  Up: Expressions

Comma Operator
..............


File: js.info,  Node: Global Methods and Properties,  Next: Native Objects,  Prev: Language,  Up: NGS JavaScript Language

Global Methods and Properties
=============================

*Standard*
     ECMA-262 Version 2 draft 22-Apr-98

 - Property of Global: NaN
     The *not a number* value.

 - Property of Global: Infinity
     The *positive infinity* value.

 - Function: eval (ANY)

 - Function: parseInt (STRING, RADIX)

 - Function: parseFloat (STRING)

 - Function: escape (STRING)

 - Function: unescape (STRING)

 - Function: isNaN (ANY)

 - Function: isFinite (ANY)

 - Function: debug (ANY)
    *Standard*
          Netscape JavaScript Reference 12-Dec-97


 - Function: print (ANY[,...])
    *Standard*
          Netscape JavaScript Reference 12-Dec-97 ???


 - Function: error (MESSAGE)
    *Standard*
          Netscape JavaScript Reference 12-Dec-97 ???


 - Function: float (ANY)
    *Standard*
          NGS JavaScript Interpreter 0.2.5


 - Function: int (ANY)
    *Standard*
          NGS JavaScript Interpreter 0.2.5


 - Function: isFloat (ANY)
    *Standard*
          NGS JavaScript Interpreter 0.2.5


 - Function: isInt (ANY)
    *Standard*
          NGS JavaScript Interpreter 0.2.5


 - Function: load (FILE...)
    *Standard*
          NGS JavaScript Interpreter 0.2.5


 - Function: loadClass (CLASS_SPEC...)
    *Standard*
          NGS JavaScript Interpreter 0.2.5

     Extend interpreter by calling an initialization function from
     shared library CLASS_SPEC.  The argument CLASS_SPEC can be given in
     the following formats:

    `LIBRARY:FUNCTION'
          The argument LIBRARY specifies the shared library from which
          function FUNCTION is called.  The library specification can be
          given in absolute or relative formats.

    `LIBRARY'
          The argument LIBRARY specifies both the shared library, and
          the name of the entry function.  The name of the entry
          function is the name of the library, without the possible
          leading directory path and any suffixes.

          loadClass ("libexts.so:init_all");
          => CALL FUNCTION `INIT_ALL' FROM LIBRARY `LIBEXTS.SO'
          
          loadClass ("/usr/local/lib/libexts.so:init_all");
          => CALL FUNCTION `INIT_ALL' FROM LIBRARY `/USR/LOCAL/LIB/LIBEXTS.SO'
          
          loadClass ("/usr/local/lib/libdbexts.so");
          => CALL FUNCTION `DBEXTS' FROM LIBRARY `/USR/LOCAL/LIB/LIBEXTS.SO'

     The initialization function must be a void function that takes one
     argument that is a pointer to the interpreter.

          void
          entry (JSInterpPtr interp)
          {
            INITIALIZE EXTENSIONS USING NORMAL `JS.H' AND `JSINT.H'
            INTERFACES.
          }

 - Function: callMethod (OBJECT, METHOD, ARGUMENTS)
    *Standard*
          NGS JavaScript Interpreter 0.2.5

     Call method METHOD from object OBJECT with arguments ARGUMENTS.

          callMethod (System.stdout, "writeln", ["Hello, world!"]);
          -| Hello, world!


File: js.info,  Node: Native Objects,  Next: Extensions,  Prev: Global Methods and Properties,  Up: NGS JavaScript Language

Native Objects
==============

* Menu:

* Array::
* Boolean::
* Date::
* File::
* Directory::
* Function::
* Math::
* Number::
* Object::
* RegExp::
* String::
* System::
* VM::


File: js.info,  Node: Array,  Next: Boolean,  Prev: Native Objects,  Up: Native Objects

Array
-----

*Standard*
     ECMA-262 Version 2 draft 22-Apr-98

*Incompatibilities*
        * The `toSource()' method is missing.

        * The constructor doesn't set the [[Prototype]] and [[Class]]
          properties.

 - Function: Array (COUNT)
 - Function: Array (ITEM...)
     Do exactly the same as the expression `new Array()' called with the
     same arguments.

 - Constructor: Array (COUNT)
 - Constructor: Array (ITEM...)
     Create a new array object.  The first form creates a new array
     which length is COUNT.  All items are set to value `undefined'.
     The second form creates an array that contains the given items as
     its values.

          var a = new Array (5);
          a.length;
          => 5
          a.toString ();
          => undefined,undefined,undefined,undefined,undefined
          
          a = new Array (1, 2, "hello");
          a.length;
          => 3
          a.toString ();
          => 1,2,hello

 - Method on Array: concat (ARRAY[, ...])
     Create a new array object from the items of the called array
     object and the argument arrays ARRAY, ....  The contents of the
     argument arrays are not modified.

          var a = new Array (1, 2, 3);
          var b = a.concat (new Array (4, 5));
          b.length;
          => 5;
          b.toString ();
          => 1,2,3,4,5

 - Method on Array: join ([GLUE])
     Convert the array to a string.  Individual items of the array are
     combined with the string GLUE.  If the argument GLUE is omitted,
     string `","' is used.

          var a = new Array (1, 2, "three");
          a.join ();
          => "1,2,three"
          
          a.join ("-");
          => "1-2-three"

 - Method on Array: pop ()
     Remove the last item of the array.  The method returns the item
     removed.  If the array is empty, value `undefined' is returned.

          a = new Array (1, 2, 3);
          a.pop ();
          => 3
          a.length;
          => 2

 - Method on Array: push (ANY...)
     Insert items to the end of the array.  The method returns the last
     item pushed.

          a = new Array (1, 2);
          a.push (7);
          => 7
          a.push (7, 8, 9);
          => 9
          System.print (a.join (", "), "\n");
          -| 1, 2, 7, 7, 8, 9

 - Method on Array: reverse ()
     Reverse the array.

          a = new Array (1, 2, 3);
          a.reverse ();
          System.print (a.join (""), "\n");
          -| 321

 - Method on Array: shift ()
     Remove item from the beginning of the array.  The method returns
     the item removed, or value `undefined' if the array was empty.

          a = new Array (1, 2, 3);
          a.shift ();
          => 1

 - Method on Array: slice (START[, END])
     Return a new array containing items between START (inclusively)
     and END (exclusively) in the array.  If the argument END is
     negative, it is counted from the end of the array.  If the argument
     END is omitted, the method extract items from the position START
     to the end of the array.

          a = new Array (1, 2, 3, 4, 5);
          b = a.slice (1, 4);
          System.print (b.join (", "), "\n");
          -| 2, 3, 4
          b = a.slice (1, -2);
          System.print (b.join (", "), "\n");
          -| 2, 3
          b = a.slice (2);
          System.print (b.join (", "), "\n");
          -| 3, 4, 5

 - Method on Array: splice (INDEX, REMOVE[, ANY...])
     Modify array by removing old items and by inserting new ones.  The
     argument INDEX specifies the index from which the array is
     modified.  The argument REMOVE specifies how many old items are
     removed.  If the argument REMOVE is 0, no old items are removed
     and at least one new item must have been given.  After the items
     are removed, all remaining arguments are inserted after the
     position INDEX.

          var a = new Array (1, 2, 3);
          a.splice (1, 1);
          => 1, 3
          a.splice (1, 0, "new item");
          => 1, "new item", 2, 3
          
          var a = new Array (1, 2, 3, 4);
          a.splice (1, 2, "new item");
          => 1, "new item", 4

 - Method on Array: sort ([SORT_FUNCTION])
     Sort the array to the order specified by the argument function
     SORT_FUNCTION.  The comparison function SORT_FUNCTION takes two
     arguments and it must return one of the following codes:

    `-1'
          the first argument items is smaller than the second item
          (must come before the second item)

    `0'
          the items are equal

    `1'
          the first argument item is bigger than the second item (it
          must come after the second item)

     If the argument SORT_FUNCTION is omitted, the items are sorted to
     an alphabetical (lexicographical) order.

          a = new Array ("Jukka-Pekka", "Jukka", "Kari", "Markku");
          a.sort ();
          System.print (a, "\n");
          -| Jukka,Jukka-Pekka,Kari,Markku
          a = new Array (1, 2, 10, 20, 100, 200);
          a.sort ();
          System.stdout.writeln (a.toString ());
          -| 1,10,100,2,20,200

     The sort method is stable in that sense that, if the comparison
     function returns 0 for two items, their original order in the
     array is preserved.  For example, if a list of person objects is
     sorted first by their names, and second by their ages, all persons
     with the same age will remain sorted in an alphabetical order.

          function by_age (a, b)
          {
            return a.age - b.age;
          }
          
          function by_name (a, b)
          {
            if (a.name < b.name)
              return -1;
            if (a.name > b.name)
              return 1;
            return 0;
          }
          
          function Person (name, age)
          {
            this.name = name;
            this.age = age;
          }
          
          a = new Array (new Person ("Smith", 30),
                         new Person ("Jones", 31),
                         new Person ("Bob", 30),
                         new Person ("Chris", 29));
          
          a.sort (by_name);
          a.sort (by_age);
          
          for (i in a)
            System.print (i.name, ", ", i.age, "\n");
          -| Chris, 29
          -| Bob, 30
          -| Smith, 30
          -| Jones, 31

 - Method on Array: toSource ()

 - Method on Array: toString ()
     Convert the array to a string.  The method converts each item of
     the array to string and combines them with the string `","'.

          var a = new Array (1, "foo", 2, new Array (7, 8));
          a.toString ();
          => 1,foo,2,7,8

 - Method on Array: unshift (ANY...)
     Insert items ANY... to the beginning of the array.  The method
     returns the new length of the array.

          a = new Array (1, 2, 3);
          System.print (a.unshift (7, 8, 9), "\n");
          -| 6

 - Property of Array: length
     The length of the array.

          var a = new Array (1, 2);
          a.length;
          => 2
          a.push (3, 4, 5);
          a.length;
          => 5


File: js.info,  Node: Boolean,  Next: Date,  Prev: Array,  Up: Native Objects

Boolean
-------

*Standard*
     ECMA-262 Version 2 draft 22-Apr-98

*Incompatibilities*
        * The constructor doesn't set the [[Prototype]] and [[Class]]
          properties.

 - Function: Boolean ()
     Return `false'.

 - Function: Boolean (VALUE)

 - Constructor: Boolean ()
 - Constructor: Boolean (VALUE)
     Create a new boolean object.  If no arguments are given, the
     returned object will have value `false'.  If the argument VALUE is
     given, the initial value of the object is determined by the type
     of the argument and its value.  If the argument VALUE is
     `undefined', `null', `false', `""' (an empty string), or `0', the
     value of the object will be `false'.  All other values for the
     argument VALUE will set the initial value of the object to `true'.

 - Method on Boolean: toString ()
     Return a string presentation of the boolean object.  The method
     will return string `"true"' or `"false"' according to the value of
     the object.

 - Method on Boolean: valueOf ()


File: js.info,  Node: Date,  Next: File,  Prev: Boolean,  Up: Native Objects

Date
----

*Standard*
     ECMA-262 Version 2 draft 22-Apr-98

*Incompatibilities*
     XXX Check all methods and properties.

 - Function: MakeTime (HOUR, MIN, SEC, MS)

 - Function: MakeDay (YEAR, MONTH, DATE)

 - Function: MakeDate (DAY, TIME)

 - Function: TimeClip (TIME)

 - Function: Date ([A1[, A2[, A3[, A4[, A5[, A6[, A7]]]]]]])
     When the `Date' constructor is called as a function, it ignores
     arguments A1...A7 and returns the result of expression:

          new Date ().toString()

 - Constructor: Date ()
 - Constructor: Date ("MONTH DAY, YEAR HOURS:MINUTES:SECONDS")
 - Constructor: Date (YR_NUM, MO_NUM, DAY_NUM)
 - Constructor: Date (YR_NUM, MO_NUM, DAY_NUM, HR_NUM, MIN_NUM, SEC_NUM)

 - Static Method on Date: UTC (YEAR, MONTH, DAY, HRS, MIN, SEC)

 - Method on Date: format (FORMAT)

 - Method on Date: formatGMT (FORMAT)

 - Method on Date: getDate ()

 - Method on Date: getDay ()

 - Method on Date: getHours ()

 - Method on Date: getMinutes ()

 - Method on Date: getMonth ()

 - Method on Date: getSeconds ()

 - Method on Date: getTime ()

 - Method on Date: getTimezoneOffset ()

 - Method on Date: getYear ()

 - Method on Date: parse (STRING)

 - Method on Date: setDate (DAY)

 - Method on Date: setHours (HOURS)

 - Method on Date: setMinutes (MINUTES)

 - Method on Date: setMonths (MONTHS)

 - Method on Date: setSeconds (SECONDS)

 - Method on Date: setTime (TIME)

 - Method on Date: setYear (YEAR)

 - Method on Date: toGMTString ()

 - Method on Date: toLocaleString ()


File: js.info,  Node: File,  Next: Directory,  Prev: Date,  Up: Native Objects

File
----

*Standard*
     Netscape JavaScript Reference 12-Dec-97

*Incompatibilities*
     XXX Check all methods and properties.

 - Constructor: File (PATH)

 - Static Method on File: byteToString (BYTE)

 - Static Method on File: chmod (PATH, MODE)
    *Standard*
          NGS JavaScript Interpreter 0.2.5

     Change permissions of file PATH to MODE.  The modes are specifeid
     by or'ing the following values:

    `04000'
          set user ID on execution

    `02000'
          set group ID on execution

    `01000'
          sticky bit

    `00400'
          read by owner

    `00200'
          write by owner

    `00100'
          execute / search by owner

    `00040'
          read by group

    `00020'
          write by group

    `00010'
          execute / search by group

    `00004'
          read by others

    `00002'
          write by others

    `00001'
          execute / search by others

 - Static Method on File: lstat (PATH)
    *Standard*
          NGS JavaScript Interpreter 0.2.5


 - Static Method on File: remove (PATH)
    *Standard*
          NGS JavaScript Interpreter 0.2.5


 - Static Method on File: rename (PATH)
    *Standard*
          NGS JavaScript Interpreter 0.2.5


 - Static Method on File: stat (PATH)
    *Standard*
          NGS JavaScript Interpreter 0.2.5

     Return statistics about the file FILE.  The method returns a 13
     element array containing the statistics, or `false' if the file
     couldn't be inspected.

     The returned array contains the following items:

    `dev'
          Device that contains a directory entry for this file.

    `ino'
          Index of this file on its device.  A file is uniquely
          identified by specifying its `dev' and `ino'.

    `mode'
          The mode of the file.

    `nlink'
          The number of hard links to the file.

    `uid'
          The ID of the file owner.

    `gid'
          The ID of the file group.

    `rdev'
          The ID of the device.

    `size'
          The size of the file.

    `atime'
          The time when the data was last accessed.

    `mtime'
          The time when the data was last modified.

    `ctime'
          The time when the file status was last changed.

    `blksize'
          Preferred blocksize for file system I/O.

    `blocks'
          The number of blocks the file actually uses.

          fields = new Array ("dev", "ino", "mode", "nlink", "uid",
                              "gid", "rdev", "size", "atime",
                              "mtime", "ctime", "blksize", "blocks");
          
          var a = File.stat ("js");
          if (a)
            {
              var i;
              for (i = 0; i < a.length; i++)
                System.print (fields[i], "=", a[i], " ");
              System.print ("\n");
            }
          
          -| dev=655368 ino=370741 mode=33261 nlink=1 uid=201 gid=200
          -| rdev=2979328 size=731370 atime=893159080 mtime=893158537
          -| ctime=893158537 blksize=4096 blocks=1432

 - Static Method on File: stringToByte (STRING)

 - Method on File: open (MODE)
     The argument MODE must have one of the following values:

    `r'[`b']

    `w'[`b']

    `a'[`b']

    `r+'[`b']

    `w+'[`b']

    `a+'[`b']

 - Method on File: close ()

 - Method on File: setPosition (POSITION[, WHENCE])

 - Method on File: getPosition ()

 - Method on File: eof ()

 - Method on File: read (SIZE)

 - Method on File: readln ()

 - Method on File: readByte ()

 - Method on File: toString ()

 - Method on File: write (STRING)

 - Method on File: writeln (STRING)

 - Method on File: writeByte (BYTE)

 - Method on File: ungetByte (BYTE)
    *Standard*
          NGS JavaScript Interpreter 0.2.5


 - Method on File: flush ()

 - Method on File: getLength ()

 - Method on File: exists ()

 - Method on File: error ()

 - Method on File: clearError ()

 - Property of File: autoFlush
    *Standard*
          NGS JavaScript Interpreter 0.2.5

     Flag that specifies whether the stream should automatically flush
     its buffers after a write.

 - Property of File: bufferSize
    *Standard*
          NGS JavaScript Interpreter 0.2.5

     The I/O buffer size of the stream.  The buffer size can be changed
     at the runtime.


File: js.info,  Node: Directory,  Next: Function,  Prev: File,  Up: Native Objects

Directory
---------

*Standard*
     NGS JavaScript Interpreter 0.2.5

 - Constructor: Directory (PATH)

 - Method on Directory: close ()

 - Method on Directory: open ()

 - Method on Directory: read ()

 - Method on Directory: rewind ()

 - Method on Directory: seek (POS)

 - Method on Directory: tell ()


File: js.info,  Node: Function,  Next: Math,  Prev: Directory,  Up: Native Objects

Function
--------


File: js.info,  Node: Math,  Next: Number,  Prev: Function,  Up: Native Objects

Math
----

*Standard*
     ECMA-262 Version 2 draft 22-Apr-98

 - Static Method on Math: abs (X)

 - Static Method on Math: acos (X)

 - Static Method on Math: asin (X)

 - Static Method on Math: atan (X)

 - Static Method on Math: atan2 (Y, X)

 - Static Method on Math: ceil (X)

 - Static Method on Math: cos (X)

 - Static Method on Math: exp (X)

 - Static Method on Math: floor (X)

 - Static Method on Math: log (X)

 - Static Method on Math: max (X, Y)

 - Static Method on Math: min (X, Y)

 - Static Method on Math: pow (X, Y)

 - Static Method on Math: random ()

 - Static Method on Math: round (X)

 - Static Method on Math: seed (X)
    *Standard*
          NGS JavaScript Interpreter 0.2.5


 - Static Method on Math: sin (X)

 - Static Method on Math: sqrt (X)

 - Static Method on Math: tan (X)

 - Static Property of Math: E

 - Static Property of Math: LN10

 - Static Property of Math: LN2

 - Static Property of Math: LOG10E

 - Static Property of Math: LOG2E

 - Static Property of Math: PI

 - Static Property of Math: SQRT1_2

 - Static Property of Math: SQRT2


File: js.info,  Node: Number,  Next: Object,  Prev: Math,  Up: Native Objects

Number
------

*Standard*
     ECMA-262 Version 2 draft 22-Apr-98

 - Function: Number()
     Return value `0'.

 - Function: Number (VALUE)

 - Constructor: Number ()
 - Constructor: Number (VALUE)
     Create a new number object.  If no argument is given, the
     constructor returns value `+0'.  If the argument VALUE is given,
     the constructor returns `ToNumber(VALUE)'.

          new Number ();
          => 0
          new Number (3.1415);
          => 3.1415
          new Number (true);
          => 1


 - Method on Number: toString ([RADIX])
     Convert the number to its textual presentation.  If the argument
     RADIX is given, it specifies the radix to which the number is
     formatted.  If the argument RADIX is not given, it defaults to
     `10'.

          System.stdout.writeln ((193).toString ());
          -| 193
          System.stdout.writeln ((193).toString (8));
          -| 301
          System.stdout.writeln ((193).toString (16));
          -| c1
          System.stdout.writeln ((193).toString (2));
          -| 11000001

 - Method on Number: valueOf ()
     Return the value of the number object.

 - Static Property of Number: MAX_VALUE

 - Static Property of Number: MIN_VALUE

 - Static Property of Number: NaN

 - Static Property of Number: NEGATIVE_INFINITY

 - Static Property of Number: POSITIVE_INFINITY


File: js.info,  Node: Object,  Next: RegExp,  Prev: Number,  Up: Native Objects

Object
------

*Standard*
     ECMA-262 Version 2 draft 22-Apr-98

*Incompatibilities*
        * The `toString()' and `toSource()' methods are missing.

        * The constructor doesn't set the [[Prototype]] and [[Class]]
          properties.

 - Function: Object ([VALUE])

 - Constructor: Object ([VALUE])
     Create a new object.

          var o = new Object ();

 - Method on Object: toString ()

 - Method on Object: toSource ()

 - Method on Object: valueOf ()


File: js.info,  Node: RegExp,  Next: String,  Prev: Object,  Up: Native Objects

RegExp
------

*Standard*
     ECMA-262 Version 2 draft 22-Apr-98

*Incompatibilities*
        * The regular expression engine - taken from the GNU Emacs -
          might not support all features that are required.

        * XXX Check all methods and properties.

 - Constructor: RegExp (PATTERN[, FLAGS])
     Create a new regular expression from string PATTERN.  The optional
     argument string FLAGS can contain the following options:

    `i'
          Ignore case; the matching is case-insensitive.

    `g'
          Global search.  This allows you to iterate over all matches
          of the expression by executing the `exec' method multiple
          times against the string.

 - Method on RegExp: compile (PATTERN[, FLAGS])
     Create a new regular expression from string PATTERN using optional
     options FLAGS.  The method can be used to change the regular
     expression pattern or its flags in the regular expression object.
     The method returns an error if the string PATTERN do not specify a
     well-formed regular expression.

     *Note!*  All regular expressions are always compiled in this
     implementation.  This holds also for the expressions, created with
     the `RegExp()' constructor.

          var re = new RegExp ("ab*");
          re.compile ("ab*", "i");

 - Method on RegExp: exec ([STRING])
     Match the expression against the string STRING.  If the argument
     STRING is omitted, the regular expression is matched against the
     `RegExp.input' string.  The method returns an array that holds the
     matched portions of the expression.

          var re = new RegExp ("d(b+)(d)", "ig");
          var a = re.exec ("cdbBdbsbz");
          a.toString ();
          => "dbBd,bB,d"

   In the previous example, the result array `a' has the following
items:

`dbBd'
     The substring that matched the regular expression.  This string
     can also be retrieved as `RegExp.lastMatch'.

`bB'
     The matched substring for the first parenthesized subexpression
     `(b+)'.  This match can also be found as `RegExp.$1'.

`d'
     The matched substring for the second parentsized subexpression
     `(d)'.  This match can also be found as `RegExp.$2'.

   The option `g' of the regular expression can be used to iterate over
multiple matches of the expression on at a time.  For example, the
following code fragment searches for the expression `a(b*)' from the
string `str'.  In the inial state - when the expression is create with
the constructor - the object's `lastIndex' property is set to 0.  When
the expression is matched against the string, the `lastIndex' property
is updated to point to the next index from which the matching should be
continued.  Therefore, the following example iterates over all matches
in the string `str'.

     var re = new RegExp ("a(b*)", "g");
     var str = "abbcdefabh";
     while (a = re.exec (str))
       System.print ("Found ", a, ". Next match starts at ", re.lastIndex,
     		    ".\n");
     -| Found abb. Next match starts at 3.
     -| Found ab. Next match starts at 9.

   The property `REGEXP.lastIndex' can also be set explicitly to start
the matching from a pre-defined position.

 - Method on RegExp: test ([STRING])
     Test whether the regular expression matches for the string STRING.
     If the argument STRING is omitted, the regular expression is
     tested against the `RegExp.input' string.

          var re = new RegExp ("fo*bar");
          re.test ("fbar");
          => true
          re.test ("fooBar");
          => false
          
          re = new RegExp ("fo*bar", "i");
          re.test ("FOObAR");
          => true
          
          RegExp.input = "#include <stdio.h>";
          re = new RegExp ("^#");
          re.test ();
          => true

 - Static Property of RegExp: $1
 - Static Property of RegExp: $2
 - Static Property of RegExp: $3
 - Static Property of RegExp: $4
 - Static Property of RegExp: $5
 - Static Property of RegExp: $6
 - Static Property of RegExp: $7
 - Static Property of RegExp: $8
 - Static Property of RegExp: $9
     The matching substring for the n:th parenthesized subexpression.
     If the latest regular expression didn't have that many
     parenthesized subexpressions, the property has value `undefined'.

 - Static Property of RegExp: $_
 - Static Property of RegExp: input
     The string against which the expression was tested.  The `input'
     property is also used, if no string argument was given for the
     `test()' or `exec()' methods.

          var str = file.readln ();
          re.test (str);
          RegExp.input;
          => THE STRING RETURNED BY THE `FILE.READLN()' METHOD.

 - Static Property of RegExp: lastMatch
     The substring that matched the whole expression in the last regular
     expression matching.

 - Static Property of RegExp: lastParen
     The last parenthesized subexpression of the last regular expression
     matching.

 - Static Property of RegExp: leftContext
     The substring from the beginning of the input string to the
     beginning of the matching substring of the last regular expression.

          var re = new RegExp ("foo");
          var str = "garbage foo tail garbage";
          re.exec (str);
          RegExp.leftContext;
          => "garbage "

 - Static Property of RegExp: multiline

 - Static Property of RegExp: rightContext
     The substring from the end of the matching substring to the end the
     input string.

          var re = new RegExp ("foo");
          var str = "garbage foo tail garbage";
          re.exec (str);
          RegExp.rightContext;
          => " tail garbage"

 - Property of RegExp: global
     Flag that tells if the option `g' was given for the constructor or
     for the `compile' method.

 - Property of RegExp: ignoreCase
     Flat that tells if the option `i' was given for the construtor or
     for the `compile' method.

 - Property of RegExp: lastIndex
     The index from which the matching is continued with the global
     (`g') expressions.

 - Property of RegExp: source
     The source string from which the regular expression object was
     created.


File: js.info,  Node: String,  Next: System,  Prev: RegExp,  Up: Native Objects

String
------

*Standard*
     ECMA-262 Version 2 draft 22-Apr-98

*Incompatibilities*
        * The constructor doesn't set the [[Prototype]] and [[Class]]
          properties.

 - Constructor: String (STRING)
     Create a new string object and set its data to STRING.

          var str = new String ("Hello, world");
          => "Hello, world!"

 - Static Method on String: fromCharCode (CODE...)
     Create a new string object from the character codes CODE....

          var str = String.fromCharCode (72, 101, 108, 108, 111, 33);
          => "Hello!"

 - Static Method on String: pack (FORMAT, ARG[, ...])
    *Standard*
          NGS JavaScript Interpreter 0.2.5

     Create a new string by packing values ARG... to a string according
     to the format string FORMAT.

     The format is a sequence of characters that specify the type of
     values as follows:

    `C'
          an unsigned char value

    `n'
          a short in "network" (big-endian) order

    `N'
          a long in "network" (big-endian) order

    `d'
          a double-precision float in the native format

 - Method on String: append (STRING)
    *Standard*
          NGS JavaScript Interpreter 0.2.5

     Append string STRING to the end of the string object.  The string
     object must be a dynamic string, not a constant string literal.

          var str = new String ("");
          str.append ("foo");
          str.append ("-");
          str.append ("bar");
          => "foo-bar"

 - Method on String: charAt (POSITION)
     Create a new string that constains the character from position
     POSITION of the the string object.

          "foobar".charAt (3);
          => "b"

 - Method on String: charCodeAt (POSITION)
     Return the code of the character at position POSITION in the
     string object.

          "foobar".charCodeAt (3);
          => 98

 - Method on String: concat (STRING[, ...])
     Create a new string by appending the argument strings STRING, ...
     to the end of the string object.

          "foo".concat ("bar");
          => "foobar"

 - Method on String: crc32 ()
    *Standard*
          NGS JavaScript Interpreter 0.2.5

     Count a 32-bit CRC of the string.

          var str = "Hello, world!";
          System.print ("CRC32 of \"", str, "\" is ",
                        str.crc32 ().toString (16), ".\n");
          -| CRC32 of "Hello, world!" is e4928064.

 - Method on String: indexOf (STRING[, START_INDEX])
     Return the index of the first substring of STRING within the
     string object, or -1 if the string didn't contain the substring.
     The optional argument START_INDEX can be used to specify the index
     from which the searching is started.

          var str = "foobar foo bar foo";
          str.indexOf ("foo");
          => 0
          str.indexOf (" foo");
          => 6
          str.indexOf ("foo", 1);
          => 7
          str.indexOf ("Foo");
          => -1

 - Method on String: lastIndexOf (STRING[, START_INDEX])
     Return the the index of the last substring of STRING within the
     string object, or -1 if the string didn't contain the substring.
     The optional argument START_INDEX can be used to specify the index
     from which the searching is started.

          var str = "foobar foo bar foo";
          str.lastIndexOf ("foo");
          => 15
          str.lastIndexOf ("bar");
          => 11
          str.lastIndexOf ("foo", 14);
          => 7
          str.lastIndexOf ("Foo");
          => -1

 - Method on String: match (REGEXP)

 - Method on String: replace (REGEXP, SUBSTITUTION)

 - Method on String: search (REGEXP)

 - Method on String: slice (START[, END])

 - Method on String: split (SEPARTOR[, LIMIT])

 - Method on String: substr (START[, LENGTH])

 - Method on String: substring (START[, END])

 - Method on String: toLowerCase ()
     Create a new string which contents is the data of the string
     object, converted to the lower case.

          "FoObAr".toLowerCase ();
          => "foobar"

 - Method on String: toUpperCase ()
     Create a new string which contents is the data of the string
     object, converted to the upper case.

          "FoObAr".toUpperCase ();
          => "FOOBAR"

 - Method on String: unpack (FORMAT)
    *Standard*
          NGS JavaScript Interpreter 0.2.5


 - Property of String: length
     The length of the string.

          "foobar".length;
          => 6
          var str = new String ("foo");
          str.append ("bar");
          str.length;
          => 6


File: js.info,  Node: System,  Next: VM,  Prev: String,  Up: Native Objects

System
------

*Standard*
     NGS JavaScript Interpreter 0.2.5

 - Static Method on System: chdir (DIRECTORY)
     Change the process' current working directory to DIRECTORY.  The
     function returns a boolean success status.

 - Static Method on System: error (ANY[, ...])
     Convert arguments ANY... to string and print the resulting string
     to the standard error stream of the system.

 - Static Method on System: exit (CODE)
     Terminate the program execution and return the value CODE to the
     operating system as the return value of the running program.
     Effectively the method performs C-code `exit (CODE)'.

 - Static Method on System: getcwd ()
     Get the current working directory of the process.  The function
     returns a strings presenting the directory or `false' if errors
     were encountered.

 - Static Method on System: getenv (VARIABLE)
     Return the value of the environment variable VARIABLE.  The method
     returns the value as a string or `undefined' if the variable was
     not defined in the environment.

 - Static Method on System: popen (COMMAND, MODE)

 - Static Method on System: print (ANY[, ...])
     Convert arguments ANY... to string and print the resulting string
     to the standard output stream of the system.

 - Static Method on System: sleep (SECONDS)
     Stop the interpreter for SECONDS seconds.

 - Static Method on System: strerror (ERRNO)
     Return a string that describes the system error code ERRNO.

 - Static Method on System: system (COMMAND)

 - Static Method on System: usleep (MICRO_SECONDS)
     Stop the interpreter for MICRO_SECONDS micro seconds.

 - Static Property of System: bits
     Return a value that describes the "bitness" of the underlying
     system.  Possible values might be `16', `32', `64', or even `128'.
     Normally this is the size of a host system pointer in bits.

 - Static Property of System: canonicalHost
     The canonical host name of the system where the interpreter was
     compiled.

          System.stdout.writeln (System.canonicalHost);
          -| powerpc-ibm-aix4.2.1.0

 - Static Property of System: canonicalHostCPU
     The CPU part of the canonical host name.

          System.stdout.writeln (System.canonicalHostCPU);
          -| powerpc

 - Static Property of System: canonicalHostVendor
     The Vendor part of the canonical host name.

          System.stdout.writeln (System.canonicalHostVendor);
          -| ibm

 - Static Property of System: canonicalHostOS
     The OS part of the canonical host name.

          System.stdout.writeln (System.canonicalHostOS);
          -| aix4.2.1.0

 - Static Property of System: errno
     The system's error number.  The error number can be converted to a
     string with the `strerror()' method of the System object.

          var fp = new File ("output.txt");
          if (!fp.open ("w"))
            System.error ("couldn't create output file `", fp, "': ",
                          System.strerror (System.errno), "\n");
          -| couldn't create output file `output.txt': Permission denied

 - Static Property of System: lineBreakSequence
     The line break sequence that is used in the underlying system.  For
     example, the outputs from the following lines are identical:

          System.stdout.writeln ("Hello!");
          -| Hello!
          System.stdout.write ("Hello!" + System.lineBreakSequence);
          -| Hello!


 - Static Property of System: stderr
     The system's standard error stream.  This is a normal JavaScript
     file and all methods of the File object can be called for it.

          System.stderr.writeln ("panic: must exit");
          System.exit (1);
          -| panic: must exit

 - Static Property of System: stdin
     The system's standard input stream.

 - Static Property of System: stdout
     The system's standard output stream.


File: js.info,  Node: VM,  Prev: System,  Up: Native Objects

VM
--

*Standard*
     NGS JavaScript Interpreter 0.2.5

 - Static Method on VM: garbageCollect ()
     Perform a garbage collection for the virtual machine heap.
     Normally, the garbage collection is triggered automatically, but
     the `garbageCollect()' method can be used to trigger the collection
     explicitly.

 - Static Method on VM: stackTrace ([LIMIT])
     Print the contents of the virtual machine stack.  Optional argument
     LIMIT specifies how many stack frames are printed.  If no
     arguments are given, the whole virtual machine stack is printed.

          function recursive (n)
          {
            if (n > 5)
              VM.stackTrace ();
            else
              recursive (n + 1);
          }
          
          recursive (0);
          -|VM: stacktrace: stacksize=2048, used=78
          -|#0   recursive(): builtin 0
          -|#1   recursive(): null 1 6
          -|#2   recursive(): null 1 5
          -|#3   recursive(): null 1 4
          -|#4   recursive(): null 1 3
          -|#5   recursive(): null 1 2
          -|#6   recursive(): null 1 1
          -|#7   .global(): null 1 0

 - Static Property of VM: dispatchMethod
     The name of the dispatch method, currently used in the virtual
     machine.  The method returns a string that describes the method.
     The possible return values are `switch-basic', `switch', and
     `jumps'.

 - Static Property of VM: gcCount
     How many times the garbage collection has been performed for the
     heap.

 - Static Property of VM: gcTrigger
     The garbage collection trigger.  When the virtual machine heap has
     allocated more than `gcTrigger' number of bytes of memory, the
     virtual machine will perform a garbage collection.

 - Static Property of VM: heapAllocated
     The number of bytes of memory the system has allocated from the
     heap.

 - Static Property of VM: heapFree
     The number of bytes of memory the heap freelist contains.

 - Static Property of VM: heapSize
     The size of the heap in bytes.

 - Static Property of VM: numConstants
     The number of constants defined in the virtual machine.

 - Static Property of VM: numGlobals
     The number of global symbols defined in the virtual machine.  This
     value equals to the number of global variables and functions,
     defined in the system.

 - Static Property of VM: stackSize
     The size of the virtual machine stack.

 - Static Property of VM: stacktraceOnError
     A boolean flag that tells whether the virtual machine stack trace
     is printed if an error occurs in the program execution.

 - Static Property of VM: verbose
     The verbosity level of the virtual machine.

 - Static Property of VM: verboseStacktrace
     A boolean flag that tells whether the virtual machine prints the
     normal or verbose stacktrace.

 - Static Property of VM: version
     The version string of the interpreter virtual machine.

 - Static Property of VM: versionMajor
     The major version number of the virtual machine.

 - Static Property of VM: versionMinor
     The minor version number of the virtual machine.

 - Static Property of VM: versionPatch
     The patch level number of the virtual machine.

 - Static Property of VM: warnUndef
     A boolean flag that tells whether the virtual machine should print
     a warning message if an undefined variable is used.


File: js.info,  Node: Extensions,  Prev: Native Objects,  Up: NGS JavaScript Language

Extensions
==========

* Menu:

* Curses::
* JS::
* MD5::


File: js.info,  Node: Curses,  Next: JS,  Prev: Extensions,  Up: Extensions

Curses
------


File: js.info,  Node: JS,  Next: MD5,  Prev: Curses,  Up: Extensions

JS
--

 - Constructor: JS ()

 - Method on JS: compile (FILE, ASM_FILE, BC_FILE)

 - Method on JS: eval (STRING)

 - Method on JS: evalFile (FILENAME)

 - Method on JS: evalJavaScriptFile (FILENAME)

 - Method on JS: executeByteCodeFile (FILENAME)

 - Method on JS: getVar (NAME)

 - Method on JS: setVar (NAME, VALUE)

 - Property of JS: errorMessage

