The branch, master has been updated
via f7b6c2bc40d70920bba87539a5e068be995d34b6 (commit)
via 9c417e009c004a24f4709874fffe76b454b06bb0 (commit)
via ace430cfa9a6260375550e4cc23274173266de52 (commit)
via 997860f361af8d15362ca6bb2fc68736dcc41316 (commit)
via 1db6b034cbd260191845098648fdb65d597167f3 (commit)
via 5f8a60e0040585d9812c2824f4854eb6dbf91647 (commit)
via 0afe2ccec025ee6b3411767c6b003cf5ec1c7617 (commit)
via 2960d0fcaa8810ebbdb48fd4975ab26e0ceb0e21 (commit)
via 2dc112fbe00f65851115609be12549335a60cff5 (commit)
via 721748e6fd188340e07207082445b461ef856440 (commit)
via ddf70a63ee273efa59c2a3f9b6bc3bec9a83cc6a (commit)
via 2b7679f462a2f271271b84688a964537115a806e (commit)
via 753016f13e52956ea3f34e6c391c290bdf694cf5 (commit)
via 4e78d45f996adcc1083a2516c10c8df7bd4add54 (commit)
from fc4f483d20272dbf308e40cb352558b82fc2ca0c (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 f7b6c2bc40d70920bba87539a5e068be995d34b6
Author: Erick Tryzelaar <idad...@users.sourceforge.net>
Date: Thu Oct 21 07:53:06 2010 -0700
Migrate to latest fbuild.
diff --git a/buildsystem/iscr.py b/buildsystem/iscr.py
index b0fff82..4c22a07 100644
--- a/buildsystem/iscr.py
+++ b/buildsystem/iscr.py
@@ -69,7 +69,7 @@ class Iscr(fbuild.db.PersistentObject):
if m:
dsts.append(Path(m.group(1)))
- fbuild.db.add_external_dependencies_to_call(self.ctx, srcs=srcs)
+ self.ctx.db.add_external_dependencies_to_call(srcs=srcs)
return dsts
diff --git a/buildsystem/speed.py b/buildsystem/speed.py
index 1278e0b..4b4aff6 100644
--- a/buildsystem/speed.py
+++ b/buildsystem/speed.py
@@ -149,7 +149,7 @@ def run_test(ctx, path, dst, srcs:fbuild.db.SRCS, expect:fbuild.db.OPTIONAL_SRC,
# If we failed to compile, just move on
return None, None
- fbuild.db.add_external_dependencies_to_call(ctx, dsts=[exe])
+ ctx.db.add_external_dependencies_to_call(dsts=[exe])
# Run the executable and measure the wall clock time
ctx.logger.check('running ' + exe)
diff --git a/fbuild b/fbuild
index 3fa955e..1f75235 160000
--- a/fbuild
+++ b/fbuild
@@ -1 +1 @@
-Subproject commit 3fa955e5d8a238125d170923fbbe1c188ad1150a
+Subproject commit 1f752353d445f0cd251a5e5191014e55306ee216
commit 9c417e009c004a24f4709874fffe76b454b06bb0
Merge: fc4f483 ace430c
Author: Erick Tryzelaar <idad...@users.sourceforge.net>
Date: Thu Oct 21 07:36:12 2010 -0700
Merge branch 'master' of github.com:erickt/felix
commit ace430cfa9a6260375550e4cc23274173266de52
Author: skaller <Max.S...@gmail.com>
Date: Thu Oct 21 01:55:57 2010 +1100
Add syntax colouring for C/C++ files, and hyperlinking
of #include files. As yet you can't jump from a felix
header '#include "file.hpp"';
to C++.
diff --git a/tools/webserver.flx b/tools/webserver.flx
index 5e4e1bc..4b39015 100644
--- a/tools/webserver.flx
+++ b/tools/webserver.flx
@@ -206,11 +206,238 @@ span.big_keyword {color:#FF1010; }
span.small_keyword {color:#802040; }
span.qualifier {color:#A02020; }
span.hack {color:#00FF00; }
+span.preproc {color:#00FF00; }
</style>
</head>
<body>
""";
+fun inarray[N](s:string, a:array[string,N])=>
+ mem (fun (x:string) => s == x) a
+;
+
+// C++ and C
+val cpp_big_keywords =
+ "class",
+ "struct",
+ "union",
+ "namespace",
+ "typedef",
+ "enum"
+;
+
+val cpp_small_keywords =
+ "if", "while", "until","do","for","return","goto","std"
+;
+
+val cpp_qualifiers =
+ "virtual", "inline", "static",
+ "int","long","unsigned","float","double","char","short","signed","void","size_t",
+ "const","volatile"
+;
+
+val cpp_preproc =
+ "define","if","endif","else","include","ifdef","ifndef"
+;
+
+proc write_cpp(k:socket_t, t:string, eof_flag: &bool)
+{
+ proc write_string(k:socket_t, t:string)
+ {
+ if not *eof_flag do Flx_stream::write_string(k,t,eof_flag);
+ else goto giveup;
+ done
+ }
+
+ union state_t =
+ | sot // start of token
+ | id // processing identifier
+ | num // in a number
+ | sq // processing single quote string
+ | dq // processing double quote string
+ | ccomment // a C style comment
+ | cppcomment // a C++ style comment
+ ;
+ fun str(s:state_t) => match s with
+ | sot => "sot"
+ | id => "id"
+ | num => "num"
+ | sq => "sq"
+ | dq => "dq"
+ | ccomment=> "ccomment"
+ | cppcomment => "cppcomment"
+ endmatch;
+
+ var i = 0; var s:state_t;
+ var ch = t.[i];
+ proc next() { ch = t.[i]; ++i; }
+ fun ahead (j:int)=> t.[i+j-1];
+
+ var b = "";
+ var last_id = "";
+ var last_op = "";
+ proc cp() { b += ch; }
+ proc ws() {
+ if last_id == "include" do // hackery
+ var n = b;
+ whilst n.[0] == char "'" or n.[0] == char '"' do n = n.[1 to]; done
+ whilst n.[-1] == char "'" or n.[-1] == char '"' do n = n.[to -1]; done
+ write_string(k,'<a href="/rtl/'+n+'" >' + b + '</a>') ;
+ else
+ write_string(k,'<span class=fstring>'+b+"</span>");
+ done
+ }
+ proc w() {
+ //println$ "Token["+str s+"]="+b;
+ match s with
+ | dq => { ws; }
+ | sq => { ws; }
+ | ccomment=> { write_string(k,'<span class=comment>'+b+"</span>"); }
+ | cppcomment=> { write_string(k,'<span class=comment>'+b+"</span>"); }
+ | id =>
+ {
+ last_id = b;
+ if inarray(b,cpp_big_keywords) do write_string(k,'<span class=big_keyword>'+b+"</span>");
+ elif inarray(b,cpp_small_keywords) do write_string(k,'<span class=small_keyword>'+b+"</span>");
+ elif inarray(b,cpp_qualifiers) do write_string(k,'<span class=qualifier>'+b+"</span>");
+ elif last_op == "#" and inarray(b,cpp_preproc) do write_string(k,'<span class=preproc>'+b+"</span>"); last_op="";
+ else write_string(k,b); done
+ }
+ | _ =>
+ {
+ last_op=b;
+ if b == "<" do b = "<";
+ elif b == ">" do b = ">";
+ elif b == "&" do b = "&";
+ done;
+ write_string(k,b);
+ }
+ endmatch;
+ b = "";
+ }
+
+
+ goto nextt;
+
+contin:> // copy char and continue
+ cp();
+ goto nextch;
+
+overrun:> // one past last char of token
+ w();
+ s = sot;
+ goto thisch;
+
+lastch:> // last char of token
+ cp();
+ w();
+
+nextt:> // new token on next char
+ s = sot;
+
+nextch:> // next char
+ next();
+
+thisch:> // same char, reconsider it
+ //println$ "Considering char " + str(ord(ch));
+ if isnull ch goto fin; // out of data
+ match s with
+ | sot =>
+ {
+ if isidstart ch do s = id; goto contin;
+ elif isdigit ch do s = num; goto contin;
+ elif issq ch do s = sq; goto contin;
+ elif isdq ch do s = dq; goto contin;
+ elif ch == char "/" do
+ if ahead(1) == char "/" do cp; next; s = cppcomment; goto contin
+ elif ahead(1) == char "*" do cp; next; s = ccomment; goto contin
+ else goto lastch
+ done
+ else cp; w; goto nextt;
+ done
+ }
+
+ | id =>
+ {
+ if isalphanum ch do goto contin;
+ else goto overrun;
+ done
+ }
+ | num =>
+ {
+ if isnumeric ch do goto contin;
+ else goto overrun;
+ done
+ }
+ // single quoted strings
+ | sq =>
+ {
+ if issq ch do goto lastch;
+ elif ch== char "<" do b+="<"; goto nextch;
+ elif ch== char ">" do b+=">"; goto nextch;
+ elif ch== char "&" do b+="&"; goto nextch;
+ else goto contin;
+ done
+ }
+ | dq =>
+ {
+ if isdq ch do goto lastch;
+ elif ch== char "<" do b+="<"; goto nextch;
+ elif ch== char ">" do b+=">"; goto nextch;
+ elif ch== char "&" do b+="&"; goto nextch;
+ else goto contin;
+ done
+ }
+ // comments
+ | cppcomment =>
+ {
+ if iseol ch do goto lastch;
+ else goto contin;
+ done
+ }
+ | ccomment => // doesn't handle nested comments yet
+ {
+ if ch == char "*" and ahead(1) == char "/" do
+ cp;
+ goto lastch;
+ else goto contin;
+ done
+ }
+ endmatch
+ ; // execute selected function
+ println$ "Unexpected drop thru";
+
+fin:>
+ println "outof data";
+ w(); // whatever is left over gets written
+giveup:>
+}
+
+proc serve_cpp(s:socket_t, fname:string)
+{
+ var eof_flag = false;
+ proc write_string(k:socket_t, t:string)
+ {
+ if not eof_flag do Flx_stream::write_string(k,t,&eof_flag);
+ else goto giveup;
+ done
+ }
+
+ var flx = Text_file::load(fname);
+ if flx == "" do flx = Text_file::load(LIBROOT+"/"+fname); done
+ if flx == "" do flx = "NO FILE "+fname+" FOUND IN " + LIBROOT; done
+ println$ "Loaded C/C++file " + fname;
+ //println$ "Contents=" + flx;
+ write_string(s, html_header);
+ write_string(s, flx_head);
+ write_string(s,"<pre>");
+ write_cpp(s, flx, &eof_flag);
+ write_string(s,"</pre>\n");
+ write_string(s,"</body></html>\n");
+giveup:>
+}
+
+// Felix
val big_keywords =
"module",
"fun",
@@ -237,7 +464,7 @@ val big_keywords =
val small_keywords =
"if", "then", "else", "elif", "endif", "do", "done",
"in", "forall", "while", "whilst","to", "upto","downto",
- "match","endmatch","with","requires"
+ "match","endmatch","with","requires","return","goto"
;
val qualifiers =
@@ -245,10 +472,7 @@ val qualifiers =
;
val hack = "C_hack","C_hack"; // to make it an array we need 2 components
-fun inarray[N](s:string, a:array[string,N])=>
- mem (fun (x:string) => s == x) a
-;
-
+
proc write_felix(k:socket_t, t:string, eof_flag: &bool)
{
proc write_string(k:socket_t, t:string)
@@ -328,7 +552,15 @@ proc write_felix(k:socket_t, t:string, eof_flag: &bool)
elif inarray(b,hack) do write_string(k,'<span class=hack>'+b+"</span>");
else write_string(k,b); done
}
- | _ => { write_string(k,b); }
+ | _ =>
+ {
+ last_op=b;
+ if b == "<" do b = "<";
+ elif b == ">" do b = ">";
+ elif b == "&" do b = "&";
+ done;
+ write_string(k,b);
+ }
endmatch;
b = "";
}
@@ -501,6 +733,9 @@ proc serve_file(infname: string, s: socket_t)
print "suffix is "; print suffix; endl;
if suffix == "flx" do serve_felix(s:socket_t, fname:string);
+ elif suffix == "cpp" or suffix == "hpp"
+ or suffix == "cxx" or suffix == "h" or suffix == "c"
+ do serve_cpp(s:socket_t, fname:string);
else
if WIN32 do win32_send_file(s,fname, suffix);
commit 997860f361af8d15362ca6bb2fc68736dcc41316
Author: skaller <Max.S...@gmail.com>
Date: Wed Oct 20 03:17:26 2010 +1100
Finally fix the webserver bug, which turned out to be a gc problem.
Now it runs, and the gc is running too.
diff --git a/lpsrc/flx_maker.pak b/lpsrc/flx_maker.pak
index 39944f2..92430ba 100644
--- a/lpsrc/flx_maker.pak
+++ b/lpsrc/flx_maker.pak
@@ -733,8 +733,10 @@ if FELIX == 1 do
write_include_file(filebase);
else
dbug?? println "Felix compilation skipped by switch";
+ calpackages(); // need to do this here to set linker switches
done
+
if STATIC == 0 do
dbug?? println "Dynamic linkage";
CCMD=List::cat ' ' (List::list (
diff --git a/src/compiler/flx_cpp_backend/flx_ogen.ml b/src/compiler/flx_cpp_backend/flx_ogen.ml
index acaea58..73928d0 100644
--- a/src/compiler/flx_cpp_backend/flx_ogen.ml
+++ b/src/compiler/flx_cpp_backend/flx_ogen.ml
@@ -522,7 +522,6 @@ let gen_offset_tables syms bsym_table module_name =
if not is_pod then begin
bcat s ("static void " ^ name ^ "_finaliser(collector_t *, void *p){\n");
bcat s (" (("^ tname ^ "*)p)->~" ^ tname ^ "();\n");
- bcat s (" p = (void*)((char*)p + sizeof("^tname^"));\n");
bcat s ("}\n")
end
;
@@ -530,7 +529,7 @@ let gen_offset_tables syms bsym_table module_name =
bcat s (" " ^ old_ptr_map ^ ",\n");
bcat s (" \"" ^ name ^ "\",\n");
bcat s (" " ^ si k ^ ",\n");
- bcat s (" sizeof("^name^"),\n");
+ bcat s (" sizeof("^tname^"),\n"); (* NOTE: size of ONE element!! *)
bcat s
(
if not is_pod then (" "^name^"_finaliser,\n")
diff --git a/src/faio/faio_posixio.cpp b/src/faio/faio_posixio.cpp
index aff1012..17923cb 100644
--- a/src/faio/faio_posixio.cpp
+++ b/src/faio/faio_posixio.cpp
@@ -94,7 +94,7 @@ socketio_wakeup::wakeup(posix_demuxer& demux)
else if(wakeup_flags & PDEMUX_EOF)
{
connection_closed = true;
- fprintf(stderr,"posix faio wakeup PDEMUX_EOF, connection closed = %d\n", connection_closed);
+ //fprintf(stderr,"posix faio wakeup PDEMUX_EOF, connection closed = %d\n", connection_closed);
//pb.bytes_written=0;
}
@@ -112,8 +112,8 @@ socketio_wakeup::wakeup(posix_demuxer& demux)
assert(wakeup_flags == PDEMUX_WRITE);
//fprintf(stderr,"posix faio wakeup PDEMUX_WRITE, writing..\n");
connection_closed = posix_demuxer::socket_send(s, &pb);
- if(connection_closed)
- fprintf(stderr,"posix faio wakeup PDEMUX_WRITE, connection closed = %d\n", connection_closed);
+ //if(connection_closed)
+ // fprintf(stderr,"posix faio wakeup PDEMUX_WRITE, connection closed = %d\n", connection_closed);
}
// fprintf(stderr,"posthandle wakeup, this: %p, read: %i, len: %i, done %i\n",
diff --git a/src/faio/flx_stream.flx b/src/faio/flx_stream.flx
index 9681adb..cf4e078 100644
--- a/src/faio/flx_stream.flx
+++ b/src/faio/flx_stream.flx
@@ -263,7 +263,7 @@ module Flx_stream {
var st: string="";
var finished = false;
- fprintln$ cerr,"Get line from IByteStream "+id;
+ //fprintln$ cerr,"Get line from IByteStream "+id;
whilst not finished do
var len = 1;
var eof: bool;
diff --git a/src/gc/flx_collector.cpp b/src/gc/flx_collector.cpp
index 0f0cc64..018873a 100644
--- a/src/gc/flx_collector.cpp
+++ b/src/gc/flx_collector.cpp
@@ -223,13 +223,17 @@ void *flx_collector_t::create_empty_array(
void flx_collector_t::impl_finalise(void *fp)
{
assert(fp!=NULL);
- gc_shape_t *shape = get_shape(fp);
+ //fprintf(stderr, "Finaliser for %p\n", fp);
+ gc_shape_t *shape = get_shape(fp); // inefficient, since we already know the shape!
+ //fprintf(stderr, "Got shape %p=%s\n", shape,shape->cname);
void (*finaliser)(collector_t*, void*) = shape->finaliser;
+ //fprintf(stderr, "Got finaliser %p\n", finaliser);
if (finaliser)
{
unsigned char *cp = (unsigned char*)fp;
unsigned long n_used = get_count(fp) * shape->count;
unsigned long eltsize = shape->amt;
+ //fprintf(stderr, "Finalising at %p for type %s %ld objects each size %ld\n", cp, shape->cname, n_used, eltsize);
for(unsigned long j = 0; j<n_used; ++j)
{
(*finaliser)(this,(void*)cp);
@@ -244,6 +248,7 @@ void flx_collector_t::unlink(void *fp)
assert(fp!=NULL);
// call the finaliser if there is one
+ //fprintf(stderr,"Calling finaliser\n");
impl_finalise(fp);
allocation_count--;
@@ -251,12 +256,15 @@ void flx_collector_t::unlink(void *fp)
unsigned long n_objects = get_count(fp);
unsigned long nobj = shape -> count * n_objects;
std::size_t size = shape->amt * nobj;
+ //fprintf(stderr, "Uncounting %ld bytes\n", long(size));
allocation_amt -= size;
// unlink the frame from the collectors list
+ //fprintf(stderr,"Removing address from Judy lists\n");
JudyLDel(&j_shape, (Word_t)fp, &je);
JudyLDel(&j_nused, (Word_t)fp, &je);
JudyLDel(&j_nalloc, (Word_t)fp, &je);
+ //fprintf(stderr,"Finished unlinking\n");
}
void flx_collector_t::post_delete(void *fp)
@@ -350,14 +358,19 @@ unsigned long flx_collector_t::sweep()
if(debug)
fprintf(stderr,"Garbage %p=%s\n",current,((gc_shape_t*)(*pshape & ~1UL))->cname);
++ sweeped;
+ //fprintf(stderr,"Unlinking ..\n");
unlink(current);
+ //fprintf(stderr,"Posting delete ..\n");
post_delete(current);
+ //fprintf(stderr,"Reaping done\n");
}
else
if(debug)
fprintf(stderr,"Reachable %p=%s\n",current,((gc_shape_t*)(*pshape & ~1UL))->cname);
+ //fprintf(stderr,"Calling Judy for next object\n");
pshape = (Word_t*)JudyLNext(j_shape,(Word_t*)(void*)¤t,&je);
+ //fprintf(stderr,"Judy got next object %p\n",pshape);
}
parity = !parity;
diff --git a/src/gc/flx_gc.cpp b/src/gc/flx_gc.cpp
index 31c3838..7bdff9f 100644
--- a/src/gc/flx_gc.cpp
+++ b/src/gc/flx_gc.cpp
@@ -67,7 +67,7 @@ unsigned long gc_profile_t::actually_collect() {
void *gc_profile_t::allocate(
flx::gc::generic::gc_shape_t *shape,
- unsigned long amt,
+ unsigned long count,
bool allow_gc
)
{
@@ -78,20 +78,27 @@ void *gc_profile_t::allocate(
{
maybe_collect();
try {
- return collector -> allocate(shape,amt);
+ return collector -> allocate(shape,count);
}
catch (flx::rtl::flx_out_of_memory_t&) {
actually_collect();
- return collector -> allocate(shape,amt);
+ return collector -> allocate(shape,count);
}
}
else
- return collector -> allocate(shape,amt);
+ return collector -> allocate(shape,count);
}
}}} // end namespaces
// in global namespace now ..
+//
+// NOTE: Felix arrays are two dimensional. The shape.amt field is the size of
+// one element. The shape.count field is the number of elements for a static
+// array type. The dynamic length is for varrays, it is stored in a judy array
+// associated with the array address. If there is nothing in the judy array,
+// the dynamic length is one. C++ operator new allocates arrays of dynamic length 1.
+//
void *operator new(
std::size_t amt,
flx::gc::generic::gc_profile_t &gcp,
@@ -99,13 +106,13 @@ void *operator new(
bool allow_gc
)
{
- if (amt != shape.amt)
+ if (amt != shape.amt * shape.count)
{
fprintf(stderr,"Shape size error: allocator size = %ld\n",amt);
- fprintf(stderr,"Shape %s size = %ld\n",shape.cname,shape.amt);
+ fprintf(stderr,"Shape %s element size = %ld, element count = %;d\n",shape.cname,shape.amt,shape.count);
abort();
}
- void *p = gcp.allocate(&shape,1,allow_gc);
+ void *p = gcp.allocate(&shape,1,allow_gc); // dynamic array count = 1
return p;
}
commit 1db6b034cbd260191845098648fdb65d597167f3
Author: skaller <Max.S...@gmail.com>
Date: Tue Oct 19 13:04:33 2010 +1100
Fix the webserver so it doesn't write on closed connections.
Add some more colours and keywords.
diff --git a/lpsrc/flx_maker.pak b/lpsrc/flx_maker.pak
index de407f9..39944f2 100644
--- a/lpsrc/flx_maker.pak
+++ b/lpsrc/flx_maker.pak
@@ -433,7 +433,7 @@ dbug?? println$ "cpps="+cpps;
dbug?? println$ "cppos="+cppos;
var USER_ARGS = ""; whilst argno < System::argc do USER_ARGS+=" " + System::argv argno; ++argno; done
-println$ "USER_ARGS=" + USER_ARGS;
+//println$ "USER_ARGS=" + USER_ARGS;
if NOOPTIMISE == 0 do
dbug?? println "Set C++ compiler optimisation switches";
diff --git a/src/compiler/flx_cpp_backend/flx_gen.ml b/src/compiler/flx_cpp_backend/flx_gen.ml
index de282eb..bcf9a23 100644
--- a/src/compiler/flx_cpp_backend/flx_gen.ml
+++ b/src/compiler/flx_cpp_backend/flx_gen.ml
@@ -996,7 +996,8 @@ let gen_exe filename
| Function ->
begin match label_kind with
- | `Far -> assert false
+ | `Far -> failwith ("[gen_exe] In function " ^ Flx_bsym.id bsym ^
+ ": Non-local going to label " ^s)
| `Near ->
" " ^ cid_of_flxid s ^ ":;\n"
| `Unused -> ""
diff --git a/src/demux/demux_demuxer.hpp b/src/demux/demux_demuxer.hpp
index 98c65fc..a8df878 100644
--- a/src/demux/demux_demuxer.hpp
+++ b/src/demux/demux_demuxer.hpp
@@ -6,10 +6,22 @@ namespace flx { namespace demux {
struct sel_param {
char* buffer; // set on input
- long buffer_size; // set on input
- long bytes_written; // set on input and output
+ long buffer_size; // set on input
+ long bytes_written; // set on input and output
+ bool eof_detected; // NEW: a proper eof flag
+ // maybe implemented in Posix,
+ // not done in Windows yet (since I don't have a Windows development box)
- bool finished() { return bytes_written == buffer_size; }
+ bool error_detected; // NEW: a proper error flag
+ // maybe implemented on Posix
+ // not done in Windows yet (since I don't have a Windows development box)
+ // NOTE: there's no indication of what the error is
+ // because that is platform dependent
+ // A normal EOF condition is NOT an error
+ // However most errors will be associated with an eof!
+
+ sel_param() : buffer(0), buffer_size(0), bytes_written(0), eof_detected(false), error_detected(false) {}
+ bool finished() { return error_detected || eof_detected || (bytes_written == buffer_size); }
};
// rename ...
diff --git a/src/demux/posix/demux_posix_demuxer.cpp b/src/demux/posix/demux_posix_demuxer.cpp
index 8e155ad..f3b7da4 100644
--- a/src/demux/posix/demux_posix_demuxer.cpp
+++ b/src/demux/posix/demux_posix_demuxer.cpp
@@ -37,15 +37,18 @@ posix_demuxer::socket_recv(int s, sel_param* pb)
s,pb, int(pb->bytes_written), int(pb->buffer_size - pb->bytes_written), int(nbytes)
);
*/
- if(nbytes <= 0)
+ if(nbytes <= 0) // so what happens if the client wants to send 0 bytes?
{
if(nbytes == 0)
{
+ pb->eof_detected = true;
return true; // connection closed
}
else
{
perror("recv"); // can get reset connection here
+ pb->eof_detected = true;
+ pb->error_detected = true;
return true; // so say closed, yeah?
}
}
@@ -82,11 +85,22 @@ posix_demuxer::socket_send(int s, sel_param* pb)
// what's the story with zero? Is that allowed or does it signal
// that the connection closed?
+ // JS: According to the man page, it can happen on an async socket
+ // but for us this could be if the notification event lied
+ // OR a socket connection got closed in between the notification
+ // and this call: we can tell by looking at errno but that utterly
+ // sucks .. oh well, unix is a pretty bad OS in some ways
+ // OR .. it could happen if the client decided to send 0 bytes!
+
if(-1 == nbytes)
{
fprintf(stderr,"posix_demuxer: socket send failed, connection closed by client?\n");
perror("send");
fprintf(stderr,"Should have printed the error code above ..\n");
+ pb->eof_detected = true;
+ pb->error_detected = true; // really, trying to write on a connection merely closed
+ // by the client is NOT an error, since there's no other way
+ // to tell than try to do a write
return true; // I guess the connection closed
}
else
diff --git a/src/demux/win/demux_overlapped.cpp b/src/demux/win/demux_overlapped.cpp
index 8ab3dbd..2eee5f1 100644
--- a/src/demux/win/demux_overlapped.cpp
+++ b/src/demux/win/demux_overlapped.cpp
@@ -347,6 +347,7 @@ wsasocketio_control_block::start_overlapped()
}
fprintf(stderr,"WSARecv/Send returned SOCKET_ERR: %li\n", err);
+ ppb->eof_detected=true;
return true; // assume it's bad and we won't get a wakeup
}
break;
diff --git a/src/faio/faio_asyncio.cpp b/src/faio/faio_asyncio.cpp
index bd7febd..529e74b 100644
--- a/src/faio/faio_asyncio.cpp
+++ b/src/faio/faio_asyncio.cpp
@@ -21,7 +21,7 @@ void flx_driver_request_base:: start_async_op(finote_t *fn_a)
void flx_driver_request_base:: notify_finished()
{
- //fprintf(stderr, "faio_req=%p, Notify %p\n", this,fn);
+ //fprintf(stderr, "faio_req=%p, Notify finished %p\n", this,fn);
assert(fn!=0);
finote_t *fin = fn;
fn=0;
diff --git a/src/faio/faio_posixio.cpp b/src/faio/faio_posixio.cpp
index 2913375..aff1012 100644
--- a/src/faio/faio_posixio.cpp
+++ b/src/faio/faio_posixio.cpp
@@ -88,11 +88,13 @@ socketio_wakeup::wakeup(posix_demuxer& demux)
{
connection_closed = true;
//pb.bytes_written=0;
+ fprintf(stderr,"posix faio wakeup PDEMUX_ERROR, connection closed = %d\n", connection_closed);
}
else if(wakeup_flags & PDEMUX_EOF)
{
connection_closed = true;
+ fprintf(stderr,"posix faio wakeup PDEMUX_EOF, connection closed = %d\n", connection_closed);
//pb.bytes_written=0;
}
@@ -110,7 +112,8 @@ socketio_wakeup::wakeup(posix_demuxer& demux)
assert(wakeup_flags == PDEMUX_WRITE);
//fprintf(stderr,"posix faio wakeup PDEMUX_WRITE, writing..\n");
connection_closed = posix_demuxer::socket_send(s, &pb);
- //fprintf(stderr,"posix faio wakeup PDEMUX_WRITE, connection closed = %d\n", connection_closed);
+ if(connection_closed)
+ fprintf(stderr,"posix faio wakeup PDEMUX_WRITE, connection closed = %d\n", connection_closed);
}
// fprintf(stderr,"posthandle wakeup, this: %p, read: %i, len: %i, done %i\n",
@@ -121,6 +124,10 @@ socketio_wakeup::wakeup(posix_demuxer& demux)
if(connection_closed || pb.bytes_written == pb.buffer_size)
{
// fprintf(stderr,"schedding %p, drv: %p, f: %p\n", this, drv, f);
+ // if the connection closed, this notify should tell the caller
+ // not to keep trying to write, but it doesn't .. why not?
+ // who called it anyhow?
+ // I think the writing code ignores error returns ..
request->notify_finished();
return;
}
diff --git a/src/faio/flx_faio.flx b/src/faio/flx_faio.flx
index 01e7f33..3f5c827 100644
--- a/src/faio/flx_faio.flx
+++ b/src/faio/flx_faio.flx
@@ -26,9 +26,14 @@ module Faio {
proc calc_eof(pb: sel_param_ptr, len: &int, eof: &bool)
{
+ //println "Calc_eof ..";
var bytes_done = pb.bytes_done;
+ //println$ "Bytes done = "+ str bytes_done;
+ //println$ "Req len= "+ str (*len);
*eof = (bytes_done != *len);
+ //println$ "Eof = " + str (*eof);
*len = bytes_done;
+ //println$ "Reset len to bytes done ..";
}
type sleep_request = 'flx::faio::sleep_request' requires faio_timer_h;
diff --git a/src/faio/flx_faio_posix.flx b/src/faio/flx_faio_posix.flx
index 3d51b26..d61f6e2 100644
--- a/src/faio/flx_faio_posix.flx
+++ b/src/faio/flx_faio_posix.flx
@@ -103,9 +103,13 @@ fun get_pb: socketio_request -> sel_param_ptr = '&$1.sv.pb';
// read & write differ only by a flag
proc async_rw(fd: socket_t, len: &int, buf: address, eof: &bool, read_flag: bool)
{
+ //println$ "faio/flx_faoi_posix.flx: async_rw (s,"+str (*len)+",buf,"+str(*eof)+", "+str read_flag+") calling mk_socketio_req ..";
var asyncb = mk_socketio_request(sys_demux,fd, buf, *len, read_flag);
faio_req$ &asyncb;
+ //println$ "faio/flx_faoi_posix.flx: async_rw ("+ str fd+", "+str (*len)+",buf,"+str(*eof)+", "+str read_flag+") calculating eof ..";
+
calc_eof(asyncb.pb, len, eof);
+ //println$ "faio/flx_faoi_posix.flx: async_rw (s,"+str (*len)+",buf,"+str(*eof)+", "+str read_flag+") called mk_socketio_req ..";
}
proc async_read(fd: socket_t, len: &int, buf: address,
@@ -116,7 +120,9 @@ proc async_read(fd: socket_t, len: &int, buf: address,
proc async_write(fd: socket_t, len: &int, buf: address, eof: &bool)
{
+ //println$ "faio/flx_faoi_posix.flx: async_write(s,"+str (*len)+",buf,"+str(*eof)+" calling async_rw ..";
async_rw(fd, len, buf, eof, false); // write
+ //println$ "faio/flx_faoi_posix.flx: async_write(s,"+str (*len)+",buf,"+str(*eof)+" call async_rw ..";
}
type flxfileio_request = "flx::faio::flxfileio_request";
diff --git a/src/faio/flx_socket.flx b/src/faio/flx_socket.flx
index 9463593..e2f1845 100644
--- a/src/faio/flx_socket.flx
+++ b/src/faio/flx_socket.flx
@@ -77,7 +77,11 @@ module Flx_socket {
{
if POSIX do
proc write(s: socket_t, len: &int, buf: address, eof: &bool)
- { Faio_posix::async_write(s, len, buf, eof); }
+ {
+ //println$ "faio/flx_socket.flx: Flx_stream::OByteStream[socket_t]: write(s,"+str (*len)+",buf,"+str(*eof)+") calling async_write ..";
+ Faio_posix::async_write(s, len, buf, eof);
+ //println$ "faio/flx_socket.flx: Flx_stream::OByteStream[socket_t]: write(s,"+str (*len)+",buf,"+str(*eof)+") called async_write ..";
+ }
else
proc write(s: socket_t, len: &int, buf: address, eof: &bool)
{ Faio_win32::WSASend(s, len, buf, eof); }
diff --git a/src/faio/flx_stream.flx b/src/faio/flx_stream.flx
index a6a9279..9681adb 100644
--- a/src/faio/flx_stream.flx
+++ b/src/faio/flx_stream.flx
@@ -302,11 +302,10 @@ module Flx_stream {
proc write_string[ostr with OByteStream[ostr]]
- (sk: ostr, var s: string)
+ (sk: ostr, var s: string, eof: &bool)
{
var slen = len s;
var a = C_hack::cast[address]$ cstr s;
- var eof: bool;
- write(sk, &slen, a, &eof);
+ write(sk, &slen, a, eof);
}
} // module Flx_stream
diff --git a/src/pthread/pthread_condv.cpp b/src/pthread/pthread_condv.cpp
index d6f190c..b4200b8 100644
--- a/src/pthread/pthread_condv.cpp
+++ b/src/pthread/pthread_condv.cpp
@@ -4,15 +4,59 @@
namespace flx { namespace pthread {
-flx_condv_t::flx_condv_t() { pthread_cond_init(&cv, NULL); }
-flx_condv_t::~flx_condv_t() { pthread_cond_destroy(&cv); }
-void flx_condv_t::wait(flx_mutex_t *m) { pthread_cond_wait(&cv,&(m->m)); }
-void flx_condv_t::signal() { pthread_cond_signal(&cv);}
-void flx_condv_t::broadcast() { pthread_cond_broadcast(&cv); }
+flx_condv_t::flx_condv_t() {
+ int res = pthread_cond_init(&cv, NULL);
+ #if !FLX_WIN32
+ if(res==EINVAL) {
+ // I suspect this is an error .. perhaps something got deleted
+ fprintf(stderr,"pthred_cond_init returned EINVAL!");
+ }
+ #endif
+}
+flx_condv_t::~flx_condv_t() {
+ int res = pthread_cond_destroy(&cv);
+ #if !FLX_WIN32
+ if(res==EINVAL) {
+ // I suspect this is an error .. perhaps something got deleted
+ fprintf(stderr,"pthred_cond_destroy returned EINVAL!");
+ }
+ #endif
+}
+void flx_condv_t::wait(flx_mutex_t *m) {
+ int res = pthread_cond_wait(&cv,&(m->m));
+ #if !FLX_WIN32
+ if(res==EINVAL) {
+ // I suspect this is an error .. perhaps something got deleted
+ fprintf(stderr,"pthred_cond_wait returned EINVAL!");
+ }
+ #endif
+}
+void flx_condv_t::signal() {
+ int res = pthread_cond_signal(&cv);
+ #if !FLX_WIN32
+ if(res==EINVAL) {
+ // I suspect this is an error .. perhaps something got deleted
+ fprintf(stderr,"pthred_cond_signal returned EINVAL!");
+ }
+ #endif
+}
+void flx_condv_t::broadcast() {
+ int res = pthread_cond_broadcast(&cv);
+ #if !FLX_WIN32
+ if(res==EINVAL) {
+ // I suspect this is an error .. perhaps something got deleted
+ fprintf(stderr,"pthred_cond_broadcast returned EINVAL!");
+ }
+ #endif
+}
int flx_condv_t::timedwait(flx_mutex_t *m, timespec *t) {
int res = pthread_cond_timedwait(&cv,&(m->m),t);
#if !FLX_WIN32
- if(res==EINVAL) return 0; // this is NOT an error!
+ if(res==EINVAL) {
+ // I suspect this is an error .. perhaps something got deleted
+ fprintf(stderr,"pthred_cond_timedwait returned EINVAL!");
+ return 0; // this is NOT an error!
+ }
#endif
return res;
}
diff --git a/test/faio/faio-1.01.01-0.flx b/test/faio/faio-1.01.01-0.flx
index 20ef86e..a585338 100644
--- a/test/faio/faio-1.01.01-0.flx
+++ b/test/faio/faio-1.01.01-0.flx
@@ -23,6 +23,7 @@ print "spawning connector\n";
spawn_fthread
{
{
+ var eof = false;
// print "Connector dude\n"; // get rid of, hard to test
var c: socket_t;
connect(&c, c"127.0.0.1", port); // connect to localhost
@@ -31,7 +32,7 @@ spawn_fthread
get_line(c, &st,"fthread");
print "connector got "; print st; endl;
- write_string(c, "thanks\n"); // newline important
+ write_string(c, "thanks\n", &eof); // newline important
ioclose(c); // finished with this
//println$ "fthread closed " + str c;
@@ -43,8 +44,9 @@ accept(listener, &s);
//println$ "Mainline accepted connection on socket " + str s;
ioclose(listener); // not needed anymore
+var eof = false;
print "got connection\n";
-write_string(s, "server says hi\n"); // newline important here
+write_string(s, "server says hi\n", &eof); // newline important here
var st: string;
get_line(s, &st,"mainline");
diff --git a/tools/webserver.flx b/tools/webserver.flx
index 58d78dd..5e4e1bc 100644
--- a/tools/webserver.flx
+++ b/tools/webserver.flx
@@ -113,12 +113,12 @@ Content-Type: text/html\r
PAGE NOT FOUND:
""";
-proc write_http_header(s:socket_t, suffix:string)
+proc write_http_header(s:socket_t, suffix:string, eof: &bool)
{
// mime type mapping from suffix. make better here.
- if("gif" == suffix) then { write_string(s, gif_header); }
- elif("css" == suffix) then { write_string(s, css_header); }
- else { write_string(s, html_header); } endif;
+ if("gif" == suffix) then { write_string(s, gif_header, eof); }
+ elif("css" == suffix) then { write_string(s, css_header, eof); }
+ else { write_string(s, html_header, eof); } endif;
}
if WIN32 do
@@ -143,7 +143,7 @@ if WIN32 do
done
}
elif POSIX do
- proc posix_send_file(s:socket_t,fname:string,suffix:string)
+ proc posix_send_file(s:socket_t,fname:string,suffix:string, eof: &bool)
{
// this fn sets the O_NONBLOCK flag which is completely unnecessary
// as read goes via the preading worker fifo. don't know if
@@ -153,14 +153,14 @@ elif POSIX do
if Faio_posix::invalid fd do
{
print ("BUGGER, posix open of "+fname+" failed\n");
- write_string(s, notfound_header);
- write_string(s, fname+"\r\n\n");
+ write_string(s, notfound_header, eof);
+ write_string(s, fname+"\r\n\n", eof);
}
else
{
print ("got fd "+str fd +" for read file of "+fname+"\n");
- write_http_header(s,suffix);
+ write_http_header(s,suffix, eof);
var from_strm: Faio_posix::fd_t = fd;
var to_strm: socket_t = s;
Flx_stream::cat(from_strm, to_strm);
@@ -202,8 +202,10 @@ flx_head := """
<style type="text/css">
span.fstring {color:darkblue; font-style:italic; }
span.comment {font-family:arial; color:blue; font-style:italic; }
-span.big_keyword {color:red; }
-span.small_keyword {color:darkred; }
+span.big_keyword {color:#FF1010; }
+span.small_keyword {color:#802040; }
+span.qualifier {color:#A02020; }
+span.hack {color:#00FF00; }
</style>
</head>
<body>
@@ -212,8 +214,11 @@ span.small_keyword {color:darkred; }
val big_keywords =
"module",
"fun",
+ "gen",
"proc",
"type",
+ "union",
+ "struct",
"typedef",
"var",
"val",
@@ -225,7 +230,9 @@ val big_keywords =
"include",
"open",
"spawn_fthread",
- "spawn_pthread"
+ "spawn_pthread",
+ "reduce", "axiom",
+ "open", "inherit"
;
val small_keywords =
"if", "then", "else", "elif", "endif", "do", "done",
@@ -233,12 +240,24 @@ val small_keywords =
"match","endmatch","with","requires"
;
+val qualifiers =
+ "virtual", "inline", "noinline", "private", "incomplete"
+;
+val hack = "C_hack","C_hack"; // to make it an array we need 2 components
+
fun inarray[N](s:string, a:array[string,N])=>
mem (fun (x:string) => s == x) a
;
-proc write_felix(k:socket_t, t:string)
+proc write_felix(k:socket_t, t:string, eof_flag: &bool)
{
+ proc write_string(k:socket_t, t:string)
+ {
+ if not *eof_flag do Flx_stream::write_string(k,t,eof_flag);
+ else goto giveup;
+ done
+ }
+
union state_t =
| sot // start of token
| id // processing identifier
@@ -305,6 +324,8 @@ proc write_felix(k:socket_t, t:string)
last_id = b;
if inarray(b,big_keywords) do write_string(k,'<span class=big_keyword>'+b+"</span>");
elif inarray(b,small_keywords) do write_string(k,'<span class=small_keyword>'+b+"</span>");
+ elif inarray(b,qualifiers) do write_string(k,'<span class=qualifier>'+b+"</span>");
+ elif inarray(b,hack) do write_string(k,'<span class=hack>'+b+"</span>");
else write_string(k,b); done
}
| _ => { write_string(k,b); }
@@ -427,25 +448,36 @@ thisch:> // same char, reconsider it
fin:>
println "outof data";
w(); // whatever is left over gets written
+giveup:>
}
proc serve_felix(s:socket_t, fname:string)
{
- var flx = Text_file::load(fname);
- if flx == "" do flx = Text_file::load(LIBROOT+"/"+fname); done
- if flx == "" do flx = "NO FILE "+fname+" FOUND IN " + LIBROOT; done
- println$ "Loaded felix file " + fname;
- //println$ "Contents=" + flx;
- write_string(s, html_header);
- write_string(s, flx_head);
- write_string(s,"<pre>");
- write_felix(s, flx);
- write_string(s,"</pre>\n");
- write_string(s,"</body></html>\n");
+ var eof_flag = false;
+ proc write_string(k:socket_t, t:string)
+ {
+ if not eof_flag do Flx_stream::write_string(k,t,&eof_flag);
+ else goto giveup;
+ done
+ }
+
+ var flx = Text_file::load(fname);
+ if flx == "" do flx = Text_file::load(LIBROOT+"/"+fname); done
+ if flx == "" do flx = "NO FILE "+fname+" FOUND IN " + LIBROOT; done
+ println$ "Loaded felix file " + fname;
+ //println$ "Contents=" + flx;
+ write_string(s, html_header);
+ write_string(s, flx_head);
+ write_string(s,"<pre>");
+ write_felix(s, flx, &eof_flag);
+ write_string(s,"</pre>\n");
+ write_string(s,"</body></html>\n");
+giveup:>
}
proc serve_file(infname: string, s: socket_t)
{
+ var eof_flag = false;
// if empty string, serve index.html
// not quite right - needs to handle directories too, so
// not only foo.com/ -> index.html, but foo.com/images/ -> images/index.html
@@ -472,7 +504,7 @@ proc serve_file(infname: string, s: socket_t)
else
if WIN32 do win32_send_file(s,fname, suffix);
- elif POSIX do posix_send_file(s,fname, suffix);
+ elif POSIX do posix_send_file(s,fname, suffix,&eof_flag);
done
done
}
@@ -524,7 +556,7 @@ noinline proc handler (var k:socket_t) ()
//cat(s, DEVNULL);
fprint$ cerr,"fthread closing socket "+str k+"\n";
- Faio::sleep(clock,1.0); // give OS time to empty its buffers
+ Faio::sleep(clock,0.1); // give OS time to empty its buffers
ioclose(k);
fprint$ cerr,"fthread "+str k+" terminating!\n";
};
commit 5f8a60e0040585d9812c2824f4854eb6dbf91647
Author: skaller <Max.S...@gmail.com>
Date: Mon Oct 18 04:15:42 2010 +1100
Hyperlinks in webserver, use --root=FLX_INSTALL_DIR to set the root for
include statements to do their lookup.
diff --git a/lpsrc/flx_maker.pak b/lpsrc/flx_maker.pak
index 5b82247..de407f9 100644
--- a/lpsrc/flx_maker.pak
+++ b/lpsrc/flx_maker.pak
@@ -432,6 +432,9 @@ dbug?? println$ "path="+path+": dir="+dir+",base="+base", ext="+ext;
dbug?? println$ "cpps="+cpps;
dbug?? println$ "cppos="+cppos;
+var USER_ARGS = ""; whilst argno < System::argc do USER_ARGS+=" " + System::argv argno; ++argno; done
+println$ "USER_ARGS=" + USER_ARGS;
+
if NOOPTIMISE == 0 do
dbug?? println "Set C++ compiler optimisation switches";
CCFLAGS=CCFLAGS+" " + OPTIMISE;
@@ -607,17 +610,7 @@ proc write_include_file(path:string) {
Text_file::fclose f;
}
-
-// grab program arguments
-grab=1;
-fun pop (x:List::list[string], n:int) =>
- if n == 0 then x
- else match x with | Cons(_,?t) => pop(t,n-1) | Empty[string] => List::Empty[string] endmatch
- endif
-;
-
-var tail = pop (System::args(), argno);
-var args= List::cat " " tail;
+val args = USER_ARGS;
dbug?? println$ "Target program args = "+args;
var INCLUDE_DIR="-I"+Filename::join(FLX_INSTALL_DIR,"lib","rtl") + " -I"+Filename::join(FLX_INSTALL_DIR,"config","target");
diff --git a/tools/webserver.flx b/tools/webserver.flx
index 492d105..58d78dd 100644
--- a/tools/webserver.flx
+++ b/tools/webserver.flx
@@ -24,6 +24,22 @@ macro fun dbg(x) = { fprint (cerr,x); };
// read new sockets off it ..
open TerminalIByteStream[socket_t];
+var arg = "";
+var argno = 1;
+fun prefix(arg:string,key:string)=>
+ arg.[to len key]==key
+;
+var LIBROOT = "";
+whilst argno<System::argc do
+ arg = System::argv argno;
+ println$ "ARG=" + arg;
+ if prefix(arg,"--root=") do
+ LIBROOT=arg.[7 to]+"/lib";
+ done
+ ++argno;
+done
+println$ "LIBROOT="+LIBROOT;
+
fun getline_to_url (get:string) =>
if not startswith get "GET " then
""
@@ -262,18 +278,31 @@ proc write_felix(k:socket_t, t:string)
;
var b = "";
+ var last_id = "";
proc cp() { b += ch; }
+ proc ws() {
+ if last_id == "include" do // hackery
+ var n = b;
+ whilst n.[0] == char "'" or n.[0] == char '"' do n = n.[1 to]; done
+ whilst n.[-1] == char "'" or n.[-1] == char '"' do n = n.[to -1]; done
+ if n.[-4 to] != ".flx" do n+= ".flx"; done // hack, fixme
+ write_string(k,'<a href="/'+n+'" >' + b + '</a>') ;
+ else
+ write_string(k,'<span class=fstring>'+b+"</span>");
+ done
+ }
proc w() {
//println$ "Token["+str s+"]="+b;
match s with
- | dq => { write_string(k,'<span class=fstring>'+b+"</span>"); }
- | sq => { write_string(k,'<span class=fstring>'+b+"</span>"); }
- | sq3 => { write_string(k,'<span class=fstring>'+b+"</span>"); }
- | dq3 => { write_string(k,'<span class=fstring>'+b+"</span>"); }
+ | dq => { ws; }
+ | sq => { ws; }
+ | sq3 => { ws; }
+ | dq3 => { ws; }
| ccomment=> { write_string(k,'<span class=comment>'+b+"</span>"); }
| cppcomment=> { write_string(k,'<span class=comment>'+b+"</span>"); }
| id =>
{
+ last_id = b;
if inarray(b,big_keywords) do write_string(k,'<span class=big_keyword>'+b+"</span>");
elif inarray(b,small_keywords) do write_string(k,'<span class=small_keyword>'+b+"</span>");
else write_string(k,b); done
@@ -318,11 +347,11 @@ thisch:> // same char, reconsider it
elif issq ch do s = sq; goto contin;
elif isdq ch do s = dq; goto contin;
elif ch == char "/" do
- if ahead(1) == char "/" do cp(); next(); s = cppcomment; goto contin
- elif ahead(1) == char "*" do cp(); next(); s = ccomment; goto contin
+ if ahead(1) == char "/" do cp; next; s = cppcomment; goto contin
+ elif ahead(1) == char "*" do cp; next; s = ccomment; goto contin
else goto lastch
done
- else cp(); w(); goto nextt;
+ else cp; w; goto nextt;
done
}
@@ -360,7 +389,7 @@ thisch:> // same char, reconsider it
// triple quoted strings
| sq3 =>
{
- if issq3() do cp(); next(); cp(); next(); cp(); w(); goto nextt;
+ if issq3() do cp; next; cp; next; cp; w; goto nextt;
elif ch== char "<" do b+="<"; goto nextch;
elif ch== char ">" do b+=">"; goto nextch;
elif ch== char "&" do b+="&"; goto nextch;
@@ -369,7 +398,7 @@ thisch:> // same char, reconsider it
}
| dq3 =>
{
- if isdq3() do cp(); next(); cp(); next(); cp(); w(); goto nextt;
+ if isdq3() do cp; next; cp; next; cp; w; goto nextt;
elif ch== char "<" do b+="<"; goto nextch;
elif ch== char ">" do b+=">"; goto nextch;
elif ch== char "&" do b+="&"; goto nextch;
@@ -386,7 +415,7 @@ thisch:> // same char, reconsider it
| ccomment => // doesn't handle nested comments yet
{
if ch == char "*" and ahead(1) == char "/" do
- cp();
+ cp;
goto lastch;
else goto contin;
done
@@ -402,15 +431,17 @@ fin:>
proc serve_felix(s:socket_t, fname:string)
{
- val flx = Text_file::load(fname);
+ var flx = Text_file::load(fname);
+ if flx == "" do flx = Text_file::load(LIBROOT+"/"+fname); done
+ if flx == "" do flx = "NO FILE "+fname+" FOUND IN " + LIBROOT; done
println$ "Loaded felix file " + fname;
//println$ "Contents=" + flx;
write_string(s, html_header);
write_string(s, flx_head);
write_string(s,"<pre>");
write_felix(s, flx);
- write_string(s,"</pre>");
- write_string(s,"</body></html>");
+ write_string(s,"</pre>\n");
+ write_string(s,"</body></html>\n");
}
proc serve_file(infname: string, s: socket_t)
@@ -493,7 +524,7 @@ noinline proc handler (var k:socket_t) ()
//cat(s, DEVNULL);
fprint$ cerr,"fthread closing socket "+str k+"\n";
- Faio::sleep(clock,0.1); // give OS time to empty its buffers
+ Faio::sleep(clock,1.0); // give OS time to empty its buffers
ioclose(k);
fprint$ cerr,"fthread "+str k+" terminating!\n";
};
commit 0afe2ccec025ee6b3411767c6b003cf5ec1c7617
Author: skaller <Max.S...@gmail.com>
Date: Mon Oct 18 02:37:14 2010 +1100
Add --options flag to flx to list current values of variant options.
A bit of a hack.
diff --git a/lpsrc/flx_maker.pak b/lpsrc/flx_maker.pak
index 8db770d..5b82247 100644
--- a/lpsrc/flx_maker.pak
+++ b/lpsrc/flx_maker.pak
@@ -133,7 +133,6 @@ var FLX_INSTALL_DIR = Env::getenv("FLX_INSTALL_DIR", INSTALL_ROOT);
// check for test mode: this argument must come first
-var TESTMODE=0;
var RECOMPILE=0;
var DEBUG=0;
var DEBUG_COMPILER=0;
@@ -227,12 +226,10 @@ whilst grab == 1 and argno<System::argc do
elif prefix(arg,"--test=") do
dbug?? println "Set test directory";
- TESTMODE=1;
FLX_INSTALL_DIR=arg.[7 to];
elif arg=="--test" do
dbug?? println "Set test directory";
- TESTMODE=1;
FLX_INSTALL_DIR=".";
elif arg=="--install" do
@@ -347,6 +344,27 @@ whilst grab == 1 and argno<System::argc do
println$ "DEBUG_FLAGS = "+str DEBUG_FLAGS;
System::exit(0);
+ elif arg == "--options" do
+ println$ "NOOPTIMISE = "+str NOOPTIMISE;
+ println$ "STATIC = "+str STATIC;
+ println$ "ECHO = "+str ECHO;
+ println$ "NOSTDLIB = "+str NOSTDLIB;
+ println$ "DEBUG = "+str DEBUG;
+ println$ "DEBUG_COMPILER = "+str DEBUG_COMPILER;
+ println$ "STDIMPORT = "+str STDIMPORT;
+ println$ "IMPORTS = "+str IMPORTS;
+ println$ "RECOMPILE = "+str RECOMPILE;
+ println$ "cpps = "+str cpps;
+ println$ "cppos = "+str cppos;
+ println$ "TIME = "+str TIME;
+ println$ "OUTPUT_DIR = "+str OUTPUT_DIR;
+ println$ "RUNIT = "+str RUNIT;
+ println$ "INCLUDE_DIRS = "+str INCLUDE_DIRS;
+ println$ "FELIX = "+str FELIX;
+ println$ "LINKER_SWITCHES = "+str LINKER_SWITCHES;
+ println$ "MACROS = "+str MACROS;
+ System::exit(0)
+
elif arg == "--where" do
dbug?? println "Print location of install directory and exit";
println(FLX_INSTALL_DIR);
@@ -928,7 +946,6 @@ FLX_INSTALL_DIR = os.getenv("FLX_INSTALL_DIR", INSTALL_ROOT)
# check for test mode: this argument must come first
-TESTMODE=0
RECOMPILE=0
DEBUG=0
DEBUG_COMPILER=0
@@ -1002,11 +1019,9 @@ while grab == 1 and argno<len(sys.argv):
IMPORTS=IMPORTS + " " + arg[9:]
elif prefix(arg,"--test="):
- TESTMODE=1
FLX_INSTALL_DIR=arg[7:]
elif arg=="--test":
- TESTMODE=1
FLX_INSTALL_DIR="."
elif prefix(arg,"--stdout="):
@@ -1410,7 +1425,6 @@ sys.exit(0!=result)
# check for test mode: this argument must come first
-TESTMODE=0
RECOMPILE=0
DEBUG=0
INLINE=100
@@ -1454,13 +1468,11 @@ do
;;
x--test=*)
- TESTMODE=1
FLX_INSTALL_DIR=${1:7}
shift
;;
x--test)
- TESTMODE=1
FLX_INSTALL_DIR=.
shift
;;
@@ -1986,132 +1998,6 @@ echo "---------"
exit $bad
-@head(1,'Package Manager Meta Info')
-@head(2,'GODI')
-This is the Godiva file originally used to
-create the GODI data. At the moment this is
-the authoritative meta data. However,
-godiva may not handle all the options
-we need -- so the generated makefile
-is included as well.
-
-@select(tangler('meta/godiva/flx.godiva','data'))
-Package: apps-felix
-@tangle('Version: '+config.flx_version)
-Revision: 0
-Depends:
-Build-Depends: godi-ocaml (> 3.08)
-@tangle('Sources: http://felix.sf.net/flx_'+config.flx_version+'_src.tgz')
-@tangle('Unpacks-To: flx_'+config.flx_version)
-Bytecode-Target: all
-Opt-Target: all
-Homepage: http://felix.sf.net
-Maintainer: John Skaller <ska...@users.sf.net>
-Options: configure
-Description: Felix Compiler
-Felix Compiler
-.
-
-@select(tangler('meta/godiva/flx.godiva_camlsyntax','data'))
-name = "felix";
-@tangle('version = "'+config.flx_version+'";')
-revision = 0;
-category = `apps;
-depends = [];
-build_depends = [`godi,"ocaml", Some (`gt, "3.08")];
-sources_site ="http://felix.sf.net/";
-@tangle('sources_basename= "flx_'+config.flx_version+'_src";')
-sources_extension = ".tgz";
-@tangle('sources_unpacksto = "flx_'+config.flx_version+'";')
-all_target= "all";
-opt_target= "all";
-homepage= "http://felix.sf.net";
-maintainer = "John Skaller <ska...@users.sf.net>";
-options= [`configure];
-short_desc = "Felix Compiler";
-long_desc = "Felix Compiler";
-confopts = [
- {
- name = "SUPPORT_DYNAMIC_LOADING";
- default = "1";
- description = "Whether to support dlopen loading";
- implementation = `configarg "--SUPPORT_DYNAMIC_LOADING"
- }
-];
-specfile = "meta/godiva/flx.godiva_camlsyntax";
-patches = [];
-filesdir = None;
-
-@select(tangler('meta/godi/DESCR','data'))
-Felix Compiler and tools.
-
-@doc()
-This makefile only here for reference (don't use it,
-it should be generated).
-
-@select(tangler('meta/godi/Makefile','data'))
-# This file was automatically generated by GODIVA
-.include "../../mk/bsd.prefs.mk"
-.include "../../mk/godi.pkg.mk"
-
-@tangle('VERSION= '+config.flx_version)
-PKGNAME= apps-felix-${VERSION}
-@tangle('PKGREVISION= '+config.godi_revision)
-@tangle('DISTNAME= flx_'+config.flx_version)
-@tangle('DISTFILES= flx_'+config.flx_version+'_src.tgz')
-CATEGORIES= apps
-MASTER_SITES= http://felix.sf.net/
-MAINTAINER= John Skaller <ska...@users.sf.net>
-HOMEPAGE= http://felix.sf.net
-COMMENT= Felix Compiler
-
-# confopt defaults:
-
-
-AUTOGENERATE_PLIST = yes
-PKG = apps-felix
-MAKE_FLAGS= PREFIX=${PREFIX}
-
-
-
-PATH:= ${LOCALBASE}/bin:"${PATH}"
-HAS_CONFIGURE = yes
-CONFIGURE_ARGS+= --prefix ${PREFIX}
-CONFIGURE_ENV+= ${BUILD_OCAMLFIND_ENV}
-USE_GMAKE = yes
-
-MAKE_ENV+= ${BUILD_OCAMLFIND_ENV} PKGBASE=${PKGBASE:Q}
-
-pre-configure-copy:
-. if exists(files)
- cd files && ${PAX} -rw -pp . ${WRKSRC}
-. endif
-
-pre-configure: pre-configure-copy
-
-pre-install-mkdirs:
-. for d in bin lib/ocaml/pkg-lib doc share man etc info sbin include
- ${_PKG_SILENT}${_PKG_DEBUG}mkdir -p ${PREFIX}/${d}
-. endfor
-. for n in 1 2 3 4 5 6 7 8 9
- ${_PKG_SILENT}${_PKG_DEBUG}mkdir -p ${PREFIX}/man/man${n}
-. endfor
-
-pre-install: pre-install-mkdirs
-
-ALL_TARGET= all
-.if ${GODI_HAVE_OCAMLOPT} == "yes"
-# ALL_TARGET+= all
-.endif
-
-post-install:
- mkdir -p ${PREFIX}/doc/${PKG}
-. for DOC in
- install -m 0644 ${WRKSRC}/${DOC} ${PREFIX}/doc/${PKG}
-. endfor
-
-.include "../../mk/bsd.pkg.mk"
-
@head(1,'Finish up')
Just cleaning up script now.
@make_executable(os.path.join('bin', 'flx.sh'))
commit 2960d0fcaa8810ebbdb48fd4975ab26e0ceb0e21
Author: skaller <Max.S...@gmail.com>
Date: Mon Oct 18 00:19:48 2010 +1100
Install option to retain file time stamps is "cp -Rp b src/ dst"
diff --git a/lpsrc/flx_maker.pak b/lpsrc/flx_maker.pak
index 3d3c967..8db770d 100644
--- a/lpsrc/flx_maker.pak
+++ b/lpsrc/flx_maker.pak
@@ -252,7 +252,7 @@ whilst grab == 1 and argno<System::argc do
println$ "Cannot create directory " + INSTALL_ROOT_TOPDIR;
System::exit 1;
done
- result=system("cp -ra "+FLX_INSTALL_DIR+" "+INSTALL_ROOT);
+ result=system("cp -Rp "+FLX_INSTALL_DIR+" "+INSTALL_ROOT);
if result == 0 do println "Install succeeded"
else println$ "Install failed, code = " + str(result);
done
commit 2dc112fbe00f65851115609be12549335a60cff5
Author: skaller <Max.S...@gmail.com>
Date: Mon Oct 18 00:12:48 2010 +1100
Remove all the spkg stuff cause it isn't used now.
Gets rid of some files too.
diff --git a/lpsrc/flx_demux.pak b/lpsrc/flx_demux.pak
index 38c763d..7d844e1 100644
--- a/lpsrc/flx_demux.pak
+++ b/lpsrc/flx_demux.pak
@@ -1,129 +1,6 @@
@import config
@head(1,'demux')
-@h = tangler('spkgs/demux.py')
-@select(h)
-import os
-
-import config
-
-DEMUXRTL_INTERFACES = [
- 'config/target/flx_demux_config.hpp', # portable
-
- # portable
- 'src/demux/flx_demux.hpp',
- 'src/demux/demux_demuxer.hpp',
- 'src/demux/demux_timer_queue.hpp',
- 'src/demux/demux_quitter.hpp',
-
- # windows (monolithic)
- 'src/demux/win/demux_iocp_demuxer.hpp',
- 'src/demux/win/demux_overlapped.hpp',
- 'src/demux/win/demux_win_timer_queue.hpp',
- 'src/demux/win/demux_wself_piper.hpp',
-
- # posix
- 'src/demux/posix/demux_posix_demuxer.hpp',
- 'src/demux/posix/demux_posix_timer_queue.hpp',
- 'src/demux/posix/demux_pfileio.hpp',
- 'src/demux/posix/demux_select_demuxer.hpp',
- 'src/demux/posix/demux_sockety.hpp',
- 'src/demux/posix/demux_self_piper.hpp',
- 'src/demux/posix/demux_ts_select_demuxer.hpp',
-
- # linux, 10.3 (select impl), 10.4 real.
- 'src/demux/poll/demux_poll_demuxer.hpp',
- 'src/demux/poll/demux_ts_poll_demuxer.hpp',
-
- 'src/demux/epoll/demux_epoll_demuxer.hpp', # linux (>= 2.6)
- 'src/demux/kqueue/demux_kqueue_demuxer.hpp', # osx(10.3 onwards)/bsd
- 'src/demux/evtport/demux_evtport_demuxer.hpp', # solaris (9 onwards?)
-]
-
-DEMUX_CPPS = [
- 'src/demux/flx_demux',
- 'src/demux/demux_quitter',
-]
-
-POSIX_DEMUX_CPPS = [
- 'src/demux/posix/demux_posix_demuxer', # posix
- 'src/demux/posix/demux_select_demuxer', # posix
- 'src/demux/posix/demux_posix_timer_queue', # posix
- 'src/demux/posix/demux_sockety', # posix
- 'src/demux/posix/demux_self_piper', # posix
- 'src/demux/posix/demux_pfileio', # posix
- 'src/demux/posix/demux_ts_select_demuxer', # posix
-]
-
-POLL_DEMUX_CPPS = [
- # I've seen poll on linux and osx10.4 systems.
- # conditionally compiled and used.
- 'src/demux/poll/demux_poll_demuxer', # I've seen this on linux and osx10.4
- 'src/demux/poll/demux_ts_poll_demuxer', # ditto
-]
-
-WINDOWS_DEMUX_CPPS = [
- 'src/demux/win/demux_iocp_demuxer', # windows
- 'src/demux/win/demux_overlapped', # windows
- 'src/demux/win/demux_wself_piper', # windows
- 'src/demux/win/demux_win_timer_queue', # windows
-]
-
-EXTRA_SYS_LIBS = ''
-if config.WIN32:
- DEMUX_CPPS = DEMUX_CPPS + WINDOWS_DEMUX_CPPS
- if config.HAVE_MSVC:
- EXTRA_SYS_LIBS = '/DEFAULTLIB:ws2_32 /DEFAULTLIB:mswsock '
- else:
- # mingw
- EXTRA_SYS_LIBS = '-lws2_32 -lmswsock '
-
-
-if config.POSIX:
- DEMUX_CPPS = DEMUX_CPPS + POSIX_DEMUX_CPPS
-
-if config.TARGET_CXX.options.HAVE_KQUEUE_DEMUXER:
- DEMUX_CPPS = DEMUX_CPPS + [ 'src/demux/kqueue/demux_kqueue_demuxer' ]
-
-if config.TARGET_CXX.options.HAVE_POLL:
- DEMUX_CPPS = DEMUX_CPPS + POLL_DEMUX_CPPS
-
-if config.TARGET_CXX.options.HAVE_EPOLL:
- DEMUX_CPPS = DEMUX_CPPS + [ 'src/demux/epoll/demux_epoll_demuxer' ] # Linux 2.6 +
-
-if config.TARGET_CXX.options.HAVE_EVTPORTS:
- DEMUX_CPPS = DEMUX_CPPS + [ 'src/demux/evtport/demux_evtport_demuxer'] # solaris 10
-
-if config.SOLARIS:
- # RF: this might not be necessary anymore.
- EXTRA_SYS_LIBS = '-lsocket -lnsl '
-
-cpp_cpps = DEMUX_CPPS
-lib_requires = ['libflx_pthread'] # however libflx not needed
-pkg_requires = ['flx_pthread', 'flx_rtl'] # flx_rtl for config .hpp
-dflags = EXTRA_SYS_LIBS
-sflags = EXTRA_SYS_LIBS
-build_macro = 'DEMUX'
-
-rtl_interfaces = DEMUXRTL_INTERFACES
-felix_rtl = ['src/demux/flx_demux.flx']
-
-iscr_source = [
- 'lpsrc/flx_demux.pak',
-]
-
-weaver_directory = 'doc/rtl/flx_demux/'
-tmpdir = ['demux']
-xfiles = [
- os.path.join('src', 'demux', '*'),
- os.path.join('src', 'demux', 'epoll', '*'),
- os.path.join('src', 'demux', 'evtport', '*'),
- os.path.join('src', 'demux', 'kqueue', '*'),
- os.path.join('src', 'demux', 'poll', '*'),
- os.path.join('src', 'demux', 'posix', '*'),
- os.path.join('src', 'demux', 'win', '*'),
-]
-
@h = tangler('config/demux.fpc')
@select(h)
Name: demux
diff --git a/lpsrc/flx_devutil.pak b/lpsrc/flx_devutil.pak
deleted file mode 100644
index 875e9d7..0000000
--- a/lpsrc/flx_devutil.pak
+++ /dev/null
@@ -1,1220 +0,0 @@
-@head(1,"Developer utility scripts")
-These script are NOT required to build Felix: they're utilies
-related to munging the original code into interscript format,
-and doing miscellaneous things during development.
-
-@head(2,'Attempt to produce Texinfo document')
-Hack up the tutorial: phase 1 of conversion to texinfo format.
-@h = tangler('script/mktitut.sed','python')
-@select(h)
-s/@set_title('\(.*\)')/\\input texinfo\n@settitle \1/
-s/@head(1,'\(.*\)')/@node \1\n@chapter \1/
-s/@head(1,"\(.*\)")/@node \1\n@chapter \1/
-s/@head(2,'\(.*\)')/@node \1\n@section \1/
-s/@head(2,"\(.*\)")/@node \1\n@section \1/
-s/@head(3,'\(.*\)')/@node \1\n@subsection \1/
-s/@head(3,"\(.*\)")/@node \1\n@subsection \1/
-s/@p()//
-s/@select.*/@verbatim/
-s/@doc()/@end verbatim/
-s/@begin_displayed_code()/@verbatim/
-s/@end_displayed_code()/@end verbatim/
-s/@tdir =.*//
-s/@execfile.*//
-s/@h=//
-s/@begin_table("\(.*\)","\(.*\)","\(.*\)")/@multitable @columnfractions .33 .33 .33\n@headitem \1 @tab \2 @tab \3/
-s/@begin_table("\(.*\)","\(.*\)")/@multitable @columnfractions .5 .5\n@headitem \1 @tab \2/
-s/@end_table()/@end multitable/
-s/@table_row("\(.*\)","\(.*\)","\(.*\)")/@item \1 @tab \2 @tab \3/
-s/@table_row("\(.*\)","\(.*\)")/@item \1 @tab \2/
-s/\\uXXXX/@verb{ \\uXXXX }/
-s/\\UXXXXXXXX/@verb{ \\UXXXXXXXX }/
-s/\\\\, \\', \\", \\r, \\n, \\t, \\b, \\v, \\f/@verb{ \\\\, \\', \\", \\r, \\n, \\t, \\b, \\v, \\f }/
-s/'else {}'\./@verb{.else {}.}/
-s/"{" /@verb{ { }/
-s/"}" /@verb{ } }/
-@doc()
-Now phase 2, a python script. There are some caveats
-on what it can handle: it generates just one menu.
-@h = tangler('script/mktitut.py','python')
-@select(h)
-# modify an texinfo file to add a menu of all the nodes
-# read from stdin, write to stout
-import sys
-
-crap1 = """
-@@copying
-This manual is for Felix version 1.1.0.
-Copyright @copyright{} 2005 John Skaller
-@@quotation
-All rights relinquished, you can do whatever you
-like with this manual.
-@@end quotation
-@@end copying
-
-@@titlepage
-@@title Felix Overview
-@@subtitle A quick guide to the basic ideas
-@@author John Skaller
-@@page
-@@vskip 0pt plus 1filll
-@@insertcopying
-@@end titlepage
-@@contents
-
-@@ifnottex
-"""
-
-crap2 = """
-@@top Overview
-
-@@insertcopying
-@@end ifnottex
-"""
-
-cache = []
-menu = []
-
-def nav(node):
- for i in xrange(0,n):
- if node == menu[i]:
- if i == 0: prev = "Top"
- else: prev = menu[i-1]
- if i == n-1: next = "Top"
- else: next = menu[i+1]
- return next,prev
-
-flag = 0
-for line in sys.stdin:
- if flag == 0:
- if '@node ' == line[:6]:
- node = line[6:-1]
- flag = 1
- cache.append(line)
- else:
- cache.append(line)
- else:
- if '@chapter' == line[:8]:
- #print "chapter"
- menu.append(node)
- elif '@section' == line[:8]:
- #print "section"
- menu.append(node)
- elif '@subsection' == line[:11]:
- #print "subsection"
- menu.append(node)
- else:
- print "ERROR, need chapter section or subsection here"
- print "got ",line,
- raise "error"
- cache.append('@section\n')
- flag = 0
-
-
-n = len(menu)
-
-for line in cache:
- if '@settitle' == line[:9]:
- print '@setfilename ' + sys.argv[1] # the filename
- print line,
- print crap1
- print "@node Top, "+menu[0]+", "+menu[n-1]+",(dir)"
- print crap2
- print '@menu'
- for item in menu:
- print "* " + item+":: "+item
- print '@end menu'
- elif '@node ' == line[:6]:
- node = line[6:-1]
- next,prev = nav(node)
- print '@node '+node+', '+next+', '+prev+', Top'
- else:
- print line,
-print
-
-@doc()
-This is input to equiv-build, which makes
-a dummy ocaml-3.08.3 package to satisfy
-the debian package dependencies.
-@h = tangler('misc/ocaml-nox-3.08.3-equiv','data')
-@select(h)
-Source: ocaml-nox-3.08.3
-Section: devel
-Priority: optional
-Maintainer: John Skaller <ska...@users.sourceforge.net>
-Standards-Version: 3.6.1
-
-Package: ocaml-nox-3.08.3
-Architecture: any
-Description: hack to tell system 0caml3.08.3 is installed
-
-@h = tangler('script/detab.py','python')
-@select(h)
-import string
-import sys
-
-f = open(sys.argv[1])
-data = f.readlines()
-f.close()
-f = open(sys.argv[1],"w")
-for line in data:
- line = string.expandtabs(line)
- f.write(line)
-f.close()
-
-@h = tangler('script/mkshoot.py','python')
-@select(h)
-import os
-import sys
-import glob
-import string
-root = "/home/skaller/shoot/shootout-scm-2007-05-14/shootout/bench"
-
-dirs = glob.glob(root+"/*")
-rejects = [
- "report.txt","LICENSE","Makefile","Makefile.mb","done.txt","Include","CVS",
- "tcprequest"]
-
-def basename (f): return string.split(f,"/")[-1]
-
-k = []
-for f in dirs:
- base = basename (f)
- if base not in rejects:
- k.append(base)
-
-k.sort()
-#for d in k: print d
-
-exts = [("gcc","c","c"),("ocaml","ml","ocaml"),("felix","flx","felix"),("gnat","ada","ada")]
-
-print r"""
-@def showgraph(machine,test,title):
- get_weaver()._write(
- '''<P></P><TABLE BORDER=2 ALIGN=center>
- <CAPTION>'''+title+'''</CAPTION>
- <TR><TD>
- <IMG ALT="'''+title+'''" SRC="machine/'''+machine+'''/images/'''+test+'''.jpg">
- </TD></TR></TABLE><P></P>
- ''')
-
-@def showdata(fn):
- begin_displayed_code()
- try:
- f = open(fn)
- data = f.read()
- f.close()
- lines = string.split(data,'\n')
- for line in lines: weave(line+'\n')
- except:
- weave(fn+" not available\n")
- end_displayed_code()
-
-
-@import glob
-@raw_machs = glob.glob("speed/machine/*")
-@machs = []
-@for i in raw_machs: machs.append(i[14:])
-
-"""
-
-for d in k:
- #print "Bench = "+d
- print "@head(1,'["+d+"]')"
- print "@for i in machs:"
- print " showgraph(i,'ack','"+d+" on '+i)"
- print " showdata('speed/machine/'+i+'/rankings/"+d+".txt')"
- print
- print "@select(tangler('speed/specs/"+d+".py'))"
- print "descr='"+d+"'"
- print "min=5"
- print "max=10"
- print
-
- for tag,ext,dir in exts:
- #print " Tag = " + tag+ ", ext = " + ext
- fls = glob.glob(root+"/"+d+"/*."+tag)
- for fn in fls:
- base = basename(fn)
- #print " file = " + base
- bn = string.split(base,".")
- if len (bn) == 2:
- print "@select(tangler('speed/src/"+dir+"/"+bn[0]+"."+ext+"'))"
- fi = open(fn)
- lines = fi.read()
- print lines
- fi.close()
-
-
-
-
-
-@h = tangler('script/mkjudy.py','python')
-@select(h)
-#
-# Judy .. it's a bit of a mess .. macro threaded for
-# code sharing
-#
-import string
-import os
-import sys
-
-prefix = '/home/skaller/judy/Judy-1.0.4/src'
-
-files = [
- 'Judy.h',
-
- 'JudyCommon/JudyMalloc.c',
- 'JudyCommon/JudyPrivate1L.h',
- 'JudyCommon/JudyPrivateBranch.h',
- 'JudyCommon/JudyPrivate.h',
-
- 'Judy1/Judy1ByCount.c',
- 'Judy1/Judy1Cascade.c',
- 'Judy1/Judy1Count.c',
- 'Judy1/Judy1CreateBranch.c',
- 'Judy1/Judy1Decascade.c',
- 'Judy1/Judy1First.c',
- 'Judy1/Judy1FreeArray.c',
- 'Judy1/Judy1.h',
- 'Judy1/Judy1InsertBranch.c',
- 'Judy1/Judy1MallocIF.c',
- 'Judy1/Judy1MemActive.c',
- 'Judy1/Judy1MemUsed.c',
- 'Judy1/Judy1Next.c',
- 'Judy1/Judy1NextEmpty.c',
- 'Judy1/Judy1Prev.c',
- 'Judy1/Judy1PrevEmpty.c',
- 'Judy1/Judy1SetArray.c',
- 'Judy1/Judy1Set.c',
- 'Judy1/Judy1Tables.c',
- 'Judy1/Judy1Tables32.c',
- 'Judy1/Judy1Tables64.c',
- 'Judy1/Judy1TablesGen.c',
- 'Judy1/j__udy1Test.c',
- 'Judy1/Judy1Test.c',
- 'Judy1/Judy1Unset.c',
-
- 'JudyL/JudyLByCount.c',
- 'JudyL/JudyLCascade.c',
- 'JudyL/JudyLCount.c',
- 'JudyL/JudyLCreateBranch.c',
- 'JudyL/JudyLDecascade.c',
- 'JudyL/JudyLDel.c',
- 'JudyL/JudyLFirst.c',
- 'JudyL/JudyLFreeArray.c',
- 'JudyL/j__udyLGet.c',
- 'JudyL/JudyLGet.c',
- 'JudyL/JudyL.h',
- 'JudyL/JudyLInsArray.c',
- 'JudyL/JudyLIns.c',
- 'JudyL/JudyLInsertBranch.c',
- 'JudyL/JudyLMallocIF.c',
- 'JudyL/JudyLMemActive.c',
- 'JudyL/JudyLMemUsed.c',
- 'JudyL/JudyLNext.c',
- 'JudyL/JudyLNextEmpty.c',
- 'JudyL/JudyLPrev.c',
- 'JudyL/JudyLPrevEmpty.c',
- 'JudyL/JudyLTables.c',
- 'JudyL/JudyLTables32.c',
- 'JudyL/JudyLTables64.c',
- 'JudyL/JudyLTablesGen.c',
-
- 'JudyHS/JudyHS.c',
- 'JudyHS/JudyHS.h',
-
- 'JudySL/JudySL.c',
- ]
-
-externs = [
-# JUDY1 FUNCTIONS
- 'Judy1Test',
- 'Judy1Set',
- 'Judy1SetArray',
- 'Judy1Unset',
- 'Judy1Count',
- 'Judy1ByCount',
- 'Judy1FreeArray',
- 'Judy1MemUsed',
- 'Judy1MemActive',
- 'Judy1First',
- 'Judy1Next',
- 'Judy1Last',
- 'Judy1Prev',
- 'Judy1FirstEmpty',
- 'Judy1NextEmpty',
- 'Judy1LastEmpty',
- 'Judy1PrevEmpty',
- 'JudyLGet',
- 'JudyLIns',
- 'JudyLInsArray',
-# JUDYL FUNCTIONS
- 'JudyLDel',
- 'JudyLCount',
- 'JudyLByCount',
- 'JudyLFreeArray',
- 'JudyLMemUsed',
- 'JudyLMemActive',
- 'JudyLFirst',
- 'JudyLNext',
- 'JudyLLast',
- 'JudyLPrev',
- 'JudyLFirstEmpty',
- 'JudyLNextEmpty',
- 'JudyLLastEmpty',
- 'JudyLPrevEmpty',
-# JUDYSL FUNCTIONS
- 'JudySLGet',
- 'JudySLIns',
- 'JudySLDel',
- 'JudySLFreeArray',
- 'JudySLFirst',
- 'JudySLNext',
- 'JudySLLast',
- 'JudySLPrev',
-# JUDYHSL FUNCTIONS:
- 'JudyHSGet',
- 'JudyHSIns',
- 'JudyHSDel',
- 'JudyHSFreeArray',
-# JUDY memory interface to malloc
- 'Judy1MallocSizes',
- 'JudyLMallocSizes',
- 'JudyMalloc',
- 'JudyMallocVirtual',
- 'JudyFree',
- 'JudyFreeVirtual',
-]
-
-cph = '// Copyright (C) 2000 - 2002 Hewlett-Packard Company'
-cpt = '// _________________'
-cphn = len(cph)
-cptn = len(cpt)
-
-print "@import config"
-print "@head(1,'Judy')"
-g = open("tmp.tmp","w")
-for fn in files:
- copy = 1
- print "@h=tangler('judy/"+fn+"')"
- print "@select(h)"
- print "#ifndef JUDY_EXTERN"
- print "#if defined(_WIN32) && !defined(FLX_STATIC_LINK)"
- print "#ifdef BUILD_JUDY"
- print "#define JUDY_EXTERN __declspec(dllexport)"
- print "#else"
- print "#define JUDY_EXTERN __declspec(dllimport)"
- print "#endif"
- print "#else"
- print "#define JUDY_EXTERN"
- print "#endif"
- print "#endif"
- print
- print "/* here JU_WIN <=> MSVC CL build */"
- print "#ifdef _MSC_VER"
- print "#define JU_WIN"
- print "#endif"
- print
- print
- f = open(prefix+'/'+fn)
- data = f.readlines()
- f.close()
- for line in data:
- line = string.expandtabs(line)
- if line[:cphn]==cph:
- copy = 0
- if copy:
- if line[:8]=="FUNCTION":
- s1 = string.split(line,"(")
- s2 = string.split(s1[0])
- if s2[1] in ["Word_t", "int", "PPvoid_t", "Pvoid_t"]:
- if s2[2][:4]=="Judy":
- t2 = [s2[0],s2[1],"JUDY_EXTERN"]+s2[2:]
- t2 = string.join(t2," ")
- t1 = [t2]+s1[1:]
- t1 = string.join(t1,"(")
- g.write(t1)
- line = t1+"\n"
- else:
- s1 = string.split(line,"(")
- s2 = string.split(s1[0])
- if len(s2)>=3 and s2[0]=='extern':
- if s2[2] in externs:
- t2 = [s2[0],s2[1],"JUDY_EXTERN"]+s2[2:]
- t2 = string.join(t2," ")
- t1 = [t2]+s1[1:]
- t1 = string.join(t1,"(")
- g.write(t1)
- line = t1+"\n"
- print line,
- if line[:cptn] == cpt:
- copy = 1
- print
-g.close()
-
-print "@head(1,'Judy wrappers')"
-compile = []
-
-judycommon = [
- 'JudyMalloc'
- ]
-
-for i in judycommon:
- compile.append("judy/JudyCommon/"+i)
-
-judy1 = [
- 'Judy1ByCount',
- 'Judy1Cascade',
- 'Judy1Count',
- 'Judy1CreateBranch',
- 'Judy1Decascade',
- 'Judy1First',
- 'Judy1FreeArray',
- 'Judy1InsertBranch',
- 'Judy1MallocIF',
- 'Judy1MemActive',
- 'Judy1MemUsed',
- 'Judy1SetArray',
- 'Judy1Set',
- 'Judy1Tables',
- 'Judy1Unset',
- ]
-
-for file in judy1:
- fn = 'judy/Judy1/JUDY1_'+file
- compile.append(fn)
- print "@select(tangler('"+fn+".c'))"
- print "#define JUDY1"
- print '#include "'+file+'.c"'
- print
-
-judy1next = [
- 'Judy1Next',
- 'Judy1NextEmpty',
-]
-
-for file in judy1next:
- fn = 'judy/Judy1/JUDY1_'+file
- compile.append(fn)
- print "@select(tangler('"+fn+".c'))"
- print "#define JUDY1"
- print "#define JUDYNEXT"
- print '#include "'+file+'.c"'
- print
-
-
-judy1prev = [
- 'Judy1Prev',
- 'Judy1PrevEmpty',
-]
-
-for file in judy1prev:
- fn = 'judy/Judy1/JUDY1_'+file
- compile.append(fn)
- print "@select(tangler('"+fn+".c'))"
- print "#define JUDY1"
- print "#define JUDYPREV"
- print '#include "'+file+'.c"'
- print
-
-judy1get= [
- 'Judy1Test',
- ]
-
-for file in judy1get:
- fn='judy/Judy1/JUDY1_'+file
- compile.append(fn)
- print "@select(tangler('"+fn+".c'))"
- print "#define JUDY1"
- print '#include "'+file+'.c"'
- print
-
-judy1geti = [
- 'j__udy1Test',
- ]
-
-for file in judy1geti:
- fn='judy/Judy1/JUDY1_'+file
- compile.append(fn)
- print "@select(tangler('"+fn+".c'))"
- print "#define JUDY1"
- print "#define JUDYGETINLINE"
- print '#include "'+file+'.c"'
- print
-
-
-judyl = [
- 'JudyLByCount',
- 'JudyLCascade',
- 'JudyLCount',
- 'JudyLCreateBranch',
- 'JudyLDecascade',
- 'JudyLDel',
- 'JudyLFirst',
- 'JudyLFreeArray',
- 'JudyLInsArray',
- 'JudyLIns',
- 'JudyLInsertBranch',
- 'JudyLMemActive',
- 'JudyLMemUsed',
- 'JudyLMallocIF',
- 'JudyLTables',
- ]
-
-for file in judyl:
- fn='judy/JudyL/JUDYL_'+file
- compile.append(fn)
- print "@select(tangler('"+fn+".c'))"
- print "#define JUDYL"
- print '#include "'+file+'.c"'
- print
-
-
-judylnext = [
- 'JudyLNext',
- 'JudyLNextEmpty',
- ]
-
-for file in judylnext:
- fn='judy/JudyL/JUDYL_'+file
- compile.append(fn)
- print "@select(tangler('"+fn+".c'))"
- print "#define JUDYL"
- print "#define JUDYNEXT"
- print '#include "'+file+'.c"'
- print
-
-
-judylprev = [
- 'JudyLPrev',
- 'JudyLPrevEmpty',
- ]
-
-for file in judylprev:
- fn='judy/JudyL/JUDYL_'+file
- compile.append(fn)
- print "@select(tangler('"+fn+".c'))"
- print "#define JUDYL"
- print "#define JUDYPREV"
- print '#include "'+file+'.c"'
- print
-
-judylget= [
- 'JudyLGet',
- ]
-
-for file in judylget:
- fn='judy/JudyL/JUDYL_'+file
- compile.append(fn)
- print "@select(tangler('"+fn+".c'))"
- print "#define JUDYL"
- print '#include "'+file+'.c"'
- print
-
-judylgeti = [
- 'j__udyLGet',
- ]
-
-for file in judylgeti:
- fn='judy/JudyL/JUDYL_'+file
- compile.append(fn)
- print "@select(tangler('"+fn+".c'))"
- print "#define JUDYL"
- print "#define JUDYGETINLINE"
- print '#include "'+file+'.c"'
- print
-
-judyHS = [
- 'JudyHS'
- ]
-
-for i in judyHS:
- compile.append("judy/JudyHS/"+i)
-
-@# ------- source package -------------------------------
-
-print "@head(1,'Judy source package')"
-print "@select(tangler('spkgs/flx_judy.py'))"
-print "rtl_interfaces = ['judy/Judy.h']"
-print "cc_ccs = ["
-for i in compile:
- print " '"+i+"',"
-print " ]"
-
-# this line is a HACK
-print "include_path=['judy/Judy1', 'judy/JudyL', 'judy/JudyCommon', 'judy']"
-print "if SIZEOF_VOIDP == 8:"
-print " macros=['JU_64BIT']"
-print "else:"
-print " macros=['JU_32BIT']"
-
-print "provides_lib = 'libflx_judy'"
-print "iscr_source = ['lpsrc/flx_judy.pak']"
-print "weaver_directory = 'doc/judy'"
-print "build_macro = 'JUDY'"
-print
-
-@# ------- run time library -------------------------------
-
-print "@head(1,'Judy run time library')"
-print "@select(tangler('config/flx_judy.fpc'))"
-print '@if HAVE_MSVC:'
-print ' tangle("provides_dlib: /DEFAULTLIB:flx_judy_dynamic")'
-print ' tangle("provides_slib: /DEFAULTLIB:flx_judy_static")'
-print ' else:'
-print ' tangle("provides_dlib: -lflx_judy_dynamic")'
-print ' tangle("provides_slib: -lflx_judy_static")'
-print
-
-@h = tangler('script/mkdemux.py','python')
-@select(h)
-
-import string
-import os
-import sys
-
-prefix = '/Users/gchilds/UnNeko/walker/demux/'
-
-tre_files = [
- 'demuxer.h',
- 'epoll_demuxer.h',
- 'evtport_demuxer.h',
- 'iocp_demuxer.h',
- 'kqueue_demuxer.h',
- 'pfileio.h',
- 'posix_demuxer.h',
- 'select_demuxer.h',
- 'ts_select_demuxer.h',
- 'timer_queue.h',
- 'posix_timer_queue.h',
- 'posix_timer_queue.cpp',
- 'win_timer_queue.h',
- 'win_timer_queue.cpp',
- 'demuxer.cpp',
- 'epoll_demuxer.cpp',
- 'evtport_demuxer.cpp',
- 'iocp_demuxer.cpp',
- 'overlapped.cpp',
- 'overlapped.h',
- 'kqueue_demuxer.cpp',
- 'pfileio.cpp',
- 'posix_demuxer.cpp',
- 'select_demuxer.cpp',
- 'ts_select_demuxer.cpp',
- 'sockety.h',
- 'self_piper.h',
- 'self_piper.cpp',
- ]
-
-mods = {}
-tgts = []
-
-for fn in tre_files:
- parts = string.split(fn,'/')
- base = parts[-1]
- if base[0:4]=='tre-':
- target = 'tre/tre_'+base[4:]
- else:
- target = 'demux/demux_'+base
- if target[-1:]=='cpp':
- target = target[:-1]+'cpp'
- elif target[-1:]=='h':
- target = target[:-1]+'hpp'
- tgts.append((prefix+fn,target))
-
-def index(line,ch):
- n = len (line)
- for i in range(0,n):
- if line[i]==ch: return i
- return -1
-
-def incl(line):
- hp = index(line,'#')
- if hp == -1: return ""
- line = line[hp:]
- if line[:10]=='#include "':
- line=line[10:]
- qp = index(line,'"')
- if qp == -1: return ""
- return line[:qp]
- else:
- return ""
-
-print "@head(1,'demux')"
-for fn,tgt in tgts:
- print "@h=tangler('"+tgt+"')"
- print "@select(h)"
- f = open(fn)
- data = f.readlines()
- f.close()
- for line in data:
- line = string.expandtabs(line,2)
- fl = incl(line)
- if fl:
- if fl in tre_files:
- dot = index(fl,".")
- if dot > 0:
- fl = fl[:dot]
- fl = fl+'.hpp'
- if fl[0:4]=="tre-":
- print '#include "demux_'+fl[4:]+'"'
- else:
- print '#include "demux_'+fl+'"'
- else:
- print "UNKNOWN FILE:",fl
- sys.exit(1)
- else:
- if line[:5] != '#line':
- print line,
-
-
-@h = tangler('script/mktre.py','python')
-@select(h)
-
-import string
-import os
-import sys
-
-prefix = '/work/tre-0.7.2/lib/'
-
-tre_files = [
- 'gettext.h',
- 'regcomp.c',
- 'regerror.c',
- 'regexec.c',
- 'regex.h',
- 'tre-ast.c',
- 'tre-ast.h',
- 'tre-compile.c',
- 'tre-compile.h',
- 'tre-config.h',
- 'tre-filter.c',
- 'tre-filter.h',
- 'tre-internal.h',
- 'tre-match-approx.c',
- 'tre-match-backtrack.c',
- 'tre-match-parallel.c',
- 'tre-match-utils.h',
- 'tre-mem.c',
- 'tre-mem.h',
- 'tre-parse.c',
- 'tre-parse.h',
- 'tre-stack.c',
- 'tre-stack.h',
- 'xmalloc.h',
- 'xmalloc.c',
- ]
-
-mods = {}
-tgts = []
-
-for fn in tre_files:
- parts = string.split(fn,'/')
- base = parts[-1]
- if base[0:4]=='tre-':
- target = 'tre/tre_'+base[4:]
- else:
- target = 'tre/tre_'+base
- if target[-1:]=='c':
- target = target[:-1]+'cpp'
- elif target[-1:]=='h':
- target = target[:-1]+'hpp'
- tgts.append((prefix+fn,target))
-
-def index(line,ch):
- n = len (line)
- for i in range(0,n):
- if line[i]==ch: return i
- return -1
-
-def incl(line):
- hp = index(line,'#')
- if hp == -1: return ""
- line = line[hp:]
- if line[:10]=='#include "':
- line=line[10:]
- qp = index(line,'"')
- if qp == -1: return ""
- return line[:qp]
- else:
- return ""
-
-print "@head(1,'tre')"
-for fn,tgt in tgts:
- print "@h=tangler('"+tgt+"')"
- print "@select(h)"
- f = open(fn)
- data = f.readlines()
- f.close()
- for line in data:
- line = string.expandtabs(line)
- fl = incl(line)
- if fl:
- if fl in tre_files:
- dot = index(fl,".")
- if dot > 0:
- fl = fl[:dot]
- fl = fl+'.hpp'
- if fl[0:4]=="tre-":
- print '#include "tre_'+fl[4:]+'"'
- else:
- print '#include "tre_'+fl+'"'
- else:
- print "UNKNOWN FILE:",fl
- sys.exit(1)
- else:
- if line[:5] != '#line':
- print line,
-
-
-@h = tangler('script/mkdypgen.py','python')
-@select(h)
-
-import string
-import os
-
-prefix = '/home/skaller/dypgen/dypgen'
-
-dyplib = """
-@@h = tangler('spkgs/dyplib.py')
-@@select(h)
-caml_interfaces = [
-# 'src/compiler/dyp/dyplib/sig',
- 'src/compiler/dyp/dyplib/dyp',
-]
-
-caml_implementations = [
- 'src/compiler/dyp/dyplib/priority_by_relation',
- 'src/compiler/dyp/dyplib/automaton',
- 'src/compiler/dyp/dyplib/gs',
-# 'src/compiler/dyp/dyplib/parser',
- 'src/compiler/dyp/dyplib/dyp',
-]
-
-#caml_pack = [
-# ("Dyp",'src/compiler/dyp/dyplib/dyp',[
-# 'src/compiler/dyp/dyplib/sig',
-# 'src/compiler/dyp/dyplib/gs',
-# 'src/compiler/dyp/dyplib/priority_by_relation',
-# 'src/compiler/dyp/dyplib/automaton',
-# 'src/compiler/dyp/dyplib/parser'
-# ])
-#]
-
-caml_include_paths = ['dypgen/dyplib']
-caml_provide_lib = 'src/compiler/dyp/dyplib/dyplib'
-iscr_source = ["lpsrc/dyp.pak"]
-weaver_directory = 'doc/dypgen/'
-
-"""
-
-pgen = """
-@@h = tangler('spkgs/pgen.py')
-@@select(h)
-caml_include_paths=['src','dypgen/dyplib','dypgen/generators/pgen']
-caml_lexes = ['dypgen/generators/pgen/pgen_lexer']
-caml_implementations=[
- 'src/compiler/dyp/generators/pgen/pgen_parser_param',
- 'src/compiler/dyp/generators/pgen/pgen_lexer'
-]
-caml_provide_lib = 'src/compiler/dyp/generators/pgen/pgen'
-caml_require_libs = ['flx_version','dyplib','pgen']
-caml_exes = ['dypgen/generators/pgen/pgen']
-iscr_source = ["lpsrc/dyp.pak"]
-weaver_directory = 'doc/dypgen/'
-pkg_requires = ['flx_version','dyplib']
-"""
-
-dypgen = """
-@@h = tangler('spkgs/dypgen.py')
-@@select(h)
-caml_lexes = [
- 'src/compiler/dyp/generators/dypgen/dypgen_lexer',
- 'src/compiler/dyp/generators/dypgen/insert_linenum'
-]
-
-caml_pgenparses = ['src/compiler/dyp/generators/dypgen/dypgen_parser']
-caml_interfaces =[
- 'src/compiler/dyp/generators/dypgen/parse_tree',
- 'src/compiler/dyp/generators/dypgen/dypgen_parser',
-]
-caml_implementations=[
- 'src/compiler/dyp/generators/dypgen/argument',
- 'src/compiler/dyp/generators/dypgen/dypgen_parser',
- 'src/compiler/dyp/generators/dypgen/dypgen_lexer',
- 'src/compiler/dyp/generators/dypgen/insert_linenum',
-]
-caml_include_paths=['src','dypgen/dyplib','dypgen/generators/dypgen']
-caml_provide_lib = 'src/compiler/dyp/generators/dypgen/dypgen'
-caml_require_libs = ['flx_version','dyplib','dypgen']
-caml_exes = ['dypgen/generators/dypgen/dypgen']
-iscr_source = ["lpsrc/dyp.pak"]
-pkg_requires = ['flx_version','dyplib','pgen']
-weaver_directory = 'doc/dypgen/'
-"""
-
-files = [
- 'dyplib/dyp.mli',
-# 'dyplib/sig.mli',
- 'dyplib/automaton.ml',
-# 'dyplib/parser.ml',
- 'dyplib/dyp.ml',
- 'dyplib/priority_by_relation.ml',
- 'dyplib/gs.ml',
- 'generators/pgen/pgen_lexer.mll',
- 'generators/pgen/pgen.ml',
- 'generators/pgen/pgen_parser_param.ml',
- 'generators/dypgen/dypgen_parser.dyp',
- 'generators/dypgen/parse_tree.mli',
- 'generators/dypgen/argument.ml',
- 'generators/dypgen/dypgen.ml',
- 'generators/dypgen/dypgen_lexer.mll',
- 'generators/dypgen/insert_linenum.mll'
-]
-
-mods = {}
-tgts = []
-
-print "@head(1,'Dypgen')"
-print dyplib
-print pgen
-print dypgen
-
-for fn in files:
- print "@h=tangler('dypgen/"+fn+"')"
- print "@select(h)"
- f = open(prefix+'/'+fn)
- data = f.readlines()
- f.close()
- for line in data:
- line = string.expandtabs(line)
- print line,
- print
-
-@h = tangler('script/mkocs.py','python')
-@select(h)
-
-import string
-import os
-
-prefix = '/home/skaller/scheme/ocs-1.0.2/src/'
-
-files = [
- 'ocs_char.ml',
- 'ocs_char.mli',
- 'ocs_compile.ml',
- 'ocs_compile.mli',
- 'ocs_complex.ml',
- 'ocs_complex.mli',
- 'ocs_contin.ml',
- 'ocs_contin.mli',
- 'ocs_env.ml',
- 'ocs_env.mli',
- 'ocs_error.ml',
- 'ocs_error.mli',
- 'ocs_eval.ml',
- 'ocs_eval.mli',
- 'ocs_io.ml',
- 'ocs_io.mli',
- 'ocs_lex.ml',
- 'ocs_lex.mli',
- 'ocs_list.ml',
- 'ocs_list.mli',
- 'ocs_macro.ml',
- 'ocs_macro.mli',
- 'ocs_main.ml',
- 'ocs_misc.ml',
- 'ocs_misc.mli',
- 'ocs_numaux.ml',
- 'ocs_numaux.mli',
- 'ocs_num.ml',
- 'ocs_num.mli',
- 'ocs_numstr.ml',
- 'ocs_numstr.mli',
- 'ocs_port.ml',
- 'ocs_port.mli',
- 'ocs_prim.ml',
- 'ocs_prim.mli',
- 'ocs_print.ml',
- 'ocs_print.mli',
- 'ocs_read.ml',
- 'ocs_read.mli',
- 'ocs_string.ml',
- 'ocs_string.mli',
- 'ocs_sym.ml',
- 'ocs_sym.mli',
- 'ocs_top.ml',
- 'ocs_top.mli',
- 'ocs_types.mli',
- 'ocs_vartable.ml',
- 'ocs_vartable.mli',
- 'ocs_vector.ml',
- 'ocs_vector.mli',
-]
-
-mods = {}
-tgts = []
-
-for fn in files:
- parts = string.split(fn,'/')
- base = parts[-1]
- target = 'ocs/'+base
- tgts.append((prefix+fn,target))
- i = string.index(base,'.')
-
-print "@head(1,'OCS')"
-print """
-@@h = tangler('spkgs/ocs.py')
-@@select(h)
-OCS_MODULES = [
- 'ocs/ocs_vartable',
- 'ocs/ocs_error',
- 'ocs/ocs_port',
- 'ocs/ocs_types',
- 'ocs/ocs_sym',
- 'ocs/ocs_env',
- 'ocs/ocs_char',
- 'ocs/ocs_numaux',
- 'ocs/ocs_complex',
- 'ocs/ocs_num',
- 'ocs/ocs_numstr',
- 'ocs/ocs_lex',
- 'ocs/ocs_misc',
- 'ocs/ocs_read',
- 'ocs/ocs_eval',
- 'ocs/ocs_list',
- 'ocs/ocs_compile',
- 'ocs/ocs_macro',
- 'ocs/ocs_prim',
- 'ocs/ocs_string',
- 'ocs/ocs_vector',
- 'ocs/ocs_print',
- 'ocs/ocs_io',
- 'ocs/ocs_contin',
- 'ocs/ocs_top',
-]
-
-caml_raw_interfaces = ['ocs/ocs_types']
-caml_interfaces = OCS_MODULES
-caml_implementations= OCS_MODULES
-caml_include_paths = ['src','ocs']
-caml_provide_lib = 'src/compiler/ocs/ocslib'
-caml_require_libs = ['nums','unix','flx_version','ocslib']
-caml_exes = ['ocs/ocs_main']
-iscr_src= ['lpsrc/ocs.pak']
-weaver_directory='doc/ocs'
-pkg_requires = ['flx_version']
-"""
-
-for fn,tgt in tgts:
- print "@h=tangler('"+tgt+"')"
- print "@select(h)"
- f = open(fn)
- data = f.readlines()
- f.close()
- for line in data:
- line = string.expandtabs(line)
- print line,
-
-@h = tangler('script/mkcil.py','python')
-@select(h)
-
-import string
-import os
-
-prefix = '/usr/local/src/cil/'
-files = [
- 'src/check.ml',
- 'src/check.mli',
- 'src/cil.ml',
- 'src/cil.mli',
- 'src/cilutil.ml',
- 'src/clist.ml',
- 'src/clist.mli',
- 'src/escape.ml',
- 'src/escape.mli',
- 'src/formatcil.ml',
- 'src/formatcil.mli',
- 'src/formatlex.mll',
- 'src/formatparse.mly',
- 'src/libmaincil.ml',
- 'src/maincil.ml',
- 'src/mergecil.ml',
- 'src/mergecil.mli',
- 'src/rmtmps.ml',
- 'src/rmtmps.mli',
- 'src/testcil.ml',
- 'src/frontc/cabs2cil.ml',
- 'src/frontc/cabs2cil.mli',
- 'src/frontc/cabs.ml',
- 'src/frontc/cabsvisit.ml',
- 'src/frontc/cabsvisit.mli',
- 'src/frontc/clexer.mli',
- 'src/frontc/clexer.mll',
- 'src/frontc/cparser.mly',
- 'src/frontc/cprint.ml',
- 'src/frontc/frontc.ml',
- 'src/frontc/frontc.mli',
- 'src/frontc/lexerhack.ml',
- 'src/frontc/patch.ml',
- 'src/frontc/patch.mli',
- 'ocamlutil/errormsg.ml',
- 'ocamlutil/errormsg.mli',
- 'ocamlutil/inthash.ml',
- 'ocamlutil/pretty.ml',
- 'ocamlutil/pretty.mli',
- 'ocamlutil/stats.ml',
- 'ocamlutil/stats.mli',
- 'ocamlutil/trace.ml',
- 'ocamlutil/trace.mli',
- 'ocamlutil/util.ml',
- 'ocamlutil/util.mli',
-]
-
-mods = {}
-tgts = []
-
-for fn in files:
- parts = string.split(fn,'/')
- base = parts[-1]
- target = 'src/flx_cil_'+base
- tgts.append((prefix+fn,target))
- i = string.index(base,'.')
- m = base[:i]
- mods[m.capitalize()]='Flx_cil_' + m
-
-ms = mods.keys()
-for k in ms:
- print mods[k]
-
-print "@head(1,'CIL')"
-for fn,tgt in tgts:
- print "@h=tangler('"+tgt+"')"
- print "@select(h)"
- f = open(fn)
- data = f.readlines()
- f.close()
- for line in data:
- line = string.expandtabs(line)
- for s in ms:
- r = mods[s]
- line = string.replace(line,s,r)
- print line,
-
-@h = tangler('script/mk_fish','python')
-@select(h)
-import glob
-glob = glob.glob
-
-for i in glob("*.mli")+glob("*.mll")+glob("*.mly")+glob("*.ml"):
- if i not in ["parse_fish.ml","lex_fish.ml"]:
- print '@head(2,"'+i+'")'
- print i+"."
- print '@select(tangler("src/'+i+'"))'
- f = open(i)
- for j in f: print j,
- f.close()
- print
-
-
diff --git a/lpsrc/flx_doc.pak b/lpsrc/flx_doc.pak
index fc96dda..12b0a36 100644
--- a/lpsrc/flx_doc.pak
+++ b/lpsrc/flx_doc.pak
@@ -159,9 +159,3 @@ Felix Build system source code listing (interscript):
@cite_url("flx/flx_maker/en_flx_maker_top.html")
@p()
-
-@select(tangler('spkgs/doc.py'))
-iscr_source = ["lpsrc/flx_doc.pak"]
-weaver_directory = 'doc/'
-
-
diff --git a/lpsrc/flx_faio.pak b/lpsrc/flx_faio.pak
index 6243266..59f3ab2 100644
--- a/lpsrc/flx_faio.pak
+++ b/lpsrc/flx_faio.pak
@@ -18,66 +18,6 @@ Version: $Id$
tangle('includes: \'"faio_posixio.hpp"\'')
Requires: demux
-@select(tangler('spkgs/faio.py'))
-import os
-
-import config
-
-FAIORTL_INTERFACES = [
- 'config/target/flx_faio_config.hpp',
- 'src/faio/faio_asyncio.hpp',
- 'src/faio/faio_job.hpp',
- 'src/faio/faio_timer.hpp',
- 'src/faio/faio_posixio.hpp',
- 'src/faio/faio_winio.hpp',
-]
-
-FAIO_CPPS = [
- "src/faio/faio_timer",
- "src/faio/faio_job",
- "src/faio/faio_asyncio",
-]
-
-POSIX_FAIO_CPPS = [
- "src/faio/faio_posixio",
-]
-
-WINDOWS_FAIO_CPPS = [
- "src/faio/faio_winio",
-]
-
-root = config.src_dir
-EXTRA_TEST_GLOBS = [('test', 'faio', 'faio-*.flx')]
-
-if config.WIN32:
- FAIO_CPPS = FAIO_CPPS + WINDOWS_FAIO_CPPS
- EXTRA_TEST_GLOBS.append(('test', 'faio', 'win-*.flx'))
-
-if config.POSIX:
- FAIO_CPPS = FAIO_CPPS + POSIX_FAIO_CPPS
- EXTRA_TEST_GLOBS.append(('test', 'faio', 'posix-*.flx'))
-
-cpp_cpps = FAIO_CPPS
-build_macro = "FAIO"
-
-rtl_interfaces = FAIORTL_INTERFACES
-felix_rtl = [
- 'src/faio/flx_faio.flx',
- 'src/faio/flx_faio_posix.flx',
- 'src/faio/flx_faio_win32.flx',
- 'src/faio/flx_socket.flx',
- 'src/faio/flx_stream.flx',
-]
-
-pkg_requires = ['demux','flx_pthread', 'flx_rtl'] # flx_rtl for rtl_config.
-lib_requires = ['libdemux','libflx_pthread'] # however lib not required
-unit_tests = EXTRA_TEST_GLOBS
-demos = [('demos', 'faio', '*.flx')]
-iscr_source = ["lpsrc/flx_faio.pak"]
-weaver_directory = 'doc/rtl/flx_faio/'
-tmpdir = ['faio']
-xfiles = [os.path.join('src', 'faio', '*')]
-
@h=tangler('config/target/flx_faio_config.hpp')
@select(h)
#ifndef __FLX_FAIO_CONFIG_H__
diff --git a/lpsrc/flx_gc.pak b/lpsrc/flx_gc.pak
index 76cdafb..8f9b834 100644
--- a/lpsrc/flx_gc.pak
+++ b/lpsrc/flx_gc.pak
@@ -40,31 +40,6 @@ around the malloc/free interface. It is provided primarily
to allow instrumentation of allocations, although it is possible
to supply a user written allocator.
-@h = tangler('spkgs/flx_gc.py')
-@select(h)
-import os
-
-cpp_cpps = [
- 'src/gc/flx_gc',
- 'src/gc/flx_collector',
- 'src/gc/flx_ts_collector'
- ]
-
-rtl_interfaces = [
- 'src/gc/flx_gc.hpp',
- 'src/gc/flx_collector.hpp',
- 'src/gc/flx_gc_private.hpp',
- 'src/gc/flx_ts_collector.hpp'
-]
-
-provides_lib = "libflx_gc"
-pkg_requires = ['flx_judy', 'flx_exceptions', 'flx_pthread']
-lib_requires = ['libflx_judy', 'libflx_exceptions', 'libflx_pthread']
-iscr_source = ['lpsrc/flx_gc.pak']
-build_macro = "FLX_GC"
-weaver_directory = 'doc/rtl/flx_gc/'
-xfiles = [os.path.join('src', 'gc', '*')]
-
@h = tangler('config/flx_gc.fpc')
@select(h)
Name: flx_gc
diff --git a/lpsrc/flx_glob.pak b/lpsrc/flx_glob.pak
index c1da3be..fe9678f 100644
--- a/lpsrc/flx_glob.pak
+++ b/lpsrc/flx_glob.pak
@@ -17,34 +17,6 @@ Version: $Id$
else:
pass
-@h = tangler('spkgs/flx_glob.py')
-@select(h)
-import os
-import glob
-
-import config
-
-iscr_source = ["lpsrc/flx_glob.pak"]
-weaver_directory = 'doc/rtl/flx_glob/'
-xfiles = [os.path.join('src', 'unixem', '*')]
-
-rtl_interfaces = ['config/target/flx_glob_config.hpp', 'src/unixem/flx_glob.hpp']
-felix_rtl = ['src/unixem/glob.flx']
-
-cpp_cpps = []
-if config.WIN32:
- cpp_cpps.extend([
- 'src/unixem/flx_glob',
- 'src/unixem/unixem_util',
- ])
-
-lib_requires = ['libflx_gc']
-pkg_requires = ['flx_rtl'] # flx_rtl provides flx_rtl_config.hpp
-build_macro = "GLOB"
-
-root = config.src_dir
-unit_tests = [('test', 'glob', 'glob-*.flx')]
-
@h=tangler('config/target/flx_glob_config.hpp')
@select(h)
#ifndef __FLX_GLOB_CONFIG_H__
diff --git a/lpsrc/flx_gmp.pak b/lpsrc/flx_gmp.pak
index e41e329..4c0cfcf 100644
--- a/lpsrc/flx_gmp.pak
+++ b/lpsrc/flx_gmp.pak
@@ -19,18 +19,6 @@ except ImportError:
pa(f, locals(), "HAVE_GMPXX")
f.close()
-@h = tangler('spkgs/gmpxx.py')
-@select(h)
-import config
-from cpkgs.target.gmpxx import HAVE_GMPXX
-
-if HAVE_GMPXX:
- root = config.src_dir
- unit_tests = [('test', 'gmp', 'gmp-*.flx')]
-
-iscr_source = ['lpsrc/flx_gmp.pak']
-weaver_directory = 'doc/gmp/'
-
@h = tangler('config/gmpxx.fpc')
@select(h)
requires_slibs: -lgmp
diff --git a/lpsrc/flx_judy.pak b/lpsrc/flx_judy.pak
index 6934643..6e4cb59 100644
--- a/lpsrc/flx_judy.pak
+++ b/lpsrc/flx_judy.pak
@@ -1,93 +1,5 @@
@import config
-@head(1,'Judy source package')
-@select(tangler('spkgs/flx_judy.py'))
-import os
-import glob
-
-import config
-
-iscr_source = ['lpsrc/flx_judy.pak']
-weaver_directory = 'doc/judy'
-
-xfiles = [
- os.path.join('src', 'judy', '*'),
- os.path.join('src', 'judy', 'Judy1', '*'),
- os.path.join('src', 'judy', 'JudyCommon', '*'),
- os.path.join('src', 'judy', 'JudyHS', '*'),
- os.path.join('src', 'judy', 'JudyL', '*'),
- os.path.join('src', 'judy', 'JudySL', '*'),
-]
-
-rtl_interfaces = [
- 'src/judy/Judy.h'
-]
-
-felix_rtl = [
- 'src/judy/judy.flx',
-]
-
-cc_ccs = [
- 'src/judy/JudyCommon/JudyMalloc',
- 'src/judy/Judy1/JUDY1_Judy1ByCount',
- 'src/judy/Judy1/JUDY1_Judy1Cascade',
- 'src/judy/Judy1/JUDY1_Judy1Count',
- 'src/judy/Judy1/JUDY1_Judy1CreateBranch',
- 'src/judy/Judy1/JUDY1_Judy1Decascade',
- 'src/judy/Judy1/JUDY1_Judy1First',
- 'src/judy/Judy1/JUDY1_Judy1FreeArray',
- 'src/judy/Judy1/JUDY1_Judy1InsertBranch',
- 'src/judy/Judy1/JUDY1_Judy1MallocIF',
- 'src/judy/Judy1/JUDY1_Judy1MemActive',
- 'src/judy/Judy1/JUDY1_Judy1MemUsed',
- 'src/judy/Judy1/JUDY1_Judy1SetArray',
- 'src/judy/Judy1/JUDY1_Judy1Set',
- 'src/judy/Judy1/JUDY1_Judy1Tables',
- 'src/judy/Judy1/JUDY1_Judy1Unset',
- 'src/judy/Judy1/JUDY1_Judy1Next',
- 'src/judy/Judy1/JUDY1_Judy1NextEmpty',
- 'src/judy/Judy1/JUDY1_Judy1Prev',
- 'src/judy/Judy1/JUDY1_Judy1PrevEmpty',
- 'src/judy/Judy1/JUDY1_Judy1Test',
- 'src/judy/Judy1/JUDY1_j__udy1Test',
- 'src/judy/JudyL/JUDYL_JudyLByCount',
- 'src/judy/JudyL/JUDYL_JudyLCascade',
- 'src/judy/JudyL/JUDYL_JudyLCount',
- 'src/judy/JudyL/JUDYL_JudyLCreateBranch',
- 'src/judy/JudyL/JUDYL_JudyLDecascade',
- 'src/judy/JudyL/JUDYL_JudyLDel',
- 'src/judy/JudyL/JUDYL_JudyLFirst',
- 'src/judy/JudyL/JUDYL_JudyLFreeArray',
- 'src/judy/JudyL/JUDYL_JudyLInsArray',
- 'src/judy/JudyL/JUDYL_JudyLIns',
- 'src/judy/JudyL/JUDYL_JudyLInsertBranch',
- 'src/judy/JudyL/JUDYL_JudyLMemActive',
- 'src/judy/JudyL/JUDYL_JudyLMemUsed',
- 'src/judy/JudyL/JUDYL_JudyLMallocIF',
- 'src/judy/JudyL/JUDYL_JudyLTables',
- 'src/judy/JudyL/JUDYL_JudyLNext',
- 'src/judy/JudyL/JUDYL_JudyLNextEmpty',
- 'src/judy/JudyL/JUDYL_JudyLPrev',
- 'src/judy/JudyL/JUDYL_JudyLPrevEmpty',
- 'src/judy/JudyL/JUDYL_JudyLGet',
- 'src/judy/JudyL/JUDYL_j__udyLGet',
- 'src/judy/JudyHS/JudyHS',
-]
-
-include_path=['src/judy/Judy1', 'src/judy/JudyL', 'src/judy/JudyCommon', 'src/judy']
-
-if config.TARGET_CC.options.SIZEOF_VOIDP == 8:
- macros=['JU_64BIT']
-else:
- macros=['JU_32BIT']
-
-build_macro = 'JUDY'
-
-provides_lib = 'libflx_judy'
-
-root = config.src_dir
-unit_tests = [('test', 'judy', 'judy-*.flx')]
-
@head(1,'Judy run time library')
@select(tangler('config/flx_judy.fpc'))
@if config.HAVE_MSVC:
diff --git a/lpsrc/flx_linux.pak b/lpsrc/flx_linux.pak
index 4f9bfb2..2d6b594 100644
--- a/lpsrc/flx_linux.pak
+++ b/lpsrc/flx_linux.pak
@@ -2,19 +2,6 @@
@head(1,'Felix Library: Linux support')
-@select(tangler('spkgs/plat_linux.py'))
-import config
-
-if config.LINUX:
- pkg_provides = ['plat_linux']
- cpp_cpps = ['src/plat/linux/plat_linux']
- provides_lib = "libplat_linux"
-
-iscr_source = ['lpsrc/flx_linux.pak']
-build_macro = "LINUX"
-rtl_interfaces = [ 'src/plat/linux/plat_linux.hpp' ]
-
-
@select(tangler('config/target/plat_linux.fpc', 'data'))
Description: Linux specific
@if config.LINUX:
diff --git a/lpsrc/flx_maker.pak b/lpsrc/flx_maker.pak
index 2c6ba70..3d3c967 100644
--- a/lpsrc/flx_maker.pak
+++ b/lpsrc/flx_maker.pak
@@ -29,30 +29,6 @@ for ch in data:
counter = 0
print()
-@h = tangler('spkgs/tutorial.py')
-@select(h)
-pkg_requires = [
- 'flx_tutorial',
- 'flx_tut_macro',
- 'flx_tut_bind',
- 'flx_tut_migrate'
- ]
-
-iscr_source = [
- 'lpsrc/flx_tutorial',
- 'lpsrc/flx_tut_macro',
- 'lpsrc/flx_tut_bind',
- 'lpsrc/flx_tut_migrate',
- ]
-
-@select(tangler('spkgs/flx_maker.py'))
-iscr_source = ['lpsrc/flx_maker.pak']
-
-weaver_directory = 'doc/flx/flx_maker/'
-
-@select(tangler('spkgs/__init__.py'))
-@doc()
-
@head(1,'AUTHORS')
@select(tangler('AUTHORS'))
John (Max) Skaller skaller at users dot sourceforge dot net
@@ -276,7 +252,7 @@ whilst grab == 1 and argno<System::argc do
println$ "Cannot create directory " + INSTALL_ROOT_TOPDIR;
System::exit 1;
done
- result=system("cp -r "+FLX_INSTALL_DIR+" "+INSTALL_ROOT);
+ result=system("cp -ra "+FLX_INSTALL_DIR+" "+INSTALL_ROOT);
if result == 0 do println "Install succeeded"
else println$ "Install failed, code = " + str(result);
done
diff --git a/lpsrc/flx_man.pak b/lpsrc/flx_man.pak
index 4383487..7788633 100644
--- a/lpsrc/flx_man.pak
+++ b/lpsrc/flx_man.pak
@@ -6,10 +6,6 @@
@gmtime = time.gmtime(now)
@short_time = time.strftime("%a %d %b %Y",gmtime)
@head(1,'Man pages')
-@h = tangler('spkgs/flx_man.py')
-@select(h)
-iscr_source = ['lpsrc/flx_man.pak']
-
@python('//')
manfoot = r"""
.SH VERSION
diff --git a/lpsrc/flx_mmap.pak b/lpsrc/flx_mmap.pak
index d2aeb3f..c82f8c9 100644
--- a/lpsrc/flx_mmap.pak
+++ b/lpsrc/flx_mmap.pak
@@ -2,16 +2,6 @@
@head(1,"Address space management")
-@select(tangler('spkgs/mmap.py'))
-import config
-
-if config.TARGET_CXX.options.HAVE_MMAP:
- root = config.src_dir
- unit_tests = [('test', 'mmap', 'mmap-*.flx')]
-
-iscr_source = ['lpsrc/flx_mmap.pak']
-weaver_directory = 'doc/mmap/'
-
@select(tangler('config/mmap.fpc', 'data'))
Name: mmap
diff --git a/lpsrc/flx_perf.pak b/lpsrc/flx_perf.pak
index 50cc402..0ece675 100644
--- a/lpsrc/flx_perf.pak
+++ b/lpsrc/flx_perf.pak
@@ -1,10 +1,5 @@
@set_title('Performance Measurements')
-@select(tangler('spkgs/speed.py'))
-pkg_requires = ["flx"]
-iscr_source = ["lpsrc/flx_perf.pak"]
-weaver_directory = 'speed/'
-
@head(1,"How Fast is Felix?")
This module contains codes to compare the Felix translator
with other language translators. Each translator should be run
diff --git a/lpsrc/flx_pthread.pak b/lpsrc/flx_pthread.pak
index 703e8dc..d76d95d 100644
--- a/lpsrc/flx_pthread.pak
+++ b/lpsrc/flx_pthread.pak
@@ -29,93 +29,6 @@ Version: $Id$
includes: '"pthread_thread.hpp"'
Requires: flx_gc
-@h = tangler('spkgs/flx_pthread.py')
-@select(h)
-import os
-
-import config
-
-PTHREADRTL_INTERFACES = [
- 'src/pthread/pthread_thread.hpp', # portable
- 'src/pthread/pthread_win_posix_condv_emul.hpp', # win32 and posix
- 'src/pthread/pthread_mutex.hpp', # portable
- 'src/pthread/pthread_counter.hpp', # portable
- 'src/pthread/pthread_waitable_bool.hpp', # portable
- 'src/pthread/pthread_condv.hpp', # portable
- 'src/pthread/pthread_semaphore.hpp', # portable
- 'src/pthread/pthread_monitor.hpp', # portable
- 'src/pthread/pthread_sleep_queue.hpp', # portable
- 'src/pthread/pthread_work_fifo.hpp', # portable
-]
-
-PTHREAD_CPPS = [
- "src/pthread/pthread_win_posix_condv_emul", # portability hackery
- "src/pthread/pthread_mutex",
- "src/pthread/pthread_condv",
- "src/pthread/pthread_counter",
- "src/pthread/pthread_waitable_bool",
- "src/pthread/pthread_semaphore",
- "src/pthread/pthread_monitor",
- "src/pthread/pthread_sleep_queue",
- "src/pthread/pthread_work_fifo",
- "src/pthread/pthread_thread_control",
-]
-
-POSIX_PTHREAD_CPPS = [
- 'src/pthread/pthread_posix_thread',
-]
-
-LINUX_PTHREAD_CPPS = [
-]
-
-SOLARIS_PTHREAD_CPPS = [
-]
-
-WINDOWS_PTHREAD_CPPS = [
- 'src/pthread/pthread_win_thread',
-]
-
-BSD_PTHREAD_CPPS = [
-]
-
-EXTRA_SYS_LIBS = ""
-if config.WIN32:
- PTHREAD_CPPS = PTHREAD_CPPS + WINDOWS_PTHREAD_CPPS
-
-if config.POSIX:
- PTHREAD_CPPS = PTHREAD_CPPS + POSIX_PTHREAD_CPPS
-
-if config.LINUX:
- PTHREAD_CPPS = PTHREAD_CPPS + LINUX_PTHREAD_CPPS
-
-if config.BSD or config.MACOSX:
- PTHREAD_CPPS = PTHREAD_CPPS + BSD_PTHREAD_CPPS
-
-if config.SOLARIS:
- PTHREAD_CPPS = PTHREAD_CPPS + SOLARIS_PTHREAD_CPPS
- EXTRA_SYS_LIBS = "-lrt " # man sem_wait
-
-if config.TARGET_CXX.options.HAVE_PTHREADS:
- EXTRA_SYS_LIBS=EXTRA_SYS_LIBS+config.TARGET_CXX.options.PTHREAD_SWITCH
-
-root = config.src_dir
-completion_tests = [('test', 'pthread', 'pthread-*.flx')]
-
-cpp_cpps = PTHREAD_CPPS
-lib_requires = ['libflx_exceptions']
-dflags = EXTRA_SYS_LIBS
-sflags = EXTRA_SYS_LIBS
-build_macro = "PTHREAD"
-
-rtl_interfaces = PTHREADRTL_INTERFACES
-felix_rtl = ['src/pthread/pthread.flx']
-
-pkg_requires = ['flx_exceptions','flx_rtl_config']
-iscr_source = ["lpsrc/flx_pthread.pak"]
-weaver_directory = 'doc/rtl/flx_pthread/'
-tmpdir = ['pthread']
-xfiles= [os.path.join('src', 'pthread', '*')]
-
@h=tangler('config/target/flx_pthread_config.hpp')
@select(h)
#ifndef __FLX_PTHREAD_CONFIG_H__
diff --git a/lpsrc/flx_ref.pak b/lpsrc/flx_ref.pak
index 74f230a..bca80c5 100644
--- a/lpsrc/flx_ref.pak
+++ b/lpsrc/flx_ref.pak
@@ -1,10 +1,5 @@
@import config.flx_data as flx_data
-@h = tangler('spkgs/flx_ref.py')
-@select(h)
-iscr_source = ['lpsrc/flx_ref.pak']
-weaver_directory = 'doc/refman/'
-
@set_title("Felix Reference")
@head(1,"Conformance Model")
This document purports to be a descripton of required behaviour
diff --git a/lpsrc/flx_regress.pak b/lpsrc/flx_regress.pak
deleted file mode 100644
index 0072e67..0000000
--- a/lpsrc/flx_regress.pak
+++ /dev/null
@@ -1,107 +0,0 @@
-@import config
-
-@set_title('Regression Tests')
-
-@head(1, 'Packages')
-@select(tangler('spkgs/flx_regression_tests_rt.py'))
-import config
-
-root = config.src_dir
-unit_tests = [('test', 'regress', 'rt', '*.flx')]
-
-pkg_requires = ['flx_compiler','flx_drivers']
-iscr_source = ['lpsrc/flx_regress.pak']
-
-weaver_directory = 'doc/test/regress'
-@doc()
-
-
-@select(tangler('spkgs/flx_regression_tests_srt.py'))
-import config
-
-root = config.src_dir
-static_unit_tests = [('test', 'regress', 'srt', '*.flx')]
-
-pkg_requires = ['flx_compiler','flx_drivers','flx_regression_tests_rt']
-iscr_source = ['lpsrc/flx_regress.pak']
-
-weaver_directory = 'doc/test/'
-@doc()
-
-
-@select(tangler('spkgs/flx_regression_tests_drt.py'))
-import config
-
-root = config.src_dir
-dynamic_unit_tests = [('test', 'regress', 'drt', '*.flx')]
-
-pkg_requires = ['flx_compiler','flx_drivers','flx_regression_tests_rt']
-iscr_source = ['lpsrc/flx_regress.pak']
-
-weaver_directory = 'doc/test/'
-@doc()
-
-
-@select(tangler('spkgs/flx_regression_tests_nd.py'))
-import config
-
-root = config.src_dir
-completion_tests = [('test', 'regress', 'nd', '*.flx')]
-
-pkg_requires = ['flx_compiler','flx_drivers']
-iscr_source = ['lpsrc/flx_regress.pak']
-
-weaver_directory = 'doc/test/'
-@doc()
-
-
-@select(tangler('spkgs/flx_regression_tests_pt.py'))
-import config
-
-root = config.src_dir
-perform_tests = [('test', 'regress', 'pt', '*.flx')]
-
-pkg_requires = ['flx_compiler','flx_drivers']
-iscr_source = ['lpsrc/flx_regress.pak']
-
-weaver_directory = 'doc/test/'
-@doc()
-
-
-@select(tangler('spkgs/flx_regression_tests_bt.py'))
-import config
-
-root = config.src_dir
-
-# these are supposed to fail!
-failures_tests = [('test', 'regress', 'bt', '*.flx')]
-
-pkg_requires = ['flx_compiler','flx_drivers']
-iscr_source = ['lpsrc/flx_regress.pak']
-
-weaver_directory = 'doc/test/'
-@doc()
-
-@select(tangler('spkgs/flx_regression_tests_kf.py'))
-import config
-
-root = config.src_dir
-
-# these are supposed to fail!
-known_failures_tests = [('test', 'regress', 'kf', '*.flx')]
-
-pkg_requires = ['flx_compiler','flx_drivers']
-iscr_source = ['lpsrc/flx_regress.pak']
-
-weaver_directory = 'doc/test/'
-
-@select(tangler('spkgs/flx_regression_tests.py'))
-pkg_requires = [
- 'flx_regression_tests_rt', 'flx_regression_tests_drt',
- 'flx_regression_tests_nd', 'flx_regression_tests_bt',
- 'flx_regression_tests_kf']
-iscr_source = ['lpsrc/flx_regress.pak']
-
-weaver_directory = 'doc/test/'
-tmpdir = ['test']
-
diff --git a/lpsrc/flx_rtl.pak b/lpsrc/flx_rtl.pak
index ab89b0f..194224c 100644
--- a/lpsrc/flx_rtl.pak
+++ b/lpsrc/flx_rtl.pak
@@ -14,113 +14,6 @@ The code all lives in directory rtl, the run time
library support directory. The symbols are defined
in namespace flx::rtl, except as noted.
-@select(tangler('spkgs/flx_exceptions.py'))
-import os
-
-cpp_cpps = [
- "src/exceptions/flx_exceptions",
-]
-
-rtl_interfaces = [
- 'config/target/flx_exceptions_config.hpp',
- 'src/exceptions/flx_exceptions.hpp',
-]
-
-pkg_requires = ['flx_rtl_config']
-provides_lib = "libflx_exceptions"
-iscr_source = ['lpsrc/flx_rtl.pak']
-build_macro = "FLX_EXCEPTIONS"
-weaver_directory = 'doc/rtl/flx_exceptions/'
-xfiles = [os.path.join('src', 'exceptions', '*')]
-@doc()
-
-@select(tangler('spkgs/flx_rtl.py'))
-import os
-
-cpp_cpps = [
- "src/rtl/flx_rtl",
- "src/rtl/flx_dynlink",
- "src/rtl/flx_sync",
- "src/rtl/flx_eh",
- "src/rtl/flx_i18n",
- "src/rtl/flx_ioutil",
- "src/rtl/flx_strutil",
- "src/rtl/flx_executil",
- "src/rtl/flx_main",
-]
-
-rtl_interfaces = [
- "src/rtl/flx_rtl.hpp",
- 'src/rtl/flx_compiler_support_headers.hpp',
- 'src/rtl/flx_compiler_support_bodies.hpp',
- 'src/rtl/flx_dynlink.hpp',
- 'src/rtl/flx_i18n.hpp',
- 'src/rtl/flx_ioutil.hpp',
- 'src/rtl/flx_strutil.hpp',
- 'src/rtl/flx_executil.hpp',
-]
-
-provides_lib = "libflx"
-lib_requires = ['libflx_exceptions','libflx_gc','libflx_judy','libflx_pthread']
-pkg_requires = ['flx_exceptions','flx_gc','flx_pthread']
-iscr_source = ['lpsrc/flx_rtl.pak']
-build_macro = "RTL"
-weaver_directory = 'doc/rtl/flx_rtl/'
-xfiles = [os.path.join('src', 'rtl', '*')]
-@doc()
-
-@select(tangler('spkgs/flx.py'))
-pkg_requires = ['flx_compiler','flx_drivers','flx_rtl','flx_gc','flx_pthread','demux','faio','flx_stdlib']
-@doc()
-
-@select(tangler('spkgs/flx_async.py'))
-cpp_cpps = ['src/flx_async/flx_async']
-provides_lib = "libflx_async"
-pkg_requires = ['faio','demux','flx_pthread','flx_rtl','flx_gc']
-lib_requires = ['libfaio','libdemux','libflx_pthread','libflx','libflx_gc','libflx_judy', 'libflx_exceptions']
-iscr_source = ['lpsrc/flx_rtl.pak']
-build_macro = "ASYNC"
-@doc()
-
-@select(tangler('spkgs/flx_drivers.py'))
-static_drivers = [('src/flx_drivers/flx_run', 'lib/rtl')]
-dynamic_drivers = [('src/flx_drivers/flx_run', 'bin')]
-
-include_path = ['src/rtl']
-
-drivers_require_libs = [
- 'libflx_pthread',
- 'libflx',
- 'libflx_gc',
- 'libflx_judy',
-]
-
-pkg_requires = ['flx_rtl','flx_pthread','flx_gc', 'flx_exceptions']
-lib_requires = ['libdemux','libflx_pthread','libflx','libflx_judy', 'libflx_exceptions']
-iscr_source = ['lpsrc/flx_rtl.pak']
-@doc()
-
-@select(tangler('spkgs/flx_async_drivers.py'))
-static_drivers = [('src/flx_drivers/flx_arun','lib/rtl')]
-dynamic_drivers = [('src/flx_drivers/flx_arun','bin')]
-
-include_path = ['src/rtl']
-
-drivers_require_libs = [
- 'libflx_async',
- 'libfaio',
- 'libdemux',
- 'libflx_pthread',
- 'libflx',
- 'libflx_gc',
- 'libflx_judy',
- 'libflx_exceptions',
-]
-
-pkg_requires = ['flx_gc','flx_rtl','flx_pthread','flx_async','demux','faio']
-iscr_source = ['lpsrc/flx_rtl.pak']
-@doc()
-
@select(tangler('config/flx_exceptions.fpc', 'data'))
Name: flx
Description: Felix exceptions
diff --git a/lpsrc/flx_rtl_config.pak b/lpsrc/flx_rtl_config.pak
index 4f6005d..c0e5bdf 100644
--- a/lpsrc/flx_rtl_config.pak
+++ b/lpsrc/flx_rtl_config.pak
@@ -2,12 +2,6 @@
@head(1,"Configuration management")
-@select(tangler('spkgs/flx_rtl_config.py'))
-
-iscr_source = ['lpsrc/flx_rtl_config.pak']
-weaver_directory = 'doc/rtl/flx_rtl/'
-@doc()
-
@select(tangler("config/target/flx_meta.hpp"))
#ifndef __FLX_META_H__
#define __FLX_META_H__
diff --git a/lpsrc/flx_sqlite.pak b/lpsrc/flx_sqlite.pak
index b6b8892..b2a5a33 100644
--- a/lpsrc/flx_sqlite.pak
+++ b/lpsrc/flx_sqlite.pak
@@ -11,18 +11,6 @@ except ImportError:
pa(f,locals(),"HAVE_SQLITE3")
f.close()
-@h = tangler('spkgs/sqlite3.py')
-@select(h)
-import config
-from cpkgs.target.sqlite3 import HAVE_SQLITE3
-
-if HAVE_SQLITE3:
- root = config.src_dir
- unit_tests = [('test', 'sqlite', 'sqlite-*.flx')]
-
-iscr_source = ['lpsrc/flx_sqlite.pak']
-weaver_directory = 'doc/sqlite/'
-
@h = tangler('config/sqlite3.fpc')
@select(h)
provides_dlib: -lsqlite3
diff --git a/lpsrc/flx_stdlib.pak b/lpsrc/flx_stdlib.pak
index 9826eb3..a34ee38 100644
--- a/lpsrc/flx_stdlib.pak
+++ b/lpsrc/flx_stdlib.pak
@@ -3,17 +3,6 @@
@head(1,'Felix Standard Library')
-@select(tangler('spkgs/flx_stdlib.py'))
-import config
-
-root = config.src_dir
-unit_tests = [('test', 'stdlib', 'slrt-*.flx')]
-pkg_requires = ['flx_compiler','flx_drivers','flx_rtl','flx_gc','flx_pthread','demux','faio']
-pkg_provides = ['flx_stdlib']
-
-iscr_source = ['lpsrc/flx_stdlib.pak']
-@doc()
-
@head(2,"Code")
Support table.
@begin_table("filebase","language","namespace","function")
diff --git a/lpsrc/flx_test.pak b/lpsrc/flx_test.pak
deleted file mode 100644
index 7ca0c44..0000000
--- a/lpsrc/flx_test.pak
+++ /dev/null
@@ -1,68 +0,0 @@
-@set_title('Felix Tests')
-
-@select(tangler('spkgs/flx_test.py'))
-import os
-
-import config
-
-root = config.src_dir
-
-static_drivers = [
- ('test/drivers/flx_perf_drv1', ''),
- ('test/drivers/mickey_mouse', ''),
-]
-
-dynamic_drivers = [
- ('test/drivers/flx_perf_drv1', ''),
- ('test/drivers/mickey_mouse', ''),
-]
-
-drivers_require_libs = [
- 'libflx_pthread',
- 'libflx',
- 'libflx_gc',
- 'libflx_judy',
-]
-
-unit_tests = [('test', 'drivers', 'drvr-*.flx')]
-pkg_requires = ['flx_compiler','flx_drivers','flx_rtl']
-iscr_source = ['lpsrc/flx_test.pak']
-
-xfiles = [('test', 'drivers', '*')]
-@doc()
-
-@head(1,'Drivers')
-These are C++ mainline routines, which are used
-to drive different kinds of Felix programs.
-@p()
-The Universal Filter Driver, flx_stdin,
-runs a Felix program which reads standard input.
-@p()
-We need some other standard drivers.
-An X-Windows driver would be really nice.
-
-@head(2,'Test 1')
-The Universal Program Driver, flx_run,
-runs a Felix program with no inputs.
-This driver is located in flx_rtl.ipk.
-@p()
-This routine just loops through
-numbers 1 to 10, and prints if they're odd or even.
-
-@head(2,'Performance Test')
-The first test program generates lines like:
-@begin_displayed_code()
-0 0 TEXT
-0 1 TEXT
-2 2 TEXT
-2 3 TEXT
-...
-@end_displayed_code()
-where the first value is a service key, and the second
-a sequence number. Messages with the same service
-key are sent to the same Felix line handler task:
-if one does not exist, it is created. Each task
-suicides after reading two lines.
-@p()
-We create 1 million threads, and process 2 million
-messages.
diff --git a/lpsrc/flx_tut_bind.pak b/lpsrc/flx_tut_bind.pak
index 58c43af..907a7e3 100644
--- a/lpsrc/flx_tut_bind.pak
+++ b/lpsrc/flx_tut_bind.pak
@@ -15,17 +15,6 @@ Felix is designed to integrate smoothly with C and C++.
Tests by category keyword.
@env.emit_katlist()
-@select(tangler('spkgs/flx_tut_bind.py'))
-import glob
-
-@tangle('TESTS = glob.glob("%s*.flx")' % env.native_root)
-
-unit_tests = TESTS
-pkg_requires = ['flx_compiler','flx_drivers','flx_rtl','faio']
-iscr_source = [ 'lpsrc/flx_tut_bind.pak' ]
-weaver_directory = 'doc/tutorial/embedding/'
-@doc()
-
@env.head(2,'Basic Bindings')
In the previous examples, we've use the Felix standard
library. It's time to look at how it works.
diff --git a/lpsrc/flx_tut_macro.pak b/lpsrc/flx_tut_macro.pak
index c4bc997..c978a2c 100644
--- a/lpsrc/flx_tut_macro.pak
+++ b/lpsrc/flx_tut_macro.pak
@@ -4,16 +4,6 @@
@env = setup_test(get_input_frame(), 'tut/macros/mac-')
-@select(tangler('spkgs/flx_tut_macro.py'))
-import glob
-
-@tangle('TESTS = glob.glob("%s*.flx")' % env.native_root)
-
-unit_tests = TESTS
-pkg_requires = ['flx_compiler','flx_drivers','flx_rtl','faio']
-iscr_source = [ 'lpsrc/flx_tut_macro.pak' ]
-weaver_directory = 'doc/tutorial/macros/'
-
@env.head(1,'The Syntax Macro Processor')
@env.head(2,'Expression Macro Facility')
Felix provides an powerful and dangerous
diff --git a/lpsrc/flx_tut_migrate.pak b/lpsrc/flx_tut_migrate.pak
index 1251a5d..dae48e2 100644
--- a/lpsrc/flx_tut_migrate.pak
+++ b/lpsrc/flx_tut_migrate.pak
@@ -4,17 +4,6 @@
@env = setup_test(get_input_frame(), 'tut/migration/mig-')
-@select(tangler('spkgs/flx_tut_migrate.py'))
-import glob
-
-@tangle('TESTS = glob.glob("%s*.flx")' % env.native_root)
-
-unit_tests = TESTS
-pkg_requires = ['flx_compiler','flx_drivers','flx_rtl','faio']
-iscr_source = [ 'lpsrc/flx_tut_migrate.pak' ]
-weaver_directory = 'doc/tutorial/migration/'
-@doc()
-
@env.head(1,"Introduction")
Felix is a new programming language with special support for
for C/C++ integration. This document highlights some of
diff --git a/lpsrc/flx_tutorial.pak b/lpsrc/flx_tutorial.pak
index 997cde5..459df7d 100644
--- a/lpsrc/flx_tutorial.pak
+++ b/lpsrc/flx_tutorial.pak
@@ -4460,21 +4460,3 @@ divide by zero somewhere
Tests by category keyword.
@env.emit_katlist()
-...@env.head(1,"Package Metadata")
-This contains the Felix build system description of
-the tutorial package.
-@select(tangler('spkgs/flx_tutorial.py'))
-import glob
-
-@tangle('TESTS = glob.glob("%s*.flx")' % env.native_root)
-
-unit_tests = TESTS
-pkg_requires = ['flx_compiler','flx_drivers','flx_rtl','faio']
-iscr_source = [ 'lpsrc/flx_tutorial.pak' ]
-
-weaver_directory = 'doc/tutorial/introduction/'
-tmpdir = ['tut']
-
-@doc()
-
-
diff --git a/lpsrc/tre.pak b/lpsrc/tre.pak
index bd9367c..a84a95d 100644
--- a/lpsrc/tre.pak
+++ b/lpsrc/tre.pak
@@ -1,47 +1,6 @@
@import config
@head(1,'tre')
-@select(tangler('spkgs/tre.py'))
-import os
-
-import config
-
-iscr_source = ['lpsrc/tre.pak']
-weaver_directory = 'doc/rtl/tre/'
-
-xfiles = [os.path.join('src', 'tre', '*')]
-
-rtl_interfaces = [
- 'config/target/flx_target_tre_config.h',
- 'src/tre/tre-regex.h',
- 'src/tre/tre-config.h',
-]
-
-felix_rtl = [
- 'src/tre/tre.flx',
-]
-
-cc_ccs = [
- 'src/tre/regcomp',
- 'src/tre/regerror',
- 'src/tre/regexec',
- 'src/tre/tre-ast',
- 'src/tre/tre-compile',
- 'src/tre/tre-match-approx',
- 'src/tre/tre-match-backtrack',
- 'src/tre/tre-match-parallel',
- 'src/tre/tre-mem',
- 'src/tre/tre-parse',
- 'src/tre/tre-stack',
- 'src/tre/xmalloc',
-]
-
-include_path = ['src/tre']
-build_macro = "TRE"
-
-root = config.src_dir
-unit_tests = [('test', 'tre', 'tre-*.flx')]
-
@h = tangler('config/tre.fpc')
@select(h)
commit 721748e6fd188340e07207082445b461ef856440
Author: skaller <Max.S...@gmail.com>
Date: Sun Oct 17 19:04:37 2010 +1100
Webserver which colourises Felix files!
diff --git a/tools/webserver.flx b/tools/webserver.flx
index 8fe252d..492d105 100644
--- a/tools/webserver.flx
+++ b/tools/webserver.flx
@@ -97,15 +97,328 @@ Content-Type: text/html\r
PAGE NOT FOUND:
""";
+proc write_http_header(s:socket_t, suffix:string)
+{
+ // mime type mapping from suffix. make better here.
+ if("gif" == suffix) then { write_string(s, gif_header); }
+ elif("css" == suffix) then { write_string(s, css_header); }
+ else { write_string(s, html_header); } endif;
+}
-proc serve_file(infname: string, s: socket_t)
+if WIN32 do
+ proc win32_send_file(s:socket_t,fname:string,suffix:string)
+ {
+ // quick 'n' dirty unix -> dos style pathnames
+ val wname = map (fun (a:char) => if a == char '/' then char '\\' else a endif) fname;
+ print "mapped "; print fname; print " -> "; print wname; endl;
+ var wf: WFILE <- Faio_win32::OpenFile(wname);
+ if wf == Faio_win32::INVALID_HANDLE_VALUE do
+ {
+ print "BUGGER: OpenFile failed: "; print (GetLastError()); endl;
+ }
+ else
+ {
+ print "opened "; print wname; endl;
+ write_http_header(s,suffix);
+ print "Transmitting file!\n";
+ TransmitFile(s, wf);
+ CloseFile(wf);
+ }
+ done
+ }
+elif POSIX do
+ proc posix_send_file(s:socket_t,fname:string,suffix:string)
+ {
+ // this fn sets the O_NONBLOCK flag which is completely unnecessary
+ // as read goes via the preading worker fifo. don't know if
+ // O_NONBLOCK even works on actual files.
+ var fd = Faio_posix::ropen(fname);
+
+ if Faio_posix::invalid fd do
+ {
+ print ("BUGGER, posix open of "+fname+" failed\n");
+ write_string(s, notfound_header);
+ write_string(s, fname+"\r\n\n");
+ }
+ else
+ {
+ print ("got fd "+str fd +" for read file of "+fname+"\n");
+
+ write_http_header(s,suffix);
+ var from_strm: Faio_posix::fd_t = fd;
+ var to_strm: socket_t = s;
+ Flx_stream::cat(from_strm, to_strm);
+
+ dbg$ ("close read fd " + str(from_strm)+"file "+fname+"\n");
+ iclose(from_strm); // this'll know how to close a unix fd
+ }
+ done
+
+ // var contents = Text_file::load(fname);
+ // print "loaded: "; print contents; endl;
+ // print "contents len="; print (len contents); endl;
+ // write_string(s, html_header + contents);
+ }
+done
+
+// define some basic character sets
+val letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_";
+val digits = "0123456789";
+val alphanum = letters + digits;
+val numeric = digits + ".eEdD_"; // crud hack
+
+// some character classification functions
+fun isidstart(x:char) => match find$ letters,x with | Some _ => true | None _ => false endmatch;
+fun isidcont(x:char) => match find$ alphanum,x with | Some _ => true | None _ => false endmatch;
+fun isdigit(x:char) => match find$ digits,x with | Some _ => true | None _ => false endmatch;
+fun isnumeric(x:char) => match find$ numeric,x with | Some _ => true | None _ => false endmatch;
+fun isalphanum(x:char) => isidstart x or isdigit x;
+
+fun issq(x:char) => x == char "'";
+fun isdq(x:char) => x == char '"';
+fun isslosh(x:char) => x == char '\\';
+fun isnull(x:char) => x == char "";
+fun iseol(x:char) => x == char "\n"; // will be CR on Windoze ;(
+
+flx_head := """
+<html>
+<head>
+<style type="text/css">
+span.fstring {color:darkblue; font-style:italic; }
+span.comment {font-family:arial; color:blue; font-style:italic; }
+span.big_keyword {color:red; }
+span.small_keyword {color:darkred; }
+</style>
+</head>
+<body>
+""";
+
+val big_keywords =
+ "module",
+ "fun",
+ "proc",
+ "type",
+ "typedef",
+ "var",
+ "val",
+ "typeclass",
+ "const",
+ "instance",
+ "header",
+ "body",
+ "include",
+ "open",
+ "spawn_fthread",
+ "spawn_pthread"
+;
+val small_keywords =
+ "if", "then", "else", "elif", "endif", "do", "done",
+ "in", "forall", "while", "whilst","to", "upto","downto",
+ "match","endmatch","with","requires"
+;
+
+fun inarray[N](s:string, a:array[string,N])=>
+ mem (fun (x:string) => s == x) a
+;
+
+proc write_felix(k:socket_t, t:string)
+{
+ union state_t =
+ | sot // start of token
+ | id // processing identifier
+ | num // in a number
+ | sq // processing single quote string
+ | dq // processing double quote string
+ | sq3 // processing single quote string
+ | dq3 // processing double quote string
+ | ccomment // a C style comment
+ | cppcomment // a C++ style comment
+ ;
+ fun str(s:state_t) => match s with
+ | sot => "sot"
+ | id => "id"
+ | num => "num"
+ | sq => "sq"
+ | dq => "dq"
+ | sq3 => "sq3"
+ | dq3 => "dq3"
+ | ccomment=> "ccomment"
+ | cppcomment => "cppcomment"
+ endmatch;
+
+ var i = 0; var s:state_t;
+ var ch = t.[i];
+ proc next() { ch = t.[i]; ++i; }
+ fun ahead (j:int)=> t.[i+j-1];
+ fun issq3() =>
+ ch == char "'" and
+ ahead(1) == char "'" and
+ ahead(2) == char "'"
+ ;
+ fun isdq3() =>
+ ch == char '"' and
+ ahead(1) == char '"' and
+ ahead(2) == char '"'
+ ;
+
+ var b = "";
+ proc cp() { b += ch; }
+ proc w() {
+ //println$ "Token["+str s+"]="+b;
+ match s with
+ | dq => { write_string(k,'<span class=fstring>'+b+"</span>"); }
+ | sq => { write_string(k,'<span class=fstring>'+b+"</span>"); }
+ | sq3 => { write_string(k,'<span class=fstring>'+b+"</span>"); }
+ | dq3 => { write_string(k,'<span class=fstring>'+b+"</span>"); }
+ | ccomment=> { write_string(k,'<span class=comment>'+b+"</span>"); }
+ | cppcomment=> { write_string(k,'<span class=comment>'+b+"</span>"); }
+ | id =>
+ {
+ if inarray(b,big_keywords) do write_string(k,'<span class=big_keyword>'+b+"</span>");
+ elif inarray(b,small_keywords) do write_string(k,'<span class=small_keyword>'+b+"</span>");
+ else write_string(k,b); done
+ }
+ | _ => { write_string(k,b); }
+ endmatch;
+ b = "";
+ }
+
+
+ goto nextt;
+
+contin:> // copy char and continue
+ cp();
+ goto nextch;
+
+overrun:> // one past last char of token
+ w();
+ s = sot;
+ goto thisch;
+
+lastch:> // last char of token
+ cp();
+ w();
+
+nextt:> // new token on next char
+ s = sot;
+
+nextch:> // next char
+ next();
+
+thisch:> // same char, reconsider it
+ //println$ "Considering char " + str(ord(ch));
+ if isnull ch goto fin; // out of data
+ match s with
+ | sot =>
+ {
+ if isidstart ch do s = id; goto contin;
+ elif isdigit ch do s = num; goto contin;
+ elif issq3() do cp; next; cp; next; s = sq3; goto contin;
+ elif isdq3() do cp; next; cp; next; s = dq3; goto contin;
+ elif issq ch do s = sq; goto contin;
+ elif isdq ch do s = dq; goto contin;
+ elif ch == char "/" do
+ if ahead(1) == char "/" do cp(); next(); s = cppcomment; goto contin
+ elif ahead(1) == char "*" do cp(); next(); s = ccomment; goto contin
+ else goto lastch
+ done
+ else cp(); w(); goto nextt;
+ done
+ }
+
+ | id =>
+ {
+ if isalphanum ch do goto contin;
+ else goto overrun;
+ done
+ }
+ | num =>
+ {
+ if isnumeric ch do goto contin;
+ else goto overrun;
+ done
+ }
+ // single quoted strings
+ | sq =>
+ {
+ if issq ch do goto lastch;
+ elif ch== char "<" do b+="<"; goto nextch;
+ elif ch== char ">" do b+=">"; goto nextch;
+ elif ch== char "&" do b+="&"; goto nextch;
+ else goto contin;
+ done
+ }
+ | dq =>
+ {
+ if isdq ch do goto lastch;
+ elif ch== char "<" do b+="<"; goto nextch;
+ elif ch== char ">" do b+=">"; goto nextch;
+ elif ch== char "&" do b+="&"; goto nextch;
+ else goto contin;
+ done
+ }
+ // triple quoted strings
+ | sq3 =>
+ {
+ if issq3() do cp(); next(); cp(); next(); cp(); w(); goto nextt;
+ elif ch== char "<" do b+="<"; goto nextch;
+ elif ch== char ">" do b+=">"; goto nextch;
+ elif ch== char "&" do b+="&"; goto nextch;
+ else goto contin;
+ done
+ }
+ | dq3 =>
+ {
+ if isdq3() do cp(); next(); cp(); next(); cp(); w(); goto nextt;
+ elif ch== char "<" do b+="<"; goto nextch;
+ elif ch== char ">" do b+=">"; goto nextch;
+ elif ch== char "&" do b+="&"; goto nextch;
+ else goto contin;
+ done
+ }
+ // comments
+ | cppcomment =>
+ {
+ if iseol ch do goto lastch;
+ else goto contin;
+ done
+ }
+ | ccomment => // doesn't handle nested comments yet
+ {
+ if ch == char "*" and ahead(1) == char "/" do
+ cp();
+ goto lastch;
+ else goto contin;
+ done
+ }
+ endmatch
+ ; // execute selected function
+ println$ "Unexpected drop thru";
+
+fin:>
+ println "outof data";
+ w(); // whatever is left over gets written
+}
+
+proc serve_felix(s:socket_t, fname:string)
{
- var fname: string;
+ val flx = Text_file::load(fname);
+ println$ "Loaded felix file " + fname;
+ //println$ "Contents=" + flx;
+ write_string(s, html_header);
+ write_string(s, flx_head);
+ write_string(s,"<pre>");
+ write_felix(s, flx);
+ write_string(s,"</pre>");
+ write_string(s,"</body></html>");
+}
+proc serve_file(infname: string, s: socket_t)
+{
// if empty string, serve index.html
// not quite right - needs to handle directories too, so
// not only foo.com/ -> index.html, but foo.com/images/ -> images/index.html
- if "" == infname then { fname = "index.html"; }else{ fname = infname;}endif;
+ var fname = if "" == infname then "index.html" else infname endif;
// set mime type depending on extension...
// serve a "not found page" for that case (check for recursion)
@@ -124,65 +437,13 @@ proc serve_file(infname: string, s: socket_t)
print "suffix is "; print suffix; endl;
-if WIN32 do
- // quick 'n' dirty unix -> dos style pathnames
- val wname = map (fun (a:char) => if a == char '/' then char '\\' else a endif) fname;
- print "mapped "; print fname; print " -> "; print wname; endl;
- // send header
- // TransmitFile
- var wf: WFILE <- Faio_win32::OpenFile(wname);
-
- if wf == Faio_win32::INVALID_HANDLE_VALUE then
- {
- print "BUGGER: OpenFile failed: "; print (GetLastError()); endl;
- } else {
- print "opened "; print wname; endl;
-
- // mime type mapping from suffix. make better here.
- if("gif" == suffix) then { write_string(s, gif_header); }
- elif("css" == suffix) then { write_string(s, css_header); }
- else { write_string(s, html_header); } endif;
-
- print "Transmitting file!\n";
- TransmitFile(s, wf);
-
- // send footer
- CloseFile(wf);
- } endif;
-elif POSIX do
- // this fn sets the O_NONBLOCK flag which is completely unnecessary
- // as read goes via the preading worker fifo. don't know if
- // O_NONBLOCK even works on actual files.
- var fd = Faio_posix::ropen(fname);
-
- if Faio_posix::invalid fd then
- {
- print ("BUGGER, posix open of "+fname+" failed\n");
- write_string(s, notfound_header);
- write_string(s, fname+"\r\n\n");
- } else {
- print ("got fd "+str fd +" for read file of "+fname+"\n");
-
- // mime type mapping from suffix. make better here.
- // factor out
- if("gif" == suffix) then { write_string(s, gif_header); }
- elif("css" == suffix) then { write_string(s, css_header); }
- else { write_string(s, html_header); } endif;
-
- var from_strm: Faio_posix::fd_t = fd;
- var to_strm: socket_t = s;
- Flx_stream::cat(from_strm, to_strm);
-
- dbg$ ("close read fd " + str(from_strm)+"file "+fname+"\n");
- iclose(from_strm); // this'll know how to close a unix fd
- } endif;
-
- // var contents = Text_file::load(fname);
- // print "loaded: "; print contents; endl;
- // print "contents len="; print (len contents); endl;
- // write_string(s, html_header + contents);
-
-done
+ if suffix == "flx" do serve_felix(s:socket_t, fname:string);
+
+ else
+ if WIN32 do win32_send_file(s,fname, suffix);
+ elif POSIX do posix_send_file(s,fname, suffix);
+ done
+ done
}
val webby_port = 1234;
@@ -196,43 +457,45 @@ mk_listener(&listener, &p, 10);
var clock = Faio::mk_alarm_clock();
+// noinline is necessary to stop the closure being
+// inlined into the loop, preventing the socket variable k
+// being duplicated as it must be [a bug in Felix]
noinline proc handler (var k:socket_t) ()
{
- dbg$ "Spawned fthread running for socket "+str k+"\n";
- // should spawn fthread here to allow for more io overlap
-
- var line: string;
- get_line(k, &line, str(k)); // should be the GET line.
- //cat(s, DEVNULL);
-
- print$ "got line from socket "+str k+": "; print line; endl;
-
- // now I need to parse the GET line, get a file name out of its url
- // (e.g. unqualfied -> index.html and name/flx.jpg -> flx.jpg
- match parse_get_line line with
- | None[string*string] => {
- print "BAD get line: "; print line; endl;
- }
- | Some (?base, ?file) => {
- print "well formed get...\n";
- print "base="; print base; endl;
- print "file="; print file; endl;
-
- serve_file(file, k);
- }
- endmatch;
-
- // we've only read the GET line, so let's flush out the rest of
- // the http request so we don't get connection reset errors when
- // we close the socket. shutting down stops cat blocking (?)
- //Faio_posix::shutdown(s, 1); // disallow further sends.
- //cat(s, DEVNULL);
-
- fprint$ cerr,"fthread closing socket "+str k+"\n";
- Faio::sleep(clock,0.1); // give OS time to empty its buffers
- ioclose(k);
- fprint$ cerr,"fthread "+str k+" terminating!\n";
-
+ dbg$ "Spawned fthread running for socket "+str k+"\n";
+ // should spawn fthread here to allow for more io overlap
+
+ var line: string;
+ get_line(k, &line, str(k)); // should be the GET line.
+ //cat(s, DEVNULL);
+
+ print$ "got line from socket "+str k+": "; print line; endl;
+
+ // now I need to parse the GET line, get a file name out of its url
+ // (e.g. unqualfied -> index.html and name/flx.jpg -> flx.jpg
+ match parse_get_line line with
+ | None[string*string] => {
+ print "BAD get line: "; print line; endl;
+ }
+ | Some (?base, ?file) => {
+ print "well formed get...\n";
+ print "base="; print base; endl;
+ print "file="; print file; endl;
+
+ serve_file(file, k);
+ }
+ endmatch;
+
+ // we've only read the GET line, so let's flush out the rest of
+ // the http request so we don't get connection reset errors when
+ // we close the socket. shutting down stops cat blocking (?)
+ //Faio_posix::shutdown(s, 1); // disallow further sends.
+ //cat(s, DEVNULL);
+
+ fprint$ cerr,"fthread closing socket "+str k+"\n";
+ Faio::sleep(clock,0.1); // give OS time to empty its buffers
+ ioclose(k);
+ fprint$ cerr,"fthread "+str k+" terminating!\n";
};
forever {
commit ddf70a63ee273efa59c2a3f9b6bc3bec9a83cc6a
Author: skaller <Max.S...@gmail.com>
Date: Fri Oct 15 02:08:08 2010 +1100
Lots of fiddling to get the web server to work.
Remove some spkgs since I don't think the build system
uses them anymore.
Create a module in lib/std/posix/signal.flx which allows me
to turn off the SIGPIPE signal which was killing the webserver.
diff --git a/buildsystem/__init__.py b/buildsystem/__init__.py
index 6dfa537..d62b2a3 100644
--- a/buildsystem/__init__.py
+++ b/buildsystem/__init__.py
@@ -30,6 +30,9 @@ def copy_flxs_to_lib(ctx, flxs):
def copy_flxs_to_libstd(ctx, flxs):
return copy_to(ctx, ctx.buildroot / 'lib/std', tuple(flxs))
+def copy_flxs_to_libstd_posix(ctx, flxs):
+ return copy_to(ctx, ctx.buildroot / 'lib/std/posix', tuple(flxs))
+
def copy_flxs_to_libstl(ctx, flxs):
return copy_to(ctx, ctx.buildroot / 'lib/stl', tuple(flxs))
diff --git a/buildsystem/bindings.py b/buildsystem/bindings.py
index f439d49..dada2c9 100644
--- a/buildsystem/bindings.py
+++ b/buildsystem/bindings.py
@@ -11,13 +11,17 @@ import buildsystem
# ------------------------------------------------------------------------------
def build_flx(phase):
+ # Note, *.flx bindings are copied even if the underlying C libs
+ # and/or header files don't exist, so the code will Felix compile
+ # After all the client may add these things later.. and they may
+ # be on the target machine even they're not on the host
dsts = []
if fbuild.config.c.gsl.gsl_gsl_blas_h(phase.cxx.shared).header:
dsts.extend(buildsystem.copy_fpc_to_config(phase.ctx,
Path('src/gsl/*.fpc').glob()))
- dsts.extend(buildsystem.copy_flxs_to_lib(phase.ctx,
+ dsts.extend(buildsystem.copy_to(phase.ctx,Path (phase.ctx.buildroot)/"lib/gsl",
Path('src/gsl/*.flx').glob()))
if 'macosx' in phase.platform:
@@ -86,21 +90,22 @@ def build_flx(phase):
dsts.extend(buildsystem.copy_fpc_to_config(phase.ctx, [sdl_fpc]))
- dsts.extend(buildsystem.copy_to(phase.ctx,
+ dsts.extend(buildsystem.copy_to(phase.ctx,
phase.ctx.buildroot / 'lib/SDL', Path('src/sdl/*.flx').glob()))
if fbuild.config.c.mpi.mpi_h(phase.cxx.shared).header:
dsts.extend(buildsystem.copy_fpc_to_config(phase.ctx,
Path('src/mpi/*.fpc').glob()))
- dsts.extend(buildsystem.copy_flxs_to_lib(phase.ctx,
- Path('src/mpi/*.flx').glob()))
+ dsts.extend(buildsystem.copy_to(phase.ctx,
+ Path(phase.ctx.buildroot) / 'lib/mpi', Path('src/mpi/*.flx').glob()))
if fbuild.config.c.pari.pari_h(phase.cxx.shared).header:
dsts.extend(buildsystem.copy_fpc_to_config(phase.ctx,
Path('src/pari/*.fpc').glob()))
- dsts.extend(buildsystem.copy_flxs_to_lib(phase.ctx,
+ dsts.extend(buildsystem.copy_to(phase.ctx,
+ Path(phase.ctx.buildroot) / "lib/mpi",
Path('src/pari/*.flx').glob()))
return dsts
diff --git a/buildsystem/flx_stdlib.py b/buildsystem/flx_stdlib.py
index 9c962c1..74aa90e 100644
--- a/buildsystem/flx_stdlib.py
+++ b/buildsystem/flx_stdlib.py
@@ -12,6 +12,8 @@ def build_flx(phase):
(path / '*.flx{,h}').glob()))
dsts.extend(buildsystem.copy_flxs_to_libstd(phase.ctx,
(path / 'std/*.flx{,h}').glob()))
+ dsts.extend(buildsystem.copy_flxs_to_libstd_posix(phase.ctx,
+ (path / 'std/posix/*.flx{,h}').glob()))
dsts.extend(buildsystem.copy_flxs_to_libstl(phase.ctx,
(path / 'stl/*.flx{,h}').glob()))
diff --git a/spkgs/dypgen.py b/spkgs/dypgen.py
deleted file mode 100644
index f4d68bf..0000000
--- a/spkgs/dypgen.py
+++ /dev/null
@@ -1,22 +0,0 @@
-caml_lexes = [
- 'src/compiler/dyp/generators/dypgen/dypgen_lexer',
- 'src/compiler/dyp/generators/dypgen/insert_linenum'
-]
-
-caml_pgenparses = ['src/compiler/dyp/generators/dypgen/dypgen_parser']
-caml_interfaces =[
- 'src/compiler/dyp/generators/dypgen/parse_tree',
- 'src/compiler/dyp/generators/dypgen/dypgen_parser',
-]
-caml_implementations=[
- 'src/compiler/dyp/generators/dypgen/argument',
- 'src/compiler/dyp/generators/dypgen/dypgen_parser',
- 'src/compiler/dyp/generators/dypgen/dypgen_lexer',
- 'src/compiler/dyp/generators/dypgen/insert_linenum',
-]
-caml_include_paths = ['src/compiler/dyp/dyplib']
-caml_provide_lib = 'src/compiler/dyp/generators/dypgen/dypgen'
-caml_require_libs = ['dyplib','dypgen']
-caml_exes = ['src/compiler/dyp/generators/dypgen/dypgen']
-pkg_requires = ['dyplib','pgen']
-weaver_directory = 'doc/dypgen/'
diff --git a/spkgs/dyplib.py b/spkgs/dyplib.py
deleted file mode 100644
index c529cbd..0000000
--- a/spkgs/dyplib.py
+++ /dev/null
@@ -1,25 +0,0 @@
-caml_interfaces = [
-# 'src/compiler/dyp/dyplib/sig',
- 'src/compiler/dyp/dyplib/dyp',
-]
-
-caml_implementations = [
- 'src/compiler/dyp/dyplib/priority_by_relation',
- 'src/compiler/dyp/dyplib/automaton',
- 'src/compiler/dyp/dyplib/gs',
-# 'src/compiler/dyp/dyplib/parser',
- 'src/compiler/dyp/dyplib/dyp',
-]
-
-#caml_pack = [
-# ("Dyp",'src/compiler/dyp/dyplib/dyp',[
-# 'src/compiler/dyp/dyplib/sig',
-# 'src/compiler/dyp/dyplib/gs',
-# 'src/compiler/dyp/dyplib/priority_by_relation',
-# 'src/compiler/dyp/dyplib/automaton',
-# 'src/compiler/dyp/dyplib/parser'
-# ])
-#]
-
-caml_provide_lib = 'src/compiler/dyp/dyplib/dyplib'
-weaver_directory = 'doc/dypgen/'
diff --git a/spkgs/flx_backend.py b/spkgs/flx_backend.py
deleted file mode 100644
index b252590..0000000
--- a/spkgs/flx_backend.py
+++ /dev/null
@@ -1,38 +0,0 @@
-iscr_source = ['flx.pak']
-
-caml_modules = [
- 'src/compiler/flx_backend/flx_backend_config',
- 'src/compiler/flx_backend/flx_name',
- 'src/compiler/flx_backend/flx_csubst',
- 'src/compiler/flx_backend/flx_tgen',
- 'src/compiler/flx_backend/flx_display',
- 'src/compiler/flx_backend/flx_ogen',
- 'src/compiler/flx_backend/flx_regen',
- 'src/compiler/flx_backend/flx_unravel',
- 'src/compiler/flx_backend/flx_pgen',
- 'src/compiler/flx_backend/flx_egen',
- 'src/compiler/flx_backend/flx_ctorgen',
- 'src/compiler/flx_backend/flx_elkgen',
- 'src/compiler/flx_backend/flx_why',
- 'src/compiler/flx_backend/flx_gen',
-]
-
-caml_include_paths = [
- 'src/compiler/flx_core',
- 'src/compiler/flx_misc',
- 'src/compiler/flx_bind',
- 'src/compiler/flxcclib',
- 'src/compiler/flx_frontend',
-]
-
-caml_provide_lib = 'src/compiler/flx_backend/flx_backend'
-
-pkg_requires = [
- 'flx_core',
- 'flx_frontend',
- 'flx_misc',
- 'flx_bind',
- 'flxcc_util',
-]
-
-weaver_directory = 'doc/flx/flx_compiler/'
diff --git a/spkgs/flx_bind.py b/spkgs/flx_bind.py
deleted file mode 100644
index cb2d90f..0000000
--- a/spkgs/flx_bind.py
+++ /dev/null
@@ -1,25 +0,0 @@
-caml_modules = [
- 'src/compiler/flx_bind/flx_generic',
- 'src/compiler/flx_bind/flx_tpat',
- 'src/compiler/flx_bind/flx_tconstraint',
- 'src/compiler/flx_bind/flx_overload',
- 'src/compiler/flx_bind/flx_lookup',
- 'src/compiler/flx_bind/flx_mbind',
- 'src/compiler/flx_bind/flx_bexe',
- 'src/compiler/flx_bind/flx_bbind',
- 'src/compiler/flx_bind/flx_symtab',
-]
-
-caml_include_paths = [
- 'src/compiler/flx_core',
- 'src/compiler/flx_misc',
- 'src/compiler/inria_re',
-]
-
-caml_provide_lib = 'src/compiler/flx_bind/flx_bind'
-
-pkg_requires = [
- 'flx_core',
- 'flx_misc',
- 'inria_re',
-]
diff --git a/spkgs/flx_compiler.py b/spkgs/flx_compiler.py
deleted file mode 100644
index 386cdd3..0000000
--- a/spkgs/flx_compiler.py
+++ /dev/null
@@ -1,73 +0,0 @@
-iscr_source = ['flx.pak']
-
-caml_modules = [
- 'src/compiler/drivers/flx_terminate',
- 'src/compiler/drivers/flx_flxopt',
-]
-
-caml_exes = [
- 'src/compiler/drivers/flxp',
- 'src/compiler/drivers/flxm',
- 'src/compiler/drivers/flxd',
- 'src/compiler/drivers/flxb',
- 'src/compiler/drivers/flxg',
- 'src/compiler/drivers/stub',
-]
-
-caml_require_libs = [
- 'str',
- 'nums',
- 'unix',
- 'flx_version',
- 'ocslib',
- 'sexlib',
- 'dyplib',
- 'flx_misc',
- 'cillib',
- 'flxcclib',
- 'inria_re',
- 'flx_core',
- 'flx_bind',
- 'flx_lex',
- 'flx_parse',
- 'flx_desugar',
- 'flx_frontend',
- 'flx_backend',
- 'flx_version_hook',
- 'flx_driver',
-]
-
-caml_include_paths = [
- 'src/compiler/flx_frontend',
- 'src/compiler/flx_backend',
- 'src/compiler/inria_re',
- 'src/compiler/ocs',
- 'src/compiler/sex',
- 'src/compiler/cil',
- 'src/compiler/cil/ocamlutil',
- 'src/compiler/cil/src',
- 'src/compiler/cil/src/frontc',
- 'src/compiler/dyp/dyplib',
- 'src/compiler/flxcclib',
- 'src/compiler/flx_bind',
- 'src/compiler/flx_core',
- 'src/compiler/flx_desugar',
- 'src/compiler/flx_lex',
- 'src/compiler/flx_parse',
- 'src/compiler/flx_misc',
- 'src/compiler/flx_version',
- 'src/compiler/flx_version_hook'
-]
-
-caml_provide_lib = 'src/compiler/drivers/flx_driver'
-
-pkg_requires = [
- 'flx_backend',
- 'flx_bind',
- 'flx_desugar',
- 'flx_frontend',
- 'flx_version',
- 'flx_version_hook',
-]
-
-weaver_directory = 'doc/flx/flx_compiler/'
diff --git a/spkgs/flx_core.py b/spkgs/flx_core.py
deleted file mode 100644
index 4705854..0000000
--- a/spkgs/flx_core.py
+++ /dev/null
@@ -1,25 +0,0 @@
-iscr_source = ['flx.pak']
-
-caml_modules = [
- 'src/compiler/flx_core/flx_ast',
- 'src/compiler/flx_core/flx_types',
- 'src/compiler/flx_core/flx_srcref',
- 'src/compiler/flx_core/flx_typing',
- 'src/compiler/flx_core/flx_print',
- 'src/compiler/flx_core/flx_exceptions',
- 'src/compiler/flx_core/flx_typing2',
- 'src/compiler/flx_core/flx_mtypes2',
- 'src/compiler/flx_core/flx_maps',
- 'src/compiler/flx_core/flx_unify',
- 'src/compiler/flx_core/flx_beta',
-]
-
-caml_include_paths = [
- 'src/compiler/flx_misc',
-]
-
-caml_provide_lib = 'src/compiler/flx_core/flx_core'
-
-pkg_requires = [
- 'flx_misc',
-]
diff --git a/spkgs/flx_desugar.py b/spkgs/flx_desugar.py
deleted file mode 100644
index 56e3c53..0000000
--- a/spkgs/flx_desugar.py
+++ /dev/null
@@ -1,42 +0,0 @@
-iscr_source = ['flx.pak']
-
-caml_modules = [
- 'src/compiler/flx_desugar/flx_pat',
- 'src/compiler/flx_desugar/flx_constfld',
- 'src/compiler/flx_desugar/flx_macro',
- 'src/compiler/flx_desugar/flx_colns',
- 'src/compiler/flx_desugar/flx_ciltoflx',
- 'src/compiler/flx_desugar/flx_cformat',
- 'src/compiler/flx_desugar/flx_tcdoc',
- 'src/compiler/flx_desugar/flx_desugar',
-]
-
-caml_include_paths = [
- 'src/compiler/cil/ocamlutil',
- 'src/compiler/cil/src',
- 'src/compiler/cil/src/frontc',
- 'src/compiler/dyp/dyplib',
- 'src/compiler/flx_core',
- 'src/compiler/flx_lex',
- 'src/compiler/flx_misc',
- 'src/compiler/flx_parse',
- 'src/compiler/flx_version',
- 'src/compiler/flxcclib',
- 'src/compiler/ocs',
- 'src/compiler/sex',
-]
-
-caml_provide_lib = 'src/compiler/flx_desugar/flx_desugar'
-
-pkg_requires = [
- 'cil',
- 'dypgen',
- 'flx_core',
- 'flx_lex',
- 'flx_misc',
- 'flx_parse',
- 'flx_version',
- 'flxcc_util',
- 'ocs',
- 'sex',
-]
diff --git a/spkgs/flx_doxygen.py b/spkgs/flx_doxygen.py
deleted file mode 100644
index d386bfc..0000000
--- a/spkgs/flx_doxygen.py
+++ /dev/null
@@ -1,5 +0,0 @@
-from fbuild.flxbuild.flxutil import mkdirs
-iscr_source=['lpsrc/flx_doxygen.pak']
-
-# dir must exist for doxygen to work
-mkdirs(os.path.join('doc','rtl','doxygen'))
diff --git a/spkgs/flx_frontend.py b/spkgs/flx_frontend.py
deleted file mode 100644
index d887a2e..0000000
--- a/spkgs/flx_frontend.py
+++ /dev/null
@@ -1,47 +0,0 @@
-caml_modules = [
- 'src/compiler/flx_frontend/flx_treg',
- 'src/compiler/flx_frontend/flx_use',
- 'src/compiler/flx_frontend/flx_prop',
- 'src/compiler/flx_frontend/flx_child',
- 'src/compiler/flx_frontend/flx_strabs',
- 'src/compiler/flx_frontend/flx_typeclass',
- 'src/compiler/flx_frontend/flx_axiom',
- 'src/compiler/flx_frontend/flx_label',
- 'src/compiler/flx_frontend/flx_cflow',
- 'src/compiler/flx_frontend/flx_call',
- 'src/compiler/flx_frontend/flx_passign',
- 'src/compiler/flx_frontend/flx_tailit',
- 'src/compiler/flx_frontend/flx_reparent',
- 'src/compiler/flx_frontend/flx_spexes',
- 'src/compiler/flx_frontend/flx_foldvars',
- 'src/compiler/flx_frontend/flx_args',
- 'src/compiler/flx_frontend/flx_uncurry',
- 'src/compiler/flx_frontend/flx_stack_calls',
- 'src/compiler/flx_frontend/flx_mkproc',
- 'src/compiler/flx_frontend/flx_reduce',
- 'src/compiler/flx_frontend/flx_mono',
- 'src/compiler/flx_frontend/flx_mkcls',
- 'src/compiler/flx_frontend/flx_global',
- 'src/compiler/flx_frontend/flx_inst',
- 'src/compiler/flx_frontend/flx_inline',
-]
-
-caml_include_paths = [
- 'src/compiler/flx_core',
- 'src/compiler/flx_misc',
- 'src/compiler/flx_bind',
- 'src/compiler/flxcclib',
- 'src/compiler/inria_re',
-]
-
-caml_provide_lib = 'src/compiler/flx_frontend/flx_frontend'
-
-pkg_requires = [
- 'flx_core',
- 'flx_misc',
- 'flx_bind',
- 'flxcc_util',
- 'inria_re',
-]
-
-weaver_directory = 'doc/flx/flx_compiler/'
diff --git a/spkgs/flx_lex.py b/spkgs/flx_lex.py
deleted file mode 100644
index a047a8c..0000000
--- a/spkgs/flx_lex.py
+++ /dev/null
@@ -1,31 +0,0 @@
-iscr_source = ['flx.pak']
-
-caml_modules = [
- 'src/compiler/flx_lex/flx_token',
- 'src/compiler/flx_lex/flx_prelex',
- 'src/compiler/flx_lex/flx_tok',
- 'src/compiler/flx_lex/flx_charset',
- 'src/compiler/flx_lex/flx_pdoc',
- 'src/compiler/flx_lex/flx_preparse',
- 'src/compiler/flx_lex/flx_id',
-]
-
-caml_include_paths = [
- 'src/compiler/dyp/dyplib',
- 'src/compiler/flx_core',
- 'src/compiler/flx_misc',
- 'src/compiler/flx_version',
- 'src/compiler/ocs',
- 'src/compiler/sex',
-]
-
-caml_provide_lib = 'src/compiler/flx_lex/flx_lex'
-
-pkg_requires = [
- 'dypgen',
- 'flx_core',
- 'flx_misc',
- 'flx_version',
- 'ocs',
- 'sex',
-]
diff --git a/spkgs/flx_misc.py b/spkgs/flx_misc.py
deleted file mode 100644
index 0cdd637..0000000
--- a/spkgs/flx_misc.py
+++ /dev/null
@@ -1,13 +0,0 @@
-caml_modules = [
- 'src/compiler/flx_misc/flx_filesys',
- 'src/compiler/flx_misc/flx_list',
- 'src/compiler/flx_misc/flx_set',
- 'src/compiler/flx_misc/flx_string',
- 'src/compiler/flx_misc/flx_util',
- 'src/compiler/flx_misc/flx_getopt',
- 'src/compiler/flx_misc/flx_dlst',
-]
-
-caml_require_libs = ["str"]
-
-caml_provide_lib = 'src/compiler/flx_misc/flx_misc'
diff --git a/spkgs/flx_parse.py b/spkgs/flx_parse.py
deleted file mode 100644
index 8405221..0000000
--- a/spkgs/flx_parse.py
+++ /dev/null
@@ -1,28 +0,0 @@
-iscr_source = ['flx.pak']
-
-caml_modules = [
- 'src/compiler/flx_parse/flx_sex2flx',
- 'src/compiler/flx_parse/flx_parse',
-]
-
-caml_include_paths = [
- 'src/compiler/dyp/dyplib',
- 'src/compiler/flx_core',
- 'src/compiler/flx_lex',
- 'src/compiler/flx_misc',
- 'src/compiler/flx_version',
- 'src/compiler/ocs',
- 'src/compiler/sex',
-]
-
-caml_provide_lib = 'src/compiler/flx_parse/flx_parse'
-
-pkg_requires = [
- 'dypgen',
- 'flx_core',
- 'flx_lex',
- 'flx_misc',
- 'flx_version',
- 'ocs',
- 'sex',
-]
diff --git a/spkgs/flx_pkgconfig.py b/spkgs/flx_pkgconfig.py
deleted file mode 100644
index b6f0b69..0000000
--- a/spkgs/flx_pkgconfig.py
+++ /dev/null
@@ -1,25 +0,0 @@
-import os
-
-#
-# we can't use flx_pkgconfig to supply platform
-# libraries .. because this IS flx_pkgconfig --
-# so it isn't built yet!!
-#
-# driver apps (like pkg_config) only use async if they have to, so I think
-# all this socket bootstrapping stuff is now unnecessary. Let's see!
-FLXFLAGS = ""
-#if WIN32:
-# if HAVE_MSVC:
-# FLXFLAGS = "/DEFAULTLIB:ws2_32 /DEFAULTLIB:mswsock "
-# else:
-# FLXFLAGS = "-lws2_32 -lmswsock "
-#elif SOLARIS:
-# FLXFLAGS = "-lsocket -lnsl " # uses async hooker->faio->demux->sockets
-
-# DRLIBS = ['libflx_async','libfaio','libdemux','libflx_pthread','libflx', 'libflx_exceptions']
-DRLIBS = ['libflx_pthread','libflx','libflx_gc','libflx_judy', 'libflx_exceptions']
-
-pkg_requires = ['flx_compiler','flx_drivers','flx_stdlib']
-felix_tools = [('src/flx_pkgconfig/flx_pkgconfig','bin/flx_pkgconfig')]
-felix_requires_linkflags = FLXFLAGS
-exes_require_libs = DRLIBS
diff --git a/spkgs/flx_version_hook.py b/spkgs/flx_version_hook.py
deleted file mode 100644
index 7387623..0000000
--- a/spkgs/flx_version_hook.py
+++ /dev/null
@@ -1,12 +0,0 @@
-caml_modules = [
- 'src/compiler/flx_version_hook/flx_version_hook',
-]
-
-caml_include_paths = [
- 'src/compiler/flx_version',
- 'src/compiler/flx_version_hook',
-]
-
-caml_provide_lib = 'src/compiler/flx_version_hook/flx_version_hook'
-
-pkg_requires = ['flx_version']
diff --git a/spkgs/gl.py b/spkgs/gl.py
deleted file mode 100644
index bbecc69..0000000
--- a/spkgs/gl.py
+++ /dev/null
@@ -1,2 +0,0 @@
-iscr_source = ['lpsrc/flx_opengl.pak']
-weaver_directory = "doc/opengl/"
diff --git a/spkgs/glu.py b/spkgs/glu.py
deleted file mode 100644
index 4a4019b..0000000
--- a/spkgs/glu.py
+++ /dev/null
@@ -1 +0,0 @@
-pkg_requires = ['gl']
diff --git a/spkgs/glut.py b/spkgs/glut.py
deleted file mode 100644
index 730b501..0000000
--- a/spkgs/glut.py
+++ /dev/null
@@ -1 +0,0 @@
-pkg_requires = ['glu']
diff --git a/spkgs/gsl.py b/spkgs/gsl.py
deleted file mode 100644
index 005c048..0000000
--- a/spkgs/gsl.py
+++ /dev/null
@@ -1,5 +0,0 @@
-from cpkgs.target.gsl import HAVE_GSL
-if HAVE_GSL:
- pass
-
-weaver_directory = 'doc/gsl/'
diff --git a/spkgs/inria_re.py b/spkgs/inria_re.py
deleted file mode 100644
index 4b725fb..0000000
--- a/spkgs/inria_re.py
+++ /dev/null
@@ -1,8 +0,0 @@
-caml_modules = [
- 'src/compiler/inria_re/inria_table',
- 'src/compiler/inria_re/inria_cset',
- 'src/compiler/inria_re/inria_syntax',
- 'src/compiler/inria_re/inria_lexgen',
-]
-
-caml_provide_lib = 'src/compiler/inria_re/inria_re'
diff --git a/spkgs/mpi.py b/spkgs/mpi.py
deleted file mode 100644
index 811abba..0000000
--- a/spkgs/mpi.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from cpkgs.target.mpi import HAVE_MPI
-if HAVE_MPI:
- weaver_directory = 'doc/rtl/mpi/'
diff --git a/spkgs/ocs.py b/spkgs/ocs.py
deleted file mode 100644
index 77dc8e2..0000000
--- a/spkgs/ocs.py
+++ /dev/null
@@ -1,34 +0,0 @@
-caml_modules = [
- 'src/compiler/ocs/ocs_vartable',
- 'src/compiler/ocs/ocs_error',
- 'src/compiler/ocs/ocs_port',
- 'src/compiler/ocs/ocs_types',
- 'src/compiler/ocs/ocs_sym',
- 'src/compiler/ocs/ocs_env',
- 'src/compiler/ocs/ocs_char',
- 'src/compiler/ocs/ocs_numaux',
- 'src/compiler/ocs/ocs_complex',
- 'src/compiler/ocs/ocs_num',
- 'src/compiler/ocs/ocs_numstr',
- 'src/compiler/ocs/ocs_lex',
- 'src/compiler/ocs/ocs_misc',
- 'src/compiler/ocs/ocs_read',
- 'src/compiler/ocs/ocs_print',
- 'src/compiler/ocs/ocs_eval',
- 'src/compiler/ocs/ocs_list',
- 'src/compiler/ocs/ocs_compile',
- 'src/compiler/ocs/ocs_macro',
- 'src/compiler/ocs/ocs_io',
- 'src/compiler/ocs/ocs_prim',
- 'src/compiler/ocs/ocs_string',
- 'src/compiler/ocs/ocs_vector',
- 'src/compiler/ocs/ocs_contin',
- 'src/compiler/ocs/ocs_top',
-]
-
-caml_provide_lib = 'src/compiler/ocs/ocslib'
-caml_require_libs = ['nums','unix','ocslib']
-caml_exes = ['src/compiler/ocs/ocs_main']
-weaver_directory='doc/ocs'
-pkg_requires = []
-tmpdir = ['ocs']
diff --git a/spkgs/pari.py b/spkgs/pari.py
deleted file mode 100644
index 3655605..0000000
--- a/spkgs/pari.py
+++ /dev/null
@@ -1,4 +0,0 @@
-from cpkgs.target.pari import HAVE_PARI
-
-if HAVE_PARI:
- weaver_directory = 'doc/rtl/pari/'
diff --git a/spkgs/pgen.py b/spkgs/pgen.py
deleted file mode 100644
index 792a294..0000000
--- a/spkgs/pgen.py
+++ /dev/null
@@ -1,11 +0,0 @@
-caml_include_paths = ['src/compiler/dyp/dyplib']
-caml_lexes = ['src/compiler/dyp/generators/pgen/pgen_lexer']
-caml_implementations=[
- 'src/compiler/dyp/generators/pgen/pgen_parser_param',
- 'src/compiler/dyp/generators/pgen/pgen_lexer'
-]
-caml_provide_lib = 'src/compiler/dyp/generators/pgen/pgen'
-caml_require_libs = ['dyplib','pgen']
-caml_exes = ['src/compiler/dyp/generators/pgen/pgen']
-weaver_directory = 'doc/dypgen/'
-pkg_requires = ['dyplib']
diff --git a/spkgs/sdl.py b/spkgs/sdl.py
deleted file mode 100644
index 1202960..0000000
--- a/spkgs/sdl.py
+++ /dev/null
@@ -1,21 +0,0 @@
-import os
-
-import config
-import cpkgs.target.sdl as sdl
-
-if sdl.HAVE_SDL:
- # flags are compiler natives switches
- # not to be confused with platform independent lists
- # of libraries, include files, paths, etc
- cflags = sdl.SDL_CFLAGS
- dflags = sdl.SDL_LIBS
- sflags = sdl.SDL_STATIC_LIBS
-
- pkg_requires = ['faio']
- lib_requires = ['libfaio', 'libdemux','libflx_pthread','libflx']
- root = config.src_dir
- demos = [('demos', 'sdl', '*.flx')]
-
-iscr_source = ['lpsrc/flx_sdl.pak']
-build_macro = "SDL"
-weaver_directory = "doc/sdl/"
diff --git a/spkgs/sdl_drivers.py b/spkgs/sdl_drivers.py
deleted file mode 100644
index 1af74b0..0000000
--- a/spkgs/sdl_drivers.py
+++ /dev/null
@@ -1,28 +0,0 @@
-import cpkgs.target.sdl as sdl
-
-if sdl.HAVE_SDL:
- STATIC_DRIVERS = [
- ('src/flx_drivers/flx_arun', 'lib/rtl'),
- ]
- DYNAMIC_DRIVERS = [
- ('src/flx_drivers/flx_arun', 'bin'),
- ]
- DRLIBS = [
- 'libflx_async',
- 'libfaio',
- 'libdemux',
- 'libflx_pthread',
- 'libflx',
- 'libflx_gc',
- 'libflx_judy',
- ]
-
- include_path = ['src/rtl']
-
- static_drivers = STATIC_DRIVERS
- dynamic_drivers = DYNAMIC_DRIVERS
- drivers_require_libs = DRLIBS
- pkg_requires = ['flx_rtl','flx_async','faio','demux','flx_pthread','sdl']
- cflags = sdl.SDL_CFLAGS
- dflags = sdl.SDL_LIBS
- sflags = sdl.SDL_STATIC_LIBS
diff --git a/spkgs/sex.py b/spkgs/sex.py
deleted file mode 100644
index 37a6430..0000000
--- a/spkgs/sex.py
+++ /dev/null
@@ -1,17 +0,0 @@
-caml_modules = [
- 'src/compiler/sex/sex_types',
- 'src/compiler/sex/sex_token',
- 'src/compiler/sex/sex_parse',
- 'src/compiler/sex/sex_lex',
- 'src/compiler/sex/sex_print',
- 'src/compiler/sex/sex_map',
- 'src/compiler/sex/ocs2sex',
- ]
-
-caml_include_paths = ['src/compiler/ocs','src/compiler/dyp/dyplib','src/compiler/sex']
-caml_provide_lib = 'src/compiler/sex/sexlib'
-caml_require_libs = ['dyplib','ocslib','sexlib']
-pkg_requires = ['ocs','dypgen']
-caml_exes = ['src/compiler/sex/sex']
-weaver_directory='doc/sex'
-tmpdir = ['sex']
diff --git a/src/demux/flx_demux.cpp b/src/demux/flx_demux.cpp
index 9cd64fe..5fa9958 100644
--- a/src/demux/flx_demux.cpp
+++ b/src/demux/flx_demux.cpp
@@ -12,9 +12,9 @@ pthread_thread(void* udat)
while(1)
{
- fprintf(stderr, "ETHREAD ABOUT TO WAIT\n");
+ //fprintf(stderr, "ETHREAD ABOUT TO WAIT\n");
d->wait(); // this does it
- fprintf(stderr, "ETHREAD CHECKING QUIT FLAG\n");
+ //fprintf(stderr, "ETHREAD CHECKING QUIT FLAG\n");
demux_quit_flag* f = d->get_quit_flag();
if(f)
{
diff --git a/src/demux/kqueue/demux_kqueue_demuxer.cpp b/src/demux/kqueue/demux_kqueue_demuxer.cpp
index 91cad42..3fae9cf 100644
--- a/src/demux/kqueue/demux_kqueue_demuxer.cpp
+++ b/src/demux/kqueue/demux_kqueue_demuxer.cpp
@@ -58,7 +58,7 @@ kqueue_demuxer::~kqueue_demuxer()
int
kqueue_demuxer::add_socket_wakeup(socket_wakeup* sv, int flags)
{
- fprintf(stderr,"Add socket wakeup\n");
+ //fprintf(stderr,"Add socket wakeup\n");
// we only know these flags
if((flags & ~(PDEMUX_READ | PDEMUX_WRITE))) return -1;
@@ -69,13 +69,13 @@ kqueue_demuxer::add_socket_wakeup(socket_wakeup* sv, int flags)
if(flags & PDEMUX_READ)
{
if(add_kqueue_filter(sv, EVFILT_READ) == -1) return -1;
- fprintf (stderr,"Added read filter\n");
+ //fprintf (stderr,"Added read filter\n");
}
if(flags & PDEMUX_WRITE)
{
if(add_kqueue_filter(sv, EVFILT_WRITE) == -1) return -1;
- fprintf(stderr,"Added write filter\n");
+ //fprintf(stderr,"Added write filter\n");
}
return 0;
@@ -134,7 +134,7 @@ kqueue_demuxer::remove_kqueue_filter(int s, short filter)
perror("kevent remove_socket_wakeup");
return -1;
}
- fprintf(stderr,"Removed kqueue filter\n");
+ //fprintf(stderr,"Removed kqueue filter\n");
return 0;
}
@@ -198,7 +198,7 @@ kqueue_demuxer::get_evts(bool poll)
}
// fprintf(stderr,"kqueue wakeup!\n");
- fprintf(stderr,"Kqueue got %d events\n",nevts);
+ //fprintf(stderr,"Kqueue got %d events\n",nevts);
socket_wakeup* sv = (socket_wakeup*)ev.udata;
// The filters are not bit fields, hence they must come in serially.
@@ -227,7 +227,6 @@ kqueue_demuxer::get_evts(bool poll)
(int)ev.data, ev.fflags);
}
// fprintf(stderr,"EVFILT_READ: got %i bytes coming\n", (int)ev.data);
- fprintf(stderr,"EVFILT_READ: got %i bytes coming\n", (int)ev.data);
// remove_reading_fd(s); // now useing EV_ONESHOT
// remove other outstanding here...?
sv->wakeup_flags = PDEMUX_READ; // Tell 'em what they've won.
@@ -236,7 +235,6 @@ kqueue_demuxer::get_evts(bool poll)
else if(ev.filter == EVFILT_WRITE)
{
// fprintf(stderr,"EVFILT_WRITE: can write (?) %i bytes\n", (int)ev.data);
- fprintf(stderr,"EVFILT_WRITE: can write (?) %i bytes\n", (int)ev.data);
// using oneshot mode now.
// remove_writing_fd(s);
diff --git a/src/demux/posix/demux_posix_demuxer.cpp b/src/demux/posix/demux_posix_demuxer.cpp
index 09cb8cc..8e155ad 100644
--- a/src/demux/posix/demux_posix_demuxer.cpp
+++ b/src/demux/posix/demux_posix_demuxer.cpp
@@ -22,7 +22,7 @@ posix_demuxer::~posix_demuxer()
bool
posix_demuxer::socket_recv(int s, sel_param* pb)
{
- fprintf(stderr,"posix_demuxer:socket_recv\n");
+ //fprintf(stderr,"posix_demuxer:socket_recv\n");
// why do I have the zero buffer size?
assert(pb->buffer_size > pb->bytes_written || 0 == pb->buffer_size);
ssize_t nbytes;
@@ -31,7 +31,7 @@ posix_demuxer::socket_recv(int s, sel_param* pb)
nbytes = recv(s, pb->buffer + pb->bytes_written,
pb->buffer_size - pb->bytes_written, 0);
- fprintf(stderr,"posix_demuxer:socket_recv got %d bytes\n", nbytes);
+ //fprintf(stderr,"posix_demuxer:socket_recv got %d bytes\n", nbytes);
/*
fprintf(stderr,"posix_demuxer RECV: s=%d, pb=%p, buf+%d, req=%d, got %d\n",
s,pb, int(pb->bytes_written), int(pb->buffer_size - pb->bytes_written), int(nbytes)
@@ -68,10 +68,10 @@ posix_demuxer::socket_send(int s, sel_param* pb)
ssize_t nbytes;
- fprintf(stderr,"posix_demuxer:socket_send\n", nbytes);
+ //fprintf(stderr,"posix_demuxer:socket_send\n", nbytes);
nbytes = send(s, pb->buffer + pb->bytes_written,
pb->buffer_size - pb->bytes_written, 0);
- fprintf(stderr,"posix_demuxer:socket_send wrote %ld bytes\n", (long) nbytes);
+ //fprintf(stderr,"posix_demuxer:socket_send wrote %ld bytes\n", (long) nbytes);
/*
fprintf(stderr,"posix_demuxer SEND: s=%d, pb=%p buf+%d, req=%d, got %d\n",
diff --git a/src/faio/faio_asyncio.cpp b/src/faio/faio_asyncio.cpp
index e465e35..bd7febd 100644
--- a/src/faio/faio_asyncio.cpp
+++ b/src/faio/faio_asyncio.cpp
@@ -21,13 +21,13 @@ void flx_driver_request_base:: start_async_op(finote_t *fn_a)
void flx_driver_request_base:: notify_finished()
{
- fprintf(stderr, "faio_req=%p, Notify %p\n", this,fn);
+ //fprintf(stderr, "faio_req=%p, Notify %p\n", this,fn);
assert(fn!=0);
finote_t *fin = fn;
fn=0;
fin->signal();
delete fin;
- fprintf(stderr, "faio_req=%p, FINISHED\n",this);
+ //fprintf(stderr, "faio_req=%p, FINISHED\n",this);
}
}}
diff --git a/src/faio/faio_posixio.cpp b/src/faio/faio_posixio.cpp
index 5e07702..2913375 100644
--- a/src/faio/faio_posixio.cpp
+++ b/src/faio/faio_posixio.cpp
@@ -100,17 +100,17 @@ socketio_wakeup::wakeup(posix_demuxer& demux)
{
// just check that our above assumption hasn't been violated.
assert(wakeup_flags == PDEMUX_READ);
- fprintf(stderr,"posix faio wakeup PDEMUX_READ, reading..\n");
+ //fprintf(stderr,"posix faio wakeup PDEMUX_READ, reading..\n");
connection_closed = posix_demuxer::socket_recv(s, &pb);
- fprintf(stderr,"posix faio wakeup PDEMUX_READ, connection closed = %d\n", connection_closed);
+ //fprintf(stderr,"posix faio wakeup PDEMUX_READ, connection closed = %d\n", connection_closed);
}
else
{
// never hurts to be paranoid.
assert(wakeup_flags == PDEMUX_WRITE);
- fprintf(stderr,"posix faio wakeup PDEMUX_WRITE, writing..\n");
+ //fprintf(stderr,"posix faio wakeup PDEMUX_WRITE, writing..\n");
connection_closed = posix_demuxer::socket_send(s, &pb);
- fprintf(stderr,"posix faio wakeup PDEMUX_WRITE, connection closed = %d\n", connection_closed);
+ //fprintf(stderr,"posix faio wakeup PDEMUX_WRITE, connection closed = %d\n", connection_closed);
}
// fprintf(stderr,"posthandle wakeup, this: %p, read: %i, len: %i, done %i\n",
diff --git a/src/faio/flx_stream.flx b/src/faio/flx_stream.flx
index 987003b..a6a9279 100644
--- a/src/faio/flx_stream.flx
+++ b/src/faio/flx_stream.flx
@@ -270,6 +270,7 @@ module Flx_stream {
read(strm, &len, ac, &eof);
+ /*
if len == 0 do
fprintln$ cerr,"Got nothing from IByteStream "+id;
if eof do fprintln$ cerr,"Eof on IBytestream "+id;
@@ -282,15 +283,18 @@ module Flx_stream {
//fprintln$ cerr,"Got char " + str c + " from an IByteStream "+id;
done
done
+ */
if eof or c == char '\n' do
- fprintln$ cerr,"Got end of line (or file) from an IByteStream "+id;
+ //fprintln$ cerr,"Got end of line (or file) from an IByteStream "+id;
finished = true;
else
st += c;
done
done
*s = st; // pass back result
+ //println$ "Got: " + st;
+
}
proc get_line[istr with IByteStream[istr]]
diff --git a/src/lib/std/system.flx b/src/lib/std/system.flx
index 8c5660a..6cae2d2 100644
--- a/src/lib/std/system.flx
+++ b/src/lib/std/system.flx
@@ -8,7 +8,7 @@ module System
fun args () => List::map (the argv) (List::range argc);
fun system: string -> int = "::std::system($1.data())"
requires cstdlib;
- proc exit: int = '{ fprintf(stderr,"Flx exit\n"); ::std::exit($1);}';
+ proc exit: int = '::std::exit($1);';
proc abort: 1 = "::std::abort($1);";
type ptf_t = "thread_frame_t*";
const ptf:ptf_t = "FLX_POINTER_TO_THEAD_FRAME";
diff --git a/tools/webserver.flx b/tools/webserver.flx
index 4539259..8fe252d 100644
--- a/tools/webserver.flx
+++ b/tools/webserver.flx
@@ -1,6 +1,8 @@
if POSIX do
include "flx_faio_posix"; // aio_ropen
//open Faio_posix;
+include "std/posix/signal";
+Posix_Signal::ignore_signal(Posix_Signal::SIGPIPE);
done
include "flx_socket";
@@ -192,15 +194,18 @@ var p = webby_port;
var listener: socket_t;
mk_listener(&listener, &p, 10);
-proc handler (s:socket_t) ()
+var clock = Faio::mk_alarm_clock();
+
+noinline proc handler (var k:socket_t) ()
{
- dbg$ "Spawned fthread running for socket "+str s+"\n";
+ dbg$ "Spawned fthread running for socket "+str k+"\n";
// should spawn fthread here to allow for more io overlap
var line: string;
- get_line(s, &line, str(s)); // should be the GET line.
+ get_line(k, &line, str(k)); // should be the GET line.
+ //cat(s, DEVNULL);
- print$ "got line from socket "+str s+": "; print line; endl;
+ print$ "got line from socket "+str k+": "; print line; endl;
// now I need to parse the GET line, get a file name out of its url
// (e.g. unqualfied -> index.html and name/flx.jpg -> flx.jpg
@@ -213,19 +218,20 @@ proc handler (s:socket_t) ()
print "base="; print base; endl;
print "file="; print file; endl;
- serve_file(file, s);
+ serve_file(file, k);
}
endmatch;
// we've only read the GET line, so let's flush out the rest of
// the http request so we don't get connection reset errors when
// we close the socket. shutting down stops cat blocking (?)
- Faio_posix::shutdown(s, 1); // disallow further sends.
- cat(s, DEVNULL);
+ //Faio_posix::shutdown(s, 1); // disallow further sends.
+ //cat(s, DEVNULL);
- fprint$ cerr,"fthread closing socket "+str s+"\n";
- ioclose(s);
- fprint$ cerr,"fthread "+str s+" terminating!\n";
+ fprint$ cerr,"fthread closing socket "+str k+"\n";
+ Faio::sleep(clock,0.1); // give OS time to empty its buffers
+ ioclose(k);
+ fprint$ cerr,"fthread "+str k+" terminating!\n";
};
@@ -237,7 +243,8 @@ forever {
// hmm - spawning an fthread is blocking the web server. don't know why
print$ "spawning fthread to handle connection "+str s+"\n";
- spawn_fthread (handler s);
+ var h = handler s;
+ spawn_fthread h;
//collect(); // this hangs everything, no idea why!
};
commit 2b7679f462a2f271271b84688a964537115a806e
Author: skaller <Max.S...@gmail.com>
Date: Wed Oct 13 04:48:32 2010 +1100
Debugging to try to find out what the webserver is doing ..
diff --git a/lpsrc/flx_stdlib.pak b/lpsrc/flx_stdlib.pak
index 53d8020..9826eb3 100644
--- a/lpsrc/flx_stdlib.pak
+++ b/lpsrc/flx_stdlib.pak
@@ -239,25 +239,15 @@ open[T in basic_types] Show[T];
open Show[bool];
@doc()
-@h = tangler("lib/std/system.flx")
+@h = tangler("lib/std/version.flx")
@select(h)
publish "System Interface"
-module System
+module Version
{
- const argc:int = "PTF argc";
- const _argv:&charp= "PTF argv";
-
- fun argv:int -> string = '::std::string($1<0||$1>=PTF argc??"":PTF argv[$1])';
- fun args () => List::map (the argv) (List::range argc);
@tangle(' const felix_version : string = \'::std::string("'+config.flx_version+'")\';')
- fun system: string -> int = "::std::system($1.data())"
- requires cstdlib;
- proc exit: int = "::std::exit($1);";
- proc abort: 1 = "::std::abort($1);";
- type ptf_t = "thread_frame_t*";
- const ptf:ptf_t = "FLX_POINTER_TO_THEAD_FRAME";
}
+
@h = tangler("lib/plat/filename.flx")
@select(h)
include "std/list.flx";
diff --git a/src/demux/flx_demux.cpp b/src/demux/flx_demux.cpp
index e101dde..9cd64fe 100644
--- a/src/demux/flx_demux.cpp
+++ b/src/demux/flx_demux.cpp
@@ -12,16 +12,16 @@ pthread_thread(void* udat)
while(1)
{
- //fprintf(stderr, "ETHREAD ABOUT TO WAIT\n");
+ fprintf(stderr, "ETHREAD ABOUT TO WAIT\n");
d->wait(); // this does it
- //fprintf(stderr, "ETHREAD CHECKING QUIT FLAG\n");
+ fprintf(stderr, "ETHREAD CHECKING QUIT FLAG\n");
demux_quit_flag* f = d->get_quit_flag();
if(f)
{
// got a quit flag - this is the very last thing we do before
// exiting. don't use the demuxer after this as it's probably been
// destructed.
- //fprintf(stderr, "ETHREAD GOT QUIT FLAG, SIGNALLING AND EXITING\n");
+ fprintf(stderr, "ETHREAD GOT QUIT FLAG, SIGNALLING AND EXITING\n");
f->signal_true();
// in the case of a system takedown there's no guarantee that
// anything after the signal_finish will be run at all, so this
@@ -29,8 +29,8 @@ pthread_thread(void* udat)
break; // outta here
}
}
- //fprintf(stderr, "ETHREAD EXITING\n");
- // fprintf(stderr, "proto_async was asked to quit...\n");
+ fprintf(stderr, "ETHREAD EXITING\n");
+ fprintf(stderr, "proto_async was asked to quit...\n");
}
flx_demuxer_t *
diff --git a/src/demux/posix/demux_posix_demuxer.cpp b/src/demux/posix/demux_posix_demuxer.cpp
index f71285b..09cb8cc 100644
--- a/src/demux/posix/demux_posix_demuxer.cpp
+++ b/src/demux/posix/demux_posix_demuxer.cpp
@@ -71,7 +71,7 @@ posix_demuxer::socket_send(int s, sel_param* pb)
fprintf(stderr,"posix_demuxer:socket_send\n", nbytes);
nbytes = send(s, pb->buffer + pb->bytes_written,
pb->buffer_size - pb->bytes_written, 0);
- fprintf(stderr,"posix_demuxer:socket_send wrote %d bytes\n", nbytes);
+ fprintf(stderr,"posix_demuxer:socket_send wrote %ld bytes\n", (long) nbytes);
/*
fprintf(stderr,"posix_demuxer SEND: s=%d, pb=%p buf+%d, req=%d, got %d\n",
@@ -84,7 +84,9 @@ posix_demuxer::socket_send(int s, sel_param* pb)
// that the connection closed?
if(-1 == nbytes)
{
+ fprintf(stderr,"posix_demuxer: socket send failed, connection closed by client?\n");
perror("send");
+ fprintf(stderr,"Should have printed the error code above ..\n");
return true; // I guess the connection closed
}
else
diff --git a/src/faio/faio_asyncio.cpp b/src/faio/faio_asyncio.cpp
index bd7febd..e465e35 100644
--- a/src/faio/faio_asyncio.cpp
+++ b/src/faio/faio_asyncio.cpp
@@ -21,13 +21,13 @@ void flx_driver_request_base:: start_async_op(finote_t *fn_a)
void flx_driver_request_base:: notify_finished()
{
- //fprintf(stderr, "faio_req=%p, Notify %p\n", this,fn);
+ fprintf(stderr, "faio_req=%p, Notify %p\n", this,fn);
assert(fn!=0);
finote_t *fin = fn;
fn=0;
fin->signal();
delete fin;
- //fprintf(stderr, "faio_req=%p, FINISHED\n",this);
+ fprintf(stderr, "faio_req=%p, FINISHED\n",this);
}
}}
diff --git a/src/lib/std/system.flx b/src/lib/std/system.flx
new file mode 100644
index 0000000..8c5660a
--- /dev/null
+++ b/src/lib/std/system.flx
@@ -0,0 +1,16 @@
+publish "System Interface"
+module System
+{
+ const argc:int = "PTF argc";
+ const _argv:&charp= "PTF argv";
+
+ fun argv:int -> string = '::std::string($1<0||$1>=PTF argc??"":PTF argv[$1])';
+ fun args () => List::map (the argv) (List::range argc);
+ fun system: string -> int = "::std::system($1.data())"
+ requires cstdlib;
+ proc exit: int = '{ fprintf(stderr,"Flx exit\n"); ::std::exit($1);}';
+ proc abort: 1 = "::std::abort($1);";
+ type ptf_t = "thread_frame_t*";
+ const ptf:ptf_t = "FLX_POINTER_TO_THEAD_FRAME";
+}
+
diff --git a/tools/webserver.flx b/tools/webserver.flx
index a349c0a..4539259 100644
--- a/tools/webserver.flx
+++ b/tools/webserver.flx
@@ -223,13 +223,15 @@ proc handler (s:socket_t) ()
Faio_posix::shutdown(s, 1); // disallow further sends.
cat(s, DEVNULL);
- fprint$ cerr,"closing socket "+str s+"\n";
+ fprint$ cerr,"fthread closing socket "+str s+"\n";
ioclose(s);
+ fprint$ cerr,"fthread "+str s+" terminating!\n";
};
forever {
var s: socket_t;
+ dbg$ "Waiting for connection\n";
accept(listener, &s); // blocking
dbg$ "got connection "+str s + "\n"; // error check here
@@ -239,4 +241,5 @@ forever {
//collect(); // this hangs everything, no idea why!
};
+println "WEB SERVER FINNISHED?";
iclose(listener);
commit 753016f13e52956ea3f34e6c391c290bdf694cf5
Author: skaller <Max.S...@gmail.com>
Date: Tue Oct 12 10:53:51 2010 +1100
Lots of misc changes. Fixed flx so --help works.
Fiddled with many thing to try to get the webserver to work.
Still not working, terminates for unknown reason, DEBUG is not
working in flx for some reason.
diff --git a/lpsrc/flx_maker.pak b/lpsrc/flx_maker.pak
index 5404421..2c6ba70 100644
--- a/lpsrc/flx_maker.pak
+++ b/lpsrc/flx_maker.pak
@@ -108,6 +108,730 @@ mkgif("minus",plus)
mkgif("dot",dot)
//
+@head(1, "Run script written in Felix")
+
+@# ------------- UNIVERSAL RUN SCRIPT flx.flx
+@# ------------- This script should be compiled to binary using one of the other
+@# ------------- run scripts, or even do it the hard way, the result is a binary
+@# ------------- executable with no dependencies which was generated from platform
+@# ------------- independent code. Obviously the install directory is bound in,
+@# ------------- but it can easily be overridden on the command line by again writing
+@# ------------- a native shell script to drive it (but now leaving the binary to
+@# ------------- do most of the command line argument processing etc
+
+@select(tangler('src/flx/flx.flx','data'))
+
+dbug := false; // switch off for production
+
+False := false;
+True := true;
+@def ts(x): tangle(x+";")
+
+@def tv(x): ts("var "+x)
+
+@tv("INSTALL_ROOT_TOPDIR=Filename::join(%r, 'lib/felix')" % (config.PREFIX))
+@tv("INSTALL_ROOT=Filename::join(INSTALL_ROOT_TOPDIR, 'felix-%s')" % (config.flx_version))
+var FLX_INSTALL_DIR = Env::getenv("FLX_INSTALL_DIR", INSTALL_ROOT);
+@tv("CYGWIN="+str(config.CYGWIN))
+@tv("WIN32="+str(config.WIN32))
+@tv("MACOSX="+str(config.MACOSX))
+@tv("HAVE_GNU="+str(config.HAVE_GNU))
+@tv("HAVE_MSVC="+str(config.HAVE_MSVC))
+@if config.TARGET_CXX.options.HAVE_PIC:
+ tv('CCOBJ_DLLIB="'+config.TARGET_CXX.options.CCOBJ_DYNAMIC_FLX+' '+config.TARGET_CXX.options.PIC+'"')
+ else:
+ tv('CCOBJ_DLLIB="'+config.TARGET_CXX.options.CCOBJ_DYNAMIC_FLX+'"')
+@tv('CCLINK_DLLIB="'+config.TARGET_CXX.options.CCLINK_DYNAMIC_FLX+'"')
+@tv('CCOBJ_STATIC_LIB="'+config.TARGET_CXX.options.CCOBJ_STATIC_FLX+'"')
+@tv('CCLINK_STATIC="'+config.TARGET_CXX.options.CCLINK_STATIC+'"')
+@tv('VERSION="'+config.flx_version+'"')
+@tv('EXT_LIB="'+config.TARGET_CXX.options.EXT_LIB+'"')
+@tv('EXT_STATIC_OBJ="'+config.TARGET_CXX.options.EXT_STATIC_OBJ+'"')
+@tv('EXT_SHARED_OBJ="'+config.TARGET_CXX.options.EXT_SHARED_OBJ+'"')
+@tv('EXT_EXE="'+config.TARGET_CXX.options.EXT_EXE+'"')
+@tv('EXT_SHLIB="'+config.TARGET_CXX.options.EXT_SHLIB+'"')
+@tv('SPEC_OBJ_FILENAME="'+config.TARGET_CXX.options.SPEC_OBJ_FILENAME+'"')
+@tv('SPEC_EXE_FILENAME="'+config.TARGET_CXX.options.SPEC_EXE_FILENAME+'"')
+@tv('OPTIMISE="'+config.TARGET_CXX.options.OPTIMISE+' "')
+@tv('DEBUG_FLAGS="'+config.TARGET_CXX.options.DEBUG_FLAGS+' "')
+
+// check for test mode: this argument must come first
+
+var TESTMODE=0;
+var RECOMPILE=0;
+var DEBUG=0;
+var DEBUG_COMPILER=0;
+var INLINE=100;
+var ECHO=0;
+var TIME=0;
+var NOOPTIMISE=0;
+var TIMECMD="time -p";
+
+@if config.DEFAULT_LINK_MODEL=="dynamic":
+ tv("STATIC=0;")
+ else:
+ tv("STATIC=1;")
+
+var RUNIT=1;
+var CCFLAGS="";
+var FELIX=1;
+var LINKER_SWITCHES="";
+var MACROS="";
+var grab=1;
+var cpps="";
+var cppos="";
+var INCLUDE_DIRS="";
+var INCLUDE_FILES="";
+var NOSTDLIB=0;
+var STDOUT="";
+var STDIMPORT="--import=nugram.flxh --import=flx.flxh";
+var IMPORTS="";
+var OUTPUT_DIR="";
+
+var DRIVER_PKG = "";
+var DRIVER = "";
+var LINK_STRING = "";
+
+var pkgs="";
+
+var CONFIG_DIR = "";
+var FLXG = "";
+var FLXRUN = "";
+
+fun splitext(p:string)=>
+ if p.[-4 to] == ".flx" then p.[to -4],"flx"
+ elif p.[-4 to] == ".cpp" then p.[to -4],"cpp"
+ else p,""
+ endif
+;
+
+gen system(cmd:string):int= {
+ if ECHO==1 do println(cmd); done
+ var result = System::system(cmd);
+ if ECHO==1 do println("Result code " + str(result)); done
+ return result;
+}
+
+var argno=1;
+fun prefix(arg:string,key:string)=>
+ arg.[to len key]==key
+;
+
+var compile_exts = List::list ('cpp','cxx');
+var linkexts = List::list ('o','obj','lib','dll','a','so');
+var arg = "";
+var result = 0;
+
+whilst grab == 1 and argno<System::argc do
+ arg = System::argv argno;
+ dbug?? println$ "ARGNO="+str(argno)+", arg='"+arg+"'";
+ var path,ext = splitext(arg);
+ var dir,base = Filename::split1(path);
+ dbug?? println$ "path="+path+", ext="+ext+",dir="+dir+",base="+base;
+ if ext != "flx" and ext != "" do
+ // add to list of things to link, and also things to compile
+ // if the extension is appropriate
+ if List::mem eq of (string * string) compile_exts ext do
+ cpps = cpps + " " + arg;
+ cppos = cppos + " " + path + "." + EXT_OBJ;
+ else
+ cppos = cppos + " " + arg;
+ done
+
+ elif arg == "--nostdimport" do
+ dbug?? println "No standard library import";
+ // Note: currently, Felix compiler generates code that REQUIRES
+ // the standard library, eg the driver passes a gc_profile_t record
+ // and the compiler generates _uctor_ objects, etc etc
+ STDIMPORT="";
+
+ elif prefix(arg,"--import=") do
+ dbug?? println "Add import";
+ IMPORTS=IMPORTS + " " + arg.[9 to];
+
+ elif prefix(arg,"--test=") do
+ dbug?? println "Set test directory";
+ TESTMODE=1;
+ FLX_INSTALL_DIR=arg.[7 to];
+
+ elif arg=="--test" do
+ dbug?? println "Set test directory";
+ TESTMODE=1;
+ FLX_INSTALL_DIR=".";
+
+ elif arg=="--install" do
+ dbug?? println "Intall Felix";
+ println "Install Felix: ONLY ON UNIX (you may need to be superuser)";
+ println "Always installs the --test directory to the configured install target";
+ println "Because that is hard coded into this program";
+ println "Note: does NOT install this program 'flx' into your PATH!";
+ println$ "FROM: " + FLX_INSTALL_DIR;
+ println$ "TO : " + INSTALL_ROOT;
+ if FLX_INSTALL_DIR == INSTALL_ROOT do
+ println "Can't install, src and dst are the same";
+ System::exit(1);
+ else
+ result=system("mkdir -pv "+INSTALL_ROOT_TOPDIR);
+ if result != 0 do
+ println$ "Cannot create directory " + INSTALL_ROOT_TOPDIR;
+ System::exit 1;
+ done
+ result=system("cp -r "+FLX_INSTALL_DIR+" "+INSTALL_ROOT);
+ if result == 0 do println "Install succeeded"
+ else println$ "Install failed, code = " + str(result);
+ done
+ System::exit(result);
+ done
+
+ elif prefix(arg,"--stdout=") do
+ dbug?? println "Redirect standard output";
+ // of the Felix program only: used for saving the output
+ // to a file so the test harness can compare it with an .expect file
+ STDOUT=arg.[9 to];
+
+ elif arg=="--force" do
+ dbug?? println "Force recompilation";
+ // of the felix code, runs Felix unless --nofelix is set
+ // the C++ compiler is run unless the felix compile failed
+ RECOMPILE=1;
+
+ elif arg=="--debug" do
+ dbug?? println "Enable runtime debugging";
+ DEBUG=1;
+
+ elif arg=="--debug-compiler" do
+ dbug?? println "Enable compiler debugging";
+ DEBUG_COMPILER=1;
+
+ elif arg=="--nooptimise" do
+ dbug?? println "Disable optimisation";
+ NOOPTIMISE=1;
+
+ elif arg=="--nostdlib" do
+ dbug?? println "Do not load standard library";
+ NOSTDLIB=1;
+
+ elif arg == "--echo" do
+ dbug?? println "Echo commands sent to system";
+ ECHO=1;
+
+ elif arg == "--static" do
+ dbug?? println "Compile a statically linked program";
+ STATIC=1;
+
+ elif prefix(arg,"--inline=") do
+ dbug?? println "Set inline aggressiveness";
+ INLINE=int(arg.[to 9]);
+
+ elif arg == "--inline" do
+ dbug?? println "Set inline aggressiveness";
+ INLINE=100;
+
+ elif arg == "--noinline" do
+ dbug?? println "Disable inlining (NOT RECOMMENDED)";
+ INLINE=0;
+
+ elif arg == "--version" do
+ dbug?? println "Print Felix version and exit";
+ print("version ..");
+ println(VERSION);
+ System::exit(0);
+
+ elif arg == "--config" do
+ println$ "VERSION = "+VERSION;
+ println$ "INSTALL_ROOT_TOPDIR= "+INSTALL_ROOT_TOPDIR;
+ println$ "INSTALL_ROOT = "+INSTALL_ROOT;
+ println$ "FLX_INSTALL_DIR = "+FLX_INSTALL_DIR;
+ println$ "";
+ println$ "CYGWIN = "+str CYGWIN;
+ println$ "WIN32 = "+str WIN32;
+ println$ "MACOSX = "+str MACOSX;
+
+ println$ "";
+ println$ "HAVE_GNU = "+str HAVE_GNU;
+ println$ "HAVE_MSVC = "+str HAVE_MSVC;
+
+ println$ "";
+ println$ "CCOBJ_DLLIB = "+CCOBJ_DLLIB;
+ println$ "CCLINK_DLLIB = "+CCLINK_DLLIB;
+ println$ "CCOBJ_STATIC_LIB = "+CCOBJ_STATIC_LIB;
+ println$ "CCLINK_STATIC = "+CCLINK_STATIC;
+
+ println$ "";
+ println$ "EXT_LIB = "+EXT_LIB;
+ println$ "EXT_STATIC_OBJ = "+EXT_STATIC_OBJ;
+ println$ "EXT_SHARED_OBJ = "+EXT_SHARED_OBJ;
+ println$ "EXT_EXE = "+EXT_EXE;
+ println$ "EXT_SHLIB = "+EXT_SHLIB;
+ println$ "SPEC_OBJ_FILENAME = "+SPEC_OBJ_FILENAME;
+ println$ "SPEC_EXE_FILENAME = "+SPEC_EXE_FILENAME;
+
+ println$ "";
+ println$ "OPTIMISE = "+str OPTIMISE;
+ println$ "DEBUG_FLAGS = "+str DEBUG_FLAGS;
+ System::exit(0);
+
+ elif arg == "--where" do
+ dbug?? println "Print location of install directory and exit";
+ println(FLX_INSTALL_DIR);
+ System::exit(0);
+
+ elif arg == "--time" do
+ dbug?? println "Time program execution and print after running";
+ TIME=1;
+
+ elif prefix(arg,"--output_dir=") do
+ dbug?? println "Set the directory for compiler generated C++ files";
+ OUTPUT_DIR=arg;
+
+ elif arg == "--help" do
+ dbug?? println "Display top level manual page using 'man' program";
+ C_hack::ignore(system( "man -M "+FLX_INSTALL_DIR+Filename::sep+"man"+" flx"));
+ System::exit(0);
+
+ elif arg == "-c" do
+ dbug?? println "Compile program but do not run it";
+ RUNIT=0;
+
+ elif prefix(arg,"-I") do
+ dbug?? println "Set include directories for both Felix and C/C++";
+ INCLUDE_DIRS=INCLUDE_DIRS + " " + arg;
+
+ elif arg== "--nofelix" do
+ dbug?? println "Do not translate Felix code, just compile generated C++ (used to debug at C++ level)";
+ FELIX=0;
+
+ elif prefix(arg,"-l") or prefix(arg,"-L") do
+ dbug?? println "Set extra switched for linker";
+ LINKER_SWITCHES=LINKER_SWITCHES + " " + arg;
+
+ elif prefix(arg,"-D") do
+ dbug?? println "Set extra macros for C++ compilation";
+ MACROS=MACROS + " " + arg;
+
+ elif prefix(arg,"--pkg=") do
+ dbug?? println "Add pkgconfig package to link";
+ pkgs= pkgs + " " + arg.[6 to];
+
+ elif prefix(arg,"--") do
+ dbug?? println "Unknown -- style option, abort";
+ println("Unknown option '"+ arg+"'");
+ System::exit(1);
+
+// the main filename -- subsequent args are args to flx_run
+ else
+ dbug?? println "Assume we have the filename now";
+ grab=0;
+ done
+ argno = argno + 1;
+done
+
+dbug?? println$ grab,argno,System::argc;
+if grab == 1 and argno == System::argc do
+ println("usage: flx [options] filename");
+ System::exit(1);
+done
+
+dbug?? println "#--------";
+dbug?? println$ "DONE, option index = "+str(argno);
+dbug?? println$ "path="+path+": dir="+dir+",base="+base", ext="+ext;
+dbug?? println$ "cpps="+cpps;
+dbug?? println$ "cppos="+cppos;
+
+if NOOPTIMISE == 0 do
+ dbug?? println "Set C++ compiler optimisation switches";
+ CCFLAGS=CCFLAGS+" " + OPTIMISE;
+else
+ dbug?? println "What, no optimisation?";
+done
+
+@if config.HAVE_MSVC:
+ tangle('dbug?? println "Set MSVC linker options";');
+ tv('DLINK_STRING="/link /DLL /LIBPATH:"+FLX_INSTALL_DIR+"\\\\lib\\\\rtl "')
+ tangle('SLINK_STRING="/link /DLL /LIBPATH:"+FLX_INSTALL_DIR+"\\\\lib\\\\rtl "')
+ elif config.CYGWIN or config.WIN32:
+ tangle('dbug?? println "Set Cygwin linker options";');
+ tv('DLINK_STRING="-L"+{FLX_INSTALL_DIR+"/bin "')
+ tv('SLINK_STRING="-L"+FLX_INSTALL_DIR+"/lib/rtl "')
+ else:
+ tangle('dbug?? println "Set Unix linker options";');
+ tv('DLINK_STRING="-L"+FLX_INSTALL_DIR+"/lib/rtl "')
+ tv('SLINK_STRING="-L"+FLX_INSTALL_DIR+"/lib/rtl "')
+
+
+var PKGCONFIG=Filename::join$ List::list(FLX_INSTALL_DIR,"bin","flx_pkgconfig");
+dbug?? println$ "Felix package manager program is "+PKGCONFIG;
+
+if ECHO == 1 do
+ println("#FLX_INSTALL_DIR="+FLX_INSTALL_DIR);
+ println("#PKGCONFIG="+PKGCONFIG);
+done
+
+CONFIG_DIR = Filename::join(FLX_INSTALL_DIR,'config');
+dbug?? println$ "Felix package manager config directory is "+CONFIG_DIR;
+// make a list of any *.cpp files (or other g++ options ..)
+
+var EXT_OBJ =
+ if STATIC == 0 then EXT_SHARED_OBJ
+ else EXT_STATIC_OBJ
+ endif
+;
+
+// this hack forces a directory name, because executing "prog"
+// can fail if the currect directory is not on the PATH,
+// or worse, the wrong program can execute. The PATH is not
+// searched if the filename includes a / somewhere so force one in.
+// similarly for dynamic loaders looking for shared libraries
+//
+// It would probably be better to convert any relative filename
+// to an absolute one, however this only makes sense on Unix
+// since Windows has multiple "drives" it is much harder to
+// do the conversion.
+dir =
+ if dir != "" then dir
+ else "."
+ endif
+;
+
+var filebase = Filename::join(dir,base);
+dbug?? println$ "User program base is " + filebase;
+
+// Find absolute pathname
+
+if path == "" do
+ fprint$ cerr, ("No such felix program: "+path+"\n");
+ System::exit(1);
+done
+
+gen get_stdout(x:string) = {
+ // We're screwed if popen doesn't work ..
+/*
+ if os.name == "nt": // popen doesn't work on Windows
+*/
+ result := system(x + " >tmp.out");
+ Stdout::flush();
+ output := Text_file::load "tmp.out";
+/*
+ else:
+ fout = os.popen(x+" 2>&1 ","r")
+ output = []
+ try:
+ for line in fout:
+ output.append(line)
+ if outit: outit(line)
+ finally:
+ result = fout.close()
+*/
+ return result,output;
+}
+
+gen xqt(cmd:string) = {
+ ECHO == 1 or dbug ?? println("cmd="+cmd);
+ var result,output = get_stdout(cmd);
+ if result == 0 do
+ n :=
+ match find_first_of (output, char "\n") with
+ | Some ?n => n
+ | None => len output
+ endmatch
+ ;
+ output = output.[to n]; // first line excluding newline
+ ECHO==1 or dbug ?? println("output='"+output+"'");
+ else
+ dbug ?? println ("COMMAND FAILED");
+ fprint$ cerr, ("Error "+repr(result)+" executing command " + cmd + "/n");
+ System::exit result;
+ done
+ return output;
+}
+
+proc calpackages () {
+
+ // find external header files
+ var PKGCONFIG_CFLAGS=PKGCONFIG+ " --path+="+Filename::join(FLX_INSTALL_DIR,"config") + " --field=cflags ";
+
+ // external header files
+ var PKGCONFIG_INCLUDES=PKGCONFIG+ " --path+="+Filename::join(FLX_INSTALL_DIR,"config") + " --field=includes ";
+
+ // find external dynload libraries
+ var PKGCONFIG_DLIBS=PKGCONFIG+" -r --path+="+Filename::join(FLX_INSTALL_DIR,"config") + " --field=provides_dlib --field=requires_dlibs ";
+
+ // find external static libraries
+ var PKGCONFIG_SLIBS=PKGCONFIG+" -r --keeprightmost --path+="+Filename::join(FLX_INSTALL_DIR,"config") + " --field=provides_slib --field=requires_slibs ";
+
+ //find driver package required
+ var PKGCONFIG_DRIVER=PKGCONFIG+" --path+="+Filename::join(FLX_INSTALL_DIR,"config") + " --field=flx_requires_driver ";
+
+
+ // find all include directories
+ var x = xqt(PKGCONFIG_CFLAGS+ " @"+filebase+".resh");
+ INCLUDE_DIRS=INCLUDE_DIRS +" " + x;
+
+ // find all include files
+ x = xqt(PKGCONFIG_INCLUDES+ " @"+filebase+".resh");
+ INCLUDE_FILES=INCLUDE_FILES +" " + x;
+
+ // find the driver package
+ DRIVER_PKG=xqt(PKGCONFIG_DRIVER+" @"+filebase+".resh");
+ DRIVER_PKG == "" ?? DRIVER_PKG="flx_run";
+
+ // find the driver entity
+ if STATIC == 0 do
+ // dynamic linkage: the driver executable
+ DRIVER=Filename::join$ List::list (FLX_INSTALL_DIR,"bin",DRIVER_PKG+EXT_EXE);
+ else
+ // static linkage: the driver object file
+ DRIVER=Filename::join$ List::list (FLX_INSTALL_DIR,"lib","rtl",DRIVER_PKG+EXT_STATIC_OBJ);
+ done
+
+ if STATIC == 0 do
+ // dynamic linkage: all the libraries required by the application
+ LINK_STRING=DLINK_STRING+LINKER_SWITCHES+xqt(
+ PKGCONFIG_DLIBS+" @"+filebase+".resh");
+ else
+ // static linkage: all the libraries required by the application and driver
+ LINK_STRING=SLINK_STRING+LINKER_SWITCHES+xqt(
+ PKGCONFIG_SLIBS+" "+DRIVER_PKG+" @"+filebase+".resh");
+ done
+
+ if ECHO == 1 do
+ println("//RESOURCE FILE="+filebase+".resh");
+ println("//INCLUDE_DIRS="+INCLUDE_DIRS);
+ println("//INCLUDE_FILES="+INCLUDE_FILES);
+ println("//DRIVER="+DRIVER);
+ println("//LINK_STRING="+LINK_STRING);
+ done
+}
+
+proc write_include_file(path:string) {
+ includes := split (strip INCLUDE_FILES,char " ");
+ var f = Text_file::fopen_output(path+".includes");
+ List::iter
+ (proc (i:string) { Text_file::writeln$ f, "#include " + i; })
+ includes
+ ;
+ Text_file::fclose f;
+}
+
+
+// grab program arguments
+grab=1;
+fun pop (x:List::list[string], n:int) =>
+ if n == 0 then x
+ else match x with | Cons(_,?t) => pop(t,n-1) | Empty[string] => List::Empty[string] endmatch
+ endif
+;
+
+var tail = pop (System::args(), argno);
+var args= List::cat " " tail;
+dbug?? println$ "Target program args = "+args;
+
+var INCLUDE_DIR="-I"+Filename::join(FLX_INSTALL_DIR,"lib","rtl") + " -I"+Filename::join(FLX_INSTALL_DIR,"config","target");
+dbug?? println$ "C++ Include directory for Felix library " + INCLUDE_DIR;
+
+var FLXLIB="-I"+Filename::join(FLX_INSTALL_DIR,"lib");
+var STDLIB="std";
+if NOSTDLIB == 1 do
+ FLXLIB="";
+ STDLIB="";
+done
+
+if WIN32 do
+ FLXG=Filename::join(FLX_INSTALL_DIR, 'bin', 'flxg');
+ FLXRUN='';
+else
+ FLXG="env PATH="+FLX_INSTALL_DIR+"/bin:$PATH "+FLX_INSTALL_DIR+"/bin/flxg";
+ // the mac uses DYLD_LIBRARY_PATH instead of LD_LIBRARY_PATH
+ if MACOSX do
+ FLXRUN="env DYLD_LIBRARY_PATH="+FLX_INSTALL_DIR+"/lib/rtl:$DYLD_LIBRARY_PATH ";
+ else
+ FLXRUN="env LD_LIBRARY_PATH="+FLX_INSTALL_DIR+"/lib/rtl:$LD_LIBRARY_PATH ";
+ done
+done
+
+var DEBUGSWITCH="";
+DEBUG_COMPILER == 1?? DEBUGSWITCH=" --debug";
+
+var STATIC_ENV="";
+DEBUG_COMPILER == 1?? STATIC_ENV="env FLX_DEBUG=1 ";
+
+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>";
+
+
+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)
+ dbug?? println "Checking to see if the binary is uptodate";
+ if STATIC == 0 do
+ if (filetime(filebase+EXT_SHLIB) > filetime (filebase+".flx")) do
+ dbug?? println$ "Running dynamically linked binary";
+ calpackages();
+ cmd=FLXRUN+DRIVER+DEBUGSWITCH+" "+ filebase+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(filebase+EXT_EXE) > filetime(filebase+".flx")) do
+ dbug?? println$ "Running statically linked binary";
+ cmd=STATIC_ENV+" "+filebase+" "+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
+
+var VERBOSE = "";
+if DEBUG_COMPILER == 1 do
+ VERBOSE="-v";
+ dbug?? println "Compiler debugging on";
+else
+ VERBOSE="-q";
+ dbug?? println "Compiler debugging off";
+done
+
+if DEBUG==1 do
+ CCFLAGS=CCFLAGS+DEBUG_FLAGS;
+done
+
+var FLXFLAGS="--inline="+str(INLINE) + ' ' + str(OUTPUT_DIR);
+
+var FCMD="";
+var LCMD="";
+var CCMD="";
+
+if FELIX == 1 do
+ FCMD=List::cat ' ' (List::list (
+ FLXG,
+ VERBOSE, FLXFLAGS, FLXLIB,
+ INCLUDE_DIRS, STDIMPORT, IMPORTS,
+ STDLIB, filebase));
+ dbug?? println$ "Felix command="+FCMD;
+ result=system(FCMD);
+ if result != 0 do
+ dbug?? println "Felix compilation failed";
+ System::exit(int(0!=result));
+ done
+ dbug?? println "Felix compilation succeeded";
+ calpackages();
+ write_include_file(filebase);
+else
+ dbug?? println "Felix compilation skipped by switch";
+done
+
+if STATIC == 0 do
+ dbug?? println "Dynamic linkage";
+ CCMD=List::cat ' ' (List::list (
+ CCOBJ_DLLIB, CCFLAGS, "-DTARGET_BUILD",
+ INCLUDE_DIR, INCLUDE_DIRS, MACROS,
+ cpps, filebase+".cpp",
+ SPEC_OBJ_FILENAME+filebase+EXT_OBJ));
+ LCMD=List::cat ' ' (List::list (
+ CCLINK_DLLIB, CCFLAGS,
+ cppos, filebase+EXT_OBJ,
+ SPEC_EXE_FILENAME+filebase+EXT_SHLIB,
+ LINK_STRING));
+ dbug?? println$ "C++ command="+CCMD;
+ result = system(CCMD);
+ if result == 0 do
+ dbug?? println$ "Link command="+LCMD;
+ result = system(LCMD);
+ if result == 0 do
+ if RUNIT == 1 do
+ if TIME == 1 do
+ cmd=List::cat ' ' (List::list (
+ TIMECMD,
+ FLXRUN+DRIVER+DEBUGSWITCH,
+ filebase+EXT_SHLIB, args));
+ else
+ cmd=List::cat ' ' (List::list (
+ FLXRUN+DRIVER+DEBUGSWITCH,
+ filebase+EXT_SHLIB, args));
+ done
+ if STDOUT != "" do cmd=cmd+" > " +STDOUT; done
+ dbug?? println$ "Run command="+cmd;
+ System::exit(int(0!=system(cmd)));
+ else
+ dbug?? println "Not running program selected by switch";
+ done
+ else
+ dbug?? println "Dynamic linkage failed";
+ done
+ else
+ dbug?? println "C++ compilation failed";
+ done
+else
+ dbug?? println "Static linkage";
+ CCMD=List::cat ' ' (List::list (
+ CCOBJ_STATIC_LIB,
+ CCFLAGS, "-DTARGET_BUILD",
+ "-DFLX_STATIC_LINK", INCLUDE_DIR, INCLUDE_DIRS,
+ MACROS, cpps, filebase+".cpp",
+ SPEC_OBJ_FILENAME+filebase+EXT_OBJ));
+ LCMD=List::cat ' ' (List::list (
+ CCLINK_STATIC, SPEC_EXE_FILENAME+filebase+EXT_EXE,
+ filebase+EXT_OBJ, DRIVER, cppos, LINK_STRING));
+ dbug?? println$ "C++ command="+CCMD;
+ result=system(CCMD);
+ if result == 0 do
+ dbug?? println$ "Link command="+LCMD;
+ result=system(LCMD);
+ if result == 0 do
+ // rm -f "$base.cpp"
+ if RUNIT == 1 do
+ if TIME == 1 do
+ cmd= List::cat ' ' (List::list (
+ TIMECMD, STATIC_ENV, filebase, args));
+ else
+ cmd=List::cat ' ' (List::list (
+ STATIC_ENV, filebase,args));
+ done
+ if STDOUT != "" do cmd=cmd + " > "+STDOUT; done
+ dbug?? println$ "Run command="+cmd;
+ System::exit(int(0!=system(cmd)));
+ else
+ dbug?? println "Not running program selected by switch";
+ done
+ else
+ dbug?? println "Static Linkage failed";
+ done
+ else
+ dbug?? println "C++ compilation failed";
+ done
+done
+
+System::exit(int(0!=result));
+
+
@head(1,'Run script')
@# ------------- RUN SCRIPT flx.bat FOR WINDOWS COMMAND LINE
@@ -1220,694 +1944,6 @@ else
eval $cmd || exit $?
fi
fi
-
-@# ------------- UNIVERSAL RUN SCRIPT flx.flx
-@# ------------- This script should be compiled to binary using one of the other
-@# ------------- run scripts, or even do it the hard way, the result is a binary
-@# ------------- executable with no dependencies which was generated from platform
-@# ------------- independent code. Obviously the install directory is bound in,
-@# ------------- but it can easily be overridden on the command line by again writing
-@# ------------- a native shell script to drive it (but now leaving the binary to
-@# ------------- do most of the command line argument processing etc
-
-@select(tangler('src/flx/flx.flx','data'))
-
-dbug := false; // switch off for production
-
-False := false;
-True := true;
-@def ts(x): tangle(x+";")
-
-@def tv(x): ts("var "+x)
-
-@tv("INSTALL_ROOT_TOPDIR=Filename::join(%r, 'lib/felix')" % (config.PREFIX))
-@tv("INSTALL_ROOT=Filename::join(INSTALL_ROOT_TOPDIR, 'felix-%s')" % (config.flx_version))
-var FLX_INSTALL_DIR = Env::getenv("FLX_INSTALL_DIR", INSTALL_ROOT);
-@tv("CYGWIN="+str(config.CYGWIN))
-@tv("WIN32="+str(config.WIN32))
-@tv("MACOSX="+str(config.MACOSX))
-@tv("HAVE_GNU="+str(config.HAVE_GNU))
-@tv("HAVE_MSVC="+str(config.HAVE_MSVC))
-@if config.TARGET_CXX.options.HAVE_PIC:
- tv('CCOBJ_DLLIB="'+config.TARGET_CXX.options.CCOBJ_DYNAMIC_FLX+' '+config.TARGET_CXX.options.PIC+'"')
- else:
- tv('CCOBJ_DLLIB="'+config.TARGET_CXX.options.CCOBJ_DYNAMIC_FLX+'"')
-@tv('CCLINK_DLLIB="'+config.TARGET_CXX.options.CCLINK_DYNAMIC_FLX+'"')
-@tv('CCOBJ_STATIC_LIB="'+config.TARGET_CXX.options.CCOBJ_STATIC_FLX+'"')
-@tv('CCLINK_STATIC="'+config.TARGET_CXX.options.CCLINK_STATIC+'"')
-@tv('VERSION="'+config.flx_version+'"')
-@tv('EXT_LIB="'+config.TARGET_CXX.options.EXT_LIB+'"')
-@tv('EXT_STATIC_OBJ="'+config.TARGET_CXX.options.EXT_STATIC_OBJ+'"')
-@tv('EXT_SHARED_OBJ="'+config.TARGET_CXX.options.EXT_SHARED_OBJ+'"')
-@tv('EXT_EXE="'+config.TARGET_CXX.options.EXT_EXE+'"')
-@tv('EXT_SHLIB="'+config.TARGET_CXX.options.EXT_SHLIB+'"')
-@tv('SPEC_OBJ_FILENAME="'+config.TARGET_CXX.options.SPEC_OBJ_FILENAME+'"')
-@tv('SPEC_EXE_FILENAME="'+config.TARGET_CXX.options.SPEC_EXE_FILENAME+'"')
-@tv('OPTIMISE="'+config.TARGET_CXX.options.OPTIMISE+' "')
-@tv('DEBUG_FLAGS="'+config.TARGET_CXX.options.DEBUG_FLAGS+' "')
-
-// check for test mode: this argument must come first
-
-var TESTMODE=0;
-var RECOMPILE=0;
-var DEBUG=0;
-var DEBUG_COMPILER=0;
-var INLINE=100;
-var ECHO=0;
-var TIME=0;
-var NOOPTIMISE=0;
-var TIMECMD="time -p";
-
-@if config.DEFAULT_LINK_MODEL=="dynamic":
- tv("STATIC=0;")
- else:
- tv("STATIC=1;")
-
-var RUNIT=1;
-var CCFLAGS="";
-var FELIX=1;
-var LINKER_SWITCHES="";
-var MACROS="";
-var grab=1;
-var cpps="";
-var cppos="";
-var INCLUDE_DIRS="";
-var INCLUDE_FILES="";
-var NOSTDLIB=0;
-var STDOUT="";
-var STDIMPORT="--import=nugram.flxh --import=flx.flxh";
-var IMPORTS="";
-var OUTPUT_DIR="";
-
-var DRIVER_PKG = "";
-var DRIVER = "";
-var LINK_STRING = "";
-
-var pkgs="";
-
-var CONFIG_DIR = "";
-var FLXG = "";
-var FLXRUN = "";
-
-fun splitext(p:string)=>
- if p.[-4 to] == ".flx" then p.[to -4],"flx"
- elif p.[-4 to] == ".cpp" then p.[to -4],"cpp"
- else p,""
- endif
-;
-
-gen system(cmd:string):int= {
- if ECHO==1 do println(cmd); done
- var result = System::system(cmd);
- if ECHO==1 do println("Result code " + str(result)); done
- return result;
-}
-
-var argno=1;
-fun prefix(arg:string,key:string)=>
- arg.[to len key]==key
-;
-
-var compile_exts = List::list ('cpp','cxx');
-var linkexts = List::list ('o','obj','lib','dll','a','so');
-var arg = "";
-var result = 0;
-
-whilst grab == 1 and argno<System::argc do
- arg = System::argv argno;
- dbug?? println$ "ARGNO="+str(argno)+", arg='"+arg+"'";
- var path,ext = splitext(arg);
- var dir,base = Filename::split1(path);
- dbug?? println$ "path="+path+", ext="+ext+",dir="+dir+",base="+base;
- if ext != "flx" and ext != "" do
- // add to list of things to link, and also things to compile
- // if the extension is appropriate
- if List::mem eq of (string * string) compile_exts ext do
- cpps = cpps + " " + arg;
- cppos = cppos + " " + path + "." + EXT_OBJ;
- else
- cppos = cppos + " " + arg;
- done
-
- elif arg == "--nostdimport" do
- dbug?? println "No standard library import";
- // Note: currently, Felix compiler generates code that REQUIRES
- // the standard library, eg the driver passes a gc_profile_t record
- // and the compiler generates _uctor_ objects, etc etc
- STDIMPORT="";
-
- elif prefix(arg,"--import=") do
- dbug?? println "Add import";
- IMPORTS=IMPORTS + " " + arg.[9 to];
-
- elif prefix(arg,"--test=") do
- dbug?? println "Set test directory";
- TESTMODE=1;
- FLX_INSTALL_DIR=arg.[7 to];
-
- elif arg=="--test" do
- dbug?? println "Set test directory";
- TESTMODE=1;
- FLX_INSTALL_DIR=".";
-
- elif arg=="--install" do
- dbug?? println "Intall Felix";
- println "Install Felix: ONLY ON UNIX (you may need to be superuser)";
- println "Always installs the --test directory to the configured install target";
- println "Because that is hard coded into this program";
- println "Note: does NOT install this program 'flx' into your PATH!";
- println$ "FROM: " + FLX_INSTALL_DIR;
- println$ "TO : " + INSTALL_ROOT;
- if FLX_INSTALL_DIR == INSTALL_ROOT do
- println "Can't install, src and dst are the same";
- System::exit(1);
- else
- result=System::system("mkdir -pv "+INSTALL_ROOT_TOPDIR);
- if result != 0 do
- println$ "Cannot create directory " + INSTALL_ROOT_TOPDIR;
- System::exit 1;
- done
- result=System::system("cp -r "+FLX_INSTALL_DIR+" "+INSTALL_ROOT);
- if result == 0 do println "Install succeeded"
- else println$ "Install failed, code = " + str(result);
- done
- System::exit(result);
- done
-
- elif prefix(arg,"--stdout=") do
- dbug?? println "Redirect standard output";
- // of the Felix program only: used for saving the output
- // to a file so the test harness can compare it with an .expect file
- STDOUT=arg.[9 to];
-
- elif arg=="--force" do
- dbug?? println "Force recompilation";
- // of the felix code, runs Felix unless --nofelix is set
- // the C++ compiler is run unless the felix compile failed
- RECOMPILE=1;
-
- elif arg=="--debug" do
- dbug?? println "Enable runtime debugging";
- DEBUG=1;
-
- elif arg=="--debug-compiler" do
- dbug?? println "Enable compiler debugging";
- DEBUG_COMPILER=1;
-
- elif arg=="--nooptimise" do
- dbug?? println "Disable optimisation";
- NOOPTIMISE=1;
-
- elif arg=="--nostdlib" do
- dbug?? println "Do not load standard library";
- NOSTDLIB=1;
-
- elif arg == "--echo" do
- dbug?? println "Echo commands sent to system";
- ECHO=1;
-
- elif arg == "--static" do
- dbug?? println "Compile a statically linked program";
- STATIC=1;
-
- elif prefix(arg,"--inline=") do
- dbug?? println "Set inline aggressiveness";
- INLINE=int(arg.[to 9]);
-
- elif arg == "--inline" do
- dbug?? println "Set inline aggressiveness";
- INLINE=100;
-
- elif arg == "--noinline" do
- dbug?? println "Disable inlining (NOT RECOMMENDED)";
- INLINE=0;
-
- elif arg == "--version" do
- dbug?? println "Print Felix version and exit";
- print("version ..");
- println(VERSION);
- System::exit(0);
-
- elif arg == "--where" do
- dbug?? println "Print location of install directory and exit";
- println(FLX_INSTALL_DIR);
- System::exit(0);
-
- elif arg == "--time" do
- dbug?? println "Time program execution and print after running";
- TIME=1;
-
- elif prefix(arg,"--output_dir=") do
- dbug?? println "Set the directory for compiler generated C++ files";
- OUTPUT_DIR=arg;
-
- elif arg == "--help" do
- dbug?? println "Display top level manual page using 'man' program";
- unused := system("man -M "+FLX_INSTALL_DIR+Filename::sep+"man"+" flx");
- System::exit(0);
-
- elif arg == "-c" do
- dbug?? println "Compile program but do not run it";
- RUNIT=0;
-
- elif prefix(arg,"-I") do
- dbug?? println "Set include directories for both Felix and C/C++";
- INCLUDE_DIRS=INCLUDE_DIRS + " " + arg;
-
- elif arg== "--nofelix" do
- dbug?? println "Do not translate Felix code, just compile generated C++ (used to debug at C++ level)";
- FELIX=0;
-
- elif prefix(arg,"-l") or prefix(arg,"-L") do
- dbug?? println "Set extra switched for linker";
- LINKER_SWITCHES=LINKER_SWITCHES + " " + arg;
-
- elif prefix(arg,"-D") do
- dbug?? println "Set extra macros for C++ compilation";
- MACROS=MACROS + " " + arg;
-
- elif prefix(arg,"--pkg=") do
- dbug?? println "Add pkgconfig package to link";
- pkgs= pkgs + " " + arg.[6 to];
-
- elif prefix(arg,"--") do
- dbug?? println "Unknown -- style option, abort";
- println("Unknown option '"+ arg+"'");
- System::exit(1);
-
-// the main filename -- subsequent args are args to flx_run
- else
- dbug?? println "Assume we have the filename now";
- grab=0;
- done
- argno = argno + 1;
-done
-
-dbug?? println$ grab,argno,System::argc;
-if grab == 1 and argno == System::argc do
- println("usage: flx [options] filename");
- System::exit(1);
-done
-
-dbug?? println "#--------";
-dbug?? println$ "DONE, option index = "+str(argno);
-dbug?? println$ "path="+path+": dir="+dir+",base="+base", ext="+ext;
-dbug?? println$ "cpps="+cpps;
-dbug?? println$ "cppos="+cppos;
-
-if NOOPTIMISE == 0 do
- dbug?? println "Set C++ compiler optimisation switches";
- CCFLAGS=CCFLAGS+" " + OPTIMISE;
-else
- dbug?? println "What, no optimisation?";
-done
-
-@if config.HAVE_MSVC:
- tangle('dbug?? println "Set MSVC linker options";');
- tv('DLINK_STRING="/link /DLL /LIBPATH:"+FLX_INSTALL_DIR+"\\\\lib\\\\rtl "')
- tangle('SLINK_STRING="/link /DLL /LIBPATH:"+FLX_INSTALL_DIR+"\\\\lib\\\\rtl "')
- elif config.CYGWIN or config.WIN32:
- tangle('dbug?? println "Set Cygwin linker options";');
- tv('DLINK_STRING="-L"+{FLX_INSTALL_DIR+"/bin "')
- tv('SLINK_STRING="-L"+FLX_INSTALL_DIR+"/lib/rtl "')
- else:
- tangle('dbug?? println "Set Unix linker options";');
- tv('DLINK_STRING="-L"+FLX_INSTALL_DIR+"/lib/rtl "')
- tv('SLINK_STRING="-L"+FLX_INSTALL_DIR+"/lib/rtl "')
-
-
-var PKGCONFIG=Filename::join$ List::list(FLX_INSTALL_DIR,"bin","flx_pkgconfig");
-dbug?? println$ "Felix package manager program is "+PKGCONFIG;
-
-if ECHO == 1 do
- println("#FLX_INSTALL_DIR="+FLX_INSTALL_DIR);
- println("#PKGCONFIG="+PKGCONFIG);
-done
-
-CONFIG_DIR = Filename::join(FLX_INSTALL_DIR,'config');
-dbug?? println$ "Felix package manager config directory is "+CONFIG_DIR;
-// make a list of any *.cpp files (or other g++ options ..)
-
-var EXT_OBJ =
- if STATIC == 0 then EXT_SHARED_OBJ
- else EXT_STATIC_OBJ
- endif
-;
-
-// this hack forces a directory name, because executing "prog"
-// can fail if the currect directory is not on the PATH,
-// or worse, the wrong program can execute. The PATH is not
-// searched if the filename includes a / somewhere so force one in.
-// similarly for dynamic loaders looking for shared libraries
-//
-// It would probably be better to convert any relative filename
-// to an absolute one, however this only makes sense on Unix
-// since Windows has multiple "drives" it is much harder to
-// do the conversion.
-dir =
- if dir != "" then dir
- else "."
- endif
-;
-
-var filebase = Filename::join(dir,base);
-dbug?? println$ "User program base is " + filebase;
-
-// Find absolute pathname
-
-if path == "" do
- fprint$ cerr, ("No such felix program: "+path+"\n");
- System::exit(1);
-done
-
-gen get_stdout(x:string) = {
- // We're screwed if popen doesn't work ..
-/*
- if os.name == "nt": // popen doesn't work on Windows
-*/
- result := system(x + " >tmp.out");
- Stdout::flush();
- output := Text_file::load "tmp.out";
-/*
- else:
- fout = os.popen(x+" 2>&1 ","r")
- output = []
- try:
- for line in fout:
- output.append(line)
- if outit: outit(line)
- finally:
- result = fout.close()
-*/
- return result,output;
-}
-
-gen xqt(cmd:string) = {
- ECHO == 1 or dbug ?? println("cmd="+cmd);
- var result,output = get_stdout(cmd);
- if result == 0 do
- n :=
- match find_first_of (output, char "\n") with
- | Some ?n => n
- | None => len output
- endmatch
- ;
- output = output.[to n]; // first line excluding newline
- ECHO==1 or dbug ?? println("output='"+output+"'");
- else
- dbug ?? println ("COMMAND FAILED");
- fprint$ cerr, ("Error "+repr(result)+" executing command " + cmd + "/n");
- System::exit result;
- done
- return output;
-}
-
-proc calpackages () {
-
- // find external header files
- var PKGCONFIG_CFLAGS=PKGCONFIG+ " --path+="+Filename::join(FLX_INSTALL_DIR,"config") + " --field=cflags ";
-
- // external header files
- var PKGCONFIG_INCLUDES=PKGCONFIG+ " --path+="+Filename::join(FLX_INSTALL_DIR,"config") + " --field=includes ";
-
- // find external dynload libraries
- var PKGCONFIG_DLIBS=PKGCONFIG+" -r --path+="+Filename::join(FLX_INSTALL_DIR,"config") + " --field=provides_dlib --field=requires_dlibs ";
-
- // find external static libraries
- var PKGCONFIG_SLIBS=PKGCONFIG+" -r --keeprightmost --path+="+Filename::join(FLX_INSTALL_DIR,"config") + " --field=provides_slib --field=requires_slibs ";
-
- //find driver package required
- var PKGCONFIG_DRIVER=PKGCONFIG+" --path+="+Filename::join(FLX_INSTALL_DIR,"config") + " --field=flx_requires_driver ";
-
-
- // find all include directories
- var x = xqt(PKGCONFIG_CFLAGS+ " @"+filebase+".resh");
- INCLUDE_DIRS=INCLUDE_DIRS +" " + x;
-
- // find all include files
- x = xqt(PKGCONFIG_INCLUDES+ " @"+filebase+".resh");
- INCLUDE_FILES=INCLUDE_FILES +" " + x;
-
- // find the driver package
- DRIVER_PKG=xqt(PKGCONFIG_DRIVER+" @"+filebase+".resh");
- DRIVER_PKG == "" ?? DRIVER_PKG="flx_run";
-
- // find the driver entity
- if STATIC == 0 do
- // dynamic linkage: the driver executable
- DRIVER=Filename::join$ List::list (FLX_INSTALL_DIR,"bin",DRIVER_PKG+EXT_EXE);
- else
- // static linkage: the driver object file
- DRIVER=Filename::join$ List::list (FLX_INSTALL_DIR,"lib","rtl",DRIVER_PKG+EXT_STATIC_OBJ);
- done
-
- if STATIC == 0 do
- // dynamic linkage: all the libraries required by the application
- LINK_STRING=DLINK_STRING+LINKER_SWITCHES+xqt(
- PKGCONFIG_DLIBS+" @"+filebase+".resh");
- else
- // static linkage: all the libraries required by the application and driver
- LINK_STRING=SLINK_STRING+LINKER_SWITCHES+xqt(
- PKGCONFIG_SLIBS+" "+DRIVER_PKG+" @"+filebase+".resh");
- done
-
- if ECHO == 1 do
- println("//RESOURCE FILE="+filebase+".resh");
- println("//INCLUDE_DIRS="+INCLUDE_DIRS);
- println("//INCLUDE_FILES="+INCLUDE_FILES);
- println("//DRIVER="+DRIVER);
- println("//LINK_STRING="+LINK_STRING);
- done
-}
-
-proc write_include_file(path:string) {
- includes := split (strip INCLUDE_FILES,char " ");
- var f = Text_file::fopen_output(path+".includes");
- List::iter
- (proc (i:string) { Text_file::writeln$ f, "#include " + i; })
- includes
- ;
- Text_file::fclose f;
-}
-
-
-// grab program arguments
-grab=1;
-fun pop (x:List::list[string], n:int) =>
- if n == 0 then x
- else match x with | Cons(_,?t) => pop(t,n-1) | Empty[string] => List::Empty[string] endmatch
- endif
-;
-
-var tail = pop (System::args(), argno);
-var args= List::cat " " tail;
-dbug?? println$ "Target program args = "+args;
-
-var INCLUDE_DIR="-I"+Filename::join(FLX_INSTALL_DIR,"lib","rtl") + " -I"+Filename::join(FLX_INSTALL_DIR,"config","target");
-dbug?? println$ "C++ Include directory for Felix library " + INCLUDE_DIR;
-
-var FLXLIB="-I"+Filename::join(FLX_INSTALL_DIR,"lib");
-var STDLIB="std";
-if NOSTDLIB == 1 do
- FLXLIB="";
- STDLIB="";
-done
-
-if WIN32 do
- FLXG=Filename::join(FLX_INSTALL_DIR, 'bin', 'flxg');
- FLXRUN='';
-else
- FLXG="env PATH="+FLX_INSTALL_DIR+"/bin:$PATH "+FLX_INSTALL_DIR+"/bin/flxg";
- // the mac uses DYLD_LIBRARY_PATH instead of LD_LIBRARY_PATH
- if MACOSX do
- FLXRUN="env DYLD_LIBRARY_PATH="+FLX_INSTALL_DIR+"/lib/rtl:$DYLD_LIBRARY_PATH ";
- else
- FLXRUN="env LD_LIBRARY_PATH="+FLX_INSTALL_DIR+"/lib/rtl:$LD_LIBRARY_PATH ";
- done
-done
-
-var DEBUGSWITCH="";
-DEBUG_COMPILER == 1?? DEBUGSWITCH=" --debug";
-
-var STATIC_ENV="";
-DEBUG_COMPILER == 1?? STATIC_ENV="env FLX_DEBUG=1 ";
-
-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>";
-
-
-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)
- dbug?? println "Checking to see if the binary is uptodate";
- if STATIC == 0 do
- if (filetime(filebase+EXT_SHLIB) > filetime (filebase+".flx")) do
- dbug?? println$ "Running dynamically linked binary";
- calpackages();
- cmd=FLXRUN+DRIVER+DEBUGSWITCH+" "+ filebase+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(filebase+EXT_EXE) > filetime(filebase+".flx")) do
- dbug?? println$ "Running statically linked binary";
- cmd=STATIC_ENV+" "+filebase+" "+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
-
-var VERBOSE = "";
-if DEBUG_COMPILER == 1 do
- VERBOSE="-v";
- dbug?? println "Compiler debugging on";
-else
- VERBOSE="-q";
- dbug?? println "Compiler debugging off";
-done
-
-if DEBUG==1 do
- CCFLAGS=CCFLAGS+DEBUG_FLAGS;
-done
-
-var FLXFLAGS="--inline="+str(INLINE) + ' ' + str(OUTPUT_DIR);
-
-var FCMD="";
-var LCMD="";
-var CCMD="";
-
-if FELIX == 1 do
- FCMD=List::cat ' ' (List::list (
- FLXG,
- VERBOSE, FLXFLAGS, FLXLIB,
- INCLUDE_DIRS, STDIMPORT, IMPORTS,
- STDLIB, filebase));
- dbug?? println$ "Felix command="+FCMD;
- result=system(FCMD);
- if result != 0 do
- dbug?? println "Felix compilation failed";
- System::exit(int(0!=result));
- done
- dbug?? println "Felix compilation succeeded";
- calpackages();
- write_include_file(filebase);
-else
- dbug?? println "Felix compilation skipped by switch";
-done
-
-if STATIC == 0 do
- dbug?? println "Dynamic linkage";
- CCMD=List::cat ' ' (List::list (
- CCOBJ_DLLIB, CCFLAGS, "-DTARGET_BUILD",
- INCLUDE_DIR, INCLUDE_DIRS, MACROS,
- cpps, filebase+".cpp",
- SPEC_OBJ_FILENAME+filebase+EXT_OBJ));
- LCMD=List::cat ' ' (List::list (
- CCLINK_DLLIB, CCFLAGS,
- cppos, filebase+EXT_OBJ,
- SPEC_EXE_FILENAME+filebase+EXT_SHLIB,
- LINK_STRING));
- dbug?? println$ "C++ command="+CCMD;
- result = system(CCMD);
- if result == 0 do
- dbug?? println$ "Link command="+LCMD;
- result = system(LCMD);
- if result == 0 do
- if RUNIT == 1 do
- if TIME == 1 do
- cmd=List::cat ' ' (List::list (
- TIMECMD,
- FLXRUN+DRIVER+DEBUGSWITCH,
- filebase+EXT_SHLIB, args));
- else
- cmd=List::cat ' ' (List::list (
- FLXRUN+DRIVER+DEBUGSWITCH,
- filebase+EXT_SHLIB, args));
- done
- if STDOUT != "" do cmd=cmd+" > " +STDOUT; done
- dbug?? println$ "Run command="+cmd;
- System::exit(int(0!=system(cmd)));
- else
- dbug?? println "Not running program selected by switch";
- done
- else
- dbug?? println "Dynamic linkage failed";
- done
- else
- dbug?? println "C++ compilation failed";
- done
-else
- dbug?? println "Static linkage";
- CCMD=List::cat ' ' (List::list (
- CCOBJ_STATIC_LIB,
- CCFLAGS, "-DTARGET_BUILD",
- "-DFLX_STATIC_LINK", INCLUDE_DIR, INCLUDE_DIRS,
- MACROS, cpps, filebase+".cpp",
- SPEC_OBJ_FILENAME+filebase+EXT_OBJ));
- LCMD=List::cat ' ' (List::list (
- CCLINK_STATIC, SPEC_EXE_FILENAME+filebase+EXT_EXE,
- filebase+EXT_OBJ, DRIVER, cppos, LINK_STRING));
- dbug?? println$ "C++ command="+CCMD;
- result=system(CCMD);
- if result == 0 do
- dbug?? println$ "Link command="+LCMD;
- result=system(LCMD);
- if result == 0 do
- // rm -f "$base.cpp"
- if RUNIT == 1 do
- if TIME == 1 do
- cmd= List::cat ' ' (List::list (
- TIMECMD, STATIC_ENV, filebase, args));
- else
- cmd=List::cat ' ' (List::list (
- STATIC_ENV, filebase,args));
- done
- if STDOUT != "" do cmd=cmd + " > "+STDOUT; done
- dbug?? println$ "Run command="+cmd;
- System::exit(int(0!=system(cmd)));
- else
- dbug?? println "Not running program selected by switch";
- done
- else
- dbug?? println "Static Linkage failed";
- done
- else
- dbug?? println "C++ compilation failed";
- done
-done
-
-System::exit(int(0!=result));
-
@select(tangler('bin/flx-postinstall-check','data'))
#!/usr/bin/env bash
FLX=flx
diff --git a/src/compiler/flx_bind/flx_lookup.ml b/src/compiler/flx_bind/flx_lookup.ml
index 5abb6ae..dbc9467 100644
--- a/src/compiler/flx_bind/flx_lookup.ml
+++ b/src/compiler/flx_bind/flx_lookup.ml
@@ -1618,7 +1618,9 @@ and btype_of_bsym state bsym_table bt bid bsym =
match Flx_bsym.bbdcl bsym with
| BBDCL_invalid -> assert false
- | BBDCL_module -> assert false
+ | BBDCL_module -> failwith
+ ("Attempt to construe module name " ^ Flx_bsym.id bsym ^ " as a type")
+
| BBDCL_fun (_,_,(params,_),return_type,_) ->
btyp_function (type_of_params params, return_type)
| BBDCL_val (_,t,_) -> t
diff --git a/src/demux/kqueue/demux_kqueue_demuxer.cpp b/src/demux/kqueue/demux_kqueue_demuxer.cpp
index 46918de..91cad42 100644
--- a/src/demux/kqueue/demux_kqueue_demuxer.cpp
+++ b/src/demux/kqueue/demux_kqueue_demuxer.cpp
@@ -58,6 +58,7 @@ kqueue_demuxer::~kqueue_demuxer()
int
kqueue_demuxer::add_socket_wakeup(socket_wakeup* sv, int flags)
{
+ fprintf(stderr,"Add socket wakeup\n");
// we only know these flags
if((flags & ~(PDEMUX_READ | PDEMUX_WRITE))) return -1;
@@ -68,11 +69,13 @@ kqueue_demuxer::add_socket_wakeup(socket_wakeup* sv, int flags)
if(flags & PDEMUX_READ)
{
if(add_kqueue_filter(sv, EVFILT_READ) == -1) return -1;
+ fprintf (stderr,"Added read filter\n");
}
if(flags & PDEMUX_WRITE)
{
if(add_kqueue_filter(sv, EVFILT_WRITE) == -1) return -1;
+ fprintf(stderr,"Added write filter\n");
}
return 0;
@@ -131,7 +134,7 @@ kqueue_demuxer::remove_kqueue_filter(int s, short filter)
perror("kevent remove_socket_wakeup");
return -1;
}
-
+ fprintf(stderr,"Removed kqueue filter\n");
return 0;
}
@@ -177,6 +180,7 @@ kqueue_demuxer::get_evts(bool poll)
timeout.tv_sec = 0; // effectuate a poll
timeout.tv_nsec = 0;
tptr = &timeout;
+ fprintf(stderr,"Kqueue emulating poll\n");
}
// timeout.tv_sec = 1; // timeout every second
@@ -194,7 +198,7 @@ kqueue_demuxer::get_evts(bool poll)
}
// fprintf(stderr,"kqueue wakeup!\n");
-
+ fprintf(stderr,"Kqueue got %d events\n",nevts);
socket_wakeup* sv = (socket_wakeup*)ev.udata;
// The filters are not bit fields, hence they must come in serially.
@@ -223,6 +227,7 @@ kqueue_demuxer::get_evts(bool poll)
(int)ev.data, ev.fflags);
}
// fprintf(stderr,"EVFILT_READ: got %i bytes coming\n", (int)ev.data);
+ fprintf(stderr,"EVFILT_READ: got %i bytes coming\n", (int)ev.data);
// remove_reading_fd(s); // now useing EV_ONESHOT
// remove other outstanding here...?
sv->wakeup_flags = PDEMUX_READ; // Tell 'em what they've won.
@@ -230,8 +235,8 @@ kqueue_demuxer::get_evts(bool poll)
}
else if(ev.filter == EVFILT_WRITE)
{
- // fprintf(stderr,"EVFILT_WRITE: can write (?) %i bytes\n",
- // (int)ev.data);
+ // fprintf(stderr,"EVFILT_WRITE: can write (?) %i bytes\n", (int)ev.data);
+ fprintf(stderr,"EVFILT_WRITE: can write (?) %i bytes\n", (int)ev.data);
// using oneshot mode now.
// remove_writing_fd(s);
@@ -241,8 +246,8 @@ kqueue_demuxer::get_evts(bool poll)
// errno in fflags? data should be zero bytes, right?
// can't write anything
fprintf(stderr,
- "got EV_EOF on write, data bytes =%i (0?), errno/fflags?=%i\n",
- (int)ev.data, ev.fflags);
+ "got EV_EOF on write, socket = %d, data bytes =%i (0?), errno/fflags?=%i\n",
+ sv->s, (int)ev.data, ev.fflags);
}
// remove other outstanding here?
sv->wakeup_flags = PDEMUX_WRITE;
diff --git a/src/demux/posix/demux_posix_demuxer.cpp b/src/demux/posix/demux_posix_demuxer.cpp
index a8d2f60..f71285b 100644
--- a/src/demux/posix/demux_posix_demuxer.cpp
+++ b/src/demux/posix/demux_posix_demuxer.cpp
@@ -22,6 +22,7 @@ posix_demuxer::~posix_demuxer()
bool
posix_demuxer::socket_recv(int s, sel_param* pb)
{
+ fprintf(stderr,"posix_demuxer:socket_recv\n");
// why do I have the zero buffer size?
assert(pb->buffer_size > pb->bytes_written || 0 == pb->buffer_size);
ssize_t nbytes;
@@ -30,6 +31,7 @@ posix_demuxer::socket_recv(int s, sel_param* pb)
nbytes = recv(s, pb->buffer + pb->bytes_written,
pb->buffer_size - pb->bytes_written, 0);
+ fprintf(stderr,"posix_demuxer:socket_recv got %d bytes\n", nbytes);
/*
fprintf(stderr,"posix_demuxer RECV: s=%d, pb=%p, buf+%d, req=%d, got %d\n",
s,pb, int(pb->bytes_written), int(pb->buffer_size - pb->bytes_written), int(nbytes)
@@ -66,8 +68,10 @@ posix_demuxer::socket_send(int s, sel_param* pb)
ssize_t nbytes;
+ fprintf(stderr,"posix_demuxer:socket_send\n", nbytes);
nbytes = send(s, pb->buffer + pb->bytes_written,
pb->buffer_size - pb->bytes_written, 0);
+ fprintf(stderr,"posix_demuxer:socket_send wrote %d bytes\n", nbytes);
/*
fprintf(stderr,"posix_demuxer SEND: s=%d, pb=%p buf+%d, req=%d, got %d\n",
diff --git a/src/faio/faio_posixio.cpp b/src/faio/faio_posixio.cpp
index c0a41dd..5e07702 100644
--- a/src/faio/faio_posixio.cpp
+++ b/src/faio/faio_posixio.cpp
@@ -53,6 +53,11 @@ socketio_request::start_async_op_impl()
// fprintf(stderr, "adding wakeup: len %i, done %i\n",
// sv.pb.buffer_size, sv.pb.bytes_written);
+ if(sv.s == -1) {
+ fprintf(stderr, "Attempt to start_async_op on socket -1\n");
+ exit(1);
+ }
+
// wake thread if call failed
bool failed = (pd->add_socket_wakeup(&sv, sv.sio_flags) == -1);
if (failed)
@@ -95,13 +100,17 @@ socketio_wakeup::wakeup(posix_demuxer& demux)
{
// just check that our above assumption hasn't been violated.
assert(wakeup_flags == PDEMUX_READ);
+ fprintf(stderr,"posix faio wakeup PDEMUX_READ, reading..\n");
connection_closed = posix_demuxer::socket_recv(s, &pb);
+ fprintf(stderr,"posix faio wakeup PDEMUX_READ, connection closed = %d\n", connection_closed);
}
else
{
// never hurts to be paranoid.
assert(wakeup_flags == PDEMUX_WRITE);
+ fprintf(stderr,"posix faio wakeup PDEMUX_WRITE, writing..\n");
connection_closed = posix_demuxer::socket_send(s, &pb);
+ fprintf(stderr,"posix faio wakeup PDEMUX_WRITE, connection closed = %d\n", connection_closed);
}
// fprintf(stderr,"posthandle wakeup, this: %p, read: %i, len: %i, done %i\n",
diff --git a/src/faio/flx_stream.flx b/src/faio/flx_stream.flx
index 5584f10..987003b 100644
--- a/src/faio/flx_stream.flx
+++ b/src/faio/flx_stream.flx
@@ -255,29 +255,48 @@ module Flx_stream {
}
// highly inefficient!
- proc get_line[istr with IByteStream[istr]]
- (strm: istr, s: &string)
+ noinline proc get_line[istr with IByteStream[istr]]
+ (strm: istr, s: &string, id:string)
{
var c: char;
val ac = C_hack::cast[address]$ C_hack::addr c;
- var st: string;
+ var st: string="";
var finished = false;
+ fprintln$ cerr,"Get line from IByteStream "+id;
whilst not finished do
var len = 1;
var eof: bool;
read(strm, &len, ac, &eof);
+ if len == 0 do
+ fprintln$ cerr,"Got nothing from IByteStream "+id;
+ if eof do fprintln$ cerr,"Eof on IBytestream "+id;
+ else fprintln$ cerr,"So not eof but also got nothing? "+id
+ done
+ else
+ if eof do
+ fprintln$ cerr,"What, eof on stream and read char " + str c + " IByteStream=" + id;
+ else
+ //fprintln$ cerr,"Got char " + str c + " from an IByteStream "+id;
+ done
+ done
+
if eof or c == char '\n' do
+ fprintln$ cerr,"Got end of line (or file) from an IByteStream "+id;
finished = true;
else
st += c;
- done;
- done;
+ done
+ done
*s = st; // pass back result
}
+ proc get_line[istr with IByteStream[istr]]
+ (strm: istr, s: &string) { get_line(strm, s, "UNKNOWN"); }
+
+
proc write_string[ostr with OByteStream[ostr]]
(sk: ostr, var s: string)
{
diff --git a/src/lib/std/stdout.flx b/src/lib/std/stdout.flx
index 0cde917..c14514d 100644
--- a/src/lib/std/stdout.flx
+++ b/src/lib/std/stdout.flx
@@ -3,6 +3,7 @@ open module Stdout
// NOTE: this module works on C++ standard streams
// NOT on the streams passed in the thread frame
// almost certainly this is a bug .. :)
+ // fprint is defined in each types module
requires iostream;
type ostream = "std::ostream*";
const cout: ostream = "&std::cout";
@@ -14,5 +15,6 @@ open module Stdout
proc print [T with Str[T]] (x:T) { fprint (cout, str x); };
proc println[T with Str[T]] (x:T) { fprint (cout, str x); endl cout; };
+ proc fprintln[T with Str[T]] (s:ostream, x:T) { fprint (s, str x); endl s; };
}
diff --git a/test/faio/faio-1.01.01-0.flx b/test/faio/faio-1.01.01-0.flx
index cfcc5dd..20ef86e 100644
--- a/test/faio/faio-1.01.01-0.flx
+++ b/test/faio/faio-1.01.01-0.flx
@@ -13,8 +13,8 @@ var port = 0; // you choose
// check errors. how is that done?
mk_listener(&listener, &port, 1);
-// print "Got port: "; print port; endl;
-// print "accepting\n";
+//println$ "Got port: "; print port; endl;
+//println$ "listeneing on socket " + str listener;
print "spawning connector\n";
// not printing in thread to make output deterministic.
@@ -26,25 +26,30 @@ spawn_fthread
// print "Connector dude\n"; // get rid of, hard to test
var c: socket_t;
connect(&c, c"127.0.0.1", port); // connect to localhost
+ //println$ "fthread's socket is " + str c;
var st: string;
- get_line(c, &st);
+ get_line(c, &st,"fthread");
print "connector got "; print st; endl;
write_string(c, "thanks\n"); // newline important
ioclose(c); // finished with this
+ //println$ "fthread closed " + str c;
};
};
var s: socket_t;
accept(listener, &s);
+//println$ "Mainline accepted connection on socket " + str s;
ioclose(listener); // not needed anymore
print "got connection\n";
write_string(s, "server says hi\n"); // newline important here
var st: string;
-get_line(s, &st);
+get_line(s, &st,"mainline");
print "server got "; print st; endl;
ioclose(s);
+//println$ "mainline closed socket " + str s;
+
diff --git a/tools/webserver.flx b/tools/webserver.flx
index 9b396af..a349c0a 100644
--- a/tools/webserver.flx
+++ b/tools/webserver.flx
@@ -1,8 +1,7 @@
-#if POSIX
+if POSIX do
include "flx_faio_posix"; // aio_ropen
//open Faio_posix;
-#endif
-
+done
include "flx_socket";
open Flx_socket;
@@ -123,7 +122,7 @@ proc serve_file(infname: string, s: socket_t)
print "suffix is "; print suffix; endl;
-#if WIN32
+if WIN32 do
// quick 'n' dirty unix -> dos style pathnames
val wname = map (fun (a:char) => if a == char '/' then char '\\' else a endif) fname;
print "mapped "; print fname; print " -> "; print wname; endl;
@@ -148,7 +147,7 @@ proc serve_file(infname: string, s: socket_t)
// send footer
CloseFile(wf);
} endif;
-#elif POSIX
+elif POSIX do
// this fn sets the O_NONBLOCK flag which is completely unnecessary
// as read goes via the preading worker fifo. don't know if
// O_NONBLOCK even works on actual files.
@@ -156,11 +155,11 @@ proc serve_file(infname: string, s: socket_t)
if Faio_posix::invalid fd then
{
- print "BUGGER, posix open failed\n";
+ print ("BUGGER, posix open of "+fname+" failed\n");
write_string(s, notfound_header);
write_string(s, fname+"\r\n\n");
} else {
- print "got fd="; print$ str fd; endl;
+ print ("got fd "+str fd +" for read file of "+fname+"\n");
// mime type mapping from suffix. make better here.
// factor out
@@ -172,7 +171,7 @@ proc serve_file(infname: string, s: socket_t)
var to_strm: socket_t = s;
Flx_stream::cat(from_strm, to_strm);
- dbg q"close file $from_strm\n";
+ dbg$ ("close read fd " + str(from_strm)+"file "+fname+"\n");
iclose(from_strm); // this'll know how to close a unix fd
} endif;
@@ -181,7 +180,7 @@ proc serve_file(infname: string, s: socket_t)
// print "contents len="; print (len contents); endl;
// write_string(s, html_header + contents);
-#endif
+done
}
val webby_port = 1234;
@@ -193,20 +192,15 @@ var p = webby_port;
var listener: socket_t;
mk_listener(&listener, &p, 10);
-forever {
- var s: socket_t;
- accept(listener, &s); // blocking
- dbg q"got connection $s\n"; // error check here
-
- // hmm - spawning an fthread is blocking the web server. don't know why
- print "spawning fthread to handle connection\n";
- spawn_fthread {
+proc handler (s:socket_t) ()
+{
+ dbg$ "Spawned fthread running for socket "+str s+"\n";
// should spawn fthread here to allow for more io overlap
var line: string;
- get_line(s, &line); // should be the GET line.
+ get_line(s, &line, str(s)); // should be the GET line.
- print "got line: "; print line; endl;
+ print$ "got line from socket "+str s+": "; print line; endl;
// now I need to parse the GET line, get a file name out of its url
// (e.g. unqualfied -> index.html and name/flx.jpg -> flx.jpg
@@ -229,11 +223,20 @@ forever {
Faio_posix::shutdown(s, 1); // disallow further sends.
cat(s, DEVNULL);
- fprint$ cerr,q"closing socket $s\n";
+ fprint$ cerr,"closing socket "+str s+"\n";
ioclose(s);
- };
- collect();
+};
+
+forever {
+ var s: socket_t;
+ accept(listener, &s); // blocking
+ dbg$ "got connection "+str s + "\n"; // error check here
+
+ // hmm - spawning an fthread is blocking the web server. don't know why
+ print$ "spawning fthread to handle connection "+str s+"\n";
+ spawn_fthread (handler s);
+ //collect(); // this hangs everything, no idea why!
};
iclose(listener);
commit 4e78d45f996adcc1083a2516c10c8df7bd4add54
Author: skaller <Max.S...@gmail.com>
Date: Fri Oct 8 17:03:58 2010 +1100
Clean up, removing more interscript stuff.
diff --git a/buildsystem/flx_compiler.py b/buildsystem/flx_compiler.py
index 3b6332d..22cb658 100644
--- a/buildsystem/flx_compiler.py
+++ b/buildsystem/flx_compiler.py
@@ -21,7 +21,7 @@ def build_flx_core(phase):
external_libs=['nums'])
def build_flx_version(phase):
- path = phase.ctx.buildroot / 'src/compiler/flx_version'
+ path = Path ('src/compiler/flx_version')
return phase.ocaml.build_lib(path / 'flx_version',
srcs=Path.glob(path / '*.ml{,i}'))
diff --git a/lpsrc/flx.pak b/lpsrc/flx.pak
index 2605b82..1f1ac04 100644
--- a/lpsrc/flx.pak
+++ b/lpsrc/flx.pak
@@ -11,142 +11,7 @@ let cpp_keywords = [
@#
]
-@head(1,'Purpose')
-Felix is a procedural language designed to implement
-ultra lightweight threads. An ultra-lightweight thread
-is a thread of control which provides cooperative
-multitasking and event driven scheduling. It is designed
-to support running millions of threads of control on
-multiple processors with low overhead
-in context switching achieved by event driven dispatch.
-@p()
-Target applications include graphical user interfaces,
-telephony and other asynchronous signalling systems,
-and web and other servers.
-
-@head(1,'Language')
-Felix is a powerful C++ code generator which uses
-a blend of Pascal, C, C++, and ML syntax in the hope
-that the power of the ML system can be provided to
-C/C++ programmers, together with control inversion.
-
-@head(1,'The tutorial')
-The tutorial is found at
-@cite_url('../../tutorial/introduction/en_flx_tutorial_top.html')
-@p()
-The macro processor now has a separate tutorial at
-@cite_url('../../tutorial/macros/en_flx_tut_macro_top.html')
-@p()
-The binding and embedding system now has a separate tutorial at
-@cite_url('../../tutorial/embedding/en_flx_tut_bind_top.html')
-@p()
-The c and c++ migration now has a separate tutorial at
-@cite_url('../../tutorial/migration/en_flx_tut_migrate_top.html')
-
-@head(1,'The Felix Compiler')
-Basic phase diagram:
-@begin_displayed_code()
- Lexer ->
- Token Filter ->
- Parser ->
- Syntax Macro Processor ->
- Desugaring/Lambda Lifting ->
- Unbound Symbol Table Construction ->
- Lookup/Binding/Use analysis ->
- Optimisation ->
- Code generation
-@end_displayed_code()
-The lexer generates tokens, which are passed
-to the token filter to strip out white spaces
-(since these make LR(1) parsing almost impossible
-by eating up lookaheads). Any token stream macro
-processing will be inserted here. The parser then
-builds the Abstract Syntax Treee from the filtered
-token stream.
-@p()
-The syntax macro processor is a basic term calculator
-for generating and reducing terms. The macro
-processing phase includes constant folding,
-with special handling for conditionals so that
-conditional compilation of syntactically correct
-phrases doesn't require any special syntax.
-@p()
-Lambda lifting replaces each anonymous function
-used in an expressions with a fresh name and
-defines the name in some context including
-the expression.
-@p()
-Desugaring includes lambda lifting and a few
-other rewrites. For example, the if/then/else/endif
-expression is replaced by an equivalent match.
-[We want to put this in the library eventually]
-@p()
-The unbound symbol table is a map from indexes
-to symbol definitions, and is a convolution
-of the hierarchical input structure of the AST.
-Each symbol has a unique index, a link to
-its parent context, and each context containing
-definitions has a map from names to indexes.
-However, the uses of symbols are unbound.
-@p()
-The binding phase performs lookups on the
-types, expressions, directives, and executable
-statements to replace each names with its
-index in the symbol table, resulting
-in the fully bound symbol table.
-@p()
-This phase is extremely complex, since the binding
-of all components must be done on the unbound symbol
-table. Whilst simple lookups present no problem,
-functions can be overloaded. This means the type
-of an application cannot be determined until the
-overload is resolved, which requires typing the
-argument of the function, which in turn depends
-on overloading.
-@p()
-In addition, the open directive adds considerable
-complication, since in Felix everything in the
-same scope is considered to be mutually recursive.
-This means the argument of the open directive
-requires lookup of the name in a context enriched
-by all the other open directives, but the enrichment
-requires lookup of the argument of those open
-directives.
-@p()
-Even more complicated: Felix has module expressions,
-and so the prefix part of a name doesn't have to
-be a module name .. it can be a module expression.
-Module expressions include functor applications,
-and functors can be overloaded. The argument
-type of a functor must be matched to the supplied
-module, which requires binding every element of
-the interface and and the signatures of the elements
-of the module.
-@p()
-The binding and lookup is driven by a flow analyser
-than is iniialised with the root procedure (the
-init routine of the top level module) plus any
-exported procedures or functions. By chasing
-down all calls, it discovers all instances types used
-in the program, and all instances of
-functions and procedures. An instances is a binding
-of a type or function to a list of types, which is
-the basic mechanism for generic programming.
-@p()
-The code generator constructs classes
-for each type, function and procedure,
-and generates descriptors for each entity
-which includes a list of offsets at which
-frame object pointers are located so
-the garbage collector can operate.
-@p()
-Finally, the code generator makes C wrappers for
-exported functions, and provides initialisation and termination
-functions to construct and destroy the
-instance frame objects (global, process,
-and thread frames at present).
-
-@head(2,'Configuration loader')
+@head(1,'Configuration loader')
There is a separate package "flx_config.pak" which should
be used to create the configuration creator script.
@import traceback
diff --git a/lpsrc/flx_config.pak b/lpsrc/flx_config.pak
index 6a5825f..26b9e23 100644
--- a/lpsrc/flx_config.pak
+++ b/lpsrc/flx_config.pak
@@ -3,8 +3,8 @@
@print(FLX_CONFIG_CVS_ID)
@flx_version_major = '1'
@flx_version_minor = '1'
-@flx_version_patch = '4'
-@flx_version_release = '_rc2'
+@flx_version_patch = '5'
+@flx_version_release = ''
@flx_version = flx_version_major+'.'+flx_version_minor+'.'+flx_version_patch+flx_version_release
@godi_revision = '0'
@debian_revision = '1'
diff --git a/lpsrc/flx_version.pak b/lpsrc/flx_version.pak
deleted file mode 100644
index ca04f69..0000000
--- a/lpsrc/flx_version.pak
+++ /dev/null
@@ -1,62 +0,0 @@
-@head(1,'Verion Control')
-@h = tangler('spkgs/flx_version.py')
-@select(h)
-caml_interfaces = [
- 'src/compiler/flx_version/flx_version',
-]
-
-caml_implementations = [
- 'src/compiler/flx_version/flx_version',
-]
-
-caml_provide_lib = 'src/compiler/flx_version/flx_version'
-iscr_source = ["lpsrc/flx_version.pak"]
-weaver_directory = 'doc/flx/flx_compiler/'
-
-@doc()
-We need a special hack for version control.
-Since every build results in a changed
-version control record, we have to put
-the record in the last module in the
-compiler list to avoid unnecessary compilations.
-Unfortunately, that means no modules can reference
-it due to a limitation in Ocaml. Therefore,
-we make the first module a reference to the version
-control data, initialised with a dummy value,
-put the real data in the last module, and store
-it in the reference when the last module is
-initialised. Note that this means the version
-information will not be available until
-the mainline module begins.
-
-@h=tangler('src/compiler/flx_version/flx_version.mli')
-@select(h)
-type version_data_t =
-{
- version_string : string;
- build_time_float : float;
- build_time : string;
- buildno : int;
-}
-
-val version_data: version_data_t ref
-
-@h=tangler('src/compiler/flx_version/flx_version.ml')
-@select(h)
-type version_data_t =
-{
- version_string : string;
- build_time_float : float;
- build_time : string;
- buildno : int;
-}
-
-let version_data = ref
-{
- version_string = "no version";
- build_time_float = -1.0;
- build_time = "0000-00-00";
- buildno = -1;
-}
-
-
diff --git a/src/compiler/flx_version/flx_version.ml b/src/compiler/flx_version/flx_version.ml
new file mode 100644
index 0000000..177725b
--- /dev/null
+++ b/src/compiler/flx_version/flx_version.ml
@@ -0,0 +1,17 @@
+type version_data_t =
+{
+ version_string : string;
+ build_time_float : float;
+ build_time : string;
+ buildno : int;
+}
+
+let version_data = ref
+{
+ version_string = "no version";
+ build_time_float = -1.0;
+ build_time = "0000-00-00";
+ buildno = -1;
+}
+
+
diff --git a/src/compiler/flx_version/flx_version.mli b/src/compiler/flx_version/flx_version.mli
new file mode 100644
index 0000000..bd57efa
--- /dev/null
+++ b/src/compiler/flx_version/flx_version.mli
@@ -0,0 +1,10 @@
+type version_data_t =
+{
+ version_string : string;
+ build_time_float : float;
+ build_time : string;
+ buildno : int;
+}
+
+val version_data: version_data_t ref
+
-----------------------------------------------------------------------
Summary of changes:
buildsystem/__init__.py | 3 +
buildsystem/bindings.py | 15 +-
buildsystem/flx_compiler.py | 2 +-
buildsystem/flx_stdlib.py | 2 +
buildsystem/iscr.py | 2 +-
buildsystem/speed.py | 2 +-
fbuild | 2 +-
lpsrc/flx.pak | 137 +---
lpsrc/flx_config.pak | 4 +-
lpsrc/flx_demux.pak | 123 ---
lpsrc/flx_devutil.pak | 1220 ----------------------
lpsrc/flx_doc.pak | 6 -
lpsrc/flx_faio.pak | 60 --
lpsrc/flx_gc.pak | 25 -
lpsrc/flx_glob.pak | 28 -
lpsrc/flx_gmp.pak | 12 -
lpsrc/flx_judy.pak | 88 --
lpsrc/flx_linux.pak | 13 -
lpsrc/flx_maker.pak | 1581 ++++++++++++++---------------
lpsrc/flx_man.pak | 4 -
lpsrc/flx_mmap.pak | 10 -
lpsrc/flx_perf.pak | 5 -
lpsrc/flx_pthread.pak | 87 --
lpsrc/flx_ref.pak | 5 -
lpsrc/flx_regress.pak | 107 --
lpsrc/flx_rtl.pak | 107 --
lpsrc/flx_rtl_config.pak | 6 -
lpsrc/flx_sqlite.pak | 12 -
lpsrc/flx_stdlib.pak | 27 +-
lpsrc/flx_test.pak | 68 --
lpsrc/flx_tut_bind.pak | 11 -
lpsrc/flx_tut_macro.pak | 10 -
lpsrc/flx_tut_migrate.pak | 11 -
lpsrc/flx_tutorial.pak | 18 -
lpsrc/flx_version.pak | 62 --
lpsrc/tre.pak | 41 -
spkgs/dypgen.py | 22 -
spkgs/dyplib.py | 25 -
spkgs/flx_backend.py | 38 -
spkgs/flx_bind.py | 25 -
spkgs/flx_compiler.py | 73 --
spkgs/flx_core.py | 25 -
spkgs/flx_desugar.py | 42 -
spkgs/flx_doxygen.py | 5 -
spkgs/flx_frontend.py | 47 -
spkgs/flx_lex.py | 31 -
spkgs/flx_misc.py | 13 -
spkgs/flx_parse.py | 28 -
spkgs/flx_pkgconfig.py | 25 -
spkgs/flx_version_hook.py | 12 -
spkgs/gl.py | 2 -
spkgs/glu.py | 1 -
spkgs/glut.py | 1 -
spkgs/gsl.py | 5 -
spkgs/inria_re.py | 8 -
spkgs/mpi.py | 3 -
spkgs/ocs.py | 34 -
spkgs/pari.py | 4 -
spkgs/pgen.py | 11 -
spkgs/sdl.py | 21 -
spkgs/sdl_drivers.py | 28 -
spkgs/sex.py | 17 -
src/compiler/flx_bind/flx_lookup.ml | 4 +-
src/compiler/flx_cpp_backend/flx_gen.ml | 3 +-
src/compiler/flx_cpp_backend/flx_ogen.ml | 3 +-
src/compiler/flx_version/flx_version.ml | 17 +
src/compiler/flx_version/flx_version.mli | 10 +
src/demux/demux_demuxer.hpp | 18 +-
src/demux/flx_demux.cpp | 6 +-
src/demux/kqueue/demux_kqueue_demuxer.cpp | 15 +-
src/demux/posix/demux_posix_demuxer.cpp | 22 +-
src/demux/win/demux_overlapped.cpp | 1 +
src/faio/faio_asyncio.cpp | 2 +-
src/faio/faio_posixio.cpp | 16 +
src/faio/flx_faio.flx | 5 +
src/faio/flx_faio_posix.flx | 6 +
src/faio/flx_socket.flx | 6 +-
src/faio/flx_stream.flx | 38 +-
src/gc/flx_collector.cpp | 15 +-
src/gc/flx_gc.cpp | 21 +-
src/lib/std/stdout.flx | 2 +
src/lib/std/system.flx | 16 +
src/pthread/pthread_condv.cpp | 56 +-
test/faio/faio-1.01.01-0.flx | 19 +-
tools/webserver.flx | 776 ++++++++++++--
85 files changed, 1691 insertions(+), 3848 deletions(-)
delete mode 100644 lpsrc/flx_devutil.pak
delete mode 100644 lpsrc/flx_regress.pak
delete mode 100644 lpsrc/flx_test.pak
delete mode 100644 lpsrc/flx_version.pak
delete mode 100644 spkgs/dypgen.py
delete mode 100644 spkgs/dyplib.py
delete mode 100644 spkgs/flx_backend.py
delete mode 100644 spkgs/flx_bind.py
delete mode 100644 spkgs/flx_compiler.py
delete mode 100644 spkgs/flx_core.py
delete mode 100644 spkgs/flx_desugar.py
delete mode 100644 spkgs/flx_doxygen.py
delete mode 100644 spkgs/flx_frontend.py
delete mode 100644 spkgs/flx_lex.py
delete mode 100644 spkgs/flx_misc.py
delete mode 100644 spkgs/flx_parse.py
delete mode 100644 spkgs/flx_pkgconfig.py
delete mode 100644 spkgs/flx_version_hook.py
delete mode 100644 spkgs/gl.py
delete mode 100644 spkgs/glu.py
delete mode 100644 spkgs/glut.py
delete mode 100644 spkgs/gsl.py
delete mode 100644 spkgs/inria_re.py
delete mode 100644 spkgs/mpi.py
delete mode 100644 spkgs/ocs.py
delete mode 100644 spkgs/pari.py
delete mode 100644 spkgs/pgen.py
delete mode 100644 spkgs/sdl.py
delete mode 100644 spkgs/sdl_drivers.py
delete mode 100644 spkgs/sex.py
create mode 100644 src/compiler/flx_version/flx_version.ml
create mode 100644 src/compiler/flx_version/flx_version.mli
create mode 100644 src/lib/std/system.flx
hooks/post-receive
--
An advanced programming language