Browsing projects by Tag(s)

Select a tag to browse associated projects and drill deeper into the tag cloud.

Showing page 1 of 1

BESEN is an acronym for "Bero's EcmaScript Engine", and it is a complete ECMAScript Fifth Edition Implemention in Object Pascal, which is compilable with Delphi >=7 and FreePascal >= 2.5.1 (2.4.0 only inoffically). BESEN is licensed under the LGPL license with ... [More] static-linking-exception. Features: It's a complete implementation of the ECMAScript Fifth Edition standard, and it has x86/x64 native code just-in-time compilers. [Less]

5.0
 
  0 reviews  |  6 users  |  60,838 lines of code  |  2 current contributors  |  Analyzed 8 days ago
 
 

ExtPascal is an Object Pascal (Delphi, FreePascal/Lazarus) wrapper/binding for Ext JS, a comprehensive GUI Ajax framework for Rich Internet Application (RIA) development. ExtPascal will wrap Draw2d and CodePress libraries too and future releases. It uses ideas from others Ext JS wrappers: ExtSharp ... [More] and ExtPHP. FeaturesHigh performance with native code for Server side programming, no PHP required. Uses FastCGI or CGI for Web Server communication. Compatible with any Web Server supporting CGI or FastCGI protocols. Statefull, keep-alive and multithread server applications. Parses Ext JS HTML documentation to Object Pascal code. Self-translate Object Pascal code to JavaScript code during execution. Coding in full Object Pascal, minimal use of (X)HTML, CSS and JavaScript. AJAX programming using Object Pascal. Full wrapper to all Ext JS classes, singletons and widgets. Transparent support for all main web browsers: IE 5+, Firefox 1.5+, Safari 2+ and Opera 9+ on any client side platform! Server side multi-platform support through FreePascal 2.2.2+ compiler. Tested on Windows, Linux and Mac OS X. Thread Garbage Collector for all Ext JS classes and widgets. Slim Services and EventLog support for Windows Produces very tiny executables. Easy debugging. Convert your desktop and client/server applications, made in Delphi/Lazarus, to Web 2. Standalone Web Server option, no Apache/IIS required (available in 0.9.2 version or SVN) RoadmapThis roadmap is sync with Ext JS Roadmap0.1. Implement wrapper 0.2. Wrapper tested 0.3. ObjectPascal to JavaScript self-translating 0.4. Self-translating tested 0.5. Implement FastCGI 0.6. FastCGI tested with Apache 2.2.8 on Windows XP 0.7. Wrap ExtJS 2.1 0.8. Implement some ExtJS demos in ExtPascal, using Turbo Delphi 2006 0.8.1. Compatibilize to FreePascal 2.3.1, Delphi 7 and older versions 0.8.2. ExtPascal also works perfectly on Linux and Mac OS X servers. Thanks you Bee! 0.8.3. Implement FastCGI thru CGI gateway 0.8.4. Test on Linux with Apache 1.3 using plain CGI 0.8.5. Publish live-demos on commercial web hosting 0.8.6. Beta 1 release 0.8.7. Beta 2, fixes 0.8.8. Beta 3, Garbage Collector 0.8.9. Beta 4, Services and EventLog support for Windows 0.9. On-line(HTML) and off-line(CHM) documentations 0.9.1. Change VCL pitinnu interface to ExtPascal <<m doing this point 0.9.1.1. Use the embedded Web Server. Thanks you Vagner! 0.9.2. Beta 5 0.9.3. Convert all Ext JS demos to ExtPascal 0.9.4. Release candidate 1.0. Release 1.1. Wrap Draw2d 1.2. Release 1.3. Wrap CodePress 1.4. Release 1.9. Wrap ExtJS 3.0 2.0. Release [Less]

5.0
 
  0 reviews  |  2 users  |  106,710 lines of code  |  2 current contributors  |  Analyzed about 10 hours ago
 
 

Unlike original/official Delphi JavaScript bridge, which is due to its complexness not compileable in FPC (FreePascal) and/or doesn't work really well, is too big, bloated and outdated, this project use only js15decl.pas (basically C header) interface from the original bridge and add very small ... [More] (simple and maintainable) wrapper around it to simplify the usage of Mozilla JavaScript engine in FPC. It also contain set of minimal working demos how to do basic JS stuff from FPC like call JS function, set JS variable, call FPC function from JS, etc... Please use SVN to download the project. API OverviewIf you want to use RawFpcJs, you need add uses clause first. uses RawFpcJs;This gives you access to 2 main objects - TFpcJsRuntime and TFpcJsScript. var r : TFpcJsRuntime; s : TFpcJsScript;To actually access JavaScript, create runtime and then script object. Usual way is to have single runtime and multiple scripts. Created scripts belongs to runtime. r := TFpcJsRuntime.Create; s := r.CreateScript;Once you have script object, you can compile actual JavaScript source code. Note that this will also execute the code! If source code evaluation failed (e.g. because of syntax error), it will return FALSE. if not s.Evaluate('var a=22, b=7, i=5, b=true, s="asdf", r=2.78; echo("pi is approximately ",a/b,"\n");') then writeln('error: evaluation failed');Example above will write: pi is approximately 3.142857142857143E+000You can easily get values of JavaScript global variables with GetValue: writeln('i=',s.GetValue('i'),' b=',s.GetValue('b'),' s=',s.GetValue('s'),' r=',real(s.GetValue('r')):1:5);Will print: i=5 b=True s=asdf r=2.78000You can change these variables with SetValue: s.SetValue('i',6); s.SetValue('b',false); s.SetValue('s','qwer'); s.SetValue('r',1.68);If you print variables now, you will see new values. This code: writeln('i=',s.GetValue('i'),' b=',s.GetValue('b'),' s=',s.GetValue('s'),' r=',real(s.GetValue('r')):1:5);Will print: i=6 b=False s=qwer r=1.68000With SetValue, you can set variable which even doesn't exist. It will create it automatically. s.SetValue('n',123); writeln('n=',s.GetValue('n'));Will print: n=123Probably most important part is binding pascal functions to be called from JavaScript, and calling JavaScript functions from pascal. Both tasks are very simple. First, let's create some JavaScript function, for example factorial: if not s.Evaluate('function fact(n) { if (n <= 1) return 1; return n * fact(n-1); }') then writeln('error: evaluation failed');</pre><p>You can now call it with method Call. Function is identified by its name and parameters are passed as array of variants. Result is also retrieved as variant. Following code: <pre class="prettyprint">writeln('factorial 5 is ',s.Call('fact',[5]));</pre><p>Will print: <pre class="prettyprint">factorial 5 is 120</pre><p>If you want to bind pascal function for use in JavaScript, use RegisterFunction. First create some pascal function. This one print PI with given amount of decimal digits: <pre class="prettyprint">function myPi(AParams : TVariantArray) : variant; var i : integer; begin i := AParams[0]; if i > 10 then i := 10; if i < 1 then i := 1; result := Format('%1.'+inttostr(i)+'f',[pi]); end;</pre><p>Above function attributes are "AParams : TVariantArray" and result is "variant". This is the one and only kind of function that can be bind. You cannot have function with different attributes or different result type. You even cannot bind procedures or objects methods. <p>Once pascal function is created, you can bind it with corresponding name to script: <pre class="prettyprint">s.RegisterFunction('pi',myPi);</pre><p>Then you can create script which will use this function: <pre class="prettyprint">if not s.Evaluate('echo("pi is actually ",pi(5),"\n");') then writeln('error: evaluation 2 failed');</pre><p>Will print: <pre class="prettyprint">pi is actually 3,14159</pre><p>As you may noticed, there is allready one function binded for all scripts. This function is function "echo" which will print all it's attributes to stdout. It can be used for whatever purposes, e.g. debugging. It convert '\n' to new line. And that's it. Pretty simple isn't it? Unfortunately, there is some bug in Linux version of libmozjs. So in Linux, you cannot use TScript.RegisterFunction, you have to use TScript.RegisterNative and bind only native functions. That is because on Linux, argv[-2] doesn't point to PJsFunction object declared with JS_DefineFunction. Why? I don't know. Previous myPi function will look like this: function myPi(cx: PJSContext; obj: PJSObject; argc: uintN; argv, rval: pjsval): JSBool; cdecl; var i : integer; params : TVariantArray; begin // print pi on specified amount of digits params := JsParams(cx,obj,argc,argv); i := params[0]; if i > 10 then i := 10; if i < 1 then i := 1; result := JsResult(Format('%1.'+inttostr(i)+'f',[pi]),cx,rval,@params); end; This incorporate 2 special functions - JsParams and JsResult. These functions convert JS parameters and set JS result. It also allocate and release local function params. This will eventually be fixed someday. Meanwhile, use RegisterNative if you want portable applications. [Less]

0
 
  0 reviews  |  0 users  |  2,043 lines of code  |  0 current contributors  |  Analyzed about 2 years ago
 
 

Unlike original/official Delphi JavaScript bridge, which is due to its complexness not compileable in FPC (FreePascal) and/or doesn't work really well, is too big, bloated and outdated, this project use only js15decl.pas (basically C header) interface from the original bridge and add very small ... [More] (simple and maintainable) wrapper around it to simplify the usage of Mozilla JavaScript engine in FPC. It also contain set of minimal working demos how to do basic JS stuff from FPC like call JS function, set JS variable, call FPC function from JS, etc... Please use SVN to download the project. API OverviewIf you want to use FpcJs, you need add uses clause first. uses FpcJs;This gives you access to 2 main objects - TFpcJsRuntime and TFpcJsScript. var r : TFpcJsRuntime; s : TFpcJsScript;To actually access JavaScript, create runtime and then script object. Usual way is to have single runtime and multiple scripts. Created scripts belongs to runtime. r := TFpcJsRuntime.Create; s := r.CreateScript;Once you have script object, you can compile actual JavaScript source code. Note that this will also execute the code! If source code evaluation failed (e.g. because of syntax error), it will return FALSE. if not s.Evaluate('var a=22, b=7, i=5, b=true, s="asdf", r=2.78; echo("pi is approximately ",a/b,"\n");') then writeln('error: evaluation failed');Example above will write: pi is approximately 3.142857142857143E+000You can easily get values of JavaScript global variables with GetValue: writeln('i=',s.GetValue('i'),' b=',s.GetValue('b'),' s=',s.GetValue('s'),' r=',real(s.GetValue('r')):1:5);Will print: i=5 b=True s=asdf r=2.78000You can change these variables with SetValue: s.SetValue('i',6); s.SetValue('b',false); s.SetValue('s','qwer'); s.SetValue('r',1.68);If you print variables now, you will see new values. This code: writeln('i=',s.GetValue('i'),' b=',s.GetValue('b'),' s=',s.GetValue('s'),' r=',real(s.GetValue('r')):1:5);Will print: i=6 b=False s=qwer r=1.68000With SetValue, you can set variable which even doesn't exist. It will create it automatically. s.SetValue('n',123); writeln('n=',s.GetValue('n'));Will print: n=123Probably most important part is binding pascal functions to be called from JavaScript, and calling JavaScript functions from pascal. Both tasks are very simple. First, let's create some JavaScript function, for example factorial: if not s.Evaluate('function fact(n) { if (n 10 then i := 10; if i < 1 then i := 1; result := JsResult(Format('%1.'+inttostr(i)+'f',[pi]),cx,rval,@params); end; This incorporate 2 special functions - JsParams and JsResult. These functions convert JS parameters and set JS result. It also allocate and release local function params. This will eventually be fixed someday. Meanwhile, use RegisterNative if you want portable applications. [Less]

0
 
  0 reviews  |  0 users  |  1,529 lines of code  |  1 current contributor  |  Analyzed 7 days ago
 
 
 
 

Creative Commons License Copyright © 2013 Black Duck Software, Inc. and its contributors, Some Rights Reserved. Unless otherwise marked, this work is licensed under a Creative Commons Attribution 3.0 Unported License . Ohloh ® and the Ohloh logo are trademarks of Black Duck Software, Inc. in the United States and/or other jurisdictions. All other trademarks are the property of their respective holders.