mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-29 12:23:30 +00:00
Remove the no longer used kjs library
svn path=/trunk/; revision=24592
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
|
||||
Authors of the NGS JavaScript Interpreter
|
||||
|
||||
Markku Rossi <[email protected]>
|
||||
@@ -1,482 +0,0 @@
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the library GPL. It is
|
||||
numbered 2 because it goes with version 2 of the ordinary GPL.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Library General Public License, applies to some
|
||||
specially designated Free Software Foundation software, and to any
|
||||
other libraries whose authors decide to use it. You can use it for
|
||||
your libraries, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if
|
||||
you distribute copies of the library, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link a program with the library, you must provide
|
||||
complete object files to the recipients so that they can relink them
|
||||
with the library, after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright
|
||||
the library, and (2) offer you this license which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
library. If the library is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original
|
||||
version, so that any problems introduced by others will not reflect on
|
||||
the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that companies distributing free
|
||||
software will individually obtain patent licenses, thus in effect
|
||||
transforming the program into proprietary software. To prevent this,
|
||||
we have made it clear that any patent must be licensed for everyone's
|
||||
free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary
|
||||
GNU General Public License, which was designed for utility programs. This
|
||||
license, the GNU Library General Public License, applies to certain
|
||||
designated libraries. This license is quite different from the ordinary
|
||||
one; be sure to read it in full, and don't assume that anything in it is
|
||||
the same as in the ordinary license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that
|
||||
they blur the distinction we usually make between modifying or adding to a
|
||||
program and simply using it. Linking a program with a library, without
|
||||
changing the library, is in some sense simply using the library, and is
|
||||
analogous to running a utility program or application program. However, in
|
||||
a textual and legal sense, the linked executable is a combined work, a
|
||||
derivative of the original library, and the ordinary General Public License
|
||||
treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General
|
||||
Public License for libraries did not effectively promote software
|
||||
sharing, because most developers did not use the libraries. We
|
||||
concluded that weaker conditions might promote sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the
|
||||
users of those programs of all benefit from the free status of the
|
||||
libraries themselves. This Library General Public License is intended to
|
||||
permit developers of non-free programs to use free libraries, while
|
||||
preserving your freedom as a user of such programs to change the free
|
||||
libraries that are incorporated in them. (We have not seen how to achieve
|
||||
this as regards changes in header files, but we have achieved it as regards
|
||||
changes in the actual functions of the Library.) The hope is that this
|
||||
will lead to faster development of free libraries.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, while the latter only
|
||||
works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary
|
||||
General Public License rather than by this special one.
|
||||
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which
|
||||
contains a notice placed by the copyright holder or other authorized
|
||||
party saying it may be distributed under the terms of this Library
|
||||
General Public License (also called "this License"). Each licensee is
|
||||
addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also compile or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
c) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
d) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the source code distributed need not include anything that is normally
|
||||
distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Library General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
@@ -1,112 +0,0 @@
|
||||
1999-01-15 Markku Rossi <[email protected]>
|
||||
|
||||
* configure.in: Added AC_FUNC_ALLOCA.
|
||||
|
||||
1999-01-12 Markku Rossi <[email protected]>
|
||||
|
||||
* configure.in (with_dload_val): Added check for the dlfcn.h
|
||||
header file.
|
||||
|
||||
1998-10-20 Markku Rossi <[email protected]>
|
||||
|
||||
* Version 0.2.4 released.
|
||||
|
||||
1998-10-02 Markku Rossi <[email protected]>
|
||||
|
||||
* configure.in: New configure option --enable-operand-hooks to
|
||||
enable the byte-code operand hooks.
|
||||
|
||||
1998-09-17 Markku Rossi <[email protected]>
|
||||
|
||||
* configure.in: Fixed the --with-pthreads to resolve the compiler
|
||||
and its options which are needed when compiling thread
|
||||
applications. The thread checks are defined in `am/pthreads.m4'
|
||||
file.
|
||||
|
||||
1998-09-07 Markku Rossi <[email protected]>
|
||||
|
||||
* Version 0.2.2 released.
|
||||
|
||||
1998-08-24 Markku Rossi <[email protected]>
|
||||
|
||||
* Version 0.2.1 released.
|
||||
|
||||
1998-08-17 Markku Rossi <[email protected]>
|
||||
|
||||
* configure.in: Added check for struct_st.st_blksize.
|
||||
|
||||
1998-08-12 Markku Rossi <[email protected]>
|
||||
|
||||
* configure.in: New option --disable-jumps to unconditionally
|
||||
disable the `jumps' byte-code instruction dispatch method.
|
||||
|
||||
1998-08-10 Markku Rossi <[email protected]>
|
||||
|
||||
* configure.in: Changed to use libtool for libraries. Now the
|
||||
libjs can be built to a shared library.
|
||||
|
||||
1998-08-04 Markku Rossi <[email protected]>
|
||||
|
||||
* Added `projects' subdirectory to hold JS related work and
|
||||
contributions.
|
||||
|
||||
1998-07-06 Markku Rossi <[email protected]>
|
||||
|
||||
* Changed the license to GNU Library General Public License LGPL.
|
||||
|
||||
* Version 0.2.0 released.
|
||||
|
||||
1998-06-26 Markku Rossi <[email protected]>
|
||||
|
||||
* configure.in: New option --enable-profiling to enable byte-code
|
||||
operand profiling.
|
||||
Renamed --with-all-dispatchers to --enable-all-dispatchers.
|
||||
|
||||
1998-06-25 Markku Rossi <[email protected]>
|
||||
|
||||
* Added jsas directory for the JavaScript assembler.
|
||||
|
||||
1998-06-09 Markku Rossi <[email protected]>
|
||||
|
||||
* Version 0.1.2 released.
|
||||
|
||||
1998-06-02 Markku Rossi <[email protected]>
|
||||
|
||||
* configure.in: New options --without-js and --without-md5 to
|
||||
undefine the JS and MD5 extensions.
|
||||
Added check for the lstat() function that is not present on
|
||||
djgpp/Windows 95.
|
||||
Added check for struct stat's st_blocks member. That is not
|
||||
present on djgpp/windows 95.
|
||||
Thanks to Dave Pearson <[email protected]> for the
|
||||
djgpp/Window95 notes.
|
||||
Added checks for some pthread differences.
|
||||
|
||||
1998-05-29 Markku Rossi <[email protected]>
|
||||
|
||||
* Version 0.1.1 released.
|
||||
|
||||
1998-05-25 Markku Rossi <[email protected]>
|
||||
|
||||
* Version 0.1.0 released.
|
||||
|
||||
1998-04-07 Markku Rossi <[email protected]>
|
||||
|
||||
* Version 0.0.2 frozen.
|
||||
|
||||
1998-04-02 Markku Rossi <[email protected]>
|
||||
|
||||
* configure.in: New option --with-all-dispatchers to enable all
|
||||
byte-code instruction dispatchers.
|
||||
|
||||
1998-03-30 Markku Rossi <[email protected]>
|
||||
|
||||
* Added micros directory for micro ports.
|
||||
|
||||
1998-02-27 Markku Rossi <[email protected]>
|
||||
|
||||
* Added dasm and docs directories to the project.
|
||||
|
||||
1998-02-23 Markku Rossi <[email protected]>
|
||||
|
||||
* Started to use auto{make,conf} in the project.
|
||||
@@ -1,183 +0,0 @@
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
These are generic installation instructions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, a file
|
||||
`config.cache' that saves the results of its tests to speed up
|
||||
reconfiguring, and a file `config.log' containing compiler output
|
||||
(useful mainly for debugging `configure').
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If at some point `config.cache'
|
||||
contains results you don't want to keep, you may remove or edit it.
|
||||
|
||||
The file `configure.in' is used to create `configure' by a program
|
||||
called `autoconf'. You only need `configure.in' if you want to change
|
||||
it or regenerate `configure' using a newer version of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
Running `configure' takes awhile. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
5. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. You can give `configure'
|
||||
initial values for variables by setting them in the environment. Using
|
||||
a Bourne-compatible shell, you can do that on the command line like
|
||||
this:
|
||||
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
|
||||
|
||||
Or on systems that have the `env' program, you can do it like this:
|
||||
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you have to use a `make' that does not supports the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a time
|
||||
in the source code directory. After you have installed the package for
|
||||
one architecture, use `make distclean' before reconfiguring for another
|
||||
architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=PATH' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' can not figure out
|
||||
automatically, but needs to determine by the type of host the package
|
||||
will run on. Usually `configure' can figure that out, but if it prints
|
||||
a message saying it can not guess the host type, give it the
|
||||
`--host=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name with three fields:
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the host type.
|
||||
|
||||
If you are building compiler tools for cross-compiling, you can also
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for and the `--build=TYPE' option to select the type of
|
||||
system on which you are compiling the package.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Operation Controls
|
||||
==================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Use and save the results of the tests in FILE instead of
|
||||
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
|
||||
debugging `configure'.
|
||||
|
||||
`--help'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to `/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--version'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options.
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type"
|
||||
content="text/html; charset=ISO-8859-1">
|
||||
<title>Kernel Javascript Support</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Kernel Javascript support</h1>
|
||||
<br>
|
||||
This document details the kernel javascript debugging extension
|
||||
recently added to the reactos kernel.<br>
|
||||
<h2>Enabling</h2>
|
||||
The extension is enabled when KDBG := 1 is set in <span
|
||||
style="font-family: monospace;">config</span> in the reactos source
|
||||
tree.<br>
|
||||
<br>
|
||||
kdb presents the usual prompt when ReactOS starts, but the '<span
|
||||
style="font-family: monospace;">js</span>' command initializes the
|
||||
javascript system and allows the user to start working with the system
|
||||
in javascript. A welcome banner is displayed when the system is
|
||||
ready, along with the prompt <span style="font-family: monospace;">kjs:></span>.<br>
|
||||
<h2>Using</h2>
|
||||
You may type as many lines in each input as needed. To cancel
|
||||
some input, just enter '.' as the only character on an input
|
||||
line. To exit from the javascript interpreter, enter '.' on the
|
||||
first input line. In order to determine when the user is finished
|
||||
typing, the kernel javascript system uses the harmless ';;'
|
||||
sequence. Entering ';;' anywhere in the input terminates input
|
||||
and evaluates the current input buffer. The buffer is emptied
|
||||
afterward. Any javascript error messages or output are printed
|
||||
before the next prompt is displayed. Note that the interpreter
|
||||
does not automatically print the evaluation results, so it's useful to
|
||||
wrap simple evaluations with write().<br>
|
||||
<br>
|
||||
<h2>Sample Session</h2>
|
||||
<pre>kdb:> js<br>JS Registry Init Complete. Welcome to ReactOS kernel scripting<br>Kernel Debugger Script Interface (JavaScript :-)<br>Terminate input with ;; and end scripting with .<br>kjs:> write(System.getmodule(1));; <br>hal.dll,3225501696 <br>kjs:> write(System.getmodule(1)[1].toString(16));; <br>c0414000<br>kjs:> write(ebp().toString(16));;<br>cee8bf84<br><br>kjs:> function dump_sec(base) {<br>..... base2 = peekw(base + 0x3c) + base;<br>..... sec_off = 0xf8;<br>..... for( i = 0; peekl(base2 + sec_off + (40 * i)); i++ ) {<br>..... base_sec = base2 + sec_off + (40 * i);<br>..... write("Section: " + System.mread(0,base_sec) + "\n");<br>..... write("RVA: " + peekl(base_sec + 12).toString(16) + "\n");<br>..... }<br>..... }<br>..... ;;<br>kjs:> dump_sec(0xc0000000);;<br>Section: .text<br>RVA: 1000<br>Section: init<br>RVA: e6000<br>Section: .data<br>RVA: f4000<br>Section: .edata<br>RVA: 10d000<br>Section: .idata<br>RVA: 115000<br>Section: .rsrc<br>RVA: 116000<br>Section: .bss<br>RVA: 118000<br>Section: .reloc<br>RVA: 15a000<br><br>kjs:> var key = "\\registry\\machine\\system\\currentcontrolset\\services\\ne20001\\parameters\\tcpip";;<br>kjs:> write(regread(key,"defaultgateway"));;<br>10.0.0.1<br></pre>
|
||||
<h2>Builtin and initialized functions</h2>
|
||||
These functions are available after a successful javascript
|
||||
initialization:<br>
|
||||
<br style="font-weight: bold;">
|
||||
<span style="font-weight: bold;">System.getmodule(n) => (string,int)
|
||||
array</span><br>
|
||||
<br>
|
||||
Returns the name and base address of the nth module in the kernel
|
||||
module list.<br>
|
||||
<br style="font-weight: bold;">
|
||||
<span style="font-weight: bold;">System.mread(s,address) =>
|
||||
integer/string</span><br>
|
||||
<br>
|
||||
System.mread reads a value from memory and returns it. s
|
||||
determines what type of read is performed, and address specifies the
|
||||
starting address of the operation.<br>
|
||||
<br>
|
||||
Valid values of s are:<br>
|
||||
<br>
|
||||
0 -- Read a null-terminated ascii string<br>
|
||||
1 -- Read a byte<br>
|
||||
2 -- Read a word<br>
|
||||
4 -- Read a dword<br style="font-weight: bold;">
|
||||
<br style="font-weight: bold;">
|
||||
<span style="font-weight: bold;">System.mwrite(s,address,value) =>
|
||||
bool</span><br>
|
||||
<br>
|
||||
System.mwrite writes a value to a memory address. The operand
|
||||
size depends on s, 1 for byte, 2 for word, 4 for dword.<br>
|
||||
<br>
|
||||
<span style="font-weight: bold;">System.print(...) => undefined</span><br>
|
||||
<br>
|
||||
Uses DbgPrint to print the specified output. In javascript, every
|
||||
value is printable, so feel free to give any value type to print.<br>
|
||||
Use C style escapes for tabs and newlines: \t and \n.<br>
|
||||
<br>
|
||||
<span style="font-weight: bold;">System.regs(int) => int</span><br>
|
||||
<br>
|
||||
System.regs read the specified word value from the TRAP_FRAME given to
|
||||
kdb when it was started. This is useful for locating the stack,
|
||||
along with various other queries. The machine registers are also
|
||||
provided as named functions by javascript, for example ebp() and eax().<br>
|
||||
<br>
|
||||
<span style="font-weight: bold;">System.regread(key,value) =>
|
||||
string/undefined</span><br>
|
||||
<br>
|
||||
System.regread reads a string value from the registry (as a member of
|
||||
the specified registry key). If the read is successful, the
|
||||
string value contained in it is returned. If the value cannot be
|
||||
read, then undefined is returned.<br>
|
||||
<br>
|
||||
This method is used by the registry initializer to read the
|
||||
initialization strings.<br>
|
||||
<br>
|
||||
<span style="font-weight: bold;">ebp(), eip(), esp() ... vm86_gs()
|
||||
=> int</span><br>
|
||||
<br>
|
||||
Every register provided by the system trap frame is available as a
|
||||
global function of the same name. This makes reading specific
|
||||
registers easy.<br>
|
||||
<br>
|
||||
<span style="font-weight: bold;">peek,peekw,peekl(int addr) => int</span><br>
|
||||
<br>
|
||||
Aliases for System.mread([1,2,4],addr)<br>
|
||||
<br>
|
||||
<span style="font-weight: bold;">poke,pokew,pokel(int addr, int value)
|
||||
=> int</span><br>
|
||||
<br>
|
||||
Aliases for System.mwrite([1,2,4],addr,value)<br>
|
||||
<br>
|
||||
<span style="font-weight: bold;">write(...) => undefined</span><br>
|
||||
<br>
|
||||
Alias for System.print<br>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,6 +0,0 @@
|
||||
This interpreter has been modified for use in the ReactOS kernel as a
|
||||
debugging aid. The original files are available in the src directory,
|
||||
and modified files are in the ksrc directory.
|
||||
|
||||
The file jsconfig.h which is normally automatically generated has been
|
||||
hand generated here.
|
||||
@@ -1,35 +0,0 @@
|
||||
#
|
||||
# Automakefile for JS interpreter.
|
||||
# Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
#
|
||||
# Author: Markku Rossi <[email protected]>
|
||||
#
|
||||
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
# MA 02111-1307, USA
|
||||
#
|
||||
|
||||
SUBDIRS = src jsc jsas jsdas jswrap docs micros examples projects
|
||||
|
||||
include_HEADERS = jsconfig.h
|
||||
|
||||
ACLOCAL_AMFLAGS = -I $(srcdir)/am @ACLOCAL_FLAGS_FOR_LIBTOOL@
|
||||
|
||||
dist-hook:
|
||||
mkdir $(distdir)/am
|
||||
cp -p $(srcdir)/am/pthreads.m4 $(distdir)/am/pthreads.m4
|
||||
mkdir $(distdir)/am.opt
|
||||
cp -p $(srcdir)/am.opt/libtool.m4 $(distdir)/am.opt/libtool.m4
|
||||
@@ -1,384 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
#
|
||||
# Automakefile for JS interpreter.
|
||||
# Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
#
|
||||
# Author: Markku Rossi <[email protected]>
|
||||
#
|
||||
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
# MA 02111-1307, USA
|
||||
#
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = .
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
ACLOCAL_FLAGS_FOR_LIBTOOL = @ACLOCAL_FLAGS_FOR_LIBTOOL@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
EXTENSIONS = @EXTENSIONS@
|
||||
EXTENSIONS_LIBS = @EXTENSIONS_LIBS@
|
||||
INTERPRETER_FEATURES = @INTERPRETER_FEATURES@
|
||||
LD = @LD@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
NM = @NM@
|
||||
PACKAGE = @PACKAGE@
|
||||
PGCC_BY_PROVENZANO = @PGCC_BY_PROVENZANO@
|
||||
RANLIB = @RANLIB@
|
||||
U = @U@
|
||||
VERSION = @VERSION@
|
||||
XLC_R_AIX = @XLC_R_AIX@
|
||||
|
||||
SUBDIRS = src jsc jsas jsdas jswrap docs micros examples projects
|
||||
|
||||
include_HEADERS = jsconfig.h
|
||||
|
||||
ACLOCAL_AMFLAGS = -I $(srcdir)/am @ACLOCAL_FLAGS_FOR_LIBTOOL@
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = jsconfig.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
HEADERS = $(include_HEADERS)
|
||||
|
||||
DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
|
||||
Makefile.in NEWS THANKS TODO acconfig.h aclocal.m4 config.guess \
|
||||
config.sub configure configure.in install-sh jsconfig.h.in ltconfig \
|
||||
ltmain.sh missing mkinstalldirs stamp-h.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
all: all-recursive-am all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
$(ACLOCAL_M4): configure.in
|
||||
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
|
||||
config.status: $(srcdir)/configure
|
||||
$(SHELL) ./config.status --recheck
|
||||
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
||||
cd $(srcdir) && $(AUTOCONF)
|
||||
|
||||
jsconfig.h: stamp-h
|
||||
@:
|
||||
stamp-h: $(srcdir)/jsconfig.h.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES= CONFIG_HEADERS=jsconfig.h \
|
||||
$(SHELL) ./config.status
|
||||
@echo timestamp > stamp-h
|
||||
$(srcdir)/jsconfig.h.in: $(srcdir)/stamp-h.in
|
||||
$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
|
||||
cd $(top_srcdir) && $(AUTOHEADER)
|
||||
@echo timestamp > $(srcdir)/stamp-h.in
|
||||
|
||||
mostlyclean-hdr:
|
||||
|
||||
clean-hdr:
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f jsconfig.h
|
||||
|
||||
maintainer-clean-hdr:
|
||||
|
||||
install-includeHEADERS: $(include_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(includedir)
|
||||
@list='$(include_HEADERS)'; for p in $$list; do \
|
||||
if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
|
||||
echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \
|
||||
$(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \
|
||||
done
|
||||
|
||||
uninstall-includeHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(include_HEADERS)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(includedir)/$$p; \
|
||||
done
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
all-recursive install-data-recursive install-exec-recursive \
|
||||
installdirs-recursive install-recursive uninstall-recursive \
|
||||
check-recursive installcheck-recursive info-recursive dvi-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
(cd $$subdir && $(MAKE) $$target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
|
||||
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
rev="$$subdir $$rev"; \
|
||||
done; \
|
||||
for subdir in $$rev; do \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
(cd $$subdir && $(MAKE) $$target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
(cd $$subdir && $(MAKE) tags); \
|
||||
done
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) jsconfig.h.in $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)jsconfig.h.in$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags jsconfig.h.in $$unique $(LISP) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
-rm -rf $(distdir)
|
||||
GZIP=$(GZIP) $(TAR) zxf $(distdir).tar.gz
|
||||
mkdir $(distdir)/=build
|
||||
mkdir $(distdir)/=inst
|
||||
dc_install_base=`cd $(distdir)/=inst && pwd`; \
|
||||
cd $(distdir)/=build \
|
||||
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
|
||||
&& $(MAKE) \
|
||||
&& $(MAKE) dvi \
|
||||
&& $(MAKE) check \
|
||||
&& $(MAKE) install \
|
||||
&& $(MAKE) installcheck \
|
||||
&& $(MAKE) dist
|
||||
-rm -rf $(distdir)
|
||||
@echo "========================"; \
|
||||
echo "$(distdir).tar.gz is ready for distribution"; \
|
||||
echo "========================"
|
||||
dist: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
dist-all: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
distdir: $(DISTFILES)
|
||||
-rm -rf $(distdir)
|
||||
mkdir $(distdir)
|
||||
-chmod 777 $(distdir)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
for subdir in $(SUBDIRS); do \
|
||||
test -d $(distdir)/$$subdir \
|
||||
|| mkdir $(distdir)/$$subdir \
|
||||
|| exit 1; \
|
||||
chmod 777 $(distdir)/$$subdir; \
|
||||
(cd $$subdir && $(MAKE) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
|
||||
|| exit 1; \
|
||||
done
|
||||
$(MAKE) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook
|
||||
info: info-recursive
|
||||
dvi: dvi-recursive
|
||||
check: all-am
|
||||
$(MAKE) check-recursive
|
||||
installcheck: installcheck-recursive
|
||||
all-recursive-am: jsconfig.h
|
||||
$(MAKE) all-recursive
|
||||
|
||||
all-am: Makefile $(HEADERS) jsconfig.h
|
||||
|
||||
install-data-am: install-includeHEADERS
|
||||
|
||||
uninstall-am: uninstall-includeHEADERS
|
||||
|
||||
install-exec: install-exec-recursive
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install-data: install-data-recursive install-data-am
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-recursive install-data-am
|
||||
@:
|
||||
|
||||
uninstall: uninstall-recursive uninstall-am
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs: installdirs-recursive
|
||||
$(mkinstalldirs) $(DATADIR)$(includedir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic
|
||||
|
||||
clean-am: clean-hdr clean-tags clean-generic mostlyclean-am
|
||||
|
||||
distclean-am: distclean-hdr distclean-tags distclean-generic clean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-hdr maintainer-clean-tags \
|
||||
maintainer-clean-generic distclean-am
|
||||
|
||||
mostlyclean: mostlyclean-recursive mostlyclean-am
|
||||
|
||||
clean: clean-recursive clean-am
|
||||
|
||||
distclean: distclean-recursive distclean-am
|
||||
-rm -f config.status
|
||||
-rm -f libtool
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive maintainer-clean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
-rm -f config.status
|
||||
|
||||
.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
|
||||
uninstall-includeHEADERS install-includeHEADERS install-data-recursive \
|
||||
uninstall-data-recursive install-exec-recursive \
|
||||
uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
|
||||
all-recursive check-recursive installcheck-recursive info-recursive \
|
||||
dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
|
||||
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
|
||||
distclean-tags clean-tags maintainer-clean-tags distdir info dvi \
|
||||
installcheck all-recursive-am all-am install-data-am uninstall-am \
|
||||
install-exec install-data install uninstall all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
dist-hook:
|
||||
mkdir $(distdir)/am
|
||||
cp -p $(srcdir)/am/pthreads.m4 $(distdir)/am/pthreads.m4
|
||||
mkdir $(distdir)/am.opt
|
||||
cp -p $(srcdir)/am.opt/libtool.m4 $(distdir)/am.opt/libtool.m4
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -1,384 +0,0 @@
|
||||
# Generated automatically from Makefile.in by configure.
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
#
|
||||
# Automakefile for JS interpreter.
|
||||
# Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
#
|
||||
# Author: Markku Rossi <[email protected]>
|
||||
#
|
||||
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
# MA 02111-1307, USA
|
||||
#
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = .
|
||||
top_srcdir = .
|
||||
prefix = /usr/local/js-0.2.5
|
||||
exec_prefix = ${prefix}
|
||||
|
||||
bindir = ${exec_prefix}/bin
|
||||
sbindir = ${exec_prefix}/sbin
|
||||
libexecdir = ${exec_prefix}/libexec
|
||||
datadir = ${prefix}/share
|
||||
sysconfdir = ${prefix}/etc
|
||||
sharedstatedir = ${prefix}/com
|
||||
localstatedir = ${prefix}/var
|
||||
libdir = ${exec_prefix}/lib
|
||||
infodir = ${prefix}/info
|
||||
mandir = ${prefix}/man
|
||||
includedir = ${prefix}/include
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/js
|
||||
pkglibdir = $(libdir)/js
|
||||
pkgincludedir = $(includedir)/js
|
||||
|
||||
top_builddir = .
|
||||
|
||||
ACLOCAL = aclocal
|
||||
AUTOCONF = autoconf
|
||||
AUTOMAKE = automake
|
||||
AUTOHEADER = autoheader
|
||||
|
||||
INSTALL = /usr/bin/install -c
|
||||
INSTALL_PROGRAM = ${INSTALL}
|
||||
INSTALL_DATA = ${INSTALL} -m 644
|
||||
INSTALL_SCRIPT = ${INSTALL_PROGRAM}
|
||||
transform = s,x,x,
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = i686-pc-linux-gnu
|
||||
host_triplet = i686-pc-linux-gnu
|
||||
ACLOCAL_FLAGS_FOR_LIBTOOL =
|
||||
CC = gcc
|
||||
CPP = gcc -E
|
||||
EXTENSIONS = dl_open.lo xjs.lo xmd5.lo md5c.lo
|
||||
EXTENSIONS_LIBS = -ldl
|
||||
INTERPRETER_FEATURES = r_std.lo
|
||||
LD = /usr/bin/ld
|
||||
LIBTOOL = $(SHELL) $(top_builddir)/libtool
|
||||
LN_S = ln -s
|
||||
MAKEINFO = makeinfo
|
||||
NM = /usr/bin/nm -B
|
||||
PACKAGE = js
|
||||
PGCC_BY_PROVENZANO =
|
||||
RANLIB = ranlib
|
||||
U =
|
||||
VERSION = 0.2.5
|
||||
XLC_R_AIX =
|
||||
|
||||
SUBDIRS = src jsc jsas jsdas jswrap docs micros examples projects
|
||||
|
||||
include_HEADERS = jsconfig.h
|
||||
|
||||
ACLOCAL_AMFLAGS = -I $(srcdir)/am
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = jsconfig.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
HEADERS = $(include_HEADERS)
|
||||
|
||||
DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
|
||||
Makefile.in NEWS THANKS TODO acconfig.h aclocal.m4 config.guess \
|
||||
config.sub configure configure.in install-sh jsconfig.h.in ltconfig \
|
||||
ltmain.sh missing mkinstalldirs stamp-h.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
all: all-recursive-am all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
$(ACLOCAL_M4): configure.in
|
||||
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
|
||||
config.status: $(srcdir)/configure
|
||||
$(SHELL) ./config.status --recheck
|
||||
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
||||
cd $(srcdir) && $(AUTOCONF)
|
||||
|
||||
jsconfig.h: stamp-h
|
||||
@:
|
||||
stamp-h: $(srcdir)/jsconfig.h.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES= CONFIG_HEADERS=jsconfig.h \
|
||||
$(SHELL) ./config.status
|
||||
@echo timestamp > stamp-h
|
||||
$(srcdir)/jsconfig.h.in: $(srcdir)/stamp-h.in
|
||||
$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
|
||||
cd $(top_srcdir) && $(AUTOHEADER)
|
||||
@echo timestamp > $(srcdir)/stamp-h.in
|
||||
|
||||
mostlyclean-hdr:
|
||||
|
||||
clean-hdr:
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f jsconfig.h
|
||||
|
||||
maintainer-clean-hdr:
|
||||
|
||||
install-includeHEADERS: $(include_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(includedir)
|
||||
@list='$(include_HEADERS)'; for p in $$list; do \
|
||||
if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
|
||||
echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \
|
||||
$(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \
|
||||
done
|
||||
|
||||
uninstall-includeHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(include_HEADERS)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(includedir)/$$p; \
|
||||
done
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
|
||||
|
||||
|
||||
all-recursive install-data-recursive install-exec-recursive \
|
||||
installdirs-recursive install-recursive uninstall-recursive \
|
||||
check-recursive installcheck-recursive info-recursive dvi-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
(cd $$subdir && $(MAKE) $$target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
|
||||
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
rev="$$subdir $$rev"; \
|
||||
done; \
|
||||
for subdir in $$rev; do \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
(cd $$subdir && $(MAKE) $$target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
(cd $$subdir && $(MAKE) tags); \
|
||||
done
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) jsconfig.h.in $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)jsconfig.h.in$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags jsconfig.h.in $$unique $(LISP) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
-rm -rf $(distdir)
|
||||
GZIP=$(GZIP) $(TAR) zxf $(distdir).tar.gz
|
||||
mkdir $(distdir)/=build
|
||||
mkdir $(distdir)/=inst
|
||||
dc_install_base=`cd $(distdir)/=inst && pwd`; \
|
||||
cd $(distdir)/=build \
|
||||
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
|
||||
&& $(MAKE) \
|
||||
&& $(MAKE) dvi \
|
||||
&& $(MAKE) check \
|
||||
&& $(MAKE) install \
|
||||
&& $(MAKE) installcheck \
|
||||
&& $(MAKE) dist
|
||||
-rm -rf $(distdir)
|
||||
@echo "========================"; \
|
||||
echo "$(distdir).tar.gz is ready for distribution"; \
|
||||
echo "========================"
|
||||
dist: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
dist-all: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
distdir: $(DISTFILES)
|
||||
-rm -rf $(distdir)
|
||||
mkdir $(distdir)
|
||||
-chmod 777 $(distdir)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
for subdir in $(SUBDIRS); do \
|
||||
test -d $(distdir)/$$subdir \
|
||||
|| mkdir $(distdir)/$$subdir \
|
||||
|| exit 1; \
|
||||
chmod 777 $(distdir)/$$subdir; \
|
||||
(cd $$subdir && $(MAKE) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
|
||||
|| exit 1; \
|
||||
done
|
||||
$(MAKE) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook
|
||||
info: info-recursive
|
||||
dvi: dvi-recursive
|
||||
check: all-am
|
||||
$(MAKE) check-recursive
|
||||
installcheck: installcheck-recursive
|
||||
all-recursive-am: jsconfig.h
|
||||
$(MAKE) all-recursive
|
||||
|
||||
all-am: Makefile $(HEADERS) jsconfig.h
|
||||
|
||||
install-data-am: install-includeHEADERS
|
||||
|
||||
uninstall-am: uninstall-includeHEADERS
|
||||
|
||||
install-exec: install-exec-recursive
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install-data: install-data-recursive install-data-am
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-recursive install-data-am
|
||||
@:
|
||||
|
||||
uninstall: uninstall-recursive uninstall-am
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs: installdirs-recursive
|
||||
$(mkinstalldirs) $(DATADIR)$(includedir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic
|
||||
|
||||
clean-am: clean-hdr clean-tags clean-generic mostlyclean-am
|
||||
|
||||
distclean-am: distclean-hdr distclean-tags distclean-generic clean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-hdr maintainer-clean-tags \
|
||||
maintainer-clean-generic distclean-am
|
||||
|
||||
mostlyclean: mostlyclean-recursive mostlyclean-am
|
||||
|
||||
clean: clean-recursive clean-am
|
||||
|
||||
distclean: distclean-recursive distclean-am
|
||||
-rm -f config.status
|
||||
-rm -f libtool
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive maintainer-clean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
-rm -f config.status
|
||||
|
||||
.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
|
||||
uninstall-includeHEADERS install-includeHEADERS install-data-recursive \
|
||||
uninstall-data-recursive install-exec-recursive \
|
||||
uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
|
||||
all-recursive check-recursive installcheck-recursive info-recursive \
|
||||
dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
|
||||
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
|
||||
distclean-tags clean-tags maintainer-clean-tags distdir info dvi \
|
||||
installcheck all-recursive-am all-am install-data-am uninstall-am \
|
||||
install-exec install-data install uninstall all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
dist-hook:
|
||||
mkdir $(distdir)/am
|
||||
cp -p $(srcdir)/am/pthreads.m4 $(distdir)/am/pthreads.m4
|
||||
mkdir $(distdir)/am.opt
|
||||
cp -p $(srcdir)/am.opt/libtool.m4 $(distdir)/am.opt/libtool.m4
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -1,131 +0,0 @@
|
||||
|
||||
What's new in the NGS JavaScript Interpreter
|
||||
============================================
|
||||
|
||||
Noteworthy changes in js-0.2.5:
|
||||
|
||||
- Implemented nested function declarations, e.g. function
|
||||
declarations as statements.
|
||||
- Ported to 64 bit Alpha chip.
|
||||
|
||||
|
||||
Noteworthy changes in js-0.2.4:
|
||||
|
||||
- Security options for the virtual machine to disable insecure
|
||||
methods from the File and System built-in objects.
|
||||
- New global method `print()' that prints its arguments to the
|
||||
system's standard output stream.
|
||||
- User-definable event hooks.
|
||||
- New built-in object `Directory' to access directories.
|
||||
- ECMAScript compatibility fixes in: built-in objects, byte-code
|
||||
operands, compiler
|
||||
- Optimizations in the memory usage.
|
||||
- Simple constant folding optimization for additive expressions.
|
||||
- JavaScript assembler `jsas'.
|
||||
- Many bug fixes.
|
||||
|
||||
|
||||
Noteworthy changes in js-0.2.3:
|
||||
|
||||
* Misc
|
||||
|
||||
- ECMAScript compatibility fixes in: built-in objects, byte-code
|
||||
operands, compiler
|
||||
- fixed the configure option `--with-pthreads' to resolve the system
|
||||
features
|
||||
|
||||
|
||||
Noteworthy changes in js-0.2.2:
|
||||
|
||||
* Misc
|
||||
|
||||
- js.h API changes
|
||||
- better ECMAScript support
|
||||
|
||||
* JSC
|
||||
|
||||
- do Statement while (Expression);
|
||||
- switch (Expression) CaseBlock
|
||||
- try statement (ECMAScript compatible)
|
||||
- labeled statements
|
||||
- the continue and break statements now support the labeled
|
||||
statements
|
||||
- local variable declarations in for statements
|
||||
- \xHH and \uHHHH escape sequences in string and regular expression
|
||||
literals
|
||||
- strict equals and does-not-equal operators
|
||||
- the `arguments' property of function instance
|
||||
- optimizations and code cleanups
|
||||
|
||||
|
||||
Noteworthy changes in js-0.2.1:
|
||||
|
||||
* New methods:
|
||||
|
||||
** global methods
|
||||
|
||||
- callMethod() to call methods from objects with given array of
|
||||
arguments.
|
||||
- loadClass() extend the interpreter by calling extension entry
|
||||
functions from shared libraries.
|
||||
|
||||
** File
|
||||
|
||||
- chmod() change permissions of a file
|
||||
|
||||
** Number
|
||||
|
||||
- constructor `new Number()'
|
||||
- global method `Number()' invocation
|
||||
|
||||
* The `js' program
|
||||
|
||||
- new option -x, --executable to add execute permissions to the
|
||||
generated byte-code files
|
||||
- new warning options: -Wmissing-semicolon, -Wstrict-ecma, -Wpedantic
|
||||
|
||||
* js.h API changes
|
||||
|
||||
* Misc
|
||||
|
||||
- Uses libtool for libraries. Now the libjs can be built to a
|
||||
shared library.
|
||||
- New utility program `jswrap' to create C functions that are
|
||||
implemented in JavaScript.
|
||||
- Automatic semicolon insertion.
|
||||
- Support for regular expression literals.
|
||||
- Support for array initializers.
|
||||
- updates in the byte-code operands
|
||||
- new configure option `--disable-jumps' to uncoditionally disable
|
||||
the `jumps' byte-code instruction dispatch method
|
||||
- ported to Windows 9x/NT
|
||||
|
||||
|
||||
Noteworthy changes in js-0.2.0:
|
||||
|
||||
* The license was changed to GNU Library General Public License LGPL.
|
||||
|
||||
* JSC
|
||||
|
||||
- Implemented 'foo'-strings. The character constants are now
|
||||
written as #'a'.
|
||||
- Implemented the mod operand.
|
||||
|
||||
* Implemented the prototype properties for objects.
|
||||
|
||||
* Implemented the prototype properties for built-in objects. Now you
|
||||
can define your own properties for built-in objects.
|
||||
|
||||
* Major cleanups in the memory management:
|
||||
|
||||
- The interpreter will not exit if memory allocations fail.
|
||||
- Fixed all known memory leaks.
|
||||
- Optimized the heap freelist handling. This reduces the memory
|
||||
consumption noticeably.
|
||||
|
||||
* Namespace cleanups.
|
||||
|
||||
* Documentation updates.
|
||||
|
||||
* Bug fixes and feature updates. Please, see the ChangeLogs for the
|
||||
details.
|
||||
@@ -1,69 +0,0 @@
|
||||
|
||||
NGS JavaScript Interpreter
|
||||
==========================
|
||||
|
||||
Welcome to the NGS JavaScript interpreter. The NGS JavaScript is a
|
||||
GPL free interpreter for the JavaScript language. The JavaScript
|
||||
language is an interpreted C-like language, developed by Netscape et
|
||||
al.
|
||||
|
||||
The NGS JavaScript interpreter is free software; you can redistribute
|
||||
it and/or modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA
|
||||
|
||||
|
||||
* Design Goals
|
||||
|
||||
This implementation is not 100% compatible with the JavaScript
|
||||
language, found from the Netscape's WWW browsers and servers. To
|
||||
achieve the following design goals, some shortcuts have been taken in
|
||||
the implementation, as compared to the Netscape's implementation.
|
||||
|
||||
This implementation is designed to be:
|
||||
|
||||
- re-entrant
|
||||
|
||||
the interpreter can be safely used in multi-threaded environments
|
||||
|
||||
- extendible
|
||||
|
||||
the interpreter API allows user-defined commands and classes, and it
|
||||
allows reading and setting language's global variables
|
||||
|
||||
- fast
|
||||
|
||||
the JavaScript code is compiled to byte-code that is executed by a
|
||||
virtual machine
|
||||
|
||||
- programmable
|
||||
|
||||
it should be easy to implement large projects with the language
|
||||
|
||||
|
||||
* WWW Home Page and Additional Information
|
||||
|
||||
The WWW home page of the NGS JavaScript interpreter is at URL:
|
||||
|
||||
http://www.ngs.fi/js/
|
||||
|
||||
The home page contains up-to-date information about the interpreter,
|
||||
its development, releases, documentation, etc.
|
||||
|
||||
Please note that the current version, js-0.2.0 is a work in progress.
|
||||
It contains bugs and many features are still unimplemented.
|
||||
|
||||
Comments, suggestions, bug reports and fixes, feature wishes, etc. are
|
||||
welcome.
|
||||
|
||||
Markku Rossi <[email protected]>
|
||||
@@ -1,7 +0,0 @@
|
||||
Roger E Critchlow Jr <[email protected]>
|
||||
Dmitry M. Golubovsky <[email protected]>
|
||||
Stephan Kulow <[email protected]>
|
||||
Torben Weis <[email protected]>
|
||||
Eric W. Sink <[email protected]>
|
||||
Paul Rohr <[email protected]>
|
||||
Indrek Mandre <[email protected]>
|
||||
@@ -1,13 +0,0 @@
|
||||
|
||||
TODO JavaScript
|
||||
|
||||
* Debugger
|
||||
|
||||
* Package builder that would ease the pain of creating stubs for
|
||||
extensions. Something similar that perl has for its extensions. As
|
||||
an initial application, implement GTK package.
|
||||
|
||||
... or try SWIG: www.swig.org
|
||||
|
||||
* Implement a JSTokenized in C. That would speed up the parsing
|
||||
noticeably.
|
||||
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* Define the PACKAGE and VERSION only if they are undefined. This means
|
||||
* that we do not redefine them, when the library is used in another
|
||||
* GNU like package that defines PACKAGE and VERSION.
|
||||
*/
|
||||
|
||||
/* Package name. */
|
||||
#ifndef PACKAGE
|
||||
#undef PACKAGE
|
||||
#endif /* no PACKAGE */
|
||||
|
||||
/* Version number. */
|
||||
#ifndef VERSION
|
||||
#undef VERSION
|
||||
#endif /* no VERSION */
|
||||
|
||||
/* Are C prototypes supported. */
|
||||
#undef PROTOTYPES
|
||||
|
||||
/* Canonical host name and its parts. */
|
||||
#undef CANONICAL_HOST
|
||||
#undef CANONICAL_HOST_CPU
|
||||
#undef CANONICAL_HOST_VENDOR
|
||||
#undef CANONICAL_HOST_OS
|
||||
|
||||
/* Do we want to build all instruction dispatchers? */
|
||||
#undef ALL_DISPATCHERS
|
||||
|
||||
/* Do we want to profile byte-code operands. */
|
||||
#undef PROFILING
|
||||
|
||||
/* Do we want the byte-code operand hooks. */
|
||||
#undef BC_OPERAND_HOOKS
|
||||
|
||||
/*
|
||||
* Unconditionall disable the jumps byte-code instruction dispatch
|
||||
* method.
|
||||
*/
|
||||
#undef DISABLE_JUMPS
|
||||
|
||||
/* Does the struct stat has st_blksize member? */
|
||||
#undef HAVE_STAT_ST_ST_BLKSIZE
|
||||
|
||||
/* Does the struct stat has st_blocks member? */
|
||||
#undef HAVE_STAT_ST_ST_BLOCKS
|
||||
|
||||
|
||||
/*
|
||||
* Posix threads features.
|
||||
*/
|
||||
|
||||
/* Does the asctime_r() function take three arguments. */
|
||||
#undef ASCTIME_R_WITH_THREE_ARGS
|
||||
|
||||
/* Does the drand48_r() work with DRAND48D data. */
|
||||
#undef DRAND48_R_WITH_DRAND48D
|
||||
|
||||
/* How the attribute structures are passed to the init functions. */
|
||||
#undef CONDATTR_BY_VALUE
|
||||
#undef MUTEXATTR_BY_VALUE
|
||||
#undef THREADATTR_BY_VALUE
|
||||
|
||||
/*
|
||||
* Extensions.
|
||||
*/
|
||||
|
||||
/* JS */
|
||||
#undef WITH_JS
|
||||
|
||||
/* Curses. */
|
||||
#undef WITH_CURSES
|
||||
#undef HAVE_CURSES_H
|
||||
#undef HAVE_NCURSES_H
|
||||
|
||||
/* MD5 */
|
||||
#undef WITH_MD5
|
||||
Vendored
-664
@@ -1,664 +0,0 @@
|
||||
dnl aclocal.m4 generated automatically by aclocal 1.3
|
||||
|
||||
dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
dnl This Makefile.in is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl This program is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
dnl PARTICULAR PURPOSE.
|
||||
|
||||
# Do all the work for Automake. This macro actually does too much --
|
||||
# some checks are only needed if your package does certain things.
|
||||
# But this isn't really a big deal.
|
||||
|
||||
# serial 1
|
||||
|
||||
dnl Usage:
|
||||
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
|
||||
|
||||
AC_DEFUN(AM_INIT_AUTOMAKE,
|
||||
[AC_REQUIRE([AM_PROG_INSTALL])
|
||||
PACKAGE=[$1]
|
||||
AC_SUBST(PACKAGE)
|
||||
VERSION=[$2]
|
||||
AC_SUBST(VERSION)
|
||||
dnl test to see if srcdir already configured
|
||||
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
|
||||
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
|
||||
fi
|
||||
ifelse([$3],,
|
||||
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
|
||||
AC_REQUIRE([AM_SANITY_CHECK])
|
||||
AC_REQUIRE([AC_ARG_PROGRAM])
|
||||
dnl FIXME This is truly gross.
|
||||
missing_dir=`cd $ac_aux_dir && pwd`
|
||||
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
|
||||
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
|
||||
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
|
||||
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
|
||||
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
|
||||
AC_REQUIRE([AC_PROG_MAKE_SET])])
|
||||
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_PROG_INSTALL,
|
||||
[AC_REQUIRE([AC_PROG_INSTALL])
|
||||
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
|
||||
AC_SUBST(INSTALL_SCRIPT)dnl
|
||||
])
|
||||
|
||||
#
|
||||
# Check to make sure that the build environment is sane.
|
||||
#
|
||||
|
||||
AC_DEFUN(AM_SANITY_CHECK,
|
||||
[AC_MSG_CHECKING([whether build environment is sane])
|
||||
# Just in case
|
||||
sleep 1
|
||||
echo timestamp > conftestfile
|
||||
# Do `set' in a subshell so we don't clobber the current shell's
|
||||
# arguments. Must try -L first in case configure is actually a
|
||||
# symlink; some systems play weird games with the mod time of symlinks
|
||||
# (eg FreeBSD returns the mod time of the symlink's containing
|
||||
# directory).
|
||||
if (
|
||||
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
|
||||
if test "[$]*" = "X"; then
|
||||
# -L didn't work.
|
||||
set X `ls -t $srcdir/configure conftestfile`
|
||||
fi
|
||||
if test "[$]*" != "X $srcdir/configure conftestfile" \
|
||||
&& test "[$]*" != "X conftestfile $srcdir/configure"; then
|
||||
|
||||
# If neither matched, then we have a broken ls. This can happen
|
||||
# if, for instance, CONFIG_SHELL is bash and it inherits a
|
||||
# broken ls alias from the environment. This has actually
|
||||
# happened. Such a system could not be considered "sane".
|
||||
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
|
||||
alias in your environment])
|
||||
fi
|
||||
|
||||
test "[$]2" = conftestfile
|
||||
)
|
||||
then
|
||||
# Ok.
|
||||
:
|
||||
else
|
||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||
Check your system clock])
|
||||
fi
|
||||
rm -f conftest*
|
||||
AC_MSG_RESULT(yes)])
|
||||
|
||||
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
|
||||
dnl The program must properly implement --version.
|
||||
AC_DEFUN(AM_MISSING_PROG,
|
||||
[AC_MSG_CHECKING(for working $2)
|
||||
# Run test in a subshell; some versions of sh will print an error if
|
||||
# an executable is not found, even if stderr is redirected.
|
||||
# Redirect stdin to placate older versions of autoconf. Sigh.
|
||||
if ($2 --version) < /dev/null > /dev/null 2>&1; then
|
||||
$1=$2
|
||||
AC_MSG_RESULT(found)
|
||||
else
|
||||
$1="$3/missing $2"
|
||||
AC_MSG_RESULT(missing)
|
||||
fi
|
||||
AC_SUBST($1)])
|
||||
|
||||
# Like AC_CONFIG_HEADER, but automatically create stamp file.
|
||||
|
||||
AC_DEFUN(AM_CONFIG_HEADER,
|
||||
[AC_PREREQ([2.12])
|
||||
AC_CONFIG_HEADER([$1])
|
||||
dnl When config.status generates a header, we must update the stamp-h file.
|
||||
dnl This file resides in the same directory as the config header
|
||||
dnl that is generated. We must strip everything past the first ":",
|
||||
dnl and everything past the last "/".
|
||||
AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
|
||||
ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
|
||||
<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
|
||||
<<am_indx=1
|
||||
for am_file in <<$1>>; do
|
||||
case " <<$>>CONFIG_HEADERS " in
|
||||
*" <<$>>am_file "*<<)>>
|
||||
echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
|
||||
;;
|
||||
esac
|
||||
am_indx=`expr "<<$>>am_indx" + 1`
|
||||
done<<>>dnl>>)
|
||||
changequote([,]))])
|
||||
|
||||
#
|
||||
# Resolve how to compile Posix thread programs.
|
||||
#
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_POSIX_THREADS,
|
||||
[
|
||||
#
|
||||
# First, check the easily recognizable compilers.
|
||||
#
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
# pgcc, pthreads gcc by Chris Provenzano
|
||||
AC_CHECK_PROG(PGCC_BY_PROVENZANO, pgcc, yes, no)
|
||||
|
||||
if test "$PGCC_BY_PROVENZANO" = "yes"; then
|
||||
CC='pgcc'
|
||||
CFLAGS="$CFLAGS -g -Wall -Wno-unused"
|
||||
LDFLAGS="$LDFLAGS -g"
|
||||
fi
|
||||
|
||||
if test "X$CC" = "X"; then
|
||||
# xlc_r, thread safe C compiler for AIX
|
||||
AC_CHECK_PROG(XLC_R_AIX, xlc_r, yes, no)
|
||||
|
||||
if test "$XLC_R_AIX" = "yes"; then
|
||||
CC='xlc_r'
|
||||
CFLAGS='-I/usr/local/include -g'
|
||||
LDFLAGS="$LDFLAGS -L/usr/local/lib -g"
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(cc,
|
||||
[ --with-cc(=CC) use system's native compiler or compiler CC],
|
||||
if test "X$withval" != "Xno"; then
|
||||
if test "X$withval" = "Xyes"; then
|
||||
CC='cc'
|
||||
else
|
||||
CC=$withval
|
||||
fi
|
||||
CFLAGS='-I/usr/local/include'
|
||||
LDFLAGS="$LDFLAGS -L/usr/local/lib"
|
||||
echo "using compiler CC=$CC"
|
||||
fi
|
||||
)
|
||||
|
||||
if test "X$CC" = "X"; then
|
||||
# Ok, not an easy compiler, let's try our knowledge-base
|
||||
AC_PROG_CC
|
||||
case "$host" in
|
||||
*solaris2.5* )
|
||||
if test -n "$GCC"; then
|
||||
CFLAGS="$CFLAGS -D_REENTRANT"
|
||||
else
|
||||
CFLAGS="$CFLAGS -threads"
|
||||
fi
|
||||
;;
|
||||
*osf* )
|
||||
if test -n "$GCC"; then
|
||||
AC_WARN(don't know how to make gcc thread-aware, using cc)
|
||||
CC='cc'
|
||||
CFLAGS="$CFLAGS -threads"
|
||||
else
|
||||
CFLAGS=="$CFLAGS -threads"
|
||||
fi
|
||||
;;
|
||||
*aix4* )
|
||||
if test -n "$GCC"; then
|
||||
CFLAGS="$CFLAGS -D_REENTRANT"
|
||||
LDFLAGS="$LDFLAGS -L/usr/lib/threads -nostartfiles /lib/crt0_r.o -lc_r -lpthreads"
|
||||
else
|
||||
AC_WARN(don't know how to make $CC thread-aware)
|
||||
fi
|
||||
;;
|
||||
*-*-linux-gnu )
|
||||
CFLAGS="$CFLAGS -D_REENTRANT"
|
||||
LDFLAGS="-lpthread"
|
||||
;;
|
||||
* )
|
||||
AC_WARN(don't know how to make compiler thread-aware)
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
# Check pthread functions.
|
||||
AC_CHECK_FUNCS(pthread_attr_setscope \
|
||||
pthread_attr_setstacksize \
|
||||
pthread_mutexattr_create \
|
||||
pthread_condattr_create \
|
||||
pthread_condattr_init \
|
||||
pthread_attr_create)
|
||||
|
||||
# Check if pthread_mutex_init() takes attributes by value.
|
||||
AC_MSG_CHECKING([if pthread_mutex_init() takes attributes by value])
|
||||
AC_TRY_COMPILE([
|
||||
#include <stdio.h>
|
||||
#include <pthread.h>
|
||||
], [
|
||||
pthread_mutex_t m;
|
||||
|
||||
pthread_mutex_init (&m, NULL);
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(MUTEXATTR_BY_VALUE)
|
||||
])
|
||||
|
||||
# Check if pthread_cond_init() takes attributes by value.
|
||||
AC_MSG_CHECKING([if pthread_cond_init() takes attributes by value])
|
||||
AC_TRY_COMPILE([
|
||||
#include <stdio.h>
|
||||
#include <pthread.h>
|
||||
], [
|
||||
pthread_cond_t c;
|
||||
|
||||
pthread_cond_init (&c, NULL);
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(CONDATTR_BY_VALUE)
|
||||
])
|
||||
|
||||
# Check if pthread_create() takes attributes by value.
|
||||
AC_MSG_CHECKING([if pthread_create() takes attributes by value])
|
||||
AC_TRY_COMPILE([
|
||||
#include <stdio.h>
|
||||
#include <pthread.h>
|
||||
], [
|
||||
pthread_t th;
|
||||
pthread_attr_t th_attr;
|
||||
|
||||
pthread_create (&th, &th_attr, NULL, NULL);
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(THREADATTR_BY_VALUE)
|
||||
])
|
||||
|
||||
# Check if asctime_r() takes three arguments.
|
||||
AC_MSG_CHECKING([if asctime_r() takes three arguments])
|
||||
AC_TRY_COMPILE([
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
], [
|
||||
struct tm tm;
|
||||
char buf[256];
|
||||
|
||||
asctime_r (&tm, buf, sizeof (buf));
|
||||
], [
|
||||
AC_DEFINE(ASCTIME_R_WITH_THREE_ARGS)
|
||||
AC_MSG_RESULT(yes)
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
# Check if drand48_r() is available and it works with DRAND48D data.
|
||||
AC_MSG_CHECKING([if drand48_r() works with DRAND48D])
|
||||
AC_TRY_COMPILE([
|
||||
#include <stdlib.h>
|
||||
], [
|
||||
DRAND48D data;
|
||||
double r;
|
||||
|
||||
srand48_r (42, &data);
|
||||
drand48_r (&data, &r);
|
||||
], [
|
||||
AC_DEFINE(DRAND48_R_WITH_DRAND48D)
|
||||
AC_MSG_RESULT(yes)
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_WARN(assuming that the drand48() function is thread-safe)
|
||||
])
|
||||
|
||||
|
||||
# End of AM_POSIX_THREADS macro.
|
||||
])
|
||||
|
||||
|
||||
# serial 24 AM_PROG_LIBTOOL
|
||||
AC_DEFUN(AM_PROG_LIBTOOL,
|
||||
[AC_REQUIRE([AM_ENABLE_SHARED])dnl
|
||||
AC_REQUIRE([AM_ENABLE_STATIC])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AM_PROG_LD])dnl
|
||||
AC_REQUIRE([AM_PROG_NM])dnl
|
||||
AC_REQUIRE([AC_PROG_LN_S])dnl
|
||||
dnl
|
||||
# Always use our own libtool.
|
||||
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
|
||||
AC_SUBST(LIBTOOL)dnl
|
||||
|
||||
# Check for any special flags to pass to ltconfig.
|
||||
libtool_flags=
|
||||
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
|
||||
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
|
||||
test "$silent" = yes && libtool_flags="$libtool_flags --silent"
|
||||
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
|
||||
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
|
||||
|
||||
# Some flags need to be propagated to the compiler or linker for good
|
||||
# libtool support.
|
||||
case "$host" in
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
|
||||
if AC_TRY_EVAL(ac_compile); then
|
||||
case "`/usr/bin/file conftest.o`" in
|
||||
*32-bit*)
|
||||
LD="${LD-ld} -32"
|
||||
;;
|
||||
*N32*)
|
||||
LD="${LD-ld} -n32"
|
||||
;;
|
||||
*64-bit*)
|
||||
LD="${LD-ld} -64"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
rm -rf conftest*
|
||||
;;
|
||||
|
||||
*-*-sco3.2v5*)
|
||||
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
|
||||
CFLAGS="$CFLAGS -belf"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Actually configure libtool. ac_aux_dir is where install-sh is found.
|
||||
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
|
||||
LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
|
||||
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
|
||||
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
|
||||
|| AC_MSG_ERROR([libtool configure failed])
|
||||
])
|
||||
|
||||
# AM_ENABLE_SHARED - implement the --enable-shared flag
|
||||
# Usage: AM_ENABLE_SHARED[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AM_ENABLE_SHARED,
|
||||
[define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(shared,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-shared build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT]
|
||||
changequote([, ])dnl
|
||||
[ --enable-shared=PKGS only build shared libraries if the current package
|
||||
appears as an element in the PKGS list],
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_shared=yes ;;
|
||||
no) enable_shared=no ;;
|
||||
*)
|
||||
enable_shared=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_shared=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AM_DISABLE_SHARED - set the default shared flag to --disable-shared
|
||||
AC_DEFUN(AM_DISABLE_SHARED,
|
||||
[AM_ENABLE_SHARED(no)])
|
||||
|
||||
# AM_DISABLE_STATIC - set the default static flag to --disable-static
|
||||
AC_DEFUN(AM_DISABLE_STATIC,
|
||||
[AM_ENABLE_STATIC(no)])
|
||||
|
||||
# AM_ENABLE_STATIC - implement the --enable-static flag
|
||||
# Usage: AM_ENABLE_STATIC[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AM_ENABLE_STATIC,
|
||||
[define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(static,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-static build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT]
|
||||
changequote([, ])dnl
|
||||
[ --enable-static=PKGS only build shared libraries if the current package
|
||||
appears as an element in the PKGS list],
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_static=yes ;;
|
||||
no) enable_static=no ;;
|
||||
*)
|
||||
enable_static=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_static=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
|
||||
])
|
||||
|
||||
|
||||
# AM_PROG_LD - find the path to the GNU or non-GNU linker
|
||||
AC_DEFUN(AM_PROG_LD,
|
||||
[AC_ARG_WITH(gnu-ld,
|
||||
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
|
||||
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
ac_prog=ld
|
||||
if test "$ac_cv_prog_gcc" = yes; then
|
||||
# Check if gcc -print-prog-name=ld gives a path.
|
||||
AC_MSG_CHECKING([for ld used by GCC])
|
||||
ac_prog=`($CC -print-prog-name=ld) 2>&5`
|
||||
case "$ac_prog" in
|
||||
# Accept absolute paths.
|
||||
/* | [A-Za-z]:\\*)
|
||||
test -z "$LD" && LD="$ac_prog"
|
||||
;;
|
||||
"")
|
||||
# If it fails, then pretend we aren't using GCC.
|
||||
ac_prog=ld
|
||||
;;
|
||||
*)
|
||||
# If it is relative, then search for the first ld in PATH.
|
||||
with_gnu_ld=unknown
|
||||
;;
|
||||
esac
|
||||
elif test "$with_gnu_ld" = yes; then
|
||||
AC_MSG_CHECKING([for GNU ld])
|
||||
else
|
||||
AC_MSG_CHECKING([for non-GNU ld])
|
||||
fi
|
||||
AC_CACHE_VAL(ac_cv_path_LD,
|
||||
[if test -z "$LD"; then
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in $PATH; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f "$ac_dir/$ac_prog"; then
|
||||
ac_cv_path_LD="$ac_dir/$ac_prog"
|
||||
# Check to see if the program is GNU ld. I'd rather use --version,
|
||||
# but apparently some GNU ld's only accept -v.
|
||||
# Break only if it was the GNU/non-GNU ld that we prefer.
|
||||
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
|
||||
test "$with_gnu_ld" != no && break
|
||||
else
|
||||
test "$with_gnu_ld" != yes && break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
else
|
||||
ac_cv_path_LD="$LD" # Let the user override the test with a path.
|
||||
fi])
|
||||
LD="$ac_cv_path_LD"
|
||||
if test -n "$LD"; then
|
||||
AC_MSG_RESULT($LD)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
|
||||
AC_SUBST(LD)
|
||||
AM_PROG_LD_GNU
|
||||
])
|
||||
|
||||
AC_DEFUN(AM_PROG_LD_GNU,
|
||||
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
|
||||
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
|
||||
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
|
||||
ac_cv_prog_gnu_ld=yes
|
||||
else
|
||||
ac_cv_prog_gnu_ld=no
|
||||
fi])
|
||||
])
|
||||
|
||||
# AM_PROG_NM - find the path to a BSD-compatible name lister
|
||||
AC_DEFUN(AM_PROG_NM,
|
||||
[AC_MSG_CHECKING([for BSD-compatible nm])
|
||||
AC_CACHE_VAL(ac_cv_path_NM,
|
||||
[case "$NM" in
|
||||
/* | [A-Za-z]:\\*)
|
||||
ac_cv_path_NM="$NM" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/nm; then
|
||||
# Check to see if the nm accepts a BSD-compat flag.
|
||||
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
|
||||
# nm: unknown option "B" ignored
|
||||
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -B"
|
||||
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -p"
|
||||
else
|
||||
ac_cv_path_NM="$ac_dir/nm"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
|
||||
;;
|
||||
esac])
|
||||
NM="$ac_cv_path_NM"
|
||||
AC_MSG_RESULT([$NM])
|
||||
AC_SUBST(NM)
|
||||
])
|
||||
|
||||
|
||||
# serial 1
|
||||
|
||||
# @defmac AC_PROG_CC_STDC
|
||||
# @maindex PROG_CC_STDC
|
||||
# @ovindex CC
|
||||
# If the C compiler in not in ANSI C mode by default, try to add an option
|
||||
# to output variable @code{CC} to make it so. This macro tries various
|
||||
# options that select ANSI C on some system or another. It considers the
|
||||
# compiler to be in ANSI C mode if it handles function prototypes correctly.
|
||||
#
|
||||
# If you use this macro, you should check after calling it whether the C
|
||||
# compiler has been set to accept ANSI C; if not, the shell variable
|
||||
# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
|
||||
# code in ANSI C, you can make an un-ANSIfied copy of it by using the
|
||||
# program @code{ansi2knr}, which comes with Ghostscript.
|
||||
# @end defmac
|
||||
|
||||
AC_DEFUN(AM_PROG_CC_STDC,
|
||||
[AC_REQUIRE([AC_PROG_CC])
|
||||
AC_BEFORE([$0], [AC_C_INLINE])
|
||||
AC_BEFORE([$0], [AC_C_CONST])
|
||||
dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
|
||||
dnl a magic option to avoid problems with ANSI preprocessor commands
|
||||
dnl like #elif.
|
||||
dnl FIXME: can't do this because then AC_AIX won't work due to a
|
||||
dnl circular dependency.
|
||||
dnl AC_BEFORE([$0], [AC_PROG_CPP])
|
||||
AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
|
||||
AC_CACHE_VAL(am_cv_prog_cc_stdc,
|
||||
[am_cv_prog_cc_stdc=no
|
||||
ac_save_CC="$CC"
|
||||
# Don't try gcc -ansi; that turns off useful extensions and
|
||||
# breaks some systems' header files.
|
||||
# AIX -qlanglvl=ansi
|
||||
# Ultrix and OSF/1 -std1
|
||||
# HP-UX -Aa -D_HPUX_SOURCE
|
||||
# SVR4 -Xc -D__EXTENSIONS__
|
||||
for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
|
||||
do
|
||||
CC="$ac_save_CC $ac_arg"
|
||||
AC_TRY_COMPILE(
|
||||
[#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
|
||||
struct buf { int x; };
|
||||
FILE * (*rcsopen) (struct buf *, struct stat *, int);
|
||||
static char *e (p, i)
|
||||
char **p;
|
||||
int i;
|
||||
{
|
||||
return p[i];
|
||||
}
|
||||
static char *f (char * (*g) (char **, int), char **p, ...)
|
||||
{
|
||||
char *s;
|
||||
va_list v;
|
||||
va_start (v,p);
|
||||
s = g (p, va_arg (v,int));
|
||||
va_end (v);
|
||||
return s;
|
||||
}
|
||||
int test (int i, double x);
|
||||
struct s1 {int (*f) (int a);};
|
||||
struct s2 {int (*f) (double a);};
|
||||
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
|
||||
int argc;
|
||||
char **argv;
|
||||
], [
|
||||
return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
|
||||
],
|
||||
[am_cv_prog_cc_stdc="$ac_arg"; break])
|
||||
done
|
||||
CC="$ac_save_CC"
|
||||
])
|
||||
if test -z "$am_cv_prog_cc_stdc"; then
|
||||
AC_MSG_RESULT([none needed])
|
||||
else
|
||||
AC_MSG_RESULT($am_cv_prog_cc_stdc)
|
||||
fi
|
||||
case "x$am_cv_prog_cc_stdc" in
|
||||
x|xno) ;;
|
||||
*) CC="$CC $am_cv_prog_cc_stdc" ;;
|
||||
esac
|
||||
])
|
||||
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_C_PROTOTYPES,
|
||||
[AC_REQUIRE([AM_PROG_CC_STDC])
|
||||
AC_REQUIRE([AC_PROG_CPP])
|
||||
AC_MSG_CHECKING([for function prototypes])
|
||||
if test "$am_cv_prog_cc_stdc" != no; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(PROTOTYPES)
|
||||
U= ANSI2KNR=
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
U=_ ANSI2KNR=./ansi2knr
|
||||
# Ensure some checks needed by ansi2knr itself.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(string.h)
|
||||
fi
|
||||
AC_SUBST(U)dnl
|
||||
AC_SUBST(ANSI2KNR)dnl
|
||||
])
|
||||
|
||||
Vendored
-259
@@ -1,259 +0,0 @@
|
||||
## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
|
||||
## Copyright (C) 1996-1998 Free Software Foundation, Inc.
|
||||
## Gordon Matzigkeit <[email protected]>, 1996
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation; either version 2 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but
|
||||
## WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
## General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## As a special exception to the GNU General Public License, if you
|
||||
## distribute this file as part of a program that contains a
|
||||
## configuration script generated by Autoconf, you may include it under
|
||||
## the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# serial 24 AM_PROG_LIBTOOL
|
||||
AC_DEFUN(AM_PROG_LIBTOOL,
|
||||
[AC_REQUIRE([AM_ENABLE_SHARED])dnl
|
||||
AC_REQUIRE([AM_ENABLE_STATIC])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AM_PROG_LD])dnl
|
||||
AC_REQUIRE([AM_PROG_NM])dnl
|
||||
AC_REQUIRE([AC_PROG_LN_S])dnl
|
||||
dnl
|
||||
# Always use our own libtool.
|
||||
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
|
||||
AC_SUBST(LIBTOOL)dnl
|
||||
|
||||
# Check for any special flags to pass to ltconfig.
|
||||
libtool_flags=
|
||||
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
|
||||
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
|
||||
test "$silent" = yes && libtool_flags="$libtool_flags --silent"
|
||||
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
|
||||
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
|
||||
|
||||
# Some flags need to be propagated to the compiler or linker for good
|
||||
# libtool support.
|
||||
case "$host" in
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
|
||||
if AC_TRY_EVAL(ac_compile); then
|
||||
case "`/usr/bin/file conftest.o`" in
|
||||
*32-bit*)
|
||||
LD="${LD-ld} -32"
|
||||
;;
|
||||
*N32*)
|
||||
LD="${LD-ld} -n32"
|
||||
;;
|
||||
*64-bit*)
|
||||
LD="${LD-ld} -64"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
rm -rf conftest*
|
||||
;;
|
||||
|
||||
*-*-sco3.2v5*)
|
||||
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
|
||||
CFLAGS="$CFLAGS -belf"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Actually configure libtool. ac_aux_dir is where install-sh is found.
|
||||
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
|
||||
LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
|
||||
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
|
||||
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
|
||||
|| AC_MSG_ERROR([libtool configure failed])
|
||||
])
|
||||
|
||||
# AM_ENABLE_SHARED - implement the --enable-shared flag
|
||||
# Usage: AM_ENABLE_SHARED[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AM_ENABLE_SHARED,
|
||||
[define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(shared,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-shared build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT]
|
||||
changequote([, ])dnl
|
||||
[ --enable-shared=PKGS only build shared libraries if the current package
|
||||
appears as an element in the PKGS list],
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_shared=yes ;;
|
||||
no) enable_shared=no ;;
|
||||
*)
|
||||
enable_shared=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_shared=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AM_DISABLE_SHARED - set the default shared flag to --disable-shared
|
||||
AC_DEFUN(AM_DISABLE_SHARED,
|
||||
[AM_ENABLE_SHARED(no)])
|
||||
|
||||
# AM_DISABLE_STATIC - set the default static flag to --disable-static
|
||||
AC_DEFUN(AM_DISABLE_STATIC,
|
||||
[AM_ENABLE_STATIC(no)])
|
||||
|
||||
# AM_ENABLE_STATIC - implement the --enable-static flag
|
||||
# Usage: AM_ENABLE_STATIC[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AM_ENABLE_STATIC,
|
||||
[define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(static,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-static build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT]
|
||||
changequote([, ])dnl
|
||||
[ --enable-static=PKGS only build shared libraries if the current package
|
||||
appears as an element in the PKGS list],
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_static=yes ;;
|
||||
no) enable_static=no ;;
|
||||
*)
|
||||
enable_static=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_static=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
|
||||
])
|
||||
|
||||
|
||||
# AM_PROG_LD - find the path to the GNU or non-GNU linker
|
||||
AC_DEFUN(AM_PROG_LD,
|
||||
[AC_ARG_WITH(gnu-ld,
|
||||
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
|
||||
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
ac_prog=ld
|
||||
if test "$ac_cv_prog_gcc" = yes; then
|
||||
# Check if gcc -print-prog-name=ld gives a path.
|
||||
AC_MSG_CHECKING([for ld used by GCC])
|
||||
ac_prog=`($CC -print-prog-name=ld) 2>&5`
|
||||
case "$ac_prog" in
|
||||
# Accept absolute paths.
|
||||
/* | [A-Za-z]:\\*)
|
||||
test -z "$LD" && LD="$ac_prog"
|
||||
;;
|
||||
"")
|
||||
# If it fails, then pretend we aren't using GCC.
|
||||
ac_prog=ld
|
||||
;;
|
||||
*)
|
||||
# If it is relative, then search for the first ld in PATH.
|
||||
with_gnu_ld=unknown
|
||||
;;
|
||||
esac
|
||||
elif test "$with_gnu_ld" = yes; then
|
||||
AC_MSG_CHECKING([for GNU ld])
|
||||
else
|
||||
AC_MSG_CHECKING([for non-GNU ld])
|
||||
fi
|
||||
AC_CACHE_VAL(ac_cv_path_LD,
|
||||
[if test -z "$LD"; then
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in $PATH; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f "$ac_dir/$ac_prog"; then
|
||||
ac_cv_path_LD="$ac_dir/$ac_prog"
|
||||
# Check to see if the program is GNU ld. I'd rather use --version,
|
||||
# but apparently some GNU ld's only accept -v.
|
||||
# Break only if it was the GNU/non-GNU ld that we prefer.
|
||||
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
|
||||
test "$with_gnu_ld" != no && break
|
||||
else
|
||||
test "$with_gnu_ld" != yes && break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
else
|
||||
ac_cv_path_LD="$LD" # Let the user override the test with a path.
|
||||
fi])
|
||||
LD="$ac_cv_path_LD"
|
||||
if test -n "$LD"; then
|
||||
AC_MSG_RESULT($LD)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
|
||||
AC_SUBST(LD)
|
||||
AM_PROG_LD_GNU
|
||||
])
|
||||
|
||||
AC_DEFUN(AM_PROG_LD_GNU,
|
||||
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
|
||||
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
|
||||
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
|
||||
ac_cv_prog_gnu_ld=yes
|
||||
else
|
||||
ac_cv_prog_gnu_ld=no
|
||||
fi])
|
||||
])
|
||||
|
||||
# AM_PROG_NM - find the path to a BSD-compatible name lister
|
||||
AC_DEFUN(AM_PROG_NM,
|
||||
[AC_MSG_CHECKING([for BSD-compatible nm])
|
||||
AC_CACHE_VAL(ac_cv_path_NM,
|
||||
[case "$NM" in
|
||||
/* | [A-Za-z]:\\*)
|
||||
ac_cv_path_NM="$NM" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/nm; then
|
||||
# Check to see if the nm accepts a BSD-compat flag.
|
||||
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
|
||||
# nm: unknown option "B" ignored
|
||||
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -B"
|
||||
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -p"
|
||||
else
|
||||
ac_cv_path_NM="$ac_dir/nm"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
|
||||
;;
|
||||
esac])
|
||||
NM="$ac_cv_path_NM"
|
||||
AC_MSG_RESULT([$NM])
|
||||
AC_SUBST(NM)
|
||||
])
|
||||
@@ -1,179 +0,0 @@
|
||||
#
|
||||
# Resolve how to compile Posix thread programs.
|
||||
#
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_POSIX_THREADS,
|
||||
[
|
||||
#
|
||||
# First, check the easily recognizable compilers.
|
||||
#
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
# pgcc, pthreads gcc by Chris Provenzano
|
||||
AC_CHECK_PROG(PGCC_BY_PROVENZANO, pgcc, yes, no)
|
||||
|
||||
if test "$PGCC_BY_PROVENZANO" = "yes"; then
|
||||
CC='pgcc'
|
||||
CFLAGS="$CFLAGS -g -Wall -Wno-unused"
|
||||
LDFLAGS="$LDFLAGS -g"
|
||||
fi
|
||||
|
||||
if test "X$CC" = "X"; then
|
||||
# xlc_r, thread safe C compiler for AIX
|
||||
AC_CHECK_PROG(XLC_R_AIX, xlc_r, yes, no)
|
||||
|
||||
if test "$XLC_R_AIX" = "yes"; then
|
||||
CC='xlc_r'
|
||||
CFLAGS='-I/usr/local/include -g'
|
||||
LDFLAGS="$LDFLAGS -L/usr/local/lib -g"
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(cc,
|
||||
[ --with-cc(=CC) use system's native compiler or compiler CC],
|
||||
if test "X$withval" != "Xno"; then
|
||||
if test "X$withval" = "Xyes"; then
|
||||
CC='cc'
|
||||
else
|
||||
CC=$withval
|
||||
fi
|
||||
CFLAGS='-I/usr/local/include'
|
||||
LDFLAGS="$LDFLAGS -L/usr/local/lib"
|
||||
echo "using compiler CC=$CC"
|
||||
fi
|
||||
)
|
||||
|
||||
if test "X$CC" = "X"; then
|
||||
# Ok, not an easy compiler, let's try our knowledge-base
|
||||
AC_PROG_CC
|
||||
case "$host" in
|
||||
*solaris2.5* )
|
||||
if test -n "$GCC"; then
|
||||
CFLAGS="$CFLAGS -D_REENTRANT"
|
||||
else
|
||||
CFLAGS="$CFLAGS -threads"
|
||||
fi
|
||||
;;
|
||||
*osf* )
|
||||
if test -n "$GCC"; then
|
||||
AC_WARN(don't know how to make gcc thread-aware, using cc)
|
||||
CC='cc'
|
||||
CFLAGS="$CFLAGS -threads"
|
||||
else
|
||||
CFLAGS=="$CFLAGS -threads"
|
||||
fi
|
||||
;;
|
||||
*aix4* )
|
||||
if test -n "$GCC"; then
|
||||
CFLAGS="$CFLAGS -D_REENTRANT"
|
||||
LDFLAGS="$LDFLAGS -L/usr/lib/threads -nostartfiles /lib/crt0_r.o -lc_r -lpthreads"
|
||||
else
|
||||
AC_WARN(don't know how to make $CC thread-aware)
|
||||
fi
|
||||
;;
|
||||
*-*-linux-gnu )
|
||||
CFLAGS="$CFLAGS -D_REENTRANT"
|
||||
LDFLAGS="-lpthread"
|
||||
;;
|
||||
* )
|
||||
AC_WARN(don't know how to make compiler thread-aware)
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
# Check pthread functions.
|
||||
AC_CHECK_FUNCS(pthread_attr_setscope \
|
||||
pthread_attr_setstacksize \
|
||||
pthread_mutexattr_create \
|
||||
pthread_condattr_create \
|
||||
pthread_condattr_init \
|
||||
pthread_attr_create)
|
||||
|
||||
# Check if pthread_mutex_init() takes attributes by value.
|
||||
AC_MSG_CHECKING([if pthread_mutex_init() takes attributes by value])
|
||||
AC_TRY_COMPILE([
|
||||
#include <stdio.h>
|
||||
#include <pthread.h>
|
||||
], [
|
||||
pthread_mutex_t m;
|
||||
|
||||
pthread_mutex_init (&m, NULL);
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(MUTEXATTR_BY_VALUE)
|
||||
])
|
||||
|
||||
# Check if pthread_cond_init() takes attributes by value.
|
||||
AC_MSG_CHECKING([if pthread_cond_init() takes attributes by value])
|
||||
AC_TRY_COMPILE([
|
||||
#include <stdio.h>
|
||||
#include <pthread.h>
|
||||
], [
|
||||
pthread_cond_t c;
|
||||
|
||||
pthread_cond_init (&c, NULL);
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(CONDATTR_BY_VALUE)
|
||||
])
|
||||
|
||||
# Check if pthread_create() takes attributes by value.
|
||||
AC_MSG_CHECKING([if pthread_create() takes attributes by value])
|
||||
AC_TRY_COMPILE([
|
||||
#include <stdio.h>
|
||||
#include <pthread.h>
|
||||
], [
|
||||
pthread_t th;
|
||||
pthread_attr_t th_attr;
|
||||
|
||||
pthread_create (&th, &th_attr, NULL, NULL);
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(THREADATTR_BY_VALUE)
|
||||
])
|
||||
|
||||
# Check if asctime_r() takes three arguments.
|
||||
AC_MSG_CHECKING([if asctime_r() takes three arguments])
|
||||
AC_TRY_COMPILE([
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
], [
|
||||
struct tm tm;
|
||||
char buf[256];
|
||||
|
||||
asctime_r (&tm, buf, sizeof (buf));
|
||||
], [
|
||||
AC_DEFINE(ASCTIME_R_WITH_THREE_ARGS)
|
||||
AC_MSG_RESULT(yes)
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
# Check if drand48_r() is available and it works with DRAND48D data.
|
||||
AC_MSG_CHECKING([if drand48_r() works with DRAND48D])
|
||||
AC_TRY_COMPILE([
|
||||
#include <stdlib.h>
|
||||
], [
|
||||
DRAND48D data;
|
||||
double r;
|
||||
|
||||
srand48_r (42, &data);
|
||||
drand48_r (&data, &r);
|
||||
], [
|
||||
AC_DEFINE(DRAND48_R_WITH_DRAND48D)
|
||||
AC_MSG_RESULT(yes)
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_WARN(assuming that the drand48() function is thread-safe)
|
||||
])
|
||||
|
||||
|
||||
# End of AM_POSIX_THREADS macro.
|
||||
])
|
||||
@@ -1,48 +0,0 @@
|
||||
# This file is a shell script that caches the results of configure
|
||||
# tests run on this system so they can be shared between configure
|
||||
# scripts and configure runs. It is not useful on other systems.
|
||||
# If it contains results you don't want to keep, you may remove or edit it.
|
||||
#
|
||||
# By default, configure uses ./config.cache as the cache file,
|
||||
# creating it if it does not exist already. You can give configure
|
||||
# the --cache-file=FILE option to use a different cache file; that is
|
||||
# what configure does when it calls configure scripts in
|
||||
# subdirectories, so they share the cache.
|
||||
# Giving --cache-file=/dev/null disables caching, for debugging configure.
|
||||
# config.status only pays attention to the cache file if you give it the
|
||||
# --recheck option to rerun configure.
|
||||
#
|
||||
ac_cv_c_const=${ac_cv_c_const=yes}
|
||||
ac_cv_func_alloca_works=${ac_cv_func_alloca_works=yes}
|
||||
ac_cv_func_drand48=${ac_cv_func_drand48=yes}
|
||||
ac_cv_func_lstat=${ac_cv_func_lstat=yes}
|
||||
ac_cv_func_sleep=${ac_cv_func_sleep=yes}
|
||||
ac_cv_func_srand48=${ac_cv_func_srand48=yes}
|
||||
ac_cv_func_usleep=${ac_cv_func_usleep=yes}
|
||||
ac_cv_header_alloca_h=${ac_cv_header_alloca_h=yes}
|
||||
ac_cv_header_dlfcn_h=${ac_cv_header_dlfcn_h=yes}
|
||||
ac_cv_header_errno_h=${ac_cv_header_errno_h=yes}
|
||||
ac_cv_header_float_h=${ac_cv_header_float_h=yes}
|
||||
ac_cv_header_limits_h=${ac_cv_header_limits_h=yes}
|
||||
ac_cv_header_stdc=${ac_cv_header_stdc=yes}
|
||||
ac_cv_header_stdlib_h=${ac_cv_header_stdlib_h=yes}
|
||||
ac_cv_header_string_h=${ac_cv_header_string_h=yes}
|
||||
ac_cv_header_unistd_h=${ac_cv_header_unistd_h=yes}
|
||||
ac_cv_lib_dl_dlopen=${ac_cv_lib_dl_dlopen=yes}
|
||||
ac_cv_path_LD=${ac_cv_path_LD=/usr/bin/ld}
|
||||
ac_cv_path_NM=${ac_cv_path_NM='/usr/bin/nm -B'}
|
||||
ac_cv_path_install=${ac_cv_path_install='/usr/bin/install -c'}
|
||||
ac_cv_prog_ACLOCAL_FLAGS_FOR_LIBTOOL=${ac_cv_prog_ACLOCAL_FLAGS_FOR_LIBTOOL=found}
|
||||
ac_cv_prog_CC=${ac_cv_prog_CC=gcc}
|
||||
ac_cv_prog_CPP=${ac_cv_prog_CPP='gcc -E'}
|
||||
ac_cv_prog_LN_S=${ac_cv_prog_LN_S='ln -s'}
|
||||
ac_cv_prog_RANLIB=${ac_cv_prog_RANLIB=ranlib}
|
||||
ac_cv_prog_cc_cross=${ac_cv_prog_cc_cross=no}
|
||||
ac_cv_prog_cc_g=${ac_cv_prog_cc_g=yes}
|
||||
ac_cv_prog_cc_works=${ac_cv_prog_cc_works=yes}
|
||||
ac_cv_prog_gcc=${ac_cv_prog_gcc=yes}
|
||||
ac_cv_prog_gnu_ld=${ac_cv_prog_gnu_ld=yes}
|
||||
ac_cv_prog_make_make_set=${ac_cv_prog_make_make_set=yes}
|
||||
ac_cv_sizeof_int=${ac_cv_sizeof_int=4}
|
||||
ac_cv_sizeof_long=${ac_cv_sizeof_long=4}
|
||||
am_cv_prog_cc_stdc=${am_cv_prog_cc_stdc=}
|
||||
@@ -1,53 +0,0 @@
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
configure:582: checking for a BSD compatible install
|
||||
configure:635: checking whether build environment is sane
|
||||
configure:692: checking whether make sets ${MAKE}
|
||||
configure:738: checking for working aclocal
|
||||
configure:751: checking for working autoconf
|
||||
configure:764: checking for working automake
|
||||
configure:777: checking for working autoheader
|
||||
configure:790: checking for working makeinfo
|
||||
configure:813: checking for libtool
|
||||
configure:851: checking for ranlib
|
||||
configure:885: checking host system type
|
||||
configure:1537: checking for gcc
|
||||
configure:1614: checking whether the C compiler (gcc ) works
|
||||
configure:1628: gcc -o conftest conftest.c 1>&5
|
||||
configure:1648: checking whether the C compiler (gcc ) is a cross-compiler
|
||||
configure:1653: checking whether we are using GNU C
|
||||
configure:1677: checking whether gcc accepts -g
|
||||
configure:1765: checking for ld used by GCC
|
||||
configure:1822: checking if the linker (/usr/bin/ld) is GNU ld
|
||||
configure:1838: checking for BSD-compatible nm
|
||||
configure:1875: checking whether ln -s works
|
||||
configure:1943: checking how to run the C preprocessor
|
||||
configure:2004: checking for AIX
|
||||
configure:2032: checking for gcc option to accept ANSI C
|
||||
configure:2110: checking for working const
|
||||
configure:2187: checking for function prototypes
|
||||
configure:2348: checking for working alloca.h
|
||||
configure:2381: checking for alloca
|
||||
configure:2576: checking for ANSI C header files
|
||||
configure:2683: checking for string.h
|
||||
configure:2683: checking for stdlib.h
|
||||
configure:2683: checking for unistd.h
|
||||
configure:2683: checking for errno.h
|
||||
configure:2683: checking for float.h
|
||||
configure:2683: checking for limits.h
|
||||
configure:2721: checking size of int
|
||||
configure:2760: checking size of long
|
||||
configure:2802: checking for srand48
|
||||
configure:2802: checking for drand48
|
||||
configure:2802: checking for sleep
|
||||
configure:2802: checking for usleep
|
||||
configure:2802: checking for lstat
|
||||
configure:2856: checking if inline works
|
||||
configure:2872: gcc -c -g -O2 conftest.c 1>&5
|
||||
configure:2892: checking if struct stat has st_blksize
|
||||
configure:2907: gcc -c -g -O2 conftest.c 1>&5
|
||||
configure:2927: checking if struct stat has st_blocks
|
||||
configure:2942: gcc -c -g -O2 conftest.c 1>&5
|
||||
configure:3147: checking for dlfcn.h
|
||||
configure:3184: checking for dlopen in -ldl
|
||||
@@ -1,275 +0,0 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.12)
|
||||
|
||||
AC_INIT(src/jsint.h)
|
||||
AM_INIT_AUTOMAKE(js, 0.2.5)
|
||||
AM_CONFIG_HEADER(jsconfig.h)
|
||||
|
||||
AC_REVISION($Revision: 1.1 $)
|
||||
|
||||
dnl Check if we have `libtool'.
|
||||
|
||||
AC_CHECK_PROG(ACLOCAL_FLAGS_FOR_LIBTOOL, libtool, found, -I $(srcdir)/am.opt)
|
||||
|
||||
if test "X$ACLOCAL_FLAGS_FOR_LIBTOOL" = "Xfound"; then
|
||||
ACLOCAL_FLAGS_FOR_LIBTOOL=""
|
||||
fi
|
||||
|
||||
|
||||
AM_PROG_INSTALL
|
||||
AC_PROG_RANLIB
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
AC_DEFINE_UNQUOTED(CANONICAL_HOST, "$host")
|
||||
AC_DEFINE_UNQUOTED(CANONICAL_HOST_CPU, "$host_cpu")
|
||||
AC_DEFINE_UNQUOTED(CANONICAL_HOST_VENDOR, "$host_vendor")
|
||||
AC_DEFINE_UNQUOTED(CANONICAL_HOST_OS, "$host_os")
|
||||
|
||||
dnl System / C-compiler properties.
|
||||
|
||||
please_posix_threads=0
|
||||
AC_ARG_WITH(pthreads,
|
||||
[ --with-pthreads use Posix threads for the re-entrant functions],
|
||||
if test "X$withval" = "Xyes"; then
|
||||
please_posix_threads=1
|
||||
|
||||
echo "fetching re-entrant functions from the Posix threads library"
|
||||
RE_ENTRANT_SOURCE="r_pthrs.lo"
|
||||
fi
|
||||
)
|
||||
|
||||
if test "X$please_posix_threads" = "X1"; then
|
||||
dnl Check if we know anything about the Posix threads.
|
||||
AM_POSIX_THREADS
|
||||
fi
|
||||
|
||||
dnl ... other re-entrancy back-ends
|
||||
|
||||
if test "X$RE_ENTRANT_SOURCE" = "X"; then
|
||||
echo "fetching re-entrant functions from the C-library"
|
||||
AC_MSG_WARN(the interpreter is not re-entrant)
|
||||
RE_ENTRANT_SOURCE="r_std.lo"
|
||||
fi
|
||||
|
||||
INTERPRETER_FEATURES="$INTERPRETER_FEATURES $RE_ENTRANT_SOURCE"
|
||||
|
||||
dnl Now we definitely need the cc.
|
||||
AC_PROG_CC
|
||||
|
||||
|
||||
AM_ENABLE_SHARED(no)
|
||||
AM_ENABLE_STATIC(yes)
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
AC_AIX
|
||||
|
||||
AM_PROG_CC_STDC
|
||||
|
||||
AC_C_CONST
|
||||
AM_C_PROTOTYPES
|
||||
AC_FUNC_ALLOCA
|
||||
|
||||
AC_STDC_HEADERS
|
||||
AC_HAVE_HEADERS(string.h stdlib.h unistd.h errno.h float.h limits.h)
|
||||
|
||||
AC_CHECK_SIZEOF(int)
|
||||
AC_CHECK_SIZEOF(long)
|
||||
|
||||
AC_CHECK_FUNCS(srand48 drand48 sleep usleep lstat)
|
||||
|
||||
dnl Can we use inline?
|
||||
AC_MSG_CHECKING([if inline works])
|
||||
AC_TRY_COMPILE([
|
||||
static inline int foo ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
], [
|
||||
foo ();
|
||||
], [
|
||||
AC_MSG_RESULT(yes)
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
AC_DEFINE(inline,)
|
||||
])
|
||||
|
||||
dnl Does the struct stat have st_blksize?
|
||||
AC_MSG_CHECKING([if struct stat has st_blksize])
|
||||
AC_TRY_COMPILE([
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
], [
|
||||
struct stat stat_st;
|
||||
stat_st.st_blksize = 0;
|
||||
], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_STAT_ST_ST_BLKSIZE, 1)
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
dnl Does the struct stat have st_blocks?
|
||||
AC_MSG_CHECKING([if struct stat has st_blocks])
|
||||
AC_TRY_COMPILE([
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
], [
|
||||
struct stat stat_st;
|
||||
stat_st.st_blocks = 0;
|
||||
], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_STAT_ST_ST_BLOCKS, 1)
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Interpreter features.
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE(all-dispatchers,
|
||||
[ --enable-all-dispatchers build all byte-code instruction dispatchers],
|
||||
if test "X$enableval" = "Xyes"; then
|
||||
echo "building all byte-code instruction dispatchers"
|
||||
AC_DEFINE(ALL_DISPATCHERS)
|
||||
INTERPRETER_FEATURES="$INTERPRETER_FEATURES vmswt0.lo"
|
||||
fi
|
||||
)
|
||||
|
||||
AC_ARG_ENABLE(profiling,
|
||||
[ --enable-profiling enable byte-code operand profiling],
|
||||
if test "X$enableval" = "Xyes"; then
|
||||
echo "enabling byte-code operand profiling"
|
||||
AC_DEFINE(PROFILING)
|
||||
fi
|
||||
)
|
||||
|
||||
AC_ARG_ENABLE(operand-hooks,
|
||||
[ --enable-operand-hooks turn on byte-code operand hooks],
|
||||
if test "X$enableval" = "Xyes"; then
|
||||
echo "enabling byte-code operand hooks"
|
||||
AC_DEFINE(BC_OPERAND_HOOKS)
|
||||
fi
|
||||
)
|
||||
|
||||
AC_ARG_ENABLE(jumps,
|
||||
[ --disable-jumps disable the jumps instruction dispatch method],
|
||||
if test "X$enableval" = "Xno"; then
|
||||
echo "disabling the jumps byte-code instruction dispatch method"
|
||||
AC_DEFINE(DISABLE_JUMPS)
|
||||
fi
|
||||
)
|
||||
|
||||
|
||||
dnl
|
||||
dnl Extensions.
|
||||
dnl
|
||||
|
||||
EXTENSIONS=""
|
||||
EXTENSIONS_LIBS=""
|
||||
|
||||
with_curses_val=0
|
||||
AC_ARG_WITH(curses,
|
||||
[ --with-curses build curses entension],
|
||||
if test "X$withval" = "Xyes"; then
|
||||
echo "building curses extension"
|
||||
with_curses_val=1
|
||||
|
||||
dnl Check which curses package to use.
|
||||
AC_CHECK_HEADER(ncurses.h, [
|
||||
AC_DEFINE(HAVE_NCURSES_H)
|
||||
curses_lib='-lncurses'
|
||||
], [
|
||||
AC_CHECK_HEADER(curses.h, [
|
||||
AC_DEFINE(HAVE_CURSES_H)
|
||||
curses_lib='-lcurses'
|
||||
], [
|
||||
AC_MSG_ERROR([couldn't determine which curses library I should use])
|
||||
])
|
||||
])
|
||||
fi
|
||||
)
|
||||
if test "X$with_curses_val" = "X1"; then
|
||||
AC_DEFINE(WITH_CURSES)
|
||||
EXTENSIONS="$EXTENSIONS xcurses.lo"
|
||||
EXTENSIONS_LIBS="$EXTENSIONS_LIBS $curses_lib -ltermcap"
|
||||
fi
|
||||
|
||||
with_dload_val=1
|
||||
AC_ARG_WITH(dload,
|
||||
[ --without-dload disable dynamic loading],
|
||||
if test "X$withval" = "Xno"; then
|
||||
echo "disabling the dynamic loading"
|
||||
with_dload_val=0
|
||||
fi
|
||||
)
|
||||
if test "X$with_dload_val" = "X1"; then
|
||||
# Check what dload method we should use, and from which library.
|
||||
|
||||
# The dl{open,close,cym}() interface.
|
||||
AC_HAVE_HEADERS(dlfcn.h)
|
||||
AC_CHECK_LIB(dl, dlopen, [
|
||||
EXTENSIONS="$EXTENSIONS dl_open.lo"
|
||||
EXTENSIONS_LIBS="$EXTENSIONS_LIBS -ldl"
|
||||
], [
|
||||
# Ok, can't do dynamic loading.
|
||||
with_dload_val=0
|
||||
])
|
||||
fi
|
||||
if test "X$with_dload_val" = "X1"; then
|
||||
# Everything ok so far. Let's set the final link flags the
|
||||
# environment might require.
|
||||
case "$host" in
|
||||
*linux* )
|
||||
LDFLAGS="$LDFLAGS -rdynamic"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
# Sorry, no luck. Dynamic loading do not work on your system.
|
||||
EXTENSIONS="dl_dummy.lo"
|
||||
fi
|
||||
|
||||
with_js_val=1
|
||||
AC_ARG_WITH(js,
|
||||
[ --without-js do not built the JS extension],
|
||||
if text "X$withval" = "Xno"; then
|
||||
echo "disabling the JS extension"
|
||||
with_js_val=0
|
||||
fi
|
||||
)
|
||||
if test "X$with_js_val" = "X1"; then
|
||||
AC_DEFINE(WITH_JS)
|
||||
EXTENSIONS="$EXTENSIONS xjs.lo"
|
||||
fi
|
||||
|
||||
with_md5_val=1
|
||||
AC_ARG_WITH(md5,
|
||||
[ --without-md5 do not built the MD5 extension],
|
||||
if text "X$withval" = "Xno"; then
|
||||
echo "disabling the MD5 extension"
|
||||
with_md5_val=0
|
||||
fi
|
||||
)
|
||||
if test "X$with_md5_val" = "X1"; then
|
||||
AC_DEFINE(WITH_MD5)
|
||||
EXTENSIONS="$EXTENSIONS xmd5.lo md5c.lo"
|
||||
fi
|
||||
|
||||
AC_SUBST(EXTENSIONS)
|
||||
AC_SUBST(EXTENSIONS_LIBS)
|
||||
|
||||
AC_SUBST(INTERPRETER_FEATURES)
|
||||
|
||||
AC_OUTPUT([Makefile \
|
||||
src/Makefile \
|
||||
src/tests/Makefile \
|
||||
examples/Makefile \
|
||||
jsc/Makefile \
|
||||
jsc/tests/Makefile \
|
||||
jsas/Makefile \
|
||||
jsdas/Makefile \
|
||||
jswrap/Makefile \
|
||||
docs/Makefile \
|
||||
projects/Makefile \
|
||||
micros/Makefile])
|
||||
@@ -1,27 +0,0 @@
|
||||
#
|
||||
# Automakefile for the documents.
|
||||
# Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
#
|
||||
# Author: Markku Rossi <[email protected]>
|
||||
#
|
||||
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
# MA 02111-1307, USA
|
||||
#
|
||||
|
||||
info_TEXINFOS = js.texi
|
||||
|
||||
EXTRA_DIST = design.texi lgpl.texinfo
|
||||
@@ -1,343 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
#
|
||||
# Automakefile for the documents.
|
||||
# Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
#
|
||||
# Author: Markku Rossi <[email protected]>
|
||||
#
|
||||
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
# MA 02111-1307, USA
|
||||
#
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
ACLOCAL_FLAGS_FOR_LIBTOOL = @ACLOCAL_FLAGS_FOR_LIBTOOL@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
EXTENSIONS = @EXTENSIONS@
|
||||
EXTENSIONS_LIBS = @EXTENSIONS_LIBS@
|
||||
INTERPRETER_FEATURES = @INTERPRETER_FEATURES@
|
||||
LD = @LD@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
NM = @NM@
|
||||
PACKAGE = @PACKAGE@
|
||||
PGCC_BY_PROVENZANO = @PGCC_BY_PROVENZANO@
|
||||
RANLIB = @RANLIB@
|
||||
U = @U@
|
||||
VERSION = @VERSION@
|
||||
XLC_R_AIX = @XLC_R_AIX@
|
||||
|
||||
info_TEXINFOS = js.texi
|
||||
|
||||
EXTRA_DIST = design.texi lgpl.texinfo
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../jsconfig.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
TEXI2DVI = texi2dvi
|
||||
TEXINFO_TEX = $(srcdir)/texinfo.tex
|
||||
INFO_DEPS = js.info
|
||||
DVIS = js.dvi
|
||||
TEXINFOS = js.texi
|
||||
DIST_COMMON = Makefile.am Makefile.in mdate-sh stamp-vti texinfo.tex \
|
||||
version.texi
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
all: Makefile $(INFO_DEPS)
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .dvi .info .ps .texi .texinfo .txi
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps docs/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
version.texi: stamp-vti
|
||||
cp $(srcdir)/stamp-vti $(srcdir)/version.texi
|
||||
|
||||
stamp-vti: js.texi $(top_srcdir)/configure.in
|
||||
@echo "@set UPDATED `cd $(srcdir) \
|
||||
&& $(SHELL) ./mdate-sh js.texi`" > vti.tmp
|
||||
@echo "@set EDITION $(VERSION)" >> vti.tmp
|
||||
@echo "@set VERSION $(VERSION)" >> vti.tmp
|
||||
@cmp -s vti.tmp $(srcdir)/stamp-vti \
|
||||
|| (echo "Updating $(srcdir)/stamp-vti"; \
|
||||
cp vti.tmp $(srcdir)/stamp-vti)
|
||||
-@rm -f vti.tmp
|
||||
|
||||
mostlyclean-vti:
|
||||
-rm -f vti.tmp
|
||||
|
||||
clean-vti:
|
||||
|
||||
distclean-vti:
|
||||
|
||||
maintainer-clean-vti:
|
||||
-rm -f stamp-vti version.texi
|
||||
|
||||
js.info: js.texi version.texi
|
||||
js.dvi: js.texi version.texi
|
||||
|
||||
|
||||
DVIPS = dvips
|
||||
|
||||
.texi.info:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.texi.dvi:
|
||||
TEXINPUTS=$(srcdir):$$TEXINPUTS \
|
||||
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
|
||||
|
||||
.texi:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.texinfo.info:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.texinfo:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.texinfo.dvi:
|
||||
TEXINPUTS=$(srcdir):$$TEXINPUTS \
|
||||
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
|
||||
|
||||
.txi.info:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.txi.dvi:
|
||||
TEXINPUTS=$(srcdir):$$TEXINPUTS \
|
||||
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
|
||||
|
||||
.txi:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
.dvi.ps:
|
||||
$(DVIPS) $< -o $@
|
||||
|
||||
install-info-am: $(INFO_DEPS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(infodir)
|
||||
@for file in $(INFO_DEPS); do \
|
||||
d=$(srcdir); \
|
||||
for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
|
||||
if test -f $$d/$$ifile; then \
|
||||
echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile"; \
|
||||
$(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile; \
|
||||
else : ; fi; \
|
||||
done; \
|
||||
done
|
||||
@$(POST_INSTALL)
|
||||
@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
|
||||
for file in $(INFO_DEPS); do \
|
||||
echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file";\
|
||||
install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :;\
|
||||
done; \
|
||||
else : ; fi
|
||||
|
||||
uninstall-info:
|
||||
$(PRE_UNINSTALL)
|
||||
@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
|
||||
ii=yes; \
|
||||
else ii=; fi; \
|
||||
for file in $(INFO_DEPS); do \
|
||||
test -z "$ii" \
|
||||
|| install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
|
||||
done
|
||||
@$(NORMAL_UNINSTALL)
|
||||
for file in $(INFO_DEPS); do \
|
||||
(cd $(DESTDIR)$(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
|
||||
done
|
||||
|
||||
dist-info: $(INFO_DEPS)
|
||||
for base in $(INFO_DEPS); do \
|
||||
d=$(srcdir); \
|
||||
for file in `cd $$d && eval echo $$base*`; do \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done; \
|
||||
done
|
||||
|
||||
mostlyclean-aminfo:
|
||||
-rm -f js.aux js.cp js.cps js.dvi js.fn js.fns js.ky js.kys js.ps \
|
||||
js.log js.pg js.toc js.tp js.tps js.vr js.vrs js.op js.tr \
|
||||
js.cv js.cn
|
||||
|
||||
clean-aminfo:
|
||||
|
||||
distclean-aminfo:
|
||||
|
||||
maintainer-clean-aminfo:
|
||||
for i in $(INFO_DEPS); do \
|
||||
rm -f $$i; \
|
||||
if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \
|
||||
rm -f $$i-[0-9]*; \
|
||||
fi; \
|
||||
done
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = docs
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
$(MAKE) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info
|
||||
info: $(INFO_DEPS)
|
||||
dvi: $(DVIS)
|
||||
check: all
|
||||
$(MAKE)
|
||||
installcheck:
|
||||
install-exec:
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install-data: install-info-am
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-exec install-data all
|
||||
@:
|
||||
|
||||
uninstall: uninstall-info
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(infodir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-vti mostlyclean-aminfo mostlyclean-generic
|
||||
|
||||
clean: clean-vti clean-aminfo clean-generic mostlyclean
|
||||
|
||||
distclean: distclean-vti distclean-aminfo distclean-generic clean
|
||||
-rm -f config.status
|
||||
-rm -f libtool
|
||||
|
||||
maintainer-clean: maintainer-clean-vti maintainer-clean-aminfo \
|
||||
maintainer-clean-generic distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
.PHONY: mostlyclean-vti distclean-vti clean-vti maintainer-clean-vti \
|
||||
install-info-am uninstall-info mostlyclean-aminfo distclean-aminfo \
|
||||
clean-aminfo maintainer-clean-aminfo tags distdir info dvi installcheck \
|
||||
install-exec install-data install uninstall all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -1,112 +0,0 @@
|
||||
\input texinfo @c -*-texinfo-*-
|
||||
@c %**start of header
|
||||
@setfilename jsdesign.info
|
||||
@settitle jsdesign
|
||||
@setchapternewpage on
|
||||
@c %**end of header
|
||||
|
||||
@ifinfo
|
||||
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.
|
||||
|
||||
@ignore
|
||||
Permission is granted to process this file through TeX and print the
|
||||
results, provided the printed document carries copying permission
|
||||
notice identical to this one except for the removal of this paragraph
|
||||
|
||||
|
||||
@end ignore
|
||||
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.
|
||||
@end ifinfo
|
||||
|
||||
|
||||
@titlepage
|
||||
@title NGS JavaScript Interpreter
|
||||
@subtitle Design Goals
|
||||
@author Markku Rossi
|
||||
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
Copyright @copyright{} 1998 New Generation Software (NGS) Oy
|
||||
@sp 2
|
||||
|
||||
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 Free Software Foundation.
|
||||
@end titlepage
|
||||
|
||||
@ifinfo
|
||||
@node Top, Introduction, (dir), (dir)
|
||||
@comment node-name, next, previous, up
|
||||
@top The Design Goals of the NGS JavaScript Interpreter
|
||||
|
||||
The Design Goals of the NGS JavaScript Interpreter.
|
||||
|
||||
@end ifinfo
|
||||
|
||||
@strong{This document is very much under construction.}
|
||||
|
||||
@menu
|
||||
* Introduction::
|
||||
* Re-Entrant::
|
||||
* Extendible::
|
||||
* Fast::
|
||||
* Programmable::
|
||||
* The *Java* Hype::
|
||||
@end menu
|
||||
|
||||
@node Introduction, Re-Entrant, Top, Top
|
||||
@chapter Introduction
|
||||
|
||||
The NGS JavaScript interpreter is "yet another extension language".
|
||||
Although the world is full of extensions languages, none of the
|
||||
currently available languages didn't meet all the requirements we had
|
||||
for the extension language. So, as a trivial solution, we decided to
|
||||
implement one that would satisfy our needs.
|
||||
|
||||
The following chapters describe the goals that were set for the project.
|
||||
The chapters are in priority order, starting from the most important
|
||||
feature.
|
||||
|
||||
@node Re-Entrant, Extendible, Introduction, Top
|
||||
@chapter Re-Entrant
|
||||
|
||||
One of the original reasons for the JS project was the lack of
|
||||
thread-safe interpreters.
|
||||
|
||||
@node Extendible, Fast, Re-Entrant, Top
|
||||
@chapter Extendible
|
||||
|
||||
@node Fast, Programmable, Extendible, Top
|
||||
@chapter Fast
|
||||
|
||||
@node Programmable, The *Java* Hype, Fast, Top
|
||||
@chapter Programmable
|
||||
|
||||
@node The *Java* Hype, , Programmable, Top
|
||||
@chapter The *Java* Hype
|
||||
|
||||
@contents
|
||||
|
||||
@bye
|
||||
@@ -1,145 +0,0 @@
|
||||
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.
|
||||
|
||||
|
||||
Indirect:
|
||||
js.info-1: 1052
|
||||
js.info-2: 50497
|
||||
js.info-3: 100456
|
||||
js.info-4: 147894
|
||||
|
||||
Tag Table:
|
||||
(Indirect)
|
||||
Node: Top1052
|
||||
Node: Introduction1530
|
||||
Node: NGS JavaScript Language1730
|
||||
Node: Language1973
|
||||
Node: Lexical Conventions2215
|
||||
Node: White Space2498
|
||||
Node: Comments2631
|
||||
Node: Reserved Words2753
|
||||
Node: Identifiers2887
|
||||
Node: Punctuators3018
|
||||
Node: Literals3143
|
||||
Node: Automatic Semicolon Insertion3280
|
||||
Node: Function Definition4268
|
||||
Node: Statements4416
|
||||
Node: Block4917
|
||||
Node: Variable Statement5024
|
||||
Node: Empty Statement5162
|
||||
Node: The if Statement5305
|
||||
Node: The do...while Statement5460
|
||||
Node: The while Statement5639
|
||||
Node: The for Statement5805
|
||||
Node: The for...in Statement5965
|
||||
Node: The continue Statement6142
|
||||
Node: The break Statement6317
|
||||
Node: The return Statement6484
|
||||
Node: The with Statement6649
|
||||
Node: The switch Statement6975
|
||||
Node: Labeled Statements7139
|
||||
Node: The throw Statement7296
|
||||
Node: The try Statement7456
|
||||
Node: Expressions7585
|
||||
Node: Primary Expressions8045
|
||||
Node: Left-Hand-Side Expressions8204
|
||||
Node: Postfix Expressions8385
|
||||
Node: Unary Operators8548
|
||||
Node: Multiplicative Operators8701
|
||||
Node: Additive Operators8871
|
||||
Node: Bitwise Shift Operators9037
|
||||
Node: Relational Operators9209
|
||||
Node: Equality Operators9375
|
||||
Node: Binary Bitwise Operators9538
|
||||
Node: Binary Logical Operators9717
|
||||
Node: Conditional Operator9898
|
||||
Node: Assignment Operators10067
|
||||
Node: Comma Operator10226
|
||||
Node: Global Methods and Properties10344
|
||||
Node: Native Objects13372
|
||||
Node: Array13678
|
||||
Node: Boolean20867
|
||||
Node: Date21974
|
||||
Node: File23572
|
||||
Node: Directory27924
|
||||
Node: Function28319
|
||||
Node: Math28424
|
||||
Node: Number29593
|
||||
Node: Object31030
|
||||
Node: RegExp31585
|
||||
Node: String37819
|
||||
Node: System42434
|
||||
Node: VM46388
|
||||
Node: Extensions49830
|
||||
Node: Curses49978
|
||||
Node: JS50072
|
||||
Node: MD550497
|
||||
Node: The js Program52029
|
||||
Node: Invoking The js Program52486
|
||||
Node: Evaluating and Executing Code62627
|
||||
Node: Compiling JavaScript Code62830
|
||||
Node: Warning Messages63490
|
||||
Node: Optimization68445
|
||||
Node: Debugging Information68597
|
||||
Node: Assembler Listings70615
|
||||
Node: The jsas Program73003
|
||||
Node: Invoking The jsas Program73319
|
||||
Node: The jsdas Program74216
|
||||
Node: Invoking The jsdas Program74642
|
||||
Node: Viewing Byte-Code Files76034
|
||||
Node: Manipulating Byte-Code Files79458
|
||||
Node: The jswrap Program80445
|
||||
Node: Invoking The jswrap Program80827
|
||||
Node: Definition File Format82356
|
||||
Node: The Type Specifiers83870
|
||||
Node: The Pass-Type Specifiers85357
|
||||
Node: The Life Scope Specifiers86752
|
||||
Node: Re-Entrant Functions87454
|
||||
Node: Calling the Functions from C87636
|
||||
Node: Sample Project87826
|
||||
Node: JavaScript API88972
|
||||
Node: Interpreter Handling89240
|
||||
Node: Evaluation and Compilation91564
|
||||
Node: Type Handling95182
|
||||
Node: Defining Global Methods95764
|
||||
Node: Classes96069
|
||||
Node: Modules99295
|
||||
Node: Virtual Machine99476
|
||||
Node: Byte-Code File Format99686
|
||||
Node: File Header99953
|
||||
Node: Code Section100317
|
||||
Node: Constants Section100456
|
||||
Node: Symtab Section101224
|
||||
Node: Debug Section101371
|
||||
Node: Byte-Code Operands101490
|
||||
Node: Stack Frame113444
|
||||
Node: JavaScript Compiler114261
|
||||
Node: Public Entry Points115800
|
||||
Node: GNU Library General Public License120892
|
||||
Node: Index147894
|
||||
|
||||
End Tag Table
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,383 +0,0 @@
|
||||
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: Index, Prev: GNU Library General Public License, Up: Top
|
||||
|
||||
Index
|
||||
*****
|
||||
|
||||
* Menu:
|
||||
|
||||
* $1: RegExp.
|
||||
* $2: RegExp.
|
||||
* $3: RegExp.
|
||||
* $4: RegExp.
|
||||
* $5: RegExp.
|
||||
* $6: RegExp.
|
||||
* $7: RegExp.
|
||||
* $8: RegExp.
|
||||
* $9: RegExp.
|
||||
* $_: RegExp.
|
||||
* abs on Math: Math.
|
||||
* acos on Math: Math.
|
||||
* add: Byte-Code Operands.
|
||||
* add_1_i: Byte-Code Operands.
|
||||
* add_2_i: Byte-Code Operands.
|
||||
* and: Byte-Code Operands.
|
||||
* apop: Byte-Code Operands.
|
||||
* append on String: String.
|
||||
* Array: Array.
|
||||
* asin on Math: Math.
|
||||
* atan on Math: Math.
|
||||
* atan2 on Math: Math.
|
||||
* autoFlush: File.
|
||||
* bits: System.
|
||||
* Boolean: Boolean.
|
||||
* bufferSize: File.
|
||||
* byteToString on File: File.
|
||||
* call_method: Byte-Code Operands.
|
||||
* callMethod: Global Methods and Properties.
|
||||
* canonicalHost: System.
|
||||
* canonicalHostCPU: System.
|
||||
* canonicalHostOS: System.
|
||||
* canonicalHostVendor: System.
|
||||
* ceil on Math: Math.
|
||||
* charAt on String: String.
|
||||
* charCodeAt on String: String.
|
||||
* chdir on System: System.
|
||||
* chmod on File: File.
|
||||
* clearError on File: File.
|
||||
* close on Directory: Directory.
|
||||
* close on File: File.
|
||||
* cmp_eq: Byte-Code Operands.
|
||||
* cmp_ge: Byte-Code Operands.
|
||||
* cmp_gt: Byte-Code Operands.
|
||||
* cmp_le: Byte-Code Operands.
|
||||
* cmp_lt: Byte-Code Operands.
|
||||
* cmp_ne: Byte-Code Operands.
|
||||
* cmp_seq: Byte-Code Operands.
|
||||
* cmp_sne: Byte-Code Operands.
|
||||
* compile on JS: JS.
|
||||
* compile on RegExp: RegExp.
|
||||
* concat on Array: Array.
|
||||
* concat on String: String.
|
||||
* const: Byte-Code Operands.
|
||||
* const_false: Byte-Code Operands.
|
||||
* const_i: Byte-Code Operands.
|
||||
* const_i0: Byte-Code Operands.
|
||||
* const_i1: Byte-Code Operands.
|
||||
* const_i2: Byte-Code Operands.
|
||||
* const_i3: Byte-Code Operands.
|
||||
* const_null: Byte-Code Operands.
|
||||
* const_true: Byte-Code Operands.
|
||||
* const_undefined: Byte-Code Operands.
|
||||
* cos on Math: Math.
|
||||
* crc32 on String: String.
|
||||
* Date: Date.
|
||||
* debug: Global Methods and Properties.
|
||||
* delete_array: Byte-Code Operands.
|
||||
* delete_property: Byte-Code Operands.
|
||||
* Directory: Directory.
|
||||
* dispatchMethod: VM.
|
||||
* div: Byte-Code Operands.
|
||||
* done: Byte-Code Operands.
|
||||
* dup: Byte-Code Operands.
|
||||
* E: Math.
|
||||
* eof on File: File.
|
||||
* errno: System.
|
||||
* error: Global Methods and Properties.
|
||||
* error on File: File.
|
||||
* error on System: System.
|
||||
* errorMessage: JS.
|
||||
* escape: Global Methods and Properties.
|
||||
* eval: Global Methods and Properties.
|
||||
* eval on JS: JS.
|
||||
* evalFile on JS: JS.
|
||||
* evalJavaScriptFile on JS: JS.
|
||||
* exec on RegExp: RegExp.
|
||||
* executeByteCodeFile on JS: JS.
|
||||
* exists on File: File.
|
||||
* exit on System: System.
|
||||
* exp on Math: Math.
|
||||
* File: File.
|
||||
* final on MD5: MD5.
|
||||
* finalBinary on MD5: MD5.
|
||||
* float: Global Methods and Properties.
|
||||
* floor on Math: Math.
|
||||
* flush on File: File.
|
||||
* format on Date: Date.
|
||||
* formatGMT on Date: Date.
|
||||
* fromCharCode on String: String.
|
||||
* garbageCollect on VM: VM.
|
||||
* gcCount: VM.
|
||||
* gcTrigger: VM.
|
||||
* getcwd on System: System.
|
||||
* getDate on Date: Date.
|
||||
* getDay on Date: Date.
|
||||
* getenv on System: System.
|
||||
* getHours on Date: Date.
|
||||
* getLength on File: File.
|
||||
* getMinutes on Date: Date.
|
||||
* getMonth on Date: Date.
|
||||
* getPosition on File: File.
|
||||
* getSeconds on Date: Date.
|
||||
* getTime on Date: Date.
|
||||
* getTimezoneOffset on Date: Date.
|
||||
* getVar on JS: JS.
|
||||
* getYear on Date: Date.
|
||||
* global: RegExp.
|
||||
* halt: Byte-Code Operands.
|
||||
* heapAllocated: VM.
|
||||
* heapFree: VM.
|
||||
* heapSize: VM.
|
||||
* iffalse: Byte-Code Operands.
|
||||
* iffalse_b: Byte-Code Operands.
|
||||
* iftrue: Byte-Code Operands.
|
||||
* iftrue_b: Byte-Code Operands.
|
||||
* ignoreCase: RegExp.
|
||||
* indexOf on String: String.
|
||||
* Infinity: Global Methods and Properties.
|
||||
* init on MD5: MD5.
|
||||
* input: RegExp.
|
||||
* int: Global Methods and Properties.
|
||||
* isFinite: Global Methods and Properties.
|
||||
* isFloat: Global Methods and Properties.
|
||||
* isInt: Global Methods and Properties.
|
||||
* isNaN: Global Methods and Properties.
|
||||
* jmp: Byte-Code Operands.
|
||||
* join on Array: Array.
|
||||
* JS: JS.
|
||||
* js_apply: Evaluation and Compilation.
|
||||
* js_class_context: Classes.
|
||||
* js_class_create: Classes.
|
||||
* js_class_define_method: Classes.
|
||||
* js_class_define_property: Classes.
|
||||
* js_class_destroy: Classes.
|
||||
* js_compile: Evaluation and Compilation.
|
||||
* js_compile_data_to_byte_code: Evaluation and Compilation.
|
||||
* js_compile_to_byte_code: Evaluation and Compilation.
|
||||
* js_create_global_method: Defining Global Methods.
|
||||
* js_create_interp: Interpreter Handling.
|
||||
* js_define_class: Classes.
|
||||
* js_define_module: Modules.
|
||||
* js_destroy_interp: Interpreter Handling.
|
||||
* js_error_message: Interpreter Handling.
|
||||
* js_eval: Evaluation and Compilation.
|
||||
* js_eval_data: Evaluation and Compilation.
|
||||
* js_eval_file: Evaluation and Compilation.
|
||||
* js_eval_javascript_file: Evaluation and Compilation.
|
||||
* js_execute_byte_code: Evaluation and Compilation.
|
||||
* js_execute_byte_code_file: Evaluation and Compilation.
|
||||
* js_get_options: Interpreter Handling.
|
||||
* js_get_var: Interpreter Handling.
|
||||
* js_init_default_options: Interpreter Handling.
|
||||
* js_instantiate_class: Classes.
|
||||
* js_isa: Classes.
|
||||
* js_lookup_class: Classes.
|
||||
* js_result: Interpreter Handling.
|
||||
* js_set_options: Interpreter Handling.
|
||||
* js_set_var: Interpreter Handling.
|
||||
* js_type_make_array: Type Handling.
|
||||
* js_type_make_string: Type Handling.
|
||||
* js_version: Interpreter Handling.
|
||||
* JSC$compile_file: Public Entry Points.
|
||||
* JSC$compile_string: Public Entry Points.
|
||||
* jsr: Byte-Code Operands.
|
||||
* jsr_w: Byte-Code Operands.
|
||||
* lastIndex: RegExp.
|
||||
* lastIndexOf on String: String.
|
||||
* lastMatch: RegExp.
|
||||
* lastParen: RegExp.
|
||||
* leftContext: RegExp.
|
||||
* length <1>: String.
|
||||
* length: Array.
|
||||
* lineBreakSequence: System.
|
||||
* LN10: Math.
|
||||
* LN2: Math.
|
||||
* load: Global Methods and Properties.
|
||||
* load_arg: Byte-Code Operands.
|
||||
* load_array: Byte-Code Operands.
|
||||
* load_global: Byte-Code Operands.
|
||||
* load_global_w: Byte-Code Operands.
|
||||
* load_local: Byte-Code Operands.
|
||||
* load_nth_arg: Byte-Code Operands.
|
||||
* load_property: Byte-Code Operands.
|
||||
* loadClass: Global Methods and Properties.
|
||||
* locals: Byte-Code Operands.
|
||||
* log on Math: Math.
|
||||
* LOG10E: Math.
|
||||
* LOG2E: Math.
|
||||
* lstat on File: File.
|
||||
* MakeDate: Date.
|
||||
* MakeDay: Date.
|
||||
* MakeTime: Date.
|
||||
* match on String: String.
|
||||
* max on Math: Math.
|
||||
* MAX_VALUE: Number.
|
||||
* MD5: MD5.
|
||||
* min on Math: Math.
|
||||
* min_args: Byte-Code Operands.
|
||||
* MIN_VALUE: Number.
|
||||
* mod: Byte-Code Operands.
|
||||
* mul: Byte-Code Operands.
|
||||
* multiline: RegExp.
|
||||
* NaN <1>: Global Methods and Properties.
|
||||
* NaN: Number.
|
||||
* neg: Byte-Code Operands.
|
||||
* NEGATIVE_INFINITY: Number.
|
||||
* new: Byte-Code Operands.
|
||||
* nop: Byte-Code Operands.
|
||||
* not: Byte-Code Operands.
|
||||
* nth: Byte-Code Operands.
|
||||
* Number: Number.
|
||||
* numConstants: VM.
|
||||
* numGlobals: VM.
|
||||
* Object: Object.
|
||||
* open on Directory: Directory.
|
||||
* open on File: File.
|
||||
* or: Byte-Code Operands.
|
||||
* pack on String: String.
|
||||
* parse on Date: Date.
|
||||
* parseFloat: Global Methods and Properties.
|
||||
* parseInt: Global Methods and Properties.
|
||||
* PI: Math.
|
||||
* pop: Byte-Code Operands.
|
||||
* pop on Array: Array.
|
||||
* pop_n: Byte-Code Operands.
|
||||
* popen on System: System.
|
||||
* POSITIVE_INFINITY: Number.
|
||||
* pow on Math: Math.
|
||||
* print: Global Methods and Properties.
|
||||
* print on System: System.
|
||||
* push on Array: Array.
|
||||
* random on Math: Math.
|
||||
* read on Directory: Directory.
|
||||
* read on File: File.
|
||||
* readByte on File: File.
|
||||
* readln on File: File.
|
||||
* RegExp: RegExp.
|
||||
* remove on File: File.
|
||||
* rename on File: File.
|
||||
* replace on String: String.
|
||||
* return: Byte-Code Operands.
|
||||
* reverse on Array: Array.
|
||||
* rewind on Directory: Directory.
|
||||
* rightContext: RegExp.
|
||||
* roll: Byte-Code Operands.
|
||||
* round on Math: Math.
|
||||
* search on String: String.
|
||||
* seed on Math: Math.
|
||||
* seek on Directory: Directory.
|
||||
* setDate on Date: Date.
|
||||
* setHours on Date: Date.
|
||||
* setMinutes on Date: Date.
|
||||
* setMonths on Date: Date.
|
||||
* setPosition on File: File.
|
||||
* setSeconds on Date: Date.
|
||||
* setTime on Date: Date.
|
||||
* setVar on JS: JS.
|
||||
* setYear on Date: Date.
|
||||
* shift on Array: Array.
|
||||
* shift_left: Byte-Code Operands.
|
||||
* shift_right: Byte-Code Operands.
|
||||
* shift_rright: Byte-Code Operands.
|
||||
* sin on Math: Math.
|
||||
* sleep on System: System.
|
||||
* slice on Array: Array.
|
||||
* slice on String: String.
|
||||
* sort on Array: Array.
|
||||
* source: RegExp.
|
||||
* splice on Array: Array.
|
||||
* split on String: String.
|
||||
* sqrt on Math: Math.
|
||||
* SQRT1_2: Math.
|
||||
* SQRT2: Math.
|
||||
* stackSize: VM.
|
||||
* stackTrace on VM: VM.
|
||||
* stacktraceOnError: VM.
|
||||
* stat on File: File.
|
||||
* stderr: System.
|
||||
* stdin: System.
|
||||
* stdout: System.
|
||||
* store_arg: Byte-Code Operands.
|
||||
* store_array: Byte-Code Operands.
|
||||
* store_global: Byte-Code Operands.
|
||||
* store_local: Byte-Code Operands.
|
||||
* store_property: Byte-Code Operands.
|
||||
* strerror on System: System.
|
||||
* String: String.
|
||||
* stringToByte on File: File.
|
||||
* sub: Byte-Code Operands.
|
||||
* substr on String: String.
|
||||
* substring on String: String.
|
||||
* swap: Byte-Code Operands.
|
||||
* system on System: System.
|
||||
* tan on Math: Math.
|
||||
* tell on Directory: Directory.
|
||||
* test on RegExp: RegExp.
|
||||
* throw: Byte-Code Operands.
|
||||
* TimeClip: Date.
|
||||
* toGMTString on Date: Date.
|
||||
* toLocaleString on Date: Date.
|
||||
* toLowerCase on String: String.
|
||||
* toSource on Array: Array.
|
||||
* toSource on Object: Object.
|
||||
* toString on Array: Array.
|
||||
* toString on Boolean: Boolean.
|
||||
* toString on File: File.
|
||||
* toString on Number: Number.
|
||||
* toString on Object: Object.
|
||||
* toUpperCase on String: String.
|
||||
* try_pop: Byte-Code Operands.
|
||||
* try_push: Byte-Code Operands.
|
||||
* typeof: Byte-Code Operands.
|
||||
* unescape: Global Methods and Properties.
|
||||
* ungetByte on File: File.
|
||||
* unpack on String: String.
|
||||
* unshift on Array: Array.
|
||||
* update on MD5: MD5.
|
||||
* usleep on System: System.
|
||||
* UTC on Date: Date.
|
||||
* valueOf on Boolean: Boolean.
|
||||
* valueOf on Number: Number.
|
||||
* valueOf on Object: Object.
|
||||
* verbose: VM.
|
||||
* verboseStacktrace: VM.
|
||||
* version: VM.
|
||||
* versionMajor: VM.
|
||||
* versionMinor: VM.
|
||||
* versionPatch: VM.
|
||||
* warnUndef: VM.
|
||||
* with_pop: Byte-Code Operands.
|
||||
* with_push: Byte-Code Operands.
|
||||
* write on File: File.
|
||||
* writeByte on File: File.
|
||||
* writeln on File: File.
|
||||
* xor: Byte-Code Operands.
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,548 +0,0 @@
|
||||
@c This LGPL is meant to be included from other files.
|
||||
@c To format a standalone LGPL, use liblic.texi.
|
||||
|
||||
@ifset lgpl-appendix
|
||||
@appendix GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
@end ifset
|
||||
|
||||
@ifclear lgpl-appendix
|
||||
@unnumbered GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
@end ifclear
|
||||
@center Version 2, June 1991
|
||||
|
||||
@display
|
||||
Copyright @copyright{} 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the library GPL. It is
|
||||
numbered 2 because it goes with version 2 of the ordinary GPL.]
|
||||
@end display
|
||||
|
||||
@unnumberedsec Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software---to make sure the software is free for all its users.
|
||||
|
||||
This license, the Library General Public License, applies to some
|
||||
specially designated Free Software Foundation software, and to any
|
||||
other libraries whose authors decide to use it. You can use it for
|
||||
your libraries, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if
|
||||
you distribute copies of the library, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link a program with the library, you must provide
|
||||
complete object files to the recipients so that they can relink them
|
||||
with the library, after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright
|
||||
the library, and (2) offer you this license which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
library. If the library is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original
|
||||
version, so that any problems introduced by others will not reflect on
|
||||
the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that companies distributing free
|
||||
software will individually obtain patent licenses, thus in effect
|
||||
transforming the program into proprietary software. To prevent this,
|
||||
we have made it clear that any patent must be licensed for everyone's
|
||||
free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary
|
||||
GNU General Public License, which was designed for utility programs. This
|
||||
license, the GNU Library General Public License, applies to certain
|
||||
designated libraries. This license is quite different from the ordinary
|
||||
one; be sure to read it in full, and don't assume that anything in it is
|
||||
the same as in the ordinary license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that
|
||||
they blur the distinction we usually make between modifying or adding to a
|
||||
program and simply using it. Linking a program with a library, without
|
||||
changing the library, is in some sense simply using the library, and is
|
||||
analogous to running a utility program or application program. However, in
|
||||
a textual and legal sense, the linked executable is a combined work, a
|
||||
derivative of the original library, and the ordinary General Public License
|
||||
treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General
|
||||
Public License for libraries did not effectively promote software
|
||||
sharing, because most developers did not use the libraries. We
|
||||
concluded that weaker conditions might promote sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the
|
||||
users of those programs of all benefit from the free status of the
|
||||
libraries themselves. This Library General Public License is intended to
|
||||
permit developers of non-free programs to use free libraries, while
|
||||
preserving your freedom as a user of such programs to change the free
|
||||
libraries that are incorporated in them. (We have not seen how to achieve
|
||||
this as regards changes in header files, but we have achieved it as regards
|
||||
changes in the actual functions of the Library.) The hope is that this
|
||||
will lead to faster development of free libraries.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
``work based on the library'' and a ``work that uses the library''. The
|
||||
former contains code derived from the library, while the latter only
|
||||
works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary
|
||||
General Public License rather than by this special one.
|
||||
|
||||
@iftex
|
||||
@unnumberedsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
@end iftex
|
||||
@ifinfo
|
||||
@center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
@end ifinfo
|
||||
|
||||
@enumerate 0
|
||||
@item
|
||||
This License Agreement applies to any software library which
|
||||
contains a notice placed by the copyright holder or other authorized
|
||||
party saying it may be distributed under the terms of this Library
|
||||
General Public License (also called ``this License''). Each licensee is
|
||||
addressed as ``you''.
|
||||
|
||||
A ``library'' means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The ``Library'', below, refers to any such software library or work
|
||||
which has been distributed under these terms. A ``work based on the
|
||||
Library'' means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term ``modification''.)
|
||||
|
||||
``Source code'' for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
@item
|
||||
You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
@item
|
||||
You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
@enumerate a
|
||||
@item
|
||||
The modified work must itself be a software library.
|
||||
|
||||
@item
|
||||
You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
@item
|
||||
You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
@item
|
||||
If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
@end enumerate
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
@item
|
||||
You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
@item
|
||||
You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
@item
|
||||
A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a ``work that uses the Library''. Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a ``work that uses the Library'' with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a ``work that uses the
|
||||
library''. The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a ``work that uses the Library'' uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
@item
|
||||
As an exception to the Sections above, you may also compile or
|
||||
link a ``work that uses the Library'' with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
@enumerate a
|
||||
@item
|
||||
Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable ``work that
|
||||
uses the Library'', as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
@item
|
||||
Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
@item
|
||||
If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
@item
|
||||
Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
@end enumerate
|
||||
|
||||
For an executable, the required form of the ``work that uses the
|
||||
Library'' must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the source code distributed need not include anything that is normally
|
||||
distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
@item
|
||||
You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
@enumerate a
|
||||
@item
|
||||
Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
@item
|
||||
Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
@end enumerate
|
||||
|
||||
@item
|
||||
You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
@item
|
||||
You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
@item
|
||||
Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
@item
|
||||
If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
@item
|
||||
If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
@item
|
||||
The Free Software Foundation may publish revised and/or new
|
||||
versions of the Library General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
``any later version'', you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
@item
|
||||
If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
@iftex
|
||||
@heading NO WARRANTY
|
||||
@end iftex
|
||||
@ifinfo
|
||||
@center NO WARRANTY
|
||||
@end ifinfo
|
||||
|
||||
@item
|
||||
BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY ``AS IS'' WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
@item
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
@end enumerate
|
||||
|
||||
@iftex
|
||||
@heading END OF TERMS AND CONDITIONS
|
||||
@end iftex
|
||||
@ifinfo
|
||||
@center END OF TERMS AND CONDITIONS
|
||||
@end ifinfo
|
||||
|
||||
@page
|
||||
@unnumberedsec How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
``copyright'' line and a pointer to where the full notice is found.
|
||||
|
||||
@smallexample
|
||||
@var{one line to give the library's name and an idea of what it does.}
|
||||
Copyright (C) @var{year} @var{name of author}
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330, Cambridge,
|
||||
MA 02139, USA.
|
||||
@end smallexample
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a ``copyright disclaimer'' for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
@example
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in
|
||||
the library `Frob' (a library for tweaking knobs) written
|
||||
by James Random Hacker.
|
||||
|
||||
@var{signature of Ty Coon}, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
@end example
|
||||
|
||||
That's all there is to it!
|
||||
@@ -1,92 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Get modification time of a file or directory and pretty-print it.
|
||||
# Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
# written by Ulrich Drepper <[email protected]>, June 1995
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# Prevent date giving response in another language.
|
||||
LANG=C
|
||||
export LANG
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
LC_TIME=C
|
||||
export LC_TIME
|
||||
|
||||
# Get the extended ls output of the file or directory.
|
||||
# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below.
|
||||
if ls -L /dev/null 1>/dev/null 2>&1; then
|
||||
set - x`ls -L -l -d $1`
|
||||
else
|
||||
set - x`ls -l -d $1`
|
||||
fi
|
||||
# The month is at least the fourth argument
|
||||
# (3 shifts here, the next inside the loop).
|
||||
shift
|
||||
shift
|
||||
shift
|
||||
|
||||
# Find the month. Next argument is day, followed by the year or time.
|
||||
month=
|
||||
until test $month
|
||||
do
|
||||
shift
|
||||
case $1 in
|
||||
Jan) month=January; nummonth=1;;
|
||||
Feb) month=February; nummonth=2;;
|
||||
Mar) month=March; nummonth=3;;
|
||||
Apr) month=April; nummonth=4;;
|
||||
May) month=May; nummonth=5;;
|
||||
Jun) month=June; nummonth=6;;
|
||||
Jul) month=July; nummonth=7;;
|
||||
Aug) month=August; nummonth=8;;
|
||||
Sep) month=September; nummonth=9;;
|
||||
Oct) month=October; nummonth=10;;
|
||||
Nov) month=November; nummonth=11;;
|
||||
Dec) month=December; nummonth=12;;
|
||||
esac
|
||||
done
|
||||
|
||||
day=$2
|
||||
|
||||
# Here we have to deal with the problem that the ls output gives either
|
||||
# the time of day or the year.
|
||||
case $3 in
|
||||
*:*) set `date`; eval year=\$$#
|
||||
case $2 in
|
||||
Jan) nummonthtod=1;;
|
||||
Feb) nummonthtod=2;;
|
||||
Mar) nummonthtod=3;;
|
||||
Apr) nummonthtod=4;;
|
||||
May) nummonthtod=5;;
|
||||
Jun) nummonthtod=6;;
|
||||
Jul) nummonthtod=7;;
|
||||
Aug) nummonthtod=8;;
|
||||
Sep) nummonthtod=9;;
|
||||
Oct) nummonthtod=10;;
|
||||
Nov) nummonthtod=11;;
|
||||
Dec) nummonthtod=12;;
|
||||
esac
|
||||
# For the first six month of the year the time notation can also
|
||||
# be used for files modified in the last year.
|
||||
if (expr $nummonth \> $nummonthtod) > /dev/null;
|
||||
then
|
||||
year=`expr $year - 1`
|
||||
fi;;
|
||||
*) year=$3;;
|
||||
esac
|
||||
|
||||
# The result.
|
||||
echo $day $month $year
|
||||
@@ -1,3 +0,0 @@
|
||||
@set UPDATED 25 November 1998
|
||||
@set EDITION 0.2.5
|
||||
@set VERSION 0.2.5
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,3 +0,0 @@
|
||||
@set UPDATED 25 November 1998
|
||||
@set EDITION 0.2.5
|
||||
@set VERSION 0.2.5
|
||||
@@ -1,40 +0,0 @@
|
||||
#
|
||||
# Automakefile for the examples directory.
|
||||
# Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
#
|
||||
# Author: Markku Rossi <[email protected]>
|
||||
#
|
||||
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
# MA 02111-1307, USA
|
||||
#
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/src
|
||||
|
||||
noinst_PROGRAMS = simple ieval
|
||||
|
||||
simple_SOURCES = simple.c
|
||||
|
||||
simple_LDADD = ../src/libjs.la @EXTENSIONS_LIBS@ -lm
|
||||
|
||||
ieval_SOURCES = ieval.c
|
||||
|
||||
ieval_LDADD = ../src/libjs.la @EXTENSIONS_LIBS@ -lm
|
||||
|
||||
EXTRA_DIST = hello.js add.js dload.c
|
||||
|
||||
dload-linux:
|
||||
$(CC) $(CFLAGS) -shared -fPIC -DPIC dload.c -o dload.so
|
||||
@@ -1,320 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
#
|
||||
# Automakefile for the examples directory.
|
||||
# Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
#
|
||||
# Author: Markku Rossi <[email protected]>
|
||||
#
|
||||
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
# MA 02111-1307, USA
|
||||
#
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
ACLOCAL_FLAGS_FOR_LIBTOOL = @ACLOCAL_FLAGS_FOR_LIBTOOL@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
EXTENSIONS = @EXTENSIONS@
|
||||
EXTENSIONS_LIBS = @EXTENSIONS_LIBS@
|
||||
INTERPRETER_FEATURES = @INTERPRETER_FEATURES@
|
||||
LD = @LD@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
NM = @NM@
|
||||
PACKAGE = @PACKAGE@
|
||||
PGCC_BY_PROVENZANO = @PGCC_BY_PROVENZANO@
|
||||
RANLIB = @RANLIB@
|
||||
U = @U@
|
||||
VERSION = @VERSION@
|
||||
XLC_R_AIX = @XLC_R_AIX@
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/src
|
||||
|
||||
noinst_PROGRAMS = simple ieval
|
||||
|
||||
simple_SOURCES = simple.c
|
||||
|
||||
simple_LDADD = ../src/libjs.la @EXTENSIONS_LIBS@ -lm
|
||||
|
||||
ieval_SOURCES = ieval.c
|
||||
|
||||
ieval_LDADD = ../src/libjs.la @EXTENSIONS_LIBS@ -lm
|
||||
|
||||
EXTRA_DIST = hello.js add.js dload.c
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../jsconfig.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
PROGRAMS = $(noinst_PROGRAMS)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir) -I..
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
simple_OBJECTS = simple.o
|
||||
simple_DEPENDENCIES = ../src/libjs.la
|
||||
simple_LDFLAGS =
|
||||
ieval_OBJECTS = ieval.o
|
||||
ieval_DEPENDENCIES = ../src/libjs.la
|
||||
ieval_LDFLAGS =
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
|
||||
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
SOURCES = $(simple_SOURCES) $(ieval_SOURCES)
|
||||
OBJECTS = $(simple_OBJECTS) $(ieval_OBJECTS)
|
||||
|
||||
all: Makefile $(PROGRAMS)
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .lo .o .s
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps examples/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
mostlyclean-noinstPROGRAMS:
|
||||
|
||||
clean-noinstPROGRAMS:
|
||||
-test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
|
||||
|
||||
distclean-noinstPROGRAMS:
|
||||
|
||||
maintainer-clean-noinstPROGRAMS:
|
||||
|
||||
.c.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.s.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.S.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.o core *.core
|
||||
|
||||
clean-compile:
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
maintainer-clean-compile:
|
||||
|
||||
.c.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
.s.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
.S.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
|
||||
maintainer-clean-libtool:
|
||||
|
||||
simple: $(simple_OBJECTS) $(simple_DEPENDENCIES)
|
||||
@rm -f simple
|
||||
$(LINK) $(simple_LDFLAGS) $(simple_OBJECTS) $(simple_LDADD) $(LIBS)
|
||||
|
||||
ieval: $(ieval_OBJECTS) $(ieval_DEPENDENCIES)
|
||||
@rm -f ieval
|
||||
$(LINK) $(ieval_LDFLAGS) $(ieval_OBJECTS) $(ieval_LDADD) $(LIBS)
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = examples
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
info:
|
||||
dvi:
|
||||
check: all
|
||||
$(MAKE)
|
||||
installcheck:
|
||||
install-exec:
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install-data:
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-exec install-data all
|
||||
@:
|
||||
|
||||
uninstall:
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-noinstPROGRAMS mostlyclean-compile \
|
||||
mostlyclean-libtool mostlyclean-tags \
|
||||
mostlyclean-generic
|
||||
|
||||
clean: clean-noinstPROGRAMS clean-compile clean-libtool clean-tags \
|
||||
clean-generic mostlyclean
|
||||
|
||||
distclean: distclean-noinstPROGRAMS distclean-compile distclean-libtool \
|
||||
distclean-tags distclean-generic clean
|
||||
-rm -f config.status
|
||||
-rm -f libtool
|
||||
|
||||
maintainer-clean: maintainer-clean-noinstPROGRAMS \
|
||||
maintainer-clean-compile maintainer-clean-libtool \
|
||||
maintainer-clean-tags maintainer-clean-generic \
|
||||
distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
.PHONY: mostlyclean-noinstPROGRAMS distclean-noinstPROGRAMS \
|
||||
clean-noinstPROGRAMS maintainer-clean-noinstPROGRAMS \
|
||||
mostlyclean-compile distclean-compile clean-compile \
|
||||
maintainer-clean-compile mostlyclean-libtool distclean-libtool \
|
||||
clean-libtool maintainer-clean-libtool tags mostlyclean-tags \
|
||||
distclean-tags clean-tags maintainer-clean-tags distdir info dvi \
|
||||
installcheck install-exec install-data install uninstall all \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
dload-linux:
|
||||
$(CC) $(CFLAGS) -shared -fPIC -DPIC dload.c -o dload.so
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -1,14 +0,0 @@
|
||||
function main ()
|
||||
{
|
||||
System.print ("result1=", add (1, 2, 3), "\n");
|
||||
System.print ("result2=", add (1, 2, 3.5), "\n");
|
||||
}
|
||||
|
||||
main ();
|
||||
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
mode: c
|
||||
End:
|
||||
*/
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* An example of a shared library extension for js.
|
||||
* Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
*
|
||||
* Author: Markku Rossi <[email protected]>
|
||||
*/
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
* MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Source: /cygdrive/c/RCVS/CVS/ReactOS/reactos/lib/kjs/examples/dload.c,v $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <js.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
* Static functions.
|
||||
*/
|
||||
|
||||
/* The `hello' command. */
|
||||
JSMethodResult
|
||||
dlhello_proc (void *context, JSInterpPtr interp, int argc, JSType *argv,
|
||||
JSType *result_return, char *error_return)
|
||||
{
|
||||
char *msg = context;
|
||||
|
||||
printf ("%s\n", msg);
|
||||
|
||||
return JS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Global functions.
|
||||
*/
|
||||
|
||||
void
|
||||
dload (JSInterpPtr interp)
|
||||
{
|
||||
js_create_global_method (interp, "dlhello", dlhello_proc,
|
||||
"dlhello: Hello, world!", NULL);
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
function main ()
|
||||
{
|
||||
System.stdout.writeln ("main(): enter");
|
||||
|
||||
System.stdout.writeln ("calling our `hello' global...");
|
||||
hello ();
|
||||
|
||||
System.stdout.writeln ("calling our `Hello.show' method...");
|
||||
Hello.show ();
|
||||
try
|
||||
{
|
||||
Hello.fail ();
|
||||
}
|
||||
catch (msg)
|
||||
{
|
||||
System.stdout.writeln (msg);
|
||||
}
|
||||
|
||||
System.stdout.writeln ("Hello.msg=" + Hello.msg);
|
||||
try
|
||||
{
|
||||
Hello.msg = "foo";
|
||||
}
|
||||
catch (msg)
|
||||
{
|
||||
System.stdout.writeln (msg);
|
||||
}
|
||||
|
||||
var h1 = new Hello ("Hello, mtr!");
|
||||
h1.show ();
|
||||
|
||||
Hello.investigate (h1);
|
||||
|
||||
var h2 = h1.copy ();
|
||||
h2.show ();
|
||||
Hello.investigate (h2);
|
||||
|
||||
System.stdout.writeln ("main(): leave");
|
||||
}
|
||||
|
||||
main ();
|
||||
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
mode: c
|
||||
End:
|
||||
*/
|
||||
@@ -1,100 +0,0 @@
|
||||
/*
|
||||
* Show how the evaluation can be done in phases.
|
||||
* Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
*
|
||||
* Author: Markku Rossi <[email protected]>
|
||||
*/
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
* MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Source: /cygdrive/c/RCVS/CVS/ReactOS/reactos/lib/kjs/examples/ieval.c,v $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <js.h>
|
||||
|
||||
/*
|
||||
* Global functions.
|
||||
*/
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
char buf[1024];
|
||||
JSInterpPtr interp;
|
||||
|
||||
/* Create one interpreter. */
|
||||
interp = js_create_interp (NULL);
|
||||
|
||||
/* Enter the query loop. */
|
||||
while (1)
|
||||
{
|
||||
unsigned char *bc;
|
||||
unsigned char *bc_copy;
|
||||
unsigned int bc_len;
|
||||
char *cp;
|
||||
|
||||
printf ("What file should I evaluate? ");
|
||||
|
||||
if (fgets (buf, sizeof (buf), stdin) == NULL)
|
||||
break;
|
||||
|
||||
cp = strchr (buf, '\n');
|
||||
if (cp)
|
||||
*cp = '\0';
|
||||
|
||||
if (js_compile_to_byte_code (interp, buf, &bc, &bc_len) == 0)
|
||||
{
|
||||
printf ("Compilation to the byte-code failed: %s\n",
|
||||
js_error_message (interp));
|
||||
continue;
|
||||
}
|
||||
|
||||
printf ("Compilation returned %d bytes of byte-code data.\n",
|
||||
bc_len);
|
||||
|
||||
bc_copy = malloc (bc_len);
|
||||
assert (bc_copy != NULL);
|
||||
memcpy (bc_copy, bc, bc_len);
|
||||
|
||||
while (1)
|
||||
{
|
||||
printf ("Hit ENTER to execute the code. ^D exits the loop. ");
|
||||
if (getchar () == EOF)
|
||||
break;
|
||||
|
||||
if (js_execute_byte_code (interp, bc_copy, bc_len) == 0)
|
||||
printf ("Execution failed: %s\n", js_error_message (interp));
|
||||
}
|
||||
|
||||
free (bc_copy);
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
printf ("\n");
|
||||
|
||||
js_destroy_interp (interp);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
function main ()
|
||||
{
|
||||
System.stdout.writeln ("main(): enter");
|
||||
|
||||
System.stdout.writeln (("fubar").getType().toString());
|
||||
System.stdout.writeln ((new Object()).getType().toString());
|
||||
|
||||
System.stdout.writeln ("main(): leave");
|
||||
}
|
||||
|
||||
main ();
|
||||
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
mode: c
|
||||
End:
|
||||
*/
|
||||
@@ -1,338 +0,0 @@
|
||||
/*
|
||||
* An example how to embed the JavaScript interpreter to your program.
|
||||
* Copyright (c) 1998-1999 New Generation Software (NGS) Oy
|
||||
*
|
||||
* Author: Markku Rossi <mtr@ngs.fi>
|
||||
*/
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
* MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Source: /cygdrive/c/RCVS/CVS/ReactOS/reactos/lib/kjs/examples/simple.c,v $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <js.h>
|
||||
|
||||
/*
|
||||
* Static functions.
|
||||
*/
|
||||
|
||||
/* I/O function for the standard error stream. */
|
||||
int
|
||||
io_stderr (void *context, unsigned char *buffer, unsigned int amount)
|
||||
{
|
||||
return fwrite (buffer, 1, amount, stderr);
|
||||
}
|
||||
|
||||
|
||||
/* The `hello' command. */
|
||||
JSMethodResult
|
||||
hello_proc (void *context, JSInterpPtr interp, int argc, JSType *argv,
|
||||
JSType *result_return, char *error_return)
|
||||
{
|
||||
char *msg = context;
|
||||
|
||||
printf ("%s\n", msg);
|
||||
|
||||
return JS_OK;
|
||||
}
|
||||
|
||||
/* The `add' command. */
|
||||
JSMethodResult
|
||||
add_proc (void *context, JSInterpPtr interp, int argc, JSType *argv,
|
||||
JSType *result_return, char *error_return)
|
||||
{
|
||||
int i;
|
||||
double d = 0.0;
|
||||
int doubles = 0;
|
||||
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
JSType *arg = &argv[i];
|
||||
|
||||
switch (arg->type)
|
||||
{
|
||||
case JS_TYPE_INTEGER:
|
||||
d += (double) arg->u.i;
|
||||
break;
|
||||
|
||||
case JS_TYPE_DOUBLE:
|
||||
d += arg->u.d;
|
||||
doubles++;
|
||||
break;
|
||||
|
||||
default:
|
||||
sprintf (error_return, "add: illegal argument");
|
||||
return JS_ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (doubles == 0)
|
||||
{
|
||||
result_return->type = JS_TYPE_INTEGER;
|
||||
result_return->u.i = (long) d;
|
||||
}
|
||||
else
|
||||
{
|
||||
result_return->type = JS_TYPE_DOUBLE;
|
||||
result_return->u.d = d;
|
||||
}
|
||||
|
||||
return JS_OK;
|
||||
}
|
||||
|
||||
/* Methods for the `Hello' class. */
|
||||
|
||||
/* The instance context for Hello objects. */
|
||||
struct hello_ctx_st
|
||||
{
|
||||
char msg[1024];
|
||||
};
|
||||
|
||||
typedef struct hello_ctx_st HelloCtx;
|
||||
|
||||
/* Method `Hello.show()'. */
|
||||
static JSMethodResult
|
||||
hello_show (JSClassPtr cls, void *instance_context, JSInterpPtr interp,
|
||||
int argc, JSType *argv, JSType *result_return, char *error_return)
|
||||
{
|
||||
HelloCtx *ictx = instance_context;
|
||||
char *msg;
|
||||
|
||||
if (ictx)
|
||||
msg = ictx->msg;
|
||||
else
|
||||
msg = js_class_context (cls);
|
||||
|
||||
printf ("%s\n", msg);
|
||||
|
||||
return JS_OK;
|
||||
}
|
||||
|
||||
/* Method `Hello.fail()'. */
|
||||
static JSMethodResult
|
||||
hello_fail (JSClassPtr cls, void *instance_context, JSInterpPtr interp,
|
||||
int argc, JSType *argv, JSType *result_return, char *error_return)
|
||||
{
|
||||
strcpy (error_return, "My mission is to fail!");
|
||||
|
||||
return JS_ERROR;
|
||||
}
|
||||
|
||||
/* Method `Hello.investigate(obj)'. */
|
||||
static JSMethodResult
|
||||
hello_investigate (JSClassPtr cls, void *instance_context, JSInterpPtr interp,
|
||||
int argc, JSType *argv, JSType *result_return,
|
||||
char *error_return)
|
||||
{
|
||||
HelloCtx *others_ictx;
|
||||
|
||||
if (argc != 1)
|
||||
{
|
||||
strcpy (error_return, "illegal amount of arguments");
|
||||
return JS_ERROR;
|
||||
}
|
||||
if (!js_isa (interp, &argv[0], js_lookup_class (interp, "Hello"),
|
||||
(void **) &others_ictx))
|
||||
{
|
||||
strcpy (error_return, "illegal argument");
|
||||
return JS_ERROR;
|
||||
}
|
||||
|
||||
printf ("Hello.investigate(): my argument's message is \"%s\"\n",
|
||||
others_ictx->msg);
|
||||
|
||||
return JS_OK;
|
||||
}
|
||||
|
||||
/* Take a copy of us. */
|
||||
static JSMethodResult
|
||||
hello_copy (JSClassPtr cls, void *instance_context, JSInterpPtr interp,
|
||||
int argc, JSType *argv, JSType *result_return,
|
||||
char *error_return)
|
||||
{
|
||||
HelloCtx *ictx = instance_context;
|
||||
HelloCtx *nictx;
|
||||
JSClassPtr rcls;
|
||||
|
||||
rcls = js_lookup_class (interp, "Hello");
|
||||
if (cls != rcls)
|
||||
{
|
||||
sprintf (error_return, "internal class error");
|
||||
return JS_ERROR;
|
||||
}
|
||||
|
||||
nictx = malloc (sizeof (*nictx));
|
||||
if (ictx)
|
||||
strcpy (nictx->msg, ictx->msg);
|
||||
else
|
||||
strcpy (nictx->msg, "Hello, world!!!!!");
|
||||
|
||||
js_instantiate_class (interp, cls, nictx, free, result_return);
|
||||
|
||||
return JS_OK;
|
||||
}
|
||||
|
||||
/* The getter function for the `Hello.msg' property. */
|
||||
static JSMethodResult
|
||||
hello_msg (JSClassPtr cls, void *instance_context, JSInterpPtr interp,
|
||||
int setp, JSType *value, char *error_return)
|
||||
{
|
||||
HelloCtx *ictx = instance_context;
|
||||
char *msg;
|
||||
|
||||
if (ictx)
|
||||
msg = ictx->msg;
|
||||
else
|
||||
msg = js_class_context (cls);
|
||||
|
||||
js_type_make_string (interp, value, msg, strlen (msg));
|
||||
}
|
||||
|
||||
|
||||
static JSMethodResult
|
||||
hello_constructor (JSClassPtr cls, JSInterpPtr interp, int argc, JSType *argv,
|
||||
void **ictx_return, JSFreeProc *ictx_destructor_return,
|
||||
char *error_return)
|
||||
{
|
||||
HelloCtx *ictx;
|
||||
int len;
|
||||
|
||||
if (argc != 1)
|
||||
{
|
||||
strcpy (error_return, "wront amount of arguments");
|
||||
return JS_ERROR;
|
||||
}
|
||||
if (argv[0].type != JS_TYPE_STRING)
|
||||
{
|
||||
strcpy (error_return, "illegal argument");
|
||||
return JS_ERROR;
|
||||
}
|
||||
|
||||
ictx = calloc (1, sizeof (*ictx));
|
||||
if (ictx == NULL)
|
||||
{
|
||||
strcpy (error_return, "out of memory");
|
||||
return JS_ERROR;
|
||||
}
|
||||
|
||||
len = argv[0].u.s->len;
|
||||
if (len + 1 > sizeof (ictx->msg))
|
||||
len = sizeof (ictx->msg) - 1;
|
||||
|
||||
memcpy (ictx->msg, argv[0].u.s->data, len);
|
||||
ictx->msg[len] = '\0';
|
||||
|
||||
*ictx_return = ictx;
|
||||
*ictx_destructor_return = free;
|
||||
|
||||
return JS_OK;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Global functions.
|
||||
*/
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
JSInterpPtr interp;
|
||||
JSInterpOptions options;
|
||||
JSClassPtr cls;
|
||||
|
||||
int i;
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
fprintf (stderr, "Usage: %s FILE...\n", argv[0]);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/* Create one interpreter. */
|
||||
|
||||
js_init_default_options (&options);
|
||||
|
||||
options.verbose = 2;
|
||||
options.s_stderr = io_stderr;
|
||||
options.s_context = NULL;
|
||||
|
||||
interp = js_create_interp (&options);
|
||||
|
||||
/* Create our extensions. */
|
||||
js_create_global_method (interp, "hello", hello_proc,
|
||||
"(global method) Hello, world!", NULL);
|
||||
js_create_global_method (interp, "add", add_proc, NULL, NULL);
|
||||
|
||||
/* Create our class. */
|
||||
cls = js_class_create ("(Hello) Hello, world!", NULL, 0,
|
||||
hello_constructor);
|
||||
|
||||
js_class_define_method (cls, "show", JS_CF_STATIC, hello_show);
|
||||
js_class_define_method (cls, "fail", JS_CF_STATIC, hello_fail);
|
||||
js_class_define_method (cls, "investigate", JS_CF_STATIC, hello_investigate);
|
||||
js_class_define_method (cls, "copy", 0, hello_copy);
|
||||
|
||||
js_class_define_property (cls, "msg", JS_CF_STATIC | JS_CF_IMMUTABLE,
|
||||
hello_msg);
|
||||
|
||||
js_define_class (interp, cls, "Hello");
|
||||
|
||||
/* Evaluate all argument files. */
|
||||
for (i = 1; i < argc; i++)
|
||||
if (!js_eval_file (interp, argv[i]))
|
||||
fprintf (stderr, "evaluation of file `%s' failed: %s\n",
|
||||
argv[i], js_error_message (interp));
|
||||
|
||||
/* Call our add command with the js_apply() function. */
|
||||
{
|
||||
JSType argv[3];
|
||||
|
||||
argv[0].type = JS_TYPE_INTEGER;
|
||||
argv[0].u.i = 42;
|
||||
|
||||
argv[1].type = JS_TYPE_INTEGER;
|
||||
argv[1].u.i = 72;
|
||||
|
||||
if (!js_apply (interp, "add", 2, argv))
|
||||
{
|
||||
fprintf (stderr, "js_apply() failed: %s\n", js_error_message (interp));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
js_result (interp, &argv[2]);
|
||||
|
||||
if (argv[2].type != JS_TYPE_INTEGER)
|
||||
{
|
||||
fprintf (stderr, "add() returned wrong type!\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
printf ("%ld + %ld = %ld\n", argv[0].u.i, argv[1].u.i, argv[2].u.i);
|
||||
}
|
||||
|
||||
/* Cleanup. */
|
||||
js_destroy_interp (interp);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -1,503 +0,0 @@
|
||||
/*
|
||||
* Public API for the JavaScript interpreter.
|
||||
* Copyright (c) 1998-1999 New Generation Software (NGS) Oy
|
||||
*
|
||||
* Author: Markku Rossi <mtr@ngs.fi>
|
||||
*/
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
* MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Source: /cygdrive/c/RCVS/CVS/ReactOS/reactos/lib/kjs/include/js.h,v $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef JS_H
|
||||
#define JS_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef JS_DLLEXPORT
|
||||
|
||||
#ifdef WIN32
|
||||
#define JS_DLLEXPORT __declspec(dllexport)
|
||||
#else /* not WIN32 */
|
||||
#define JS_DLLEXPORT
|
||||
#endif /* not WIN32 */
|
||||
|
||||
#endif /* not JS_DLLEXPORT */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Types and definitions.
|
||||
*/
|
||||
|
||||
/* Flags for class methods and properties. */
|
||||
#define JS_CF_STATIC 0x01
|
||||
#define JS_CF_IMMUTABLE 0x02
|
||||
|
||||
/*
|
||||
* This is frustrating. We have to define these, since MS's and
|
||||
* Borlands' compilers can't agree on how to handle the stupid export
|
||||
* declarations and function pointer return values.
|
||||
*/
|
||||
typedef char *JSCharPtr;
|
||||
typedef void *JSVoidPtr;
|
||||
|
||||
/* Byte-code instruction dispatch methods. */
|
||||
typedef enum
|
||||
{
|
||||
JS_VM_DISPATCH_SWITCH_BASIC,
|
||||
JS_VM_DISPATCH_SWITCH,
|
||||
JS_VM_DISPATCH_JUMPS
|
||||
} JSVMDispatchMethod;
|
||||
|
||||
typedef struct js_interp_st *JSInterpPtr;
|
||||
|
||||
/*
|
||||
* An I/O function that can be set to interpreter options to redirect
|
||||
* the system's default streams.
|
||||
*/
|
||||
typedef int (*JSIOFunc) (void *context, unsigned char *buffer,
|
||||
unsigned int amount);
|
||||
|
||||
/*
|
||||
* Hook that is called at certain points during the byte-code
|
||||
* execution. Note that the JS_HOOK_OPERAND_COUNT is only available,
|
||||
* if the interpreter was configured with `--enable-operand-hooks'
|
||||
* option.
|
||||
*/
|
||||
|
||||
#define JS_EVENT_OPERAND_COUNT 1
|
||||
#define JS_EVENT_GARBAGE_COLLECT 2
|
||||
|
||||
typedef int (*JSHook) (int event, void *context);
|
||||
|
||||
|
||||
/* Interpreter options. */
|
||||
struct js_interp_options_st
|
||||
{
|
||||
unsigned int stack_size;
|
||||
JSVMDispatchMethod dispatch_method;
|
||||
unsigned int verbose;
|
||||
|
||||
/* Virtual machine flags. */
|
||||
|
||||
unsigned int no_compiler : 1;
|
||||
unsigned int stacktrace_on_error : 1;
|
||||
|
||||
unsigned int secure_builtin_file : 1;
|
||||
unsigned int secure_builtin_system : 1;
|
||||
|
||||
/* Misc compiler flags. */
|
||||
unsigned int annotate_assembler : 1;
|
||||
unsigned int debug_info : 1;
|
||||
unsigned int executable_bc_files : 1;
|
||||
|
||||
/* Compiler warning flags. */
|
||||
unsigned int warn_unused_argument : 1;
|
||||
unsigned int warn_unused_variable : 1;
|
||||
unsigned int warn_undef : 1; /* runtime option */
|
||||
unsigned int warn_shadow : 1;
|
||||
unsigned int warn_with_clobber : 1;
|
||||
unsigned int warn_missing_semicolon : 1;
|
||||
unsigned int warn_strict_ecma : 1;
|
||||
unsigned int warn_deprecated : 1;
|
||||
|
||||
/* Compiler optimization flags. */
|
||||
unsigned int optimize_peephole : 1;
|
||||
unsigned int optimize_jumps_to_jumps : 1;
|
||||
unsigned int optimize_bc_size : 1;
|
||||
unsigned int optimize_heavy : 1;
|
||||
|
||||
/*
|
||||
* The standard system streams. If these are NULL, the streams are
|
||||
* bind to the system's stdin, stdout, and stderr files.
|
||||
*/
|
||||
JSIOFunc s_stdin;
|
||||
JSIOFunc s_stdout;
|
||||
JSIOFunc s_stderr;
|
||||
void *s_context;
|
||||
|
||||
/* The callback hook. */
|
||||
JSHook hook;
|
||||
void *hook_context;
|
||||
|
||||
/*
|
||||
* Call the <hook> after the virtual machine has executed this many
|
||||
* operands.
|
||||
*/
|
||||
unsigned int hook_operand_count_trigger;
|
||||
|
||||
/* How many file descriptors the interpreter can allocate. */
|
||||
unsigned long fd_count;
|
||||
};
|
||||
|
||||
typedef struct js_interp_options_st JSInterpOptions;
|
||||
|
||||
|
||||
/* JavaScript public types. */
|
||||
|
||||
#define JS_TYPE_UNDEFINED 0
|
||||
#define JS_TYPE_NULL 1
|
||||
#define JS_TYPE_BOOLEAN 2
|
||||
#define JS_TYPE_INTEGER 3
|
||||
#define JS_TYPE_STRING 4
|
||||
#define JS_TYPE_DOUBLE 5
|
||||
#define JS_TYPE_ARRAY 6
|
||||
#define JS_TYPE_BUILTIN 11
|
||||
|
||||
/* String type. */
|
||||
struct js_type_string_st
|
||||
{
|
||||
unsigned int flags;
|
||||
unsigned char *data;
|
||||
unsigned int len;
|
||||
};
|
||||
|
||||
typedef struct js_type_string_st JSTypeString;
|
||||
|
||||
/* Array type. */
|
||||
struct js_type_array_st
|
||||
{
|
||||
unsigned int length;
|
||||
struct js_type_st *data;
|
||||
};
|
||||
|
||||
typedef struct js_type_array_st JSTypeArray;
|
||||
|
||||
/* The type closure. */
|
||||
struct js_type_st
|
||||
{
|
||||
int type; /* One of the JS_TYPE_* values. */
|
||||
|
||||
union
|
||||
{
|
||||
long i; /* integer or boolean */
|
||||
JSTypeString *s; /* string */
|
||||
double d; /* double */
|
||||
JSTypeArray *array; /* array */
|
||||
|
||||
struct /* Fillter to assure that this the type */
|
||||
{ /* structure has correct size. */
|
||||
unsigned int a1;
|
||||
unsigned int a2;
|
||||
} align;
|
||||
} u;
|
||||
};
|
||||
|
||||
typedef struct js_type_st JSType;
|
||||
|
||||
/* Function type to free client data. */
|
||||
typedef void (*JSFreeProc) (void *context);
|
||||
|
||||
/* Return types for methods. */
|
||||
typedef enum
|
||||
{
|
||||
JS_OK,
|
||||
JS_ERROR
|
||||
} JSMethodResult;
|
||||
|
||||
/* Function type for global methods. */
|
||||
typedef JSMethodResult (*JSGlobalMethodProc) (void *context,
|
||||
JSInterpPtr interp, int argc,
|
||||
JSType *argv,
|
||||
JSType *result_return,
|
||||
char *error_return);
|
||||
|
||||
/* Function type for JS modules. */
|
||||
typedef void (*JSModuleInitProc) (JSInterpPtr interp);
|
||||
|
||||
|
||||
/* Classes. */
|
||||
|
||||
typedef struct js_class_st *JSClassPtr;
|
||||
|
||||
typedef JSMethodResult (*JSMethodProc) (JSClassPtr cls, void *instance_context,
|
||||
JSInterpPtr interp, int argc,
|
||||
JSType *argv, JSType *result_return,
|
||||
char *error_return);
|
||||
|
||||
typedef JSMethodResult (*JSPropertyProc) (JSClassPtr cls,
|
||||
void *instance_context,
|
||||
JSInterpPtr interp, int setp,
|
||||
JSType *value, char *error_return);
|
||||
|
||||
typedef JSMethodResult (*JSConstructor) (JSClassPtr cls, JSInterpPtr interp,
|
||||
int argc, JSType *argv,
|
||||
void **ictx_return,
|
||||
JSFreeProc *ictx_destructor_return,
|
||||
char *error_return);
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes global functions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Interpreter handling.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Return a string that describes the JavaScript interpreter version
|
||||
* number. The returned string is in format "MAJOR.MINOR.PATCH",
|
||||
* where MAJOR, MINOR, and PATCH are integer numbers.
|
||||
*/
|
||||
JSCharPtr JS_DLLEXPORT js_version ();
|
||||
|
||||
/* Initialize interpreter options to system's default values. */
|
||||
void JS_DLLEXPORT js_init_default_options (JSInterpOptions *options);
|
||||
|
||||
/* Create a new JavaScript interpreter. */
|
||||
struct _KJS;
|
||||
JSInterpPtr JS_DLLEXPORT js_create_interp (JSInterpOptions *options,
|
||||
struct _KJS *kjs);
|
||||
|
||||
/* Destroy interpreter <interp>. */
|
||||
void JS_DLLEXPORT js_destroy_interp (JSInterpPtr interp);
|
||||
|
||||
/* Return error message from the latest error. */
|
||||
JSCharPtr JS_DLLEXPORT js_error_message (JSInterpPtr interp);
|
||||
|
||||
/*
|
||||
* Get the result of the latest evaluation or execution in interpreter
|
||||
* <interp>. The result is returned in <result_return>. All data,
|
||||
* returned in <result_return>, belongs to the interpreter. The
|
||||
* caller must not modify or changed it in any ways.
|
||||
*/
|
||||
void JS_DLLEXPORT js_result (JSInterpPtr interp, JSType *result_return);
|
||||
|
||||
/* Set the value of global variable <name> to <value>. */
|
||||
void JS_DLLEXPORT js_set_var (JSInterpPtr interp, char *name, JSType *value);
|
||||
|
||||
/* Get the value of global variable <name> to <value>. */
|
||||
void JS_DLLEXPORT js_get_var (JSInterpPtr interp, char *name, JSType *value);
|
||||
|
||||
/* Get the options of interpreter <interp> to <options>. */
|
||||
void JS_DLLEXPORT js_get_options (JSInterpPtr interp,
|
||||
JSInterpOptions *options);
|
||||
|
||||
/* Modify the options of interpreter <interp> according to <options>. */
|
||||
void JS_DLLEXPORT js_set_options (JSInterpPtr interp,
|
||||
JSInterpOptions *options);
|
||||
|
||||
/*
|
||||
* Evaluation and compilation.
|
||||
*/
|
||||
|
||||
/* Evalutate JavaScript code <code> with interpreter <interp>. */
|
||||
int JS_DLLEXPORT js_eval (JSInterpPtr interp, char *code);
|
||||
|
||||
/* Evaluate JavaScript code <data, datalen> with interpreter <interp>. */
|
||||
int JS_DLLEXPORT js_eval_data (JSInterpPtr interp, char *data,
|
||||
unsigned int datalen);
|
||||
|
||||
/*
|
||||
* Evaluate file <filename> with interpreter <interp>. File
|
||||
* <filename> can contain JavaScript of byte-code. The function
|
||||
* return 1 if the evaluation was successful or 0 otherwise. If the
|
||||
* evaluation failed, the error message can be retrieved with the
|
||||
* function js_error_message().
|
||||
*/
|
||||
int JS_DLLEXPORT js_eval_file (JSInterpPtr interp, char *filename);
|
||||
|
||||
/* Eval JavaScript file <filename> with interpreter <interp>. */
|
||||
int JS_DLLEXPORT js_eval_javascript_file (JSInterpPtr interp, char *filename);
|
||||
|
||||
/* Execute a byte-code file <filename> with interpreter <interp>. */
|
||||
int JS_DLLEXPORT js_execute_byte_code_file (JSInterpPtr interp,
|
||||
char *filename);
|
||||
|
||||
/*
|
||||
* Call funtion <name> with arguments <argc, argv>. The return value
|
||||
* of the function <name> can be retrieved with the js_result()
|
||||
* function.
|
||||
*/
|
||||
int JS_DLLEXPORT js_apply (JSInterpPtr interp, char *name,
|
||||
unsigned int argc, JSType *argv);
|
||||
|
||||
/* Compile JavaScript file <input_file> to assembler or byte-code. */
|
||||
int JS_DLLEXPORT js_compile (JSInterpPtr interp, char *input_file,
|
||||
char *assembler_file, char *byte_code_file);
|
||||
|
||||
/*
|
||||
* Compile JavaScript file <input_file> to byte-code and return the
|
||||
* resulting byte-code data in <bc_return, bc_len_return>. The
|
||||
* returned byte-code data <bc_return> belongs to the interpreter
|
||||
* and it must be saved by the caller *before* any other JS functions
|
||||
* is called. If the data is not saved, its contents will be invalid
|
||||
* at the next garbage collection.
|
||||
*/
|
||||
int JS_DLLEXPORT js_compile_to_byte_code (JSInterpPtr interp, char *input_file,
|
||||
unsigned char **bc_return,
|
||||
unsigned int *bc_len_return);
|
||||
|
||||
/*
|
||||
* Compile JavaScript code <data, datalen> to byte-code and return the
|
||||
* resulting byte-code data in <bc_return, bc_len_return>.
|
||||
*/
|
||||
int JS_DLLEXPORT js_compile_data_to_byte_code (JSInterpPtr interp, char *data,
|
||||
unsigned int datalen,
|
||||
unsigned char **bc_return,
|
||||
unsigned int *bc_len_return);
|
||||
|
||||
/*
|
||||
* Execute byte-code data <bc, bc_len>. The byte-code data is the
|
||||
* contents of a byte-code file, or a copy of the data returned by the
|
||||
* js_compile{,_data}_to_byte_code() functions.
|
||||
*
|
||||
* Note! You can't use the data from the js_compile{,_data}_to_byte_code()
|
||||
* functions as an input for this function. Instead, you must take a
|
||||
* private copy of the data and pass that copy to the function:
|
||||
*
|
||||
* if (js_compile_to_byte_code (interp, "./foo.js", &bc, &bclen))
|
||||
* {
|
||||
* char *bc_copy = xmalloc (bclen);
|
||||
*
|
||||
* memcpy (bc_copy, bc, bclen);
|
||||
* js_execute_byte_code (interp, bc_copy, bclen);
|
||||
* xfree (bc_copy);
|
||||
* }
|
||||
*/
|
||||
int JS_DLLEXPORT js_execute_byte_code (JSInterpPtr interp, unsigned char *bc,
|
||||
unsigned int bc_len);
|
||||
|
||||
|
||||
/*
|
||||
* Type handling.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Create a new string type from <data> that has <length> bytes of data.
|
||||
* All fields of <type> belong to the interpreter.
|
||||
*/
|
||||
void JS_DLLEXPORT js_type_make_string (JSInterpPtr interp, JSType *type,
|
||||
unsigned char *data,
|
||||
unsigned int length);
|
||||
|
||||
/* Create a new array with capacity of <length> items. */
|
||||
void JS_DLLEXPORT js_type_make_array (JSInterpPtr interp, JSType *type,
|
||||
unsigned int length);
|
||||
|
||||
|
||||
/*
|
||||
* Global methods.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Create a new global method to the interpreter <interp>. The
|
||||
* method's name will be <name> and its implementation is function
|
||||
* <proc>. The argument <context> is a user-specified data that is
|
||||
* passed to the command <proc>. When the command is deleted, the
|
||||
* argument <context_free_proc> is called for data <context> to free
|
||||
* up all resources the <context> might have. The function returns
|
||||
* 1 if the operation was successful or 0 otherwise.
|
||||
*/
|
||||
int JS_DLLEXPORT js_create_global_method (JSInterpPtr interp, char *name,
|
||||
JSGlobalMethodProc proc,
|
||||
void *context,
|
||||
JSFreeProc context_free_proc);
|
||||
|
||||
|
||||
/*
|
||||
* Classes.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Create a new class with class context data <class_context>. The
|
||||
* context data is destroyed with <class_context_destructor>. If the
|
||||
* argument <no_auto_destroy> is not 0, the JavaScript interpreter
|
||||
* will *not* destroy the class when the interpreter is destroyed. In
|
||||
* that case, it is the caller's responsibility to call
|
||||
* js_class_destroy() for the returned class handle, after the
|
||||
* interpreter has been destroyed. If the argument <constructor> is
|
||||
* not NULL, it is used to instantiate the class when a `new CLASS
|
||||
* (ARGS);' expression is evaluated in the JavaScript code.
|
||||
*/
|
||||
JSClassPtr JS_DLLEXPORT js_class_create (void *class_context,
|
||||
JSFreeProc class_context_destructor,
|
||||
int no_auto_destroy,
|
||||
JSConstructor constuctor);
|
||||
|
||||
void JS_DLLEXPORT js_class_destroy (JSClassPtr cls);
|
||||
|
||||
JSVoidPtr JS_DLLEXPORT js_class_context (JSClassPtr cls);
|
||||
|
||||
int JS_DLLEXPORT js_class_define_method (JSClassPtr cls, char *name,
|
||||
unsigned int flags,
|
||||
JSMethodProc method);
|
||||
|
||||
int JS_DLLEXPORT js_class_define_property (JSClassPtr cls, char *name,
|
||||
unsigned int flags,
|
||||
JSPropertyProc property);
|
||||
|
||||
int JS_DLLEXPORT js_define_class (JSInterpPtr interp, JSClassPtr cls,
|
||||
char *name);
|
||||
|
||||
int JS_DLLEXPORT js_instantiate_class (JSInterpPtr interp, JSClassPtr cls,
|
||||
void *ictx, JSFreeProc ictx_destructor,
|
||||
JSType *result_return);
|
||||
|
||||
JSClassPtr JS_DLLEXPORT js_lookup_class (JSInterpPtr interp,
|
||||
char *name);
|
||||
|
||||
/*
|
||||
* Check if object <object> is an instance of class <cls>. The
|
||||
* function returns a boolean success status. If the argument
|
||||
* <instance_context_return> is not NULL, it will be set to the
|
||||
* instance context of object <object>.
|
||||
*/
|
||||
int JS_DLLEXPORT js_isa (JSInterpPtr interp, JSType *object, JSClassPtr cls,
|
||||
void **instance_context_return);
|
||||
|
||||
|
||||
/*
|
||||
* Modules.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Call the module initialization function <init_proc>. The function
|
||||
* return 1 if the module was successfully initialized or 0 otherwise.
|
||||
* In case of error, the error message can be fetched with the
|
||||
* js_error_mesage() function.
|
||||
*/
|
||||
int JS_DLLEXPORT js_define_module (JSInterpPtr interp,
|
||||
JSModuleInitProc init_proc);
|
||||
|
||||
|
||||
/*
|
||||
* The default modules.
|
||||
*/
|
||||
|
||||
/* JavaScript interpreter extension. */
|
||||
void JS_DLLEXPORT js_ext_JS (JSInterpPtr interp);
|
||||
|
||||
/* Curses extension. */
|
||||
void JS_DLLEXPORT js_ext_curses (JSInterpPtr interp);
|
||||
|
||||
/* MD5 extension. */
|
||||
void JS_DLLEXPORT js_ext_MD5 (JSInterpPtr interp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not JS_H */
|
||||
@@ -1,189 +0,0 @@
|
||||
/* jsconfig.h. Generated automatically by configure. */
|
||||
/* jsconfig.h.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Define if on AIX 3.
|
||||
System headers sometimes define this.
|
||||
We just want to avoid a redefinition error message. */
|
||||
#ifndef _ALL_SOURCE
|
||||
/* #undef _ALL_SOURCE */
|
||||
#endif
|
||||
|
||||
/* Define if using alloca.c. */
|
||||
/* #undef C_ALLOCA */
|
||||
|
||||
/* Define to empty if the keyword does not work. */
|
||||
/* #undef const */
|
||||
|
||||
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
|
||||
This function is required for alloca.c support on those systems. */
|
||||
/* #undef CRAY_STACKSEG_END */
|
||||
|
||||
/* Define if you have alloca, as a function or macro. */
|
||||
#define HAVE_ALLOCA 1
|
||||
|
||||
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
|
||||
#define HAVE_ALLOCA_H 1
|
||||
|
||||
/* Define as __inline if that's what the C compiler calls it. */
|
||||
/* #undef inline */
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at run-time.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown
|
||||
*/
|
||||
/* #undef STACK_DIRECTION */
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/*
|
||||
* Define the PACKAGE and VERSION only if they are undefined. This means
|
||||
* that we do not redefine them, when the library is used in another
|
||||
* GNU like package that defines PACKAGE and VERSION.
|
||||
*/
|
||||
|
||||
/* Package name. */
|
||||
#ifndef PACKAGE
|
||||
#define PACKAGE "js"
|
||||
#endif /* no PACKAGE */
|
||||
|
||||
/* Version number. */
|
||||
#ifndef VERSION
|
||||
#define VERSION "0.2.5"
|
||||
#endif /* no VERSION */
|
||||
|
||||
/* Are C prototypes supported. */
|
||||
#define PROTOTYPES 1
|
||||
|
||||
/* Canonical host name and its parts. */
|
||||
#define CANONICAL_HOST "i686-pc-linux-gnu"
|
||||
#define CANONICAL_HOST_CPU "i686"
|
||||
#define CANONICAL_HOST_VENDOR "pc"
|
||||
#define CANONICAL_HOST_OS "linux-gnu"
|
||||
|
||||
/* Do we want to build all instruction dispatchers? */
|
||||
/* #undef ALL_DISPATCHERS */
|
||||
|
||||
/* Do we want to profile byte-code operands. */
|
||||
/* #undef PROFILING */
|
||||
|
||||
/* Do we want the byte-code operand hooks. */
|
||||
/* #undef BC_OPERAND_HOOKS */
|
||||
|
||||
/*
|
||||
* Unconditionall disable the jumps byte-code instruction dispatch
|
||||
* method.
|
||||
*/
|
||||
/* #undef DISABLE_JUMPS */
|
||||
|
||||
/* Does the struct stat has st_blksize member? */
|
||||
#define HAVE_STAT_ST_ST_BLKSIZE 1
|
||||
|
||||
/* Does the struct stat has st_blocks member? */
|
||||
#define HAVE_STAT_ST_ST_BLOCKS 1
|
||||
|
||||
/* Does the asctime_r() function take three arguments. */
|
||||
/* #undef ASCTIME_R_WITH_THREE_ARGS */
|
||||
|
||||
/* Does the drand48_r() work with DRAND48D data. */
|
||||
/* #undef DRAND48_R_WITH_DRAND48D */
|
||||
|
||||
/* How the attribute structures are passed to the init functions. */
|
||||
/* #undef CONDATTR_BY_VALUE */
|
||||
/* #undef MUTEXATTR_BY_VALUE */
|
||||
/* #undef THREADATTR_BY_VALUE */
|
||||
|
||||
/* JS */
|
||||
#define WITH_JS 1
|
||||
|
||||
/* Curses. */
|
||||
/* #undef WITH_CURSES */
|
||||
/* #undef HAVE_CURSES_H */
|
||||
/* #undef HAVE_NCURSES_H */
|
||||
|
||||
/* MD5 */
|
||||
#define WITH_MD5 1
|
||||
|
||||
/* The number of bytes in a int. */
|
||||
#define SIZEOF_INT 4
|
||||
|
||||
/* The number of bytes in a long. */
|
||||
#define SIZEOF_LONG 4
|
||||
|
||||
/* Define if you have the drand48 function. */
|
||||
#define HAVE_DRAND48 1
|
||||
|
||||
/* Define if you have the lstat function. */
|
||||
#define HAVE_LSTAT 1
|
||||
|
||||
/* Define if you have the pthread_attr_create function. */
|
||||
/* #undef HAVE_PTHREAD_ATTR_CREATE */
|
||||
|
||||
/* Define if you have the pthread_attr_setscope function. */
|
||||
/* #undef HAVE_PTHREAD_ATTR_SETSCOPE */
|
||||
|
||||
/* Define if you have the pthread_attr_setstacksize function. */
|
||||
/* #undef HAVE_PTHREAD_ATTR_SETSTACKSIZE */
|
||||
|
||||
/* Define if you have the pthread_condattr_create function. */
|
||||
/* #undef HAVE_PTHREAD_CONDATTR_CREATE */
|
||||
|
||||
/* Define if you have the pthread_condattr_init function. */
|
||||
/* #undef HAVE_PTHREAD_CONDATTR_INIT */
|
||||
|
||||
/* Define if you have the pthread_mutexattr_create function. */
|
||||
/* #undef HAVE_PTHREAD_MUTEXATTR_CREATE */
|
||||
|
||||
/* Define if you have the sleep function. */
|
||||
#define HAVE_SLEEP 1
|
||||
|
||||
/* Define if you have the srand48 function. */
|
||||
#define HAVE_SRAND48 1
|
||||
|
||||
/* Define if you have the usleep function. */
|
||||
#define HAVE_USLEEP 1
|
||||
|
||||
/* Define if you have the <dlfcn.h> header file. */
|
||||
#define HAVE_DLFCN_H 1
|
||||
|
||||
/* Define if you have the <errno.h> header file. */
|
||||
#define HAVE_ERRNO_H 1
|
||||
|
||||
/* Define if you have the <float.h> header file. */
|
||||
#define HAVE_FLOAT_H 1
|
||||
|
||||
/* Define if you have the <limits.h> header file. */
|
||||
#define HAVE_LIMITS_H 1
|
||||
|
||||
/* Define if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
#include "ddk/ntddk.h"
|
||||
/* #include "assert.h" */
|
||||
#ifndef __TYPE_UINT64
|
||||
typedef unsigned __int64 __uint64;
|
||||
#define __TYPE_UINT64
|
||||
#endif/*__TYPE_UINT64*/
|
||||
|
||||
extern void __kernel_abort();
|
||||
#define abort(x) __kernel_abort()
|
||||
#define HUGE_VAL (__uint64)(-1LL)
|
||||
|
||||
#ifndef SETJMP_DEF
|
||||
#define SETJMP_DEF
|
||||
typedef struct _jmpbuf_kernel {
|
||||
int words[8];
|
||||
} jmp_buf[1];
|
||||
#endif/*SETJMP_DEF*/
|
||||
|
||||
int setjmp( jmp_buf j );
|
||||
void longjmp( jmp_buf env, int val );
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,24 +0,0 @@
|
||||
#ifndef KJS_H
|
||||
#define KJS_H
|
||||
|
||||
#include "jsint.h"
|
||||
#include "js.h"
|
||||
#include "kjs_structs.h"
|
||||
|
||||
typedef struct system_ctx_st SystemCtx;
|
||||
|
||||
typedef struct _KJS {
|
||||
JSInterpPtr interp;
|
||||
JSVirtualMachine *vm;
|
||||
SystemCtx *ctx;
|
||||
} KJS, *PKJS;
|
||||
|
||||
extern PKJS kjs_create_interp( VOID *Reserved );
|
||||
extern VOID kjs_destroy_interp( PKJS kjs );
|
||||
extern VOID kjs_eval( PKJS js_interp, PCHAR commands );
|
||||
extern VOID kjs_system_register( PKJS js_interp, PCHAR method, PVOID context,
|
||||
PKJS_METHOD function );
|
||||
extern VOID kjs_system_unregister( PKJS js_interp, PVOID context,
|
||||
PKJS_METHOD function );
|
||||
|
||||
#endif/*KJS_H*/
|
||||
@@ -1,44 +0,0 @@
|
||||
#ifndef KJS_STRUCTS_H
|
||||
#define KJS_STRUCTS_H
|
||||
|
||||
struct _KJS;
|
||||
struct js_node_st;
|
||||
|
||||
typedef int (*PKJS_METHOD)( void *context,
|
||||
struct js_node_st *js_node, struct js_node_st *result );
|
||||
|
||||
typedef struct _JSSymbolList {
|
||||
JSSymbol symbol;
|
||||
PKJS_METHOD registered_function;
|
||||
struct _JSSymbolList *next;
|
||||
PVOID context;
|
||||
} JSSymbolList;
|
||||
|
||||
struct system_ctx_st
|
||||
{
|
||||
JSSymbol s_print;
|
||||
JSSymbol s_mread;
|
||||
JSSymbol s_mwrite;
|
||||
JSSymbol s_reg;
|
||||
JSSymbol s_regdir;
|
||||
|
||||
JSSymbolList *registered_symbols;
|
||||
|
||||
JSSymbol s_bits;
|
||||
JSSymbol s_canonicalHost;
|
||||
JSSymbol s_canonicalHostCPU;
|
||||
JSSymbol s_canonicalHostVendor;
|
||||
JSSymbol s_canonicalHostOS;
|
||||
JSSymbol s_errno;
|
||||
JSSymbol s_lineBreakSequence;
|
||||
JSSymbol s_stderr;
|
||||
JSSymbol s_stdin;
|
||||
JSSymbol s_stdout;
|
||||
|
||||
/* System file handles. */
|
||||
JSNode pstderr;
|
||||
JSNode pstdin;
|
||||
JSNode pstdout;
|
||||
};
|
||||
|
||||
#endif/*KJS_STRUCTS_H*/
|
||||
@@ -1,35 +0,0 @@
|
||||
1998-12-17 Markku Rossi <[email protected]>
|
||||
|
||||
* process.js (process_file): Added support for integer constants.
|
||||
(const_string): Fixed a typo from the backslash handing.
|
||||
|
||||
1998-10-28 Markku Rossi <[email protected]>
|
||||
|
||||
* process.js (process_file): Use the operand flags instead of
|
||||
using the hardcoded operand names.
|
||||
|
||||
* extract-operands.js (main): Fixed to obey the flag comments of
|
||||
the operands.def file.
|
||||
|
||||
1998-10-14 Markku Rossi <[email protected]>
|
||||
|
||||
* main.js (main): Fixed to create the output file name from the
|
||||
input file names.
|
||||
|
||||
* process.js (process_file): Initial support for string
|
||||
constants.
|
||||
|
||||
* main.js: Implemented -g, -O, and -v options.
|
||||
|
||||
1998-10-13 Markku Rossi <[email protected]>
|
||||
|
||||
* extract-operands.js: Extract byte-code operand information from
|
||||
the `src/operands.def' file, and create the operands.js file.
|
||||
|
||||
1998-10-12 Markku Rossi <[email protected]>
|
||||
|
||||
* process.js: New file to handle the assembler file processing.
|
||||
|
||||
1998-06-25 Markku Rossi <[email protected]>
|
||||
|
||||
* Created the assembler project.
|
||||
@@ -1,51 +0,0 @@
|
||||
#
|
||||
# Automakefile for JavaScript assembler.
|
||||
# Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
#
|
||||
# Author: Markku Rossi <[email protected]>
|
||||
#
|
||||
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
# MA 02111-1307, USA
|
||||
#
|
||||
|
||||
JSCOMPILER = ../src/js
|
||||
JSCOMPILER_FLAGS = -g -Wpedantic -O2
|
||||
|
||||
JSS = process.js operands.js main.js
|
||||
JSCS = process.jsc operands.jsc main.jsc
|
||||
|
||||
EXTRA_DIST = $(JSS)
|
||||
|
||||
bin_SCRIPTS = jsas
|
||||
|
||||
compile: $(JSCS)
|
||||
|
||||
jsas: $(JSS)
|
||||
rm -f $@.js
|
||||
for i in $(JSS); do cat $(srcdir)/$$i >> $@.js; done
|
||||
$(JSCOMPILER) $(JSCOMPILER_FLAGS) -c $@.js
|
||||
echo "#!$(bindir)/js --file" > $@
|
||||
# echo "#!$(JSCOMPILER) --file" > $@
|
||||
cat $@.jsc >> $@
|
||||
chmod a+x $@
|
||||
|
||||
CLEANFILES = jsas $(JSCS)
|
||||
|
||||
SUFFIXES = .jsc .js
|
||||
|
||||
.js.jsc:
|
||||
$(JSCOMPILER) $(JSCOMPILER_FLAGS) -c $<
|
||||
@@ -1,244 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
#
|
||||
# Automakefile for JavaScript assembler.
|
||||
# Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
#
|
||||
# Author: Markku Rossi <[email protected]>
|
||||
#
|
||||
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
# MA 02111-1307, USA
|
||||
#
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
ACLOCAL_FLAGS_FOR_LIBTOOL = @ACLOCAL_FLAGS_FOR_LIBTOOL@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
EXTENSIONS = @EXTENSIONS@
|
||||
EXTENSIONS_LIBS = @EXTENSIONS_LIBS@
|
||||
INTERPRETER_FEATURES = @INTERPRETER_FEATURES@
|
||||
LD = @LD@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
NM = @NM@
|
||||
PACKAGE = @PACKAGE@
|
||||
PGCC_BY_PROVENZANO = @PGCC_BY_PROVENZANO@
|
||||
RANLIB = @RANLIB@
|
||||
U = @U@
|
||||
VERSION = @VERSION@
|
||||
XLC_R_AIX = @XLC_R_AIX@
|
||||
|
||||
JSCOMPILER = ../src/js
|
||||
JSCOMPILER_FLAGS = -g -Wpedantic -O2
|
||||
|
||||
JSS = process.js operands.js main.js
|
||||
JSCS = process.jsc operands.jsc main.jsc
|
||||
|
||||
EXTRA_DIST = $(JSS)
|
||||
|
||||
bin_SCRIPTS = jsas
|
||||
|
||||
CLEANFILES = jsas $(JSCS)
|
||||
|
||||
SUFFIXES = .jsc .js
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../jsconfig.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
SCRIPTS = $(bin_SCRIPTS)
|
||||
|
||||
DIST_COMMON = ChangeLog Makefile.am Makefile.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
all: Makefile $(SCRIPTS)
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .js .jsc
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps jsas/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
install-binSCRIPTS: $(bin_SCRIPTS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
@list='$(bin_SCRIPTS)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
|
||||
$(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||
else if test -f $(srcdir)/$$p; then \
|
||||
echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
|
||||
$(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||
else :; fi; fi; \
|
||||
done
|
||||
|
||||
uninstall-binSCRIPTS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(bin_SCRIPTS)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||
done
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = jsas
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
info:
|
||||
dvi:
|
||||
check: all
|
||||
$(MAKE)
|
||||
installcheck:
|
||||
install-exec: install-binSCRIPTS
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install-data:
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-exec install-data all
|
||||
@:
|
||||
|
||||
uninstall: uninstall-binSCRIPTS
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DATADIR)$(bindir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-generic
|
||||
|
||||
clean: clean-generic mostlyclean
|
||||
|
||||
distclean: distclean-generic clean
|
||||
-rm -f config.status
|
||||
-rm -f libtool
|
||||
|
||||
maintainer-clean: maintainer-clean-generic distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
.PHONY: uninstall-binSCRIPTS install-binSCRIPTS tags distdir info dvi \
|
||||
installcheck install-exec install-data install uninstall all \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
compile: $(JSCS)
|
||||
|
||||
jsas: $(JSS)
|
||||
rm -f $@.js
|
||||
for i in $(JSS); do cat $(srcdir)/$$i >> $@.js; done
|
||||
$(JSCOMPILER) $(JSCOMPILER_FLAGS) -c $@.js
|
||||
echo "#!$(bindir)/js --file" > $@
|
||||
# echo "#!$(JSCOMPILER) --file" > $@
|
||||
cat $@.jsc >> $@
|
||||
chmod a+x $@
|
||||
|
||||
.js.jsc:
|
||||
$(JSCOMPILER) $(JSCOMPILER_FLAGS) -c $<
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -1,980 +0,0 @@
|
||||
/*
|
||||
* Process assembler file.
|
||||
* Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
*
|
||||
* Author: Markku Rossi <mtr@ngs.fi>
|
||||
*/
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
* MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Source: /cygdrive/c/RCVS/CVS/ReactOS/reactos/lib/kjs/jsas/jsas.js,v $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
function process_file (name)
|
||||
{
|
||||
var fp = new File (name);
|
||||
var labels = new Object ();
|
||||
var label_waits = new Object ();
|
||||
var op;
|
||||
|
||||
if (fp.open ("r"))
|
||||
{
|
||||
var linenum = 0;
|
||||
|
||||
while (!fp.eof ())
|
||||
{
|
||||
var line = fp.readln ();
|
||||
linenum++;
|
||||
|
||||
/* Remove comments. */
|
||||
line = line.replace (/;.*$/, "");
|
||||
|
||||
/* Extract the labels and symbols. */
|
||||
if (/^([^ \t\n]+):(.*)$/.exec (line))
|
||||
{
|
||||
var label = RegExp.$1;
|
||||
line = RegExp.$2;
|
||||
|
||||
if (/^\.[^ ]+$/.test (label) && label != ".global")
|
||||
{
|
||||
/* It is a label. */
|
||||
if (labels[label])
|
||||
{
|
||||
System.stderr.writeln (name + ":" + linenum.toString ()
|
||||
+ ": label `" + label +
|
||||
"' is already defined");
|
||||
System.stderr.writeln (name + ":"
|
||||
+ (labels[label].linenum
|
||||
.toString ())
|
||||
+ ": this is the place of the "
|
||||
+ "previous definition");
|
||||
System.exit (1);
|
||||
}
|
||||
labels[label] = new JSC$ASM_label ();
|
||||
labels[label].linenum = linenum;
|
||||
labels[label].link ();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* It is a symbol. */
|
||||
new JSC$ASM_symbol (linenum, label).link ();
|
||||
}
|
||||
}
|
||||
|
||||
/* Skip empty lines. */
|
||||
if (/^[ \n\t]*$/.test (line))
|
||||
continue;
|
||||
|
||||
if (!/^[ \n\t]*([^ \n\t]+)[ \n\t]*(.*)[ \n\t]*$/.exec (line))
|
||||
{
|
||||
System.stderr.writeln (name + ":" + linenum.toString ()
|
||||
+ ": syntax error");
|
||||
System.exit (1);
|
||||
}
|
||||
var operand = RegExp.$1;
|
||||
var argument = RegExp.$2;
|
||||
|
||||
/* Check that this is a known operand. */
|
||||
if (typeof argument_sizes[operand] == "undefined")
|
||||
{
|
||||
System.stderr.writeln (name + ":" + linenum.toString ()
|
||||
+ ": unknown operand `" + operand
|
||||
+ "'");
|
||||
System.exit (1);
|
||||
}
|
||||
|
||||
if ((operand_flags[operand] & 0x02) != 0)
|
||||
{
|
||||
/* The branch operands. */
|
||||
if (argument.length == 0)
|
||||
{
|
||||
System.stderr.writeln (name + ":" + linenum.toString ()
|
||||
+ ": branch operand requires a "
|
||||
+ " label argument");
|
||||
System.exit (1);
|
||||
}
|
||||
if (!label_waits[argument])
|
||||
label_waits[argument] = new Array ();
|
||||
|
||||
op = give_operand (operand, linenum);
|
||||
label_waits[argument].push (op);
|
||||
op.link ();
|
||||
}
|
||||
else if ((operand_flags[operand] & 0x01) != 0)
|
||||
{
|
||||
/* The symbol operands. */
|
||||
if (!/^[A-Za-z_$][A-Za-z_$0-9]*$/.test (argument))
|
||||
{
|
||||
System.stderr.writeln (name + ":" + linenum.toString ()
|
||||
+ ": operand `" + operand
|
||||
+ "' requires a symbol argument");
|
||||
System.exit (1);
|
||||
}
|
||||
op = give_operand (operand, linenum);
|
||||
op.link ();
|
||||
op.value = argument;
|
||||
}
|
||||
else if (operand == "const")
|
||||
{
|
||||
var value;
|
||||
|
||||
if (/^\"(.*)\"$/.test (argument))
|
||||
value = const_string (RegExp.$1);
|
||||
else if (/^[0-9]+$/.test (argument))
|
||||
value = parseInt(argument);
|
||||
else
|
||||
{
|
||||
System.stderr.writeln (name + ":" + linenum.toString ()
|
||||
+ ": malformed argument `"
|
||||
+ argument + "' for operand `"
|
||||
+ operand + "'");
|
||||
System.exit (1);
|
||||
}
|
||||
|
||||
op = give_operand (operand, linenum);
|
||||
op.link ();
|
||||
op.value = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (argument_sizes[operand] == 0)
|
||||
{
|
||||
/* Simple operands without arugments. */
|
||||
if (argument.length != 0)
|
||||
{
|
||||
System.stderr.writeln (name + ":" + linenum.toString ()
|
||||
+ ": operand `" + operand
|
||||
+ "' doesn't take argument");
|
||||
System.exit (1);
|
||||
}
|
||||
give_operand (operand, linenum).link ();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Simple operands with integer arguments. */
|
||||
if (!/^[-+]?[0-9]+$/.test (argument))
|
||||
{
|
||||
System.stderr.writeln (name + ":" + linenum.toString ()
|
||||
+ ": operand `" + operand
|
||||
+ "' requires an integer "
|
||||
+ "argument");
|
||||
System.exit (1);
|
||||
}
|
||||
op = give_operand (operand, linenum);
|
||||
op.link ();
|
||||
op.value = parseInt (argument);
|
||||
}
|
||||
}
|
||||
}
|
||||
fp.close ();
|
||||
|
||||
/* Patch labels to branch operands. */
|
||||
for (var label in label_waits)
|
||||
for (op in label_waits[label])
|
||||
{
|
||||
if (!labels[label])
|
||||
{
|
||||
System.stderr.writeln (name + ":" + op.linenum.toString ()
|
||||
+ ": undefined label `" + label + "'");
|
||||
System.exit (1);
|
||||
}
|
||||
op.value = labels[label];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.stderr.writeln (program + ": couldn't open input file `"
|
||||
+ name + "': " + System.strerror (System.errno));
|
||||
System.exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function const_string (source)
|
||||
{
|
||||
var str = new String ("");
|
||||
var i;
|
||||
|
||||
for (i = 0; i < source.length; i++)
|
||||
{
|
||||
switch (source[i])
|
||||
{
|
||||
case #'\\':
|
||||
if (i + 1 > source.length)
|
||||
str.append ("\\");
|
||||
else
|
||||
{
|
||||
i++;
|
||||
var ch;
|
||||
|
||||
switch (source[i])
|
||||
{
|
||||
case #'n':
|
||||
ch = "\n";
|
||||
break;
|
||||
|
||||
case #'t':
|
||||
ch = "\t";
|
||||
break;
|
||||
|
||||
case #'v':
|
||||
ch = "\v";
|
||||
break;
|
||||
|
||||
case #'b':
|
||||
ch = "\b";
|
||||
break;
|
||||
|
||||
case #'r':
|
||||
ch = "\r";
|
||||
break;
|
||||
|
||||
case #'f':
|
||||
ch = "\f";
|
||||
break;
|
||||
|
||||
case #'a':
|
||||
ch = "\a";
|
||||
break;
|
||||
|
||||
case #'\\':
|
||||
ch = "\\";
|
||||
break;
|
||||
|
||||
case #'?':
|
||||
ch = "?";
|
||||
break;
|
||||
|
||||
case #'\'':
|
||||
ch = "'";
|
||||
break;
|
||||
|
||||
case #'"':
|
||||
ch = "\"";
|
||||
break;
|
||||
|
||||
default:
|
||||
ch = File.byteToString (source[i]);
|
||||
break;
|
||||
}
|
||||
|
||||
str.append (ch);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
str.append (File.byteToString (source[i]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
mode: c
|
||||
End:
|
||||
*/
|
||||
/* -*- c -*-
|
||||
* Operand definitions for the JavaScript byte-code.
|
||||
*
|
||||
* This file is automatically create from the operands.def file.
|
||||
* Editing is strongly discouraged. You should edit the file
|
||||
* `extract-operands.js' instead.
|
||||
*/
|
||||
|
||||
argument_sizes = new Object ();
|
||||
operand_flags = new Object ();
|
||||
|
||||
function give_operand (name, ln)
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case "halt":
|
||||
return new JSC$ASM_halt (ln);
|
||||
break;
|
||||
|
||||
case "done":
|
||||
return new JSC$ASM_done (ln);
|
||||
break;
|
||||
|
||||
case "nop":
|
||||
return new JSC$ASM_nop (ln);
|
||||
break;
|
||||
|
||||
case "dup":
|
||||
return new JSC$ASM_dup (ln);
|
||||
break;
|
||||
|
||||
case "pop":
|
||||
return new JSC$ASM_pop (ln);
|
||||
break;
|
||||
|
||||
case "pop_n":
|
||||
return new JSC$ASM_pop_n (ln);
|
||||
break;
|
||||
|
||||
case "apop":
|
||||
return new JSC$ASM_apop (ln);
|
||||
break;
|
||||
|
||||
case "swap":
|
||||
return new JSC$ASM_swap (ln);
|
||||
break;
|
||||
|
||||
case "roll":
|
||||
return new JSC$ASM_roll (ln);
|
||||
break;
|
||||
|
||||
case "const":
|
||||
return new JSC$ASM_const (ln);
|
||||
break;
|
||||
|
||||
case "const_null":
|
||||
return new JSC$ASM_const_null (ln);
|
||||
break;
|
||||
|
||||
case "const_true":
|
||||
return new JSC$ASM_const_true (ln);
|
||||
break;
|
||||
|
||||
case "const_false":
|
||||
return new JSC$ASM_const_false (ln);
|
||||
break;
|
||||
|
||||
case "const_undefined":
|
||||
return new JSC$ASM_const_undefined (ln);
|
||||
break;
|
||||
|
||||
case "const_i0":
|
||||
return new JSC$ASM_const_i0 (ln);
|
||||
break;
|
||||
|
||||
case "const_i1":
|
||||
return new JSC$ASM_const_i1 (ln);
|
||||
break;
|
||||
|
||||
case "const_i2":
|
||||
return new JSC$ASM_const_i2 (ln);
|
||||
break;
|
||||
|
||||
case "const_i3":
|
||||
return new JSC$ASM_const_i3 (ln);
|
||||
break;
|
||||
|
||||
case "const_i":
|
||||
return new JSC$ASM_const_i (ln);
|
||||
break;
|
||||
|
||||
case "load_global":
|
||||
return new JSC$ASM_load_global (ln);
|
||||
break;
|
||||
|
||||
case "store_global":
|
||||
return new JSC$ASM_store_global (ln);
|
||||
break;
|
||||
|
||||
case "load_arg":
|
||||
return new JSC$ASM_load_arg (ln);
|
||||
break;
|
||||
|
||||
case "store_arg":
|
||||
return new JSC$ASM_store_arg (ln);
|
||||
break;
|
||||
|
||||
case "load_local":
|
||||
return new JSC$ASM_load_local (ln);
|
||||
break;
|
||||
|
||||
case "store_local":
|
||||
return new JSC$ASM_store_local (ln);
|
||||
break;
|
||||
|
||||
case "load_property":
|
||||
return new JSC$ASM_load_property (ln);
|
||||
break;
|
||||
|
||||
case "store_property":
|
||||
return new JSC$ASM_store_property (ln);
|
||||
break;
|
||||
|
||||
case "load_array":
|
||||
return new JSC$ASM_load_array (ln);
|
||||
break;
|
||||
|
||||
case "store_array":
|
||||
return new JSC$ASM_store_array (ln);
|
||||
break;
|
||||
|
||||
case "nth":
|
||||
return new JSC$ASM_nth (ln);
|
||||
break;
|
||||
|
||||
case "cmp_eq":
|
||||
return new JSC$ASM_cmp_eq (ln);
|
||||
break;
|
||||
|
||||
case "cmp_ne":
|
||||
return new JSC$ASM_cmp_ne (ln);
|
||||
break;
|
||||
|
||||
case "cmp_lt":
|
||||
return new JSC$ASM_cmp_lt (ln);
|
||||
break;
|
||||
|
||||
case "cmp_gt":
|
||||
return new JSC$ASM_cmp_gt (ln);
|
||||
break;
|
||||
|
||||
case "cmp_le":
|
||||
return new JSC$ASM_cmp_le (ln);
|
||||
break;
|
||||
|
||||
case "cmp_ge":
|
||||
return new JSC$ASM_cmp_ge (ln);
|
||||
break;
|
||||
|
||||
case "cmp_seq":
|
||||
return new JSC$ASM_cmp_seq (ln);
|
||||
break;
|
||||
|
||||
case "cmp_sne":
|
||||
return new JSC$ASM_cmp_sne (ln);
|
||||
break;
|
||||
|
||||
case "sub":
|
||||
return new JSC$ASM_sub (ln);
|
||||
break;
|
||||
|
||||
case "add":
|
||||
return new JSC$ASM_add (ln);
|
||||
break;
|
||||
|
||||
case "mul":
|
||||
return new JSC$ASM_mul (ln);
|
||||
break;
|
||||
|
||||
case "div":
|
||||
return new JSC$ASM_div (ln);
|
||||
break;
|
||||
|
||||
case "mod":
|
||||
return new JSC$ASM_mod (ln);
|
||||
break;
|
||||
|
||||
case "neg":
|
||||
return new JSC$ASM_neg (ln);
|
||||
break;
|
||||
|
||||
case "and":
|
||||
return new JSC$ASM_and (ln);
|
||||
break;
|
||||
|
||||
case "not":
|
||||
return new JSC$ASM_not (ln);
|
||||
break;
|
||||
|
||||
case "or":
|
||||
return new JSC$ASM_or (ln);
|
||||
break;
|
||||
|
||||
case "xor":
|
||||
return new JSC$ASM_xor (ln);
|
||||
break;
|
||||
|
||||
case "shift_left":
|
||||
return new JSC$ASM_shift_left (ln);
|
||||
break;
|
||||
|
||||
case "shift_right":
|
||||
return new JSC$ASM_shift_right (ln);
|
||||
break;
|
||||
|
||||
case "shift_rright":
|
||||
return new JSC$ASM_shift_rright (ln);
|
||||
break;
|
||||
|
||||
case "iffalse":
|
||||
return new JSC$ASM_iffalse (ln);
|
||||
break;
|
||||
|
||||
case "iftrue":
|
||||
return new JSC$ASM_iftrue (ln);
|
||||
break;
|
||||
|
||||
case "call_method":
|
||||
return new JSC$ASM_call_method (ln);
|
||||
break;
|
||||
|
||||
case "jmp":
|
||||
return new JSC$ASM_jmp (ln);
|
||||
break;
|
||||
|
||||
case "jsr":
|
||||
return new JSC$ASM_jsr (ln);
|
||||
break;
|
||||
|
||||
case "return":
|
||||
return new JSC$ASM_return (ln);
|
||||
break;
|
||||
|
||||
case "typeof":
|
||||
return new JSC$ASM_typeof (ln);
|
||||
break;
|
||||
|
||||
case "new":
|
||||
return new JSC$ASM_new (ln);
|
||||
break;
|
||||
|
||||
case "delete_property":
|
||||
return new JSC$ASM_delete_property (ln);
|
||||
break;
|
||||
|
||||
case "delete_array":
|
||||
return new JSC$ASM_delete_array (ln);
|
||||
break;
|
||||
|
||||
case "locals":
|
||||
return new JSC$ASM_locals (ln);
|
||||
break;
|
||||
|
||||
case "min_args":
|
||||
return new JSC$ASM_min_args (ln);
|
||||
break;
|
||||
|
||||
case "load_nth_arg":
|
||||
return new JSC$ASM_load_nth_arg (ln);
|
||||
break;
|
||||
|
||||
case "with_push":
|
||||
return new JSC$ASM_with_push (ln);
|
||||
break;
|
||||
|
||||
case "with_pop":
|
||||
return new JSC$ASM_with_pop (ln);
|
||||
break;
|
||||
|
||||
case "try_push":
|
||||
return new JSC$ASM_try_push (ln);
|
||||
break;
|
||||
|
||||
case "try_pop":
|
||||
return new JSC$ASM_try_pop (ln);
|
||||
break;
|
||||
|
||||
case "throw":
|
||||
return new JSC$ASM_throw (ln);
|
||||
break;
|
||||
|
||||
case "iffalse_b":
|
||||
return new JSC$ASM_iffalse_b (ln);
|
||||
break;
|
||||
|
||||
case "iftrue_b":
|
||||
return new JSC$ASM_iftrue_b (ln);
|
||||
break;
|
||||
|
||||
case "add_1_i":
|
||||
return new JSC$ASM_add_1_i (ln);
|
||||
break;
|
||||
|
||||
case "add_2_i":
|
||||
return new JSC$ASM_add_2_i (ln);
|
||||
break;
|
||||
|
||||
case "load_global_w":
|
||||
return new JSC$ASM_load_global_w (ln);
|
||||
break;
|
||||
|
||||
case "jsr_w":
|
||||
return new JSC$ASM_jsr_w (ln);
|
||||
break;
|
||||
|
||||
default:
|
||||
System.stderr.writeln (program + ":" + ln.toString ()
|
||||
+ ": unknown operand `" + name + "'");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
argument_sizes["halt"] = 0;
|
||||
operand_flags["halt"] = 0x0;
|
||||
argument_sizes["done"] = 0;
|
||||
operand_flags["done"] = 0x0;
|
||||
argument_sizes["nop"] = 0;
|
||||
operand_flags["nop"] = 0x0;
|
||||
argument_sizes["dup"] = 0;
|
||||
operand_flags["dup"] = 0x0;
|
||||
argument_sizes["pop"] = 0;
|
||||
operand_flags["pop"] = 0x0;
|
||||
argument_sizes["pop_n"] = 1;
|
||||
operand_flags["pop_n"] = 0x0;
|
||||
argument_sizes["apop"] = 1;
|
||||
operand_flags["apop"] = 0x0;
|
||||
argument_sizes["swap"] = 0;
|
||||
operand_flags["swap"] = 0x0;
|
||||
argument_sizes["roll"] = 1;
|
||||
operand_flags["roll"] = 0x0;
|
||||
argument_sizes["const"] = 4;
|
||||
operand_flags["const"] = 0x0;
|
||||
argument_sizes["const_null"] = 0;
|
||||
operand_flags["const_null"] = 0x0;
|
||||
argument_sizes["const_true"] = 0;
|
||||
operand_flags["const_true"] = 0x0;
|
||||
argument_sizes["const_false"] = 0;
|
||||
operand_flags["const_false"] = 0x0;
|
||||
argument_sizes["const_undefined"] = 0;
|
||||
operand_flags["const_undefined"] = 0x0;
|
||||
argument_sizes["const_i0"] = 0;
|
||||
operand_flags["const_i0"] = 0x0;
|
||||
argument_sizes["const_i1"] = 0;
|
||||
operand_flags["const_i1"] = 0x0;
|
||||
argument_sizes["const_i2"] = 0;
|
||||
operand_flags["const_i2"] = 0x0;
|
||||
argument_sizes["const_i3"] = 0;
|
||||
operand_flags["const_i3"] = 0x0;
|
||||
argument_sizes["const_i"] = 4;
|
||||
operand_flags["const_i"] = 0x0;
|
||||
argument_sizes["load_global"] = 4;
|
||||
operand_flags["load_global"] = 0x1;
|
||||
argument_sizes["store_global"] = 4;
|
||||
operand_flags["store_global"] = 0x1;
|
||||
argument_sizes["load_arg"] = 1;
|
||||
operand_flags["load_arg"] = 0x0;
|
||||
argument_sizes["store_arg"] = 1;
|
||||
operand_flags["store_arg"] = 0x0;
|
||||
argument_sizes["load_local"] = 2;
|
||||
operand_flags["load_local"] = 0x0;
|
||||
argument_sizes["store_local"] = 2;
|
||||
operand_flags["store_local"] = 0x0;
|
||||
argument_sizes["load_property"] = 4;
|
||||
operand_flags["load_property"] = 0x1;
|
||||
argument_sizes["store_property"] = 4;
|
||||
operand_flags["store_property"] = 0x1;
|
||||
argument_sizes["load_array"] = 0;
|
||||
operand_flags["load_array"] = 0x0;
|
||||
argument_sizes["store_array"] = 0;
|
||||
operand_flags["store_array"] = 0x0;
|
||||
argument_sizes["nth"] = 0;
|
||||
operand_flags["nth"] = 0x0;
|
||||
argument_sizes["cmp_eq"] = 0;
|
||||
operand_flags["cmp_eq"] = 0x0;
|
||||
argument_sizes["cmp_ne"] = 0;
|
||||
operand_flags["cmp_ne"] = 0x0;
|
||||
argument_sizes["cmp_lt"] = 0;
|
||||
operand_flags["cmp_lt"] = 0x0;
|
||||
argument_sizes["cmp_gt"] = 0;
|
||||
operand_flags["cmp_gt"] = 0x0;
|
||||
argument_sizes["cmp_le"] = 0;
|
||||
operand_flags["cmp_le"] = 0x0;
|
||||
argument_sizes["cmp_ge"] = 0;
|
||||
operand_flags["cmp_ge"] = 0x0;
|
||||
argument_sizes["cmp_seq"] = 0;
|
||||
operand_flags["cmp_seq"] = 0x0;
|
||||
argument_sizes["cmp_sne"] = 0;
|
||||
operand_flags["cmp_sne"] = 0x0;
|
||||
argument_sizes["sub"] = 0;
|
||||
operand_flags["sub"] = 0x0;
|
||||
argument_sizes["add"] = 0;
|
||||
operand_flags["add"] = 0x0;
|
||||
argument_sizes["mul"] = 0;
|
||||
operand_flags["mul"] = 0x0;
|
||||
argument_sizes["div"] = 0;
|
||||
operand_flags["div"] = 0x0;
|
||||
argument_sizes["mod"] = 0;
|
||||
operand_flags["mod"] = 0x0;
|
||||
argument_sizes["neg"] = 0;
|
||||
operand_flags["neg"] = 0x0;
|
||||
argument_sizes["and"] = 0;
|
||||
operand_flags["and"] = 0x0;
|
||||
argument_sizes["not"] = 0;
|
||||
operand_flags["not"] = 0x0;
|
||||
argument_sizes["or"] = 0;
|
||||
operand_flags["or"] = 0x0;
|
||||
argument_sizes["xor"] = 0;
|
||||
operand_flags["xor"] = 0x0;
|
||||
argument_sizes["shift_left"] = 0;
|
||||
operand_flags["shift_left"] = 0x0;
|
||||
argument_sizes["shift_right"] = 0;
|
||||
operand_flags["shift_right"] = 0x0;
|
||||
argument_sizes["shift_rright"] = 0;
|
||||
operand_flags["shift_rright"] = 0x0;
|
||||
argument_sizes["iffalse"] = 4;
|
||||
operand_flags["iffalse"] = 0x2;
|
||||
argument_sizes["iftrue"] = 4;
|
||||
operand_flags["iftrue"] = 0x2;
|
||||
argument_sizes["call_method"] = 4;
|
||||
operand_flags["call_method"] = 0x1;
|
||||
argument_sizes["jmp"] = 4;
|
||||
operand_flags["jmp"] = 0x2;
|
||||
argument_sizes["jsr"] = 0;
|
||||
operand_flags["jsr"] = 0x0;
|
||||
argument_sizes["return"] = 0;
|
||||
operand_flags["return"] = 0x0;
|
||||
argument_sizes["typeof"] = 0;
|
||||
operand_flags["typeof"] = 0x0;
|
||||
argument_sizes["new"] = 0;
|
||||
operand_flags["new"] = 0x0;
|
||||
argument_sizes["delete_property"] = 4;
|
||||
operand_flags["delete_property"] = 0x1;
|
||||
argument_sizes["delete_array"] = 0;
|
||||
operand_flags["delete_array"] = 0x0;
|
||||
argument_sizes["locals"] = 2;
|
||||
operand_flags["locals"] = 0x0;
|
||||
argument_sizes["min_args"] = 1;
|
||||
operand_flags["min_args"] = 0x0;
|
||||
argument_sizes["load_nth_arg"] = 0;
|
||||
operand_flags["load_nth_arg"] = 0x0;
|
||||
argument_sizes["with_push"] = 0;
|
||||
operand_flags["with_push"] = 0x0;
|
||||
argument_sizes["with_pop"] = 1;
|
||||
operand_flags["with_pop"] = 0x0;
|
||||
argument_sizes["try_push"] = 4;
|
||||
operand_flags["try_push"] = 0x2;
|
||||
argument_sizes["try_pop"] = 1;
|
||||
operand_flags["try_pop"] = 0x0;
|
||||
argument_sizes["throw"] = 0;
|
||||
operand_flags["throw"] = 0x0;
|
||||
argument_sizes["iffalse_b"] = 4;
|
||||
operand_flags["iffalse_b"] = 0x2;
|
||||
argument_sizes["iftrue_b"] = 4;
|
||||
operand_flags["iftrue_b"] = 0x2;
|
||||
argument_sizes["add_1_i"] = 0;
|
||||
operand_flags["add_1_i"] = 0x0;
|
||||
argument_sizes["add_2_i"] = 0;
|
||||
operand_flags["add_2_i"] = 0x0;
|
||||
argument_sizes["load_global_w"] = 4;
|
||||
operand_flags["load_global_w"] = 0x1;
|
||||
argument_sizes["jsr_w"] = 4;
|
||||
operand_flags["jsr_w"] = 0x1;
|
||||
/*
|
||||
* Assembler for JavaScript assembler.
|
||||
* Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
*
|
||||
* Author: Markku Rossi <mtr@ngs.fi>
|
||||
*/
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
* MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Source: /cygdrive/c/RCVS/CVS/ReactOS/reactos/lib/kjs/jsas/jsas.js,v $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Variables and definitions.
|
||||
*/
|
||||
|
||||
version_number = "0.0.1";
|
||||
|
||||
/*
|
||||
* Options.
|
||||
*/
|
||||
|
||||
/*
|
||||
* -g, --debug
|
||||
*
|
||||
* Generate debugging information.
|
||||
*/
|
||||
|
||||
opt_debug = false;
|
||||
|
||||
/*
|
||||
* -h, --help
|
||||
*
|
||||
* Print short help and exit successfully.
|
||||
*/
|
||||
|
||||
/*
|
||||
* -O, --optimize
|
||||
*
|
||||
* Optimize the assembler.
|
||||
*/
|
||||
|
||||
opt_optimize = false;
|
||||
|
||||
/*
|
||||
* -v, --verbose
|
||||
*
|
||||
* Tell what we are doing.
|
||||
*/
|
||||
|
||||
opt_verbose = false;
|
||||
|
||||
/*
|
||||
* -V, --version
|
||||
*
|
||||
* Print version information and exit successfully.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Functions.
|
||||
*/
|
||||
|
||||
function main ()
|
||||
{
|
||||
var idx = ARGS[0].lastIndexOf ("/");
|
||||
if (idx >= 0)
|
||||
program = ARGS[0].substr (idx + 1);
|
||||
else
|
||||
program = ARGS[0];
|
||||
|
||||
/* Handle arguments. */
|
||||
var i;
|
||||
for (i = 1; i < ARGS.length; i++)
|
||||
{
|
||||
if (ARGS[i][0] == #'-')
|
||||
{
|
||||
if (ARGS[i] == "-g" || ARGS[i] == "--debug")
|
||||
opt_debug = true;
|
||||
else if (ARGS[i] == "-h" || ARGS[i] == "--help")
|
||||
{
|
||||
usage ();
|
||||
System.exit (1);
|
||||
}
|
||||
else if (ARGS[i] == "-O" || ARGS[i] == "--optimize")
|
||||
opt_optimize = true;
|
||||
else if (ARGS[i] == "-v" || ARGS[i] == "--verbose")
|
||||
opt_verbose = true;
|
||||
else if (ARGS[i] == "-V" || ARGS[i] == "--version")
|
||||
{
|
||||
version ();
|
||||
System.exit (0);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Unrecognized option. */
|
||||
System.error (program, ": unrecognized option `",
|
||||
ARGS[i], "'\n");
|
||||
System.error ("Try `", program,
|
||||
" --help' for more information.\n");
|
||||
System.exit (1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* End of arguments. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i >= ARGS.length)
|
||||
{
|
||||
System.error (program, ": no files specified\n");
|
||||
System.exit (1);
|
||||
}
|
||||
|
||||
/* Options. */
|
||||
|
||||
JSC$verbose = opt_verbose;
|
||||
JSC$generate_debug_info = opt_debug;
|
||||
|
||||
/* Process files. */
|
||||
for (; i < ARGS.length; i++)
|
||||
{
|
||||
/* Reset the JSC's assembler package. */
|
||||
JSC$asm_reset ();
|
||||
|
||||
/* Process the input file. */
|
||||
JSC$filename = ARGS[i];
|
||||
process_file (JSC$filename);
|
||||
|
||||
if (opt_optimize)
|
||||
JSC$asm_optimize (JSC$FLAG_OPTIMIZE_MASK);
|
||||
|
||||
JSC$asm_finalize ();
|
||||
|
||||
var result = JSC$asm_bytecode ();
|
||||
|
||||
/* Create the output file name. */
|
||||
var oname = ARGS[i].replace (/\.jas$/, ".jsc");
|
||||
if (oname == ARGS[i])
|
||||
oname += ".jsc";
|
||||
|
||||
var ostream = new File (oname);
|
||||
if (ostream.open ("w"))
|
||||
{
|
||||
ostream.write (result);
|
||||
ostream.close ();
|
||||
}
|
||||
else
|
||||
{
|
||||
System.stderr.writeln ("jsas: couldn't create bc file `"
|
||||
+ oname + "': "
|
||||
+ System.strerror (System.errno));
|
||||
System.exit (1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function usage ()
|
||||
{
|
||||
System.print ("\
|
||||
Usage: ", program, " [OPTION]... FILE...\n\
|
||||
Mandatory arguments to long options are mandatory for short options too.\n");
|
||||
|
||||
System.print ("\
|
||||
-g, --debug generate debugging information\n\
|
||||
-h, --help print this help and exit\n\
|
||||
-O, --optimize optimize the assembler code\n\
|
||||
-v, --verbose tell what the assembler is doing\n\
|
||||
-V, --version print version number\n\
|
||||
");
|
||||
|
||||
System.print ("\nReport bugs to [email protected].\n");
|
||||
}
|
||||
|
||||
function version ()
|
||||
{
|
||||
System.print ("NGS JavaScript assembler ", version_number, "\n");
|
||||
System.print ("\
|
||||
Copyright (C) 1998 New Generation Software (NGS) Oy.\n\
|
||||
NGS JavaScript Interpreter comes with NO WARRANTY, to the extent\n\
|
||||
permitted by law. You may redistribute copies of NGS JavaScript\n\
|
||||
Interpreter under the terms of the GNU Library General Public License.\n\
|
||||
For more information about these matters, see the files named COPYING.\n\
|
||||
");
|
||||
}
|
||||
|
||||
main ();
|
||||
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
mode: c
|
||||
End:
|
||||
*/
|
||||
@@ -1,212 +0,0 @@
|
||||
/*
|
||||
* Assembler for JavaScript assembler.
|
||||
* Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
*
|
||||
* Author: Markku Rossi <mtr@ngs.fi>
|
||||
*/
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
* MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Source: /cygdrive/c/RCVS/CVS/ReactOS/reactos/lib/kjs/jsas/main.js,v $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Variables and definitions.
|
||||
*/
|
||||
|
||||
version_number = "0.0.1";
|
||||
|
||||
/*
|
||||
* Options.
|
||||
*/
|
||||
|
||||
/*
|
||||
* -g, --debug
|
||||
*
|
||||
* Generate debugging information.
|
||||
*/
|
||||
|
||||
opt_debug = false;
|
||||
|
||||
/*
|
||||
* -h, --help
|
||||
*
|
||||
* Print short help and exit successfully.
|
||||
*/
|
||||
|
||||
/*
|
||||
* -O, --optimize
|
||||
*
|
||||
* Optimize the assembler.
|
||||
*/
|
||||
|
||||
opt_optimize = false;
|
||||
|
||||
/*
|
||||
* -v, --verbose
|
||||
*
|
||||
* Tell what we are doing.
|
||||
*/
|
||||
|
||||
opt_verbose = false;
|
||||
|
||||
/*
|
||||
* -V, --version
|
||||
*
|
||||
* Print version information and exit successfully.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Functions.
|
||||
*/
|
||||
|
||||
function main ()
|
||||
{
|
||||
var idx = ARGS[0].lastIndexOf ("/");
|
||||
if (idx >= 0)
|
||||
program = ARGS[0].substr (idx + 1);
|
||||
else
|
||||
program = ARGS[0];
|
||||
|
||||
/* Handle arguments. */
|
||||
var i;
|
||||
for (i = 1; i < ARGS.length; i++)
|
||||
{
|
||||
if (ARGS[i][0] == #'-')
|
||||
{
|
||||
if (ARGS[i] == "-g" || ARGS[i] == "--debug")
|
||||
opt_debug = true;
|
||||
else if (ARGS[i] == "-h" || ARGS[i] == "--help")
|
||||
{
|
||||
usage ();
|
||||
System.exit (1);
|
||||
}
|
||||
else if (ARGS[i] == "-O" || ARGS[i] == "--optimize")
|
||||
opt_optimize = true;
|
||||
else if (ARGS[i] == "-v" || ARGS[i] == "--verbose")
|
||||
opt_verbose = true;
|
||||
else if (ARGS[i] == "-V" || ARGS[i] == "--version")
|
||||
{
|
||||
version ();
|
||||
System.exit (0);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Unrecognized option. */
|
||||
System.error (program, ": unrecognized option `",
|
||||
ARGS[i], "'\n");
|
||||
System.error ("Try `", program,
|
||||
" --help' for more information.\n");
|
||||
System.exit (1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* End of arguments. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i >= ARGS.length)
|
||||
{
|
||||
System.error (program, ": no files specified\n");
|
||||
System.exit (1);
|
||||
}
|
||||
|
||||
/* Options. */
|
||||
|
||||
JSC$verbose = opt_verbose;
|
||||
JSC$generate_debug_info = opt_debug;
|
||||
|
||||
/* Process files. */
|
||||
for (; i < ARGS.length; i++)
|
||||
{
|
||||
/* Reset the JSC's assembler package. */
|
||||
JSC$asm_reset ();
|
||||
|
||||
/* Process the input file. */
|
||||
JSC$filename = ARGS[i];
|
||||
process_file (JSC$filename);
|
||||
|
||||
if (opt_optimize)
|
||||
JSC$asm_optimize (JSC$FLAG_OPTIMIZE_MASK);
|
||||
|
||||
JSC$asm_finalize ();
|
||||
|
||||
var result = JSC$asm_bytecode ();
|
||||
|
||||
/* Create the output file name. */
|
||||
var oname = ARGS[i].replace (/\.jas$/, ".jsc");
|
||||
if (oname == ARGS[i])
|
||||
oname += ".jsc";
|
||||
|
||||
var ostream = new File (oname);
|
||||
if (ostream.open ("w"))
|
||||
{
|
||||
ostream.write (result);
|
||||
ostream.close ();
|
||||
}
|
||||
else
|
||||
{
|
||||
System.stderr.writeln ("jsas: couldn't create bc file `"
|
||||
+ oname + "': "
|
||||
+ System.strerror (System.errno));
|
||||
System.exit (1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function usage ()
|
||||
{
|
||||
System.print ("\
|
||||
Usage: ", program, " [OPTION]... FILE...\n\
|
||||
Mandatory arguments to long options are mandatory for short options too.\n");
|
||||
|
||||
System.print ("\
|
||||
-g, --debug generate debugging information\n\
|
||||
-h, --help print this help and exit\n\
|
||||
-O, --optimize optimize the assembler code\n\
|
||||
-v, --verbose tell what the assembler is doing\n\
|
||||
-V, --version print version number\n\
|
||||
");
|
||||
|
||||
System.print ("\nReport bugs to [email protected].\n");
|
||||
}
|
||||
|
||||
function version ()
|
||||
{
|
||||
System.print ("NGS JavaScript assembler ", version_number, "\n");
|
||||
System.print ("\
|
||||
Copyright (C) 1998 New Generation Software (NGS) Oy.\n\
|
||||
NGS JavaScript Interpreter comes with NO WARRANTY, to the extent\n\
|
||||
permitted by law. You may redistribute copies of NGS JavaScript\n\
|
||||
Interpreter under the terms of the GNU Library General Public License.\n\
|
||||
For more information about these matters, see the files named COPYING.\n\
|
||||
");
|
||||
}
|
||||
|
||||
main ();
|
||||
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
mode: c
|
||||
End:
|
||||
*/
|
||||
@@ -1,472 +0,0 @@
|
||||
/* -*- c -*-
|
||||
* Operand definitions for the JavaScript byte-code.
|
||||
*
|
||||
* This file is automatically create from the operands.def file.
|
||||
* Editing is strongly discouraged. You should edit the file
|
||||
* `extract-operands.js' instead.
|
||||
*/
|
||||
|
||||
argument_sizes = new Object ();
|
||||
operand_flags = new Object ();
|
||||
|
||||
function give_operand (name, ln)
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
case "halt":
|
||||
return new JSC$ASM_halt (ln);
|
||||
break;
|
||||
|
||||
case "done":
|
||||
return new JSC$ASM_done (ln);
|
||||
break;
|
||||
|
||||
case "nop":
|
||||
return new JSC$ASM_nop (ln);
|
||||
break;
|
||||
|
||||
case "dup":
|
||||
return new JSC$ASM_dup (ln);
|
||||
break;
|
||||
|
||||
case "pop":
|
||||
return new JSC$ASM_pop (ln);
|
||||
break;
|
||||
|
||||
case "pop_n":
|
||||
return new JSC$ASM_pop_n (ln);
|
||||
break;
|
||||
|
||||
case "apop":
|
||||
return new JSC$ASM_apop (ln);
|
||||
break;
|
||||
|
||||
case "swap":
|
||||
return new JSC$ASM_swap (ln);
|
||||
break;
|
||||
|
||||
case "roll":
|
||||
return new JSC$ASM_roll (ln);
|
||||
break;
|
||||
|
||||
case "const":
|
||||
return new JSC$ASM_const (ln);
|
||||
break;
|
||||
|
||||
case "const_null":
|
||||
return new JSC$ASM_const_null (ln);
|
||||
break;
|
||||
|
||||
case "const_true":
|
||||
return new JSC$ASM_const_true (ln);
|
||||
break;
|
||||
|
||||
case "const_false":
|
||||
return new JSC$ASM_const_false (ln);
|
||||
break;
|
||||
|
||||
case "const_undefined":
|
||||
return new JSC$ASM_const_undefined (ln);
|
||||
break;
|
||||
|
||||
case "const_i0":
|
||||
return new JSC$ASM_const_i0 (ln);
|
||||
break;
|
||||
|
||||
case "const_i1":
|
||||
return new JSC$ASM_const_i1 (ln);
|
||||
break;
|
||||
|
||||
case "const_i2":
|
||||
return new JSC$ASM_const_i2 (ln);
|
||||
break;
|
||||
|
||||
case "const_i3":
|
||||
return new JSC$ASM_const_i3 (ln);
|
||||
break;
|
||||
|
||||
case "const_i":
|
||||
return new JSC$ASM_const_i (ln);
|
||||
break;
|
||||
|
||||
case "load_global":
|
||||
return new JSC$ASM_load_global (ln);
|
||||
break;
|
||||
|
||||
case "store_global":
|
||||
return new JSC$ASM_store_global (ln);
|
||||
break;
|
||||
|
||||
case "load_arg":
|
||||
return new JSC$ASM_load_arg (ln);
|
||||
break;
|
||||
|
||||
case "store_arg":
|
||||
return new JSC$ASM_store_arg (ln);
|
||||
break;
|
||||
|
||||
case "load_local":
|
||||
return new JSC$ASM_load_local (ln);
|
||||
break;
|
||||
|
||||
case "store_local":
|
||||
return new JSC$ASM_store_local (ln);
|
||||
break;
|
||||
|
||||
case "load_property":
|
||||
return new JSC$ASM_load_property (ln);
|
||||
break;
|
||||
|
||||
case "store_property":
|
||||
return new JSC$ASM_store_property (ln);
|
||||
break;
|
||||
|
||||
case "load_array":
|
||||
return new JSC$ASM_load_array (ln);
|
||||
break;
|
||||
|
||||
case "store_array":
|
||||
return new JSC$ASM_store_array (ln);
|
||||
break;
|
||||
|
||||
case "nth":
|
||||
return new JSC$ASM_nth (ln);
|
||||
break;
|
||||
|
||||
case "cmp_eq":
|
||||
return new JSC$ASM_cmp_eq (ln);
|
||||
break;
|
||||
|
||||
case "cmp_ne":
|
||||
return new JSC$ASM_cmp_ne (ln);
|
||||
break;
|
||||
|
||||
case "cmp_lt":
|
||||
return new JSC$ASM_cmp_lt (ln);
|
||||
break;
|
||||
|
||||
case "cmp_gt":
|
||||
return new JSC$ASM_cmp_gt (ln);
|
||||
break;
|
||||
|
||||
case "cmp_le":
|
||||
return new JSC$ASM_cmp_le (ln);
|
||||
break;
|
||||
|
||||
case "cmp_ge":
|
||||
return new JSC$ASM_cmp_ge (ln);
|
||||
break;
|
||||
|
||||
case "cmp_seq":
|
||||
return new JSC$ASM_cmp_seq (ln);
|
||||
break;
|
||||
|
||||
case "cmp_sne":
|
||||
return new JSC$ASM_cmp_sne (ln);
|
||||
break;
|
||||
|
||||
case "sub":
|
||||
return new JSC$ASM_sub (ln);
|
||||
break;
|
||||
|
||||
case "add":
|
||||
return new JSC$ASM_add (ln);
|
||||
break;
|
||||
|
||||
case "mul":
|
||||
return new JSC$ASM_mul (ln);
|
||||
break;
|
||||
|
||||
case "div":
|
||||
return new JSC$ASM_div (ln);
|
||||
break;
|
||||
|
||||
case "mod":
|
||||
return new JSC$ASM_mod (ln);
|
||||
break;
|
||||
|
||||
case "neg":
|
||||
return new JSC$ASM_neg (ln);
|
||||
break;
|
||||
|
||||
case "and":
|
||||
return new JSC$ASM_and (ln);
|
||||
break;
|
||||
|
||||
case "not":
|
||||
return new JSC$ASM_not (ln);
|
||||
break;
|
||||
|
||||
case "or":
|
||||
return new JSC$ASM_or (ln);
|
||||
break;
|
||||
|
||||
case "xor":
|
||||
return new JSC$ASM_xor (ln);
|
||||
break;
|
||||
|
||||
case "shift_left":
|
||||
return new JSC$ASM_shift_left (ln);
|
||||
break;
|
||||
|
||||
case "shift_right":
|
||||
return new JSC$ASM_shift_right (ln);
|
||||
break;
|
||||
|
||||
case "shift_rright":
|
||||
return new JSC$ASM_shift_rright (ln);
|
||||
break;
|
||||
|
||||
case "iffalse":
|
||||
return new JSC$ASM_iffalse (ln);
|
||||
break;
|
||||
|
||||
case "iftrue":
|
||||
return new JSC$ASM_iftrue (ln);
|
||||
break;
|
||||
|
||||
case "call_method":
|
||||
return new JSC$ASM_call_method (ln);
|
||||
break;
|
||||
|
||||
case "jmp":
|
||||
return new JSC$ASM_jmp (ln);
|
||||
break;
|
||||
|
||||
case "jsr":
|
||||
return new JSC$ASM_jsr (ln);
|
||||
break;
|
||||
|
||||
case "return":
|
||||
return new JSC$ASM_return (ln);
|
||||
break;
|
||||
|
||||
case "typeof":
|
||||
return new JSC$ASM_typeof (ln);
|
||||
break;
|
||||
|
||||
case "new":
|
||||
return new JSC$ASM_new (ln);
|
||||
break;
|
||||
|
||||
case "delete_property":
|
||||
return new JSC$ASM_delete_property (ln);
|
||||
break;
|
||||
|
||||
case "delete_array":
|
||||
return new JSC$ASM_delete_array (ln);
|
||||
break;
|
||||
|
||||
case "locals":
|
||||
return new JSC$ASM_locals (ln);
|
||||
break;
|
||||
|
||||
case "min_args":
|
||||
return new JSC$ASM_min_args (ln);
|
||||
break;
|
||||
|
||||
case "load_nth_arg":
|
||||
return new JSC$ASM_load_nth_arg (ln);
|
||||
break;
|
||||
|
||||
case "with_push":
|
||||
return new JSC$ASM_with_push (ln);
|
||||
break;
|
||||
|
||||
case "with_pop":
|
||||
return new JSC$ASM_with_pop (ln);
|
||||
break;
|
||||
|
||||
case "try_push":
|
||||
return new JSC$ASM_try_push (ln);
|
||||
break;
|
||||
|
||||
case "try_pop":
|
||||
return new JSC$ASM_try_pop (ln);
|
||||
break;
|
||||
|
||||
case "throw":
|
||||
return new JSC$ASM_throw (ln);
|
||||
break;
|
||||
|
||||
case "iffalse_b":
|
||||
return new JSC$ASM_iffalse_b (ln);
|
||||
break;
|
||||
|
||||
case "iftrue_b":
|
||||
return new JSC$ASM_iftrue_b (ln);
|
||||
break;
|
||||
|
||||
case "add_1_i":
|
||||
return new JSC$ASM_add_1_i (ln);
|
||||
break;
|
||||
|
||||
case "add_2_i":
|
||||
return new JSC$ASM_add_2_i (ln);
|
||||
break;
|
||||
|
||||
case "load_global_w":
|
||||
return new JSC$ASM_load_global_w (ln);
|
||||
break;
|
||||
|
||||
case "jsr_w":
|
||||
return new JSC$ASM_jsr_w (ln);
|
||||
break;
|
||||
|
||||
default:
|
||||
System.stderr.writeln (program + ":" + ln.toString ()
|
||||
+ ": unknown operand `" + name + "'");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
argument_sizes["halt"] = 0;
|
||||
operand_flags["halt"] = 0x0;
|
||||
argument_sizes["done"] = 0;
|
||||
operand_flags["done"] = 0x0;
|
||||
argument_sizes["nop"] = 0;
|
||||
operand_flags["nop"] = 0x0;
|
||||
argument_sizes["dup"] = 0;
|
||||
operand_flags["dup"] = 0x0;
|
||||
argument_sizes["pop"] = 0;
|
||||
operand_flags["pop"] = 0x0;
|
||||
argument_sizes["pop_n"] = 1;
|
||||
operand_flags["pop_n"] = 0x0;
|
||||
argument_sizes["apop"] = 1;
|
||||
operand_flags["apop"] = 0x0;
|
||||
argument_sizes["swap"] = 0;
|
||||
operand_flags["swap"] = 0x0;
|
||||
argument_sizes["roll"] = 1;
|
||||
operand_flags["roll"] = 0x0;
|
||||
argument_sizes["const"] = 4;
|
||||
operand_flags["const"] = 0x0;
|
||||
argument_sizes["const_null"] = 0;
|
||||
operand_flags["const_null"] = 0x0;
|
||||
argument_sizes["const_true"] = 0;
|
||||
operand_flags["const_true"] = 0x0;
|
||||
argument_sizes["const_false"] = 0;
|
||||
operand_flags["const_false"] = 0x0;
|
||||
argument_sizes["const_undefined"] = 0;
|
||||
operand_flags["const_undefined"] = 0x0;
|
||||
argument_sizes["const_i0"] = 0;
|
||||
operand_flags["const_i0"] = 0x0;
|
||||
argument_sizes["const_i1"] = 0;
|
||||
operand_flags["const_i1"] = 0x0;
|
||||
argument_sizes["const_i2"] = 0;
|
||||
operand_flags["const_i2"] = 0x0;
|
||||
argument_sizes["const_i3"] = 0;
|
||||
operand_flags["const_i3"] = 0x0;
|
||||
argument_sizes["const_i"] = 4;
|
||||
operand_flags["const_i"] = 0x0;
|
||||
argument_sizes["load_global"] = 4;
|
||||
operand_flags["load_global"] = 0x1;
|
||||
argument_sizes["store_global"] = 4;
|
||||
operand_flags["store_global"] = 0x1;
|
||||
argument_sizes["load_arg"] = 1;
|
||||
operand_flags["load_arg"] = 0x0;
|
||||
argument_sizes["store_arg"] = 1;
|
||||
operand_flags["store_arg"] = 0x0;
|
||||
argument_sizes["load_local"] = 2;
|
||||
operand_flags["load_local"] = 0x0;
|
||||
argument_sizes["store_local"] = 2;
|
||||
operand_flags["store_local"] = 0x0;
|
||||
argument_sizes["load_property"] = 4;
|
||||
operand_flags["load_property"] = 0x1;
|
||||
argument_sizes["store_property"] = 4;
|
||||
operand_flags["store_property"] = 0x1;
|
||||
argument_sizes["load_array"] = 0;
|
||||
operand_flags["load_array"] = 0x0;
|
||||
argument_sizes["store_array"] = 0;
|
||||
operand_flags["store_array"] = 0x0;
|
||||
argument_sizes["nth"] = 0;
|
||||
operand_flags["nth"] = 0x0;
|
||||
argument_sizes["cmp_eq"] = 0;
|
||||
operand_flags["cmp_eq"] = 0x0;
|
||||
argument_sizes["cmp_ne"] = 0;
|
||||
operand_flags["cmp_ne"] = 0x0;
|
||||
argument_sizes["cmp_lt"] = 0;
|
||||
operand_flags["cmp_lt"] = 0x0;
|
||||
argument_sizes["cmp_gt"] = 0;
|
||||
operand_flags["cmp_gt"] = 0x0;
|
||||
argument_sizes["cmp_le"] = 0;
|
||||
operand_flags["cmp_le"] = 0x0;
|
||||
argument_sizes["cmp_ge"] = 0;
|
||||
operand_flags["cmp_ge"] = 0x0;
|
||||
argument_sizes["cmp_seq"] = 0;
|
||||
operand_flags["cmp_seq"] = 0x0;
|
||||
argument_sizes["cmp_sne"] = 0;
|
||||
operand_flags["cmp_sne"] = 0x0;
|
||||
argument_sizes["sub"] = 0;
|
||||
operand_flags["sub"] = 0x0;
|
||||
argument_sizes["add"] = 0;
|
||||
operand_flags["add"] = 0x0;
|
||||
argument_sizes["mul"] = 0;
|
||||
operand_flags["mul"] = 0x0;
|
||||
argument_sizes["div"] = 0;
|
||||
operand_flags["div"] = 0x0;
|
||||
argument_sizes["mod"] = 0;
|
||||
operand_flags["mod"] = 0x0;
|
||||
argument_sizes["neg"] = 0;
|
||||
operand_flags["neg"] = 0x0;
|
||||
argument_sizes["and"] = 0;
|
||||
operand_flags["and"] = 0x0;
|
||||
argument_sizes["not"] = 0;
|
||||
operand_flags["not"] = 0x0;
|
||||
argument_sizes["or"] = 0;
|
||||
operand_flags["or"] = 0x0;
|
||||
argument_sizes["xor"] = 0;
|
||||
operand_flags["xor"] = 0x0;
|
||||
argument_sizes["shift_left"] = 0;
|
||||
operand_flags["shift_left"] = 0x0;
|
||||
argument_sizes["shift_right"] = 0;
|
||||
operand_flags["shift_right"] = 0x0;
|
||||
argument_sizes["shift_rright"] = 0;
|
||||
operand_flags["shift_rright"] = 0x0;
|
||||
argument_sizes["iffalse"] = 4;
|
||||
operand_flags["iffalse"] = 0x2;
|
||||
argument_sizes["iftrue"] = 4;
|
||||
operand_flags["iftrue"] = 0x2;
|
||||
argument_sizes["call_method"] = 4;
|
||||
operand_flags["call_method"] = 0x1;
|
||||
argument_sizes["jmp"] = 4;
|
||||
operand_flags["jmp"] = 0x2;
|
||||
argument_sizes["jsr"] = 0;
|
||||
operand_flags["jsr"] = 0x0;
|
||||
argument_sizes["return"] = 0;
|
||||
operand_flags["return"] = 0x0;
|
||||
argument_sizes["typeof"] = 0;
|
||||
operand_flags["typeof"] = 0x0;
|
||||
argument_sizes["new"] = 0;
|
||||
operand_flags["new"] = 0x0;
|
||||
argument_sizes["delete_property"] = 4;
|
||||
operand_flags["delete_property"] = 0x1;
|
||||
argument_sizes["delete_array"] = 0;
|
||||
operand_flags["delete_array"] = 0x0;
|
||||
argument_sizes["locals"] = 2;
|
||||
operand_flags["locals"] = 0x0;
|
||||
argument_sizes["min_args"] = 1;
|
||||
operand_flags["min_args"] = 0x0;
|
||||
argument_sizes["load_nth_arg"] = 0;
|
||||
operand_flags["load_nth_arg"] = 0x0;
|
||||
argument_sizes["with_push"] = 0;
|
||||
operand_flags["with_push"] = 0x0;
|
||||
argument_sizes["with_pop"] = 1;
|
||||
operand_flags["with_pop"] = 0x0;
|
||||
argument_sizes["try_push"] = 4;
|
||||
operand_flags["try_push"] = 0x2;
|
||||
argument_sizes["try_pop"] = 1;
|
||||
operand_flags["try_pop"] = 0x0;
|
||||
argument_sizes["throw"] = 0;
|
||||
operand_flags["throw"] = 0x0;
|
||||
argument_sizes["iffalse_b"] = 4;
|
||||
operand_flags["iffalse_b"] = 0x2;
|
||||
argument_sizes["iftrue_b"] = 4;
|
||||
operand_flags["iftrue_b"] = 0x2;
|
||||
argument_sizes["add_1_i"] = 0;
|
||||
operand_flags["add_1_i"] = 0x0;
|
||||
argument_sizes["add_2_i"] = 0;
|
||||
operand_flags["add_2_i"] = 0x0;
|
||||
argument_sizes["load_global_w"] = 4;
|
||||
operand_flags["load_global_w"] = 0x1;
|
||||
argument_sizes["jsr_w"] = 4;
|
||||
operand_flags["jsr_w"] = 0x1;
|
||||
@@ -1,296 +0,0 @@
|
||||
/*
|
||||
* Process assembler file.
|
||||
* Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
*
|
||||
* Author: Markku Rossi <mtr@ngs.fi>
|
||||
*/
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
* MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Source: /cygdrive/c/RCVS/CVS/ReactOS/reactos/lib/kjs/jsas/process.js,v $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
function process_file (name)
|
||||
{
|
||||
var fp = new File (name);
|
||||
var labels = new Object ();
|
||||
var label_waits = new Object ();
|
||||
var op;
|
||||
|
||||
if (fp.open ("r"))
|
||||
{
|
||||
var linenum = 0;
|
||||
|
||||
while (!fp.eof ())
|
||||
{
|
||||
var line = fp.readln ();
|
||||
linenum++;
|
||||
|
||||
/* Remove comments. */
|
||||
line = line.replace (/;.*$/, "");
|
||||
|
||||
/* Extract the labels and symbols. */
|
||||
if (/^([^ \t\n]+):(.*)$/.exec (line))
|
||||
{
|
||||
var label = RegExp.$1;
|
||||
line = RegExp.$2;
|
||||
|
||||
if (/^\.[^ ]+$/.test (label) && label != ".global")
|
||||
{
|
||||
/* It is a label. */
|
||||
if (labels[label])
|
||||
{
|
||||
System.stderr.writeln (name + ":" + linenum.toString ()
|
||||
+ ": label `" + label +
|
||||
"' is already defined");
|
||||
System.stderr.writeln (name + ":"
|
||||
+ (labels[label].linenum
|
||||
.toString ())
|
||||
+ ": this is the place of the "
|
||||
+ "previous definition");
|
||||
System.exit (1);
|
||||
}
|
||||
labels[label] = new JSC$ASM_label ();
|
||||
labels[label].linenum = linenum;
|
||||
labels[label].link ();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* It is a symbol. */
|
||||
new JSC$ASM_symbol (linenum, label).link ();
|
||||
}
|
||||
}
|
||||
|
||||
/* Skip empty lines. */
|
||||
if (/^[ \n\t]*$/.test (line))
|
||||
continue;
|
||||
|
||||
if (!/^[ \n\t]*([^ \n\t]+)[ \n\t]*(.*)[ \n\t]*$/.exec (line))
|
||||
{
|
||||
System.stderr.writeln (name + ":" + linenum.toString ()
|
||||
+ ": syntax error");
|
||||
System.exit (1);
|
||||
}
|
||||
var operand = RegExp.$1;
|
||||
var argument = RegExp.$2;
|
||||
|
||||
/* Check that this is a known operand. */
|
||||
if (typeof argument_sizes[operand] == "undefined")
|
||||
{
|
||||
System.stderr.writeln (name + ":" + linenum.toString ()
|
||||
+ ": unknown operand `" + operand
|
||||
+ "'");
|
||||
System.exit (1);
|
||||
}
|
||||
|
||||
if ((operand_flags[operand] & 0x02) != 0)
|
||||
{
|
||||
/* The branch operands. */
|
||||
if (argument.length == 0)
|
||||
{
|
||||
System.stderr.writeln (name + ":" + linenum.toString ()
|
||||
+ ": branch operand requires a "
|
||||
+ " label argument");
|
||||
System.exit (1);
|
||||
}
|
||||
if (!label_waits[argument])
|
||||
label_waits[argument] = new Array ();
|
||||
|
||||
op = give_operand (operand, linenum);
|
||||
label_waits[argument].push (op);
|
||||
op.link ();
|
||||
}
|
||||
else if ((operand_flags[operand] & 0x01) != 0)
|
||||
{
|
||||
/* The symbol operands. */
|
||||
if (!/^[A-Za-z_$][A-Za-z_$0-9]*$/.test (argument))
|
||||
{
|
||||
System.stderr.writeln (name + ":" + linenum.toString ()
|
||||
+ ": operand `" + operand
|
||||
+ "' requires a symbol argument");
|
||||
System.exit (1);
|
||||
}
|
||||
op = give_operand (operand, linenum);
|
||||
op.link ();
|
||||
op.value = argument;
|
||||
}
|
||||
else if (operand == "const")
|
||||
{
|
||||
var value;
|
||||
|
||||
if (/^\"(.*)\"$/.test (argument))
|
||||
value = const_string (RegExp.$1);
|
||||
else if (/^[0-9]+$/.test (argument))
|
||||
value = parseInt(argument);
|
||||
else
|
||||
{
|
||||
System.stderr.writeln (name + ":" + linenum.toString ()
|
||||
+ ": malformed argument `"
|
||||
+ argument + "' for operand `"
|
||||
+ operand + "'");
|
||||
System.exit (1);
|
||||
}
|
||||
|
||||
op = give_operand (operand, linenum);
|
||||
op.link ();
|
||||
op.value = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (argument_sizes[operand] == 0)
|
||||
{
|
||||
/* Simple operands without arugments. */
|
||||
if (argument.length != 0)
|
||||
{
|
||||
System.stderr.writeln (name + ":" + linenum.toString ()
|
||||
+ ": operand `" + operand
|
||||
+ "' doesn't take argument");
|
||||
System.exit (1);
|
||||
}
|
||||
give_operand (operand, linenum).link ();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Simple operands with integer arguments. */
|
||||
if (!/^[-+]?[0-9]+$/.test (argument))
|
||||
{
|
||||
System.stderr.writeln (name + ":" + linenum.toString ()
|
||||
+ ": operand `" + operand
|
||||
+ "' requires an integer "
|
||||
+ "argument");
|
||||
System.exit (1);
|
||||
}
|
||||
op = give_operand (operand, linenum);
|
||||
op.link ();
|
||||
op.value = parseInt (argument);
|
||||
}
|
||||
}
|
||||
}
|
||||
fp.close ();
|
||||
|
||||
/* Patch labels to branch operands. */
|
||||
for (var label in label_waits)
|
||||
for (op in label_waits[label])
|
||||
{
|
||||
if (!labels[label])
|
||||
{
|
||||
System.stderr.writeln (name + ":" + op.linenum.toString ()
|
||||
+ ": undefined label `" + label + "'");
|
||||
System.exit (1);
|
||||
}
|
||||
op.value = labels[label];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.stderr.writeln (program + ": couldn't open input file `"
|
||||
+ name + "': " + System.strerror (System.errno));
|
||||
System.exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function const_string (source)
|
||||
{
|
||||
var str = new String ("");
|
||||
var i;
|
||||
|
||||
for (i = 0; i < source.length; i++)
|
||||
{
|
||||
switch (source[i])
|
||||
{
|
||||
case #'\\':
|
||||
if (i + 1 > source.length)
|
||||
str.append ("\\");
|
||||
else
|
||||
{
|
||||
i++;
|
||||
var ch;
|
||||
|
||||
switch (source[i])
|
||||
{
|
||||
case #'n':
|
||||
ch = "\n";
|
||||
break;
|
||||
|
||||
case #'t':
|
||||
ch = "\t";
|
||||
break;
|
||||
|
||||
case #'v':
|
||||
ch = "\v";
|
||||
break;
|
||||
|
||||
case #'b':
|
||||
ch = "\b";
|
||||
break;
|
||||
|
||||
case #'r':
|
||||
ch = "\r";
|
||||
break;
|
||||
|
||||
case #'f':
|
||||
ch = "\f";
|
||||
break;
|
||||
|
||||
case #'a':
|
||||
ch = "\a";
|
||||
break;
|
||||
|
||||
case #'\\':
|
||||
ch = "\\";
|
||||
break;
|
||||
|
||||
case #'?':
|
||||
ch = "?";
|
||||
break;
|
||||
|
||||
case #'\'':
|
||||
ch = "'";
|
||||
break;
|
||||
|
||||
case #'"':
|
||||
ch = "\"";
|
||||
break;
|
||||
|
||||
default:
|
||||
ch = File.byteToString (source[i]);
|
||||
break;
|
||||
}
|
||||
|
||||
str.append (ch);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
str.append (File.byteToString (source[i]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
mode: c
|
||||
End:
|
||||
*/
|
||||
@@ -1,652 +0,0 @@
|
||||
1999-01-11 Markku Rossi <[email protected]>
|
||||
|
||||
* lexer.js (JSC$lexer_read_string): Optimized the stream reading
|
||||
by using the new String.append(INTEGER) method.
|
||||
|
||||
1998-10-26 Markku Rossi <[email protected]>
|
||||
|
||||
* parser.js (JSC$parser_parse_stmt): Implemented function
|
||||
declarations as statements.
|
||||
|
||||
* gram.js (JSC$stmt_function_declaration): New statement for
|
||||
nested function declarations.
|
||||
|
||||
* defs.js: New statement type JSC$STMT_FUNCTION_DECLARATION.
|
||||
|
||||
* gram.js (JSC$expr_call_asm): Added support for function
|
||||
pointers.
|
||||
|
||||
* asm.js: Added support for function pointers.
|
||||
Added new operands `jsr_w' and `load_global_w' which operate with
|
||||
the with chains.
|
||||
|
||||
1998-10-12 Markku Rossi <[email protected]>
|
||||
|
||||
* gram.js (JSC$expr_additive_constant_folding): Implemented simple
|
||||
constant folding optimization.
|
||||
|
||||
* parser.js (JSC$parser_parse_assignment_expr): Implemented
|
||||
constant folding optimization.
|
||||
|
||||
* entry.js (JSC$compile_stream): Added a try-finally block over
|
||||
the stream compilation. This assures that the stream is always
|
||||
closed, even if the compilation fails.
|
||||
|
||||
1998-10-01 Markku Rossi <[email protected]>
|
||||
|
||||
* parser.js (JSC$parser_parse_function_declaration): Fixed the
|
||||
parameter list parsing. Now we do require that the parameters are
|
||||
separated by a ','.
|
||||
|
||||
1998-09-17 Markku Rossi <[email protected]>
|
||||
|
||||
* gram.js (JSC$stmt_try_asm): If none of the catch blocks matches
|
||||
the exception, we must throw it the upper level.
|
||||
|
||||
1998-09-10 Markku Rossi <[email protected]>
|
||||
|
||||
* asm.js (JSC$ASM_const_i_print): Cleaned up the output.
|
||||
|
||||
* gram.js (JSC$expr_object_initializer): New expression object for
|
||||
object literals.
|
||||
|
||||
* parser.js (JSC$parser_parse_primary_expr): Implemented object
|
||||
literals.
|
||||
|
||||
* asm.js (JSC$ASM_const_i): New operand to push a Int32 integer to
|
||||
the stack. Effectively this operand removes all integer constants
|
||||
from the constants section. They can be expressed in the same
|
||||
space that was used to present the integer index.
|
||||
|
||||
* gram.js (JSC$expr_integer_asm): Changed to use the new `const_i'
|
||||
operand.
|
||||
|
||||
1998-09-07 Markku Rossi <[email protected]>
|
||||
|
||||
* parser.js (JSC$parser_parse_function_declaration): Implemented
|
||||
the `arguments' property of function instance.
|
||||
|
||||
* gram.js (JSC$function_declaration_asm): Added support for the
|
||||
`arguments' property of function instance. If the property is
|
||||
used in the function body, we add code to the beginning of the
|
||||
function to create the arguments array.
|
||||
(JSC$stmt_for_count_locals): Fixed the counting of the local
|
||||
variables.
|
||||
(JSC$stmt_for_in_count_locals): Fixed the counting of local
|
||||
variables.
|
||||
|
||||
* entry.js: New flag JSC$FLAG_WARN_DEPRECATED to generate error
|
||||
messages about uses of deprecated features.
|
||||
|
||||
* asm.js (JSC$ASM_load_nth_arg): New byte-code operand to load the
|
||||
nth argument of function, where the index is at the top of the
|
||||
stack. This is needed in the implemenation of the `arguments'
|
||||
property of function instances.
|
||||
Re-organized byte-code operand numbers. All old byte-code files
|
||||
must be re-compiled.
|
||||
|
||||
1998-09-04 Markku Rossi <[email protected]>
|
||||
|
||||
* asm.js: Re-organized byte-code operand numbers. All old
|
||||
byte-code files must be re-compiled.
|
||||
|
||||
* parser.js (JSC$parser_parse_primary_expr): Changed the way how
|
||||
the regular expression constants are handled. We must decide the
|
||||
point when we accept a regexp constant. The lexer can't do it
|
||||
because the div operand and regexp constants can't be
|
||||
distinguished based on lexical analysis.
|
||||
(JSC$parser_parse_equality_expr): Implemented strict equals and
|
||||
does-not-equal operators. The change affects lexer.js, parser.js,
|
||||
gram.js, asm.js, and defs.js.
|
||||
|
||||
* defs.js: Removed constant JSC$tREGEXP.
|
||||
|
||||
* lexer.js (JSC$lexer): Changed the way how the regular expression
|
||||
constants are handled. We no longer return them as a token. We
|
||||
return the starting '/' character as-is and the parser recognizes
|
||||
the cases when it can start a regexp constant. In those cases,
|
||||
the parser will call JSC$lexer_read_regexp_constant() that reads
|
||||
the constant and compiles it to the RegExp built-in object.
|
||||
|
||||
1998-09-03 Markku Rossi <[email protected]>
|
||||
|
||||
* lexer.js (JSC$lexer): Changed the way how errors are returned
|
||||
form the malformed regular expression constants. This is needed
|
||||
because the syntax of the try-statement was changed.
|
||||
|
||||
* gram.js (JSC$stmt_for): Added support for local variable
|
||||
declarations.
|
||||
(JSC$stmt_for_in): Added support for local variable declarations.
|
||||
|
||||
* parser.js (JSC$parser_parse_iteration_stmt): Added support for
|
||||
local variable declarations in the head of the for statement.
|
||||
|
||||
* entry.js (JSC$compile_stream): Clear the syntax tree after the
|
||||
assembler has been generated. This saves some memory.
|
||||
|
||||
* Replaced all JC$Lists in the compiler sources with built-in
|
||||
Array objects.
|
||||
Removed the list.js file from the project.
|
||||
|
||||
* asm.js (JSC$asm_print): Cleaned up the annotated assembler
|
||||
output.
|
||||
|
||||
* gram.js (JSC$ContBreak): Added support for labeled statements.
|
||||
The constructor and all calculation methods were fixed to support
|
||||
the labels.
|
||||
(JSC$ContBreak$is_unique_label): New method is_unique_label() to
|
||||
check if the given label is unique in the current continue-break
|
||||
stack.
|
||||
(JSC$stmt_continue): Added support for labeled statements.
|
||||
(JSC$stmt_break): Added support for labeled statements.
|
||||
(JSC$stmt_labeled_stmt): New statement for the labeled
|
||||
statements.
|
||||
|
||||
* parser.js (JSC$parser_parse_stmt): Implemented labeled
|
||||
statements.
|
||||
(JSC$parser_parse_stmt): Added optional label to break and
|
||||
continue statements.
|
||||
|
||||
1998-09-02 Markku Rossi <[email protected]>
|
||||
|
||||
* parser.js (JSC$parser_parse_try): New function to parse try
|
||||
statements.
|
||||
|
||||
* gram.js (JSC$stmt_break_asm): Cleaned up the try and with
|
||||
nesting calculation. Now we use the methods, instead of directly
|
||||
investigating the top frame in the cont_break stack.
|
||||
(JSC$stmt_try): Re-implemented the try statement, including its
|
||||
asm() and count_locals() methods. Now the implementation is
|
||||
ECMAScript compatible.
|
||||
|
||||
1998-09-01 Markku Rossi <[email protected]>
|
||||
|
||||
* asm.js (JSC$asm_optimize): Optimize cases `const_true, iftrue'
|
||||
and `const_false, iffalse' to jumps.
|
||||
(JSC$asm_optimize): Cleaned up the peephole optimizations.
|
||||
Implemented a new byte-code side optimization that removes
|
||||
unnecessary jumps to the immediately following labels.
|
||||
|
||||
* gram.js (JSC$stmt_switch): New statement object for the switch
|
||||
statements.
|
||||
(JSC$stmt_continue_asm): Fixed to work inside a switch statement.
|
||||
(JSC$ContBreak): Cleaned up the continue-break handling in loops.
|
||||
Now it should work inside switch statements, including nested
|
||||
switch statements.
|
||||
|
||||
* parser.js (JSC$parser_parse_switch): New function to parse
|
||||
switch statements.
|
||||
|
||||
1998-08-25 Markku Rossi <[email protected]>
|
||||
|
||||
* parser.js (JSC$parser_parse_stmt): Added strict_ecma warning
|
||||
about line terminators between `throw' and the expression.
|
||||
|
||||
* gram.js (JSC$stmt_do_while): New statement object for do...while
|
||||
statements.
|
||||
|
||||
* parser.js (JSC$parser_parse_variable_stmt): Fixed the variable
|
||||
declaration parsing. Now it should co-operate correctly with the
|
||||
automatic semicolon insertion.
|
||||
(JSC$parser_parse_iteration_stmt): Implemented do...while
|
||||
statements.
|
||||
|
||||
* lexer.js (JSC$lexer_read_regexp): New function to read regular
|
||||
expression literals. The backslash escapes within them are so
|
||||
different from string literals that they need an own function to
|
||||
handle them.
|
||||
(JSC$lexer_read_backslash_escape): New function to handle
|
||||
backslash escapes in strings, character constants, and partly in
|
||||
regular expression literals.
|
||||
(JSC$lexer_read_backslash_escape): Added support for \xHH and
|
||||
\uHHHH escapes.
|
||||
Now the lexer should be ECMAScript 2.0 (draft) compatible.
|
||||
|
||||
1998-08-19 Markku Rossi <[email protected]>
|
||||
|
||||
* parser.js: New functions JSC$warning() and JSC$message() to
|
||||
report warnings and messages from the compiler. Changed all
|
||||
outputs in the sources to use these functions. There shouldn't be
|
||||
any System.error() calls left.
|
||||
|
||||
1998-08-17 Markku Rossi <[email protected]>
|
||||
|
||||
* gram.js (JSC$expr_array_initializer): New expression for array
|
||||
initializers.
|
||||
|
||||
* parser.js (JSC$parser_parse_primary_expr): Implemented array
|
||||
initializers.
|
||||
|
||||
* defs.js: New expression type JSC$EXPR_ARRAY_INITIALIZER.
|
||||
|
||||
* list.js: Cleaned up the code.
|
||||
|
||||
1998-08-14 Markku Rossi <[email protected]>
|
||||
|
||||
* asm.js: Changed JSC$CONST_REGEXP's value to 11. It is returned
|
||||
as a JS_BUILTIN.
|
||||
|
||||
* parser.js: Added support for the regular expression constants.
|
||||
|
||||
* gram.js (JSC$expr_regexp): New grammar component for the regular
|
||||
expression constants.
|
||||
|
||||
* asm.js: Added support for the regular expression constants.
|
||||
|
||||
* defs.js: New type constant JSC$JS_BUILTIN.
|
||||
|
||||
1998-08-13 Markku Rossi <[email protected]>
|
||||
|
||||
* defs.js: New token constant JSC$tREGEXP.
|
||||
|
||||
* parser.js (JSC$parser_parse): Fixed to report the number of
|
||||
missing semicolons only if there are any.
|
||||
|
||||
* entry.js: New flag JSC$FLAG_WARN_STRICT_ECMA to generate error
|
||||
messages about features that are supported but which are agains
|
||||
the ECMAScript standard.
|
||||
|
||||
* lexer.js (JSC$lexer): Fixed all error messages to be in the
|
||||
`FILENAME:LINENUM: MESSAGE' format.
|
||||
(JSC$lexer_read_string): Added warning about line terminators in
|
||||
string and regular expression constants.
|
||||
Fixed all error messages.
|
||||
Optimized the data creation to use the String.append() method.
|
||||
(JSC$lexer): Implemented regular expression literals.
|
||||
|
||||
1998-08-12 Markku Rossi <[email protected]>
|
||||
|
||||
* parser.js: Changed messages about automatic semicolon inserting
|
||||
to warnings.
|
||||
|
||||
* entry.js: New flag JSC$FLAG_WARN_MISSING_SEMICOLON.
|
||||
|
||||
1998-08-11 Markku Rossi <[email protected]>
|
||||
|
||||
* parser.js (JSC$parser_parse_source_element): Tag the global
|
||||
level variable declarations so that we can distinguish them at the
|
||||
assembler creation time.
|
||||
Implemented automatic semicolon inserting.
|
||||
(JSC$parser_parse): Added statistics about the missing
|
||||
semicolons.
|
||||
|
||||
* gram.js (JSC$stmt_variable_asm): Changed the variables, declared
|
||||
at the global level, to be global variables.
|
||||
Fixed some panic() calls to report the error with the `error()'
|
||||
global method.
|
||||
|
||||
1998-08-05 Markku Rossi <[email protected]>
|
||||
|
||||
* entry.js: New flag JSC$FLAG_GENERATE_EXECUTABLE_BC_FILES.
|
||||
(JSC$compile_stream): Added support for
|
||||
JSC$FLAG_GENERATE_EXECUTABLE_BC_FILES.
|
||||
|
||||
1998-06-08 Markku Rossi <[email protected]>
|
||||
|
||||
* parser.js (JSC$parser_parse_arguments): Fixed a bug that allowed
|
||||
us to call functions so that the individual arguements were not
|
||||
separated by a comma #','.
|
||||
|
||||
* asm.js: Removed operands `assert_args', `assert_min_args', and
|
||||
`assert_max_args'.
|
||||
Added operands `min_args', `add_1_i', and `add_2_i'.
|
||||
|
||||
* gram.js (JSC$function_declaration_asm): Removed conditional
|
||||
function argument count checks. The check were replaced with
|
||||
`min_args' operand that arranges things so that the minimum amount
|
||||
of arguments is present.
|
||||
|
||||
* entry.js (JSC$compile_stream): Removed flag
|
||||
JSC$FLAG_ARGUMENT_COUNT_CHECKS. JavaScript allows functions to be
|
||||
called with any number of arguments. Therefore, we can't assert
|
||||
the minimum amount of arguments for function.
|
||||
|
||||
* gram.js (JSC$expr_new_asm): Added support for `new Foo'
|
||||
expressions.
|
||||
|
||||
* asm.js: Changed constant types to new values.
|
||||
|
||||
1998-06-05 Markku Rossi <[email protected]>
|
||||
|
||||
* asm.js (JSC$ASM_mod): Implemented operand mod.
|
||||
Cleaned up byte-code operand opcodes.
|
||||
|
||||
1998-06-03 Markku Rossi <[email protected]>
|
||||
|
||||
* asm.js: Cleaned up the byte-code creation. Now we have common
|
||||
byte-code creation methods for different operand values: int8,
|
||||
int16, etc. This cleanup removes redundancy and saves nine
|
||||
functions.
|
||||
Cleaned up the compiler progress messages.
|
||||
|
||||
1998-06-02 Markku Rossi <[email protected]>
|
||||
|
||||
* lexer.js (JSC$lexer): Implemented 'data' -strings. The
|
||||
character constants are now presented as #'a'.
|
||||
|
||||
1998-05-15 Markku Rossi <[email protected]>
|
||||
|
||||
* gram.js (JSC$stmt_if_count_locals): Changed the way how the
|
||||
number of locals is counted. We don't need #if + #else, but we
|
||||
need max(#if, #else).
|
||||
|
||||
* parser.js (JSC$parser_parse_stmt): Implemented the `throw'
|
||||
statement.
|
||||
|
||||
* gram.js (JSC$stmt_throw): Implemented the `throw' statement.
|
||||
|
||||
* asm.js (JSC$ASM_throw): Implemented operand `throw'.
|
||||
|
||||
* defs.js: Defined new statement JSC$STMT_THROW.
|
||||
|
||||
1998-05-14 Markku Rossi <[email protected]>
|
||||
|
||||
* parser.js (JSC$parser_parse_stmt): Implemented the `try...catch'
|
||||
statement.
|
||||
Fixed a typo where function syntax_error() was called instead of
|
||||
JSC$parser_syntax_error().
|
||||
|
||||
* gram.js (JSC$ContBreak$try_return_nesting): New function to
|
||||
count how many try_pop's the return statement should invoke.
|
||||
(JSC$stmt_return_asm): Changed to invoke try_pop's if the return
|
||||
occurs inside a try-block.
|
||||
(JSC$stmt_try): Implemented the `try...catch' statement.
|
||||
|
||||
* asm.js: Implemented new operands try_push and try_pop to
|
||||
implement the `try...catch' statement.
|
||||
(JSC$asm_is_local_jump): Added JSC$OP_TRY_PUSH.
|
||||
(JSC$asm_optimize): Changed to stop `dup...pop' searching on
|
||||
`try_pop' operand.
|
||||
|
||||
* defs.js: Defined tokens for the ECMA Script's future reserved
|
||||
keywords.
|
||||
Defined new statement JSC$STMT_TRY.
|
||||
|
||||
* lexer.js (JSC$lexer): Added support for the ECMA Script's future
|
||||
reserved keywords.
|
||||
|
||||
* gram.js: Cleaned up the `continue' and `break' statement
|
||||
handling. Now there is an instance of class JSC$ContBreak that
|
||||
holds the state of the currently active looping constructs.
|
||||
|
||||
1998-05-13 Markku Rossi <[email protected]>
|
||||
|
||||
* gram.js: Checked all XXX's and fixed them.
|
||||
|
||||
1998-05-12 Markku Rossi <[email protected]>
|
||||
|
||||
* parser.js (JSC$parser_parse_iteration_stmt): Implemented
|
||||
`for...in' statements.
|
||||
|
||||
* gram.js (JSC$stmt_for_in): Implemented `for...in' statements.
|
||||
|
||||
* defs.js: New statement type JSC$STMT_FOR_IN.
|
||||
|
||||
* asm.js: Reorganized byte-code operands.
|
||||
(JSC$ASM_roll): New operand to roll the n uppermost items in the
|
||||
stack.
|
||||
(JSC$ASM_nth): New operand to return the nth item from array,
|
||||
object, or string.
|
||||
|
||||
1998-05-11 Markku Rossi <[email protected]>
|
||||
|
||||
* asm.js (JSC$ASM_delete_property): New function for the
|
||||
`delete_property' operand.
|
||||
(JSC$ASM_delete_array): New function for the `delete_array'
|
||||
operand.
|
||||
The new functions JSC$ASM_delete_property and JSC$ASM_delete_array
|
||||
replace the old `delete' operand.
|
||||
|
||||
* gram.js (JSC$expr_unary_asm): Implemented (correctly) the delete
|
||||
operator.
|
||||
|
||||
1998-05-07 Markku Rossi <[email protected]>
|
||||
|
||||
* asm.js (JSC$asm_optimize): Fixed a bug from the peep-hole
|
||||
optimization. We must not optimize over subroutine calls like:
|
||||
jsr, new, call_method or return operands.
|
||||
|
||||
* lexer.js (JSC$lexer_read_string): Fixed to handle
|
||||
backslash+newline like C does.
|
||||
|
||||
1998-04-16 Markku Rossi <[email protected]>
|
||||
|
||||
* lexer.js (JSC$lexer): Implemented decimal literals.
|
||||
|
||||
* asm.js (JSC$ASM_const_bytecode): Implemented float and NaN
|
||||
constants.
|
||||
|
||||
* entry.js: New flag JSC$FLAG_WARN_WITH_CLOBBER to control
|
||||
warnings about the with-lookup clobbering.
|
||||
|
||||
* gram.js (JSC$asm_expr_lvalue_load_asm): Added warnings for
|
||||
symbols which with-lookup is clobbered by a local variable or a
|
||||
function argument declaration.
|
||||
|
||||
1998-04-15 Markku Rossi <[email protected]>
|
||||
|
||||
* asm.js (JSC$ASM_with_pop): Added argument `value' that specifies
|
||||
how many with-frames the operand pops.
|
||||
|
||||
* gram.js (JSC$stmt_with_asm): Finished with statement. Now it
|
||||
handles break and continue statements within the with block.
|
||||
|
||||
1998-03-31 Markku Rossi <[email protected]>
|
||||
|
||||
* entry.js: Renamed flag JSC$FLAG_OPTIMIZE_JUMPS_TO_JUMPS to
|
||||
JSC$FLAG_OPTIMIZE_JUMPS.
|
||||
|
||||
1998-03-26 Markku Rossi <[email protected]>
|
||||
|
||||
* Added tests for the compiler.
|
||||
|
||||
* defs.js: Changed JSC$alloc_id() calls with constant values.
|
||||
|
||||
1998-03-25 Markku Rossi <[email protected]>
|
||||
|
||||
* asm.js (JSC$asm_optimize): Replaced individual `dup nnn pop =>
|
||||
nnn' optimizations with one generic dup-pop optimizations. This
|
||||
new optimizations handles all the optimizable dup-pop cases.
|
||||
|
||||
1998-03-24 Markku Rossi <[email protected]>
|
||||
|
||||
* asm.js (JSC$asm_optimize): New optimizations for `while (true)'
|
||||
and `while (false)' cases.
|
||||
|
||||
1998-03-05 Markku Rossi <[email protected]>
|
||||
|
||||
* parser.js (JSC$parser_parse_left_hand_side_expr): Fixed few
|
||||
typos where JSC$parser_get_token() was called without arguments.
|
||||
|
||||
* lexer.js (JSC$lexer): Implemented some character constants. Now
|
||||
the lexer supports all character constants that can be found from
|
||||
the ANSI-C reference.
|
||||
|
||||
* gram.js: Added language types for all expressions that know
|
||||
them.
|
||||
Changed to generate type aware assembler operands for expressions
|
||||
and statements for which the type is known.
|
||||
|
||||
* entry.js (JSC$compile_stream): Added unconditional
|
||||
optimizations: constant folding and type optimizations.
|
||||
|
||||
* defs.js: Added language primitive types.
|
||||
|
||||
* asm.js: Implemented type aware iffalse_b and iftrue_b operands.
|
||||
|
||||
1998-03-04 Markku Rossi <[email protected]>
|
||||
|
||||
* gram.js (JSC$expr_real_asm): Implemented.
|
||||
|
||||
1998-03-03 Markku Rossi <[email protected]>
|
||||
|
||||
* asm.js (JSC$optimize_heavy): New function to perform
|
||||
optimizations that require the liveness information of local
|
||||
variables and arguments.
|
||||
|
||||
* entry.js: New flag JSC$FLAG_OPTIMIZE_HEAVY for heavy
|
||||
optimizations.
|
||||
|
||||
* asm.js: Re-organized assembler operands.
|
||||
Implemented all missing operands.
|
||||
|
||||
* entry.js: New flag JSC$FLAG_ARGUMENT_COUNT_CHECKS.
|
||||
|
||||
* gram.js (JSC$function_declaration_asm): Added argument count
|
||||
checks.
|
||||
Renamed shift operands.
|
||||
|
||||
1998-03-02 Markku Rossi <[email protected]>
|
||||
|
||||
* parser.js: Fixes some bugs, shown by the new function argument
|
||||
count check.
|
||||
|
||||
* gram.js: Changed all `new JSC$ASM_*()' constructors to
|
||||
explicitly call the link() method.
|
||||
|
||||
* asm.js: Removed call to JSC$asm_append() from all asm
|
||||
constructors. The linking is now implemented with the link()
|
||||
method that is defined to all assembler operands, labels and
|
||||
symbols.
|
||||
|
||||
* gram.js (JSC$function_declaration): Added lbrace_ln to hold the
|
||||
line number of the opening lbrace of the body.
|
||||
(JSC$function_declaration_asm): Set locals' linenumber to be
|
||||
lbrace_ln.
|
||||
|
||||
1998-02-27 Markku Rossi <[email protected]>
|
||||
|
||||
* asm.js (JSC$asm_bytecode): Added debugging information.
|
||||
|
||||
* entry.js: Renamed to entry.js from main.js.
|
||||
New flag JSC$FLAG_ANNOTATE_ASSEMBLER.
|
||||
(JSC$compile_stream): Changed to handle
|
||||
JSC$FLAG_ANNOTATE_ASSEMBLER flag.
|
||||
New flag JSC$FLAG_GENERATE_DEBUG_INFO.
|
||||
(JSC$compile_stream): Changed to handle
|
||||
JSC$FLAG_GENERATE_DEBUG_INFO flga.
|
||||
|
||||
* streams.js: Added rewind and readln methods to all streams.
|
||||
|
||||
* asm.js (JSC$asm_print): If requested, annotate the generated
|
||||
assembler listing with the original source code.
|
||||
|
||||
* gram.js: Added line number information to all assembler
|
||||
operands.
|
||||
|
||||
* parser.js: Added line number information to all statements and
|
||||
expressions.
|
||||
|
||||
1998-02-26 Markku Rossi <[email protected]>
|
||||
|
||||
* asm.js (JSC$asm_optimize): Implemented new optimization for
|
||||
assembler, generated from statements like `i++' and `i--'.
|
||||
|
||||
1998-02-24 Markku Rossi <[email protected]>
|
||||
|
||||
* asm.js (JSC$ASM_xor): Implemented xor opcode.
|
||||
(JSC$ASM_with_push): Implemented with statements.
|
||||
(JSC$asm_generate): Changed to ensure that the evaluation of the
|
||||
global section returns some sane value to the caller.
|
||||
(JSC$asm_optimize): New peephole optimization for apop + pop.
|
||||
(JSC$ASM_locals): Changed the argument to be a 16 bit integer.
|
||||
|
||||
* parser.js (JSC$parser_parse): Fixed an infinite loop. We must
|
||||
check that parse_source_element() returns true. Otherwise we have
|
||||
encountered a syntax error.
|
||||
|
||||
* gram.js (JSC$expr_unary_asm): Implemented rest unary
|
||||
expressions.
|
||||
(JSC$stmt_with): Implemented with statement.
|
||||
|
||||
* lexer.js (JSC$lexer): Made `#!' a single line commment starter.
|
||||
(JSC$lexer): Implemented '\ooo' notations to top-level and to
|
||||
string constants.
|
||||
|
||||
1998-02-23 Markku Rossi <[email protected]>
|
||||
|
||||
* namespace.js: Changed namespace to report errors and warnings
|
||||
about different variable and argument definition illegalities.
|
||||
|
||||
* main.js (JSC$compile_stream): Changed to raise an error if the
|
||||
input stream couldn't be opened.
|
||||
|
||||
* gram.js (JSC$stmt_variable_asm): Removed warnings about multiply
|
||||
defined variables. They are now reported directly from
|
||||
namespace.
|
||||
|
||||
* asm.js (JSC$asm_optimize): Added argument flags that tells which
|
||||
optimizations the function should perform.
|
||||
|
||||
1998-02-20 Markku Rossi <[email protected]>
|
||||
|
||||
* parser.js (JSC$parser_reset): New function to reset all global
|
||||
variables.
|
||||
|
||||
* main.js (JSC$compiler_reset): New function to reset the whole
|
||||
compiler.
|
||||
|
||||
* gram.js (JSC$gram_reset): New function to reset all global
|
||||
variables.
|
||||
|
||||
* asm.js (JSC$asm_reset): New function to reset all global
|
||||
variables. This replaces the old JSC$asm_clear() function.
|
||||
|
||||
* Changed all errors to be reported with the error() global
|
||||
method.
|
||||
|
||||
1998-02-18 Markku Rossi <[email protected]>
|
||||
|
||||
* main.js (JSC$compile_stream): Made error messages more
|
||||
informative.
|
||||
|
||||
* streams.js: Added property `error' for all streams.
|
||||
|
||||
* namespace.js (JSC$NameSpace_define_symbol): Changed to return a
|
||||
boolean status code that identify whether the symbol was already
|
||||
defined or not.
|
||||
|
||||
* gram.js: Added line number information for statements.
|
||||
|
||||
1998-02-16 Markku Rossi <[email protected]>
|
||||
|
||||
* gram.js (JSC$stmt_continue): Implemented `continue' statement.
|
||||
(JSC$stmt_break): Implemented `break' statement.
|
||||
|
||||
* asm.js (JSC$asm_bytecode): Changed to use String.append()
|
||||
instead of the plus operand. This saves memory usage noticeably.
|
||||
|
||||
1998-02-13 Markku Rossi <[email protected]>
|
||||
|
||||
* asm.js (JSC$asm_optimize): Made heavy optimizations to depend on
|
||||
the JSC$optimize_heavy variable.
|
||||
|
||||
* main.js: Create a new public interface to the compiler.
|
||||
Made all diagnostics messages to depend on the JSC$verbose
|
||||
variable.
|
||||
|
||||
* asm.js (JSC$asm_optimize): Cleaned up the optimization code.
|
||||
Run the dead code elimination optimizations in a loop until no
|
||||
more changes can be done.
|
||||
(JSC$asm_generate): Added support for local variables in the
|
||||
global statements.
|
||||
|
||||
* parser.js (JSC$parser_parse_left_hand_side_expr): Implemented
|
||||
array references.
|
||||
|
||||
1998-02-11 Markku Rossi <[email protected]>
|
||||
|
||||
* The JavaScript compiler is now self-hosting. It can generate
|
||||
valid byte-code files which can be executed with the virtual
|
||||
machine. The perl assembler is no longer needed.
|
||||
|
||||
* gram.js: Changed to generate internal assembler objects instead
|
||||
of dumping the assembler code to the stdout.
|
||||
|
||||
* asm.js: New file to implement the assembler.
|
||||
|
||||
1998-02-09 Markku Rossi <[email protected]>
|
||||
|
||||
* streams.js (JSC$StreamString): Implemented string stream.
|
||||
|
||||
* The JavaScript JavaScript compiler can now compile itself.
|
||||
@@ -1,60 +0,0 @@
|
||||
#
|
||||
# Automakefile for JavaScript JavaScript compiler.
|
||||
# Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
#
|
||||
# Author: Markku Rossi <[email protected]>
|
||||
#
|
||||
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
# MA 02111-1307, USA
|
||||
#
|
||||
|
||||
SUBDIRS = tests
|
||||
|
||||
JSCOMPILER = ../src/js
|
||||
JSCOMPILER_FLAGS = -Wpedantic -O2
|
||||
|
||||
JSS = defs.js lexer.js parser.js gram.js namespace.js \
|
||||
streams.js asm.js entry.js
|
||||
JSCS = defs.jsc lexer.jsc parser.jsc gram.jsc namespace.jsc \
|
||||
streams.jsc asm.jsc entry.jsc
|
||||
|
||||
EXTRA_DIST = $(JSS) $(JSCS) bs.js bs.jsc compiler.js compiler.jsc
|
||||
|
||||
compile: $(JSCS) bs.jsc
|
||||
|
||||
compiler: compiler.jsc
|
||||
|
||||
compiler.jsc: compiler.js
|
||||
$(JSCOMPILER) $(JSCOMPILER_FLAGS) -c $<
|
||||
cp compiler.jsc bak/compiler-`date | sed 's/ /-/g'`.jsc || true
|
||||
|
||||
compiler.js: $(JSS)
|
||||
cat $(JSS) >compiler.js
|
||||
|
||||
run: compile
|
||||
$(JSCOMPILER) --load $(JSCS) --file bs.jsc
|
||||
|
||||
wc:
|
||||
wc $(JSS)
|
||||
|
||||
my-clean:
|
||||
rm -f $(JSCS) bs.jsc
|
||||
|
||||
SUFFIXES = .jsc .js
|
||||
|
||||
.js.jsc:
|
||||
$(JSCOMPILER) $(JSCOMPILER_FLAGS) -g -c $<
|
||||
@@ -1,318 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
#
|
||||
# Automakefile for JavaScript JavaScript compiler.
|
||||
# Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
#
|
||||
# Author: Markku Rossi <[email protected]>
|
||||
#
|
||||
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
# MA 02111-1307, USA
|
||||
#
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
ACLOCAL_FLAGS_FOR_LIBTOOL = @ACLOCAL_FLAGS_FOR_LIBTOOL@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
EXTENSIONS = @EXTENSIONS@
|
||||
EXTENSIONS_LIBS = @EXTENSIONS_LIBS@
|
||||
INTERPRETER_FEATURES = @INTERPRETER_FEATURES@
|
||||
LD = @LD@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
NM = @NM@
|
||||
PACKAGE = @PACKAGE@
|
||||
PGCC_BY_PROVENZANO = @PGCC_BY_PROVENZANO@
|
||||
RANLIB = @RANLIB@
|
||||
U = @U@
|
||||
VERSION = @VERSION@
|
||||
XLC_R_AIX = @XLC_R_AIX@
|
||||
|
||||
SUBDIRS = tests
|
||||
|
||||
JSCOMPILER = ../src/js
|
||||
JSCOMPILER_FLAGS = -Wpedantic -O2
|
||||
|
||||
JSS = defs.js lexer.js parser.js gram.js namespace.js \
|
||||
streams.js asm.js entry.js
|
||||
JSCS = defs.jsc lexer.jsc parser.jsc gram.jsc namespace.jsc \
|
||||
streams.jsc asm.jsc entry.jsc
|
||||
|
||||
EXTRA_DIST = $(JSS) $(JSCS) bs.js bs.jsc compiler.js compiler.jsc
|
||||
|
||||
SUFFIXES = .jsc .js
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../jsconfig.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_COMMON = ChangeLog Makefile.am Makefile.in TODO
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
all: all-recursive all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .js .jsc
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps jsc/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
all-recursive install-data-recursive install-exec-recursive \
|
||||
installdirs-recursive install-recursive uninstall-recursive \
|
||||
check-recursive installcheck-recursive info-recursive dvi-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
(cd $$subdir && $(MAKE) $$target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
|
||||
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
rev="$$subdir $$rev"; \
|
||||
done; \
|
||||
for subdir in $$rev; do \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
(cd $$subdir && $(MAKE) $$target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
(cd $$subdir && $(MAKE) tags); \
|
||||
done
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = jsc
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
for subdir in $(SUBDIRS); do \
|
||||
test -d $(distdir)/$$subdir \
|
||||
|| mkdir $(distdir)/$$subdir \
|
||||
|| exit 1; \
|
||||
chmod 777 $(distdir)/$$subdir; \
|
||||
(cd $$subdir && $(MAKE) top_distdir=../$(top_distdir) distdir=../$(distdir)/$$subdir distdir) \
|
||||
|| exit 1; \
|
||||
done
|
||||
info: info-recursive
|
||||
dvi: dvi-recursive
|
||||
check: all-am
|
||||
$(MAKE) check-recursive
|
||||
installcheck: installcheck-recursive
|
||||
all-am: Makefile
|
||||
|
||||
install-exec: install-exec-recursive
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install-data: install-data-recursive
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-recursive
|
||||
@:
|
||||
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs: installdirs-recursive
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean-am: mostlyclean-tags mostlyclean-generic
|
||||
|
||||
clean-am: clean-tags clean-generic mostlyclean-am
|
||||
|
||||
distclean-am: distclean-tags distclean-generic clean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \
|
||||
distclean-am
|
||||
|
||||
mostlyclean: mostlyclean-recursive mostlyclean-am
|
||||
|
||||
clean: clean-recursive clean-am
|
||||
|
||||
distclean: distclean-recursive distclean-am
|
||||
-rm -f config.status
|
||||
-rm -f libtool
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive maintainer-clean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
.PHONY: install-data-recursive uninstall-data-recursive \
|
||||
install-exec-recursive uninstall-exec-recursive installdirs-recursive \
|
||||
uninstalldirs-recursive all-recursive check-recursive \
|
||||
installcheck-recursive info-recursive dvi-recursive \
|
||||
mostlyclean-recursive distclean-recursive clean-recursive \
|
||||
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
|
||||
distclean-tags clean-tags maintainer-clean-tags distdir info dvi \
|
||||
installcheck all-am install-exec install-data install uninstall all \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
compile: $(JSCS) bs.jsc
|
||||
|
||||
compiler: compiler.jsc
|
||||
|
||||
compiler.jsc: compiler.js
|
||||
$(JSCOMPILER) $(JSCOMPILER_FLAGS) -c $<
|
||||
cp compiler.jsc bak/compiler-`date | sed 's/ /-/g'`.jsc || true
|
||||
|
||||
compiler.js: $(JSS)
|
||||
cat $(JSS) >compiler.js
|
||||
|
||||
run: compile
|
||||
$(JSCOMPILER) --load $(JSCS) --file bs.jsc
|
||||
|
||||
wc:
|
||||
wc $(JSS)
|
||||
|
||||
my-clean:
|
||||
rm -f $(JSCS) bs.jsc
|
||||
|
||||
.js.jsc:
|
||||
$(JSCOMPILER) $(JSCOMPILER_FLAGS) -g -c $<
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -1,24 +0,0 @@
|
||||
|
||||
TODO JavaScript JavaScript Compiler
|
||||
|
||||
* General
|
||||
|
||||
- clean up the compiler source
|
||||
|
||||
* Optimizations
|
||||
|
||||
- Improve constant folding: type conversions, expr_multiplicative,
|
||||
expr_shift, expr_relational, expr_bitwise, etc.
|
||||
|
||||
- create type-specified virtual machine operands for +, -, *,
|
||||
etc. and use them if the types are known. See JSC$stmt_if_asm()
|
||||
for an example.
|
||||
|
||||
- delete_{property,array} => delete_{property,array}
|
||||
pop
|
||||
const_undefined
|
||||
|
||||
* parser.js
|
||||
|
||||
- 7.8 Sharp Variables
|
||||
- and more???
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* Bootstrap file for the JavaScript compiler.
|
||||
* Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
*
|
||||
* Author: Markku Rossi <mtr@ngs.fi>
|
||||
*/
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
* MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Source: /cygdrive/c/RCVS/CVS/ReactOS/reactos/lib/kjs/jsc/bs.js,v $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* To run the compiler from vm, just call the entry point with fixed
|
||||
* arguments.
|
||||
*/
|
||||
VM.verbose = 0;
|
||||
|
||||
function compile ()
|
||||
{
|
||||
var file = "a.js";
|
||||
var verbose = JSC$FLAG_VERBOSE;
|
||||
|
||||
if (ARGS.length == 2)
|
||||
{
|
||||
file = ARGS[1];
|
||||
verbose = 0;
|
||||
}
|
||||
|
||||
JSC$compile_file (file,
|
||||
verbose
|
||||
| JSC$FLAG_ANNOTATE_ASSEMBLER
|
||||
| JSC$FLAG_GENERATE_DEBUG_INFO
|
||||
| JSC$FLAG_OPTIMIZE_MASK
|
||||
| JSC$FLAG_WARN_MASK & ~JSC$FLAG_WARN_MISSING_SEMICOLON,
|
||||
"./a.jas",
|
||||
"./a.jsc");
|
||||
}
|
||||
|
||||
compile ();
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
mode: c
|
||||
End:
|
||||
*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,178 +0,0 @@
|
||||
/*
|
||||
* Internal definitions.
|
||||
* Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
*
|
||||
* Author: Markku Rossi <mtr@ngs.fi>
|
||||
*/
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
* MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Source: /cygdrive/c/RCVS/CVS/ReactOS/reactos/lib/kjs/jsc/defs.js,v $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Constants.
|
||||
*/
|
||||
|
||||
/* Tokens. */
|
||||
|
||||
JSC$tEOF = 128;
|
||||
JSC$tINTEGER = 129;
|
||||
JSC$tFLOAT = 130;
|
||||
JSC$tSTRING = 131;
|
||||
JSC$tIDENTIFIER = 132;
|
||||
|
||||
JSC$tBREAK = 133;
|
||||
JSC$tCONTINUE = 134;
|
||||
JSC$tDELETE = 135;
|
||||
JSC$tELSE = 136;
|
||||
JSC$tFOR = 137;
|
||||
JSC$tFUNCTION = 138;
|
||||
JSC$tIF = 139;
|
||||
JSC$tIN = 140;
|
||||
JSC$tNEW = 141;
|
||||
JSC$tRETURN = 142;
|
||||
JSC$tTHIS = 143;
|
||||
JSC$tTYPEOF = 144;
|
||||
JSC$tVAR = 145;
|
||||
JSC$tVOID = 146;
|
||||
JSC$tWHILE = 147;
|
||||
JSC$tWITH = 148;
|
||||
|
||||
JSC$tCASE = 149;
|
||||
JSC$tCATCH = 150;
|
||||
JSC$tCLASS = 151;
|
||||
JSC$tCONST = 152;
|
||||
JSC$tDEBUGGER = 153;
|
||||
JSC$tDEFAULT = 154;
|
||||
JSC$tDO = 155;
|
||||
JSC$tENUM = 156;
|
||||
JSC$tEXPORT = 157;
|
||||
JSC$tEXTENDS = 158;
|
||||
JSC$tFINALLY = 159;
|
||||
JSC$tIMPORT = 160;
|
||||
JSC$tSUPER = 161;
|
||||
JSC$tSWITCH = 162;
|
||||
JSC$tTHROW = 163;
|
||||
JSC$tTRY = 164;
|
||||
|
||||
JSC$tNULL = 165;
|
||||
JSC$tTRUE = 166;
|
||||
JSC$tFALSE = 167;
|
||||
|
||||
JSC$tEQUAL = 168;
|
||||
JSC$tNEQUAL = 169;
|
||||
JSC$tLE = 170;
|
||||
JSC$tGE = 171;
|
||||
JSC$tAND = 172;
|
||||
JSC$tOR = 173;
|
||||
JSC$tPLUSPLUS = 174;
|
||||
JSC$tMINUSMINUS = 175;
|
||||
JSC$tMULA = 176;
|
||||
JSC$tDIVA = 177;
|
||||
JSC$tMODA = 178;
|
||||
JSC$tADDA = 179;
|
||||
JSC$tSUBA = 180;
|
||||
JSC$tANDA = 181;
|
||||
JSC$tXORA = 182;
|
||||
JSC$tORA = 183;
|
||||
JSC$tLSIA = 184;
|
||||
JSC$tLSHIFT = 185;
|
||||
JSC$tRSHIFT = 186;
|
||||
JSC$tRRSHIFT = 187;
|
||||
JSC$tRSIA = 188;
|
||||
JSC$tRRSA = 189;
|
||||
JSC$tSEQUAL = 190;
|
||||
JSC$tSNEQUAL = 191;
|
||||
|
||||
|
||||
/* Expressions. */
|
||||
|
||||
JSC$EXPR_COMMA = 0;
|
||||
JSC$EXPR_ASSIGNMENT = 1;
|
||||
JSC$EXPR_QUEST_COLON = 2;
|
||||
JSC$EXPR_LOGICAL = 3;
|
||||
JSC$EXPR_BITWISE = 4;
|
||||
JSC$EXPR_EQUALITY = 5;
|
||||
JSC$EXPR_RELATIONAL = 6;
|
||||
JSC$EXPR_SHIFT = 7;
|
||||
JSC$EXPR_MULTIPLICATIVE = 8;
|
||||
JSC$EXPR_ADDITIVE = 9;
|
||||
JSC$EXPR_THIS = 10;
|
||||
JSC$EXPR_NULL = 11;
|
||||
JSC$EXPR_TRUE = 12;
|
||||
JSC$EXPR_FALSE = 13;
|
||||
JSC$EXPR_IDENTIFIER = 14;
|
||||
JSC$EXPR_FLOAT = 15;
|
||||
JSC$EXPR_INTEGER = 16;
|
||||
JSC$EXPR_STRING = 17;
|
||||
JSC$EXPR_CALL = 18;
|
||||
JSC$EXPR_OBJECT_PROPERTY = 19;
|
||||
JSC$EXPR_OBJECT_ARRAY = 20;
|
||||
JSC$EXPR_NEW = 21;
|
||||
JSC$EXPR_DELETE = 22;
|
||||
JSC$EXPR_VOID = 23;
|
||||
JSC$EXPR_TYPEOF = 24;
|
||||
JSC$EXPR_PREFIX = 25;
|
||||
JSC$EXPR_POSTFIX = 26;
|
||||
JSC$EXPR_UNARY = 27;
|
||||
JSC$EXPR_REGEXP = 28;
|
||||
JSC$EXPR_ARRAY_INITIALIZER = 29;
|
||||
JSC$EXPR_OBJECT_INITIALIZER = 30;
|
||||
|
||||
/* Statements */
|
||||
|
||||
JSC$STMT_BLOCK = 0;
|
||||
JSC$STMT_FUNCTION_DECLARATION = 1;
|
||||
JSC$STMT_VARIABLE = 2;
|
||||
JSC$STMT_EMPTY = 3;
|
||||
JSC$STMT_EXPR = 4;
|
||||
JSC$STMT_IF = 5;
|
||||
JSC$STMT_WHILE = 6;
|
||||
JSC$STMT_FOR = 7;
|
||||
JSC$STMT_FOR_IN = 8;
|
||||
JSC$STMT_CONTINUE = 9;
|
||||
JSC$STMT_BREAK = 10;
|
||||
JSC$STMT_RETURN = 11;
|
||||
JSC$STMT_WITH = 12;
|
||||
JSC$STMT_TRY = 13;
|
||||
JSC$STMT_THROW = 14;
|
||||
JSC$STMT_DO_WHILE = 15;
|
||||
JSC$STMT_SWITCH = 16;
|
||||
JSC$STMT_LABELED_STMT = 17;
|
||||
|
||||
/* JavaScript types. */
|
||||
|
||||
JSC$JS_UNDEFINED = 0;
|
||||
JSC$JS_NULL = 1;
|
||||
JSC$JS_BOOLEAN = 2;
|
||||
JSC$JS_INTEGER = 3;
|
||||
JSC$JS_STRING = 4;
|
||||
JSC$JS_FLOAT = 5;
|
||||
JSC$JS_ARRAY = 6;
|
||||
JSC$JS_OBJECT = 7;
|
||||
JSC$JS_BUILTIN = 11;
|
||||
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
mode: c
|
||||
End:
|
||||
*/
|
||||
@@ -1,206 +0,0 @@
|
||||
/*
|
||||
* Public entry points to the JavaScript compiler.
|
||||
* Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
*
|
||||
* Author: Markku Rossi <mtr@ngs.fi>
|
||||
*/
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
* MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Source: /cygdrive/c/RCVS/CVS/ReactOS/reactos/lib/kjs/jsc/entry.js,v $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Definitions.
|
||||
*/
|
||||
|
||||
JSC$FLAG_VERBOSE = 0x00000001;
|
||||
JSC$FLAG_ANNOTATE_ASSEMBLER = 0x00000002;
|
||||
JSC$FLAG_GENERATE_DEBUG_INFO = 0x00000004;
|
||||
JSC$FLAG_GENERATE_EXECUTABLE_BC_FILES = 0x00000008;
|
||||
|
||||
JSC$FLAG_OPTIMIZE_PEEPHOLE = 0x00000020;
|
||||
JSC$FLAG_OPTIMIZE_JUMPS = 0x00000040;
|
||||
JSC$FLAG_OPTIMIZE_BC_SIZE = 0x00000080;
|
||||
JSC$FLAG_OPTIMIZE_HEAVY = 0x00000100;
|
||||
|
||||
JSC$FLAG_OPTIMIZE_MASK = 0x0000fff0;
|
||||
|
||||
JSC$FLAG_WARN_UNUSED_ARGUMENT = 0x00010000;
|
||||
JSC$FLAG_WARN_UNUSED_VARIABLE = 0x00020000;
|
||||
JSC$FLAG_WARN_SHADOW = 0x00040000;
|
||||
JSC$FLAG_WARN_WITH_CLOBBER = 0x00080000;
|
||||
JSC$FLAG_WARN_MISSING_SEMICOLON = 0x00100000;
|
||||
JSC$FLAG_WARN_STRICT_ECMA = 0x00200000;
|
||||
JSC$FLAG_WARN_DEPRECATED = 0x00400000;
|
||||
|
||||
JSC$FLAG_WARN_MASK = 0xffff0000;
|
||||
|
||||
/*
|
||||
* Global interfaces to the compiler.
|
||||
*/
|
||||
|
||||
function JSC$compile_file (fname, flags, asm_file, bc_file)
|
||||
{
|
||||
var stream = new JSC$StreamFile (fname);
|
||||
return JSC$compile_stream (stream, flags, asm_file, bc_file);
|
||||
}
|
||||
|
||||
|
||||
function JSC$compile_string (str, flags, asm_file, bc_file)
|
||||
{
|
||||
var stream = new JSC$StreamString (str);
|
||||
return JSC$compile_stream (stream, flags, asm_file, bc_file);
|
||||
}
|
||||
|
||||
|
||||
function JSC$compiler_reset ()
|
||||
{
|
||||
/* Reset compiler to a known initial state. */
|
||||
JSC$parser_reset ();
|
||||
JSC$gram_reset ();
|
||||
JSC$asm_reset ();
|
||||
}
|
||||
|
||||
|
||||
function JSC$compile_stream (stream, flags, asm_file, bc_file)
|
||||
{
|
||||
var result = false;
|
||||
|
||||
JSC$compiler_reset ();
|
||||
|
||||
if (stream.open ())
|
||||
{
|
||||
try
|
||||
{
|
||||
JSC$verbose = ((flags & JSC$FLAG_VERBOSE) != 0);
|
||||
JSC$generate_debug_info
|
||||
= ((flags & JSC$FLAG_GENERATE_DEBUG_INFO) != 0);
|
||||
|
||||
JSC$warn_unused_argument
|
||||
= ((flags & JSC$FLAG_WARN_UNUSED_ARGUMENT) != 0);
|
||||
JSC$warn_unused_variable
|
||||
= ((flags & JSC$FLAG_WARN_UNUSED_VARIABLE) != 0);
|
||||
JSC$warn_shadow
|
||||
= ((flags & JSC$FLAG_WARN_SHADOW) != 0);
|
||||
JSC$warn_with_clobber
|
||||
= ((flags & JSC$FLAG_WARN_WITH_CLOBBER) != 0);
|
||||
JSC$warn_missing_semicolon
|
||||
= ((flags & JSC$FLAG_WARN_MISSING_SEMICOLON) != 0);
|
||||
JSC$warn_strict_ecma
|
||||
= ((flags & JSC$FLAG_WARN_STRICT_ECMA) != 0);
|
||||
JSC$warn_deprecated
|
||||
= ((flags & JSC$FLAG_WARN_DEPRECATED) != 0);
|
||||
|
||||
/* Compilation and assembler generation time optimizations. */
|
||||
JSC$optimize_constant_folding = true;
|
||||
JSC$optimize_type = true;
|
||||
|
||||
JSC$parser_parse (stream);
|
||||
|
||||
/* Assembler. */
|
||||
JSC$asm_generate ();
|
||||
|
||||
/*
|
||||
* We don't need the syntax tree anymore. Free it and save
|
||||
* some memory.
|
||||
*/
|
||||
JSC$parser_reset ();
|
||||
|
||||
/* Optimize if requested. */
|
||||
if ((flags & JSC$FLAG_OPTIMIZE_MASK) != 0)
|
||||
JSC$asm_optimize (flags);
|
||||
|
||||
if (typeof asm_file == "string")
|
||||
{
|
||||
var asm_stream = new File (asm_file);
|
||||
var src_stream = false;
|
||||
|
||||
if (asm_stream.open ("w"))
|
||||
{
|
||||
if ((flags & JSC$FLAG_ANNOTATE_ASSEMBLER) != 0)
|
||||
if (stream.rewind ())
|
||||
src_stream = stream;
|
||||
|
||||
JSC$asm_print (src_stream, asm_stream);
|
||||
asm_stream.close ();
|
||||
}
|
||||
else
|
||||
JSC$message ("jsc: couldn't create asm output file \""
|
||||
+ asm_file + "\": "
|
||||
+ System.strerror (System.errno));
|
||||
}
|
||||
|
||||
JSC$asm_finalize ();
|
||||
|
||||
result = JSC$asm_bytecode ();
|
||||
|
||||
/* Remove all intermediate results from the memory. */
|
||||
JSC$compiler_reset ();
|
||||
|
||||
if (typeof bc_file == "string")
|
||||
{
|
||||
var ostream = new File (bc_file);
|
||||
if (ostream.open ("w"))
|
||||
{
|
||||
ostream.write (result);
|
||||
ostream.close ();
|
||||
|
||||
if ((flags & JSC$FLAG_GENERATE_EXECUTABLE_BC_FILES) != 0)
|
||||
{
|
||||
/* Add execute permissions to the output file. */
|
||||
var st = File.stat (bc_file);
|
||||
if (st)
|
||||
{
|
||||
if (!File.chmod (bc_file, st[2] | 0111))
|
||||
JSC$message ("jsc: couldn't add execute "
|
||||
+ "permissions to bc file \""
|
||||
+ bc_file + "\": "
|
||||
+ System.strerror (System.errno));
|
||||
}
|
||||
else
|
||||
JSC$message ("jsc: couldn't stat bc file \"" + bc_file
|
||||
+ "\": "
|
||||
+ System.strerror (System.errno));
|
||||
}
|
||||
}
|
||||
else
|
||||
JSC$message ("jsc: couldn't create bc file \"" + bc_file
|
||||
+ "\": " + System.strerror (System.errno));
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
stream.close ();
|
||||
}
|
||||
}
|
||||
else
|
||||
error ("jsc: couldn't open input stream \"" + stream.name + "\": "
|
||||
+ stream.error);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
mode: c
|
||||
End:
|
||||
*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,824 +0,0 @@
|
||||
/*
|
||||
* Lexer.
|
||||
* Copyright (c) 1998-1999 New Generation Software (NGS) Oy
|
||||
*
|
||||
* Author: Markku Rossi <mtr@ngs.fi>
|
||||
*/
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
* MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Source: /cygdrive/c/RCVS/CVS/ReactOS/reactos/lib/kjs/jsc/lexer.js,v $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Global functions.
|
||||
*/
|
||||
|
||||
function JSC$lexer (stream)
|
||||
{
|
||||
var ch, ch2;
|
||||
|
||||
JSC$token_value = null;
|
||||
|
||||
while ((ch = stream.readByte ()) != -1)
|
||||
{
|
||||
if (ch == #'\n')
|
||||
{
|
||||
JSC$linenum++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (JSC$lexer_is_white_space (ch))
|
||||
continue;
|
||||
|
||||
JSC$token_linenum = JSC$linenum;
|
||||
|
||||
if (ch == #'/' && JSC$lexer_peek_char (stream) == #'*')
|
||||
{
|
||||
/* Multi line comment. */
|
||||
stream.readByte ();
|
||||
while ((ch = stream.readByte ()) != -1
|
||||
&& (ch != #'*' || JSC$lexer_peek_char (stream) != #'/'))
|
||||
if (ch == #'\n')
|
||||
JSC$linenum++;
|
||||
|
||||
/* Consume the peeked #'/' character. */
|
||||
stream.readByte ();
|
||||
}
|
||||
else if ((ch == #'/' && JSC$lexer_peek_char (stream) == #'/')
|
||||
|| (ch == #'#' && JSC$lexer_peek_char (stream) == #'!'))
|
||||
{
|
||||
/* Single line comment. */
|
||||
while ((ch = stream.readByte ()) != -1 && ch != #'\n')
|
||||
;
|
||||
if (ch == #'\n')
|
||||
JSC$linenum++;
|
||||
}
|
||||
else if (ch == #'"' || ch == #'\'')
|
||||
{
|
||||
/* String constant. */
|
||||
JSC$token_value = JSC$lexer_read_string (stream, "string", ch);
|
||||
return JSC$tSTRING;
|
||||
}
|
||||
|
||||
/* Literals. */
|
||||
else if (ch == #'=' && JSC$lexer_peek_char (stream) == #'=')
|
||||
{
|
||||
stream.readByte ();
|
||||
if (JSC$lexer_peek_char (stream) == #'=')
|
||||
{
|
||||
stream.readByte ();
|
||||
return JSC$tSEQUAL;
|
||||
}
|
||||
return JSC$tEQUAL;
|
||||
}
|
||||
else if (ch == #'!' && JSC$lexer_peek_char (stream) == #'=')
|
||||
{
|
||||
stream.readByte ();
|
||||
if (JSC$lexer_peek_char (stream) == #'=')
|
||||
{
|
||||
stream.readByte ();
|
||||
return JSC$tSNEQUAL;
|
||||
}
|
||||
return JSC$tNEQUAL;
|
||||
}
|
||||
else if (ch == #'<' && JSC$lexer_peek_char (stream) == #'=')
|
||||
{
|
||||
stream.readByte ();
|
||||
return JSC$tLE;
|
||||
}
|
||||
else if (ch == #'>' && JSC$lexer_peek_char (stream) == #'=')
|
||||
{
|
||||
stream.readByte ();
|
||||
return JSC$tGE;
|
||||
}
|
||||
else if (ch == #'&' && JSC$lexer_peek_char (stream) == #'&')
|
||||
{
|
||||
stream.readByte ();
|
||||
return JSC$tAND;
|
||||
}
|
||||
else if (ch == #'|' && JSC$lexer_peek_char (stream) == #'|')
|
||||
{
|
||||
stream.readByte ();
|
||||
return JSC$tOR;
|
||||
}
|
||||
else if (ch == #'+' && JSC$lexer_peek_char (stream) == #'+')
|
||||
{
|
||||
stream.readByte ();
|
||||
return JSC$tPLUSPLUS;
|
||||
}
|
||||
else if (ch == #'-' && JSC$lexer_peek_char (stream) == #'-')
|
||||
{
|
||||
stream.readByte ();
|
||||
return JSC$tMINUSMINUS;
|
||||
}
|
||||
else if (ch == #'*' && JSC$lexer_peek_char (stream) == #'=')
|
||||
{
|
||||
stream.readByte ();
|
||||
return JSC$tMULA;
|
||||
}
|
||||
else if (ch == #'/' && JSC$lexer_peek_char (stream) == #'=')
|
||||
{
|
||||
stream.readByte ();
|
||||
return JSC$tDIVA;
|
||||
}
|
||||
else if (ch == #'%' && JSC$lexer_peek_char (stream) == #'=')
|
||||
{
|
||||
stream.readByte ();
|
||||
return JSC$tMODA;
|
||||
}
|
||||
else if (ch == #'+' && JSC$lexer_peek_char (stream) == #'=')
|
||||
{
|
||||
stream.readByte ();
|
||||
return JSC$tADDA;
|
||||
}
|
||||
else if (ch == #'-' && JSC$lexer_peek_char (stream) == #'=')
|
||||
{
|
||||
stream.readByte ();
|
||||
return JSC$tSUBA;
|
||||
}
|
||||
else if (ch == #'&' && JSC$lexer_peek_char (stream) == #'=')
|
||||
{
|
||||
stream.readByte ();
|
||||
return JSC$tANDA;
|
||||
}
|
||||
else if (ch == #'^' && JSC$lexer_peek_char (stream) == #'=')
|
||||
{
|
||||
stream.readByte ();
|
||||
return JSC$tXORA;
|
||||
}
|
||||
else if (ch == #'|' && JSC$lexer_peek_char (stream) == #'=')
|
||||
{
|
||||
stream.readByte ();
|
||||
return JSC$tORA;
|
||||
}
|
||||
else if (ch == #'<' && JSC$lexer_peek_char (stream) == #'<')
|
||||
{
|
||||
stream.readByte ();
|
||||
if (JSC$lexer_peek_char (stream) == #'=')
|
||||
{
|
||||
stream.readByte ();
|
||||
return JSC$tLSIA;
|
||||
}
|
||||
else
|
||||
return JSC$tLSHIFT;
|
||||
}
|
||||
else if (ch == #'>' && JSC$lexer_peek_char (stream) == #'>')
|
||||
{
|
||||
stream.readByte ();
|
||||
ch2 = JSC$lexer_peek_char (stream);
|
||||
if (ch2 == #'=')
|
||||
{
|
||||
stream.readByte ();
|
||||
return JSC$tRSIA;
|
||||
}
|
||||
else if (ch2 == #'>')
|
||||
{
|
||||
stream.readByte ();
|
||||
if (JSC$lexer_peek_char (stream) == #'=')
|
||||
{
|
||||
stream.readByte ();
|
||||
return JSC$tRRSA;
|
||||
}
|
||||
else
|
||||
return JSC$tRRSHIFT;
|
||||
}
|
||||
else
|
||||
return JSC$tRSHIFT;
|
||||
}
|
||||
|
||||
/* Identifiers and keywords. */
|
||||
else if (JSC$lexer_is_identifier_letter (ch))
|
||||
{
|
||||
/* An identifier. */
|
||||
var id = String.fromCharCode (ch);
|
||||
|
||||
while ((ch = stream.readByte ()) != -1
|
||||
&& (JSC$lexer_is_identifier_letter (ch)
|
||||
|| JSC$lexer_is_decimal_digit (ch)))
|
||||
id.append (File.byteToString (ch));
|
||||
stream.ungetByte (ch);
|
||||
|
||||
/* Keywords. */
|
||||
if (id == "break")
|
||||
return JSC$tBREAK;
|
||||
else if (id == "continue")
|
||||
return JSC$tCONTINUE;
|
||||
else if (id == "delete")
|
||||
return JSC$tDELETE;
|
||||
else if (id == "else")
|
||||
return JSC$tELSE;
|
||||
else if (id == "for")
|
||||
return JSC$tFOR;
|
||||
else if (id == "function")
|
||||
return JSC$tFUNCTION;
|
||||
else if (id == "if")
|
||||
return JSC$tIF;
|
||||
else if (id == "in")
|
||||
return JSC$tIN;
|
||||
else if (id == "new")
|
||||
return JSC$tNEW;
|
||||
else if (id == "return")
|
||||
return JSC$tRETURN;
|
||||
else if (id == "this")
|
||||
return JSC$tTHIS;
|
||||
else if (id == "typeof")
|
||||
return JSC$tTYPEOF;
|
||||
else if (id == "var")
|
||||
return JSC$tVAR;
|
||||
else if (id == "void")
|
||||
return JSC$tVOID;
|
||||
else if (id == "while")
|
||||
return JSC$tWHILE;
|
||||
else if (id == "with")
|
||||
return JSC$tWITH;
|
||||
|
||||
/*
|
||||
* Future reserved keywords (some of these is already in use
|
||||
* in this implementation).
|
||||
*/
|
||||
else if (id == "case")
|
||||
return JSC$tCASE;
|
||||
else if (id == "catch")
|
||||
return JSC$tCATCH;
|
||||
else if (id == "class")
|
||||
return JSC$tCLASS;
|
||||
else if (id == "const")
|
||||
return JSC$tCONST;
|
||||
else if (id == "debugger")
|
||||
return JSC$tDEBUGGER;
|
||||
else if (id == "default")
|
||||
return JSC$tDEFAULT;
|
||||
else if (id == "do")
|
||||
return JSC$tDO;
|
||||
else if (id == "enum")
|
||||
return JSC$tENUM;
|
||||
else if (id == "export")
|
||||
return JSC$tEXPORT;
|
||||
else if (id == "extends")
|
||||
return JSC$tEXTENDS;
|
||||
else if (id == "finally")
|
||||
return JSC$tFINALLY;
|
||||
else if (id == "import")
|
||||
return JSC$tIMPORT;
|
||||
else if (id == "super")
|
||||
return JSC$tSUPER;
|
||||
else if (id == "switch")
|
||||
return JSC$tSWITCH;
|
||||
else if (id == "throw")
|
||||
return JSC$tTHROW;
|
||||
else if (id == "try")
|
||||
return JSC$tTRY;
|
||||
|
||||
/* Null and boolean literals. */
|
||||
else if (id == "null")
|
||||
return JSC$tNULL;
|
||||
else if (id == "true")
|
||||
return JSC$tTRUE;
|
||||
else if (id == "false")
|
||||
return JSC$tFALSE;
|
||||
else
|
||||
{
|
||||
/* It really is an identifier. */
|
||||
JSC$token_value = id;
|
||||
return JSC$tIDENTIFIER;
|
||||
}
|
||||
}
|
||||
|
||||
/* Character constants. */
|
||||
else if (ch == #'#' && JSC$lexer_peek_char (stream) == #'\'')
|
||||
{
|
||||
/* Skip the starting #'\'' and read more. */
|
||||
stream.readByte ();
|
||||
|
||||
ch = stream.readByte ();
|
||||
if (ch == #'\\')
|
||||
{
|
||||
JSC$token_value
|
||||
= JSC$lexer_read_backslash_escape (stream, 0, "character");
|
||||
|
||||
if (stream.readByte () != #'\'')
|
||||
error (JSC$filename + ":" + JSC$linenum.toString ()
|
||||
+ ": malformed character constant");
|
||||
}
|
||||
else if (JSC$lexer_peek_char (stream) == #'\'')
|
||||
{
|
||||
stream.readByte ();
|
||||
JSC$token_value = ch;
|
||||
}
|
||||
else
|
||||
error (JSC$filename + ":" + JSC$linenum.toString ()
|
||||
+ ": malformed character constant");
|
||||
|
||||
return JSC$tINTEGER;
|
||||
}
|
||||
|
||||
/* Octal and hex numbers. */
|
||||
else if (ch == #'0'
|
||||
&& JSC$lexer_peek_char (stream) != #'.'
|
||||
&& JSC$lexer_peek_char (stream) != #'e'
|
||||
&& JSC$lexer_peek_char (stream) != #'E')
|
||||
{
|
||||
JSC$token_value = 0;
|
||||
ch = stream.readByte ();
|
||||
if (ch == #'x' || ch == #'X')
|
||||
{
|
||||
ch = stream.readByte ();
|
||||
while (JSC$lexer_is_hex_digit (ch))
|
||||
{
|
||||
JSC$token_value *= 16;
|
||||
JSC$token_value += JSC$lexer_hex_to_dec (ch);
|
||||
ch = stream.readByte ();
|
||||
}
|
||||
stream.ungetByte (ch);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (JSC$lexer_is_octal_digit (ch))
|
||||
{
|
||||
JSC$token_value *= 8;
|
||||
JSC$token_value += ch - #'0';
|
||||
ch = stream.readByte ();
|
||||
}
|
||||
stream.ungetByte (ch);
|
||||
}
|
||||
|
||||
return JSC$tINTEGER;
|
||||
}
|
||||
|
||||
/* Decimal numbers. */
|
||||
else if (JSC$lexer_is_decimal_digit (ch)
|
||||
|| (ch == #'.'
|
||||
&& JSC$lexer_is_decimal_digit (
|
||||
JSC$lexer_peek_char (stream))))
|
||||
{
|
||||
var is_float = false;
|
||||
var buf = new String (File.byteToString (ch));
|
||||
var accept_dot = true;
|
||||
|
||||
if (ch == #'.')
|
||||
{
|
||||
/*
|
||||
* We started with #'.' and we know that the next character
|
||||
* is a decimal digit (we peeked it).
|
||||
*/
|
||||
is_float = true;
|
||||
|
||||
ch = stream.readByte ();
|
||||
while (JSC$lexer_is_decimal_digit (ch))
|
||||
{
|
||||
buf.append (File.byteToString (ch));
|
||||
ch = stream.readByte ();
|
||||
}
|
||||
accept_dot = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We did start with a decimal digit. */
|
||||
ch = stream.readByte ();
|
||||
while (JSC$lexer_is_decimal_digit (ch))
|
||||
{
|
||||
buf.append (File.byteToString (ch));
|
||||
ch = stream.readByte ();
|
||||
}
|
||||
}
|
||||
|
||||
if ((accept_dot && ch == #'.')
|
||||
|| ch == #'e' || ch == #'E')
|
||||
{
|
||||
is_float = true;
|
||||
|
||||
if (ch == #'.')
|
||||
{
|
||||
buf.append (File.byteToString (ch));
|
||||
ch = stream.readByte ();
|
||||
while (JSC$lexer_is_decimal_digit (ch))
|
||||
{
|
||||
buf.append (File.byteToString (ch));
|
||||
ch = stream.readByte ();
|
||||
}
|
||||
}
|
||||
|
||||
if (ch == #'e' || ch == #'E')
|
||||
{
|
||||
buf.append (File.byteToString (ch));
|
||||
ch = stream.readByte ();
|
||||
if (ch == #'+' || ch == #'-')
|
||||
{
|
||||
buf.append (File.byteToString (ch));
|
||||
ch = stream.readByte ();
|
||||
}
|
||||
if (!JSC$lexer_is_decimal_digit (ch))
|
||||
error (JSC$filename + ":" + JSC$linenum.toString ()
|
||||
+ ": malformed exponent part in a decimal literal");
|
||||
|
||||
while (JSC$lexer_is_decimal_digit (ch))
|
||||
{
|
||||
buf.append (File.byteToString (ch));
|
||||
ch = stream.readByte ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Finally, we put the last character pack to the stream. */
|
||||
stream.ungetByte (ch);
|
||||
|
||||
if (is_float)
|
||||
{
|
||||
JSC$token_value = parseFloat (buf);
|
||||
return JSC$tFLOAT;
|
||||
}
|
||||
|
||||
JSC$token_value = parseInt (buf);
|
||||
return JSC$tINTEGER;
|
||||
}
|
||||
|
||||
/* Just return the character as-is. */
|
||||
else
|
||||
return ch;
|
||||
}
|
||||
|
||||
/* EOF reached. */
|
||||
return JSC$tEOF;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Help functions.
|
||||
*/
|
||||
|
||||
function JSC$lexer_peek_char (stream)
|
||||
{
|
||||
var ch2 = stream.readByte ();
|
||||
stream.ungetByte (ch2);
|
||||
|
||||
return ch2;
|
||||
}
|
||||
|
||||
|
||||
function JSC$lexer_is_identifier_letter (ch)
|
||||
{
|
||||
return ((#'a' <= ch && ch <= #'z') || (#'A' <= ch && ch <= #'Z')
|
||||
|| ch == #'$' || ch == #'_');
|
||||
}
|
||||
|
||||
|
||||
function JSC$lexer_is_octal_digit (ch)
|
||||
{
|
||||
return (#'0' <= ch && ch <= #'7');
|
||||
}
|
||||
|
||||
|
||||
function JSC$lexer_is_decimal_digit (ch)
|
||||
{
|
||||
return #'0' <= ch && ch <= #'9';
|
||||
}
|
||||
|
||||
|
||||
function JSC$lexer_is_hex_digit (ch)
|
||||
{
|
||||
return ((#'0' <= ch && ch <= #'9')
|
||||
|| (#'a' <= ch && ch <= #'f')
|
||||
|| (#'A' <= ch && ch <= #'F'));
|
||||
}
|
||||
|
||||
|
||||
function JSC$lexer_is_white_space (ch)
|
||||
{
|
||||
return (ch == #' ' || ch == #'\t' || ch == #'\v' || ch == #'\r'
|
||||
|| ch == #'\f' || ch == #'\n');
|
||||
}
|
||||
|
||||
|
||||
function JSC$lexer_hex_to_dec (ch)
|
||||
{
|
||||
return ((#'0' <= ch && ch <= #'9')
|
||||
? ch - #'0'
|
||||
: ((#'a' <= ch && ch <= #'f')
|
||||
? 10 + ch - #'a'
|
||||
: 10 + ch - #'A'));
|
||||
}
|
||||
|
||||
|
||||
function JSC$lexer_read_backslash_escape (stream, possible_start, name)
|
||||
{
|
||||
var ch = stream.readByte ();
|
||||
|
||||
if (ch == #'n')
|
||||
ch = #'\n';
|
||||
else if (ch == #'t')
|
||||
ch = #'\t';
|
||||
else if (ch == #'v')
|
||||
ch = #'\v';
|
||||
else if (ch == #'b')
|
||||
ch = #'\b';
|
||||
else if (ch == #'r')
|
||||
ch = #'\r';
|
||||
else if (ch == #'f')
|
||||
ch = #'\f';
|
||||
else if (ch == #'a')
|
||||
ch = #'\a';
|
||||
else if (ch == #'\\')
|
||||
ch = #'\\';
|
||||
else if (ch == #'?')
|
||||
ch = #'?';
|
||||
else if (ch == #'\'')
|
||||
ch = #'\'';
|
||||
else if (ch == #'"')
|
||||
ch = #'"';
|
||||
else if (ch == #'x')
|
||||
{
|
||||
/* HexEscapeSequence. */
|
||||
var c1, c2;
|
||||
|
||||
c1 = stream.readByte ();
|
||||
c2 = stream.readByte ();
|
||||
|
||||
if (c1 == -1 || c2 == -1)
|
||||
JSC$lexer_eof_in_constant (possible_start, name);
|
||||
|
||||
if (!JSC$lexer_is_hex_digit (c1) || !JSC$lexer_is_hex_digit (c2))
|
||||
error (JSC$filename + ":" + JSC$linenum.toString ()
|
||||
+ ": \\x used with no following hex digits");
|
||||
|
||||
ch = (JSC$lexer_hex_to_dec (c1) << 4) + JSC$lexer_hex_to_dec (c2);
|
||||
}
|
||||
else if (ch == #'u')
|
||||
{
|
||||
/* UnicodeEscapeSequence. */
|
||||
var c1, c2, c3, c4;
|
||||
|
||||
c1 = stream.readByte ();
|
||||
c2 = stream.readByte ();
|
||||
c3 = stream.readByte ();
|
||||
c4 = stream.readByte ();
|
||||
|
||||
if (c1 == -1 || c2 == -1 || c3 == -1 || c4 == -1)
|
||||
JSC$lexer_eof_in_constant (possible_start, name);
|
||||
|
||||
if (!JSC$lexer_is_hex_digit (c1) || !JSC$lexer_is_hex_digit (c2)
|
||||
|| !JSC$lexer_is_hex_digit (c3) || !JSC$lexer_is_hex_digit (c4))
|
||||
error (JSC$filename + ":" + JSC$linenum.toString ()
|
||||
+ ": \\u used with no following hex digits");
|
||||
|
||||
ch = ((JSC$lexer_hex_to_dec (c1) << 12)
|
||||
+ (JSC$lexer_hex_to_dec (c2) << 8)
|
||||
+ (JSC$lexer_hex_to_dec (c3) << 4)
|
||||
+ JSC$lexer_hex_to_dec (c4));
|
||||
}
|
||||
else if (JSC$lexer_is_octal_digit (ch))
|
||||
{
|
||||
var result = ch - #'0';
|
||||
var i = 1;
|
||||
|
||||
if (ch == #'0')
|
||||
/* Allow three octal digits after '0'. */
|
||||
i = 0;
|
||||
|
||||
ch = stream.readByte ();
|
||||
while (i < 3 && JSC$lexer_is_octal_digit (ch))
|
||||
{
|
||||
result *= 8;
|
||||
result += ch - #'0';
|
||||
ch = stream.readByte ();
|
||||
i++;
|
||||
}
|
||||
stream.ungetByte (ch);
|
||||
ch = result;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ch == -1)
|
||||
error (JSC$filename + ":" + JSC$linenum.toString ()
|
||||
+ ": unterminated " + name);
|
||||
|
||||
JSC$warning (JSC$filename + ":" + JSC$linenum.toString ()
|
||||
+ ": warning: unknown escape sequence `\\"
|
||||
+ File.byteToString (ch) + "'");
|
||||
}
|
||||
|
||||
return ch;
|
||||
}
|
||||
|
||||
|
||||
function JSC$lexer_read_string (stream, name, ender)
|
||||
{
|
||||
var str = new String ("");
|
||||
var done = false, ch;
|
||||
var possible_start_ln = JSC$linenum;
|
||||
var warned_line_terminator = false;
|
||||
|
||||
while (!done)
|
||||
{
|
||||
ch = stream.readByte ();
|
||||
if (ch == #'\n')
|
||||
{
|
||||
if (JSC$warn_strict_ecma && !warned_line_terminator)
|
||||
{
|
||||
JSC$warning (JSC$filename + ":" + JSC$linenum.toString ()
|
||||
+ ": warning: ECMAScript don't allow line terminators in "
|
||||
+ name + " constants");
|
||||
warned_line_terminator = true;
|
||||
}
|
||||
JSC$linenum++;
|
||||
}
|
||||
|
||||
if (ch == -1)
|
||||
JSC$lexer_eof_in_constant (possible_start_ln, name);
|
||||
|
||||
else if (ch == ender)
|
||||
done = true;
|
||||
else
|
||||
{
|
||||
if (ch == #'\\')
|
||||
{
|
||||
if (JSC$lexer_peek_char (stream) == #'\n')
|
||||
{
|
||||
/*
|
||||
* Backslash followed by a newline character. Ignore
|
||||
* them both.
|
||||
*/
|
||||
stream.readByte ();
|
||||
JSC$linenum++;
|
||||
continue;
|
||||
}
|
||||
ch = JSC$lexer_read_backslash_escape (stream, possible_start_ln,
|
||||
name);
|
||||
}
|
||||
str.append (ch);
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
function JSC$lexer_read_regexp_constant (stream)
|
||||
{
|
||||
/* Regexp literal. */
|
||||
var source = JSC$lexer_read_regexp_source (stream);
|
||||
|
||||
/* Check the possible flags. */
|
||||
var flags = new String ("");
|
||||
while ((ch = JSC$lexer_peek_char (stream)) == #'g' || ch == #'i')
|
||||
{
|
||||
stream.readByte ();
|
||||
flags.append (File.byteToString (ch));
|
||||
}
|
||||
|
||||
/* Try to compile it. */
|
||||
var msg = false;
|
||||
var result;
|
||||
try
|
||||
{
|
||||
result = new RegExp (source, flags);
|
||||
}
|
||||
catch (msg)
|
||||
{
|
||||
var start = msg.lastIndexOf (":");
|
||||
msg = (JSC$filename + ":" + JSC$token_linenum.toString ()
|
||||
+ ": malformed regular expression constant:"
|
||||
+ msg.substr (start + 1));
|
||||
}
|
||||
if (msg)
|
||||
error (msg);
|
||||
|
||||
/* Success. */
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
function JSC$lexer_read_regexp_source (stream)
|
||||
{
|
||||
var str = new String ("");
|
||||
var done = false, ch;
|
||||
var possible_start_ln = JSC$linenum;
|
||||
var warned_line_terminator = false;
|
||||
var name = "regular expression";
|
||||
|
||||
while (!done)
|
||||
{
|
||||
ch = stream.readByte ();
|
||||
if (ch == #'\n')
|
||||
{
|
||||
if (JSC$warn_strict_ecma && !warned_line_terminator)
|
||||
{
|
||||
JSC$warning (JSC$filename + ":" + JSC$linenum.toString ()
|
||||
+ ": warning: ECMAScript don't allow line "
|
||||
+ "terminators in " + name + " constants");
|
||||
warned_line_terminator = true;
|
||||
}
|
||||
JSC$linenum++;
|
||||
}
|
||||
|
||||
if (ch == -1)
|
||||
JSC$lexer_eof_in_constant (possible_start_ln, name);
|
||||
|
||||
else if (ch == #'/')
|
||||
done = true;
|
||||
else
|
||||
{
|
||||
if (ch == #'\\')
|
||||
{
|
||||
ch = stream.readByte ();
|
||||
if (ch == #'\n')
|
||||
{
|
||||
/*
|
||||
* Backslash followed by a newline character. Ignore
|
||||
* them both.
|
||||
*/
|
||||
JSC$linenum++;
|
||||
continue;
|
||||
}
|
||||
if (ch == -1)
|
||||
JSC$lexer_eof_in_constant (possible_start_ln, name);
|
||||
|
||||
/* Handle the backslash escapes. */
|
||||
if (ch == #'f')
|
||||
ch = #'\f';
|
||||
else if (ch == #'n')
|
||||
ch = #'\n';
|
||||
else if (ch == #'r')
|
||||
ch = #'\r';
|
||||
else if (ch == #'t')
|
||||
ch = #'\t';
|
||||
else if (ch == #'v')
|
||||
ch == #'\v';
|
||||
else if (ch == #'c')
|
||||
{
|
||||
/* SourceCharacter. */
|
||||
ch = stream.readByte ();
|
||||
if (ch == -1)
|
||||
JSC$lexer_eof_in_constant (possible_start_ln, name);
|
||||
|
||||
if (ch == #'\n' && JSC$warn_strict_ecma)
|
||||
JSC$warning (JSC$filename + ":" + JSC$linenum.toString ()
|
||||
+ ": warning: ECMAScript don't allow line termiantor after \\c in regular expression constants");
|
||||
|
||||
/*
|
||||
* Append the source-character escape start. The ch
|
||||
* will be appended later.
|
||||
*/
|
||||
str.append ("\\c");
|
||||
}
|
||||
else if (ch == #'u' || ch == #'x' || ch == #'0')
|
||||
{
|
||||
/* These can be handled with the read_backslash_escape(). */
|
||||
stream.ungetByte (ch);
|
||||
ch = JSC$lexer_read_backslash_escape (stream);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Nothing special. Leave it to the result as-is.
|
||||
* The regular expression backage will handle it.
|
||||
*/
|
||||
stream.ungetByte (ch);
|
||||
ch = #'\\';
|
||||
}
|
||||
}
|
||||
str.append (File.byteToString (ch));
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
function JSC$lexer_eof_in_constant (possible_start, name)
|
||||
{
|
||||
var msg = (JSC$filename + ":" + JSC$linenum.toString ()
|
||||
+ ": unterminated " + name + " constant");
|
||||
|
||||
if (possible_start > 0)
|
||||
msg += (System.lineBreakSequence
|
||||
+ JSC$filename + ":" + possible_start.toString ()
|
||||
+ ": possible real start of unterminated " + name + " constant");
|
||||
|
||||
error (msg);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
mode: c
|
||||
End:
|
||||
*/
|
||||
@@ -1,161 +0,0 @@
|
||||
/*
|
||||
* Namespace handling.
|
||||
* Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
*
|
||||
* Author: Markku Rossi <mtr@ngs.fi>
|
||||
*/
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
* MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Source: /cygdrive/c/RCVS/CVS/ReactOS/reactos/lib/kjs/jsc/namespace.js,v $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Global functions.
|
||||
*/
|
||||
|
||||
JSC$SCOPE_ARG = 1;
|
||||
JSC$SCOPE_LOCAL = 2;
|
||||
|
||||
function JSC$NameSpace ()
|
||||
{
|
||||
this.frame = new JSC$NameSpaceFrame ();
|
||||
this.push_frame = JSC$NameSpace_push_frame;
|
||||
this.pop_frame = JSC$NameSpace_pop_frame;
|
||||
this.alloc_local = JSC$NameSpace_alloc_local;
|
||||
this.define_symbol = JSC$NameSpace_define_symbol;
|
||||
this.lookup_symbol = JSC$NameSpace_lookup_symbol;
|
||||
}
|
||||
|
||||
|
||||
function JSC$NameSpace_push_frame ()
|
||||
{
|
||||
var f = new JSC$NameSpaceFrame ();
|
||||
|
||||
f.num_locals = this.frame.num_locals;
|
||||
|
||||
f.next = this.frame;
|
||||
this.frame = f;
|
||||
}
|
||||
|
||||
|
||||
function JSC$NameSpace_pop_frame ()
|
||||
{
|
||||
var i;
|
||||
|
||||
for (i = this.frame.defs; i != null; i = i.next)
|
||||
if (i.usecount == 0)
|
||||
{
|
||||
if (i.scope == JSC$SCOPE_ARG)
|
||||
{
|
||||
if (JSC$warn_unused_argument)
|
||||
JSC$warning (JSC$filename + ":" + i.linenum.toString ()
|
||||
+ ": warning: unused argument `" + i.symbol + "'");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (JSC$warn_unused_variable)
|
||||
JSC$warning (JSC$filename + ":" + i.linenum.toString ()
|
||||
+ ": warning: unused variable `" + i.symbol + "'");
|
||||
}
|
||||
}
|
||||
|
||||
this.frame = this.frame.next;
|
||||
}
|
||||
|
||||
|
||||
function JSC$NameSpace_alloc_local ()
|
||||
{
|
||||
return this.frame.num_locals++;
|
||||
}
|
||||
|
||||
|
||||
function JSC$NameSpace_define_symbol (symbol, scope, value, linenum)
|
||||
{
|
||||
var i;
|
||||
|
||||
for (i = this.frame.defs; i != null; i = i.next)
|
||||
if (i.symbol == symbol)
|
||||
{
|
||||
if (i.scope == scope)
|
||||
error (JSC$filename + ":" + i.linenum.toString()
|
||||
+ ": redeclaration of `" + i.symbol + "'");
|
||||
if (i.scope == JSC$SCOPE_ARG && JSC$warn_shadow)
|
||||
JSC$warning (JSC$filename + ":" + linenum.toString ()
|
||||
+ ": warning: declaration of `" + symbol
|
||||
+ "' shadows a parameter");
|
||||
|
||||
i.scope = scope;
|
||||
i.value = value;
|
||||
i.linenum = linenum;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Create a new definition. */
|
||||
i = new JSC$SymbolDefinition (symbol, scope, value, linenum);
|
||||
i.next = this.frame.defs;
|
||||
this.frame.defs = i;
|
||||
}
|
||||
|
||||
|
||||
function JSC$NameSpace_lookup_symbol (symbol)
|
||||
{
|
||||
var f, i;
|
||||
|
||||
for (f = this.frame; f != null; f = f.next)
|
||||
for (i = f.defs; i != null; i = i.next)
|
||||
if (i.symbol == symbol)
|
||||
{
|
||||
i.usecount++;
|
||||
return i;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* Static helpers.
|
||||
*/
|
||||
|
||||
function JSC$NameSpaceFrame ()
|
||||
{
|
||||
this.next = null;
|
||||
this.defs = null;
|
||||
this.num_locals = 0;
|
||||
}
|
||||
|
||||
|
||||
function JSC$SymbolDefinition (symbol, scope, value, linenum)
|
||||
{
|
||||
this.next = null;
|
||||
this.symbol = symbol;
|
||||
this.scope = scope;
|
||||
this.value = value;
|
||||
this.linenum = linenum;
|
||||
this.usecount = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
mode: c
|
||||
End:
|
||||
*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,173 +0,0 @@
|
||||
/*
|
||||
* Input stream definitions.
|
||||
* Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
*
|
||||
* Author: Markku Rossi <mtr@ngs.fi>
|
||||
*/
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
* MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Source: /cygdrive/c/RCVS/CVS/ReactOS/reactos/lib/kjs/jsc/streams.js,v $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* File stream.
|
||||
*/
|
||||
|
||||
function JSC$StreamFile (name)
|
||||
{
|
||||
this.name = name;
|
||||
this.stream = new File (name);
|
||||
this.error = "";
|
||||
|
||||
this.open = JSC$StreamFile_open;
|
||||
this.close = JSC$StreamFile_close;
|
||||
this.rewind = JSC$StreamFile_rewind;
|
||||
this.readByte = JSC$StreamFile_read_byte;
|
||||
this.ungetByte = JSC$StreamFile_unget_byte;
|
||||
this.readln = JSC$StreamFile_readln;
|
||||
}
|
||||
|
||||
|
||||
function JSC$StreamFile_open ()
|
||||
{
|
||||
if (!this.stream.open ("r"))
|
||||
{
|
||||
this.error = System.strerror (System.errno);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function JSC$StreamFile_close ()
|
||||
{
|
||||
return this.stream.close ();
|
||||
}
|
||||
|
||||
|
||||
function JSC$StreamFile_rewind ()
|
||||
{
|
||||
return this.stream.setPosition (0);
|
||||
}
|
||||
|
||||
|
||||
function JSC$StreamFile_read_byte ()
|
||||
{
|
||||
return this.stream.readByte ();
|
||||
}
|
||||
|
||||
|
||||
function JSC$StreamFile_unget_byte (byte)
|
||||
{
|
||||
this.stream.ungetByte (byte);
|
||||
}
|
||||
|
||||
|
||||
function JSC$StreamFile_readln ()
|
||||
{
|
||||
return this.stream.readln ();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* String stream.
|
||||
*/
|
||||
|
||||
function JSC$StreamString (str)
|
||||
{
|
||||
this.name = "StringStream";
|
||||
this.string = str;
|
||||
this.pos = 0;
|
||||
this.unget_byte = -1;
|
||||
this.error = "";
|
||||
|
||||
this.open = JSC$StreamString_open;
|
||||
this.close = JSC$StreamString_close;
|
||||
this.rewind = JSC$StreamString_rewind;
|
||||
this.readByte = JSC$StreamString_read_byte;
|
||||
this.ungetByte = JSC$StreamString_unget_byte;
|
||||
this.readln = JSC$StreamString_readln;
|
||||
}
|
||||
|
||||
|
||||
function JSC$StreamString_open ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function JSC$StreamString_close ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function JSC$StreamString_rewind ()
|
||||
{
|
||||
this.pos = 0;
|
||||
this.unget_byte = -1;
|
||||
this.error = "";
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function JSC$StreamString_read_byte ()
|
||||
{
|
||||
var ch;
|
||||
|
||||
if (this.unget_byte >= 0)
|
||||
{
|
||||
ch = this.unget_byte;
|
||||
this.unget_byte = -1;
|
||||
return ch;
|
||||
}
|
||||
|
||||
if (this.pos >= this.string.length)
|
||||
return -1;
|
||||
|
||||
return this.string.charCodeAt (this.pos++);
|
||||
}
|
||||
|
||||
|
||||
function JSC$StreamString_unget_byte (byte)
|
||||
{
|
||||
this.unget_byte = byte;
|
||||
}
|
||||
|
||||
|
||||
function JSC$StreamString_readln ()
|
||||
{
|
||||
var line = new String ("");
|
||||
var ch;
|
||||
|
||||
while ((ch = this.readByte ()) != -1 && ch != #'\n')
|
||||
line.append (String.pack ("C", ch));
|
||||
|
||||
return line;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
mode: c
|
||||
End:
|
||||
*/
|
||||
@@ -1,11 +0,0 @@
|
||||
1998-11-25 Markku Rossi <[email protected]>
|
||||
|
||||
* asci.test: Fixed to work when the builddir != srcdir.
|
||||
|
||||
1998-08-11 Markku Rossi <[email protected]>
|
||||
|
||||
* asci.test: Added test for the automatic semicolon insertion.
|
||||
|
||||
1998-03-26 Markku Rossi <[email protected]>
|
||||
|
||||
* Makefile.am: Created tests for the JavaScript compiler.
|
||||
@@ -1,28 +0,0 @@
|
||||
#
|
||||
# Automakefile for JavaScript compiler tests.
|
||||
# Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
#
|
||||
# Author: Markku Rossi <[email protected]>
|
||||
#
|
||||
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
#
|
||||
# along with this program; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
#
|
||||
|
||||
TESTS = compile.test asci.test
|
||||
|
||||
EXTRA_DIST = defs $(TESTS) asci.js
|
||||
@@ -1,223 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
#
|
||||
# Automakefile for JavaScript compiler tests.
|
||||
# Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
#
|
||||
# Author: Markku Rossi <[email protected]>
|
||||
#
|
||||
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
#
|
||||
# along with this program; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
#
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ../..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
ACLOCAL_FLAGS_FOR_LIBTOOL = @ACLOCAL_FLAGS_FOR_LIBTOOL@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
EXTENSIONS = @EXTENSIONS@
|
||||
EXTENSIONS_LIBS = @EXTENSIONS_LIBS@
|
||||
INTERPRETER_FEATURES = @INTERPRETER_FEATURES@
|
||||
LD = @LD@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
NM = @NM@
|
||||
PACKAGE = @PACKAGE@
|
||||
PGCC_BY_PROVENZANO = @PGCC_BY_PROVENZANO@
|
||||
RANLIB = @RANLIB@
|
||||
U = @U@
|
||||
VERSION = @VERSION@
|
||||
XLC_R_AIX = @XLC_R_AIX@
|
||||
|
||||
TESTS = compile.test asci.test
|
||||
|
||||
EXTRA_DIST = defs $(TESTS) asci.js
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../../jsconfig.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_COMMON = ChangeLog Makefile.am Makefile.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
all: Makefile
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps jsc/tests/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = jsc/tests
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
for tst in $(TESTS); do \
|
||||
if test -f $$tst; then dir=.; \
|
||||
else dir="$(srcdir)"; fi; \
|
||||
if $(TESTS_ENVIRONMENT) $$dir/$$tst; then \
|
||||
all=`expr $$all + 1`; \
|
||||
echo "PASS: $$tst"; \
|
||||
elif test $$? -ne 77; then \
|
||||
all=`expr $$all + 1`; \
|
||||
failed=`expr $$failed + 1`; \
|
||||
echo "FAIL: $$tst"; \
|
||||
fi; \
|
||||
done; \
|
||||
if test "$$failed" -eq 0; then \
|
||||
banner="All $$all tests passed"; \
|
||||
else \
|
||||
banner="$$failed of $$all tests failed"; \
|
||||
fi; \
|
||||
dashes=`echo "$$banner" | sed s/./=/g`; \
|
||||
echo "$$dashes"; \
|
||||
echo "$$banner"; \
|
||||
echo "$$dashes"; \
|
||||
test "$$failed" -eq 0
|
||||
info:
|
||||
dvi:
|
||||
check: all
|
||||
$(MAKE) check-TESTS
|
||||
installcheck:
|
||||
install-exec:
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install-data:
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-exec install-data all
|
||||
@:
|
||||
|
||||
uninstall:
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-generic
|
||||
|
||||
clean: clean-generic mostlyclean
|
||||
|
||||
distclean: distclean-generic clean
|
||||
-rm -f config.status
|
||||
-rm -f libtool
|
||||
|
||||
maintainer-clean: maintainer-clean-generic distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
.PHONY: tags distdir check-TESTS info dvi installcheck install-exec \
|
||||
install-data install uninstall all installdirs mostlyclean-generic \
|
||||
distclean-generic clean-generic maintainer-clean-generic clean \
|
||||
mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -1,44 +0,0 @@
|
||||
function t1 ()
|
||||
{
|
||||
1
|
||||
}
|
||||
|
||||
function t2 ()
|
||||
{
|
||||
return
|
||||
}
|
||||
|
||||
function t3 ()
|
||||
{
|
||||
return a + b
|
||||
}
|
||||
|
||||
function t4 ()
|
||||
{
|
||||
return
|
||||
a + b
|
||||
}
|
||||
|
||||
function t5 ()
|
||||
{
|
||||
i
|
||||
++i;
|
||||
}
|
||||
|
||||
function t6 ()
|
||||
{
|
||||
i
|
||||
--i;
|
||||
}
|
||||
|
||||
t3 ()
|
||||
|
||||
{ 1
|
||||
2 } 3
|
||||
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
mode: c
|
||||
End:
|
||||
*/
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Test the automatic semicolon insertion.
|
||||
#
|
||||
|
||||
. $srcdir/defs || exit 1
|
||||
|
||||
ascifiles="asci.js"
|
||||
|
||||
name="asci.test"
|
||||
|
||||
# First, create the state 1 compiler.
|
||||
|
||||
rm -f jsc.js
|
||||
|
||||
for i in $jscsources; do
|
||||
cat $srcdir/../$i >> jsc.js
|
||||
done
|
||||
|
||||
echo "$name: creating the state 1 compiler"
|
||||
$js -Wall -O2 -c jsc.js
|
||||
mv jsc.jsc stage1.jsc
|
||||
|
||||
# Now, compile our asci test source files with the state 1 compiler.
|
||||
|
||||
for i in $ascifiles; do
|
||||
$js --load stage1.jsc --file $srcdir/../bs.js $srcdir/$i
|
||||
done
|
||||
|
||||
# Finally, cleanup.
|
||||
|
||||
rm -f a.jas a.jsc jsc.js stage1.jsc
|
||||
@@ -1,50 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Compile the compiler source a couple of times.
|
||||
#
|
||||
|
||||
. $srcdir/defs || exit 1
|
||||
|
||||
name="compile.test"
|
||||
|
||||
# First, create the compiler source file.
|
||||
|
||||
rm -f jsc.js
|
||||
|
||||
for i in $jscsources; do
|
||||
cat $srcdir/../$i >> jsc.js
|
||||
done
|
||||
|
||||
# Second, compile the source to the stage one compiler.
|
||||
|
||||
echo "$name: creating the stage 1 compiler"
|
||||
$js -Wall -O2 -c jsc.js
|
||||
mv jsc.jsc stage1.jsc
|
||||
|
||||
# Third, compile the stage two compiler with our new compiler.
|
||||
|
||||
echo "$name: creating the stage 2 compiler"
|
||||
$js --load stage1.jsc --file $srcdir/../bs.js jsc.js
|
||||
mv a.jsc stage2.jsc
|
||||
|
||||
# Fourth, compile stage three compiler.
|
||||
|
||||
echo "$name: creating the stage 3 compiler"
|
||||
$js --load stage2.jsc --file $srcdir/../bs.js jsc.js
|
||||
mv a.jsc stage3.jsc
|
||||
|
||||
# Fifth, cleanup.
|
||||
|
||||
rm -f a.jas jsc.js stage1.jsc
|
||||
|
||||
# Finally, check that stage2.jsc and stage3.jsc do not differ. If
|
||||
# they do, the there is something seriously broken.
|
||||
|
||||
cmp stage2.jsc stage3.jsc || {
|
||||
rm -f stage2.jsc stage3.jsc
|
||||
echo "error: the stage 2 and stage 3 compilers differ"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# All ok.
|
||||
rm -f stage2.jsc stage3.jsc
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Definitions for the JavaScript compiler testing environment.
|
||||
#
|
||||
|
||||
jscsources="defs.js lexer.js parser.js gram.js namespace.js \
|
||||
streams.js asm.js entry.js"
|
||||
|
||||
js="../../src/js"
|
||||
|
||||
# Check that $srcdir is set correctly.
|
||||
test -f $srcdir/defs || {
|
||||
echo "defs: installation error" 1>&2
|
||||
exit 1
|
||||
}
|
||||
@@ -1,167 +0,0 @@
|
||||
/* jsconfig.h.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Define if on AIX 3.
|
||||
System headers sometimes define this.
|
||||
We just want to avoid a redefinition error message. */
|
||||
#ifndef _ALL_SOURCE
|
||||
#undef _ALL_SOURCE
|
||||
#endif
|
||||
|
||||
/* Define if using alloca.c. */
|
||||
#undef C_ALLOCA
|
||||
|
||||
/* Define to empty if the keyword does not work. */
|
||||
#undef const
|
||||
|
||||
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
|
||||
This function is required for alloca.c support on those systems. */
|
||||
#undef CRAY_STACKSEG_END
|
||||
|
||||
/* Define if you have alloca, as a function or macro. */
|
||||
#undef HAVE_ALLOCA
|
||||
|
||||
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
|
||||
#undef HAVE_ALLOCA_H
|
||||
|
||||
/* Define as __inline if that's what the C compiler calls it. */
|
||||
#undef inline
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at run-time.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown
|
||||
*/
|
||||
#undef STACK_DIRECTION
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/*
|
||||
* Define the PACKAGE and VERSION only if they are undefined. This means
|
||||
* that we do not redefine them, when the library is used in another
|
||||
* GNU like package that defines PACKAGE and VERSION.
|
||||
*/
|
||||
|
||||
/* Package name. */
|
||||
#ifndef PACKAGE
|
||||
#undef PACKAGE
|
||||
#endif /* no PACKAGE */
|
||||
|
||||
/* Version number. */
|
||||
#ifndef VERSION
|
||||
#undef VERSION
|
||||
#endif /* no VERSION */
|
||||
|
||||
/* Are C prototypes supported. */
|
||||
#undef PROTOTYPES
|
||||
|
||||
/* Canonical host name and its parts. */
|
||||
#undef CANONICAL_HOST
|
||||
#undef CANONICAL_HOST_CPU
|
||||
#undef CANONICAL_HOST_VENDOR
|
||||
#undef CANONICAL_HOST_OS
|
||||
|
||||
/* Do we want to build all instruction dispatchers? */
|
||||
#undef ALL_DISPATCHERS
|
||||
|
||||
/* Do we want to profile byte-code operands. */
|
||||
#undef PROFILING
|
||||
|
||||
/* Do we want the byte-code operand hooks. */
|
||||
#undef BC_OPERAND_HOOKS
|
||||
|
||||
/*
|
||||
* Unconditionall disable the jumps byte-code instruction dispatch
|
||||
* method.
|
||||
*/
|
||||
#undef DISABLE_JUMPS
|
||||
|
||||
/* Does the struct stat has st_blksize member? */
|
||||
#undef HAVE_STAT_ST_ST_BLKSIZE
|
||||
|
||||
/* Does the struct stat has st_blocks member? */
|
||||
#undef HAVE_STAT_ST_ST_BLOCKS
|
||||
|
||||
/* Does the asctime_r() function take three arguments. */
|
||||
#undef ASCTIME_R_WITH_THREE_ARGS
|
||||
|
||||
/* Does the drand48_r() work with DRAND48D data. */
|
||||
#undef DRAND48_R_WITH_DRAND48D
|
||||
|
||||
/* How the attribute structures are passed to the init functions. */
|
||||
#undef CONDATTR_BY_VALUE
|
||||
#undef MUTEXATTR_BY_VALUE
|
||||
#undef THREADATTR_BY_VALUE
|
||||
|
||||
/* JS */
|
||||
#undef WITH_JS
|
||||
|
||||
/* Curses. */
|
||||
#undef WITH_CURSES
|
||||
#undef HAVE_CURSES_H
|
||||
#undef HAVE_NCURSES_H
|
||||
|
||||
/* MD5 */
|
||||
#undef WITH_MD5
|
||||
|
||||
/* The number of bytes in a int. */
|
||||
#undef SIZEOF_INT
|
||||
|
||||
/* The number of bytes in a long. */
|
||||
#undef SIZEOF_LONG
|
||||
|
||||
/* Define if you have the drand48 function. */
|
||||
#undef HAVE_DRAND48
|
||||
|
||||
/* Define if you have the lstat function. */
|
||||
#undef HAVE_LSTAT
|
||||
|
||||
/* Define if you have the pthread_attr_create function. */
|
||||
#undef HAVE_PTHREAD_ATTR_CREATE
|
||||
|
||||
/* Define if you have the pthread_attr_setscope function. */
|
||||
#undef HAVE_PTHREAD_ATTR_SETSCOPE
|
||||
|
||||
/* Define if you have the pthread_attr_setstacksize function. */
|
||||
#undef HAVE_PTHREAD_ATTR_SETSTACKSIZE
|
||||
|
||||
/* Define if you have the pthread_condattr_create function. */
|
||||
#undef HAVE_PTHREAD_CONDATTR_CREATE
|
||||
|
||||
/* Define if you have the pthread_condattr_init function. */
|
||||
#undef HAVE_PTHREAD_CONDATTR_INIT
|
||||
|
||||
/* Define if you have the pthread_mutexattr_create function. */
|
||||
#undef HAVE_PTHREAD_MUTEXATTR_CREATE
|
||||
|
||||
/* Define if you have the sleep function. */
|
||||
#undef HAVE_SLEEP
|
||||
|
||||
/* Define if you have the srand48 function. */
|
||||
#undef HAVE_SRAND48
|
||||
|
||||
/* Define if you have the usleep function. */
|
||||
#undef HAVE_USLEEP
|
||||
|
||||
/* Define if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define if you have the <errno.h> header file. */
|
||||
#undef HAVE_ERRNO_H
|
||||
|
||||
/* Define if you have the <float.h> header file. */
|
||||
#undef HAVE_FLOAT_H
|
||||
|
||||
/* Define if you have the <limits.h> header file. */
|
||||
#undef HAVE_LIMITS_H
|
||||
|
||||
/* Define if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
@@ -1,61 +0,0 @@
|
||||
1998-10-26 Markku Rossi <[email protected]>
|
||||
|
||||
* extract-op-names.js (main): Fixed to use the flags comments in
|
||||
the operands.def file.
|
||||
|
||||
1998-09-01 Markku Rossi <[email protected]>
|
||||
|
||||
* bc.js (ByteCode$parse): Added a more verbose error message for
|
||||
cases when the byte-code file is truncated.
|
||||
|
||||
1998-08-25 Markku Rossi <[email protected]>
|
||||
|
||||
* bc.js (ByteCode$prettyPrintString): Added support for some
|
||||
missing character escapes.
|
||||
|
||||
1998-08-14 Markku Rossi <[email protected]>
|
||||
|
||||
* bc.js: Added support for the regular expression constants.
|
||||
|
||||
1998-06-08 Markku Rossi <[email protected]>
|
||||
|
||||
* Changed all character constants to the new #'f' format.
|
||||
|
||||
1998-05-27 Markku Rossi <[email protected]>
|
||||
|
||||
* jsdas.1: Documented the command line options.
|
||||
|
||||
1998-05-25 Markku Rossi <[email protected]>
|
||||
|
||||
* main.js (main): Added option -S, --strip to remove the debug
|
||||
section.
|
||||
|
||||
1998-05-14 Markku Rossi <[email protected]>
|
||||
|
||||
* bc.js (ByteCode$printCode): Added support for the `try_push'
|
||||
operand.
|
||||
|
||||
1998-05-12 Markku Rossi <[email protected]>
|
||||
|
||||
* jsdas.1: Initial version of the manual page.
|
||||
|
||||
1998-05-11 Markku Rossi <[email protected]>
|
||||
|
||||
* bc.js (ByteCode$printCode): Added support for the
|
||||
`delete_property' operand.
|
||||
|
||||
1998-05-08 Markku Rossi <[email protected]>
|
||||
|
||||
* bc.js: Cleaned up the byte-code file handling.
|
||||
(ByteCode$printCode): Implemented byte-code printing.
|
||||
Implemented byte-code file mutators: linkSection(),
|
||||
removeSection() and write().
|
||||
|
||||
1998-05-07 Markku Rossi <[email protected]>
|
||||
|
||||
* Re-organized the das directory. Now the JavaScript disassembler
|
||||
is built automatically with the `all' target. It is a
|
||||
`bin_SCRIPTS' target so it gets installed when the JavaScript
|
||||
package is installed. The makefile also makes the `jsdasm' an
|
||||
executable and it sets the `js' interpreter command to the first
|
||||
line of the compiled `jsdasm' program.
|
||||
@@ -1,53 +0,0 @@
|
||||
#
|
||||
# Automakefile for JavaScript disassembler.
|
||||
# Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
#
|
||||
# Author: Markku Rossi <[email protected]>
|
||||
#
|
||||
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
# MA 02111-1307, USA
|
||||
#
|
||||
|
||||
JSCOMPILER = ../src/js
|
||||
JSCOMPILER_FLAGS = -Wpedantic -O2 -g
|
||||
|
||||
JSS = bc.js operands.js main.js
|
||||
JSCS = bc.jsc operands.jsc main.jsc
|
||||
|
||||
EXTRA_DIST = $(JSS) extract-op-names.js jsdas.1
|
||||
|
||||
man_MANS = jsdas.1
|
||||
|
||||
bin_SCRIPTS = jsdas
|
||||
|
||||
compile: $(JSCS)
|
||||
|
||||
jsdas: $(JSS)
|
||||
rm -f $@.js
|
||||
for i in $(JSS); do cat $(srcdir)/$$i >> $@.js; done
|
||||
$(JSCOMPILER) $(JSCOMPILER_FLAGS) -c $@.js
|
||||
echo "#!$(bindir)/js --file" > $@
|
||||
# echo "#!$(JSCOMPILER) --file" > $@
|
||||
cat $@.jsc >> $@
|
||||
chmod a+x $@
|
||||
|
||||
CLEANFILES = jsdas $(JSCS)
|
||||
|
||||
SUFFIXES = .jsc .js
|
||||
|
||||
.js.jsc:
|
||||
$(JSCOMPILER) $(JSCOMPILER_FLAGS) -c $<
|
||||
@@ -1,290 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
#
|
||||
# Automakefile for JavaScript disassembler.
|
||||
# Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
#
|
||||
# Author: Markku Rossi <[email protected]>
|
||||
#
|
||||
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
# MA 02111-1307, USA
|
||||
#
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
ACLOCAL_FLAGS_FOR_LIBTOOL = @ACLOCAL_FLAGS_FOR_LIBTOOL@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
EXTENSIONS = @EXTENSIONS@
|
||||
EXTENSIONS_LIBS = @EXTENSIONS_LIBS@
|
||||
INTERPRETER_FEATURES = @INTERPRETER_FEATURES@
|
||||
LD = @LD@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
NM = @NM@
|
||||
PACKAGE = @PACKAGE@
|
||||
PGCC_BY_PROVENZANO = @PGCC_BY_PROVENZANO@
|
||||
RANLIB = @RANLIB@
|
||||
U = @U@
|
||||
VERSION = @VERSION@
|
||||
XLC_R_AIX = @XLC_R_AIX@
|
||||
|
||||
JSCOMPILER = ../src/js
|
||||
JSCOMPILER_FLAGS = -Wpedantic -O2 -g
|
||||
|
||||
JSS = bc.js operands.js main.js
|
||||
JSCS = bc.jsc operands.jsc main.jsc
|
||||
|
||||
EXTRA_DIST = $(JSS) extract-op-names.js jsdas.1
|
||||
|
||||
man_MANS = jsdas.1
|
||||
|
||||
bin_SCRIPTS = jsdas
|
||||
|
||||
CLEANFILES = jsdas $(JSCS)
|
||||
|
||||
SUFFIXES = .jsc .js
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../jsconfig.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
SCRIPTS = $(bin_SCRIPTS)
|
||||
|
||||
man1dir = $(mandir)/man1
|
||||
MANS = $(man_MANS)
|
||||
|
||||
NROFF = nroff
|
||||
DIST_COMMON = ChangeLog Makefile.am Makefile.in TODO
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
all: Makefile $(SCRIPTS) $(MANS)
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .js .jsc
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps jsdas/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
install-binSCRIPTS: $(bin_SCRIPTS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
@list='$(bin_SCRIPTS)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
|
||||
$(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||
else if test -f $(srcdir)/$$p; then \
|
||||
echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
|
||||
$(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||
else :; fi; fi; \
|
||||
done
|
||||
|
||||
uninstall-binSCRIPTS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(bin_SCRIPTS)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||
done
|
||||
|
||||
install-man1:
|
||||
$(mkinstalldirs) $(DESTDIR)$(man1dir)
|
||||
@list='$(man1_MANS)'; \
|
||||
l2='$(man_MANS)'; for i in $$l2; do \
|
||||
case "$$i" in \
|
||||
*.1*) list="$$list $$i" ;; \
|
||||
esac; \
|
||||
done; \
|
||||
for i in $$list; do \
|
||||
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
|
||||
else file=$$i; fi; \
|
||||
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
||||
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
||||
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
||||
echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \
|
||||
$(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \
|
||||
done
|
||||
|
||||
uninstall-man1:
|
||||
@list='$(man1_MANS)'; \
|
||||
l2='$(man_MANS)'; for i in $$l2; do \
|
||||
case "$$i" in \
|
||||
*.1*) list="$$list $$i" ;; \
|
||||
esac; \
|
||||
done; \
|
||||
for i in $$list; do \
|
||||
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
||||
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
||||
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
||||
echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \
|
||||
rm -f $(DESTDIR)$(man1dir)/$$inst; \
|
||||
done
|
||||
install-man: $(MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(MAKE) install-man1
|
||||
uninstall-man:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
$(MAKE) uninstall-man1
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = jsdas
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
info:
|
||||
dvi:
|
||||
check: all
|
||||
$(MAKE)
|
||||
installcheck:
|
||||
install-exec: install-binSCRIPTS
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install-data: install-man
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-exec install-data all
|
||||
@:
|
||||
|
||||
uninstall: uninstall-binSCRIPTS uninstall-man
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DATADIR)$(bindir) $(DESTDIR)$(mandir)/man1
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-generic
|
||||
|
||||
clean: clean-generic mostlyclean
|
||||
|
||||
distclean: distclean-generic clean
|
||||
-rm -f config.status
|
||||
-rm -f libtool
|
||||
|
||||
maintainer-clean: maintainer-clean-generic distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
.PHONY: uninstall-binSCRIPTS install-binSCRIPTS install-man1 \
|
||||
uninstall-man1 install-man uninstall-man tags distdir info dvi \
|
||||
installcheck install-exec install-data install uninstall all \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
compile: $(JSCS)
|
||||
|
||||
jsdas: $(JSS)
|
||||
rm -f $@.js
|
||||
for i in $(JSS); do cat $(srcdir)/$$i >> $@.js; done
|
||||
$(JSCOMPILER) $(JSCOMPILER_FLAGS) -c $@.js
|
||||
echo "#!$(bindir)/js --file" > $@
|
||||
# echo "#!$(JSCOMPILER) --file" > $@
|
||||
cat $@.jsc >> $@
|
||||
chmod a+x $@
|
||||
|
||||
.js.jsc:
|
||||
$(JSCOMPILER) $(JSCOMPILER_FLAGS) -c $<
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -1,5 +0,0 @@
|
||||
|
||||
TODO JavaScript Disassembler
|
||||
============================
|
||||
|
||||
* option --extract to save contents of a section to file
|
||||
@@ -1,619 +0,0 @@
|
||||
/*
|
||||
* Byte-code file handling.
|
||||
* Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
*
|
||||
* Author: Markku Rossi <mtr@ngs.fi>
|
||||
*/
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
* MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Source: /cygdrive/c/RCVS/CVS/ReactOS/reactos/lib/kjs/jsdas/bc.js,v $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
function ByteCode$SymtabEntry (name, offset)
|
||||
{
|
||||
this.name = name;
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
|
||||
function ByteCode ()
|
||||
{
|
||||
/* Private methods. */
|
||||
this.sectionName = ByteCode$sectionName;
|
||||
this.lookupSection = ByteCode$lookupSection;
|
||||
this.parseConstants = ByteCode$parseConstants;
|
||||
this.parseSymtab = ByteCode$parseSymtab;
|
||||
this.prettyPrintString = ByteCode$prettyPrintString;
|
||||
this.opIsSymbol = ByteCode$opIsSymbol;
|
||||
this.opIsJump = ByteCode$opIsJump;
|
||||
|
||||
/* Public methods. */
|
||||
this.parse = ByteCode$parse;
|
||||
this.write = ByteCode$write;
|
||||
this.printInfo = ByteCode$printInfo;
|
||||
this.printCode = ByteCode$printCode;
|
||||
this.printConstants = ByteCode$printConstants;
|
||||
this.printSymtab = ByteCode$printSymtab;
|
||||
this.printDebug = ByteCode$printDebug;
|
||||
this.linkSection = ByteCode$linkSection;
|
||||
this.removeSection = ByteCode$removeSection;
|
||||
}
|
||||
|
||||
|
||||
function ByteCode$sectionName (type)
|
||||
{
|
||||
var name = type.toString ();
|
||||
|
||||
if (type == JSC$BC_SECT_CODE)
|
||||
name += " (code)";
|
||||
else if (type == JSC$BC_SECT_CONSTANTS)
|
||||
name += " (constants)";
|
||||
else if (type == JSC$BC_SECT_SYMTAB)
|
||||
name += " (symtab)";
|
||||
else if (type == JSC$BC_SECT_DEBUG)
|
||||
name += " (debug)";
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
function ByteCode$lookupSection (sect)
|
||||
{
|
||||
var i;
|
||||
for (i = 0; i < this.sect_types.length; i++)
|
||||
if (this.sect_types[i] == sect)
|
||||
return this.sect_data[i];
|
||||
|
||||
System.print ("jsdas: no section ", this.sectionName (sect), "\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function ByteCode$parseConstants ()
|
||||
{
|
||||
if (this.constants)
|
||||
return this.constants;
|
||||
|
||||
var data = this.lookupSection (JSC$BC_SECT_CONSTANTS);
|
||||
if (!data)
|
||||
return false;
|
||||
|
||||
this.constants = new Array ();
|
||||
var pos, count = 0;
|
||||
for (pos = 0; pos < data.length; count++)
|
||||
{
|
||||
var type = data[pos++];
|
||||
var val;
|
||||
|
||||
if (type == JSC$CONST_INT)
|
||||
{
|
||||
val = data.substr (pos, 4).unpack ("N")[0];
|
||||
pos += 4;
|
||||
}
|
||||
else if (type == JSC$CONST_STRING)
|
||||
{
|
||||
var len = data.substr (pos, 4).unpack ("N")[0];
|
||||
pos += 4;
|
||||
|
||||
val = "\"" + data.substr (pos, len);
|
||||
pos += len;
|
||||
}
|
||||
else if (type == JSC$CONST_FLOAT)
|
||||
{
|
||||
val = data.substr (pos, 8).unpack ("d")[0];
|
||||
pos += 8;
|
||||
}
|
||||
else if (type == JSC$CONST_SYMBOL)
|
||||
{
|
||||
val = new String ("S");
|
||||
for (; data[pos] != #'\0'; pos++)
|
||||
val.append (data.charAt (pos));
|
||||
pos++;
|
||||
}
|
||||
else if (type == JSC$CONST_NAN)
|
||||
{
|
||||
val = parseFloat ("****");
|
||||
}
|
||||
else if (type == JSC$CONST_REGEXP)
|
||||
{
|
||||
var flags = data.substr (pos, 1).unpack ("C")[0];
|
||||
pos++;
|
||||
|
||||
var len = data.substr (pos, 4).unpack ("N")[0];
|
||||
pos += 4;
|
||||
|
||||
val = "/" + File.byteToString (flags) + data.substr (pos, len);
|
||||
pos += len;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Unknown constant type. */
|
||||
this.constants = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
this.constants[count] = val;
|
||||
}
|
||||
|
||||
return this.constants;
|
||||
}
|
||||
|
||||
|
||||
function ByteCode$parseSymtab ()
|
||||
{
|
||||
if (this.symtab)
|
||||
return this.symtab;
|
||||
|
||||
var data = this.lookupSection (JSC$BC_SECT_SYMTAB);
|
||||
if (!data)
|
||||
return false;
|
||||
|
||||
this.symtab = new Array ();
|
||||
|
||||
/* Fetch the number of symtab entries. */
|
||||
var nentries = data.unpack ("N")[0];
|
||||
|
||||
var pos, count = 0;
|
||||
for (pos = 4; pos < data.length; count++)
|
||||
{
|
||||
/* Read the symbol name. */
|
||||
var name = new String ("");
|
||||
for (; data[pos] != #'\0'; pos++)
|
||||
name.append (data.charAt (pos));
|
||||
pos++;
|
||||
|
||||
/* Read the offset. */
|
||||
var offset = data.substr (pos, 4).unpack ("N")[0];
|
||||
pos += 4;
|
||||
|
||||
this.symtab.push (new ByteCode$SymtabEntry (name, offset));
|
||||
}
|
||||
|
||||
if (count != nentries)
|
||||
System.print ("jsdas: warning: expected ", nentries,
|
||||
" symtab entries, but got ", count, "\n");
|
||||
|
||||
return this.symtab;
|
||||
}
|
||||
|
||||
|
||||
function ByteCode$prettyPrintString (str)
|
||||
{
|
||||
var i;
|
||||
var tail = "";
|
||||
var ender;
|
||||
|
||||
/* Determine the type. */
|
||||
if (str[0] == #'"')
|
||||
{
|
||||
i = 1;
|
||||
ender = "\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Regexp. */
|
||||
var flags = str[1];
|
||||
ender = "/";
|
||||
|
||||
if (flags & JSC$CONST_REGEXP_FLAG_G)
|
||||
tail += "g";
|
||||
if (flags & JSC$CONST_REGEXP_FLAG_I)
|
||||
tail += "i";
|
||||
|
||||
i = 2;
|
||||
}
|
||||
|
||||
System.print (ender);
|
||||
for (; i < str.length; i++)
|
||||
{
|
||||
if (str[i] == ender[0] || str[i] == #'\\')
|
||||
System.print ("\\" + str.charAt (i));
|
||||
else if (str[i] == #'\n')
|
||||
System.print ("\\n");
|
||||
else if (str[i] == #'\t')
|
||||
System.print ("\\t");
|
||||
else if (str[i] == #'\v')
|
||||
System.print ("\\v");
|
||||
else if (str[i] == #'\b')
|
||||
System.print ("\\b");
|
||||
else if (str[i] == #'\r')
|
||||
System.print ("\\r");
|
||||
else if (str[i] == #'\f')
|
||||
System.print ("\\f");
|
||||
else if (str[i] == #'\a')
|
||||
System.print ("\\a");
|
||||
else if (str[i] == #'\'')
|
||||
System.print ("\\\'");
|
||||
else if (str[i] == #'\"')
|
||||
System.print ("\\\"");
|
||||
else
|
||||
System.print (str.charAt (i));
|
||||
}
|
||||
System.print (ender, tail);
|
||||
}
|
||||
|
||||
function ByteCode$opIsSymbol (op)
|
||||
{
|
||||
return (DASM$op_flags[op] & 0x01) != 0;
|
||||
}
|
||||
|
||||
function ByteCode$opIsJump (op)
|
||||
{
|
||||
return (DASM$op_flags[op] & 0x02) != 0;
|
||||
}
|
||||
|
||||
|
||||
function ByteCode$parse (stream)
|
||||
{
|
||||
var ch;
|
||||
var buf;
|
||||
|
||||
ch = stream.readByte ();
|
||||
if (ch == #'#')
|
||||
{
|
||||
if (stream.readByte () != #'!')
|
||||
return false;
|
||||
|
||||
/* Skip the first comment line. */
|
||||
this.first_line = "#!" + stream.readln ();
|
||||
}
|
||||
else
|
||||
{
|
||||
stream.ungetByte (ch);
|
||||
this.first_line = false;
|
||||
}
|
||||
|
||||
buf = stream.read (4);
|
||||
if (buf.length != 4)
|
||||
return false;
|
||||
|
||||
var a = buf.unpack ("N");
|
||||
if (a[0] != JSC$BC_MAGIC)
|
||||
{
|
||||
System.print ("jsdas: illegal magic: ", a[0].toString (16),
|
||||
", should be: ", JSC$BC_MAGIC.toString (16), "\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
buf = stream.read (4);
|
||||
if (buf.length != 4)
|
||||
return false;
|
||||
|
||||
var num_sections = buf.unpack ("N")[0];
|
||||
this.sect_types = new Array ();
|
||||
this.sect_data = new Array ();
|
||||
|
||||
/* Read sections. */
|
||||
for (i = 0; i < num_sections; i++)
|
||||
{
|
||||
/* Type and length. */
|
||||
buf = stream.read (8);
|
||||
if (buf.length != 8)
|
||||
return false;
|
||||
|
||||
a = buf.unpack ("NN");
|
||||
|
||||
this.sect_types[i] = a[0];
|
||||
|
||||
var len = a[1];
|
||||
buf = stream.read (len);
|
||||
if (buf.length != len)
|
||||
{
|
||||
System.stdout.writeln ("couldn't read section " + i.toString ()
|
||||
+ ", expected=" + len.toString ()
|
||||
+ ", got=" + buf.length.toString ());
|
||||
return false;
|
||||
}
|
||||
|
||||
this.sect_data[i] = buf;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function ByteCode$printInfo ()
|
||||
{
|
||||
var i;
|
||||
|
||||
for (i = 0; i < this.sect_types.length; i++)
|
||||
{
|
||||
var sectname = this.sectionName (this.sect_types[i]);
|
||||
System.print (" section ", i, ": ");
|
||||
System.print ("type=", sectname);
|
||||
System.print (", length=", this.sect_data[i].length, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function ByteCode$printConstants ()
|
||||
{
|
||||
if (!this.parseConstants ())
|
||||
{
|
||||
System.print ("jsdas: couldn't find a parse the constants section\n");
|
||||
return;
|
||||
}
|
||||
|
||||
var i;
|
||||
for (i = 0; i < this.constants.length; i++)
|
||||
{
|
||||
System.print (" ", i, ":\t");
|
||||
|
||||
var c = this.constants[i];
|
||||
if (typeof c == "number")
|
||||
System.print (c);
|
||||
else if (typeof c == "string")
|
||||
{
|
||||
/* Must be a string, regexp or symbol. */
|
||||
if (c[0] == #'S')
|
||||
/* Symbol. */
|
||||
System.print (c.substr (1));
|
||||
else
|
||||
this.prettyPrintString (c);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.print ("jsdas: illegal element in the constans array: type=",
|
||||
typeof c, "\n");
|
||||
return;
|
||||
}
|
||||
|
||||
System.print ("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function ByteCode$printSymtab ()
|
||||
{
|
||||
var symtab = this.parseSymtab ();
|
||||
if (!symtab)
|
||||
{
|
||||
System.print ("jsdas: couldn't find or parse symtab section\n");
|
||||
return;
|
||||
}
|
||||
|
||||
var i;
|
||||
for (i = 0; i < symtab.length; i++)
|
||||
{
|
||||
var name = symtab[i].name;
|
||||
var offset = symtab[i].offset;
|
||||
|
||||
System.print (" ", name);
|
||||
|
||||
var pad = name.length;
|
||||
for (; pad < 40; pad++)
|
||||
System.print (" ");
|
||||
|
||||
System.print (offset, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function ByteCode$printDebug ()
|
||||
{
|
||||
var data = this.lookupSection (JSC$BC_SECT_DEBUG);
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
var pos, count = 0;
|
||||
var filename = "<unknown>";
|
||||
for (pos = 0; pos < data.length; count++)
|
||||
{
|
||||
var type = data[pos++];
|
||||
|
||||
if (type == JSC$DEBUG_FILENAME)
|
||||
{
|
||||
var len = data.substr (pos, 4).unpack ("N")[0];
|
||||
pos += 4;
|
||||
|
||||
filename = data.substr (pos, len);
|
||||
pos += len;
|
||||
}
|
||||
else if (type == JSC$DEBUG_LINENUMBER)
|
||||
{
|
||||
var a = data.substr (pos, 8).unpack ("NN");
|
||||
pos += 8;
|
||||
|
||||
System.print (" ", a[0], "\t", filename, ":", a[1], "\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
System.print ("jsdas: unknown debug entry: ",
|
||||
"skipping all remaining data\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function ByteCode$printCode ()
|
||||
{
|
||||
var data = this.lookupSection (JSC$BC_SECT_CODE);
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
var consts = this.parseConstants ();
|
||||
if (!consts)
|
||||
{
|
||||
System.print ("jsdas: couldn't find or parse constants\n");
|
||||
return;
|
||||
}
|
||||
|
||||
var symtab = this.parseSymtab ();
|
||||
if (!symtab)
|
||||
{
|
||||
System.print ("jsdas: couldn't find or parse symtab\n");
|
||||
return;
|
||||
}
|
||||
|
||||
var symtab_pos = -1;
|
||||
var next_symtab_offset = -1;
|
||||
|
||||
var pos;
|
||||
for (pos = 0; pos < data.length; )
|
||||
{
|
||||
/* Handle symtab entries. */
|
||||
if (pos >= next_symtab_offset)
|
||||
{
|
||||
while (pos > next_symtab_offset)
|
||||
{
|
||||
/* Lookup the next offset. */
|
||||
symtab_pos++;
|
||||
if (symtab_pos >= symtab.length)
|
||||
next_symtab_offset = data.length + 1;
|
||||
else
|
||||
next_symtab_offset = symtab[symtab_pos].offset;
|
||||
}
|
||||
|
||||
if (pos == next_symtab_offset)
|
||||
System.print (pos == 0 ? "" : "\n",
|
||||
symtab[symtab_pos].name, ":\n");
|
||||
}
|
||||
|
||||
System.print (" ", pos, "\t");
|
||||
|
||||
var op = data[pos++];
|
||||
if (!DASM$op_names[op])
|
||||
{
|
||||
System.print ("jsdas: unknown operand: ",
|
||||
"skipping all remaining data\n");
|
||||
return;
|
||||
}
|
||||
|
||||
System.print (DASM$op_names[op], "\t");
|
||||
if (DASM$op_names[op].length < 8)
|
||||
System.print ("\t");
|
||||
|
||||
var ds = DASM$op_data[op];
|
||||
var val;
|
||||
|
||||
if (ds == 1)
|
||||
val = data[pos];
|
||||
else if (ds == 2)
|
||||
val = data.substr (pos, 2).unpack ("n")[0];
|
||||
else if (ds == 4)
|
||||
val = data.substr (pos, 4).unpack ("N")[0];
|
||||
|
||||
if (op == JSC$OP_CONST || this.opIsSymbol (op))
|
||||
{
|
||||
/* Handle symbols and constants. */
|
||||
|
||||
var c = consts[val];
|
||||
if (typeof c == "string")
|
||||
{
|
||||
if (c[0] == #'S')
|
||||
System.print (c.substr (1));
|
||||
else
|
||||
this.prettyPrintString (c);
|
||||
}
|
||||
else
|
||||
System.print (c);
|
||||
}
|
||||
else if (this.opIsJump (op))
|
||||
{
|
||||
/* Local jumps. */
|
||||
val += pos + ds;
|
||||
System.print (val);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Handle all the rest. */
|
||||
if (ds != 0)
|
||||
System.print (val);
|
||||
}
|
||||
|
||||
pos += ds;
|
||||
|
||||
System.print ("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function ByteCode$linkSection (type, data)
|
||||
{
|
||||
var i;
|
||||
for (i = 0; i < this.sect_types.length; i++)
|
||||
if (this.sect_types[i] == type)
|
||||
{
|
||||
this.sect_data[i] = data;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Create a new section. */
|
||||
this.sect_types.push (type);
|
||||
this.sect_data.push (data);
|
||||
}
|
||||
|
||||
|
||||
function ByteCode$removeSection (type)
|
||||
{
|
||||
var i;
|
||||
for (i = 0; i < this.sect_types.length; i++)
|
||||
if (this.sect_types[i] == type)
|
||||
{
|
||||
/* Found it. */
|
||||
this.sect_types.splice (i, 1);
|
||||
this.sect_data.splice (i, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function ByteCode$write (name)
|
||||
{
|
||||
var fp = new File (name);
|
||||
if (fp.open ("w"))
|
||||
{
|
||||
/* Possible first line. */
|
||||
if (this.first_line)
|
||||
fp.writeln (this.first_line);
|
||||
|
||||
/* Magic. */
|
||||
fp.write (String.pack ("N", JSC$BC_MAGIC));
|
||||
|
||||
/* Number of sections. */
|
||||
fp.write (String.pack ("N", this.sect_types.length));
|
||||
|
||||
var i;
|
||||
for (i = 0; i < this.sect_types.length; i++)
|
||||
{
|
||||
/* Write type and the length of the section. */
|
||||
fp.write (String.pack ("NN", this.sect_types[i],
|
||||
this.sect_data[i].length));
|
||||
|
||||
/* Write the data. */
|
||||
fp.write (this.sect_data[i]);
|
||||
}
|
||||
|
||||
return fp.close ();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
mode: c
|
||||
End:
|
||||
*/
|
||||
@@ -1,117 +0,0 @@
|
||||
#!../src/js
|
||||
/*
|
||||
* Extract byte-code operand names from the operands.def file.
|
||||
* Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
*
|
||||
* Author: Markku Rossi <mtr@ngs.fi>
|
||||
*/
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
* MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Source: /cygdrive/c/RCVS/CVS/ReactOS/reactos/lib/kjs/jsdas/extract-op-names.js,v $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
source = "../src/operands.def";
|
||||
target = "operands.js";
|
||||
|
||||
op_re = new RegExp ("\
|
||||
^operand[ \t]+([a-zA-Z_][a-zA-Z0-9_]*)[ \t]+([^ \t]+)[ \t]+{(.*)");
|
||||
|
||||
function main ()
|
||||
{
|
||||
var ifp = new File (source);
|
||||
var ofp = new File (target);
|
||||
var count = 0;
|
||||
|
||||
if (ifp.open ("r"))
|
||||
{
|
||||
if (ofp.open ("w"))
|
||||
{
|
||||
header (ofp);
|
||||
|
||||
while (!ifp.eof ())
|
||||
{
|
||||
var line = ifp.readln ();
|
||||
if (op_re.test (line))
|
||||
operand (ofp, RegExp.$1, RegExp.$2, RegExp.$3, count++);
|
||||
}
|
||||
|
||||
ofp.close ();
|
||||
}
|
||||
else
|
||||
{
|
||||
ifp.close ();
|
||||
System.error ("Couldn't create target file `", target, "':",
|
||||
System.strerror (System.errno), "\n");
|
||||
System.exit (1);
|
||||
}
|
||||
|
||||
ifp.close ();
|
||||
}
|
||||
else
|
||||
{
|
||||
System.error ("Couldn't open source file `", source, "':",
|
||||
System.strerror (System.errno), "\n");
|
||||
System.exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
function header (fp)
|
||||
{
|
||||
fp.write ("\
|
||||
/* -*- c -*-
|
||||
* Operand definitions for the JavaScript byte-code.
|
||||
*
|
||||
* This file is automatically create from the operands.def file.
|
||||
* Editing is strongly discouraged. You should edit the file
|
||||
* `extract-op-names.js' instead.
|
||||
*/
|
||||
|
||||
DASM$op_names = new Array ();
|
||||
DASM$op_data = new Array ();
|
||||
DASM$op_flags = new Array ();
|
||||
");
|
||||
}
|
||||
|
||||
|
||||
function operand (ofp, name, data, flags, count)
|
||||
{
|
||||
var f = 0;
|
||||
|
||||
if (/symbol/.test (flags))
|
||||
f |= 0x01;
|
||||
if (/jump/.test (flags))
|
||||
f |= 0x02;
|
||||
|
||||
ofp.write ("\
|
||||
DASM$op_names[" + count.toString () + "]\t= \"" + name + "\";
|
||||
DASM$op_data[" + count.toString () + "] \t= " + data + ";
|
||||
DASM$op_flags[" + count.toString () + "] \t= 0x" + f.toString (16) + ";
|
||||
");
|
||||
}
|
||||
|
||||
main ();
|
||||
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
mode: c
|
||||
End:
|
||||
*/
|
||||
@@ -1,83 +0,0 @@
|
||||
.\"
|
||||
.\" Manual page for the js disassembler.
|
||||
.\" Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
.\" Author: Markku Rossi <[email protected]>
|
||||
.\"
|
||||
.\" This program is free software; you can redistribute it and/or modify
|
||||
.\" it under the terms of the GNU General Public License as published by
|
||||
.\" the Free Software Foundation; either version 2, or (at your option)
|
||||
.\" any later version.
|
||||
.\"
|
||||
.\" This program is distributed in the hope that it will be useful,
|
||||
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
.\" GNU General Public License for more details.
|
||||
.\"
|
||||
.\" You should have received a copy of the GNU General Public License
|
||||
.\" along with this program; see the file COPYING. If not, write to
|
||||
.\" the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
.\" Boston, MA 02111-1307, USA.
|
||||
.\"
|
||||
.TH JSDAS 1 "May 27, 1998" "JSDAS" "JSDAS"
|
||||
|
||||
.SH NAME
|
||||
jsdas \- disassemble and manipulate JavaScript byte\-code files
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B jsdas
|
||||
[\f3\-cCdhisSV\f1]
|
||||
[\f3\-l \f2type\f1 \f2data\f1]
|
||||
[\f3\-r \f2type\f1]
|
||||
\f2file\f1...
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
||||
The \f3jsdas\f1 program is a disassembler and a manipulator for the
|
||||
JavaScript byte\-code files. The program can be used to view,
|
||||
disassemble and manipulate the byte\-code files.
|
||||
|
||||
.SH OPTIONS
|
||||
|
||||
.TP 8
|
||||
.B \-c, \-\-code
|
||||
Print the code section of the byte\-code files. This is the default
|
||||
action that is preformed if no options are given for the \f3jsdas\f1
|
||||
program.
|
||||
.TP 8
|
||||
.B \-C, \-\-constants
|
||||
Print the constants section of the byte\-code file.
|
||||
.TP 8
|
||||
.B \-d, \-\-debug
|
||||
Print the debug section of the byte\-code file.
|
||||
.TP 8
|
||||
.B \-h, \-\-help
|
||||
Print a short help message that describes the options that can be given
|
||||
to the \f3jsdas\f1 program.
|
||||
.TP 8
|
||||
.B \-i, \-\-info
|
||||
Print the byte\-code file information.
|
||||
.TP 8
|
||||
.B \-l \f2type\f3 \f2data\f3, \-\-link \f2type\f3 \f2data\f3
|
||||
Link a new section to the byte\-code file. The section's type is
|
||||
\f2type\f1 and its contents is read from file \f2data\f1.
|
||||
.TP 8
|
||||
.B \-r \f2type\f3, \-\-remove \f2type\f3
|
||||
Remove section of type \f2type\f1 from the byte\-code files.
|
||||
.TP 8
|
||||
.B \-s, \-\-symtab
|
||||
Print the symbol table section of the byte\-code file.
|
||||
.TP 8
|
||||
.B \-S, \-\-strip
|
||||
Remove the debug section from the byte\-code files.
|
||||
.TP 8
|
||||
.B \-V, \-\-version
|
||||
Print the version number of the \f3jsdas\f1 program.
|
||||
|
||||
|
||||
.SH AUTHOR
|
||||
Markku Rossi <[email protected]>
|
||||
|
||||
NGS JavaScript WWW home page: <http://www.ngs.fi/js/>
|
||||
|
||||
.SH SEE ALSO
|
||||
js(1)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,398 +0,0 @@
|
||||
/*
|
||||
* Disassembler for JavaScript byte-code files.
|
||||
* Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
*
|
||||
* Author: Markku Rossi <mtr@ngs.fi>
|
||||
*/
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
* MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Source: /cygdrive/c/RCVS/CVS/ReactOS/reactos/lib/kjs/jsdas/main.js,v $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Variables and definitions.
|
||||
*/
|
||||
|
||||
version_number = "0.0.1";
|
||||
|
||||
/*
|
||||
* Options.
|
||||
*/
|
||||
|
||||
/*
|
||||
* -c, --code
|
||||
*
|
||||
* Print code section.
|
||||
*/
|
||||
|
||||
opt_code = false;
|
||||
|
||||
/*
|
||||
* -C, --constants
|
||||
*
|
||||
* Print constants section.
|
||||
*/
|
||||
|
||||
opt_constants = false;
|
||||
|
||||
/*
|
||||
* -d, --debug
|
||||
*
|
||||
* Print the debug section.
|
||||
*/
|
||||
|
||||
opt_debug = false;
|
||||
|
||||
/*
|
||||
* -h, --help
|
||||
*
|
||||
* Print short help and exit successfully.
|
||||
*/
|
||||
|
||||
/*
|
||||
* -i, --info
|
||||
*
|
||||
* Show general information about the file.
|
||||
*/
|
||||
|
||||
opt_info = false;
|
||||
|
||||
/*
|
||||
* -l TYPE DATA, --link TYPE DATA
|
||||
*
|
||||
* Link a new section to the byte-code file. The new section's type is
|
||||
* TYPE and its data is in file DATA.
|
||||
*/
|
||||
|
||||
opt_link = false;
|
||||
opt_link_type = 0;
|
||||
opt_link_data = "";
|
||||
|
||||
/*
|
||||
* -r TYPE, --remove TYPE
|
||||
*
|
||||
* Remove section TYPE.
|
||||
*/
|
||||
|
||||
opt_remove = false;
|
||||
opt_remove_type = 0;
|
||||
|
||||
/*
|
||||
* -s, --symtab
|
||||
*
|
||||
* Print symtab section.
|
||||
*/
|
||||
|
||||
opt_symtab = false;
|
||||
|
||||
/*
|
||||
* -S, --strip
|
||||
*
|
||||
* Remove the debug section from byte-code files.
|
||||
*/
|
||||
|
||||
/*
|
||||
* -V, --version
|
||||
*
|
||||
* Print version information and exit successfully.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Functions.
|
||||
*/
|
||||
|
||||
function main ()
|
||||
{
|
||||
var opt_default = true;
|
||||
|
||||
var idx = ARGS[0].lastIndexOf ("/");
|
||||
if (idx >= 0)
|
||||
program = ARGS[0].substr (idx + 1);
|
||||
else
|
||||
program = ARGS[0];
|
||||
|
||||
/* Handle arguments. */
|
||||
var i;
|
||||
for (i = 1; i < ARGS.length; i++)
|
||||
{
|
||||
if (ARGS[i][0] == #'-')
|
||||
{
|
||||
if (ARGS[i] == "-c" || ARGS[i] == "--code")
|
||||
{
|
||||
opt_code = true;
|
||||
opt_default = false;
|
||||
}
|
||||
else if (ARGS[i] == "-C" || ARGS[i] == "--constants")
|
||||
{
|
||||
opt_constants = true;
|
||||
opt_default = false;
|
||||
}
|
||||
else if (ARGS[i] == "-d" || ARGS[i] == "--debug")
|
||||
{
|
||||
opt_debug = true;
|
||||
opt_default = false;
|
||||
}
|
||||
else if (ARGS[i] == "-i" || ARGS[i] == "--info")
|
||||
{
|
||||
opt_info = true;
|
||||
opt_default = false;
|
||||
}
|
||||
else if (ARGS[i] == "-l" || ARGS[i] == "--link")
|
||||
{
|
||||
opt_link = true;
|
||||
opt_default = false;
|
||||
|
||||
if (i + 2 >= ARGS.length)
|
||||
{
|
||||
System.error (program, ": no arguments for option --link\n");
|
||||
System.exit (1);
|
||||
}
|
||||
|
||||
opt_link_type = parseInt (ARGS[++i]);
|
||||
if (isNaN (opt_link_type))
|
||||
{
|
||||
System.error (program, ": illegal section type `",
|
||||
ARGS[i], "'\n");
|
||||
System.exit (1);
|
||||
}
|
||||
opt_link_data = (ARGS[++i]);
|
||||
}
|
||||
else if (ARGS[i] == "-r" || ARGS[i] == "--remove")
|
||||
{
|
||||
opt_remove = true;
|
||||
opt_default = false;
|
||||
|
||||
if (i + 1 >= ARGS.length)
|
||||
{
|
||||
System.error (program,
|
||||
": no arguments for option --remove\n");
|
||||
System.exit (1);
|
||||
}
|
||||
|
||||
opt_remove_type = parseInt (ARGS[++i]);
|
||||
if (isNaN (opt_remove_type))
|
||||
{
|
||||
System.error (program, ": illegal section type `",
|
||||
ARGS[i], "'\n");
|
||||
System.exit (1);
|
||||
}
|
||||
}
|
||||
else if (ARGS[i] == "-s" || ARGS[i] == "--symtab")
|
||||
{
|
||||
opt_symtab = true;
|
||||
opt_default = false;
|
||||
}
|
||||
else if (ARGS[i] == "-S" || ARGS[i] == "--strip")
|
||||
{
|
||||
opt_remove = true;
|
||||
opt_default = false;
|
||||
opt_remove_type = JSC$BC_SECT_DEBUG;
|
||||
}
|
||||
else if (ARGS[i] == "-h" || ARGS[i] == "--help")
|
||||
{
|
||||
usage ();
|
||||
System.exit (0);
|
||||
}
|
||||
else if (ARGS[i] == "-V" || ARGS[i] == "--version")
|
||||
{
|
||||
version ();
|
||||
System.exit (0);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Unrecognized option. */
|
||||
System.error (program, ": unrecognized option `",
|
||||
ARGS[i], "'\n");
|
||||
System.error ("Try `", program,
|
||||
" --help' for more information.\n");
|
||||
System.exit (1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* End of arguments. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i >= ARGS.length)
|
||||
{
|
||||
System.error (program, ": no files specified\n");
|
||||
System.exit (1);
|
||||
}
|
||||
|
||||
/* Process files. */
|
||||
var first = true;
|
||||
for (; i < ARGS.length; i++)
|
||||
{
|
||||
if (first)
|
||||
first = false;
|
||||
else
|
||||
System.print ("\n");
|
||||
|
||||
System.print (ARGS[i], ":\n");
|
||||
var is = new File (ARGS[i]);
|
||||
if (is.open ("r"))
|
||||
{
|
||||
var bc = new ByteCode ();
|
||||
var result = bc.parse (is);
|
||||
is.close ();
|
||||
|
||||
if (!result)
|
||||
System.print (program, ": couldn't parse byte-code file `",
|
||||
ARGS[i], "'\n");
|
||||
else
|
||||
{
|
||||
var write_back = false;
|
||||
|
||||
if (opt_info)
|
||||
{
|
||||
System.print ("\n* byte-code file information\n\n");
|
||||
bc.printInfo ();
|
||||
}
|
||||
|
||||
if (opt_constants)
|
||||
{
|
||||
System.print ("\n* section `Constants'\n\n");
|
||||
bc.printConstants ();
|
||||
}
|
||||
|
||||
if (opt_default || opt_code)
|
||||
{
|
||||
System.print ("\n* section `Code'\n\n");
|
||||
bc.printCode ();
|
||||
}
|
||||
|
||||
if (opt_symtab)
|
||||
{
|
||||
System.print ("\n* section `Symtab'\n\n");
|
||||
bc.printSymtab ();
|
||||
}
|
||||
|
||||
if (opt_debug)
|
||||
{
|
||||
System.print ("\n* section `Debug'\n\n");
|
||||
bc.printDebug ();
|
||||
}
|
||||
|
||||
if (opt_link)
|
||||
{
|
||||
var df = new File (opt_link_data);
|
||||
if (df.open ("r"))
|
||||
{
|
||||
var len = df.getLength ();
|
||||
var data = df.read (len);
|
||||
df.close ();
|
||||
|
||||
if (data.length < len)
|
||||
System.error (program,
|
||||
": couldn't read data from file `",
|
||||
opt_link_data, "': ",
|
||||
System.strerror (System.errno), "\n");
|
||||
else
|
||||
{
|
||||
System.print (program, ": linking ", data.length,
|
||||
" bytes of data to section ",
|
||||
opt_link_type.toString (), "\n");
|
||||
bc.linkSection (opt_link_type, data);
|
||||
write_back = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
System.error (program, ": couldn't open data file `",
|
||||
opt_link_data, "': ",
|
||||
System.strerror (System.errno), "\n");
|
||||
}
|
||||
|
||||
if (opt_remove)
|
||||
{
|
||||
System.print (program, ": removing section ",
|
||||
opt_remove_type, "\n");
|
||||
if (bc.removeSection (opt_remove_type))
|
||||
write_back = true;
|
||||
}
|
||||
|
||||
if (write_back)
|
||||
{
|
||||
/* Write the byte-code file back to its original file. */
|
||||
if (!bc.write (ARGS[i]))
|
||||
{
|
||||
System.error (program, ": write failed: ",
|
||||
System.strerror (System.errno),
|
||||
"\n");
|
||||
System.exit (1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
System.error (program, ": couldn't open bc file `", ARGS[i], "': ",
|
||||
System.strerror (System.errno), "\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function usage ()
|
||||
{
|
||||
System.print ("\
|
||||
Usage: ", program, " [OPTION]... FILE...\n\
|
||||
Mandatory arguments to long options are mandatory for short options too.\n");
|
||||
|
||||
System.print ("\
|
||||
-c, --code print code section (default)\n\
|
||||
-C, --constants print constants section\n\
|
||||
-d, --debug print debug section\n\
|
||||
-h, --help print this help and exit\n\
|
||||
-i, --info print the byte-code file header and general\n\
|
||||
information about the sections\n\
|
||||
-l, --link TYPE DATA link data from file DATA to section TYPE\n\
|
||||
-r, --remove TYPE remove section TYPE\n\
|
||||
-s, --symtab print symtab section\n\
|
||||
-S, --strip remove debug section\n\
|
||||
-V, --version print version number\n\
|
||||
");
|
||||
|
||||
System.print ("\nReport bugs to [email protected].\n");
|
||||
}
|
||||
|
||||
|
||||
function version ()
|
||||
{
|
||||
System.print ("NGS JavaScript disassembler ", version_number, "\n");
|
||||
System.print ("\
|
||||
Copyright (C) 1998 New Generation Software (NGS) Oy.\n\
|
||||
NGS JavaScript Interpreter comes with NO WARRANTY, to the extent\n\
|
||||
permitted by law. You may redistribute copies of NGS JavaScript\n\
|
||||
Interpreter under the terms of the GNU Library General Public License.\n\
|
||||
For more information about these matters, see the files named COPYING.\n\
|
||||
");
|
||||
}
|
||||
|
||||
|
||||
main ();
|
||||
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
mode: c
|
||||
End:
|
||||
*/
|
||||
@@ -1,236 +0,0 @@
|
||||
/* -*- c -*-
|
||||
* Operand definitions for the JavaScript byte-code.
|
||||
*
|
||||
* This file is automatically create from the operands.def file.
|
||||
* Editing is strongly discouraged. You should edit the file
|
||||
* `extract-op-names.js' instead.
|
||||
*/
|
||||
|
||||
DASM$op_names = new Array ();
|
||||
DASM$op_data = new Array ();
|
||||
DASM$op_flags = new Array ();
|
||||
DASM$op_names[0] = "halt";
|
||||
DASM$op_data[0] = 0;
|
||||
DASM$op_flags[0] = 0x0;
|
||||
DASM$op_names[1] = "done";
|
||||
DASM$op_data[1] = 0;
|
||||
DASM$op_flags[1] = 0x0;
|
||||
DASM$op_names[2] = "nop";
|
||||
DASM$op_data[2] = 0;
|
||||
DASM$op_flags[2] = 0x0;
|
||||
DASM$op_names[3] = "dup";
|
||||
DASM$op_data[3] = 0;
|
||||
DASM$op_flags[3] = 0x0;
|
||||
DASM$op_names[4] = "pop";
|
||||
DASM$op_data[4] = 0;
|
||||
DASM$op_flags[4] = 0x0;
|
||||
DASM$op_names[5] = "pop_n";
|
||||
DASM$op_data[5] = 1;
|
||||
DASM$op_flags[5] = 0x0;
|
||||
DASM$op_names[6] = "apop";
|
||||
DASM$op_data[6] = 1;
|
||||
DASM$op_flags[6] = 0x0;
|
||||
DASM$op_names[7] = "swap";
|
||||
DASM$op_data[7] = 0;
|
||||
DASM$op_flags[7] = 0x0;
|
||||
DASM$op_names[8] = "roll";
|
||||
DASM$op_data[8] = 1;
|
||||
DASM$op_flags[8] = 0x0;
|
||||
DASM$op_names[9] = "const";
|
||||
DASM$op_data[9] = 4;
|
||||
DASM$op_flags[9] = 0x0;
|
||||
DASM$op_names[10] = "const_null";
|
||||
DASM$op_data[10] = 0;
|
||||
DASM$op_flags[10] = 0x0;
|
||||
DASM$op_names[11] = "const_true";
|
||||
DASM$op_data[11] = 0;
|
||||
DASM$op_flags[11] = 0x0;
|
||||
DASM$op_names[12] = "const_false";
|
||||
DASM$op_data[12] = 0;
|
||||
DASM$op_flags[12] = 0x0;
|
||||
DASM$op_names[13] = "const_undefined";
|
||||
DASM$op_data[13] = 0;
|
||||
DASM$op_flags[13] = 0x0;
|
||||
DASM$op_names[14] = "const_i0";
|
||||
DASM$op_data[14] = 0;
|
||||
DASM$op_flags[14] = 0x0;
|
||||
DASM$op_names[15] = "const_i1";
|
||||
DASM$op_data[15] = 0;
|
||||
DASM$op_flags[15] = 0x0;
|
||||
DASM$op_names[16] = "const_i2";
|
||||
DASM$op_data[16] = 0;
|
||||
DASM$op_flags[16] = 0x0;
|
||||
DASM$op_names[17] = "const_i3";
|
||||
DASM$op_data[17] = 0;
|
||||
DASM$op_flags[17] = 0x0;
|
||||
DASM$op_names[18] = "const_i";
|
||||
DASM$op_data[18] = 4;
|
||||
DASM$op_flags[18] = 0x0;
|
||||
DASM$op_names[19] = "load_global";
|
||||
DASM$op_data[19] = 4;
|
||||
DASM$op_flags[19] = 0x1;
|
||||
DASM$op_names[20] = "store_global";
|
||||
DASM$op_data[20] = 4;
|
||||
DASM$op_flags[20] = 0x1;
|
||||
DASM$op_names[21] = "load_arg";
|
||||
DASM$op_data[21] = 1;
|
||||
DASM$op_flags[21] = 0x0;
|
||||
DASM$op_names[22] = "store_arg";
|
||||
DASM$op_data[22] = 1;
|
||||
DASM$op_flags[22] = 0x0;
|
||||
DASM$op_names[23] = "load_local";
|
||||
DASM$op_data[23] = 2;
|
||||
DASM$op_flags[23] = 0x0;
|
||||
DASM$op_names[24] = "store_local";
|
||||
DASM$op_data[24] = 2;
|
||||
DASM$op_flags[24] = 0x0;
|
||||
DASM$op_names[25] = "load_property";
|
||||
DASM$op_data[25] = 4;
|
||||
DASM$op_flags[25] = 0x1;
|
||||
DASM$op_names[26] = "store_property";
|
||||
DASM$op_data[26] = 4;
|
||||
DASM$op_flags[26] = 0x1;
|
||||
DASM$op_names[27] = "load_array";
|
||||
DASM$op_data[27] = 0;
|
||||
DASM$op_flags[27] = 0x0;
|
||||
DASM$op_names[28] = "store_array";
|
||||
DASM$op_data[28] = 0;
|
||||
DASM$op_flags[28] = 0x0;
|
||||
DASM$op_names[29] = "nth";
|
||||
DASM$op_data[29] = 0;
|
||||
DASM$op_flags[29] = 0x0;
|
||||
DASM$op_names[30] = "cmp_eq";
|
||||
DASM$op_data[30] = 0;
|
||||
DASM$op_flags[30] = 0x0;
|
||||
DASM$op_names[31] = "cmp_ne";
|
||||
DASM$op_data[31] = 0;
|
||||
DASM$op_flags[31] = 0x0;
|
||||
DASM$op_names[32] = "cmp_lt";
|
||||
DASM$op_data[32] = 0;
|
||||
DASM$op_flags[32] = 0x0;
|
||||
DASM$op_names[33] = "cmp_gt";
|
||||
DASM$op_data[33] = 0;
|
||||
DASM$op_flags[33] = 0x0;
|
||||
DASM$op_names[34] = "cmp_le";
|
||||
DASM$op_data[34] = 0;
|
||||
DASM$op_flags[34] = 0x0;
|
||||
DASM$op_names[35] = "cmp_ge";
|
||||
DASM$op_data[35] = 0;
|
||||
DASM$op_flags[35] = 0x0;
|
||||
DASM$op_names[36] = "cmp_seq";
|
||||
DASM$op_data[36] = 0;
|
||||
DASM$op_flags[36] = 0x0;
|
||||
DASM$op_names[37] = "cmp_sne";
|
||||
DASM$op_data[37] = 0;
|
||||
DASM$op_flags[37] = 0x0;
|
||||
DASM$op_names[38] = "sub";
|
||||
DASM$op_data[38] = 0;
|
||||
DASM$op_flags[38] = 0x0;
|
||||
DASM$op_names[39] = "add";
|
||||
DASM$op_data[39] = 0;
|
||||
DASM$op_flags[39] = 0x0;
|
||||
DASM$op_names[40] = "mul";
|
||||
DASM$op_data[40] = 0;
|
||||
DASM$op_flags[40] = 0x0;
|
||||
DASM$op_names[41] = "div";
|
||||
DASM$op_data[41] = 0;
|
||||
DASM$op_flags[41] = 0x0;
|
||||
DASM$op_names[42] = "mod";
|
||||
DASM$op_data[42] = 0;
|
||||
DASM$op_flags[42] = 0x0;
|
||||
DASM$op_names[43] = "neg";
|
||||
DASM$op_data[43] = 0;
|
||||
DASM$op_flags[43] = 0x0;
|
||||
DASM$op_names[44] = "and";
|
||||
DASM$op_data[44] = 0;
|
||||
DASM$op_flags[44] = 0x0;
|
||||
DASM$op_names[45] = "not";
|
||||
DASM$op_data[45] = 0;
|
||||
DASM$op_flags[45] = 0x0;
|
||||
DASM$op_names[46] = "or";
|
||||
DASM$op_data[46] = 0;
|
||||
DASM$op_flags[46] = 0x0;
|
||||
DASM$op_names[47] = "xor";
|
||||
DASM$op_data[47] = 0;
|
||||
DASM$op_flags[47] = 0x0;
|
||||
DASM$op_names[48] = "shift_left";
|
||||
DASM$op_data[48] = 0;
|
||||
DASM$op_flags[48] = 0x0;
|
||||
DASM$op_names[49] = "shift_right";
|
||||
DASM$op_data[49] = 0;
|
||||
DASM$op_flags[49] = 0x0;
|
||||
DASM$op_names[50] = "shift_rright";
|
||||
DASM$op_data[50] = 0;
|
||||
DASM$op_flags[50] = 0x0;
|
||||
DASM$op_names[51] = "iffalse";
|
||||
DASM$op_data[51] = 4;
|
||||
DASM$op_flags[51] = 0x2;
|
||||
DASM$op_names[52] = "iftrue";
|
||||
DASM$op_data[52] = 4;
|
||||
DASM$op_flags[52] = 0x2;
|
||||
DASM$op_names[53] = "call_method";
|
||||
DASM$op_data[53] = 4;
|
||||
DASM$op_flags[53] = 0x1;
|
||||
DASM$op_names[54] = "jmp";
|
||||
DASM$op_data[54] = 4;
|
||||
DASM$op_flags[54] = 0x2;
|
||||
DASM$op_names[55] = "jsr";
|
||||
DASM$op_data[55] = 0;
|
||||
DASM$op_flags[55] = 0x0;
|
||||
DASM$op_names[56] = "return";
|
||||
DASM$op_data[56] = 0;
|
||||
DASM$op_flags[56] = 0x0;
|
||||
DASM$op_names[57] = "typeof";
|
||||
DASM$op_data[57] = 0;
|
||||
DASM$op_flags[57] = 0x0;
|
||||
DASM$op_names[58] = "new";
|
||||
DASM$op_data[58] = 0;
|
||||
DASM$op_flags[58] = 0x0;
|
||||
DASM$op_names[59] = "delete_property";
|
||||
DASM$op_data[59] = 4;
|
||||
DASM$op_flags[59] = 0x1;
|
||||
DASM$op_names[60] = "delete_array";
|
||||
DASM$op_data[60] = 0;
|
||||
DASM$op_flags[60] = 0x0;
|
||||
DASM$op_names[61] = "locals";
|
||||
DASM$op_data[61] = 2;
|
||||
DASM$op_flags[61] = 0x0;
|
||||
DASM$op_names[62] = "min_args";
|
||||
DASM$op_data[62] = 1;
|
||||
DASM$op_flags[62] = 0x0;
|
||||
DASM$op_names[63] = "load_nth_arg";
|
||||
DASM$op_data[63] = 0;
|
||||
DASM$op_flags[63] = 0x0;
|
||||
DASM$op_names[64] = "with_push";
|
||||
DASM$op_data[64] = 0;
|
||||
DASM$op_flags[64] = 0x0;
|
||||
DASM$op_names[65] = "with_pop";
|
||||
DASM$op_data[65] = 1;
|
||||
DASM$op_flags[65] = 0x0;
|
||||
DASM$op_names[66] = "try_push";
|
||||
DASM$op_data[66] = 4;
|
||||
DASM$op_flags[66] = 0x2;
|
||||
DASM$op_names[67] = "try_pop";
|
||||
DASM$op_data[67] = 1;
|
||||
DASM$op_flags[67] = 0x0;
|
||||
DASM$op_names[68] = "throw";
|
||||
DASM$op_data[68] = 0;
|
||||
DASM$op_flags[68] = 0x0;
|
||||
DASM$op_names[69] = "iffalse_b";
|
||||
DASM$op_data[69] = 4;
|
||||
DASM$op_flags[69] = 0x2;
|
||||
DASM$op_names[70] = "iftrue_b";
|
||||
DASM$op_data[70] = 4;
|
||||
DASM$op_flags[70] = 0x2;
|
||||
DASM$op_names[71] = "add_1_i";
|
||||
DASM$op_data[71] = 0;
|
||||
DASM$op_flags[71] = 0x0;
|
||||
DASM$op_names[72] = "add_2_i";
|
||||
DASM$op_data[72] = 0;
|
||||
DASM$op_flags[72] = 0x0;
|
||||
DASM$op_names[73] = "load_global_w";
|
||||
DASM$op_data[73] = 4;
|
||||
DASM$op_flags[73] = 0x1;
|
||||
DASM$op_names[74] = "jsr_w";
|
||||
DASM$op_data[74] = 4;
|
||||
DASM$op_flags[74] = 0x1;
|
||||
@@ -1,13 +0,0 @@
|
||||
1998-08-12 Markku Rossi <[email protected]>
|
||||
|
||||
* process.js (path_to_ppname): Fixed to convert all non-identifier
|
||||
characters to '_'. The function can now also handle file names
|
||||
which start with an number.
|
||||
|
||||
1998-08-10 Markku Rossi <[email protected]>
|
||||
|
||||
* process.js (Func$print_c): Fixed call-by-reference arguments.
|
||||
Implemented the `static' modifier for arguments.
|
||||
(c_typename): Changed int's C-type to `long'.
|
||||
(Func$print_c): Added some casts to make C++ compilers happy about
|
||||
our code.
|
||||
@@ -1,51 +0,0 @@
|
||||
#
|
||||
# Automakefile for jswrap.
|
||||
# Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
#
|
||||
# Author: Markku Rossi <[email protected]>
|
||||
#
|
||||
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
# MA 02111-1307, USA
|
||||
#
|
||||
|
||||
JSCOMPILER = ../src/js
|
||||
JSCOMPILER_FLAGS = -Wpedantic -O2 -g
|
||||
|
||||
JSS = process.js main.js
|
||||
JSCS = process.jsc main.jsc
|
||||
|
||||
EXTRA_DIST = $(JSS)
|
||||
|
||||
bin_SCRIPTS = jswrap
|
||||
|
||||
compile: $(JSCS)
|
||||
|
||||
jswrap: $(JSS)
|
||||
rm -f $@.js
|
||||
for i in $(JSS); do cat $(srcdir)/$$i >> $@.js; done
|
||||
$(JSCOMPILER) $(JSCOMPILER_FLAGS) -c $@.js
|
||||
echo "#!$(bindir)/js --file" > $@
|
||||
# echo "#!$(JSCOMPILER) --file" > $@
|
||||
cat $@.jsc >> $@
|
||||
chmod a+x $@
|
||||
|
||||
CLEANFILES = jswrap $(JSCS)
|
||||
|
||||
SUFFIXES = .jsc .js
|
||||
|
||||
.js.jsc:
|
||||
$(JSCOMPILER) $(JSCOMPILER_FLAGS) -c $<
|
||||
@@ -1,244 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
#
|
||||
# Automakefile for jswrap.
|
||||
# Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
#
|
||||
# Author: Markku Rossi <[email protected]>
|
||||
#
|
||||
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
# MA 02111-1307, USA
|
||||
#
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
ACLOCAL_FLAGS_FOR_LIBTOOL = @ACLOCAL_FLAGS_FOR_LIBTOOL@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
EXTENSIONS = @EXTENSIONS@
|
||||
EXTENSIONS_LIBS = @EXTENSIONS_LIBS@
|
||||
INTERPRETER_FEATURES = @INTERPRETER_FEATURES@
|
||||
LD = @LD@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
NM = @NM@
|
||||
PACKAGE = @PACKAGE@
|
||||
PGCC_BY_PROVENZANO = @PGCC_BY_PROVENZANO@
|
||||
RANLIB = @RANLIB@
|
||||
U = @U@
|
||||
VERSION = @VERSION@
|
||||
XLC_R_AIX = @XLC_R_AIX@
|
||||
|
||||
JSCOMPILER = ../src/js
|
||||
JSCOMPILER_FLAGS = -Wpedantic -O2 -g
|
||||
|
||||
JSS = process.js main.js
|
||||
JSCS = process.jsc main.jsc
|
||||
|
||||
EXTRA_DIST = $(JSS)
|
||||
|
||||
bin_SCRIPTS = jswrap
|
||||
|
||||
CLEANFILES = jswrap $(JSCS)
|
||||
|
||||
SUFFIXES = .jsc .js
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../jsconfig.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
SCRIPTS = $(bin_SCRIPTS)
|
||||
|
||||
DIST_COMMON = ChangeLog Makefile.am Makefile.in TODO
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
all: Makefile $(SCRIPTS)
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .js .jsc
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps jswrap/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
install-binSCRIPTS: $(bin_SCRIPTS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
@list='$(bin_SCRIPTS)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
|
||||
$(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||
else if test -f $(srcdir)/$$p; then \
|
||||
echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
|
||||
$(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||
else :; fi; fi; \
|
||||
done
|
||||
|
||||
uninstall-binSCRIPTS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(bin_SCRIPTS)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||
done
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = jswrap
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
info:
|
||||
dvi:
|
||||
check: all
|
||||
$(MAKE)
|
||||
installcheck:
|
||||
install-exec: install-binSCRIPTS
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install-data:
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-exec install-data all
|
||||
@:
|
||||
|
||||
uninstall: uninstall-binSCRIPTS
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DATADIR)$(bindir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-generic
|
||||
|
||||
clean: clean-generic mostlyclean
|
||||
|
||||
distclean: distclean-generic clean
|
||||
-rm -f config.status
|
||||
-rm -f libtool
|
||||
|
||||
maintainer-clean: maintainer-clean-generic distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
.PHONY: uninstall-binSCRIPTS install-binSCRIPTS tags distdir info dvi \
|
||||
installcheck install-exec install-data install uninstall all \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
compile: $(JSCS)
|
||||
|
||||
jswrap: $(JSS)
|
||||
rm -f $@.js
|
||||
for i in $(JSS); do cat $(srcdir)/$$i >> $@.js; done
|
||||
$(JSCOMPILER) $(JSCOMPILER_FLAGS) -c $@.js
|
||||
echo "#!$(bindir)/js --file" > $@
|
||||
# echo "#!$(JSCOMPILER) --file" > $@
|
||||
cat $@.jsc >> $@
|
||||
chmod a+x $@
|
||||
|
||||
.js.jsc:
|
||||
$(JSCOMPILER) $(JSCOMPILER_FLAGS) -c $<
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -1,13 +0,0 @@
|
||||
|
||||
TODO jswrap
|
||||
===========
|
||||
|
||||
* Fix the debugging information in the embedded byte-code files: input
|
||||
file name (.psw) and line numbers. This requires support from the
|
||||
compiler.
|
||||
|
||||
* The current version do not optimize with -O2. We can't do the
|
||||
liveness analysing, because on `return' statements, arguments are
|
||||
not alive, and the by-reference return values won't work. The
|
||||
compiler needs a new flag JSC$FLAG_OPTIMIZE_ARGUMENTS_LIVE_ON_RETURN
|
||||
that would fix the problem.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,248 +0,0 @@
|
||||
/*
|
||||
* JS C wrapper.
|
||||
* Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
*
|
||||
* Author: Markku Rossi <mtr@ngs.fi>
|
||||
*/
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
* MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Source: /cygdrive/c/RCVS/CVS/ReactOS/reactos/lib/kjs/jswrap/main.js,v $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Variables and definitions.
|
||||
*/
|
||||
|
||||
version_number = "0.0.1";
|
||||
|
||||
/*
|
||||
* Options.
|
||||
*/
|
||||
|
||||
/*
|
||||
* -g, --debug
|
||||
*
|
||||
* Generate debugging information to the generated JS byte-code.
|
||||
*/
|
||||
|
||||
opt_debug = false;
|
||||
|
||||
/*
|
||||
* -h FILE, --header FILE
|
||||
*
|
||||
* Generate the C header to file FILE.
|
||||
*/
|
||||
|
||||
header_file = null;
|
||||
|
||||
/*
|
||||
* -n, --no-error-handler
|
||||
*
|
||||
* Do not create the default error handler to the C files.
|
||||
*/
|
||||
opt_no_error_handler = false;
|
||||
|
||||
/*
|
||||
* -o FILE, --output FILE
|
||||
*
|
||||
* Generate the C output to file FILE.
|
||||
*/
|
||||
|
||||
output_file = null;
|
||||
|
||||
/*
|
||||
* -r, --reentrant
|
||||
*
|
||||
* Generate re-entrant C stubs.
|
||||
*/
|
||||
|
||||
opt_reentrant = false;
|
||||
|
||||
/*
|
||||
* -V, --version
|
||||
*
|
||||
* Print version information and exit successfully.
|
||||
*/
|
||||
|
||||
/*
|
||||
* --help
|
||||
*
|
||||
* Print short help and exit successfully.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Functions.
|
||||
*/
|
||||
|
||||
function main ()
|
||||
{
|
||||
var idx = ARGS[0].lastIndexOf ("/");
|
||||
if (idx >= 0)
|
||||
program = ARGS[0].substr (idx + 1);
|
||||
else
|
||||
program = ARGS[0];
|
||||
|
||||
/* Handle arguments. */
|
||||
var i;
|
||||
for (i = 1; i < ARGS.length; i++)
|
||||
{
|
||||
if (ARGS[i][0] == #'-')
|
||||
{
|
||||
if (ARGS[i] == "-g" || ARGS[i] == "--debug")
|
||||
opt_debug = true;
|
||||
else if (ARGS[i] == "-h" || ARGS[i] == "--header")
|
||||
{
|
||||
if (i + 1 >= ARGS.length)
|
||||
{
|
||||
System.error (program,
|
||||
": no argument for option --header\n");
|
||||
System.exit (1);
|
||||
}
|
||||
|
||||
header_file = ARGS[++i];
|
||||
}
|
||||
else if (ARGS[i] == "-n" || ARGS[i] == "--no-error-handler")
|
||||
opt_no_error_handler = true;
|
||||
else if (ARGS[i] == "-o" || ARGS[i] == "--output")
|
||||
{
|
||||
if (i + 1 >= ARGS.length)
|
||||
{
|
||||
System.error (program,
|
||||
": no argument for option --output\n");
|
||||
System.exit (1);
|
||||
}
|
||||
|
||||
output_file = ARGS[++i];
|
||||
}
|
||||
else if (ARGS[i] == "-r" || ARGS[i] == "--reentrant")
|
||||
opt_reentrant = true;
|
||||
else if (ARGS[i] == "-V" || ARGS[i] == "--version")
|
||||
{
|
||||
version ();
|
||||
System.exit (0);
|
||||
}
|
||||
else if (ARGS[i] == "--help")
|
||||
{
|
||||
usage ();
|
||||
System.exit (0);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Unrecognized option. */
|
||||
System.error (program, ": unrecognized option `",
|
||||
ARGS[i], "'\n");
|
||||
System.error ("Try `", program,
|
||||
" --help' for more information.\n");
|
||||
System.exit (1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* End of arguments. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i >= ARGS.length)
|
||||
{
|
||||
System.error (program, ": no input file specified\n");
|
||||
System.exit (1);
|
||||
}
|
||||
if (i + 1 < ARGS.length)
|
||||
{
|
||||
System.error (program, ": extraneous arguments after input file\n");
|
||||
System.exit (1);
|
||||
}
|
||||
|
||||
input_file = ARGS[i];
|
||||
|
||||
/* Set the defaults. */
|
||||
|
||||
var re = new RegExp ("^(.*)\\.jsw$");
|
||||
if (!header_file)
|
||||
{
|
||||
if (re.test (input_file))
|
||||
header_file = RegExp.$1 + ".h";
|
||||
else
|
||||
header_file = input_file + ".h";
|
||||
}
|
||||
if (!output_file)
|
||||
{
|
||||
if (re.test (input_file))
|
||||
output_file = RegExp.$1 + ".c";
|
||||
else
|
||||
output_file = input_file + ".c";
|
||||
}
|
||||
if (false)
|
||||
{
|
||||
if (re.test (input_file))
|
||||
js_file = RegExp.$1 + ".js";
|
||||
else
|
||||
js_file = input_file + ".js";
|
||||
}
|
||||
|
||||
process ();
|
||||
}
|
||||
|
||||
|
||||
function usage ()
|
||||
{
|
||||
System.print ("\
|
||||
Usage: ", program, " [OPTION]... FILE\n\
|
||||
Mandatory arguments to long options are mandatory for short options too.\n");
|
||||
|
||||
System.print ("\
|
||||
-g, --debug generate debugging information to the generated\n\
|
||||
JS byte-code\n\
|
||||
-h, --header FILE generate the C header to file FILE\n\
|
||||
-n, --no-error-handler do not generate the default error handler\n\
|
||||
-o, --output FILE generate the C output to file FILE\n\
|
||||
-r, --reentrant generate re-entrant C stubs\n\
|
||||
-V, --version print version number\n\
|
||||
--help print this help and exit\n\
|
||||
");
|
||||
|
||||
System.print ("\nReport bugs to [email protected].\n");
|
||||
}
|
||||
|
||||
|
||||
function version ()
|
||||
{
|
||||
System.print ("NGS JavaScript C wrapper generator ", version_number, "\n");
|
||||
System.print ("\
|
||||
Copyright (C) 1998 New Generation Software (NGS) Oy.\n\
|
||||
NGS JavaScript Interpreter comes with NO WARRANTY, to the extent\n\
|
||||
permitted by law. You may redistribute copies of NGS JavaScript\n\
|
||||
Interpreter under the terms of the GNU Library General Public License.\n\
|
||||
For more information about these matters, see the files named COPYING.\n\
|
||||
");
|
||||
}
|
||||
|
||||
|
||||
main ();
|
||||
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
mode: c
|
||||
End:
|
||||
*/
|
||||
@@ -1,890 +0,0 @@
|
||||
/*
|
||||
* Process the jswrap input files and generate output.
|
||||
* Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
*
|
||||
* Author: Markku Rossi <mtr@ngs.fi>
|
||||
*/
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
* MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Source: /cygdrive/c/RCVS/CVS/ReactOS/reactos/lib/kjs/jswrap/process.js,v $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Constants and definitions.
|
||||
*/
|
||||
|
||||
/* Tokens. */
|
||||
|
||||
tEOF = 1000;
|
||||
|
||||
tFUNCTION = 1001;
|
||||
tIDENTIFIER = 1002;
|
||||
|
||||
tCSTRING = 2001;
|
||||
tDOUBLE = 2002;
|
||||
tINT = 2003;
|
||||
tSTRING = 2004;
|
||||
tVOID = 2005;
|
||||
|
||||
tIN = 2010;
|
||||
tOUT = 2011;
|
||||
tINOUT = 2012;
|
||||
|
||||
tSTATIC = 2020;
|
||||
|
||||
function is_type_token (token)
|
||||
{
|
||||
return (token == tCSTRING || token == tDOUBLE || token == tINT
|
||||
|| token == tSTRING || token == tVOID);
|
||||
}
|
||||
|
||||
function is_copy_type_token (token)
|
||||
{
|
||||
return (token == tIN || token == tOUT || token == tINOUT);
|
||||
}
|
||||
|
||||
function typename (token)
|
||||
{
|
||||
if (token == tCSTRING)
|
||||
return "cstring";
|
||||
else if (token == tDOUBLE)
|
||||
return "double";
|
||||
else if (token == tINT)
|
||||
return "int";
|
||||
else if (token == tSTRING)
|
||||
return "string";
|
||||
else if (token == tVOID)
|
||||
return "void";
|
||||
else if (token == tIN)
|
||||
return "in";
|
||||
else if (token == tOUT)
|
||||
return "out";
|
||||
else if (token == tINOUT)
|
||||
return "inout";
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
function c_typename (token)
|
||||
{
|
||||
if (token == tCSTRING)
|
||||
return "char *";
|
||||
else if (token == tDOUBLE)
|
||||
return "double ";
|
||||
else if (token == tINT)
|
||||
return "long ";
|
||||
else if (token == tVOID)
|
||||
return "void ";
|
||||
else if (token == tOUT || token == tINOUT)
|
||||
return "*";
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
function jsint_typename (token)
|
||||
{
|
||||
if (token == tCSTRING)
|
||||
return "JS_STRING";
|
||||
else if (token == tDOUBLE)
|
||||
return "JS_FLOAT";
|
||||
else if (token == tINT)
|
||||
return "JS_INTEGER";
|
||||
else if (token == tSTRING)
|
||||
return "JS_STRING";
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
valid_c_identifier_re = new RegExp ("^[A-Za-z_][A-Za-z_0-9]*$");
|
||||
|
||||
end_brace_re = new RegExp ("^}[ \t]*$");
|
||||
|
||||
/*
|
||||
* Variables.
|
||||
*/
|
||||
|
||||
/* The input file line number. */
|
||||
linenum = 1;
|
||||
|
||||
token_linenum = 1;
|
||||
|
||||
token_value = null;
|
||||
|
||||
/*
|
||||
* Functions.
|
||||
*/
|
||||
|
||||
function process ()
|
||||
{
|
||||
if (false)
|
||||
System.print (program, ": processing file `", input_file,
|
||||
"', header=`", header_file,
|
||||
"', output=`", output_file,
|
||||
"', reentrant=", opt_reentrant, "\n");
|
||||
|
||||
linenum = 1;
|
||||
|
||||
/* Open input file. */
|
||||
ifp = new File (input_file);
|
||||
if (!ifp.open ("r"))
|
||||
{
|
||||
System.error (program, ": couldn't open input file `", input_file,
|
||||
"': ", System.strerror (System.errno), "\n");
|
||||
System.exit (1);
|
||||
}
|
||||
|
||||
/* Create output files. */
|
||||
|
||||
ofp_c = new File (output_file);
|
||||
if (!ofp_c.open ("w"))
|
||||
{
|
||||
System.error (program, ": couldn't create output file `", output_file,
|
||||
"': ", System.strerror (System.errno), "\n");
|
||||
System.exit (1);
|
||||
}
|
||||
|
||||
ofp_h = new File (header_file);
|
||||
if (!ofp_h.open ("w"))
|
||||
{
|
||||
ofp_c.close ();
|
||||
File.remove (output_file);
|
||||
|
||||
System.error (program, ": couldn't create header file `", header_file,
|
||||
"': ", System.strerror (System.errno), "\n");
|
||||
System.exit (1);
|
||||
}
|
||||
|
||||
if (false)
|
||||
{
|
||||
ofp_js = new File (js_file);
|
||||
if (!ofp_js.open ("w"))
|
||||
{
|
||||
ofp_c.close ();
|
||||
ofp_h.close ();
|
||||
File.remove (output_file);
|
||||
File.remove (header_file);
|
||||
|
||||
System.error (program, ": couldn't create JS file `", js_file,
|
||||
"': ", System.strerror (System.errno), "\n");
|
||||
System.exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Parse the input. */
|
||||
parse ();
|
||||
|
||||
/* Cleanup. */
|
||||
|
||||
ofp_c.close ();
|
||||
ofp_h.close ();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The Func class to hold function definitions.
|
||||
*/
|
||||
|
||||
function Func ()
|
||||
{
|
||||
}
|
||||
|
||||
new Func ();
|
||||
|
||||
function Func$generate_js ()
|
||||
{
|
||||
this.code = new String ("function " + this.name + " (");
|
||||
var i;
|
||||
for (i = 0; i < this.args.length; i++)
|
||||
{
|
||||
this.code.append (this.args[i].name);
|
||||
if (i + 1 < this.args.length)
|
||||
this.code.append (", ");
|
||||
}
|
||||
this.code.append (")\n{");
|
||||
this.code.append (this.body);
|
||||
this.code.append ("}\n");
|
||||
}
|
||||
Func.prototype.generate_js = Func$generate_js;
|
||||
|
||||
function Func$print_js (stream)
|
||||
{
|
||||
stream.write (this.code);
|
||||
}
|
||||
Func.prototype.print_js = Func$print_js;
|
||||
|
||||
function Func$print_h (stream, header)
|
||||
{
|
||||
stream.write ("\n");
|
||||
stream.write (c_typename (this.return_type) + this.name + " (");
|
||||
|
||||
if (opt_reentrant)
|
||||
{
|
||||
/* The first argument is the interpreter handle. */
|
||||
stream.write ("\n\tJSInterpPtr interp");
|
||||
if (this.args.length > 0)
|
||||
stream.write (",");
|
||||
}
|
||||
|
||||
var i;
|
||||
for (i = 0; i < this.args.length; i++)
|
||||
{
|
||||
stream.write ("\n\t");
|
||||
if (this.args[i].type == tSTRING)
|
||||
{
|
||||
stream.write ("unsigned char *"
|
||||
+ c_typename (this.args[i].copy_type)
|
||||
+ this.args[i].name + ",\n\t"
|
||||
+ "unsigned int "
|
||||
+ c_typename (this.args[i].copy_type)
|
||||
+ this.args[i].name + "_len");
|
||||
}
|
||||
else
|
||||
{
|
||||
stream.write (c_typename (this.args[i].type)
|
||||
+ c_typename (this.args[i].copy_type));
|
||||
stream.write (this.args[i].name);
|
||||
}
|
||||
|
||||
if (i + 1 < this.args.length)
|
||||
stream.write (", ");
|
||||
}
|
||||
stream.write ("\n\t)");
|
||||
|
||||
if (header)
|
||||
stream.write (";");
|
||||
|
||||
stream.write ("\n");
|
||||
}
|
||||
Func.prototype.print_h = Func$print_h;
|
||||
|
||||
function Func$print_c (stream)
|
||||
{
|
||||
this.compile ();
|
||||
this.dump_bc (stream);
|
||||
|
||||
this.print_h (stream, false);
|
||||
|
||||
stream.write ("{\n");
|
||||
|
||||
if (!opt_reentrant)
|
||||
stream.write (" JSInterpPtr interp = jswrap_interp;\n");
|
||||
|
||||
stream.write (" JSVirtualMachine *vm = interp->vm;\n");
|
||||
|
||||
stream.write (" JSNode argv["
|
||||
+ (this.args.length + 1).toString ()
|
||||
+ "];\n");
|
||||
stream.write (" int result;\n");
|
||||
|
||||
if (this.return_type == tCSTRING)
|
||||
stream.write (" char *cp;\n");
|
||||
|
||||
stream.write ("\n");
|
||||
|
||||
/* Argument count. */
|
||||
stream.write (" argv[0].type = JS_INTEGER;\n");
|
||||
stream.write (" argv[0].u.vinteger = "
|
||||
+ this.args.length.toString ()
|
||||
+ ";\n");
|
||||
|
||||
/* Arguments. */
|
||||
|
||||
/* Construct the argv array. */
|
||||
for (i = 0; i < this.args.length; i++)
|
||||
{
|
||||
var arg = this.args[i];
|
||||
var cspec = "";
|
||||
|
||||
stream.write ("\n");
|
||||
|
||||
var argnum = (i + 1).toString ();
|
||||
|
||||
if (arg.copy_type == tOUT)
|
||||
{
|
||||
stream.write (" argv[" + argnum + "].type = JS_UNDEFINED;\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (arg.copy_type == tINOUT)
|
||||
cspec = "*";
|
||||
|
||||
if (arg.type == tCSTRING)
|
||||
{
|
||||
stream.write (" js_vm_make"
|
||||
+ (arg.staticp ? "_static" : "")
|
||||
+ "_string (vm, &argv["
|
||||
+ argnum + "], "
|
||||
+ cspec + arg.name + ", strlen ("
|
||||
+ cspec + arg.name + "));\n");
|
||||
}
|
||||
else if (arg.type == tDOUBLE)
|
||||
{
|
||||
stream.write (" argv[" + argnum + "].type = JS_FLOAT;\n");
|
||||
stream.write (" argv[" + argnum + "].u.vfloat = "
|
||||
+ cspec + arg.name + ";\n");
|
||||
}
|
||||
else if (arg.type == tINT)
|
||||
{
|
||||
stream.write (" argv[" + argnum + "].type = JS_INTEGER;\n");
|
||||
stream.write (" argv[" + argnum + "].u.vinteger = "
|
||||
+ cspec + arg.name + ";\n");
|
||||
}
|
||||
else if (arg.type == tSTRING)
|
||||
{
|
||||
stream.write (" js_vm_make_static_string (vm, &argv["
|
||||
+ argnum + "], "
|
||||
+ cspec + arg.name + ", "
|
||||
+ cspec + arg.name + "_len);\n");
|
||||
}
|
||||
else
|
||||
VM.stackTrace ();
|
||||
}
|
||||
}
|
||||
|
||||
/* Call the function. */
|
||||
stream.write ("\
|
||||
|
||||
retry:
|
||||
|
||||
result = js_vm_apply (vm, \"" + this.name + "\", NULL, "
|
||||
+ (i + 1).toString () + ", argv);
|
||||
if (result == 0)
|
||||
{
|
||||
JSNode *n = &vm->globals[js_vm_intern (vm, \"" + this.name + "\")];
|
||||
|
||||
if (n->type != JS_FUNC)
|
||||
{
|
||||
JSByteCode *bc = js_bc_read_data (" + this.name + "_bc,
|
||||
sizeof (" + this.name + "_bc));
|
||||
result = js_vm_execute (vm, bc);
|
||||
js_bc_free (bc);
|
||||
|
||||
if (result == 0)
|
||||
jswrap_error (interp, \"initialization of function`"
|
||||
+ this.name + "' failed\");
|
||||
goto retry;
|
||||
}
|
||||
jswrap_error (interp, \"execution of function `"
|
||||
+ this.name + "' failed\");
|
||||
}
|
||||
");
|
||||
|
||||
/* Handle out and inout parameters. */
|
||||
for (i = 0; i < this.args.length; i++)
|
||||
{
|
||||
var arg = this.args[i];
|
||||
if (arg.copy_type == tIN)
|
||||
continue;
|
||||
|
||||
var spos = (this.args.length - i).toString ();
|
||||
|
||||
/* Check that we have there a correct type. */
|
||||
stream.write ("
|
||||
if ((vm->sp - " + spos + ")->type != " + jsint_typename (arg.type) + ")
|
||||
jswrap_error (interp,
|
||||
\"wrong return type for argument `"
|
||||
+ arg.name + "' of function `" + this.name + "'\");
|
||||
");
|
||||
|
||||
/* Handle the different types. */
|
||||
if (arg.type == tCSTRING)
|
||||
{
|
||||
stream.write ("\
|
||||
*" + arg.name + " = (char *) js_vm_alloc (vm, (vm->sp - "
|
||||
+ spos + ")->u.vstring->len + 1);
|
||||
memcpy (*" + arg.name + ", (vm->sp - " + spos + ")->u.vstring->data,
|
||||
(vm->sp - " + spos + ")->u.vstring->len);
|
||||
" + arg.name + "[(vm->sp - " + spos + ")->u.vstring->len] = '\\0';
|
||||
");
|
||||
}
|
||||
else if (arg.type == tDOUBLE)
|
||||
{
|
||||
stream.write ("\
|
||||
*" + arg.name + " = (vm->sp - " + spos + ")->u.vfloat;\n");
|
||||
}
|
||||
else if (arg.type == tINT)
|
||||
{
|
||||
stream.write ("\
|
||||
*" + arg.name + " = (vm->sp - " + spos + ")->u.vinteger;\n");
|
||||
}
|
||||
else if (arg.type == tSTRING)
|
||||
{
|
||||
stream.write ("\
|
||||
*" + arg.name + " = (vm->sp - " + spos + ")->u.vstring->data;
|
||||
*" + arg.name + "_len = (vm->sp - " + spos + ")->u.vstring->len;
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle the function return value. */
|
||||
if (this.return_type != tVOID)
|
||||
{
|
||||
/* Check that the code returned correct type. */
|
||||
stream.write ("
|
||||
if (vm->exec_result.type != " + jsint_typename (this.return_type) + ")
|
||||
jswrap_error (interp, \"return type mismatch in function `"
|
||||
+ this.name + "'\");
|
||||
|
||||
");
|
||||
|
||||
/* Handle the different types. */
|
||||
if (this.return_type == tCSTRING)
|
||||
{
|
||||
stream.write ("\
|
||||
cp = (char *) js_vm_alloc (vm, vm->exec_result.u.vstring->len + 1);
|
||||
memcpy (cp, vm->exec_result.u.vstring->data, vm->exec_result.u.vstring->len);
|
||||
cp[vm->exec_result.u.vstring->len] = '\\0';
|
||||
|
||||
return cp;
|
||||
");
|
||||
}
|
||||
else if (this.return_type == tDOUBLE)
|
||||
stream.write (" return vm->exec_result.u.vfloat;\n");
|
||||
else if (this.return_type == tINT)
|
||||
stream.write (" return vm->exec_result.u.vinteger;\n");
|
||||
}
|
||||
|
||||
stream.write ("}\n");
|
||||
}
|
||||
Func.prototype.print_c = Func$print_c;
|
||||
|
||||
function Func$compile ()
|
||||
{
|
||||
/* Create the byte-code for this function. */
|
||||
|
||||
var flags = 0;
|
||||
|
||||
if (false)
|
||||
flags |= JSC$FLAG_VERBOSE;
|
||||
|
||||
if (opt_debug)
|
||||
flags |= JSC$FLAG_GENERATE_DEBUG_INFO;
|
||||
|
||||
flags |= (JSC$FLAG_OPTIMIZE_PEEPHOLE
|
||||
| JSC$FLAG_OPTIMIZE_JUMPS
|
||||
| JSC$FLAG_OPTIMIZE_BC_SIZE);
|
||||
|
||||
flags |= JSC$FLAG_WARN_MASK;
|
||||
|
||||
try
|
||||
{
|
||||
this.bc = JSC$compile_string (this.code, flags, null, null);
|
||||
}
|
||||
catch (error)
|
||||
{
|
||||
System.error (error, "\n");
|
||||
System.exit (1);
|
||||
}
|
||||
}
|
||||
Func.prototype.compile = Func$compile;
|
||||
|
||||
function Func$dump_bc (stream)
|
||||
{
|
||||
stream.write ("\nstatic unsigned char " + this.name + "_bc[] = {");
|
||||
|
||||
var i;
|
||||
for (i = 0; i < this.bc.length; i++)
|
||||
{
|
||||
if ((i % 12) == 0)
|
||||
stream.write ("\n ");
|
||||
|
||||
var item = this.bc[i].toString (16);
|
||||
if (item.length == 1)
|
||||
item = "0" + item;
|
||||
|
||||
stream.write (" 0x" + item + ",");
|
||||
}
|
||||
|
||||
stream.write ("\n};\n");
|
||||
}
|
||||
Func.prototype.dump_bc = Func$dump_bc;
|
||||
|
||||
/*
|
||||
* The Argument class to hold function argument definitions.
|
||||
*/
|
||||
|
||||
function Argument ()
|
||||
{
|
||||
this.type = false;
|
||||
this.copy_type = tIN;
|
||||
this.staticp = false;
|
||||
}
|
||||
|
||||
new Argument ();
|
||||
|
||||
function Argument$print ()
|
||||
{
|
||||
System.print (typename (this.copy_type), " ", typename (this.type),
|
||||
" ", this.name);
|
||||
}
|
||||
Argument.prototype.print = Argument$print;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* The .jsw file parsing.
|
||||
*/
|
||||
|
||||
function parse ()
|
||||
{
|
||||
var token;
|
||||
var func;
|
||||
|
||||
headers ();
|
||||
|
||||
while ((token = get_token ()) != tEOF)
|
||||
{
|
||||
if (token != tFUNCTION)
|
||||
syntax_error ();
|
||||
|
||||
func = new Func ();
|
||||
|
||||
/* Possible return type. */
|
||||
token = get_token ();
|
||||
if (is_type_token (token))
|
||||
{
|
||||
if (token == tSTRING)
|
||||
{
|
||||
System.error (input_file, ":", linenum,
|
||||
": the function return value can't be `string'\n");
|
||||
System.exit (1);
|
||||
}
|
||||
|
||||
func.return_type = token;
|
||||
|
||||
token = get_token ();
|
||||
}
|
||||
else
|
||||
func.return_type = tVOID;
|
||||
|
||||
/* The name of the function. */
|
||||
if (token != tIDENTIFIER)
|
||||
syntax_error ();
|
||||
|
||||
if (!valid_c_identifier_re.test (token_value))
|
||||
{
|
||||
System.error (input_file, ":", linenum,
|
||||
": function name is not a valid C identifier `",
|
||||
token_value, "'\n");
|
||||
System.exit (1);
|
||||
}
|
||||
|
||||
func.name = token_value;
|
||||
|
||||
/* Arguments. */
|
||||
token = get_token ();
|
||||
if (token != #'(')
|
||||
syntax_error ();
|
||||
|
||||
var args = new Array ();
|
||||
|
||||
token = get_token ();
|
||||
while (token != #')')
|
||||
{
|
||||
var arg = new Argument ();
|
||||
|
||||
while (token != tIDENTIFIER)
|
||||
{
|
||||
if (token == tEOF)
|
||||
syntax_error ();
|
||||
|
||||
if (is_type_token (token))
|
||||
arg.type = token;
|
||||
else if (is_copy_type_token (token))
|
||||
arg.copy_type = token;
|
||||
else if (token == tSTATIC)
|
||||
arg.staticp = true;
|
||||
else
|
||||
syntax_error ();
|
||||
|
||||
token = get_token ();
|
||||
}
|
||||
|
||||
if (!valid_c_identifier_re.test (token_value))
|
||||
{
|
||||
System.error (input_file, ":", linenum,
|
||||
": argument name is not a valid C identifier `",
|
||||
token_value, "'\n");
|
||||
System.exit (1);
|
||||
}
|
||||
arg.name = token_value;
|
||||
|
||||
/* Check some validity conditions. */
|
||||
if (!arg.type)
|
||||
{
|
||||
System.error (input_file, ":", linenum,
|
||||
": no type specified for argument `",
|
||||
arg.name, "'\n");
|
||||
System.exit (1);
|
||||
}
|
||||
if (arg.staticp)
|
||||
{
|
||||
if (arg.type != tCSTRING && arg.type != tSTRING)
|
||||
{
|
||||
System.error (input_file, ":", linenum,
|
||||
": type `static' can only be used with `cstring' and `string' arguments\n");
|
||||
System.exit (1);
|
||||
}
|
||||
if (arg.copy_type == tOUT)
|
||||
System.error (input_file, ":", linenum,
|
||||
": warning: type `static' is meaningful only with `in' and `inout' arguments\n");
|
||||
}
|
||||
|
||||
args.push (arg);
|
||||
|
||||
token = get_token ();
|
||||
if (token == #',')
|
||||
token = get_token ();
|
||||
}
|
||||
|
||||
func.args = args;
|
||||
|
||||
/* The opening '{' of the function body. */
|
||||
token = get_token ();
|
||||
if (token != #'{')
|
||||
syntax_error ();
|
||||
|
||||
/* Get the function body. */
|
||||
var code = new String ("");
|
||||
while (true)
|
||||
{
|
||||
var line = ifp.readln ();
|
||||
if (!line)
|
||||
syntax_error ();
|
||||
linenum++;
|
||||
|
||||
if (end_brace_re.test (line))
|
||||
break;
|
||||
|
||||
code.append (line + "\n");
|
||||
}
|
||||
|
||||
func.body = code;
|
||||
func.generate_js ();
|
||||
|
||||
// func.print_js (ofp_js);
|
||||
func.print_h (ofp_h, true);
|
||||
func.print_c (ofp_c);
|
||||
}
|
||||
|
||||
trailers ();
|
||||
}
|
||||
|
||||
function get_token ()
|
||||
{
|
||||
var ch;
|
||||
|
||||
while ((ch = ifp.readByte ()) != -1)
|
||||
{
|
||||
if (ch == #' ' || ch == #'\t' || ch == #'\v' || ch == #'\r'
|
||||
|| ch == #'\f')
|
||||
continue;
|
||||
|
||||
if (ch == #'\n')
|
||||
{
|
||||
linenum++;
|
||||
continue;
|
||||
}
|
||||
|
||||
token_linenum = linenum;
|
||||
|
||||
if (ch == #'/' && peek_char () == #'*')
|
||||
{
|
||||
/* Multi line comment. */
|
||||
ifp.readByte ();
|
||||
while ((ch = ifp.readByte ()) != -1
|
||||
&& (ch != #'*' || peek_char () != #'/'))
|
||||
if (ch == #'\n')
|
||||
linenum++;
|
||||
|
||||
/* Consume the peeked #'/' character. */
|
||||
ifp.readByte ();
|
||||
}
|
||||
|
||||
/* Identifiers and keywords. */
|
||||
else if (JSC$lexer_is_identifier_letter (ch))
|
||||
{
|
||||
/* An identifier. */
|
||||
var id = String.fromCharCode (ch);
|
||||
|
||||
while ((ch = ifp.readByte ()) != -1
|
||||
&& (JSC$lexer_is_identifier_letter (ch)
|
||||
|| JSC$lexer_is_decimal_digit (ch)))
|
||||
id.append (File.byteToString (ch));
|
||||
ifp.ungetByte (ch);
|
||||
|
||||
/* Keywords. */
|
||||
if (id == "function")
|
||||
return tFUNCTION;
|
||||
|
||||
/* Types. */
|
||||
else if (id == "cstring")
|
||||
return tCSTRING;
|
||||
else if (id == "double")
|
||||
return tDOUBLE;
|
||||
else if (id == "int")
|
||||
return tINT;
|
||||
else if (id == "string")
|
||||
return tSTRING;
|
||||
else if (id == "void")
|
||||
return tVOID;
|
||||
else if (id == "in")
|
||||
return tIN;
|
||||
else if (id == "out")
|
||||
return tOUT;
|
||||
else if (id == "inout")
|
||||
return tINOUT;
|
||||
else if (id == "static")
|
||||
return tSTATIC;
|
||||
|
||||
else
|
||||
{
|
||||
/* It really is an identifier. */
|
||||
token_value = id;
|
||||
return tIDENTIFIER;
|
||||
}
|
||||
}
|
||||
|
||||
/* Just return the character as-is. */
|
||||
else
|
||||
return ch;
|
||||
}
|
||||
|
||||
/* EOF reached. */
|
||||
return tEOF;
|
||||
}
|
||||
|
||||
function peek_char ()
|
||||
{
|
||||
var ch = ifp.readByte ();
|
||||
ifp.ungetByte (ch);
|
||||
|
||||
return ch;
|
||||
}
|
||||
|
||||
function syntax_error ()
|
||||
{
|
||||
System.error (input_file, ":", linenum, ": syntax error\n");
|
||||
System.exit (1);
|
||||
}
|
||||
|
||||
function headers ()
|
||||
{
|
||||
var stream;
|
||||
|
||||
/* The header file. */
|
||||
|
||||
stream = ofp_h;
|
||||
header_banner (stream);
|
||||
|
||||
var ppname = path_to_ppname (header_file);
|
||||
stream.write ("\n#ifndef " + ppname
|
||||
+ "\n#define " + ppname + "\n");
|
||||
|
||||
/* The C file. */
|
||||
stream = ofp_c;
|
||||
header_banner (stream);
|
||||
stream.write ("\n#include <jsint.h>\n");
|
||||
|
||||
if (!opt_reentrant)
|
||||
{
|
||||
stream.write ("
|
||||
/*
|
||||
* This global interpreter handle can be removed with " + program + "'s
|
||||
* option -r, --reentrant.
|
||||
*/
|
||||
");
|
||||
stream.write ("extern JSInterpPtr jswrap_interp;\n");
|
||||
}
|
||||
|
||||
if (opt_no_error_handler)
|
||||
{
|
||||
stream.write ("
|
||||
/* Prototype for the error handler of the JS runtime errors. */
|
||||
");
|
||||
stream.write ("void jswrap_error (JSInterpPtr interp, char *error);\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Define the default jswrap_error() function. */
|
||||
stream.write ("
|
||||
/*
|
||||
* This is the default error handler for the JS runtime errors. The default
|
||||
* handler can be removed with " + program + "'s option -n, --no-error-handler.
|
||||
* In this case, your code must define the handler function.
|
||||
*/
|
||||
");
|
||||
stream.write ("\
|
||||
static void
|
||||
jswrap_error (JSInterpPtr interp, char *error)
|
||||
{
|
||||
const char *cp;
|
||||
|
||||
fprintf (stderr, \"JS runtime error: %s\", error);
|
||||
|
||||
cp = js_error_message (interp);
|
||||
if (cp[0])
|
||||
fprintf (stderr, \": %s\", cp);
|
||||
fprintf (stderr, \"\\n\");
|
||||
|
||||
exit (1);
|
||||
}
|
||||
");
|
||||
}
|
||||
|
||||
stream.write ("
|
||||
|
||||
/*
|
||||
* The global function definitions.
|
||||
*/
|
||||
");
|
||||
}
|
||||
|
||||
function header_banner (stream)
|
||||
{
|
||||
stream.write ("/* This file is automatically generated from `"
|
||||
+ input_file + "' by " + program + ". */\n");
|
||||
}
|
||||
|
||||
path_to_ppname_re = new RegExp ("[^A-Za-z_0-9]", "g");
|
||||
|
||||
function path_to_ppname (path)
|
||||
{
|
||||
var str = path.toUpperCase ().replace (path_to_ppname_re, "_");
|
||||
if (#'0' <= str[0] && str[0] <= #'9')
|
||||
str = "_" + str;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function trailers ()
|
||||
{
|
||||
/* The header file. */
|
||||
var stream = ofp_h;
|
||||
stream.write ("\n#endif /* not " + path_to_ppname (header_file) + " */\n");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
mode: c
|
||||
End:
|
||||
*/
|
||||
@@ -1,11 +0,0 @@
|
||||
; $Id$
|
||||
;
|
||||
; ReactOS Operating System
|
||||
;
|
||||
LIBRARY kjs.dll
|
||||
|
||||
EXPORTS
|
||||
kjs_eval
|
||||
kjs_system_register
|
||||
kjs_create_interp
|
||||
kjs_destroy_interp
|
||||
@@ -1,44 +0,0 @@
|
||||
<module name="kjs" type="staticlibrary">
|
||||
<include base="kjs">.</include>
|
||||
<include base="kjs">src</include>
|
||||
<include base="kjs">include</include>
|
||||
<define name="__NO_CTYPE_INLINES" />
|
||||
<define name="__USE_W32API" />
|
||||
<define name="_NTOSKRNL_" />
|
||||
<directory name="ksrc">
|
||||
<file>setjmp.S</file>
|
||||
<file>longjmp.S</file>
|
||||
<file>alloc.c</file>
|
||||
<file>bc.c</file>
|
||||
<file>b_core.c</file>
|
||||
<file>b_file.c</file>
|
||||
<file>b_func.c</file>
|
||||
<file>b_regexp.c</file>
|
||||
<file>b_system.c</file>
|
||||
<file>compat.c</file>
|
||||
<file>debug.c</file>
|
||||
<file>iostream.c</file>
|
||||
<file>js.c</file>
|
||||
<file>kjs.c</file>
|
||||
<file>mrgsort.c</file>
|
||||
<file>object.c</file>
|
||||
<file>regex.c</file>
|
||||
<file>vm.c</file>
|
||||
<file>vmjumps.c</file>
|
||||
<file>vmswitch.c</file>
|
||||
<file>vmswt0.c</file>
|
||||
</directory>
|
||||
<directory name="src">
|
||||
<file>b_array.c</file>
|
||||
<file>b_bool.c</file>
|
||||
<file>b_object.c</file>
|
||||
<file>b_number.c</file>
|
||||
<file>b_string.c</file>
|
||||
<file>b_vm.c</file>
|
||||
<file>compiler.c</file>
|
||||
<file>crc32.c</file>
|
||||
<file>dl_dummy.c</file>
|
||||
<file>heap.c</file>
|
||||
<file>utils.c</file>
|
||||
</directory>
|
||||
</module>
|
||||
@@ -1,7 +0,0 @@
|
||||
/* $Id$ */
|
||||
|
||||
#define REACTOS_VERSION_DLL
|
||||
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Kernel JavaScript DLL\0"
|
||||
#define REACTOS_STR_INTERNAL_NAME "kjs\0"
|
||||
#define REACTOS_STR_ORIGINAL_FILENAME "kjs.dll\0"
|
||||
#include <reactos/version.rc>
|
||||
@@ -1,46 +0,0 @@
|
||||
function write(x) { System.print(x); }'
|
||||
function regs(n) { return System.regs(n); }
|
||||
function debugebp() { return regs(0); }
|
||||
function debugeip() { return regs(1); }
|
||||
function tf_argmark() { return regs(2); }
|
||||
function tf_pointer() { return regs(3); }
|
||||
function tf_tempcs() { return regs(4); }
|
||||
function tf_tempeip() { return regs(5); }
|
||||
function dr0() { return regs(6); }
|
||||
function dr1() { return regs(7); }
|
||||
function dr2() { return regs(8); }
|
||||
function dr3() { return regs(9); }
|
||||
function dr6() { return regs(10); }
|
||||
function dr7() { return regs(11); }
|
||||
function gs() { return regs(12) & 0xffff; }
|
||||
function es() { return regs(13) & 0xffff; }
|
||||
function ds() { return regs(14) & 0xffff; }
|
||||
function edx() { return regs(15); }
|
||||
function ecx() { return regs(16); }
|
||||
function eax() { return regs(17); }
|
||||
function tf_pmode() { return regs(18); }
|
||||
function tf_exl() { return regs(19); }
|
||||
function fs() { return regs(20) & 0xffff; }
|
||||
function edi() { return regs(21); }
|
||||
function esi() { return regs(22); }
|
||||
function ebx() { return regs(23); }
|
||||
function ebp() { return regs(24); }
|
||||
function error_code() { return regs(25); }
|
||||
function eip() { return regs(26); }
|
||||
function cs() { return regs(27) & 0xffff; }
|
||||
function eflags() { return regs(28); }
|
||||
function esp() { return regs(29); }
|
||||
function ss() { return regs(30) & 0xffff; }
|
||||
function v86_es() { return regs(31) & 0xffff; }
|
||||
function v86_ds() { return regs(32) & 0xffff; }
|
||||
function v86_fs() { return regs(33) & 0xffff; }
|
||||
function v86_gs() { return regs(34) & 0xffff; }
|
||||
function peekl(a) { return System.mread(4,a); }
|
||||
function pokel(a,b) { return System.mwrite(4,a,b); }
|
||||
function peekw(a) { return System.mread(2,a); }
|
||||
function pokew(a,b) { return System.mwrite(2,a,b); }
|
||||
function peek(a) { return System.mread(1,a); }
|
||||
function poke(a,b) { return System.mwrite(1,a,b); }
|
||||
function regread(x,y) { return System.regread(x,y); }
|
||||
function findmodule(str) { return System.findmodule(str); }
|
||||
write('JS Registry Init Complete. Welcome to ReactOS kernel scripting');
|
||||
@@ -1,342 +0,0 @@
|
||||
/*
|
||||
* Memory allocation routines.
|
||||
* Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
*
|
||||
* Author: Markku Rossi <mtr@ngs.fi>
|
||||
*/
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
* MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Source: /cygdrive/c/RCVS/CVS/ReactOS/reactos/lib/kjs/ksrc/alloc.c,v $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include "ntddk.h"
|
||||
#include "jsint.h"
|
||||
|
||||
/*
|
||||
* Global functions.
|
||||
*/
|
||||
|
||||
#if JS_DEBUG_MEMORY_LEAKS
|
||||
|
||||
struct mem_debug_st
|
||||
{
|
||||
struct mem_debug_st *next;
|
||||
struct mem_debug_st *prev;
|
||||
char *file;
|
||||
int line;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
typedef struct mem_debug_st MemDebug;
|
||||
|
||||
static MemDebug *mem_debug_blocks = NULL;
|
||||
|
||||
int mem_debug_balance = 0;
|
||||
|
||||
unsigned int alloc_fail = 0;
|
||||
unsigned int alloc_count = 0;
|
||||
|
||||
static void
|
||||
register_block (MemDebug *b, size_t size, char *file, int line)
|
||||
{
|
||||
b->next = NULL;
|
||||
b->prev = NULL;
|
||||
b->file = file;
|
||||
b->line = line;
|
||||
b->size = size;
|
||||
|
||||
if (mem_debug_blocks)
|
||||
{
|
||||
b->next = mem_debug_blocks;
|
||||
mem_debug_blocks->prev = b;
|
||||
}
|
||||
|
||||
mem_debug_blocks = b;
|
||||
mem_debug_balance++;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
unregister_block (MemDebug *b)
|
||||
{
|
||||
if (b->file == NULL)
|
||||
{
|
||||
fprintf (stderr, "freeing the same block twise\n");
|
||||
abort ();
|
||||
}
|
||||
|
||||
if (b->next)
|
||||
b->next->prev = b->prev;
|
||||
|
||||
if (b->prev)
|
||||
b->prev->next = b->next;
|
||||
else
|
||||
mem_debug_blocks = b->next;
|
||||
|
||||
b->file = NULL;
|
||||
|
||||
mem_debug_balance--;
|
||||
}
|
||||
|
||||
|
||||
static __inline int
|
||||
check_fail ()
|
||||
{
|
||||
return alloc_fail != 0 && ++alloc_count >= alloc_fail;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
js_alloc_dump_blocks ()
|
||||
{
|
||||
MemDebug *b;
|
||||
unsigned int bytes = 0;
|
||||
|
||||
fprintf (stderr, "js_alloc_dump_blocks(): #blocks=%d\n", mem_debug_balance);
|
||||
|
||||
for (b = mem_debug_blocks; b; b = b->next)
|
||||
{
|
||||
fprintf (stderr, "%s:%d: %lu\n", b->file, b->line, b->size);
|
||||
bytes += b->size;
|
||||
}
|
||||
|
||||
fprintf (stderr, "leaks=%u\n", bytes);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void *
|
||||
js_malloc_i (JSVirtualMachine *vm, size_t size, char *file, int line)
|
||||
{
|
||||
MemDebug *ptr;
|
||||
|
||||
ptr = ExAllocatePool (NonPagedPool,
|
||||
sizeof (MemDebug) + sizeof( size_t ) + size);
|
||||
if (check_fail () || ptr == NULL)
|
||||
{
|
||||
if (vm != NULL)
|
||||
{
|
||||
sprintf (vm->error, "VM: memory exhausted");
|
||||
js_vm_error (vm);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*((size_t *)ptr) = size;
|
||||
ptr = &((size_t *)ptr)[1];
|
||||
|
||||
register_block (ptr, size, file, line);
|
||||
|
||||
return (unsigned char *) ptr + sizeof (MemDebug);
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
js_calloc_i (JSVirtualMachine *vm, size_t num, size_t size, char *file,
|
||||
int line)
|
||||
{
|
||||
MemDebug *ptr;
|
||||
|
||||
ptr = ExAllocatePool (NonPagedPool, sizeof (MemDebug) + sizeof( int ) + num * size);
|
||||
if (check_fail () || ptr == NULL)
|
||||
{
|
||||
if (vm != NULL)
|
||||
{
|
||||
sprintf (vm->error, "VM: memory exhausted");
|
||||
js_vm_error (vm);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*((size_t *)ptr) = size;
|
||||
ptr = &((size_t *)ptr)[1];
|
||||
|
||||
memset (ptr, 0, sizeof (MemDebug) + num * size);
|
||||
register_block (ptr, num * size, file, line);
|
||||
|
||||
return (unsigned char *) ptr + sizeof (MemDebug);
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
js_realloc_i (JSVirtualMachine *vm, void *ptr, size_t size, char *file,
|
||||
int line)
|
||||
{
|
||||
void *nptr;
|
||||
MemDebug *b;
|
||||
|
||||
if (ptr == NULL)
|
||||
return js_malloc_i (vm, size, file, line);
|
||||
|
||||
nptr = js_malloc_i (vm, size, file, line);
|
||||
if (nptr == NULL)
|
||||
{
|
||||
if (vm != NULL)
|
||||
{
|
||||
sprintf (vm->error, "VM: memory exhausted");
|
||||
js_vm_error (vm);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
b = (MemDebug *) ((unsigned char *) ptr - sizeof (MemDebug));
|
||||
|
||||
memcpy (nptr, ptr, size < b->size ? size : b->size);
|
||||
|
||||
js_free (ptr);
|
||||
|
||||
return nptr;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
js_free (void *ptr)
|
||||
{
|
||||
MemDebug *b;
|
||||
|
||||
if (ptr == NULL)
|
||||
return;
|
||||
|
||||
b = (MemDebug *) ((unsigned char *) ptr - sizeof (MemDebug));
|
||||
unregister_block (b);
|
||||
|
||||
ptr = &((size_t *)b)[-1];
|
||||
|
||||
ExFreePool(ptr);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
js_strdup_i (JSVirtualMachine *vm, const char *str, char *file, int line)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
tmp = js_malloc_i (vm, strlen (str) + 1, file, line);
|
||||
if (tmp == NULL)
|
||||
return NULL;
|
||||
|
||||
strcpy (tmp, str);
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
#else /* not JS_DEBUG_MEMORY_LEAKS */
|
||||
|
||||
void *
|
||||
js_malloc (JSVirtualMachine *vm, size_t size)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = ExAllocatePool (NonPagedPool, sizeof( size_t ) + size);
|
||||
if (ptr == NULL && vm != NULL)
|
||||
{
|
||||
sprintf (vm->error, "VM: memory exhausted");
|
||||
js_vm_error (vm);
|
||||
}
|
||||
|
||||
*((size_t *)ptr) = size;
|
||||
ptr = &((size_t *)ptr)[1];
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
js_calloc (JSVirtualMachine *vm, size_t num, size_t size)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = ExAllocatePool (NonPagedPool, sizeof( size_t ) + num * size);
|
||||
if (ptr == NULL && vm != NULL)
|
||||
{
|
||||
sprintf (vm->error, "VM: memory exhausted");
|
||||
js_vm_error (vm);
|
||||
}
|
||||
|
||||
*((size_t *)ptr) = size;
|
||||
ptr = &((size_t *)ptr)[1];
|
||||
|
||||
RtlZeroMemory( ptr, num * size );
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
js_realloc (JSVirtualMachine *vm, void *ptr, size_t size)
|
||||
{
|
||||
void *nptr;
|
||||
size_t old_size;
|
||||
|
||||
if (ptr == NULL)
|
||||
return js_malloc (vm, size);
|
||||
|
||||
nptr = js_malloc(vm, size);
|
||||
if (nptr == NULL && vm != NULL)
|
||||
{
|
||||
sprintf (vm->error, "VM: memory exhausted");
|
||||
js_vm_error (vm);
|
||||
}
|
||||
|
||||
old_size = ((size_t *)ptr)[-1];
|
||||
|
||||
if( size && ptr ) {
|
||||
if (size > old_size)
|
||||
size = old_size;
|
||||
RtlCopyMemory( nptr, ptr, size );
|
||||
}
|
||||
|
||||
js_free(ptr);
|
||||
|
||||
return nptr;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
js_free (void *ptr)
|
||||
{
|
||||
if (ptr == NULL)
|
||||
return;
|
||||
|
||||
ptr = &((size_t *)ptr)[-1];
|
||||
|
||||
ExFreePool (ptr);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
js_strdup (JSVirtualMachine *vm, const char *str)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
tmp = js_malloc (vm, strlen (str) + 1);
|
||||
if (tmp == NULL)
|
||||
return NULL;
|
||||
|
||||
strcpy (tmp, str);
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
#endif /* not JS_DEBUG_MEMORY_LEAKS */
|
||||
@@ -1,658 +0,0 @@
|
||||
/*
|
||||
* Core builtins for the JavaScript VM.
|
||||
* Copyright (c) 1998 New Generation Software (NGS) Oy
|
||||
*
|
||||
* Author: Markku Rossi <mtr@ngs.fi>
|
||||
*/
|
||||
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
* MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Source: /cygdrive/c/RCVS/CVS/ReactOS/reactos/lib/kjs/ksrc/b_core.c,v $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Global methods:
|
||||
*
|
||||
* parseInt (string[, radix])
|
||||
* parseFloat (string)
|
||||
* escape (string)
|
||||
* unescape (string)
|
||||
* isNaN (any)
|
||||
* isFinite (any)
|
||||
* debug (any)
|
||||
* error (string)
|
||||
* float (any)
|
||||
* int (any)
|
||||
* isFloat (any)
|
||||
* isInt (any)
|
||||
* print (any[,...])
|
||||
*/
|
||||
|
||||
#include "jsint.h"
|
||||
|
||||
/*
|
||||
* Types and definitions.
|
||||
*/
|
||||
|
||||
#define EMIT_TO_RESULT(c) \
|
||||
do { \
|
||||
result_return->u.vstring->data = \
|
||||
js_vm_realloc (vm, result_return->u.vstring->data, \
|
||||
result_return->u.vstring->len + 1); \
|
||||
result_return->u.vstring->data[result_return->u.vstring->len] = (c); \
|
||||
result_return->u.vstring->len += 1; \
|
||||
} while (0)
|
||||
|
||||
|
||||
/*
|
||||
* Static functions.
|
||||
*/
|
||||
|
||||
static void
|
||||
parseInt_global_method (JSVirtualMachine *vm, JSBuiltinInfo *builtin_info,
|
||||
void *instance_context, JSNode *result_return,
|
||||
JSNode *args)
|
||||
{
|
||||
JSInt32 base = 0;
|
||||
char *cp, *end;
|
||||
|
||||
result_return->type = JS_INTEGER;
|
||||
|
||||
if (args->u.vinteger != 1 && args->u.vinteger != 2)
|
||||
{
|
||||
sprintf (vm->error, "parseInt(): illegal amount of arguments");
|
||||
js_vm_error (vm);
|
||||
}
|
||||
if (args[1].type == JS_STRING)
|
||||
cp = js_string_to_c_string (vm, &args[1]);
|
||||
else
|
||||
{
|
||||
JSNode input;
|
||||
|
||||
/* Convert the input to string. */
|
||||
js_vm_to_string (vm, &args[1], &input);
|
||||
cp = js_string_to_c_string (vm, &input);
|
||||
}
|
||||
if (args->u.vinteger == 2)
|
||||
{
|
||||
if (args[2].type == JS_INTEGER)
|
||||
base = args[2].u.vinteger;
|
||||
else
|
||||
base = js_vm_to_int32 (vm, &args[2]);
|
||||
}
|
||||
|
||||
result_return->u.vinteger = strtol (cp, &end, base);
|
||||
js_free (cp);
|
||||
|
||||
if (cp == end)
|
||||
result_return->type = JS_NAN;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
parseFloat_global_method (JSVirtualMachine *vm, JSBuiltinInfo *builtin_info,
|
||||
void *instance_context, JSNode *result_return,
|
||||
JSNode *args)
|
||||
{
|
||||
char *cp, *end;
|
||||
|
||||
result_return->type = JS_FLOAT;
|
||||
|
||||
if (args->u.vinteger != 1)
|
||||
{
|
||||
sprintf (vm->error, "parseFloat(): illegal amount of arguments");
|
||||
js_vm_error (vm);
|
||||
}
|
||||
if (args[1].type == JS_STRING)
|
||||
cp = js_string_to_c_string (vm, &args[1]);
|
||||
else
|
||||
{
|
||||
JSNode input;
|
||||
|
||||
/* Convert the input to string. */
|
||||
js_vm_to_string (vm, &args[1], &input);
|
||||
cp = js_string_to_c_string (vm, &input);
|
||||
}
|
||||
|
||||
result_return->u.vfloat = strtod (cp, &end);
|
||||
js_free (cp);
|
||||
|
||||
if (cp == end)
|
||||
/* Couldn't parse, return NaN. */
|
||||
result_return->type = JS_NAN;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
escape_global_method (JSVirtualMachine *vm, JSBuiltinInfo *builtin_info,
|
||||
void *instance_context, JSNode *result_return,
|
||||
JSNode *args)
|
||||
{
|
||||
unsigned char *dp;
|
||||
unsigned int n, i;
|
||||
JSNode *source;
|
||||
JSNode source_n;
|
||||
|
||||
if (args->u.vinteger != 1)
|
||||
{
|
||||
sprintf (vm->error, "escape(): illegal amount of arguments");
|
||||
js_vm_error (vm);
|
||||
}
|
||||
if (args[1].type == JS_STRING)
|
||||
source = &args[1];
|
||||
else
|
||||
{
|
||||
/* Convert the argument to string. */
|
||||
js_vm_to_string (vm, &args[1], &source_n);
|
||||
source = &source_n;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate the result string, Let's guess that we need at least
|
||||
* <source->u.vstring->len> bytes of data.
|
||||
*/
|
||||
n = source->u.vstring->len;
|
||||
dp = source->u.vstring->data;
|
||||
js_vm_make_string (vm, result_return, NULL, n);
|
||||
result_return->u.vstring->len = 0;
|
||||
|
||||
/*
|
||||
* Scan for characters requiring escapes.
|
||||
*/
|
||||
for (i = 0; i < n; i += 1)
|
||||
{
|
||||
unsigned int c = dp[i];
|
||||
|
||||
if (strchr ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@*_+-./",
|
||||
c))
|
||||
EMIT_TO_RESULT (c);
|
||||
else if (c > 0xFF)
|
||||
{
|
||||
char buf[6];
|
||||
|
||||
sprintf (buf, "%04x", c);
|
||||
EMIT_TO_RESULT ('%');
|
||||
EMIT_TO_RESULT ('u');
|
||||
EMIT_TO_RESULT (buf[0]);
|
||||
EMIT_TO_RESULT (buf[1]);
|
||||
EMIT_TO_RESULT (buf[2]);
|
||||
EMIT_TO_RESULT (buf[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
char buf[4];
|
||||
sprintf (buf, "%02x", c);
|
||||
|
||||
EMIT_TO_RESULT ('%');
|
||||
EMIT_TO_RESULT (buf[0]);
|
||||
EMIT_TO_RESULT (buf[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* A helper function for unescape(). */
|
||||
static int
|
||||
scanhexdigits (unsigned char *dp, int nd, unsigned int *cp)
|
||||
{
|
||||
static const char digits[] = "0123456789abcdefABCDEF";
|
||||
int i;
|
||||
unsigned int d;
|
||||
|
||||
*cp = 0;
|
||||
for (i = 0; i < nd; i += 1)
|
||||
{
|
||||
d = strchr (digits, dp[i]) - digits;
|
||||
if (d < 16)
|
||||
;
|
||||
else if (d < 22)
|
||||
d -= 6;
|
||||
else
|
||||
return 0;
|
||||
|
||||
*cp <<= 4;
|
||||
*cp += d;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
unescape_global_method (JSVirtualMachine *vm, JSBuiltinInfo *builtin_info,
|
||||
void *instance_context, JSNode *result_return,
|
||||
JSNode *args)
|
||||
{
|
||||
unsigned char *dp;
|
||||
unsigned int n, i;
|
||||
JSNode *source;
|
||||
JSNode source_n;
|
||||
|
||||
if (args->u.vinteger != 1)
|
||||
{
|
||||
sprintf (vm->error, "unescape(): illegal amount of arguments");
|
||||
js_vm_error (vm);
|
||||
}
|
||||
if (args[1].type == JS_STRING)
|
||||
source = &args[1];
|
||||
else
|
||||
{
|
||||
js_vm_to_string (vm, &args[1], &source_n);
|
||||
source = &source_n;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate the result string, Let's guess that we need at least
|
||||
* <source->u.vstring->len> bytes of data.
|
||||
*/
|
||||
n = source->u.vstring->len;
|
||||
dp = source->u.vstring->data;
|
||||
js_vm_make_string (vm, result_return, NULL, n);
|
||||
result_return->u.vstring->len = 0;
|
||||
|
||||
/*
|
||||
* Scan for escapes requiring characters.
|
||||
*/
|
||||
for (i = 0; i < n;)
|
||||
{
|
||||
unsigned int c = dp[i];
|
||||
|
||||
if (c != '%')
|
||||
i += 1;
|
||||
else if (i <= n - 6 && dp[i + 1] == 'u'
|
||||
&& scanhexdigits (dp + i + 2, 4, &c))
|
||||
i += 6;
|
||||
else if (i <= n - 3 && scanhexdigits (dp + i + 1, 2, &c))
|
||||
i += 3;
|
||||
else
|
||||
{
|
||||
c = dp[i];
|
||||
i += 1;
|
||||
}
|
||||
EMIT_TO_RESULT (c);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
isNaN_global_method (JSVirtualMachine *vm, JSBuiltinInfo *builtin_info,
|
||||
void *instance_context, JSNode *result_return,
|
||||
JSNode *args)
|
||||
{
|
||||
JSNode cvt;
|
||||
int result;
|
||||
|
||||
if (args->u.vinteger != 1)
|
||||
{
|
||||
sprintf (vm->error, "isNaN(): illegal amount of arguments");
|
||||
js_vm_error (vm);
|
||||
}
|
||||
|
||||
switch (args[1].type)
|
||||
{
|
||||
case JS_NAN:
|
||||
result = 1;
|
||||
break;
|
||||
|
||||
case JS_INTEGER:
|
||||
case JS_FLOAT:
|
||||
result = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
js_vm_to_number (vm, &args[1], &cvt);
|
||||
result = cvt.type == JS_NAN;
|
||||
break;
|
||||
}
|
||||
|
||||
result_return->type = JS_BOOLEAN;
|
||||
result_return->u.vboolean = result;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
isFinite_global_method (JSVirtualMachine *vm, JSBuiltinInfo *builtin_info,
|
||||
void *instance_context, JSNode *result_return,
|
||||
JSNode *args)
|
||||
{
|
||||
JSNode *source;
|
||||
JSNode cvt;
|
||||
int result;
|
||||
|
||||
if (args->u.vinteger != 1)
|
||||
{
|
||||
sprintf (vm->error, "isFinite(): illegal amount of arguments");
|
||||
js_vm_error (vm);
|
||||
}
|
||||
|
||||
if (args[1].type == JS_NAN || args[1].type == JS_INTEGER
|
||||
|| args[1].type == JS_FLOAT)
|
||||
source = &args[1];
|
||||
else
|
||||
{
|
||||
js_vm_to_number (vm, &args[1], &cvt);
|
||||
source = &cvt;
|
||||
}
|
||||
|
||||
switch (source->type)
|
||||
{
|
||||
case JS_NAN:
|
||||
result = 0;
|
||||
break;
|
||||
|
||||
case JS_INTEGER:
|
||||
result = 1;
|
||||
break;
|
||||
|
||||
case JS_FLOAT:
|
||||
if (JS_IS_POSITIVE_INFINITY (&args[1])
|
||||
|| JS_IS_NEGATIVE_INFINITY (&args[1]))
|
||||
result = 0;
|
||||
else
|
||||
result = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* NOTREACHED */
|
||||
result = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
result_return->type = JS_BOOLEAN;
|
||||
result_return->u.vboolean = result;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
debug_global_method (JSVirtualMachine *vm, JSBuiltinInfo *builtin_info,
|
||||
void *instance_context, JSNode *result_return,
|
||||
JSNode *args)
|
||||
{
|
||||
JSNode sitem;
|
||||
|
||||
if (args->u.vinteger != 1)
|
||||
{
|
||||
sprintf (vm->error, "debug(): illegal amount of arguments");
|
||||
js_vm_error (vm);
|
||||
}
|
||||
|
||||
/*
|
||||
* Maybe we should prefix the debug message with `Debug message:'
|
||||
* prompt.
|
||||
*/
|
||||
js_vm_to_string (vm, &args[1], &sitem);
|
||||
|
||||
result_return->type = JS_UNDEFINED;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
error_global_method (JSVirtualMachine *vm, JSBuiltinInfo *builtin_info,
|
||||
void *instance_context,
|
||||
JSNode *result_return, JSNode *args)
|
||||
{
|
||||
unsigned int len;
|
||||
|
||||
if (args->u.vinteger != 1)
|
||||
{
|
||||
sprintf (vm->error, "error(): illegal amount of arguments");
|
||||
js_vm_error (vm);
|
||||
}
|
||||
if (args[1].type != JS_STRING)
|
||||
{
|
||||
sprintf (vm->error, "error(): illegal argument");
|
||||
js_vm_error (vm);
|
||||
}
|
||||
|
||||
len = args[1].u.vstring->len;
|
||||
if (len > sizeof (vm->error) - 1)
|
||||
len = sizeof (vm->error) - 1;
|
||||
|
||||
memcpy (vm->error, args[1].u.vstring->data, len);
|
||||
vm->error[len] = '\0';
|
||||
|
||||
/* Here we go... */
|
||||
js_vm_error (vm);
|
||||
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
float_global_method (JSVirtualMachine *vm, JSBuiltinInfo *builtin_info,
|
||||
void *instance_context, JSNode *result_return,
|
||||
JSNode *args)
|
||||
{
|
||||
double fval;
|
||||
char *cp, *end;
|
||||
|
||||
if (args->u.vinteger != 1)
|
||||
{
|
||||
sprintf (vm->error, "float(): illegal amount of arguments");
|
||||
js_vm_error (vm);
|
||||
}
|
||||
|
||||
switch (args[1].type)
|
||||
{
|
||||
case JS_BOOLEAN:
|
||||
fval = (double) (args[1].u.vboolean != 0);
|
||||
break;
|
||||
|
||||
case JS_INTEGER:
|
||||
fval = (double) args[1].u.vinteger;
|
||||
break;
|
||||
|
||||
case JS_STRING:
|
||||
cp = js_string_to_c_string (vm, &args[1]);
|
||||
fval = strtod (cp, &end);
|
||||
js_free (cp);
|
||||
|
||||
if (cp == end)
|
||||
fval = 0.0;
|
||||
break;
|
||||
|
||||
case JS_FLOAT:
|
||||
fval = args[1].u.vfloat;
|
||||
break;
|
||||
|
||||
case JS_ARRAY:
|
||||
fval = (double) args[1].u.varray->length;
|
||||
break;
|
||||
|
||||
default:
|
||||
fval = 0.0;
|
||||
break;
|
||||
}
|
||||
|
||||
result_return->type = JS_FLOAT;
|
||||
result_return->u.vfloat = fval;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
int_global_method (JSVirtualMachine *vm, JSBuiltinInfo *builtin_info,
|
||||
void *instance_context, JSNode *result_return,
|
||||
JSNode *args)
|
||||
{
|
||||
long ival;
|
||||
char *cp, *end;
|
||||
|
||||
if (args->u.vinteger != 1)
|
||||
{
|
||||
sprintf (vm->error, "int(): illegal amount of arguments");
|
||||
js_vm_error (vm);
|
||||
}
|
||||
|
||||
switch (args[1].type)
|
||||
{
|
||||
case JS_BOOLEAN:
|
||||
ival = (long) (args[1].u.vboolean != 0);
|
||||
break;
|
||||
|
||||
case JS_INTEGER:
|
||||
ival = args[1].u.vinteger;
|
||||
break;
|
||||
|
||||
case JS_STRING:
|
||||
cp = js_string_to_c_string (vm, &args[1]);
|
||||
ival = strtol (cp, &end, 0);
|
||||
js_free (cp);
|
||||
|
||||
if (cp == end)
|
||||
ival = 0;
|
||||
break;
|
||||
|
||||
case JS_FLOAT:
|
||||
ival = (long) args[1].u.vfloat;
|
||||
break;
|
||||
|
||||
case JS_ARRAY:
|
||||
ival = (long) args[1].u.varray->length;
|
||||
break;
|
||||
|
||||
default:
|
||||
ival = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
result_return->type = JS_INTEGER;
|
||||
result_return->u.vinteger = ival;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
isFloat_global_method (JSVirtualMachine *vm, JSBuiltinInfo *builtin_info,
|
||||
void *instance_context, JSNode *result_return,
|
||||
JSNode *args)
|
||||
{
|
||||
/* The default result is false. */
|
||||
result_return->type = JS_BOOLEAN;
|
||||
result_return->u.vboolean = 0;
|
||||
|
||||
if (args->u.vinteger != 1)
|
||||
{
|
||||
sprintf (vm->error, "isFloat(): illegal amount of arguments");
|
||||
js_vm_error (vm);
|
||||
}
|
||||
|
||||
if (args[1].type == JS_FLOAT)
|
||||
result_return->u.vboolean = 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
isInt_global_method (JSVirtualMachine *vm, JSBuiltinInfo *builtin_info,
|
||||
void *instance_context, JSNode *result_return,
|
||||
JSNode *args)
|
||||
{
|
||||
/* The default result is false. */
|
||||
result_return->type = JS_BOOLEAN;
|
||||
result_return->u.vboolean = 0;
|
||||
|
||||
if (args->u.vinteger != 1)
|
||||
{
|
||||
sprintf (vm->error, "isInt(): illegal amount of arguments");
|
||||
js_vm_error (vm);
|
||||
}
|
||||
|
||||
if (args[1].type == JS_INTEGER)
|
||||
result_return->u.vboolean = 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
print_global_method (JSVirtualMachine *vm, JSBuiltinInfo *builtin_info,
|
||||
void *instance_context, JSNode *result_return,
|
||||
JSNode *args)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* The result is undefined. */
|
||||
result_return->type = JS_UNDEFINED;
|
||||
|
||||
for (i = 1; i <= args->u.vinteger; i++)
|
||||
{
|
||||
JSNode result;
|
||||
|
||||
js_vm_to_string (vm, &args[i], &result);
|
||||
js_iostream_write (vm->s_stdout, result.u.vstring->data,
|
||||
result.u.vstring->len);
|
||||
|
||||
if (i + 1 <= args->u.vinteger)
|
||||
js_iostream_write (vm->s_stdout, " ", 1);
|
||||
}
|
||||
|
||||
js_iostream_write (vm->s_stdout, JS_HOST_LINE_BREAK, JS_HOST_LINE_BREAK_LEN);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Global functions.
|
||||
*/
|
||||
|
||||
static struct
|
||||
{
|
||||
char *name;
|
||||
JSBuiltinGlobalMethod method;
|
||||
} global_methods[] =
|
||||
{
|
||||
{"parseInt", parseInt_global_method},
|
||||
{"parseFloat", parseFloat_global_method},
|
||||
{"escape", escape_global_method},
|
||||
{"unescape", unescape_global_method},
|
||||
{"isNaN", isNaN_global_method},
|
||||
{"isFinite", isFinite_global_method},
|
||||
{"debug", debug_global_method},
|
||||
{"error", error_global_method},
|
||||
{"float", float_global_method},
|
||||
{"int", int_global_method},
|
||||
{"isFloat", isFloat_global_method},
|
||||
{"isInt", isInt_global_method},
|
||||
{"print", print_global_method},
|
||||
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
js_builtin_core (JSVirtualMachine *vm)
|
||||
{
|
||||
int i;
|
||||
JSNode *n;
|
||||
|
||||
/* Properties. */
|
||||
|
||||
n = &vm->globals[js_vm_intern (vm, "NaN")];
|
||||
n->type = JS_NAN;
|
||||
|
||||
n = &vm->globals[js_vm_intern (vm, "Infinity")];
|
||||
JS_MAKE_POSITIVE_INFINITY (n);
|
||||
|
||||
/* Global methods. */
|
||||
for (i = 0; global_methods[i].name; i++)
|
||||
{
|
||||
JSBuiltinInfo *info;
|
||||
|
||||
info = js_vm_builtin_info_create (vm);
|
||||
info->global_method_proc = global_methods[i].method;
|
||||
|
||||
n = &vm->globals[js_vm_intern (vm, global_methods[i].name)];
|
||||
js_vm_builtin_create (vm, n, info, NULL);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user