An advanced programming language branch, master, updated. e7aad0b4dd387ab1f52b6562e8b07166647f149f

0 views
Skip to first unread message

felixgit

unread,
Oct 5, 2010, 8:10:41 AM10/5/10
to felix-...@googlegroups.com
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "An advanced programming language".

The branch, master has been updated
via e7aad0b4dd387ab1f52b6562e8b07166647f149f (commit)
from 5df44547ddbc8c4b95aba27f5a65d0c0a56f6394 (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 e7aad0b4dd387ab1f52b6562e8b07166647f149f
Author: John Skaller <ska...@users.sourceforge.net>
Date: Tue Oct 5 23:08:40 2010 +1100

Fix the problem with compiling "flx" where the namespace flxusr::flx is
confused with the toplevel library flx by using absolute pathnames
for namespaces like: ::flx::rtl::stdlib and ::std::

I may have missed some uses..

diff --git a/lpsrc/flx_stdlib.pak b/lpsrc/flx_stdlib.pak
index 9a79e54..75c4b38 100644
--- a/lpsrc/flx_stdlib.pak
+++ b/lpsrc/flx_stdlib.pak
@@ -17,10 +17,10 @@ iscr_source = ['lpsrc/flx_stdlib.pak']
@head(2,"Code")
Support table.
@begin_table("filebase","language","namespace","function")
-@table_row("rtl/flx_i18n","C++","flx::rtl::i18n","utf8 codec support")
-@table_row("rtl/flx_strutil","C++","flx::rtl::strutil","Python style substring support")
-@table_row("rtl/flx_ioutil","C++","flx::rtl::ioutil","Standard IO support")
-@table_row("rtl/flx_executil","C++","flx::rtl::executil","Fibre suport")
+@table_row("rtl/flx_i18n","C++","::flx::rtl::i18n","utf8 codec support")
+@table_row("rtl/flx_strutil","C++","::flx::rtl::strutil","Python style substring support")
+@table_row("rtl/flx_ioutil","C++","::flx::rtl::ioutil","Standard IO support")
+@table_row("rtl/flx_executil","C++","::flx::rtl::executil","Fibre suport")
@table_row("lib/stl","Felix","","STL support")
@end_table()

@@ -28,7 +28,7 @@ Support table.

@def gen_nan(t):
if config.TARGET_CXX.options.HAVE_CXX_ISNAN_IN_CMATH:
- tangle(' fun isnan: '+t+' -> bool = "std::isnan($1)" is postfix requires cmath;')
+ tangle(' fun isnan: '+t+' -> bool = "::std::isnan($1)" is postfix requires cmath;')
elif config.TARGET_CXX.options.HAVE_C99_ISNAN_IN_MATH:
tangle(' fun isnan: '+t+' -> bool = "isnan($1)" is postfix requires math_h;')
elif config.TARGET_CXX.options.HAVE_BSD_ISNAN_IN_MATH:
@@ -39,7 +39,7 @@ Support table.
tangle(' fun isnan: '+t+' -> bool = "!($1==$1)" is unary;')

if config.TARGET_CXX.options.HAVE_CXX_ISINF_IN_CMATH:
- tangle(' fun isinf: '+t+' -> bool = "std::isinf($1)" is postfix requires cmath;')
+ tangle(' fun isinf: '+t+' -> bool = "::std::isinf($1)" is postfix requires cmath;')
elif config.TARGET_CXX.options.HAVE_C99_ISINF_IN_MATH:
tangle(' fun isinf: '+t+' -> bool = "isinf($1)" is postfix requires math_h;')
elif config.TARGET_CXX.options.HAVE_BSD_ISINF_IN_MATH:
@@ -50,7 +50,7 @@ Support table.
tangle(' fun isinf: '+t+' -> bool = "($1==$1 && $1+$1+1.0==$1)" is unary;')

if config.TARGET_CXX.options.HAVE_CXX_ISFINITE_IN_CMATH:
- tangle(' fun isfinite: '+t+' -> bool = "std::isfinite($1)" is postfix requires cmath;')
+ tangle(' fun isfinite: '+t+' -> bool = "::std::isfinite($1)" is postfix requires cmath;')
elif config.TARGET_CXX.options.HAVE_C99_ISFINITE_IN_MATH:
tangle(' fun isfinite: '+t+' -> bool = "isfinite($1)" is postfix requires math_h;')
elif config.TARGET_CXX.options.HAVE_BSD_FINITE_IN_MATH:
@@ -213,7 +213,7 @@ typedef fun arithmax(l: TYPE, r: TYPE): TYPE =>
@for t in floats:
tangle("open module " + t.capitalize())
tangle("{")
- tangle(' fun _ctor_'+t+': string -> '+t+' = "static_cast<'+tmap[t]+'>(std::atof($1.data()))" requires cstdlib;')
+ tangle(' fun _ctor_'+t+': string -> '+t+' = "static_cast<'+tmap[t]+'>(::std::atof($1.data()))" requires cstdlib;')
tangle(' fun _ctor_'+t+'[T:reals]: T -> '+t+' = "static_cast<'+tmap[t]+'>($1)";')
gen_nan(t)
tangle(' proc fprint: ostream * '+t+' = "*$1<<$2;" requires iostream;')
@@ -247,13 +247,13 @@ 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 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())"
+@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);";
+ 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/src/compiler/drivers/flxg.ml b/src/compiler/drivers/flxg.ml
index 1b7d30c..7556229 100644
--- a/src/compiler/drivers/flxg.ml
+++ b/src/compiler/drivers/flxg.ml
@@ -454,9 +454,9 @@ let codegen_bsyms state bsym_table root_proc =
plh "#endif";
plh "//FELIX RUNTIME";
(* plh "#include \"flx_rtl.hpp\""; *)
- plh "using namespace flx::rtl;";
+ plh "using namespace ::flx::rtl;";
(* plh "#include \"flx_gc.hpp\""; *)
- plh "using namespace flx::gc::generic;";
+ plh "using namespace ::flx::gc::generic;";
plh "";

plh "\n//-----------------------------------------";
@@ -714,17 +714,17 @@ let codegen_bsyms state bsym_table root_proc =
plb ("}} // namespace flxusr::" ^ cid_of_flxid state.module_name);

plb "//CREATE STANDARD EXTERNAL INTERFACE";
- plb ("FLX_FRAME_WRAPPERS(flxusr::" ^ cid_of_flxid state.module_name ^ ")");
+ plb ("FLX_FRAME_WRAPPERS(::flxusr::" ^ cid_of_flxid state.module_name ^ ")");
(if List.mem `Pure topclass_props then
- plb ("FLX_C_START_WRAPPER(flxusr::" ^ cid_of_flxid state.module_name ^ "," ^ top_class ^ ")")
+ plb ("FLX_C_START_WRAPPER(::flxusr::" ^ cid_of_flxid state.module_name ^ "," ^ top_class ^ ")")
else if List.mem `Stackable topclass_props then
- plb ("FLX_STACK_START_WRAPPER(flxusr::" ^ cid_of_flxid state.module_name ^ "," ^ top_class ^ ")")
+ plb ("FLX_STACK_START_WRAPPER(::flxusr::" ^ cid_of_flxid state.module_name ^ "," ^ top_class ^ ")")
else
- plb ("FLX_START_WRAPPER(flxusr::" ^ cid_of_flxid state.module_name ^ "," ^ top_class ^ ")")
+ plb ("FLX_START_WRAPPER(::flxusr::" ^ cid_of_flxid state.module_name ^ "," ^ top_class ^ ")")
);
plb "\n//-----------------------------------------";

- plh ("using namespace flxusr::" ^ cid_of_flxid state.module_name ^ ";");
+ plh ("using namespace ::flxusr::" ^ cid_of_flxid state.module_name ^ ";");
if List.length state.syms.bifaces > 0 then begin
plh "//DECLARE USER EXPORTS";
plh (gen_biface_headers state.syms bsym_table state.syms.bifaces);
diff --git a/src/lib/std/env.flx b/src/lib/std/env.flx
index e54a75b..66fa71a 100644
--- a/src/lib/std/env.flx
+++ b/src/lib/std/env.flx
@@ -1,7 +1,7 @@
module Env
{
fun getenv:string -> string =
- "flx::rtl::strutil::atostr(getenv($1.data()))"
+ "::flx::rtl::strutil::atostr(getenv($1.data()))"
requires flx_strutil, cstdlib;

fun getenv(name:string,dflt:string)=>let ?result = getenv(name) in
diff --git a/src/lib/std/float_format.flx b/src/lib/std/float_format.flx
index 06959e9..90bd9c1 100644
--- a/src/lib/std/float_format.flx
+++ b/src/lib/std/float_format.flx
@@ -19,13 +19,13 @@ open module float_format
| scientific(?w,?p) => fmt_scientific(real v,w,p)+"+"+fmt_scientific(imag v,w,p)+"i"
endmatch
;
- fun fmt_default[t] : t * int * int -> string="flx::rtl::strutil::fmt_default($a)" requires flx_strutil;
- fun fmt_fixed[t] : t * int * int -> string="flx::rtl::strutil::fmt_fixed($a)" requires flx_strutil;
- fun fmt_scientific[t] : t * int * int -> string="flx::rtl::strutil::fmt_scientific($a)" requires flx_strutil;
+ fun fmt_default[t] : t * int * int -> string="::flx::rtl::strutil::fmt_default($a)" requires flx_strutil;
+ fun fmt_fixed[t] : t * int * int -> string="::flx::rtl::strutil::fmt_fixed($a)" requires flx_strutil;
+ fun fmt_scientific[t] : t * int * int -> string="::flx::rtl::strutil::fmt_scientific($a)" requires flx_strutil;
}

instance Str[float] {
- fun xstr: float -> string = "flx::rtl::strutil::str<#1>($1)" requires flx_strutil;
+ fun xstr: float -> string = "::flx::rtl::strutil::str<#1>($1)" requires flx_strutil;
fun str(x:float):string =>
if Float::isnan x then "nan"
elif Float::isinf x then
@@ -36,7 +36,7 @@ instance Str[float] {
}

instance Str[double] {
- fun xstr: double -> string = "flx::rtl::strutil::str<#1>($1)" requires flx_strutil;
+ fun xstr: double -> string = "::flx::rtl::strutil::str<#1>($1)" requires flx_strutil;
fun str(x:double):string =>
if Double::isnan x then "nan"
elif Double::isinf x then
@@ -47,7 +47,7 @@ instance Str[double] {
}

instance Str[ldouble] {
- fun xstr: ldouble -> string = "flx::rtl::strutil::str<#1>($1)" requires flx_strutil;
+ fun xstr: ldouble -> string = "::flx::rtl::strutil::str<#1>($1)" requires flx_strutil;
fun str(x:ldouble):string =>
if Ldouble::isnan x then "nan"
elif Ldouble::isinf x then
diff --git a/src/lib/std/float_math.flx b/src/lib/std/float_math.flx
index c1c6616..62f3dae 100644
--- a/src/lib/std/float_math.flx
+++ b/src/lib/std/float_math.flx
@@ -1,8 +1,8 @@
// note: has to be called Fcomplex to avoid clash with typeclass Complex
open module Fcomplex
{
- ctor fcomplex[t in reals] : t * t = "std::complex<float>($1,$2)";
- ctor fcomplex[t in reals] : t = "std::complex<float>($1,0)";
+ ctor fcomplex[t in reals] : t * t = "::std::complex<float>($1,$2)";
+ ctor fcomplex[t in reals] : t = "::std::complex<float>($1,0)";
proc fprint: ostream * fcomplex = "*$1<<$2;" requires iostream;
instance Str[fcomplex] {
fun str (z:fcomplex) => str(real z) + "+" + str(imag z)+"i";
@@ -32,8 +32,8 @@ open module Fcomplex

open module Dcomplex
{
- ctor dcomplex[t in reals] : t * t = "std::complex<double>($1,$2)";
- ctor dcomplex[t in reals] : t = "std::complex<double>($1,0)";
+ ctor dcomplex[t in reals] : t * t = "::std::complex<double>($1,$2)";
+ ctor dcomplex[t in reals] : t = "::std::complex<double>($1,0)";
proc fprint: ostream * dcomplex = "*$1<<$2;" requires iostream;
instance Str[dcomplex] {
fun str (z:dcomplex) => str(real z) + "+" + str(imag z)+"i";
@@ -63,8 +63,8 @@ open module Dcomplex

open module Lcomplex
{
- ctor lcomplex[t in reals] : t * t = "std::complex<long double>($1,$2)";
- ctor lcomplex[t in reals] : t = "std::complex<long double>($1,0)";
+ ctor lcomplex[t in reals] : t * t = "::std::complex<long double>($1,$2)";
+ ctor lcomplex[t in reals] : t = "::std::complex<long double>($1,0)";
proc fprint: ostream * lcomplex = "*$1<<$2;" requires iostream;
instance Str[lcomplex] {
fun str (z:lcomplex) => str(real z) + "+" + str(imag z)+"i";
@@ -94,31 +94,31 @@ open module Lcomplex

instance[t in (floats || complexes)] Trig[t] {
requires cmath;
- fun sin: t -> t = "std::sin($1)";
- fun cos: t -> t = "std::cos($1)";
- fun tan: t -> t = "std::tan($1)";
- fun asin: t -> t = "std::asin($1)";
- fun acos: t -> t = "std::acos($1)";
- fun atan: t -> t = "std::atan($1)";
- fun sinh: t -> t = "std::sinh($1)";
- fun cosh: t -> t = "std::cosh($1)";
- fun tanh: t -> t = "std::tanh($1)";
- fun asinh: t -> t = "std::asinh($1)";
- fun acosh: t -> t = "std::acosh($1)";
- fun atanh: t -> t = "std::atanh($1)";
- fun exp: t -> t = "std::exp($1)";
- fun log: t -> t = "std::log($1)";
- fun pow: t * t -> t = "std::pow($1,$2)";
+ fun sin: t -> t = "::std::sin($1)";
+ fun cos: t -> t = "::std::cos($1)";
+ fun tan: t -> t = "::std::tan($1)";
+ fun asin: t -> t = "::std::asin($1)";
+ fun acos: t -> t = "::std::acos($1)";
+ fun atan: t -> t = "::std::atan($1)";
+ fun sinh: t -> t = "::std::sinh($1)";
+ fun cosh: t -> t = "::std::cosh($1)";
+ fun tanh: t -> t = "::std::tanh($1)";
+ fun asinh: t -> t = "::std::asinh($1)";
+ fun acosh: t -> t = "::std::acosh($1)";
+ fun atanh: t -> t = "::std::atanh($1)";
+ fun exp: t -> t = "::std::exp($1)";
+ fun log: t -> t = "::std::log($1)";
+ fun pow: t * t -> t = "::std::pow($1,$2)";
}

instance[t in floats] Real[t] {
requires cmath;
- fun abs: t -> t = "std::abs($1)";
- fun log10: t -> t = "std::log10($1)";
- fun sqrt: t -> t = "std::sqrt($1)";
- fun ceil: t -> t = "std::ceil($1)";
- fun floor: t -> t = "std::floor($1)";
- fun trunc: t -> t = "std::trunc($1)";
+ fun abs: t -> t = "::std::abs($1)";
+ fun log10: t -> t = "::std::log10($1)";
+ fun sqrt: t -> t = "::std::sqrt($1)";
+ fun ceil: t -> t = "::std::ceil($1)";
+ fun floor: t -> t = "::std::floor($1)";
+ fun trunc: t -> t = "::std::trunc($1)";
}

typeclass CartComplex[r] {
diff --git a/src/lib/std/int.flx b/src/lib/std/int.flx
index 0d28c0a..6d8b50e 100644
--- a/src/lib/std/int.flx
+++ b/src/lib/std/int.flx
@@ -13,132 +13,132 @@ typedef fun integral_promotion: TYPE -> TYPE =

open module Tiny
{
- fun _ctor_tiny: string -> tiny = "static_cast<signed char>(std::atoi($1.data()))" requires cstdlib;
+ fun _ctor_tiny: string -> tiny = "static_cast<signed char>(::std::atoi($1.data()))" requires cstdlib;
fun _ctor_tiny[T in reals]: T -> tiny = "static_cast<signed char>($1)";
proc fprint: ostream * tiny = "*$1<<(int)$2;" requires iostream;
}

open module Short
{
- fun _ctor_short: string -> short = "static_cast<short>(std::atoi($1.data()))" requires cstdlib;
+ fun _ctor_short: string -> short = "static_cast<short>(::std::atoi($1.data()))" requires cstdlib;
fun _ctor_short[T in reals]: T -> short = "static_cast<short>($1)";
proc fprint: ostream * short = "*$1<<$2;" requires iostream;
}

open module Int
{
- fun _ctor_int: string -> int = "static_cast<int>(std::atoi($1.data()))" requires cstdlib;
+ fun _ctor_int: string -> int = "static_cast<int>(::std::atoi($1.data()))" requires cstdlib;
fun _ctor_int[T in reals]: T -> int = "static_cast<int>($1)";
proc fprint: ostream * int = "*$1<<$2;" requires iostream;
}

open module Long
{
- fun _ctor_long: string -> long = "static_cast<long>(std::atoi($1.data()))" requires cstdlib;
+ fun _ctor_long: string -> long = "static_cast<long>(::std::atoi($1.data()))" requires cstdlib;
fun _ctor_long[T in reals]: T -> long = "static_cast<long>($1)";
proc fprint: ostream * long = "*$1<<$2;" requires iostream;
}

open module Vlong
{
- fun _ctor_vlong: string -> vlong = "static_cast<long long>(std::atoi($1.data()))" requires cstdlib;
+ fun _ctor_vlong: string -> vlong = "static_cast<long long>(::std::atoi($1.data()))" requires cstdlib;
fun _ctor_vlong[T in reals]: T -> vlong = "static_cast<long long>($1)";
proc fprint: ostream * vlong = "*$1<<$2;" requires iostream;
}

open module Utiny
{
- fun _ctor_utiny: string -> utiny = "static_cast<unsigned char>(std::atoi($1.data()))" requires cstdlib;
+ fun _ctor_utiny: string -> utiny = "static_cast<unsigned char>(::std::atoi($1.data()))" requires cstdlib;
fun _ctor_utiny[T in reals]: T -> utiny = "static_cast<unsigned char>($1)";
proc fprint: ostream * utiny = "*$1<<(unsigned int)$2;" requires iostream;
}

open module Ushort
{
- fun _ctor_ushort: string -> ushort = "static_cast<unsigned short>(std::atoi($1.data()))" requires cstdlib;
+ fun _ctor_ushort: string -> ushort = "static_cast<unsigned short>(::std::atoi($1.data()))" requires cstdlib;
fun _ctor_ushort[T in reals]: T -> ushort = "static_cast<unsigned short>($1)";
proc fprint: ostream * ushort = "*$1<<$2;" requires iostream;
}

open module Uint
{
- fun _ctor_uint: string -> uint = "static_cast<unsigned int>(std::atoi($1.data()))" requires cstdlib;
+ fun _ctor_uint: string -> uint = "static_cast<unsigned int>(::std::atoi($1.data()))" requires cstdlib;
fun _ctor_uint[T in reals]: T -> uint = "static_cast<unsigned int>($1)";
proc fprint: ostream * uint = "*$1<<$2;" requires iostream;
}

open module Ulong
{
- fun _ctor_ulong: string -> ulong = "static_cast<unsigned long>(std::atoi($1.data()))" requires cstdlib;
+ fun _ctor_ulong: string -> ulong = "static_cast<unsigned long>(::std::atoi($1.data()))" requires cstdlib;
fun _ctor_ulong[T in reals]: T -> ulong = "static_cast<unsigned long>($1)";
proc fprint: ostream * ulong = "*$1<<$2;" requires iostream;
}

open module Uvlong
{
- fun _ctor_uvlong: string -> uvlong = "static_cast<unsigned long long>(std::atoi($1.data()))" requires cstdlib;
+ fun _ctor_uvlong: string -> uvlong = "static_cast<unsigned long long>(::std::atoi($1.data()))" requires cstdlib;
fun _ctor_uvlong[T in reals]: T -> uvlong = "static_cast<unsigned long long>($1)";
proc fprint: ostream * uvlong = "*$1<<$2;" requires iostream;
}

open module Int8
{
- fun _ctor_int8: string -> int8 = "static_cast<?1>(std::atoi($1.data()))" requires cstdlib;
+ fun _ctor_int8: string -> int8 = "static_cast<?1>(::std::atoi($1.data()))" requires cstdlib;
fun _ctor_int8[T in reals]: T -> int8 = "static_cast<?1>($1)";
}

open module Int16
{
- fun _ctor_int16: string -> int16 = "static_cast<?1>(std::atoi($1.data()))" requires cstdlib;
+ fun _ctor_int16: string -> int16 = "static_cast<?1>(::std::atoi($1.data()))" requires cstdlib;
fun _ctor_int16[T in reals]: T -> int16 = "static_cast<?1>($1)";
}

open module Int32
{
- fun _ctor_int32: string -> int32 = "static_cast<?1>(std::atoi($1.data()))" requires cstdlib;
+ fun _ctor_int32: string -> int32 = "static_cast<?1>(::std::atoi($1.data()))" requires cstdlib;
fun _ctor_int32[T in reals]: T -> int32 = "static_cast<?1>($1)";
}

open module Int64
{
- fun _ctor_int64: string -> int64 = "static_cast<?1>(std::atoi($1.data()))" requires cstdlib;
+ fun _ctor_int64: string -> int64 = "static_cast<?1>(::std::atoi($1.data()))" requires cstdlib;
fun _ctor_int64[T in reals]: T -> int64 = "static_cast<?1>($1)";
}

open module Uint8
{
- fun _ctor_uint8: string -> uint8 = "static_cast<?1>(std::atoi($1.data()))" requires cstdlib;
+ fun _ctor_uint8: string -> uint8 = "static_cast<?1>(::std::atoi($1.data()))" requires cstdlib;
fun _ctor_uint8[T in reals]: T -> uint8 = "static_cast<?1>($1)";
}

open module Uint16
{
- fun _ctor_uint16: string -> uint16 = "static_cast<?1>(std::atoi($1.data()))" requires cstdlib;
+ fun _ctor_uint16: string -> uint16 = "static_cast<?1>(::std::atoi($1.data()))" requires cstdlib;
fun _ctor_uint16[T in reals]: T -> uint16 = "static_cast<?1>($1)";
}

open module Uint32
{
- fun _ctor_uint32: string -> uint32 = "static_cast<?1>(std::atoi($1.data()))" requires cstdlib;
+ fun _ctor_uint32: string -> uint32 = "static_cast<?1>(::std::atoi($1.data()))" requires cstdlib;
fun _ctor_uint32[T in reals]: T -> uint32 = "static_cast<?1>($1)";
}

open module Uint64
{
- fun _ctor_uint64: string -> uint64 = "static_cast<?1>(std::atoi($1.data()))" requires cstdlib;
+ fun _ctor_uint64: string -> uint64 = "static_cast<?1>(::std::atoi($1.data()))" requires cstdlib;
fun _ctor_uint64[T in reals]: T -> uint64 = "static_cast<?1>($1)";
}

instance Str[tiny] {
- fun str: tiny -> string = "flx::rtl::strutil::str<int>($1)" requires flx_strutil;
+ fun str: tiny -> string = "::flx::rtl::strutil::str<int>($1)" requires flx_strutil;
}

instance Str[utiny] {
- fun str: utiny -> string = "flx::rtl::strutil::str<unsigned int>($1)" requires flx_strutil;
+ fun str: utiny -> string = "::flx::rtl::strutil::str<unsigned int>($1)" requires flx_strutil;
}

instance[T in short||ushort||int||uint||long||ulong||vlong||uvlong] Str[T] {
- fun str: T -> string = "flx::rtl::strutil::str<#1>($1)" requires flx_strutil;
+ fun str: T -> string = "::flx::rtl::strutil::str<#1>($1)" requires flx_strutil;
}

instance Repr[tiny] { fun repr[with Str[tiny]] (t:tiny) : string => (str t) + "t"; }
diff --git a/src/lib/std/string.flx b/src/lib/std/string.flx
index 4fb9a30..e63a699 100644
--- a/src/lib/std/string.flx
+++ b/src/lib/std/string.flx
@@ -1,4 +1,4 @@
-type string = "std::string";
+type string = "::std::string";
type ustring = "basic_string<uint32_t>" requires string_hxx;

typedef strings = typesetof (string,ustring);
@@ -30,28 +30,28 @@ open module String
fun add: charp * string -> string = "$1+$2";
fun add: string * char -> string = "$1+$2";
fun add: char * string -> string = "$1+$2";
- fun add: string * int -> string = "$1+flx::rtl::i18n::utf8($2)" requires flx_i18n;
- fun mul: string * int -> string = "flx::rtl::strutil::mul($1,$2)" requires flx_strutil;
- fun mul: char * int -> string = "std::string($2,$1)";
+ fun add: string * int -> string = "$1+::flx::rtl::i18n::utf8($2)" requires flx_i18n;
+ fun mul: string * int -> string = "::flx::rtl::strutil::mul($1,$2)" requires flx_strutil;
+ fun mul: char * int -> string = "::std::string($2,$1)";

fun apply (x:string, y:string):string => x + y;
fun apply (x:string, y:int):string => x + y;

fun _ctor_char (x:string) => x.[0];
fun _ctor_string (c:char) => ""+c;
- gen _ctor_string: charp -> string = "std::string($1)";
- gen _ctor_string: charp * int -> string = "std::string($1,$2)";
- gen _ctor_string: charcp -> string = "std::string($1)";
- gen _ctor_string: charcp * int -> string = "std::string($1,$2)";
+ gen _ctor_string: charp -> string = "::std::string($1)";
+ gen _ctor_string: charp * int -> string = "::std::string($1,$2)";
+ gen _ctor_string: charcp -> string = "::std::string($1)";
+ gen _ctor_string: charcp * int -> string = "::std::string($1,$2)";

fun subscript: string * int -> char =
- "flx::rtl::strutil::subscript($1,$2)" requires flx_strutil;
+ "::flx::rtl::strutil::subscript($1,$2)" requires flx_strutil;
fun copyfrom: string * int -> string =
- "flx::rtl::strutil::substr($1,$2,$1.size())" requires flx_strutil;
+ "::flx::rtl::strutil::substr($1,$2,$1.size())" requires flx_strutil;
fun copyto: string * int -> string =
- "flx::rtl::strutil::substr($1,0,$2)" requires flx_strutil;
+ "::flx::rtl::strutil::substr($1,0,$2)" requires flx_strutil;
fun substring: string * int * int -> string =
- "flx::rtl::strutil::substr($1,$2,$3)" requires flx_strutil;
+ "::flx::rtl::strutil::substr($1,$2,$3)" requires flx_strutil;

fun subscript (x:string, s:slice[int]):string =>
match s with
@@ -82,7 +82,7 @@ open module String
// Note we use int instead of size here: size is correct,
// but that would requires heaps of casts in Felix

- const stl_npos: int = "static_cast<int>(std::string::npos)";
+ const stl_npos: int = "static_cast<int>(::std::string::npos)";

fun stl_find: string * string -> int = "$1.find($2)";
fun stl_find: string * string * int -> int = "$1.find($2,$3)";
@@ -318,9 +318,9 @@ open module String
proc fprint: ostream * C_hack::ptr[char] = "*$1<<$2;" requires iostream;
proc fprint: ostream * C_hack::cptr[char] = "*$1<<$2;" requires iostream;
proc fprint: ostream * string = "*$1<<$2;" requires iostream;
- fun atoi: string -> int = "std::atoi($1.data())" requires cstdlib;
- fun atol: string -> long = "std::atol($1.data())" requires cstdlib;
- fun atof: string -> double = "std::atof($1.data())" requires cstdlib;
+ fun atoi: string -> int = "::std::atoi($1.data())" requires cstdlib;
+ fun atol: string -> long = "::std::atol($1.data())" requires cstdlib;
+ fun atof: string -> double = "::std::atof($1.data())" requires cstdlib;

proc reserve: lvalue[string] * int = "$1.reserve($2);";

@@ -328,11 +328,11 @@ open module String
fun cstr: string -> C_hack::cptr[char] = "$1.data()";

fun vsprintf[t]: C_hack::ptr[char] * t -> string =
- "flx::rtl::strutil::flx_asprintf($1,$2)" requires flx_strutil
+ "::flx::rtl::strutil::flx_asprintf($1,$2)" requires flx_strutil
;

fun vsprintf[t]: string * t -> string =
- "flx::rtl::strutil::flx_asprintf(const_cast<char*>($1.c_str()),$2)" requires flx_strutil
+ "::flx::rtl::strutil::flx_asprintf(const_cast<char*>($1.c_str()),$2)" requires flx_strutil
;
}

@@ -341,11 +341,11 @@ instance Str[string] {
}

instance[T in charp||charcp] Str[T] {
- fun str: T -> string = 'flx::rtl::strutil::atostr($1)' requires flx_strutil;
+ fun str: T -> string = '::flx::rtl::strutil::atostr($1)' requires flx_strutil;
}

instance[T in ucharp||ucharcp] Str[T] {
- fun str: T -> string = 'flx::rtl::strutil::atostr((char const*)$1)' requires flx_strutil;
+ fun str: T -> string = '::flx::rtl::strutil::atostr((char const*)$1)' requires flx_strutil;
}

instance Repr[string] {
@@ -368,7 +368,7 @@ open module Ustring

fun len: ustring -> int = "$1.size()";
fun add: ustring * ustring -> ustring = "$1+$2";
- fun mul: ustring * int -> ustring = "flx::lib::mul($1,$2)";
+ fun mul: ustring * int -> ustring = "::flx::lib::mul($1,$2)";
fun mul: char * int -> ustring = "ustring($2,$1)";

fun apply (x:ustring, y:ustring):ustring => x + y;
@@ -376,11 +376,11 @@ open module Ustring
fun subscript: ustring * int -> char =
"$1[$2<0??$1.size()+$2 : $2]";
fun copyfrom: ustring * int -> ustring =
- "flx::rtl::strutil::substr($1,$2,$1.size())" requires flx_strutil;
+ "::flx::rtl::strutil::substr($1,$2,$1.size())" requires flx_strutil;
fun copyto: ustring * int -> ustring =
- "flx::rtl::strutil::substr($1,0,$2)" requires flx_strutil;
+ "::flx::rtl::strutil::substr($1,0,$2)" requires flx_strutil;
fun substring: ustring * int * int -> ustring =
- "flx::rtl::strutil::substr($1,$2,$3)" requires flx_strutil;
+ "::flx::rtl::strutil::substr($1,$2,$3)" requires flx_strutil;

// comparisons
//gen_cmp ustring;
diff --git a/src/rtl/flx_compiler_support_bodies.hpp b/src/rtl/flx_compiler_support_bodies.hpp
index 97631fc..6defba3 100644
--- a/src/rtl/flx_compiler_support_bodies.hpp
+++ b/src/rtl/flx_compiler_support_bodies.hpp
@@ -9,10 +9,10 @@


#define FLX_EXEC_FAILURE(f,op,what) \
- throw flx::rtl::flx_exec_failure_t (f,op,what)
+ throw ::flx::rtl::flx_exec_failure_t (f,op,what)

#define FLX_HALT(f,sl,sc,el,ec,s) \
- throw flx::rtl::flx_halt_t (flx_range_srcref_t(f,sl,sc,el,ec),__FILE__,__LINE__,s)
+ throw ::flx::rtl::flx_halt_t (flx_range_srcref_t(f,sl,sc,el,ec),__FILE__,__LINE__,s)

// note call should be trace(&v,...) however that requires
// compiler support to make a trace record for each tracepoint
@@ -20,25 +20,25 @@

#ifdef FLX_ENABLE_TRACE
#define FLX_TRACE(v,f,sl,sc,el,ec,s) \
- flx::rtl::flx_trace (NULL,flx_range_srcref_t(f,sl,sc,el,ec),__FILE__,__LINE__,s)
+ ::flx::rtl::flx_trace (NULL,flx_range_srcref_t(f,sl,sc,el,ec),__FILE__,__LINE__,s)
#else
#define FLX_TRACE(v,f,sl,sc,el,ec,s)
#endif

#define FLX_MATCH_FAILURE(f,sl,sc,el,ec) \
- throw flx::rtl::flx_match_failure_t (flx_range_srcref_t(f,sl,sc,el,ec),__FILE__,__LINE__)
+ throw ::flx::rtl::flx_match_failure_t (flx_range_srcref_t(f,sl,sc,el,ec),__FILE__,__LINE__)

#define FLX_ASSERT_FAILURE(f,sl,sc,el,ec) \
- throw flx::rtl::flx_assert_failure_t (flx_range_srcref_t(f,sl,sc,el,ec),__FILE__,__LINE__)
+ throw ::flx::rtl::flx_assert_failure_t (flx_range_srcref_t(f,sl,sc,el,ec),__FILE__,__LINE__)

#define FLX_ASSERT2_FAILURE(f,sl,sc,el,ec,f2,sl2,sc2,el2,ec2) \
- throw flx::rtl::flx_assert2_failure_t (\
+ throw ::flx::rtl::flx_assert2_failure_t (\
flx_range_srcref_t(f,sl,sc,el,ec),\
flx_range_srcref_t(f2,sl2,sc2,el2,sc2),\
__FILE__,__LINE__)

#define FLX_RANGE_FAILURE(f,sl,sc,el,ec) \
- throw flx::rtl::flx_range_failure_t (flx_range_srcref_t(f,sl,sc,el,ec),__FILE__,__LINE__)
+ throw ::flx::rtl::flx_range_failure_t (flx_range_srcref_t(f,sl,sc,el,ec),__FILE__,__LINE__)

// for generated code in body file
#define INIT_PC pc=0;
diff --git a/src/rtl/flx_dynlink.hpp b/src/rtl/flx_dynlink.hpp
index bf667a6..c8ff3ae 100644
--- a/src/rtl/flx_dynlink.hpp
+++ b/src/rtl/flx_dynlink.hpp
@@ -27,8 +27,8 @@ using namespace std;
// work with .dylib, they really shouldn't shouldn't.
// #define FLX_LIB_EXTENSION ".dylib"
#define FLX_LIB_EXTENSION ".so"
- #define FLX_DLSYM(x, y) flx::rtl::getmachosym(x,"_"#y)
- #define FLX_SDLSYM(x, y) flx::rtl::getmachosym(x,(string("_")+string(y)).data())
+ #define FLX_DLSYM(x, y) ::flx::rtl::getmachosym(x,"_"#y)
+ #define FLX_SDLSYM(x, y) ::flx::rtl::getmachosym(x,(string("_")+string(y)).data())
#else
// UNIX, recent OSX
typedef void *LIBHANDLE;
@@ -54,7 +54,7 @@ using namespace std;
#ifndef FLX_STATIC_LINK
#define SDLSYM(x,y) FLX_SDLSYM(x,y)
#else
- #define SDLSYM(x,y) (throw flx::rtl::link_failure_t("<static link>",y,"dlsym with static link requires name not string")
+ #define SDLSYM(x,y) (throw ::flx::rtl::link_failure_t("<static link>",y,"dlsym with static link requires name not string")
#endif

// Utilities to make dynamic linkage and
@@ -109,7 +109,7 @@ flx_load_module(const std::string& filename);

typedef thread_frame_t *(*thread_frame_creator_t)
(
- flx::gc::generic::gc_profile_t*
+ ::flx::gc::generic::gc_profile_t*
);

/// library initialisation routine.
@@ -170,11 +170,11 @@ struct RTL_EXTERN flx_libinit_t
con_t *start_proc;
con_t *main_proc;
flx_dynlink_t *lib;
- flx::gc::generic::gc_profile_t *gcp;
+ ::flx::gc::generic::gc_profile_t *gcp;
void create
(
flx_dynlink_t *lib_a,
- flx::gc::generic::gc_profile_t *gcp_a,
+ ::flx::gc::generic::gc_profile_t *gcp_a,
main_t main_sym,
int argc,
char **argv,
diff --git a/src/rtl/flx_eh.cpp b/src/rtl/flx_eh.cpp
index 2e5319c..651bf21 100644
--- a/src/rtl/flx_eh.cpp
+++ b/src/rtl/flx_eh.cpp
@@ -3,16 +3,16 @@
#include "flx_dynlink.hpp"
#include "flx_exceptions.hpp"
#include "flx_eh.hpp"
-using namespace flx::rtl;
+using namespace ::flx::rtl;


-int flx::rtl::std_exception_handler (std::exception *e)
+int ::flx::rtl::std_exception_handler (std::exception *e)
{
fprintf(stderr,"C++ STANDARD EXCEPTION %s\n",e->what());
return 4;
}

-int flx::rtl::flx_exception_handler (flx_exception_t *e)
+int ::flx::rtl::flx_exception_handler (flx_exception_t *e)
{
if (flx_halt_t *x = dynamic_cast<flx_halt_t*>(e))
{
diff --git a/src/rtl/flx_eh.hpp b/src/rtl/flx_eh.hpp
index 6904c2b..978fcac 100644
--- a/src/rtl/flx_eh.hpp
+++ b/src/rtl/flx_eh.hpp
@@ -4,8 +4,8 @@
#include "flx_exceptions.hpp"

namespace flx { namespace rtl {
-int RTL_EXTERN std_exception_handler (std::exception *e);
-int RTL_EXTERN flx_exception_handler (flx::rtl::flx_exception_t *e);
+int RTL_EXTERN std_exception_handler (::std::exception *e);
+int RTL_EXTERN flx_exception_handler (::flx::rtl::flx_exception_t *e);
}}

#endif
diff --git a/src/rtl/flx_executil.cpp b/src/rtl/flx_executil.cpp
index d06a088..ae82c1d 100644
--- a/src/rtl/flx_executil.cpp
+++ b/src/rtl/flx_executil.cpp
@@ -1,11 +1,11 @@
#include "flx_executil.hpp"
namespace flx { namespace rtl { namespace executil {
-void run(flx::rtl::con_t *p)
+void run(::flx::rtl::con_t *p)
{
while(p)
{
try { p=p->resume(); }
- catch (flx::rtl::con_t *x) { p = x; }
+ catch (::flx::rtl::con_t *x) { p = x; }
}
}

diff --git a/src/rtl/flx_main.cpp b/src/rtl/flx_main.cpp
index d63e23a..fd68504 100644
--- a/src/rtl/flx_main.cpp
+++ b/src/rtl/flx_main.cpp
@@ -1,4 +1,4 @@
#include "flx_rtl_config.hpp"
#include "flx_rtl.hpp"
// THIS IS A DO NOTHING MAINLINE FOR USE WHEN STATICALLY LINKING
-extern "C" flx::rtl::con_t *flx_main( void *p){ return 0; }
+extern "C" ::flx::rtl::con_t *flx_main( void *p){ return 0; }
diff --git a/src/rtl/flx_rtl.cpp b/src/rtl/flx_rtl.cpp
index 1f3e9db..c5d5dc3 100644
--- a/src/rtl/flx_rtl.cpp
+++ b/src/rtl/flx_rtl.cpp
@@ -38,7 +38,7 @@ static std::size_t slist_node_offsets[2]={
offsetof(slist_node_t,data)
};

-flx::gc::generic::gc_shape_t slist_node_ptr_map = {
+::flx::gc::generic::gc_shape_t slist_node_ptr_map = {
NULL,
"slist_node_t",
1,sizeof(slist_node_t),
@@ -75,7 +75,7 @@ static std::size_t slist_offsets[1]={
offsetof(slist_t,head)
};

-flx::gc::generic::gc_shape_t slist_ptr_map = {
+::flx::gc::generic::gc_shape_t slist_ptr_map = {
&slist_node_ptr_map,
"slist_t",
1,sizeof(slist_t),
@@ -138,7 +138,7 @@ static std::size_t _fthread_offsets[1]={
offsetof(fthread_t,cc)
};

-flx::gc::generic::gc_shape_t _fthread_ptr_map = {
+::flx::gc::generic::gc_shape_t _fthread_ptr_map = {
&slist_ptr_map,
"fthread_t",
1,sizeof(fthread_t),
@@ -189,7 +189,7 @@ static std::size_t schannel_offsets[2]={
offsetof(schannel_t,waiting_to_write)
};

-flx::gc::generic::gc_shape_t schannel_ptr_map = {
+::flx::gc::generic::gc_shape_t schannel_ptr_map = {
&_fthread_ptr_map,
"schannel_t",
1,sizeof(schannel_t),
@@ -208,7 +208,7 @@ static std::size_t _uctor_offsets[1]= {
offsetof(_uctor_,data)
};

-flx::gc::generic::gc_shape_t _uctor_ptr_map = {
+::flx::gc::generic::gc_shape_t _uctor_ptr_map = {
&schannel_ptr_map,
"_uctor_",
1,
@@ -223,7 +223,7 @@ flx::gc::generic::gc_shape_t _uctor_ptr_map = {
// int implementation
// ********************************************************

-flx::gc::generic::gc_shape_t _int_ptr_map = {
+::flx::gc::generic::gc_shape_t _int_ptr_map = {
&_uctor_ptr_map,
"int",
1,
@@ -241,7 +241,7 @@ flx::gc::generic::gc_shape_t _int_ptr_map = {
//OFFSETS for address
static std::size_t _address_offsets[1]={ 0 };

-flx::gc::generic::gc_shape_t _address_ptr_map = {
+::flx::gc::generic::gc_shape_t _address_ptr_map = {
&_int_ptr_map,
"address",
1,
@@ -257,7 +257,7 @@ flx::gc::generic::gc_shape_t _address_ptr_map = {
// unit implementation
// ********************************************************

-flx::gc::generic::gc_shape_t unit_ptr_map = {
+::flx::gc::generic::gc_shape_t unit_ptr_map = {
&_address_ptr_map,
"unit",
1,
diff --git a/src/rtl/flx_rtl.hpp b/src/rtl/flx_rtl.hpp
index 1d03e1d..fcaecbe 100644
--- a/src/rtl/flx_rtl.hpp
+++ b/src/rtl/flx_rtl.hpp
@@ -35,13 +35,13 @@ struct RTL_EXTERN unit {}; // unit
// we provide a shape for C 'int' type as well
// ********************************************************

-RTL_EXTERN extern flx::gc::generic::gc_shape_t _fthread_ptr_map;
-RTL_EXTERN extern flx::gc::generic::gc_shape_t schannel_ptr_map;
-RTL_EXTERN extern flx::gc::generic::gc_shape_t _uctor_ptr_map;
-RTL_EXTERN extern flx::gc::generic::gc_shape_t _int_ptr_map;
-RTL_EXTERN extern flx::gc::generic::gc_shape_t _address_ptr_map;
-RTL_EXTERN extern flx::gc::generic::gc_shape_t unit_ptr_map;
-RTL_EXTERN extern flx::gc::generic::gc_shape_t slist_ptr_map;
+RTL_EXTERN extern ::flx::gc::generic::gc_shape_t _fthread_ptr_map;
+RTL_EXTERN extern ::flx::gc::generic::gc_shape_t schannel_ptr_map;
+RTL_EXTERN extern ::flx::gc::generic::gc_shape_t _uctor_ptr_map;
+RTL_EXTERN extern ::flx::gc::generic::gc_shape_t _int_ptr_map;
+RTL_EXTERN extern ::flx::gc::generic::gc_shape_t _address_ptr_map;
+RTL_EXTERN extern ::flx::gc::generic::gc_shape_t unit_ptr_map;
+RTL_EXTERN extern ::flx::gc::generic::gc_shape_t slist_ptr_map;

// ********************************************************
/// CONTINUATION.
diff --git a/src/rtl/flx_sync.hpp b/src/rtl/flx_sync.hpp
index 98c0600..9529b98 100644
--- a/src/rtl/flx_sync.hpp
+++ b/src/rtl/flx_sync.hpp
@@ -16,16 +16,16 @@ RTL_EXTERN char const * get_fpc_desc(fpc_t);

struct RTL_EXTERN sync_state_t {
bool debug_driver;
- flx::gc::generic::gc_profile_t *gcp;
- std::list<flx::rtl::fthread_t*> *active;
- flx::rtl::fthread_t *ft;
- flx::rtl::_uctor_ *request;
+ ::flx::gc::generic::gc_profile_t *gcp;
+ ::std::list<flx::rtl::fthread_t*> *active;
+ ::flx::rtl::fthread_t *ft;
+ ::flx::rtl::_uctor_ *request;
fpc_t pc;
fstate_t fs;
sync_state_t (
bool debug_driver_,
- flx::gc::generic::gc_profile_t *gcp_,
- std::list<flx::rtl::fthread_t*> *active_
+ ::flx::gc::generic::gc_profile_t *gcp_,
+ ::std::list<flx::rtl::fthread_t*> *active_
);
void frun();
};

-----------------------------------------------------------------------

Summary of changes:
lpsrc/flx_stdlib.pak | 26 +++++++-------
src/compiler/drivers/flxg.ml | 14 ++++----
src/lib/std/env.flx | 2 +-
src/lib/std/float_format.flx | 12 +++---
src/lib/std/float_math.flx | 54 +++++++++++++++---------------
src/lib/std/int.flx | 42 ++++++++++++------------
src/lib/std/string.flx | 48 ++++++++++++++--------------
src/rtl/flx_compiler_support_bodies.hpp | 14 ++++----
src/rtl/flx_dynlink.hpp | 12 +++---
src/rtl/flx_eh.cpp | 6 ++--
src/rtl/flx_eh.hpp | 4 +-
src/rtl/flx_executil.cpp | 4 +-
src/rtl/flx_main.cpp | 2 +-
src/rtl/flx_rtl.cpp | 16 ++++----
src/rtl/flx_rtl.hpp | 14 ++++----
src/rtl/flx_sync.hpp | 12 +++---
16 files changed, 141 insertions(+), 141 deletions(-)


hooks/post-receive
--
An advanced programming language

Reply all
Reply to author
Forward
0 new messages