Scolring - Forum

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.

#1 19-Oct-2014 13:33:18

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

viewing content of .xos file as text [solved]

is there an app that I can use to view an xos file as text?  bluefish and notepad are unable to open the file as text.

Last edited by hebdemnobad (21-Oct-2014 20:19:02)

Offline

#2 19-Oct-2014 13:41:03

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: viewing content of .xos file as text [solved]

A .xos file is a text file, any text editor must open them.
Maybe this software doesn't automatically open these files but manuelly, it does.

Offline

#3 19-Oct-2014 13:44:04

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: viewing content of .xos file as text [solved]

iri wrote:

A .xos file is a text file, any text editor must open them.
Maybe this software doesn't automatically open these files but manuelly, it does.

Thx Iri...
is there some setting I have to change in bluefish?

Offline

#4 19-Oct-2014 13:51:22

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: viewing content of .xos file as text [solved]

euhhh ....

File > Open doesn't work ?

otherwise maybe a right-click on the *.xos file in the Windows explorer and choose "Open with" Bluefish ?

Offline

#5 19-Oct-2014 14:42:45

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: viewing content of .xos file as text [solved]

In the last version I changed a bit the xos format, so it can be zipped.

use XMLload and then XMLwrite
it will load the zipped file and write it in clear text

Offline

#6 19-Oct-2014 15:02:33

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: viewing content of .xos file as text [solved]

arkeon wrote:

In the last version I changed a bit the xos format, so it can be zipped.

use XMLload and then XMLwrite
it will load the zipped file and write it in clear text

.....I assume the filereader.pkg that loads the .xos must load xmlparser.pkg.  does filereader.pkg (and filrereader.scol which calls the 'main' function in filereader.pkg) have to be in the C:\Program Files (x86)\Scol Voyager\Partition_LockedApp\tools folder?

Last edited by hebdemnobad (19-Oct-2014 15:11:16)

Offline

#7 19-Oct-2014 15:39:25

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: viewing content of .xos file as text [solved]

if you copy the player the xmlparser.pkg is already loaded.

no directory of the pkg file does not matter

Offline

#8 19-Oct-2014 17:07:12

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: viewing content of .xos file as text [solved]

arkeon wrote:

if you copy the player the xmlparser.pkg is already loaded.

no directory of the pkg file does not matter

So my filereader.pkg in my openspce3d partition can load a .pkg in \tools\whatever subdirectory?

Last edited by hebdemnobad (19-Oct-2014 17:08:03)

Offline

#9 19-Oct-2014 17:35:56

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: viewing content of .xos file as text [solved]

If  your application needs any files in os3d directory, your application and openspace3d must be installed. Is what you wish ?

Offline

#10 19-Oct-2014 17:42:45

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: viewing content of .xos file as text [solved]

This is how the partition priority works

Offline

#11 19-Oct-2014 18:18:16

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: viewing content of .xos file as text [solved]

thanks for the replies guys, I'm hiking up a this afternoon, I will post when I get home...

my Android doesn't allow me to dictate scol terms into the microphone

Offline

#12 19-Oct-2014 22:35:14

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: viewing content of .xos file as text [solved]

there was snow up there!

Last edited by hebdemnobad (19-Oct-2014 23:00:06)

Offline

#13 19-Oct-2014 23:17:39

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: viewing content of .xos file as text [solved]

this is what I have gotten to...I think I got the loop through the list of the dependencies right, but the vm doesn't recognize XMLload:

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 "tests/filereader/tools.pkg"::"tests/filereader/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 "tests/filereader/hybridgui.xos" -> xml_file in
  						(
  							XMLwrite	xml_file "tests/filereader/hybridgui.xml";
  						);
  				0;
  				) 
  		else
  				(
  							_fooS "error in dependency loading";
  				0;
  				);
);
0;;
fun main ()=
  _showconsole;
  load_dependencies;
  0;;

the code breaks at "XMLload" as unknown...ps how do I make my code more readable in my posts...chrome always messses with the indentation.

Last edited by hebdemnobad (19-Oct-2014 23:19:40)

Offline

#14 19-Oct-2014 23:30:15

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: viewing content of .xos file as text [solved]

tests/filereader/xmlparser.pkg is the correct path ?
you can load it directly from oS3Dlib directory

Offline

#15 19-Oct-2014 23:31:08

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: viewing content of .xos file as text [solved]

lol where did you go to have snow ?

Offline

#16 19-Oct-2014 23:37:16

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: viewing content of .xos file as text [solved]

arkeon wrote:

lol where did you go to have snow ?

Indian Head Mountain, NY US

Offline

#17 19-Oct-2014 23:41:09

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: viewing content of .xos file as text [solved]

arkeon wrote:

tests/filereader/xmlparser.pkg is the correct path ?
you can load it directly from oS3Dlib directory

I'll try that. Thx.

Offline

#18 19-Oct-2014 23:44:29

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: viewing content of .xos file as text [solved]

I changed

let "tests/filereader/tools.pkg"::"tests/filereader/xmlparser.pkg"::nil -> list_of_dependencies in

to

let "tools/os3dlib/tools.pkg"::"tools/os3dlib/xmlparser.pkg"::nil -> list_of_dependencies in

still get the same error

Offline

#19 19-Oct-2014 23:57:00

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: viewing content of .xos file as text [solved]

ho ok
when your pkg file compile, at this time it don't know xmlLoad functions since the files are not loaded yet

two solutions :
- you add a pkg file with one predeclared function "mainPlayer" for example using proto and start your player code here
- you predeclare all the unknown function xmlParser ... using proto

proto XMLload = fun [S] XMLfile;;
proto XMLwrite = fun [XMLfile S] I;;

Offline

#20 20-Oct-2014 00:37:25

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: viewing content of .xos file as text [solved]

yes that works. thx arkon!!!


...I don't understand though how the proto declaration makes the vm execute XMLload when  XMLload  is defined in xmlparser.pkg.  I've read (and reread) the scol tutorial .pdf and the online docs on scolring, but there I still don't understand the meaning of it.


Either something lost in translation from French to English or something is lost on me since I don't have a degree in computer science.



...and doesn't the vm execute:

while (list_of_dependencies!= nil)&& (secureLoad hd list_of_dependencies) do
				(
					set list_of_dependencies = tl list_of_dependencies;
					_fooS "dependencies loading";
				);

before proceeding to execute:

		//all dependencies have been read
		if list_of_dependencies==nil then

Last edited by hebdemnobad (20-Oct-2014 00:39:09)

Offline

#21 20-Oct-2014 08:18:34

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: viewing content of .xos file as text [solved]

pkg files are compiled on the fly.
so when a pkg is compiled only functions and variables in pkg loaded before are known.

in your case you use the _load function that load a new file in runtime, so only pkg loaded after will know this functions.
The prototype declaration allow to pre-declare this functions so compiler know the function name and prototype before it exist, and you can call it.

if the function is pre-declared but not loaded you should run into an "empty prototype" error when you call it.

Offline

#22 20-Oct-2014 13:01:07

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: viewing content of .xos file as text [solved]

arkeon wrote:

pkg files are compiled on the fly.
so when a pkg is compiled only functions and variables in pkg loaded before are known.

in your case you use the _load function that load a new file in runtime, so only pkg loaded after will know this functions.
The prototype declaration allow to pre-declare this functions so compiler know the function name and prototype before it exist, and you can call it.

if the function is pre-declared but not loaded you should run into an "empty prototype" error when you call it.


So if I load
Tools.pkg::xmlparser.pkg::filereader.pkg::nil
In loader.pkg
And then call somefunction defined in filereader.pkg in a line of code in  the loader.pkg that will work without proto declaration in loader. pkg.

Offline

#23 20-Oct-2014 13:54:30

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: viewing content of .xos file as text [solved]

no you will need to pre declare the function of filereader.pkg to be able to call it, but you will have only one function to declare not all of them

Offline

#24 20-Oct-2014 14:43:17

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: viewing content of .xos file as text [solved]

arkeon wrote:

no you will need to pre declare the function of filereader.pkg to be able to call it, but you will have only one function to declare not all of them

I see, so for any .pkg, let's say player.pkg, if there is a function called in player.pkg that is defined in some other .pkg, such as tools.pkg, xmlparser.pkg, supernewsoftware.pkg, the proto statements for functions loaded in tools and xmlparser must have proto statements. Is that correct?

I must be  not correct since in os3dplayer.pkg there is the function InitOs3dPlayer(file, projname, pw ,ph, fullscreen)...while there is a proto declaration in os3dload.pkg for InitOs3dPlayer(), there is no proto declaration for InitOs3dPlayer() in os3dplayer.pkg, even though InitOs3dPlayer is not defined in os3dplayer.pkg.

It works a bit different in javascript as I recall (save for an art festival in 2013 I haven't used it much since 2007.) ...I think if you name second.js as a source for javascript in a web page that holds javascript code (hostpage.htm) , you can just call the method as defined in second.js in inline javascript code in hostpage.htm without any proto declarations.

Offline

#25 20-Oct-2014 14:52:19

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: viewing content of .xos file as text [solved]

arkeon wrote:

pkg files are compiled on the fly.
so when a pkg is compiled only functions and variables in pkg loaded before are known.

in your case you use the _load function that load a new file in runtime, so only pkg loaded after will know this functions.
The prototype declaration allow to pre-declare this functions so compiler know the function name and prototype before it exist, and you can call it.

if the function is pre-declared but not loaded you should run into an "empty prototype" error when you call it.

wait I think I understand now.....no need to answer my question unless I run into more problems and then I'll ask after troubleshooting.

anyway here is the whole.pkg that reads a hard coded .xos file and writes it to an .xml file.
I'm thinking of creating a file format for my modded player to use that will be reading and writing xml files  (very simple ones, that contain one 3d object, up to three lights, a few environment variables (ambient color, diffuse color, etc.) that will integrate the drag and drop functionality of the editor in the player for other 3d file formats. (that's in the future, although I have a bit of learning to do before that.)

thx arkeon!

proto XMLload = fun [S] XMLfile;;
proto XMLwrite = fun [XMLfile S] I;; 


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 XMLload "tests/filereader/hybridgui.xos" -> xml_file in
  						(
  							XMLwrite  xml_file "tests/filereader/hybridgui.xml";
  						);
  				0;
  				) 
  		else
  				(
  							_fooS "error in dependency loading";
  				0;
  				);
);
0;;
fun main ()=
  _showconsole;
  load_dependencies;
  0;;

Last edited by hebdemnobad (20-Oct-2014 14:54:42)

Offline

Board footer

Powered by FluxBB