⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cajscript.html

📁 Delphi script parser
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<html>

<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="Author" content="Carlo">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title>CajScript 2.0</title>
</head>

<body bgcolor="#C0C0FF" text="#000000" link="#0000FF"
vlink="#800080" alink="#FF0080">

<h1>Cajscript 2.0</h1>

<p>Made by <a href="http://www.weyert.nl/innerfuse">InnerFuse</a>.</p>

<p><a name="tcs2pascalscript"></a><tt>TCs2PascalScript = </tt><b><tt>Object/Class</tt></b><br>
<tt>Variables : </tt><a href="#pvariablemanager"><tt>PVariableManager</tt></a><tt>
</tt><b><tt>read</tt></b><tt> Use to add variables.</tt><br>
<tt>Procedures : </tt><a href="#pproceduremanager"><tt>PProcedureManager</tt></a><b><tt>
read</tt></b><tt> Use to add external function/procedures.</tt><br>
<tt>OnUses : </tt><a href="#tonuses"><tt>TOnUses</tt></a><tt> </tt><b><tt>Read/Write</tt></b><tt>
Triggered when an Uses Clause is occured.</tt><font
face="Times New Roman"><br>
</font><tt>OnRunLine : </tt><a href="#tonrunline"><tt>TOnRunLine</tt></a><tt>
</tt><b><tt>Read/Write</tt></b><tt> Triggered when an Uses Clause
is occured.</tt><font face="Times New Roman"><br>
</font><tt>ErrorCode : </tt><a href="#tcs2error"><tt>TCs2Error</tt></a><tt>
</tt><b><tt>Read</tt></b><tt> Used to read the error occured.</tt><br>
<tt>ErrorPos : LongInt </tt><b><tt>Read</tt></b><tt> Used to read
the error position.</tt></p>

<p><b><tt>Constructor </tt></b><tt>Create (Id : Pointer);</tt><br>
<tt>Create an instance of the script engine, ID is passed to all
events.</tt></p>

<p><b><tt>Procedure </tt></b><tt>SetText (p : Pchar);</tt><br>
<tt>Assign a text to the script engine. Afterwards you should
check</tt><i><tt>errorcode</tt></i><tt>.</tt></p>

<p><b><tt>Procedure </tt></b><tt>RunScript;</tt><br>
<tt>Execute the script code, first assign some script with </tt><i><tt>SetText</tt></i><tt>.</tt></p>

<p><b><tt>Function </tt></b><tt>RunScriptProc (</tt><b><tt>Const </tt></b><tt>Name
: </tt><b><tt>String</tt></b><tt>;Parameters : </tt><a
href="#pvariablemanager"><tt>PVariableManager</tt></a><tt>): </tt><a
href="#pcajvariant"><tt>PCajVariant</tt></a><tt>;</tt><br>
<tt>Run an function inside the script. Parameters must be
assigned. If there are any parameter errors it will return :
EParameterError. Error position points the the param no. If the
function does not exist, it returns EUnknownIdentifier with
position 0.</tt></p>

<p><b><tt>Destructor </tt></b><tt>Destroy;</tt><br>
<tt>Destroy the scriptengine.</tt></p>

<hr>

<p><br>
<a name="pvariablemanager"></a><b>PVariableManager</b><br>
<b>Type</b><br>
&nbsp; PVariableManager = Pointer;<br>
Variable manager is used for storing an array of variables. You
can use these functions for accessing it:</p>

<p><b>Function </b>VM_Create (InheritFrom : PVariableManager) :
PVariableManager;<br>
Create an instance of PVariableManager<br>
<b>Procedure</b> VM_Destroy (p : PVariableManager);<br>
Destroy an instance of PVariableManager<br>
<b>Function </b>VM_Add ( P : PVariableManager; D : <a
href="#pcajvariant">PCajVariant</a>;<b>Const </b>Name : <b>String</b>)
: <a href="#pcajvariant">PCajVariant</a>;<br>
Add a PCajVariant to it.<br>
<b>Procedure </b>VM_Delete (p : PVariableManager; Idx : LongInt);<br>
Delete a PCajVariant from it. Also destroy all the Variants.<br>
<b>Function </b>VM_Get (p : PVariableManager; Idx : LongInt) : <a
href="#pcajvariant">PCajVariant</a>;<br>
Return a PCajVariant from the variable list.<br>
<b>Procedure</b> VM_SetName (p : PVariableManager; Idx : LongInt;
S: <b>String</b>);<br>
Set the name of an item.<br>
<b>Function </b>VM_Count (p : PVariableManager) : LongInt;<br>
Return the number of variant.<br>
<b>Function </b>VM_Find (p : PVariableManager; <b>Const </b>Name
:<b>String</b>) : LongInt;<br>
Find a variant.<br>
<b>Procedure </b>VM_Clear (p : PVariableManager);<br>
Remove all items from the list.</p>

<hr>

<p><br>
<a name="pproceduremanager"></a><b>PProcedureManager</b><br>
<b>Type </b>PProcedureManager = Pointer.<br>
Procedure manager is used for adding external procedures to the
script.</p>

<p><b>Function </b>PM_Create : PProcedureManager;<br>
Create an instance of PProcedureManager.<br>
<b>Procedure </b>PM_Destroy (p : PProcedureManager);<br>
Destroy an instance of PProcedureManager.<br>
<b>Procedure </b>PM_Clear (p : PProcedureManager);<br>
Remove all items.<br>
<b>Procedure </b>PM_Add (p : PProcedureManager; Const Spec : <b>String</b>;Addr
: Pointer);<br>
Spec should be the procedure header in this format:<br>
<tt>ReturnType+' '+ProcedureName+' '+Parameter1Name+'
'+Parameter1Type+' '+Parameter2Name....</tt><br>
The types are number (see PCajVariant0.<br>
When there is an ! before the parameter name, it is an <b>Var</b>
variant.This can be changed.</p>

<p>Addr should point to an <a href="#tregisteredproc">TRegisteredProc.</a><br>
<b>Procedure</b> PM_Delete (p : PProcedureManager; I : LongInt);<br>
Delete procedure number I.<br>
<b>Function</b> PM_Find (p : PProcedureManager; Const Name : <b>String</b>):
Integer;<br>
Search for procedure.<br>
<b>Function</b> PM_Get (p : PProcedureManager; i : LongInt) :
Pointer;<br>
Return the address of the procedure.<br>
<b>Function</b> PM_GetSpec (p : PProcedureManager; i : LongInt) :
<b>String</b>;<br>
Return the procedure definition of I.<br>
</p>

<hr>

<p><br>
<a name="tcs2error"></a><b>Type </b>TCs2Error = Word;<br>
&nbsp; TCs2Error is used for error handling.</p>

<p>Eror codes:<br>
&nbsp; ENoError - No error has occured<br>
&nbsp; ECanNotReadProperty - Can not read property, not used yet<br>
&nbsp; ECanNotWriteProperty - Can not write property, not used
yet<br>
&nbsp; EUnknownIdentifier - The identifier is unknown<br>
&nbsp; EIdentifierExpected - An identifier is expected<br>
&nbsp; ESemicolonExpected - A semicolon is required<br>
&nbsp; EBeginExpected - <em>Begin </em>is expected<br>
&nbsp; EDuplicateIdentifier - Duplicate identifier<br>
&nbsp; EUnexpectedEndOfFile - Unexpected end of file is occured<br>
&nbsp; EColonExpected - An colon is expected<br>
&nbsp; ESyntaxError - There was an error in the syntax<br>
&nbsp; EStringError - A string error, usually, a string that has
notended before the enter.<br>
&nbsp; EErrorInStatement - Error in the statement<br>
&nbsp; EAssignmentExpected - Assignment is expected<br>
&nbsp; ETypeMismatch - Type is not the same.<br>
&nbsp; EErrorInExpression - Error in the expresssion.<br>
&nbsp; ERoundOpenExpected - A round open is expected<br>
&nbsp; ERoundCloseExpected - A round close is expected<br>
&nbsp; EVariableExpected - A variable is expected<br>
&nbsp; ECommaExpected - A comma is expected<br>
&nbsp; EThenExpected&nbsp; - <i>Then</i> is expected<br>
&nbsp; EPeriodExpected - A period is expected<br>
&nbsp; EParameterError - Parameter error, occurs when calling
RunScriptProc.The ErrorPos gives the parameter number.<br>
&nbsp; EToExpected - <em>To </em>expected<br>
&nbsp; EDoExpected - <em>Do</em> expected<br>
&nbsp; ERangeError - out of range<br>
&nbsp; EOfExpected - <em>Of</em> expected<br>
&nbsp; EndExpxcted - <em>End</em> expected<br>
&nbsp; EOutOfRange - Out of range<br>
&nbsp; EOpenBlockExpected - Open block expected<br>
&nbsp; ECloseBlockExpected - Close block expected<br>
</p>

<hr>

<p><a name="tonuses"></a><tt>TOnUses =</tt><b><tt>Function </tt></b><tt>(</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Id
: Pointer;</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sender
: PCs2PascalScript;</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name
: </tt><b><tt>String</tt></b><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)
: TCs2Error;</tt><br>
<tt>This function is triggered when script is loaded (When
assigning a script it is </tt><em><tt>SYSTEM</tt></em><i><tt>) </tt></i><tt>and
when someone add uses XXX; One uses can not occur twice.</tt></p>

<p><i><tt>Id</tt></i><tt> The id passed to the </tt><b><tt>TCs2PascalScript.Create</tt></b><tt>.
Can be used when using more scripts at once.</tt><br>
<i><tt>Sender</tt></i><tt> The </tt><b><tt>TCs2PascalScript</tt></b><tt>.</tt><br>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -