Elmo HARmonica ユーザーズマニュアル
Elmo HARmonica Software Manual
P R E L I M I N A R Y D R A F T
HARSFEN0602
216
18 Appendix C: Converting Clarinet/Saxophone programs to
the Harmonica language
18.1
The Converter
The user program syntax for the Saxophone or Clarinet is different from the Harmonica’s syntax. The
converter program provides an easy method to convert Saxophone/Clarinet style programs to the Harmonica
syntax.
The converter program requires that the source Sax/Cla program is a simple text file.
If the Sax/Cla has been produced by the Composer program in .pgm (actually reach edit) format, be
sure to convert it first to text.
converter program provides an easy method to convert Saxophone/Clarinet style programs to the Harmonica
syntax.
The converter program requires that the source Sax/Cla program is a simple text file.
If the Sax/Cla has been produced by the Composer program in .pgm (actually reach edit) format, be
sure to convert it first to text.
18.2
The Converter Call
The converter is a console application. It gets their arguments from the command line. The arguments are the
following:
1. The first argument is the name of the input file with a user program. The default is the file named
“OldFormat.txt” from the current directory. If such file does not exist, the program exits doing nothing.
2. The second argument is the name of the output file that contains new text of the user program. The default
is the file named “NewFormat.txt” in the current directory.
This file will be created (if it does not exist) or updated (if it exists) only if the conversion is successful.
3. The third argument is the name of the output file that contains errors of compilation. The default is the file
named “Errs.txt” in the current directory.
This file will be created (if it does not exist) or updated (if it exists) only if the conversion or compilation is
failed.
4. The fourth argument is SaveOldTextflag. A user may desire to save an old program text inside comment
block for comparison with the text after conversion. The default is 0, i.e. an old text is not saved. If this
command line argument is ‘1’ – the format before conversion is saved inside C-style comment block (/* …
*/).
following:
1. The first argument is the name of the input file with a user program. The default is the file named
“OldFormat.txt” from the current directory. If such file does not exist, the program exits doing nothing.
2. The second argument is the name of the output file that contains new text of the user program. The default
is the file named “NewFormat.txt” in the current directory.
This file will be created (if it does not exist) or updated (if it exists) only if the conversion is successful.
3. The third argument is the name of the output file that contains errors of compilation. The default is the file
named “Errs.txt” in the current directory.
This file will be created (if it does not exist) or updated (if it exists) only if the conversion or compilation is
failed.
4. The fourth argument is SaveOldTextflag. A user may desire to save an old program text inside comment
block for comparison with the text after conversion. The default is 0, i.e. an old text is not saved. If this
command line argument is ‘1’ – the format before conversion is saved inside C-style comment block (/* …
*/).
Example:
ConvSyn MySax.prg NewHar.txt 1
Converts the old program MySax.prg to the new program NewHar.txt, preserving the old
Sax-style code, commented.
18.3 The
Algorithm
The converter program does the following:
1. Load program text input file.
2. Try to compile old format text in order to verify that initial text is valid according to the
2. Try to compile old format text in order to verify that initial text is valid according to the
Saxophone/Clarinet syntax. If the compilation failed - it writes error to the error output file and exits.
3. If SaveOldTextflag (the fourth command line argument) is ‘1’, save it inside comment block as it is.
4. Convert to the new format.
5. Writes new program text to the output file.
4. Convert to the new format.
5. Writes new program text to the output file.
18.4
The Conversion Process
Most the program flows instructions of the Sax/Cla need to be converted for an Harmonica application.
The table below presents a list of the changes with the brief explanation.
N Description
The table below presents a list of the changes with the brief explanation.
N Description
Saxophone/Clarinet Harmonica
1 AF
command
The keyword ‘until’ is used instead the
AF,cond until
cond