The branch, master has been updated
via 584ba89232083dd274c91bbd8617825861d32acf (commit)
from dd0ee2d09d4959c4d5bb8d9ab7f070d5d8810893 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 584ba89232083dd274c91bbd8617825861d32acf
Author: John Skaller <ska...@users.sourceforge.net>
Date: Wed Oct 6 03:21:02 2010 +1100
More flx.flx
diff --git a/lpsrc/flx_maker.pak b/lpsrc/flx_maker.pak
index d6b01b8..5b91c4c 100644
--- a/lpsrc/flx_maker.pak
+++ b/lpsrc/flx_maker.pak
@@ -2052,113 +2052,162 @@ done
var DEBUGSWITCH="";
DEBUG_COMPILER == 1?? DEBUGSWITCH=" --debug";
-var STATIC_ENV=""
+var STATIC_ENV="";
DEBUG_COMPILER == 1?? STATIC_ENV="env FLX_DEBUG=1 ";
-/* ------
-def filetime(f):
- try:
- t = os.stat(f)[stat.ST_MTIME]
- except EnvironmentError:
- t = 0
- return t
+body """
+long macosx_ftime(string s) {
+ struct stat sb;
+ int e = stat(s.data(),&sb);
+ if(e == 0) return 0l;
+ return sb.st_mtime;
+}
+""" requires header "#include <sys/stat.h>";
+
+body """
+long posix_ftime(string s) {
+ struct stat sb;
+ int e = stat(s.data(),&sb);
+ if(e == 0) return 0l;
+ return sb.st_mtime;
+}
+""" requires header "#include <sys/stat.h>";
-if RECOMPILE == 0 and RUNIT == 1:
+
+fun macosx_ftime: string -> long = "macosx_ftime($1)";
+fun posix_ftime: string -> long = "posix_ftime($1)";
+
+fun filetime(f:string)=>if MACOSX then macosx_ftime(f) else posix_ftime(f) endif;
+
+var cmd = "";
+dbug?? println$ "RECOMPILE="+str RECOMPILE;
+dbug?? println$ "RUNIT="+str RUNIT;
+
+if RECOMPILE == 0 and RUNIT == 1 do
// not (--force or -c)
- if STATIC == 0:
- if (filetime(base+EXT_SHLIB) > filetime (base+".flx")):
- calpackages()
- cmd=FLXRUN+DRIVER+DEBUGSWITCH+" "+ base+EXT_SHLIB+" "+args
- System::exit(system(cmd))
- else:
- if (filetime(base+EXT_EXE) > filetime(base+".flx")):
- cmd=STATIC_ENV+" "+base+" "+args
- System::exit(system(cmd))
+ dbug?? println "Checking to see if the binary is uptodate";
+ if STATIC == 0 do
+ if (filetime(base+EXT_SHLIB) > filetime (base+".flx")) do
+ dbug?? println$ "Running dynamically linked binary";
+ calpackages();
+ cmd=FLXRUN+DRIVER+DEBUGSWITCH+" "+ base+EXT_SHLIB+" "+args;
+ dbug?? println$ "Uptodate shared lib: Running command " + cmd;
+ System::exit(system(cmd));
+ else
+ dbug?? println$ "Dynamically linked binary out of date or non-existant";
+ done
+ else
+ if (filetime(base+EXT_EXE) > filetime(base+".flx")) do
+ dbug?? println$ "Running statically linked binary";
+ cmd=STATIC_ENV+" "+base+" "+args;
+ dbug?? println$ "Uptodate executable: Running command " + cmd;
+ System::exit(system(cmd));
+ else
+ dbug?? println$ "Statically linked binary out of date or non-existant";
+ done
+ done
+done
+/* --------
// Need Felix and c++ compile, then run it
-if DEBUG_COMPILER == 1:
- VERBOSE="-v"
-else:
- VERBOSE="-q"
+var VERBOSE = "";
+if DEBUG_COMPILER == 1 do
+ VERBOSE="-v";
+else
+ VERBOSE="-q";
+done
-if DEBUG:
- CCFLAGS=CCFLAGS+DEBUG_FLAGS
+if DEBUG do
+ CCFLAGS=CCFLAGS+DEBUG_FLAGS;
+done
-FLXFLAGS="--inline="+str(INLINE) + ' ' + str(OUTPUT_DIR)
+var FLXFLAGS="--inline="+str(INLINE) + ' ' + str(OUTPUT_DIR);
-result = 0
+var result = 0;
-if STATIC == 0:
- if FELIX == 1:
+if STATIC == 0 do
+ if FELIX == 1 do
FCMD=' '.Filename::join([
FLXG,
VERBOSE, FLXFLAGS, FLXLIB,
INCLUDE_DIRS, STDIMPORT, IMPORTS,
- STDLIB, base])
- result=system(FCMD)
- if result != 0: exit(0!=result)
- calpackages()
- write_include_file(base)
+ STDLIB, base]);
+ result=system(FCMD);
+ if result != 0 do exit(0!=result); done
+ calpackages();
+ write_include_file(base);
CCMD=' '.Filename::join([
CCOBJ_DLLIB, CCFLAGS, "-DTARGET_BUILD",
INCLUDE_DIR, INCLUDE_DIRS, MACROS,
cpps, base+".cpp",
- SPEC_OBJ_FILENAME+base+EXT_OBJ])
+ SPEC_OBJ_FILENAME+base+EXT_OBJ]);
LCMD=' '.Filename::join([
CCLINK_DLLIB, CCFLAGS,
cppos, base+EXT_OBJ,
SPEC_EXE_FILENAME+base+EXT_SHLIB,
- LINK_STRING])
- result = system(CCMD)
- if result == 0:
- result = system(LCMD)
- if result == 0:
- if RUNIT == 1:
- if TIME == 1:
+ LINK_STRING]);
+ result = system(CCMD);
+ if result == 0 do
+ result = system(LCMD);
+ if result == 0 do
+ if RUNIT == 1 do
+ if TIME == 1 do
cmd=' '.Filename::join([
TIMECMD,
FLXRUN+DRIVER+DEBUGSWITCH,
- base+EXT_SHLIB, args])
- else:
+ base+EXT_SHLIB, args]);
+ else
cmd=' '.Filename::join([
FLXRUN+DRIVER+DEBUGSWITCH,
- base+EXT_SHLIB, args])
- if STDOUT != "": cmd=cmd+" > " +STDOUT
- exit(0!=system(cmd))
-else:
- if FELIX == 1:
+ base+EXT_SHLIB, args]);
+ done
+ if STDOUT != "" do cmd=cmd+" > " +STDOUT; done
+ exit(0!=system(cmd));
+ done
+ done
+ done
+ done
+else
+ if FELIX == 1 do
FCMD=' '.Filename::join([
FLXG, VERBOSE, FLXFLAGS,
FLXLIB, INCLUDE_DIRS, STDIMPORT,
- IMPORTS, STDLIB, base])
- result=system(FCMD)
- if result == 0:
- calpackages()
- write_include_file(base)
+ IMPORTS, STDLIB, base]);
+ result=system(FCMD);
+ done
+ if result == 0 do
+ calpackages();
+ write_include_file(base);
CCMD=' '.Filename::join([
CCOBJ_STATIC_LIB,
CCFLAGS, "-DTARGET_BUILD",
"-DFLX_STATIC_LINK", INCLUDE_DIR, INCLUDE_DIRS,
MACROS, cpps, base+".cpp",
- SPEC_OBJ_FILENAME+base+EXT_OBJ])
+ SPEC_OBJ_FILENAME+base+EXT_OBJ]);
LCMD=' '.Filename::join([
CCLINK_STATIC, SPEC_EXE_FILENAME+base+EXT_EXE,
- base+EXT_OBJ, DRIVER, cppos, LINK_STRING])
- result=system(CCMD)
- if result == 0:
- result=system(LCMD)
- if result == 0:
+ base+EXT_OBJ, DRIVER, cppos, LINK_STRING]);
+ result=system(CCMD);
+ if result == 0 do
+ result=system(LCMD);
+ if result == 0 do
// rm -f "$base.cpp"
- if RUNIT == 1:
- if TIME == 1:
+ if RUNIT == 1 do
+ if TIME == 1 do
cmd=' '.Filename::join([
TIMECMD, STATIC_ENV, base, args])
- else:
+ else
cmd=' '.Filename::join([
STATIC_ENV, base,args])
- if STDOUT != "": cmd=cmd + " > "+STDOUT
- exit(0!=system(cmd))
+ done
+ if STDOUT != "" do cmd=cmd + " > "+STDOUT done
+ exit(0!=system(cmd));
+ done
+ done
+ done
+ done
+done
exit(0!=result)
-------- */
diff --git a/src/lib/std/textio.flx b/src/lib/std/textio.flx
index d42b491..e79bdda 100644
--- a/src/lib/std/textio.flx
+++ b/src/lib/std/textio.flx
@@ -1,20 +1,20 @@
module Text_file
{
requires flx_ioutil;
- fun load: string -> string = "flx::rtl::ioutil::load_file($1)";
- fun load: text_file -> string = "flx::rtl::ioutil::load_file($1)";
+ fun load: string -> string = "::flx::rtl::ioutil::load_file($1)";
+ fun load: text_file -> string = "::flx::rtl::ioutil::load_file($1)";
pod type text_file = "FILE*"; // its a macro?
- gen fopen_input: string -> text_file = 'std::fopen($1.data(),"rt")';
- gen fopen_output: string -> text_file = 'std::fopen($1.data(),"wt")';
- proc fclose: text_file = '(void)std::fclose($1);';
- gen readln: text_file -> string ="flx::rtl::ioutil::readln($1)";
- proc writeln : text_file * string ="flx::rtl::ioutil::writeln($1,$2);";
- proc write : text_file * string ="flx::rtl::ioutil::write($1,$2);";
- proc write : text_file * utiny ="std::fwrite($2,sizeof(unsigned char),1,$1)";
+ gen fopen_input: string -> text_file = '::std::fopen($1.data(),"rt")';
+ gen fopen_output: string -> text_file = '::std::fopen($1.data(),"wt")';
+ proc fclose: text_file = '(void)::std::fclose($1);';
+ gen readln: text_file -> string ="::flx::rtl::ioutil::readln($1)";
+ proc writeln : text_file * string ="::flx::rtl::ioutil::writeln($1,$2);";
+ proc write : text_file * string ="::flx::rtl::ioutil::write($1,$2);";
+ proc write : text_file * utiny ="::std::fwrite($2,sizeof(unsigned char),1,$1)";
gen valid : text_file -> bool = "$1!=(FILE*)0";
- gen feof : text_file -> bool = "std::feof($1)";
+ gen feof : text_file -> bool = "::std::feof($1)";
const stdin: text_file = "PTF flx_stdin";
const stdout: text_file = "PTF flx_stdout";
const stderr: text_file = "PTF flx_stderr";
-----------------------------------------------------------------------
Summary of changes:
lpsrc/flx_maker.pak | 177 ++++++++++++++++++++++++++++++-----------------
src/lib/std/textio.flx | 20 +++---
2 files changed, 123 insertions(+), 74 deletions(-)
hooks/post-receive
--
An advanced programming language