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
colleagues:
i currently have been able to have one vm launch another. here is the launching .pkg:
//launcher code
typeof ScolServer = Srv;;
typeof ScolServerPort = I;;
typeof win = ObjWin;;
typeof winchild = ObjWin;;
typeof font = ObjFont;;
typeof iTotalStep = I;;
typeof szCurrentStep = S;;
typeof iCurrentStep = I;;
var iCurrentStep = 0;;
typeof ChannelToPlayer = Chn;;
var bgColor = 0xdddddd;;
var foColor = 0;;
fun launchmediaoctopus3dPlayer(ScolServerPort)=
let "Mediaoctopusplayer3d" -> vmName in
// i want to call main "" "" "" "" 0 in tools/mediaoctopus3dplayer/mediaoctopusload.pkg
let _fooS strcatn " _load \"tools/mediaoctopus3dplayer/mediaoctopusload.pkg\" \nmain \"\" \"\" \"\" \"\" 0 "::(itoa ScolServerPort) :: nil -> vmScript in
_fooId _newmachine vmName vmScript nil nil;
0;;
fun main ()=
_showconsole;
_fooS "Launching Launcher !";
set ScolServerPort = 3500;
while ((set ScolServer = _setserver _envchannel _channel ScolServerPort nil)==nil) do
set ScolServerPort = ScolServerPort+1;
_fooS strcat "in launcher, Port number : " itoa ScolServerPort;
_fooS "Started server, going to launch octopus";
launchmediaoctopus3dPlayer ScolServerPort;
0;;
/* The receiver functions */
fun __fromPlayer (string_from_player)=
_fooS strcat "string from player is!!!!:::" string_from_player;
0;;
the log for the scol file launching this vm (with launcher.pkg) states:
in launcher, Port number : 3500
the launcher.pkg calls the main method of the mediaoctopusload.pkg, starting it up(along with the gui, everything starts up as expected, so far at least), however this second vm is opened on another port number:
fun main(file, projname, pw ,ph, fullscreen, portnumber) =
_showconsole;
_fooS strcat "in player, port number is : " (itoa portnumber);
the log file for mediaoctopusload.pkg shows:
> exec: main "" "" "" "" 0 3500
in player, port number is : 13568
so even though 3500 is passed to main in mediaoctopusload.pkg , mediaoctopusload.pkg reports that it is 13568...
hmmph
any input welcome
thx!!
-h
Last edited by hebdemnobad (19-Dec-2014 21:35:05)
Offline
Iri, in your eyecandy example, the port number established by eyecandy.pkg and that received as the szPortNumber in main(szPortNumber) are the same, whereas in my code, they are different, but I don't know why. (it's probably something very simple).
Offline
ok i see now, the port number must be passed from the vm1 to vm2 as a string, and in addition, it has to be surrounded by quotes as in your eyecandy.pkg example iri...i missed that formatting error. all those escape \" sequences can get confusing.
i changed the launcher script a bit (using a recursive function instead of a do while loop for some reason i find it easier to read), it works now. communication goes from the player (vm2) to the eyecandy (vm1)..i will try communication from vm1 to vm2 when i next have time. then i will be cooking with gas, as we say in the U.S.
launcher.pkg:
//launcher code
typeof ScolServer = Srv;;
typeof ScolServerPort = I;;
typeof win = ObjWin;;
typeof winchild = ObjWin;;
typeof font = ObjFont;;
typeof iTotalStep = I;;
typeof szCurrentStep = S;;
typeof iCurrentStep = I;;
var iCurrentStep = 0;;
typeof ChannelToPlayer = Chn;;
var bgColor = 0xdddddd;;
var foColor = 0;;
fun launchmediaoctopus3dPlayer(ScolServerPort)=
let "Mediaoctopusplayer3d" -> vmName in
// i want to call main "" "" "" "" 0 in tools/mediaoctopus3dplayer/mediaoctopusload.pkg
let (itoa ScolServerPort) -> serverport_string in
let _fooS strcatn " _load \"tools/mediaoctopus3dplayer/mediaoctopusload.pkg\" \nmain \"\" \"\" \"\" \"\" 0 "::"\"":: serverport_string:: "\"" :: nil -> vmScript in
_fooId _newmachine vmName vmScript nil nil;
0;;
fun connect_to_player(port)=
let _setserver _envchannel _channel port nil -> result in
if (result== nil) then
(
connect_to_player ScolServerPort;
_fooS strcat "failed to connedct to proper port, scolserver port =: " (itoa ScolServerPort);
set ScolServerPort = ScolServerPort+1;
0;
)
else
(
_fooS "Started server, going to launch octopus";
launchmediaoctopus3dPlayer ScolServerPort;
0;
);
0;;
fun main ()=
_showconsole;
_fooS "Launching Launcher !";
set ScolServerPort = 3500;
connect_to_player ScolServerPort;
0;;
/* The receiver functions */
fun __fromPlayer (string_from_player)=
_fooS strcat "string from player is!!!!:::" string_from_player;
0;;
Offline
It's ok.
> exec: main "" "" "" "" 0 3500 in player, port number is : 13568
However, i don't understand your 3500 as in integer gives a 13568 in the player ? I see no error in your code.
Offline
something strange must happen in formatting the script string
Offline
Well, in _newmachine, a decimal integer is converted in hexadecimal integer. See the source code (scolSystem.cpp and baselib.cpp). So, in the new VM, the value is in hexa, not in decimal.
This behavior is only with this function.
Thus, 3500 (16) => 13568 (10)
Offline
You can provide a hexadecimal, instead of a decimal, or convert the value in new VM in decimal. Or, as you did, set a string argument.
A much belated thanks for your clarification.
Offline
Pages: 1