Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > VReo > VReo__Prod_Cons__LangDev
diff main.c @ 0:5b757d5a7044
Initial add -- fully working
| author | Sean Halle <seanhalle@yahoo.com> |
|---|---|
| date | Wed, 12 Jun 2013 15:13:34 -0700 |
| parents | |
| children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/main.c Wed Jun 12 15:13:34 2013 -0700 1.3 @@ -0,0 +1,56 @@ 1.4 +/* 1.5 + * Copyright 2012 OpenSourceResearchInstitute.org 1.6 + * Licensed under GNU General Public License version 2 1.7 + * 1.8 + * author seanhalle@yahoo.com 1.9 + */ 1.10 + 1.11 +#include <malloc.h> 1.12 +#include <stdlib.h> 1.13 + 1.14 +#include "VReo__Test_App/VReo__Test_App.h" 1.15 + 1.16 +#define NO_INPUT_OR_OUTPUT NULL 1.17 + 1.18 +/*This demonstrates the use of the proto-runtime system. It allows multiple 1.19 + * languages to be mixed within a single sub-program. It also allows multiple 1.20 + * sub-programs to be started, where each uses its own set of languages. The 1.21 + * running sub-programs can then communicate with each other. 1.22 + * 1.23 + */ 1.24 +int main( int argc, char **argv ) 1.25 + { PRProcess *testProcess1, *testProcess2; 1.26 + 1.27 + DEBUG__printf2(TRUE, "arguments: %s | %s", argv[0], argv[1] ); 1.28 + 1.29 + //A proto-runtime based language sits on top of the proto-runtime. So, 1.30 + // first start the proto-runtime system, then create processes (which 1.31 + // start languages inside themselves) 1.32 + PR__start(); 1.33 + 1.34 + //This info shows up in the header of output files holding measurements 1.35 + //These calls MUST be made after PR__start and before creating a process 1.36 + PR__set_app_info("Test for developing VReo"); 1.37 + PR__set_input_info("no input"); 1.38 + 1.39 + 1.40 + //Now that PR is started, create processes. 1.41 + //Each process creates a seedVP and starts it running -- that then starts 1.42 + // the languages used inside the process.. 1.43 + //To get results from a process, it gets complicated.. simple soln is 1.44 + // just use PR's malloc and free, in the main thread, between PR__start 1.45 + // and PR__shutdown 1.46 + //The call returns a process struct 1.47 + //int32 *result = PR__malloc( 2 * sizeof(int32) ); 1.48 + testProcess1 = PR__create_process( &test_app_seed_Fn, NO_INPUT_OR_OUTPUT ); 1.49 + 1.50 + PR__wait_for_process_to_end( testProcess1 ); 1.51 + printf("done \n\n" ); 1.52 + 1.53 + //PR__free(result); 1.54 + 1.55 + PR__wait_for_all_activity_to_end(); //equivalent of detecting shutdown 1.56 + PR__shutdown(); 1.57 + 1.58 + exit(0); //cleans up 1.59 + }
