view main.c @ 2:d561f123f9a6

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