📄 usage.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
<TITLE></TITLE>
<META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.4 (Win32)">
<META NAME="CREATED" CONTENT="20050226;17040300">
<META NAME="CHANGEDBY" CONTENT="jewe.org">
<META NAME="CHANGED" CONTENT="20050227;15245635">
<STYLE>
<!--
@page { size: 21cm 29.7cm; margin: 2cm }
H1 { margin-bottom: 0.21cm }
H1.western { font-family: "Arial", sans-serif; font-size: 16pt }
H1.cjk { font-family: "Lucida Sans Unicode"; font-size: 16pt }
H1.ctl { font-family: "Tahoma"; font-size: 16pt }
P { margin-bottom: 0.21cm }
P.western { font-family: "Arial", sans-serif; font-size: 10pt }
H5 { margin-bottom: 0.21cm }
H5.western { font-family: "Arial", sans-serif; font-size: 11pt }
H5.cjk { font-size: 11pt }
H5.ctl { font-size: 11pt }
-->
</STYLE>
</HEAD>
<BODY LANG="de-DE" DIR="LTR">
<H1 CLASS="western">JILRunOnly usage</H1>
<H5 CLASS="western">What is it?</H5>
<P CLASS="western">The JILRunOnly project is mainly intended to
demonstrate how the JILRuntime / JewelScript library can be embedded
into any program. However, the program is "powerful" enough
to be used as a scripting tool itself - allowing developers to write
small scripts that can do small tasks, like converting text or binary
files, and things like that.</P>
<H5 CLASS="western">How to run the program from terminal / command
line</H5>
<P CLASS="western">The basic command-line format looks like this:</P>
<PRE STYLE="margin-bottom: 0.5cm">jilrun [-lvwx] script [parameters]</PRE><P CLASS="western">
In this example, <B>script</B> would represent the filename of any
JewelScript source file that you want to compile and run. You should
use the "official" extension ".jc" for
JewelScript source files. Optionally, you may add additional
<B>parameters</B> in the form of text strings to the program. The
program itself will not use these parameters, it will just create an
array out of them and pass this array into the script's <I>main()</I>
function.</P>
<P CLASS="western">Optional switches:</P>
<P CLASS="western">The <B>-l</B> switch will print out a virtual
machine code listing of the compiled script file to stdout. This may
be useful for bug-hunting.<BR>The <B>-v</B> switch will print version
info about the program to stdout.<BR>The <B>-w</B> switch will wait
for the user to press the enter key after the script has been
executed. This is useful when running the program from the desktop
environment.<BR>The <B>-x</B> switch will exit the program <U>without</U>
running the compiled script<SPAN STYLE="text-decoration: none">. This
is useful in combination with <B>-l</B> or <B>-v</B>.</SPAN></P>
<H5 CLASS="western">How to run the program from the desktop
environment</H5>
<P CLASS="western">(Currently this has only been tested under
Windows, however, it should work the same or similar with other
OSes.)</P>
<P CLASS="western">You have two options how to start a script with
parameters using the program:</P>
<P CLASS="western">1. You can select multiple files in your file
browser, including the script file you want to compile and run, and
drag these files onto the icon of the program. The order in which you
select the files shouldn't matter, since the program will use the
script file's extension ".jc" to identify which of the
passed files is the script that should be compiled and executed. All
additional files will then be passed to this script file.</P>
<P CLASS="western">2. You can put this program into a folder and
create a shortcut for it on the desktop. Additionally you put the
script file to run next to the program into the folder, and call it
"default.jc". If you now drag multiple files onto the
shortcut on your desktop, the program will load and execute
"default.jc" and pass all files to that script. (This will
be only done if no script file is passed as a parameter to the
program.)</P>
<P CLASS="western"><B>Tip:</B> If you create a shortcut to the
program on your desktop, you can edit the shortcut's command-line
parameters and add the <B>-w</B><SPAN STYLE="font-weight: medium">
option. This will allow you to read any script output to the console
after dragging a script file onto the shortcut.</SPAN></P>
<H5 CLASS="western">Writing scripts for the program</H5>
<P CLASS="western">Next to this document, you should have received a
document "nativetypes.html". This document lists all the
"built-in" classes and functions you currently can use.
Apart from them, you can of course implement any amount of new
functions and classes in JewelScript. ;)</P>
<P CLASS="western">In order to work, you must define a main
entry-point function, much like it is in 'C'. The prototype for this
function should look like one of these examples:</P>
<PRE><FONT COLOR="#0000ff">function long</FONT> main<FONT COLOR="#ff0000">(</FONT><FONT COLOR="#0000ff">const array</FONT><FONT COLOR="#ff0000">&</FONT> args<FONT COLOR="#ff0000">)</FONT>;
<FONT COLOR="#0000ff">function float</FONT> main<FONT COLOR="#ff0000">(</FONT><FONT COLOR="#0000ff">const array</FONT><FONT COLOR="#ff0000">&</FONT> args<FONT COLOR="#ff0000">)</FONT>;
<FONT COLOR="#0000ff">function string</FONT> main<FONT COLOR="#ff0000">(</FONT><FONT COLOR="#0000ff">const array</FONT><FONT COLOR="#ff0000">&</FONT> args<FONT COLOR="#ff0000">)</FONT>;</PRE><P CLASS="western">
The return value will be printed to stdout when the <I>main()</I>
function exits.</P>
<P CLASS="western">In order to see how you can get the arguments from
the given array, you can look into the demo script file "hello.jc",
which you should have received with this program.</P>
<P CLASS="western"><BR><BR>
</P>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -