-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e6fff48
commit 63b97d1
Showing
1 changed file
with
37 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
CGI FOR LCD SMARTIE 0.2-alpha | ||
============================= | ||
|
||
> CGI for LCD Smartie is designed to be a fast gateway between LCD Smartie ([http://lcdsmartie.sourceforge.net](http://lcdsmartie.sourceforge.net)) and language | ||
> interpreters such as PHP, Ruby and Python, making it easier to gather information to | ||
> CGI for LCD Smartie is designed to be a fast gateway between LCD Smartie ([lcdsmartie.sourceforge.net](http://lcdsmartie.sourceforge.net)) and language | ||
> interpreters such as PHP, Ruby or Python, making it easier to gather information to | ||
> show on the display without the need to create new plugins. | ||
> The software is made from two parts: a server (cgi4lcd.exe) and a plugin (cgi.dll). | ||
> The plugin is responsible for sending the command to the server, receiving a response and relaying it to LCD Smartie. | ||
> The server receives the command, executes the specified interpreter, storing the command and its response in a queue. At a specified time interval it will run the command, caching its result. When the plugin asks the server for the response of a command, it will deliver the cached result instead of executing the interpreter before the specified time interval. Optionally, this behavior can be changed and the interpreter executed directly. | ||
> The server receives the command, executes the specified interpreter, storing the command and its response in a queue. At a specified time interval it will execute the command, caching its result. When the plugin asks the server for the response of a command, it will deliver the cached result instead of executing the interpreter again. Also, there is a timeout value to tell the server when to remove a command if it is not being requested anymore. | ||
WHAT HAPPENED TO PHP FOR LCD SMARTIE? | ||
--------------------------------------------------- | ||
|
@@ -24,29 +24,29 @@ WHEN IT WILL BE USEFUL? | |
> * When you want to develop that in a short timespan, using your preferred programming language | ||
> * When you don't have patience to build complex plugins using C++, Delphi or VB | ||
> * When you are really not interested in worrying about pointers, variable types, compilation and other cumbersome constraints that strongly typed languages has to bother you | ||
> * When CGI4LCD is dominating the market share of all other plugins and everyone starts developing scripts for fun and non-profit and someone created something useful to you | ||
> * When the time comes and CGI4LCD is dominating the market share of all other plugins so everyone starts developing scripts for fun and non-profit and someone creates something useful to you | ||
WHEN IT WILL NOT BE USEFUL? | ||
--------------------------- | ||
|
||
> If you're happy and pleased using the other plugins | ||
> Basically, for everything that demands fast or realtime data displaying, like graph bars. | ||
> Believe me, the minimum time interval that LCD Smartie is allowed to get data from the plugin is 1 second and even if it was smaller, the default time interval to re-execute an interpreter is 15 seconds. Oh, are you thinking about decreasing everything to 100 ms? Only if you have a good machine configuration to support thousands of processes doing the same thing. | ||
> Really, don't try it. Go to C++ | ||
> Really, don't try it. I beg you to use C++ | ||
INSTALLING | ||
---------- | ||
|
||
> * Make sure you have .Net Framework 4 | ||
> * Make sure you have LCD Smartie 5.4 or 5.4.2.92b (or grab it from [http://lcdsmartie.sourceforge.net/smartied.htm](http://lcdsmartie.sourceforge.net/smartied.htm)) | ||
> * Grab the latest version (ZIP) from [https://github.com/MendelGusmao/CGI-for-LCD-Smartie/downloads](https://github.com/MendelGusmao/CGI-for-LCD-Smartie/downloads) | ||
> * Copy plugins and scripts folder to your LCD Smartie folder | ||
> * Boost >= 1.48 if you want to have fun compiling yourself the project | ||
> * Make sure you have LCD Smartie 5.4 or 5.4.2.92b (or grab it from [lcdsmartie.sourceforge.net](http://lcdsmartie.sourceforge.net/smartied.htm)) | ||
> * Grab the latest version from [downloads](https://github.com/MendelGusmao/CGI-for-LCD-Smartie/downloads) | ||
> * Copy plugins and scripts directory to your LCD Smartie directory | ||
> * Boost >= 1.48 ([boost.org](http://boost.org)) and UPX ([upx.sourceforge.net](http://upx.sourceforge.net)) if you want to have some fun compiling the project by yourself | ||
CONFIGURING | ||
----------- | ||
|
||
> The configuration is done in cgi4lcd.ini (available in scripts folder). | ||
> The configuration is done in cgi4lcd.ini (available in scripts directory). | ||
> The first section is [cgi4lcd]. It has the following attributes: | ||
|
@@ -65,9 +65,6 @@ CONFIGURING | |
> * default_extension (text) | ||
> The default file extension to be considered by the plugin if not specified in the filename passed to $dll | ||
> * add_and_run (boolean, 0-1) | ||
> If the value is 1, the server will execute the command right after it is added to the queue. If not, the server will await the configured interval to run the command and will be returning an empty response until it happens. | ||
> * max_threads (numeric) | ||
> The maximum number of commands that can be run simultaneously | ||
|
@@ -83,13 +80,13 @@ CONFIGURING | |
> The command line to execute the script. It has variables that are replaced when the plugin sends the command to the server. They are: | ||
> * %scripts_path% | ||
> The absolute path to *[LCD Smartie path]*\scripts folder | ||
> The absolute path to *[LCD Smartie path]*\scripts directory | ||
> * %routers_path% | ||
> The absolute path to *[LCD Smartie path]*\scripts\routers folder | ||
> The absolute path to *[LCD Smartie path]*\scripts\routers directory | ||
> * %script% | ||
> The absolute path to *[LCD Smartie path]*\scripts\\*[script name]* | ||
> The absolute path to *[LCD Smartie path]*\scripts\*[script name]* | ||
> * %params% | ||
> Function name or function name and parameters specified in the last argument passed to $dll | ||
|
@@ -107,10 +104,10 @@ CONFIGURING | |
USING | ||
----- | ||
|
||
> ### function1 - Run interpreter | ||
> ### function1 - Executes interpreter | ||
> * filename - mandatory. it must exist in scripts folder. | ||
> The extension is optional. If not passed, the plugin will use the default extension set in the section cgi4lcd of the configuration file | ||
> * filename - mandatory. it must exist in scripts directory. | ||
> The extension is optional. If not passed, the plugin will use the default extension set in the section *[cgi4lcd]* of the configuration file | ||
> * function (optional) and arguments (separated by semicolons), also optional | ||
> Syntax: `$dll(cgi,1,filename[.extension],[function[#arg1;arg2;...]])` | ||
|
@@ -129,10 +126,13 @@ USING | |
> Syntax: `$dll(cgi,1,file[.ext],function#arg1;arg2;argX)` | ||
> ### function2 - Run interpreter directly, without putting the command in a queue | ||
> ### function2 - Places the command in the queue without executing it | ||
> * The same arguments of function1 | ||
> ### function3 - Executes the command without placing it in a queue | ||
> * The same arguments of function1 | ||
> ### function3 - Gather interpreter version by extension | ||
> ### function4 - Gathers interpreter version by extension | ||
> * extension - optional. If empty, will use the default extension | ||
> Syntax: `$dll(cgi,3,[extension],)` | ||
|
@@ -143,11 +143,9 @@ USING | |
WRITING SCRIPTS | ||
--------------- | ||
|
||
> First of all, you'll need to know what is a router. It's a piece of code responsible for calling a function, retrieving its result and printing to the screen, so the server can grab and relay it to the plugin. Routers are optional if your script outputs data directly but mandatory if you want to group functions in a file. | ||
> First of all, you'll need to know what is a router: a piece of code responsible for calling a function, retrieving its result and printing to the screen, so the server can grab and relay it to the plugin. Routers are optional if your script outputs data directly to screen but mandatory if you want to group functions in a file. | ||
> For now, CGI4LCD comes with routers written in PHP, Ruby, Python and Perl. A Go version is in the repository - but still just a concept. | ||
> The script must be saved in scripts folder and has the following structure: | ||
> The script must be saved in scripts directory and has the following structure: | ||
> `# include router` | ||
> `# declare functions` | ||
|
@@ -157,14 +155,16 @@ WRITING SCRIPTS | |
> `[write code that outputs directly to the screen]` | ||
> The scripts directory is full of test.*[extension]* files that describes the basics of writing functions. Try it yourself: | ||
> The *scripts/tests* directory is full of test.*[extension]* files that describes the basics of writing functions. Try it yourself: | ||
> `$dll(cgi,1,test,hello)` -> Hello, world! | ||
> `$dll(cgi,1,test,hi#Mendel)` -> Hi, Mendel | ||
> `$dll(cgi,1,test,do_some_math#1;2;3)` -> 5 | ||
BUNDLED LANGUAGES (ROUTERS + BASIC CONFIGURATION) | ||
------------------------------------------------- | ||
BUNDLED LANGUAGES | ||
----------------- | ||
|
||
> *When I say "bundled", I mean it already has routers and basic configuration for the mentioned languages. You still need to download the interpreters from the internet to use their languages* | ||
> ### PHP · PYTHON · RUBY · PERL · LUA · JAVASCRIPT | ||
|
@@ -174,7 +174,9 @@ LANGUAGE SPECIFICS | |
------------------ | ||
|
||
> ### PHP | ||
> To give some boost in PHP process startup, write a crafted php.ini. This must a stripped version that doesn't make PHP load too many extensions. | ||
> To give some boost to PHP interpreter startup, write a crafted php.ini. This must a stripped version that doesn't make PHP load too many extensions. Add the -c parameter to command template in *[php]* section. e.g.: | ||
> `command="-d auto_prepend_file='%routers_path%\php.php' -c '%scripts_path%\php.ini' '%script%' '%params%'"` | ||
> ### Python | ||
> While PHP (e.g.) allows to pass a file from the command line to be included in the called script, Python doesn't (or, at least, I don't know how to). When writing a Python script, put on the first line: | ||
|
@@ -192,19 +194,18 @@ LANGUAGE SPECIFICS | |
> ### JavaScript (using [node.js](http://nodejs.org)) | ||
> The interpreter doesn't provide a way to specify a path or a module to be loaded before the script to be run, so, put on the first line of your script: | ||
> `require("routers\js.js")` | ||
> `require("routers/js.js")` | ||
ISSUES | ||
------ | ||
|
||
> * Sometimes it halts the screen when plugin requests data to the server while a command is being executed | ||
> * It **will** halt LCD Smartie if the server is shut down while requesting data | ||
> * It **will** halt LCD Smartie if the server is shut down while the client is requesting data | ||
> * *[Your complaint here]* | ||
TODO | ||
---- | ||
|
||
> * Add better support to Unicode strings | ||
> * Provide better support to Unicode strings | ||
> * Rewrite almost every function or method to use char* instead of strings | ||
> * Make the plugin run cgi4lcd.exe if it's not being executed | ||
> * In the future, drop the server-client architecture and make the plugin use threads to do the server work | ||
|
@@ -214,6 +215,6 @@ TODO | |
FINALLY | ||
------- | ||
|
||
> * Official website of LCD Smartie: [http://lcdsmartie.org](http://lcdsmartie.org) | ||
> * Official CGI4LCD thread at LCD Smartie forums: [http://forums.lcdsmartie.org/viewtopic.php?f=8&t=3274](http://forums.lcdsmartie.org/viewtopic.php?f=8&t=3274) | ||
> * Contact the author: [mailto:[email protected]](mailto:[email protected]) | ||
> * Official website of LCD Smartie: [lcdsmartie.org](http://lcdsmartie.org) | ||
> * Official CGI4LCD thread at LCD Smartie forums: [forums.lcdsmartie.org](http://forums.lcdsmartie.org/viewtopic.php?f=8&t=3274) | ||
> * Contact the author: [[email protected]](mailto:[email protected]) |