--------------------------------------------------
How access environment variables from CorbaScript?
--------------------------------------------------

To access environment variables, you could do the following:

>>> import posix
>>> v = posix.getenv("YourEnvironmentVariable")

----------------------------------------------------------------
How access command-line arguments from a non interactive script?
----------------------------------------------------------------

To access command-line arguments, the `sys.arg' symbol refers to
an array containing command-line arguments, e.g.

  # File 'MyScript.cs'
  println(sys.arg)
  for a in sys.arg {
    println(a)
  }

  unix> cssh <ORB options> MyScript.cs Arg1 Arg2 Arg3
  ["MyScript.cs", "Arg1", "Arg2", "Arg3"]
  MyScript.cs
  Arg1
  Arg2
  Arg3

---------------------------------------------------------
How to set the port of CorbaScript servers and the object
key of CORBA objects implemented with CorbaScript?
---------------------------------------------------------

When you want to run CorbaScript servers on a specific port
(of localhost, of course), you must use the specific ORB
command line option for setting this port. See the associated
ORB documentation around parameters of the CORBA::ORB_init()
operation.

When you want to create IORs with a specific object key,
you must use the 3th argument of the CORBA.ORB.connect
operation provided by CorbaScript.

Let's take the basic following OMG IDL interface:

interface Hello {
  void display(in string msg);
};

Here is from an ORBacus server side:

unix> uname -n
host.company.com
unix> cssh -OAport 7000 
      # This ORBacus command line option sets the TCP/IP port used.

>>> class HELLO {
      proc __HELLO__(self) {}
      proc display(self, msg) { println("HELLO::display(", msg, ")") }
    }
>>> h = HELLO()
>>> # the 3th argument sets the object key.
>>> CORBA.ORB.connect(h, Hello, "HelloKey")
>>>

Here is from any client side:

prompt> cssh
>>> # here is the old standard INS URL notation.
>>> h = Hello("iioploc://host.company.com:7000/HelloKey") 
>>> # here is the recent standard INS URL notation.
>>> h = Hello("corbaloc::host.company.com:7000/HelloKey") 

On other ORB, the ORBacus -OAport option must be changed to the
appropriate ORB option. See the related ORB documentation.

----------------------------------------------------
How can CorbaScript be embedded into my C++ program?
----------------------------------------------------

Currently, the CorbaScript code is not designed to be embedded
and directly used from a C++ program. This is due to a lack of
time, funds and manpower to redesign the CorbaScript engine ;-(

However, the demo/remote_cssh directory contains a general scripting
engine API defined in OMG IDL and a server implementation written
in CorbaScript.

Then to use a CorbaScript engine from your C++ or Java program, you must:
* generate Java or C++ stubs from the scripting.idl file,
* start the demo/remote_cssh/server.cs script,
* obtain the IOR of this server from your application, and
* invoke stubs operations from your application.
Note that this is the standard way to access a CORBA server from
a CORBA client. Moreover this process works with any programming language
and any ORB product.

Of course, this is less efficient than directly embed the CorbaScript
code into a C++ program: here communications between the C++ program
and the CorbaScript engine are done by IIOP. However this solution
provides a great advantage: the CorbaScript engine and your program
can run on different machines and your program can simultaneously
access to several remote CorbaScript engines. Then you could use this
to implement remote administration, mobile agents, and so on.
Finally the solution proposed here is a clean, portable and useful
CORBA solution to deal this problem.

--------------------------------
How can I exit from CorbaScript?
--------------------------------

To exit from a CorbaScript engine, you could interactively type:
* CTRL-D on Unix systems
* CTRL-Z on Windows systems

In a script, the CORBA.ORB.shutdown operation stops the CORBA.ORB.run
operation call.

------------------------------
How convert strings to values?
------------------------------

Convert a string to a long value:
>>> l = long._fromString("1415")
>>> l
1415

Comments:
- reads from the start of the string up to the first non-digit character
- skips any whitespace before the first digit character
- only handles strings that represent decimal numbers
  [ so x=027 -> x set to 23,  but x=long._fromString("027") -> x set to 27 ]
- returns a -ve value for strings representing numbers between 2**31 & 2**32-1
  [ just found this one :) ]
- raises an Overflow exception if the string is not "numeric".

Convert a string to a double value:
>>> d = double._fromString("3.1415")
>>> d
3.1415

Currently other conversions can be done
by evaluating the string.

Convert a string to an array value:
>>> a = eval("[1,2,3,4,5]")
>>> a
[1, 2, 3, 4, 5]

Convert a string to an OMG IDL value:
>>> v = eval("CORBA.Long(10)")
>>> v
CORBA::Long(10)

