Ray Strode [Wed, 5 Aug 2009 19:41:37 +0000 (15:41 -0400)]
[script] drop stringify, .script.h instead of .string
stringify.py is written in perl, but doesn't do much to justify the
dependency. We now just do sed in the Makefile. Also, rename
.string to .script.h since that's a little more conventional.
Charlie Brej [Mon, 20 Jul 2009 13:12:53 +0000 (14:12 +0100)]
[script] Rename ply-scan to script-scan
The scan functions were originally aimed to be put in libply but then again I
can't think of anything that would use them so they are now renamed to left in
the plugin.
Charlie Brej [Mon, 20 Jul 2009 12:59:20 +0000 (13:59 +0100)]
[script] Tidy up the example script
Removes the spinfinity function as it used an ugly ../ path to get the images
and assumed that spinfinity was installed.
Removes some elements which were only inserted for testing.
Charlie Brej [Wed, 8 Jul 2009 23:23:23 +0000 (00:23 +0100)]
[script] Add support for variable number of arguments
Functions can pick up the full array of arguments passed in using the "_args"
local variable. This is a hash with arguments stored indexed from "0" to "N".
The "count" entry in the _args hash contains the number of vars passed in.
Charlie Brej [Thu, 2 Jul 2009 14:57:00 +0000 (15:57 +0100)]
[script] Add support for setting the window background color
Two functions set the color of either the bottom or the top of the screen. If
the two colors are equal a solid colour draw is used. The color is supplied by
three floats specitying red green and blue elements.
Charlie Brej [Tue, 30 Jun 2009 21:13:25 +0000 (22:13 +0100)]
[script] Implement script based fade_in implementation
The example script now can show a spinfinity or a fade_in behaviour. This is
just to see how easy it is to implement current plugins. In the case of fade_in
it is around 23 lines of script code
Charlie Brej [Tue, 30 Jun 2009 20:46:40 +0000 (21:46 +0100)]
[script] Add support for 'for'
Matches the use in C as "for (first, condition, last)" where first is executed
once, last is executed at the end of each iteration (even when continue is
executed) and condition is tested at the start of every cycle.
Charlie Brej [Tue, 30 Jun 2009 14:28:31 +0000 (15:28 +0100)]
[script] Deref the state to allow local and global to be reassigned
This should allow local and global to be assigned to a different vareable.
This is discouriged as it may cause asserts to fail, but may be useful to save
current state and continue the function at a later time.
Charlie Brej [Mon, 29 Jun 2009 13:41:23 +0000 (14:41 +0100)]
[script] Creating a string object with a NULL string now returns a NULL object
Strings in C are often set to NULL to signify that they have not been set. This
should be carried through to the script system rather than failing at the
conversion.
Charlie Brej [Thu, 25 Jun 2009 14:49:12 +0000 (15:49 +0100)]
[script] Allow scripts to attach themselves to plymouth plugin callbacks
The scripts can now attach themselves to the following callbacks: refresh,
boot_progress, root_mounted, keyboard_input, update_status, display_normal,
display_password and display_question.
Charlie Brej [Thu, 25 Jun 2009 10:25:12 +0000 (11:25 +0100)]
[script] Rationalize function calls and callbacks
Allows script functions to be executed without extracting the body of the
function and executing that. This makes implementing callbacks simpler and
enables passing of parameters.
Charlie Brej [Tue, 23 Jun 2009 15:50:36 +0000 (16:50 +0100)]
[script] Output error mesages when parsing files
The parses should now produce useful error messages of syntax errors in the
parsed files. This is not a 100% coverage but at least it now gives an error
with a line number rather than just an assert and a crash.
Charlie Brej [Tue, 23 Jun 2009 13:26:07 +0000 (14:26 +0100)]
[scan] Remember the line and column number of tokens
This is useful for scan and parse error reporting. The first column is zero but
this can be changed. Nedit and Emacs say zero, gedit says 1 and Vi says "0-1".
Charlie Brej [Mon, 22 Jun 2009 22:38:57 +0000 (23:38 +0100)]
[scan] Add block comments
Treats "/*" and "*/" as block comment markers. Block comments may be nested.
There is a bug where if a comment or a string is not terminated before the end
of a file, the scanner deadlocks. Need to add a way or reporting scanner
errors to the parser.
Charlie Brej [Mon, 22 Jun 2009 21:59:45 +0000 (22:59 +0100)]
[scan] Add parsing of line comments
These are currently hard coded to '//' and '#'. The code is there to return
them to the caller but currently they are thrown away.
Should add a skip_comments option and allow customisable markers.
Charlie Brej [Mon, 22 Jun 2009 20:30:09 +0000 (21:30 +0100)]
[scan] Remember white space between tokens
Tokens now contain the number of white space characters since the last token.
This is useful in situations where white space between symbols changes the
meaning (e.g. a++ vs. a+ +).
Charlie Brej [Mon, 22 Jun 2009 20:20:13 +0000 (21:20 +0100)]
[script] Add support for script image rotation
An image rotate operation creates a new image with the same dimensions but with
the contents rotated by an angle around the centre of the image. Also added a
script object to float function to allow this.
Charlie Brej [Mon, 22 Jun 2009 15:48:46 +0000 (16:48 +0100)]
[script] Add support for unary operations (!/+/-/++/--)
Allows execution of unary operations: Pre/postfix inc/decrement, logical
negation and unary plus/minus.
The writebacks of increment/decrements happen during the execution of the
expression, unlike C where they are executed after the line if executed. This
is the case simply because it is simpler to execute this way.
Charlie Brej [Thu, 18 Jun 2009 16:27:32 +0000 (17:27 +0100)]
[script] Add support for logical AND and OR
Allows the use of "&&" and "||". These are evaluated lazily and return the
evaluated sub-value which completed the operation rather than a bool. It allows
things like:
If cache_lookup returns a false value (NULL, or 0) then slow_lookup is executed
and its result is placed in reply. Otherwise the result from cache_lookup is
used.
Charlie Brej [Fri, 12 Jun 2009 17:04:25 +0000 (18:04 +0100)]
Initial scripted plugin support
This is an initial support for the scripted plugin. There are _many_ FIXMEs
and the whole code is reather unstable. The formatting is completely incorrect
and will be changed soon. There are scripts which are converted using a perl
to an C embeddable string.
Charlie Brej [Wed, 15 Jul 2009 10:30:19 +0000 (11:30 +0100)]
[utils] Add utf-8 support functions to determine character and string length
These are used to feed the keyboard input a single character at a time, to
determine the number of bullets in the password dialogue and process backspaes.