To Miguel, and all (see below),
I've had a look at Compiler.java, and looks like a nice parser... have you
considered JavaCC for this? /me never used it before...
Anyway, since the Compiler.java was not that easy to read, I took the
documentation for an overview of commands... As I said on email, I've never
written an consistent grammer yet, so it's just a one-to-one conversion, so
please comment on the stupid bits with this first draft inherits from Chime
scripts...
To all:
below is a first draft of a XML based scripting language. The examples below
don't have any schema yet, but it will have one when things become a bit more
solid. I intend to make all script command elements empty.
This is the time to make script command requests and post any issues you have
with other script languages.
animate X -> <animate command="X"/>
e.g. <animate command="play"/>
background <color> -> <background color="colorExpression"/>
color {<object>} <color> -> <color object="X" color="colorExpression">
where X = atoms|labels|bonds|axes
cpk <boolean> -> <set field="cpk" value="on"/>
on|true|yes
cpk <value> -> <cpk percentage="90"/> | <cpk rasmolUnit="50"/>
define <var> <expression> -> <define variable="X" expression="Y"/>
delay {<delaytime}} -> <delay/> | <delay seconds="5"/>
echo <string> -> <echo message="Hello Jmol user"/>
exit -> <exit/>
label <boolean> -> <set field="label" value="on"/>
see cpk <boolean>
label <string> -> <label expression="%a"/>
load {<format>} <filename> -> <load file="some.pdb"/>
load {<format>} <url> -> <load format="pdb" url="http://sf.net/stream.cgi"/>
loop {<delaytime>} -> <loop/> | <loop seconds="5"/>
monitor <number> <number> -> <monitor distance="num1 num2"/>
monitor <num> <num> <num> -> <monitor angle="num1 num2 num3"/>
monitor <num> <num> <num> <num> -> <monitor dihedral="num1 num2 num3 num4"/>
move <xRot> <yRot> <zRot> <zoom> <xTrans> <yTrans> <zTrans> <slab> <time>
{<FPS>} {<MaxAccel>} -> <move rotateX="60" zoomFactor="200" translateX="5"
time="3"/>
this might better be done differently, by using loops? see also rotate
quit -> <quit/>
refresh -> <refresh/>
reset -> <reset/>
rotate <axis> <value> -> <rotate axis="x" angle="60"/>
script <filename|url> -> <script format="chime" url="http://some.where/"/>
select {<expression>} -> <select expression="*"/>
set <parameter> <value> -> <set field="param" value="value"/>
see also label and cpk
slab <boolean> -> <set field="slab" value="on"/>
slab <percentage> -> <slab percentage="56"/>
spacefill -> <set field="cpk" value="on"/>
translate <axis> <value> -> translate axis="x" angle="6"/>
wireframe <boolean> -> <set field="wireframe" value="on"/>
wireframe <value> -> <wireframe value="40"/>
zap -> <zap/>
zoom <boolean> -> <set field="zoom" value="on"/>
zoom <value> -> zoom value="40"/>
Because an XML doc needs a root element, commands are wrapped in a <script>
element:
<script xmlns="http://jmol.sf.net/schema/jmolscript">
<zap/>
<load url="http://www.matrix.org/aceticAcid.cml"/>
<set field="cpk" value="true"/>
<monitor angle="1 2 3"/>
</script>
Note that expressions are not XML-ized... is that worth doing it? Would it be
required in the first version of the scripting language?
Nothing is fixed in this draft, especially element names. I was not feeling
very creative at the moment... Comments appreciated. But, as coined in the
example above, JmolScript might be a nice name...
Egon
--
PhD Molecular Representation in Chemometrics
Laboratory of Analytical Chemistry
http://www-cac.sci.kun.nl/people/egonw.html
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Jmol-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jmol-developers