home *** CD-ROM | disk | FTP | other *** search
- // rinkdemo - first segment
- // (c) Ben Summers 1995
-
- #include <stdio.h>
- #include <stdlib.h>
-
- // this next function definition would be in a header file in a real program
-
- int FunctionInParentProgram(int Number);
-
- // a defintion of a number in the parent. It would be defined in a header
- // file. Obviously, direct access of data is not to be encouraged, but
- // it is possible.
-
- extern int NumberInParent;
-
-
- // some static data for this segment
-
- int TheNumber;
-
-
-
- int Start(char *String, int Number)
- {
- printf("Start in segment 1, string = %s, number = %d\n\n", String, Number);
-
- TheNumber = Number;
-
- return TheNumber * 2;
- }
-
- void Do(void)
- {
- printf("Segment1 Do: number given at start = %d\n\n", TheNumber);
-
- // call a function in the main program
- printf("... and it returned %d\n\n", FunctionInParentProgram(189));
- }
-
- int Finish(int Number)
- {
- return 0;
- }
-
- void NamedEntry1(void)
- {
- printf("Doubling number in parent\n");
- NumberInParent*=2;
- }
-
- void NamedEntry2(void)
- {
- printf("NumberInParent = %d\n\n", NumberInParent);
- }
-
-