WSC and FVM

From Casio Universal Wiki
Revision as of 12:38, June 7, 2012 by Helder7 (talk | contribs) (WSC Error reporting)
Jump to: navigation, search

Getting Started

Copy the two files inside the bin folder (WSC.g1a, FVM.g1a) to the calculator. In order to edit the source code on calc, you may need to use the EDITv1.51, of course, you can also edit the source code on the computer, it is plain text.

After the installation is complete, the main menu should be as follows:

Wsc-fvm-installed.jpg

Making a hello world

Open the EDIT, the storage Mem (Warning: Do not use the Main Mem) and create a new document.

Wsc-fvm-hello-c.jpg

Enter the text:

void main( )

{

    printf( “Hello World!\n” );

}

(PS the edit can adjust the font size (shift-set up to enter the setting interface), use the small print on one screen you can see more code, it is recommended to use the small print, set the font size in the optn other Word the wrap is also recommended to choose the offrecommended settings below)

Edit-settings.png

The input is completed as follows:

Wsc-fvm-hello-c-code.jpg

To compile the file, exit, enter the WSC, press the F1 (compile) to compile the source code.

Wsc-fvm-compile-file.jpg

If there are no error, the screen output is done, if there are errors you can return to EDIT to modify. Upon completion any key to exit into the FVM, the F1 (run) the implementation of the bytecode. The screen will output hello world. After the implementation of any key to exit.

Wsc-fvm-hello-f.jpgWsc-fvm-run-hello.jpg

WSC Support the C language features

The operator

+ - * / % += -= *= /= < <= > >= == != && || ! != &

Note that the last '&' is the address instead of a bitwise

Data type

Any number of dimensions in an int a char a float array to point to the basic types of pointer (pointer to the array)

Statement

If the else the while for the return the break

Notes

C style / * ........... * / and C + + style / / ...........

Function call

Support recursive.

WSC Error reporting

Wsc error reporting is not perfect, calculator small screen is not easy to display all error messages.

Wsc will be displayed on the screen when the error is detected, the error message, as shown:

Wsc-error-reporting.jpg

Then press the menu key you can exit to modify the other key to display the next error message.

Note that WSC did not prompt a warning!

Any pointers, arrays, in its eyes are the same, any assignment.

int, a char, float, assignment, will not generate any warning messages.

Some differences in the WSC with the standard C

Does not require the function declaration

As long as the function is defined in the file, regardless of location, can call anywhere.

Only two scopes

The entire procedure only two scope, global scope and function within the local scope.

void main()

{

int a;

{

    int a;

}

}

The example program will receive an error message "Variable 'a' redefinition"

int * a, b;

WSC a and b will be a pointer to int. (It is recommended that written int * a, b; instead of int * a, b;).

int *p; p++;

The actual value of p in the ANSI C plus 4 (sizeof (int)), but WSC will only p plus 1.

char s[50] = “asdfjkl”;

This initialization is not yet supported, sample sentence is wrong.

int a[2][2] = { 1, 2, 3, 4 };

Int a [2] [2] = {1, 2, 3, 4};

This initialization is not yet supported, sample sentence is wrong. Multidimensional array initialization must be properly grouped, such as

int a[2][2] = { {1, 2}, {3, 4} }; grouped correctly less some elements correctly, such as

int a[2][2] = { {1}, {3} };

Notice

int a[10];printf( “%d”, a );

The code writer's intent is to obtain the value of a, but as mentioned above, the WSC seen as a type of all pointers, printf library function is overloaded, and the second parameter is a pointer to a function only printf (char *, char *), so the compiler to do a wrong choice, a look has become a char *.

A correct approach is int a [10]; int t = a; printf ("% d", t);

char ch;scanf( “%c”, &ch );

For some reason, such an approach to problems, it is recommended to use getchar ();

Enter the uppercase letters

Press F6 in the input interface switch case.