
A7.3 G2Ox 157
A7.2.14 String manipulation
Gauss allows storing of strings in a ma-
trix, and provides special operators to
manipulate matrices which consists of
strings.
A string is an inbuilt data type in Ox and
arrays of strings can be created. It is pos-
sible to store a string which is 8 charac-
ters or shorter in a matrix or double as
e.g. d = double("aap"), and extract
the string as string(d)
A7.2.15 Input and Output
Gauss .fmt files are different between
the MS-DOS/Windows versions (little
endian) and the Unix versions (big en-
dian).
Ox can read and write .fmt files, and
read .dht/.dat files. These are always
written/read in little-endian mode (the
Windows/MS-DOS way of storing dou-
bles on disk; Unix systems use big-endian
mode). So a .fmt file can be written on a
PC, transferred (binary mode!) to a Sun,
and read there. Ox can also read Excel
files, see under loadmat.
A7.3 G2Ox
G2Ox is a program that translates Gauss code into Ox. It is fairly rudimentary, and can
certainly not be relied upon to translate all Gauss programs correctly. But it is a useful
starting point. The command line syntax is.
g2ox Gaussfilename[.prg] Oxfilename[.ox]
Assuming that a program test.prg needs be translated to test.ox, type:
g2ox test test
This will produce three files:
test.ox – the produced source code;
test.h – the corresponding header file;
test.log – the translation log.
G2Ox uses the input file g2ox.cvt to find out which functions are supported, which
functions need renaming and which are not supported. When running test.ox,thefile
g2ox.ox is automatically included. This file provides the translation layer for many
functions (note that a lot of functions do not yet have a translation), and sets array
indexing to start at one. Array indexing from one, and the fact that many functions are
wrapped in a thin layer means that there is a speed penalty.
G2Ox does not support the following constructs: dataloop, gosub, keyword.
Komentarze do niniejszej Instrukcji