| rev |
line source |
|
seanhalle@0
|
1 /*
|
|
seanhalle@0
|
2 * Copyright 2012 OpenSourceResearchInstitute.org
|
|
seanhalle@0
|
3 * Licensed under GNU General Public License version 2
|
|
seanhalle@0
|
4 *
|
|
seanhalle@0
|
5 * author seanhalle@yahoo.com
|
|
seanhalle@0
|
6 */
|
|
seanhalle@0
|
7
|
|
seanhalle@0
|
8 #include <malloc.h>
|
|
seanhalle@0
|
9 #include <stdlib.h>
|
|
seanhalle@0
|
10
|
|
seanhalle@0
|
11 #include "VReo__Test_App/VReo__Test_App.h"
|
|
seanhalle@0
|
12
|
|
seanhalle@0
|
13 #define NO_INPUT_OR_OUTPUT NULL
|
|
seanhalle@0
|
14
|
|
seanhalle@0
|
15 /*This demonstrates the use of the proto-runtime system. It allows multiple
|
|
seanhalle@0
|
16 * languages to be mixed within a single sub-program. It also allows multiple
|
|
seanhalle@0
|
17 * sub-programs to be started, where each uses its own set of languages. The
|
|
seanhalle@0
|
18 * running sub-programs can then communicate with each other.
|
|
seanhalle@0
|
19 *
|
|
seanhalle@0
|
20 */
|
|
seanhalle@0
|
21 int main( int argc, char **argv )
|
|
seanhalle@0
|
22 { PRProcess *testProcess1, *testProcess2;
|
|
seanhalle@0
|
23
|
|
seanhalle@0
|
24 DEBUG__printf2(TRUE, "arguments: %s | %s", argv[0], argv[1] );
|
|
seanhalle@0
|
25
|
|
seanhalle@0
|
26 //A proto-runtime based language sits on top of the proto-runtime. So,
|
|
seanhalle@0
|
27 // first start the proto-runtime system, then create processes (which
|
|
seanhalle@0
|
28 // start languages inside themselves)
|
|
seanhalle@0
|
29 PR__start();
|
|
seanhalle@0
|
30
|
|
seanhalle@0
|
31 //This info shows up in the header of output files holding measurements
|
|
seanhalle@0
|
32 //These calls MUST be made after PR__start and before creating a process
|
|
seanhalle@0
|
33 PR__set_app_info("Test for developing VReo");
|
|
seanhalle@0
|
34 PR__set_input_info("no input");
|
|
seanhalle@0
|
35
|
|
seanhalle@0
|
36
|
|
seanhalle@0
|
37 //Now that PR is started, create processes.
|
|
seanhalle@0
|
38 //Each process creates a seedVP and starts it running -- that then starts
|
|
seanhalle@0
|
39 // the languages used inside the process..
|
|
seanhalle@0
|
40 //To get results from a process, it gets complicated.. simple soln is
|
|
seanhalle@0
|
41 // just use PR's malloc and free, in the main thread, between PR__start
|
|
seanhalle@0
|
42 // and PR__shutdown
|
|
seanhalle@0
|
43 //The call returns a process struct
|
|
seanhalle@0
|
44 //int32 *result = PR__malloc( 2 * sizeof(int32) );
|
|
seanhalle@0
|
45 testProcess1 = PR__create_process( &test_app_seed_Fn, NO_INPUT_OR_OUTPUT );
|
|
seanhalle@0
|
46
|
|
seanhalle@0
|
47 PR__wait_for_process_to_end( testProcess1 );
|
|
seanhalle@0
|
48 printf("done \n\n" );
|
|
seanhalle@0
|
49
|
|
seanhalle@0
|
50 //PR__free(result);
|
|
seanhalle@0
|
51
|
|
seanhalle@0
|
52 PR__wait_for_all_activity_to_end(); //equivalent of detecting shutdown
|
|
seanhalle@0
|
53 PR__shutdown();
|
|
seanhalle@0
|
54
|
|
seanhalle@0
|
55 exit(0); //cleans up
|
|
seanhalle@0
|
56 }
|