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