|
|
- Written and documented by David Deley
Introduction to CMac Chapter 1: Hello World
Here's my intro to the powerful CMAC language which comes with Multi-Edit. I've recently learned it so I'm
passing the knowledge on.
We'll start with the usual "Hello World" program. In Multi-Edit, type in the following code in a new window
and save it as file "test.s":
Code:
void test()
{
TEXT("Hello World");
}
Now compile this program by either selecting the menu option TOOLS -> EXECUTE COMPILER... or by clicking
on the
toolbar button. The following window should come up (NOTE: If instead you get a window titled "Enter
Compiler/Program Command" it's probably because you haven't saved it as file "test.s" yet. Multi-Edit uses
the filename extention to determine what compiler to use.)
{If you can't see the image above, all images
are stored on our website, the image above is http://www.multieditsoftware.com/images/CMac/compile.gif check if your server is
blocking this site.}
(SPECIAL INSTRUCTION: There's one setting here I suggest changing. It only needs to be
changed once. Select "Compile CMACWIN macro". Then click the "Edit" button. In the "Compiler/Program Setup" window
which comes up, I suggest changing "Reset Original Line Number" from
"Special" to "Current". This way when the CMAC compiler says there's an error on a certain line number it will go to
the correct line where the error is.)
Select "Compile CMACWIN macro" and click "Select". Multi-Edit compiles the code and pops up the Tool Pane window with
the Output information. (If instead you get the error "Exec Error: Program 'C:\....\cmacwin.exe' could not be found."
then see reply to this thread below.)
Note the last line in the Tool Pane window at bottom tells you where the compiled output file TEST.mac went.
You may open or close this Tool Pane window on the bottom either by selecting the menu option VIEW -> TOOL PANE or
by clicking on the button in the lower right corner of the Multi-Edit screen.
Now run the program either by selecting the menu option MACRO -> RUN... or by clicking on the
toolbar button. The following window pops up. Type in "test" and click "OK":
This will run your program. The text "Hello World" will be entered into your window as if you typed it in.
The CMAC language documentation is obtained by going to HELP->Cmac Language
|
|