dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/JScript .cvsignore,NONE,1.1 JScript.


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/JScript .cvsignore,NONE,1.1 JScript.build,NONE,1.1 Makefile.am,NONE,1.1 README,NONE,1.1 jsrun.cs,NONE,1.1jsrun.sh,NONE,1.1
Date: Mon, 13 Jan 2003 05:53:22 -0500

Update of /cvsroot/dotgnu-pnet/pnetlib/JScript
In directory subversions:/tmp/cvs-serv3129/JScript

Added Files:
        .cvsignore JScript.build Makefile.am README jsrun.cs jsrun.sh 
Log Message:


Perform the initial check-in of the JScript implementation (requires
treecc 0.2.0 or higher).


--- NEW FILE ---
Makefile
Makefile.in
.deps
*.dll

--- NEW FILE ---
<?xml version="1.0"?>
<project name="pnetlib JScript" default="all">
        <target name="all">

                <!-- Build the Microsoft.JScript.dll library -->
                <compile output="Microsoft.JScript.dll"
                                 target="library"
                                 unsafe="true"
                                 nostdlib="true"
                                 debug="true"
                                 optimize="true">

                        <sources>
                                <includes name="**/*.cs"/>
                                <excludes name="jsrun.cs"/>
                        </sources>

                        <references>
                                <file name="../compat/Microsoft.Vsa.dll"/>
                                <file name="../System/System.dll"/>
                                <file name="../runtime/mscorlib.dll"/>
                        </references>

                        <arg compiler="cscc" value="-Wno-empty-input"/>
                        <arg compiler="csc" value="/nowarn:626"/>
                        <arg compiler="csc" value="/nowarn:649"/>
                        <arg compiler="csc" value="/nowarn:168"/>
                        <arg compiler="csc" value="/nowarn:67"/>
                        <arg compiler="csc" value="/nowarn:169"/>
                        <arg compiler="csc" value="/nowarn:679"/>
                </compile>

                <!-- Build the JScript.Test.dll library -->
                <compile output="JScript.Test.dll"
                                 target="library"
                                 unsafe="true"
                                 nostdlib="true"
                                 debug="true"
                                 optimize="true">

                        <define name="TEST" value="true"/>

                        <sources>
                                <includes name="**/*.cs"/>
                                <excludes name="jsrun.cs"/>
                        </sources>

                        <references>
                                <file name="../compat/Microsoft.Vsa.dll"/>
                                <file name="../System/System.dll"/>
                                <file name="../runtime/mscorlib.dll"/>
                        </references>

                        <arg compiler="cscc" value="-Wno-empty-input"/>
                        <arg compiler="csc" value="/nowarn:626"/>
                        <arg compiler="csc" value="/nowarn:649"/>
                        <arg compiler="csc" value="/nowarn:168"/>
                        <arg compiler="csc" value="/nowarn:67"/>
                        <arg compiler="csc" value="/nowarn:169"/>
                        <arg compiler="csc" value="/nowarn:679"/>
                </compile>

                <!-- Build the jsrun.exe program -->
                <compile output="jsrun.exe"
                                 target="exe"
                                 unsafe="true"
                                 nostdlib="true"
                                 debug="true"
                                 optimize="true">

                        <sources>
                                <file name="jsrun.cs"/>
                        </sources>

                        <references>
                                <file name="./Microsoft.JScript.dll"/>
                                <file name="../compat/Microsoft.Vsa.dll"/>
                                <file name="../System/System.dll"/>
                                <file name="../runtime/mscorlib.dll"/>
                        </references>

                        <arg compiler="cscc" value="-Wno-empty-input"/>
                        <arg compiler="csc" value="/nowarn:626"/>
                        <arg compiler="csc" value="/nowarn:649"/>
                        <arg compiler="csc" value="/nowarn:168"/>
                        <arg compiler="csc" value="/nowarn:67"/>
                        <arg compiler="csc" value="/nowarn:169"/>
                        <arg compiler="csc" value="/nowarn:679"/>
                </compile>

        </target>
</project>

--- NEW FILE ---

.PHONY: Microsoft.JScript.dll

all-local: Microsoft.JScript.dll

Microsoft.JScript.dll: Nodes/JNode.cs
        "$(CSANT)" $(CSANT_FLAGS) -f JScript.build all

TREECC_INPUTS = $(srcdir)/Nodes/JNode.tc \
                                $(srcdir)/Nodes/JExpr.tc \
                                $(srcdir)/Nodes/JStmt.tc

Nodes/JNode.cs: $(TREECC_INPUTS)
        $(TREECC) -f -o Nodes/JNode.cs $(srcdir)/Nodes/JNode.tc

CLEANFILES = Microsoft.JScript.dll JScript.Test.dll Nodes/JNode.cs jsrun.exe

pnetassembliesdir = $(libdir)/cscc/lib
pnetassemblies_DATA = Microsoft.JScript.dll

install-exec-local:
        @$(NORMAL_INSTALL)
        $(mkinstalldirs) $(DESTDIR)$(bindir)
        $(INSTALL_PROGRAM) jsrun.exe $(DESTDIR)$(bindir)/jsrun.exe
        $(INSTALL_PROGRAM) $(srcdir)/jsrun.sh $(DESTDIR)$(bindir)/jsrun

uninstall-local:
        @$(NORMALL_UNINSTALL)
        rm -f $(DESTDIR)$(bindir)/jsrun.exe
        rm -f $(DESTDIR)$(bindir)/jsrun

--- NEW FILE ---

This directory contains the JScript implementation for Portable.NET.
It is designed to be compatible with the "Microsoft.JScript" assembly
from the .NET Framework SDK.

See the file "doc/JScript-embed.txt" for information on how to embed the
engine in your own application.

For backwards compatibility, these classes are placed in the namespace
"Microsoft.JScript".  We have split them over a number of sub-directories
to make it easier to navigate the source:

Nodes
        JScript language nodes and their evaluation logic.
Parser
        JScript language parser and support classes.
Execute
        Support definitions for program execution.
Builtins
        Builtin JScript objects and classes.
Vsa
        Front-end interface to the engine.
Jsc
        Support routines for JScript programs that have been compiled to IL.
CodeDom
        Glue logic for interfacing with System.CodeDom.
doc
        Documentation files for the JScript implementation.

Where possible, we follow the ECMAScript specifications fairly closely,
as JScript is based on ECMAScript.  The specifications can be obtained
from "http://www.ecma.ch/";.

Information on the public API's was divined from the Rotor sources, as
Microsoft's documentation only specifies the CodeDom interface.  The CodeDom
interface is not the core part of the API, and so that documentation is
relatively useless for building an interoperable implementation.

The implementation here is completely "in our own words" - no Rotor code
was used in its production.

The "JScript.Test" assembly is used by the pnetlib test suite to test the
internal workings of the JScript implementation.  It breaks encapsulation
by inserting extra definitions to assist with unit testing.  It should not
be used by application programs: use "Microsoft.JScript" instead.

--- NEW FILE ---
/*
 * jsrun.cs - Run scripts from the command-line.
 *
 * Copyright (C) 2003 Southern Storm Software, Pty Ltd.
 *
 * 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
 */
 
using System;
using System.IO;
using System.Text;
using Microsoft.JScript;
using Microsoft.JScript.Vsa;
using Microsoft.Vsa;

public sealed class JSRun
{
        // Main entry point for the application.
        public static int Main(String[] args)
                        {
                                StreamReader reader;
                                StringBuilder builder;
                                String script;
                                char[] buffer;
                                int len;
                                VsaEngine engine;
                                IVsaCodeItem item;

                                // We need at least one argument.
                                if(args.Length == 0)
                                {
                                        Console.Error.WriteLine("Usage: jsrun 
script [args]");
                                        return 1;
                                }

                                // Load the script into memory as a string.
                                try
                                {
                                        reader = new StreamReader(args[0]);
                                }
                                catch(FileNotFoundException)
                                {
                                        Console.Error.WriteLine
                                                ("jsrun: {0}: No such file or 
directory");
                                        return 1;
                                }
                                builder = new StringBuilder();
                                buffer = new char [512];
                                while((len = reader.Read(buffer, 0, 512)) > 0)
                                {
                                        builder.Append(buffer, 0, len);
                                }
                                reader.Close();
                                script = builder.ToString();

                                // Create an engine instance and add the script 
to it.
                                engine = VsaEngine.CreateEngine();
                                item = (IVsaCodeItem)(engine.Items.CreateItem
                                                ("script1", VsaItemType.Code, 
VsaItemFlag.None));
                                item.SourceText = script;
                                item.SetOption("codebase", args[0]);

                                // Compile and run the script.
                                if(!engine.Compile())
                                {
                                        Console.Error.WriteLine("jsrun: Could 
not compile script");
                                        return 1;
                                }
                                engine.Run();

                                // Shut down the engine and exit.
                                engine.Close();
                                return 0;
                        }

}; // class JSRun

--- NEW FILE ---
#!/usr/bin/env clrwrap
jsrun.exe





reply via email to

[Prev in Thread] Current Thread [Next in Thread]