Guide for developing C/C++ interpreter Ch script with Magic C++ 3.0
Last update 06/14/2005
Ch is an embeddable C/C++ interpreter for cross-platform scripting, shell programming, 2D/3D plotting, numerical computing, and embedded scripting. C/Ch/C++ allow users to use one language, anywhere and everywhere, for any programming tasks. Please visit the website of SoftIntegration Inc for more information.
http://www.softintegration.com
Magic C++ 3.0 has suppoorted for developing C/C++ interpreter Ch script. Here is the guide for finishing this task.
(1) Install and configure Magic C++ and create a empty project
You must install and configure Magic C++ before developing C/C++ interpreter Ch script. Please refer
Magic C++ step by step tutorial How to write your first "Hello World"
and create a empty project instead of "Hello World" project, you needn't compile and debug the project because Ch is a kind of C/C++ interpreter script.
(2) Create a "Hello World" Ch script
Choose File->New to create a Ch script and name it as hello.ch

Copy and paste these sample codes to hello.ch
/*********************************/
#!/bin/ch
/* with the above line,
this program can run in Ch or other shells.
Otherwise, the program only runs in Ch */
#include <stdio.h>
int main( int argc, char** argv ) {
int i=0;
printf("Hello, world\n");
for( i=0; i<argc; i++ )
printf( "%s\n", argv[i] );
return 0;
}
/*********************************/
Choose File->Save Workspace to save changes.
(5) Execute "Hello World" Ch script
You needn't compile and debug the project because Ch is a kind of C/C++ interpreter script.
Choose Project->Project Setup... and input the Ch script name and execute parameters there before executing

***Notice***
If the Ch script suffix is not *.ch, you must specify ch.exe as the executable filename and specify the Ch script as the first parameter which followed by optional execute parameters.

Choose Compile->Execute to execute Ch script
Back to top
|