Keyboard input / init + questions

Charlie Brej plymouth at brej.org
Mon Sep 27 11:01:43 PDT 2010


Sorry about the delay. I'll try and answer as many questions aimed for 
me as I find, but I will probably have missed some.

On 09/25/2010 11:50 AM, Jerome Martin wrote:
> - Is there a way to call up an external binary from plymouth, like a
> system() function ? If not, I guess this would not be much to add, I can
> do it if you give me a proper pointer in your code (hints on the proper
> parse token to use, etc.).

Yes possible, although I would recommend using the on keystroke execute 
command feature rather than letting a plugin run anything it likes. At 
least that way you can be sure what state the system is in.

> - I desperately miss a couple of possibilities regarding strings, like
> determining a string length, and addressing strings as lists
> (a="foobar"; c=a[2]), thus making it possible to do strings
> transformations, iterate on strings, etc. Did I miss something ? Would
> that be hard to implement ?

Ah! So there are two functions that do this. "CharAt" and "SubString". 
Somehow, I forgot to add these to the wiki.

"String".CharAt(2) => "r"
"String".SubString(2, 4) => "rin"

I think it is indexed starting at zero and the SubString takes inclusive 
start and end pointers.

> - Last, but related to the previous, I currently keep an index on lists
> I create to knopw their length before iterating on them, but it would be
> nice to have a mylist.Len() method.

Are you just appending to a list by adding elements at increasing 
indices? list[0] = "blah", list[1]="sdf"...
In which case you can just add a length element and keep that up to date 
when you add/remove elements. (list.length++ or list["length"]++)


> Can any of the two previous points be done with a "list | []" method of
> sorts ?

Not really. That's a rather complex one to explain.

 > Things using "\033"

There is no escaping supported in the scripted system apart from \n \" 
and \0.

Ok, sorry, just found your patch. I'm split between \123 and \x123.

Are there other questions I have missed?


More information about the plymouth mailing list