Sigh. Well note: dummy = anyone still using C/C++ ... :))
Haha. Here we go with the idea. Boilerplate:
/////////////////////////////////////////////////////////
#import <flx.flxh>
body "#define main PROXY_MAIN";
proc main: int * &(charp) = "exit(main($1,$2));";
main(System::argc, System::_argv);
body cr"""
// USER PUTS PROGRAM HERE
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("Hello World argc=%d, argv[1]=%s\n",argc,
argc>1?argv[1]:"None");
return 42;
}
// AND ENDING HERE
""";
/////////////////////////////////////////////////
Now the C/C++ programmer can run:
flx myprog argument
at they're running C/C++ code as script .. i.e. no messing
around with gcc switches etc.
The PROXY_MAIN is needed for static linkage, so there aren't
two 'main' functions.
The 'cr' on the string is:
c -- do not do any magic substitutions
-- required so ? will work (otherwise you need ??
because ?1 means generic type 1)
r -- do not do any escapes
-- required so \n will generate \n instead of newline
This should allow fully literal placement of any C/C++ code.
The boilerplate above could be made more transparent, but
the above works right now, so we'll keep it until we have
a more general system.
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language