Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology
Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered
You are not logged in.
Pages: 1
I figured I would put all the code in one thread for whoever might find it useful.
to write an .xml file that looks like this:
<fps minfps="12"/>
<maxpaksize maxpaksize="5"/>
write this:
proto XMLload = fun [S] XMLfile;;
proto XMLcreate = fun [S S] XMLfile;;
proto XMLaddMark= fun [XMLfile S XMLmark [[S S] r1] S] XMLmark;;
proto XMLwrite = fun [XMLfile S] I;;
//typeof file = XMLfile;;
fun secureLoad(pack)=
let _testpak pack -> ret in
if (ret == nil) then
(
_fooS "xmlparser loading";
_load pack;
1;
)
else
(
_fooS strcat "Error in " ret;
0;
);;
fun load_dependencies() =
let "tools/os3dlib/tools.pkg"::"tools/os3dlib/xmlparser.pkg"::nil -> list_of_dependencies in
(
while (list_of_dependencies!= nil)&& (secureLoad hd list_of_dependencies) do
(
set list_of_dependencies = tl list_of_dependencies;
_fooS "dependencies loading";
);
//all dependencies have been read
if list_of_dependencies==nil then
(
//read hybridgui.xos and write to hybridgui.xml in openspace3d/tests/filreader
let "xmlwriter/xmlwriter.xml" -> file in
let XMLcreate file nil -> xmlstr in
let XMLaddMark xmlstr "fps" nil ["fps" "12"]::nil nil -> namestr in
let XMLaddMark xmlstr "maxpaksize" nil ["maxpaksize" "5"]::nil nil -> paksizestr in
(
XMLwrite xmlstr "xmlwriter/xmlwriter.xml";
_closemachine;
);
0;
)
else
(
_fooS "error in dependency loading";
0;
);
);
0;;
fun main ()=
_showconsole;
load_dependencies;
0;;
to get the values of
minfps
and
maxpaksize, write this:
proto XMLload = fun [S] XMLfile;;
proto XMLcreate = fun [S S] XMLfile;;
proto XMLaddMark= fun [XMLfile S XMLmark [[S S] r1] S] XMLmark;;
proto XMLwrite = fun [XMLfile S] I;;
proto XMLgetMarkByValue = fun [XMLfile S] XMLmark;;
proto XMLgetParam = fun [XMLmark S] S;;
//typeof file = XMLfile;;
fun secureLoad(pack)=
let _testpak pack -> ret in
if (ret == nil) then
(
_fooS "xmlparser loading";
_load pack;
1;
)
else
(
_fooS strcat "Error in " ret;
0;
);;
fun load_dependencies() =
let "tools/os3dlib/tools.pkg"::"tools/os3dlib/xmlparser.pkg"::nil -> list_of_dependencies in
(
while (list_of_dependencies!= nil)&& (secureLoad hd list_of_dependencies) do
(
set list_of_dependencies = tl list_of_dependencies;
_fooS "dependencies loading";
);
//all dependencies have been read
if list_of_dependencies==nil then
(
let XMLload "xmlwriter/xmlwriter.xml" -> xml_file in
let XMLgetMarkByValue xml_file "fps" -> fpskstr in
let XMLgetMarkByValue xml_file "maxpaksize" -> paksizestr in
(
_fooS (XMLgetParam fpskstr "fps");
_fooS (XMLgetParam paksizestr "maxpaksize");
);
0;
)
else
(
_fooS "error in dependency loading";
0;
);
);
0;;
fun main ()=
_showconsole;
load_dependencies;
0;;
this is just for a list of nodes with one param and param value per node.
Last edited by hebdemnobad (16-Dec-2014 19:30:48)
Offline
Pages: 1