forked from verhas/jScriptBasic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintro.html
More file actions
139 lines (102 loc) · 10.4 KB
/
Copy pathintro.html
File metadata and controls
139 lines (102 loc) · 10.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
| Generated by Apache Maven Doxia at Jan 17, 2013
| Rendered using Apache Maven Fluido Skin 1.2.1
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>jScriptBasic - jScriptBasic Project Documentation</title>
<link rel="stylesheet" href="./css/apache-maven-fluido.min.css" />
<link rel="stylesheet" href="./css/site.css" />
<link rel="stylesheet" href="./css/print.css" media="print" />
<script type="text/javascript" src="./js/apache-maven-fluido.min.js"></script>
<meta name="author" content="Peter Verhas" />
<meta name="Date-Creation-yyyymmdd" content="20120811" />
<meta name="Date-Revision-yyyymmdd" content="20130117" />
<meta http-equiv="Content-Language" content="en" />
</head>
<body class="topBarDisabled">
<div class="container-fluid">
<div id="banner">
<div class="pull-left">
<a href="http://scriptbasic.com" id="bannerLeft">
<img src="" alt="ScriptBasic for Java"/>
</a>
</div>
<div class="pull-right"> </div>
<div class="clear"><hr/></div>
</div>
<div id="breadcrumbs">
<ul class="breadcrumb">
<li id="publishDate">Last Published: 2013-01-17</li>
<li class="divider">|</li> <li id="projectVersion">Version: 1.0.4-SNAPSHOT</li>
<li class="pull-right"> <a href="http://scriptbasic.com" class="externalLink" title="ScriptBasic">ScriptBasic</a>
</li>
</ul>
</div>
<div class="row-fluid">
<div id="leftColumn" class="span3">
<div class="well sidebar-nav">
<h3>Documentation for SB4J</h3>
<ul>
<li class="none">
<strong>Introduction</strong>
</li>
<li class="none">
<a href="name.html" title="Name of the game">Name of the game</a>
</li>
<li class="none">
<a href="design.html" title="History and Design Goals">History and Design Goals</a>
</li>
<li class="none">
<a href="basic.html" title="Basic Language Implemented">Basic Language Implemented</a>
</li>
<li class="none">
<a href="install.html" title="Installation">Installation</a>
</li>
<li class="none">
<a href="advanced/index.html" title="Embedding API">Embedding API</a>
</li>
<li class="none">
<a href="configure.html" title="Configuration">Configuration</a>
</li>
</ul>
<h3>Project Documentation</h3>
<ul>
<li class="collapsed">
<a href="project-info.html" title="Project Information">Project Information</a>
</li>
<li class="collapsed">
<a href="project-reports.html" title="Project Reports">Project Reports</a>
</li>
</ul>
<hr class="divider" />
<div id="poweredBy">
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<div class="g-plusone" data-href="http://www.scriptbasic.com" data-size="tall" ></div>
<div class="clear"></div>
<div class="clear"></div>
<div class="clear"></div>
<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
<img class="poweredBy" alt="Built by Maven" src="./images/logos/maven-feather.png" />
</a>
</div>
</div>
</div>
<div id="bodyColumn" class="span9" >
<div class="section"><h2>What is ScriptBasic for Java<a name="What_is_ScriptBasic_for_Java"></a></h2><p>ScriptBasic for Java is a scripting implementation of the classic <a href="./basic.html">basic</a> language. Using this interpreter you can extend you application with BASIC scripting possibilities. There are many scripting languages that can be embedded into Java application. Different languages have different capabilities and different target users' group. ScriptBasic for Java targets the applications that are to be extended using scripts by users who are not programmers.</p><div class="section"><h3>No freak out language <a name="No_freak_out_language"></a></h3><p>Business analysts, domain experts who use an application can learn Groovy, JavaScript, Scala or some other scripting language to program the scripting possibilities of the application. They probably will not learn. In case of BASIC this learning is not needed. If anything is known by such a user BASIC is. This also means that the "freak out" factor is minimal. Your prospective users may freak out hearing that the application can be scripted using Groovy or Scala or JavaScript which all are considered geek languages. In case of BASIC this does not happen. If the prospective user has minimal affinity to programming he or she has some experience using Excel and its BASIC, Visual Basic or just any other BASIC.</p><p>For the same reason the language implemented is very simple. It implements only a very limited set of commands and operators. Each command is implemented that is needed to create embedded scripts but nothing more. You can assign values to variables, loop, execute conditional code (IF statement), print to the standard output and call subroutines. You can handle arrays. Anything else you need in a BASIC script? To communicate with the embedding application more than just printing to the output the program can call Java static methods or instance methods in case an object is stored in a BASIC variable. To do that the usual <tt>object.method(params)</tt> format can be used, or just <tt>method(params)</tt> when it is not ambiguous.</p></div><div class="section"><h3>Control remains at the hand of the application<a name="Control_remains_at_the_hand_of_the_application"></a></h3><p>Script languages may pose security risks if not properly configured . When you start a script it can access the application Java objects, methods and so on. You have to pay great attention to execute other language scripts securely setting up SecurityManager. To avoid a hacking script get feral.</p><p>To execute jScriptBasic all you have to do is to configure the optional RunLimitHook included in the interpreter JAR file to limit the execution and specify what the script is allowed to do and what it is not allowed to do.</p></div><div class="section"><h3>Standard Interface<a name="Standard_Interface"></a></h3><p>To embed ScriptBasic for Java into your application you can (and you are suggested to) use the standard JSR-223 interface. This way you can embed just any scripting language easily without further programming. As a matter of fact the <tt>main()</tt> method of the class <tt>com.scriptbasic.main.CommandLine</tt> uses solely this interface and as a side effect you can use the command line version of ScriptBasic for Java to execute JavaScript files utilizing the JRE7 built in Rhino engine. It is a feature that was not designed by the developers of ScriptBasic for Java. It just happens to be a fact that using the JSR-223 interface if the extension of the script file is <tt>.js</tt> then the Rhino interpreter will start.</p><p>If an application properly uses the JRS-223 interface, integrating jScriptBasic as another scripting language to the application is simply copying the <tt>jscriptbasic-x.y.z.jar</tt> file on the classpath and restart the application.</p></div><div class="section"><h3>Command line tool<a name="Command_line_tool"></a></h3><p>You can also execute BASIC programs from the command line. All you have to do is issue the command line</p><div><pre>java -jar jscriptbasic-1.0.4-SNAPSHOT.jar basicProgram.sb</pre></div><p>and the program in the file <tt>basicProgram.sb</tt> will execute. (Note that the line above uses the latest version 1.0.4-SNAPSHOT which may not be the latest released version. If it finishes with the postfix <tt>-SNAPSHOT</tt> then the version is a development version. Instead use the name of the JAR file you downloaded.)</p><p>Starting with the version 1.0.4 it is possible to specify extension classes for the command line version of the interpreter. To do that you have to use the command line option</p><div><pre>-Dextensionclasses=comma separated list of fully qualified java extension class names</pre></div><p>When you specify an extension class you wrote you also have to use the standard Java command line option <tt>-cp</tt> to specify the location of the classes.</p></div><div class="section"><h3>License is Open Source<a name="License_is_Open_Source"></a></h3><p>ScriptBasic for Java is licensed with the GPLv3 license. If you need commercial license contact the developers. At the early, intial stage of the project expect easy deals for the introductory period.</p></div></div>
</div>
</div>
<hr/>
<footer>
<div class="container-fluid">
<div class="row span16">Copyright © 2013
<a href="http://www.verhas.com">Verhas and Verhas Software Craftsmen</a>.
All Rights Reserved.
</div>
</div>
</footer>
</body>
</html>