## How do I convert my S-Lang scripts?

The CIAO 4.3 release of ChIPS removed support for S-Lang in ChIPS. The Conversion Guides section of the ChIPS web site includes general advice on updating ChIPS scripts between versions of CIAO. If you need help converting any existing scripts to Python, please contact the CXC Helpdesk. Relevant data files may be placed on the FTP site (FTP Instructions).

For simple scripts it can be as easy as the following steps:

1. remove the trailing ; character;

2. for routines called no arguments, S-Lang allows you to ignore the trailing () but these are required for Python (examples include info and clear);

3. change lists from "{...}" to "[...]";

4. boolean arguments in S-Lang were represented using 0 or 1 whereas you can now use the Python boolean values False or True;

5. change strings like "\delta = 23"R to r"\delta = 23" (the trailing R character becomes a leading r to avoid having to write \\ instead of \);

6. remove the variable term (i.e. no need to declare variable names);

7. the print routine can be used instead of message and vmessage (string formatting or interpolation can be done using the format method or the deprecated % operator);

8. use

from pychips import *
from pychips.hlui import *
from pycrates import *


rather than

require("chips");
require("chips_hlui");
require("crates");


An example of a simple conversion is given below:

S-Lang Python
#!/usr/bin/env slsh #!/usr/bin/env python
require("chips"); from pychips import *
require("chips_hlui"); from pychips.hlui import *
set_preference("window.display", "false"); set_preference("window.display", "false")