v3.3.4 v2.11.3.1
gnosygnu 9 years ago
parent d9f45cec19
commit 8a5d58a973

@ -1,20 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src_000_err"/>
<classpathentry kind="src" path="src_100_interface"/>
<classpathentry kind="src" path="src_100_types_primitive"/>
<classpathentry kind="src" path="src_101_types_object"/>
<classpathentry kind="src" path="src_120_basicDataType"/>
<classpathentry kind="src" path="src_130_brys"/>
<classpathentry kind="src" path="src_140_list"/>
<classpathentry kind="src" path="src_210_env"/>
<classpathentry kind="src" path="src_300_classXtn"/>
<classpathentry kind="src" path="src_310_gfoNde"/>
<classpathentry kind="src" path="src_311_gfoObj"/>
<classpathentry kind="src" path="src_330_store"/>
<classpathentry kind="src" path="src_400_gfs"/>
<classpathentry kind="src" path="src_410_gfoCfg"/>
<classpathentry kind="src" path="src_420_usrMsg"/>
<classpathentry kind="src" path="tst"/>
<classpathentry kind="src" path="xtn"/>

@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
import gplx.langs.gfs.*;
public class Bool_ implements GfoInvkAble {
public static final String Cls_val_name = "boolean";
public static final Class<?> Cls_ref_type = Boolean.class;

@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
import org.junit.*;
public class Byte__tst {
public class Byte__tst {
@Test public void int_() {
tst_int_( 0, 0);
tst_int_( 127, 127);

@ -99,6 +99,7 @@ public class Byte_ascii {
public static final byte[]
Tab_bry = new byte[] {Byte_ascii.Tab}
, Nl_bry = new byte[] {Byte_ascii.Nl}
, Space_bry = new byte[] {Byte_ascii.Space}
, Bang_bry = new byte[] {Byte_ascii.Bang}
, Quote_bry = new byte[] {Byte_ascii.Quote}
, Hash_bry = new byte[] {Byte_ascii.Hash}
@ -107,6 +108,7 @@ public class Byte_ascii {
, Angle_end_bry = new byte[] {Byte_ascii.Angle_end}
, Comma_bry = new byte[] {Byte_ascii.Comma}
, Colon_bry = new byte[] {Byte_ascii.Colon}
, Eq_bry = new byte[] {Byte_ascii.Eq}
, Amp_bry = new byte[] {Byte_ascii.Amp}
, Lt_bry = new byte[] {Byte_ascii.Lt}
, Gt_bry = new byte[] {Byte_ascii.Gt}
@ -118,6 +120,5 @@ public class Byte_ascii {
, Slash_bry = new byte[] {Byte_ascii.Slash}
, Asterisk_bry = new byte[] {Byte_ascii.Star}
, Dash_bry = new byte[] {Byte_ascii.Dash}
, Space_bry = new byte[] {Byte_ascii.Space}
;
}

@ -25,6 +25,7 @@ public class Err extends RuntimeException {
this.trace = is_gplx ? Err_.Trace_lang(this) : trace; // NOTE: Err_ factory methods pass in null stack trace for gplx excs; call Stack_trace here, note that trace will not show constructor
Msgs_add(type, msg, args);
}
public boolean Logged() {return logged;} public Err Logged_y_() {logged = true; return this;} private boolean logged;
public int Trace_ignore() {return trace_ignore;} public Err Trace_ignore_add_1_() {++trace_ignore; return this;} private int trace_ignore = 0;
public Err Args_add(Object... args) {msgs_ary[msgs_idx - 1].Args_add(args); return this;} // i - 1 to get current
@gplx.Internal protected boolean Type_match(String type) {

@ -21,7 +21,7 @@ public class GfsCtx {
public boolean Fail_if_unhandled() {return fail_if_unhandled;} public GfsCtx Fail_if_unhandled_(boolean v) {fail_if_unhandled = v; return this;} private boolean fail_if_unhandled;
public Gfo_usr_dlg Usr_dlg() {return usr_dlg;} public GfsCtx Usr_dlg_(Gfo_usr_dlg v) {usr_dlg = v; return this;} Gfo_usr_dlg usr_dlg;
public boolean Help_browseMode() {return help_browseMode;} public GfsCtx Help_browseMode_(boolean v) {help_browseMode = v; return this;} private boolean help_browseMode;
@gplx.Internal protected List_adp Help_browseList() {return help_browseList;} List_adp help_browseList = List_adp_.new_();
public List_adp Help_browseList() {return help_browseList;} List_adp help_browseList = List_adp_.new_();
public Object MsgSrc() {return msgSrc;} public GfsCtx MsgSrc_(Object v) {msgSrc = v; return this;} Object msgSrc;
public boolean Match(String k, String match) {
if (help_browseMode) {

@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
import gplx.core.strings.*;
import gplx.core.strings.*; import gplx.langs.gfs.*;
public class Int_ implements GfoInvkAble {
public static final String Cls_val_name = "int";
public static final Class<?> Cls_ref_type = Integer.class;

@ -24,7 +24,8 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import javax.management.RuntimeErrorException;
import gplx.core.strings.*;
import gplx.core.brys.fmtrs.*;
import gplx.core.strings.*; import gplx.langs.gfs.*;
public class ProcessAdp implements GfoInvkAble, RlsAble {
public boolean Enabled() {return enabled;} public ProcessAdp Enabled_(boolean v) {enabled = v; return this;} private boolean enabled = true;
public byte Exe_exists() {return exe_exists;} public ProcessAdp Exe_exists_(byte v) {exe_exists = v; return this;} private byte exe_exists = Bool_.__byte;

@ -221,9 +221,9 @@ class TfdsMsgBldr {
}
sb.Add_fmt_line("{0}: {1} {2} {3}"
, Int_.To_str_pad_bgn_zero(itm.Idx(), 4)
, String_.PadBgn(itm.Lhs(), lhsLenMax, " ")
, itm.Lhs() // String_.PadBgn(itm.Lhs(), lhsLenMax, " ")
, eq_str
, String_.PadBgn(itm.Rhs(), rhsLenMax, " ")
, itm.Rhs() // String_.PadBgn(itm.Rhs(), rhsLenMax, " ")
);
}
// String compSym = isEq ? " " : "!=";

@ -15,9 +15,9 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.brys; import gplx.*;
public class Bry_fmtr_arg_bry implements Bry_fmtr_arg {
public Bry_fmtr_arg_bry Data_(byte[] v) {ary = v; return this;}
public void Fmt__do(Bry_bfr bfr) {bfr.Add(ary);}
public Bry_fmtr_arg_bry(byte[] v) {this.ary = v;} byte[] ary;
package gplx.core.brys; import gplx.*; import gplx.core.*;
public interface Bfr_arg {
void Bfr_arg__clear();
boolean Bfr_arg__exists();
void Bfr_arg__add(Bry_bfr bfr);
}

@ -0,0 +1,37 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.core.brys; import gplx.*; import gplx.core.*;
import gplx.core.brys.args.*; import gplx.core.brys.fmtrs.*;
public class Bfr_arg_ {
public static Bfr_arg__int New_int(int v) {return new Bfr_arg__int(v);}
public static Bfr_arg__byte New_byte(byte v) {return new Bfr_arg__byte(v);}
public static Bfr_arg__bry New_bry(String v) {return new Bfr_arg__bry(Bry_.new_u8(v));}
public static Bfr_arg__bry New_bry(byte[] v) {return new Bfr_arg__bry(v);}
public static Bfr_arg__bry_fmtr New_bry_fmtr__null() {return new Bfr_arg__bry_fmtr(null, null);}
public static Bfr_arg__bry_fmtr New_bry_fmtr(Bry_fmtr v, Bfr_arg... arg_ary) {return new Bfr_arg__bry_fmtr(v, arg_ary);}
public static final Bfr_arg Noop = new Bfr_arg___noop();
public static void Clear(Bfr_arg... ary) {
for (Bfr_arg arg : ary)
arg.Bfr_arg__clear();
}
}
class Bfr_arg___noop implements gplx.core.brys.Bfr_arg {
public void Bfr_arg__clear() {}
public boolean Bfr_arg__exists() {return false;}
public void Bfr_arg__add(Bry_bfr bfr) {}
}

@ -15,9 +15,9 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.brys; import gplx.*;
public class Bry_fmtr_arg_byt implements Bry_fmtr_arg {
public Bry_fmtr_arg_byt(byte byt) {this.byt = byt;} private byte byt;
public Bry_fmtr_arg_byt Data_(byte v) {byt = v; return this;}
public void Fmt__do(Bry_bfr bfr) {bfr.Add_byte(byt);}
package gplx.core.brys; import gplx.*; import gplx.core.*;
public abstract class Bfr_arg_base implements Bfr_arg {
@gplx.Virtual public void Bfr_arg__clear() {}
@gplx.Virtual public boolean Bfr_arg__exists() {return true;}
public abstract void Bfr_arg__add(Bry_bfr bfr);
}

@ -0,0 +1,23 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.core.brys.args; import gplx.*; import gplx.core.*; import gplx.core.brys.*;
public class Bfr_arg__bry extends gplx.core.brys.Bfr_arg_base {
private final byte[] bry;
public Bfr_arg__bry(byte[] v) {this.bry = v;}
@Override public void Bfr_arg__add(Bry_bfr bfr) {bfr.Add(bry);}
}

@ -0,0 +1,26 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.core.brys.args; import gplx.*; import gplx.core.*; import gplx.core.brys.*;
public class Bfr_arg__bry_ary extends gplx.core.brys.Bfr_arg_base {
private byte[][] bry_ary;
public Bfr_arg__bry_ary Set(byte[][] v) {this.bry_ary = v; return this;}
@Override public void Bfr_arg__add(Bry_bfr bfr) {
for (byte[] bry : bry_ary)
bfr.Add(bry);
}
}

@ -0,0 +1,28 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.core.brys.args; import gplx.*; import gplx.core.*; import gplx.core.brys.*;
import gplx.core.brys.fmtrs.*;
public class Bfr_arg__bry_fmtr extends gplx.core.brys.Bfr_arg_base {
private Bry_fmtr fmtr; private Object[] arg_ary;
public Bfr_arg__bry_fmtr(Bry_fmtr fmtr, Object[] arg_ary) {Set(fmtr, arg_ary);}
public Bfr_arg__bry_fmtr Set(Bry_fmtr fmtr, Object... arg_ary) {
this.fmtr = fmtr; this.arg_ary = arg_ary;
return this;
}
@Override public void Bfr_arg__add(Bry_bfr bfr) {fmtr.Bld_bfr_many(bfr, arg_ary);}
}

@ -0,0 +1,23 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.core.brys.args; import gplx.*; import gplx.core.*; import gplx.core.brys.*;
public class Bfr_arg__byte extends gplx.core.brys.Bfr_arg_base {
private final byte byt;
public Bfr_arg__byte(byte byt) {this.byt = byt;}
@Override public void Bfr_arg__add(Bry_bfr bfr) {bfr.Add_byte(byt);}
}

@ -15,11 +15,11 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.brys; import gplx.*;
public class Bry_fmtr_arg_decimal_int implements Bry_fmtr_arg {
public int Val() {return val;} public Bry_fmtr_arg_decimal_int Val_(int v) {val = v; return this;} int val;
public Bry_fmtr_arg_decimal_int Places_(int v) {places = v; multiple = (int)Math_.Pow(10, v); return this;} int multiple = 1000, places = 3;
public void Fmt__do(Bry_bfr bfr) {
package gplx.core.brys.args; import gplx.*; import gplx.core.*; import gplx.core.brys.*;
public class Bfr_arg__decimal_int extends gplx.core.brys.Bfr_arg_base {
public int Val() {return val;} public Bfr_arg__decimal_int Val_(int v) {val = v; return this;} int val;
public Bfr_arg__decimal_int Places_(int v) {places = v; multiple = (int)Math_.Pow(10, v); return this;} int multiple = 1000, places = 3;
@Override public void Bfr_arg__add(Bry_bfr bfr) {
bfr.Add_int_variable(val / multiple).Add_byte(Byte_ascii.Dot).Add_int_fixed(val % multiple, places);
}
}

@ -15,13 +15,14 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.brys; import gplx.*;
public class Bry_fmtr_arg_ary_dim2 implements Bry_fmtr_arg {
public Bry_fmtr_arg_ary_dim2 Data_(byte[][] v) {ary_dim2 = v; return this;}
public Bry_fmtr_arg_ary_dim2 Ary_dim2_(byte[][] v) {this.ary_dim2 = v; return this;}
public void Fmt__do(Bry_bfr bfr) {
for (byte[] ary : ary_dim2)
bfr.Add(ary);
package gplx.core.brys.args; import gplx.*; import gplx.core.*; import gplx.core.brys.*;
public class Bfr_arg__int extends gplx.core.brys.Bfr_arg_base {
private int val, val_digits;
public Bfr_arg__int(int v) {Set(v);}
public Bfr_arg__int Set(int v) {
this.val = Int_.cast(v);
this.val_digits = Int_.DigitCount(val);
return this;
}
public Bry_fmtr_arg_ary_dim2() {} byte[][] ary_dim2 = new byte[0][];
@Override public void Bfr_arg__add(Bry_bfr bfr) {bfr.Add_int_digits(val_digits, val);}
}

@ -15,12 +15,12 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.brys; import gplx.*;
public class Bry_fmtr_arg_time implements Bry_fmtr_arg {
public Bry_fmtr_arg_time() {
package gplx.core.brys.args; import gplx.*; import gplx.core.*; import gplx.core.brys.*;
public class Bfr_arg__time extends gplx.core.brys.Bfr_arg_base {
public Bfr_arg__time() {
units_len = units.length;
}
public long Seconds() {return seconds;} public Bry_fmtr_arg_time Seconds_(long v) {seconds = v; return this;} long seconds;
public long Seconds() {return seconds;} public Bfr_arg__time Seconds_(long v) {seconds = v; return this;} long seconds;
byte[][] segs = new byte[][]
{ Bry_.new_a7("d")
, Bry_.new_a7("h")
@ -30,7 +30,7 @@ public class Bry_fmtr_arg_time implements Bry_fmtr_arg {
int[] units = new int[] {86400, 3600, 60, 1};
int units_len;
byte[] spr = new byte[] {Byte_ascii.Space};
public void Fmt__do(Bry_bfr bfr) {
@Override public void Bfr_arg__add(Bry_bfr bfr) {
if (seconds == 0) { // handle 0 separately (since it will always be < than units[*]
bfr.Add_int_fixed(0, 2).Add(segs[units_len - 1]);
return;

@ -15,9 +15,9 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.brys; import gplx.*;
package gplx.core.brys.args; import gplx.*; import gplx.core.*; import gplx.core.brys.*;
import org.junit.*;
public class Bry_fmtr_arg_time_tst {
public class Bfr_arg__time_tst {
@Test public void Basic() {
Time_fmtr_arg_fxt fxt = new Time_fmtr_arg_fxt().Clear();
fxt.XferAry( 1, "01s"); // seconds
@ -30,13 +30,13 @@ public class Bry_fmtr_arg_time_tst {
}
class Time_fmtr_arg_fxt {
public Time_fmtr_arg_fxt Clear() {
if (arg == null) arg = new Bry_fmtr_arg_time();
if (arg == null) arg = new Bfr_arg__time();
return this;
} Bry_fmtr_arg_time arg;
} Bfr_arg__time arg;
public void XferAry(int seconds, String expd) {
Bry_bfr bfr = Bry_bfr.reset_(255);
arg.Seconds_(seconds);
arg.Fmt__do(bfr);
arg.Bfr_arg__add(bfr);
Tfds.Eq(expd, bfr.To_str());
}
}

@ -15,8 +15,8 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
import gplx.core.primitives.*; import gplx.core.strings.*;
package gplx.core.brys.fmtrs; import gplx.*; import gplx.core.*; import gplx.core.brys.*;
import gplx.core.brys.*; import gplx.core.primitives.*; import gplx.core.strings.*;
public class Bry_fmtr {
public byte[] Fmt() {return fmt;} private byte[] fmt = Bry_.Empty;
public boolean Fmt_null() {return fmt.length == 0;}
@ -27,7 +27,7 @@ public class Bry_fmtr {
else keys.Clear();
int ary_len = ary.length;
for (int i = 0; i < ary_len; i++)
keys.Add(Bry_obj_ref.new_(Bry_.new_u8(ary[i])), Int_obj_val.new_(i));
keys.Add(Bry_obj_ref.New(Bry_.new_u8(ary[i])), Int_obj_val.new_(i));
dirty = true;
return this;
} Hash_adp keys = null;
@ -57,12 +57,12 @@ public class Bry_fmtr {
bfr.Add(itm.Dat);
}
}
public void Bld_bfr(Bry_bfr bfr, Bry_fmtr_arg... args) {
public void Bld_bfr(Bry_bfr bfr, Bfr_arg... args) {
if (dirty) Compile();
for (int i = 0; i < itms_len; i++) {
Bry_fmtr_itm itm = itms[i];
if (itm.Arg)
args[itm.ArgIdx].Fmt__do(bfr);
args[itm.ArgIdx].Bfr_arg__add(bfr);
else
bfr.Add(itm.Dat);
}
@ -137,7 +137,7 @@ public class Bry_fmtr {
list.Add(Bry_fmtr_itm.arg_(lkp_bfr.To_int(0) - baseInt));
else {
byte[] key_fmt = lkp_bfr.To_bry();
Object idx_ref = keys.Get_by(Bry_obj_ref.new_(key_fmt));
Object idx_ref = keys.Get_by(Bry_obj_ref.New(key_fmt));
if (idx_ref == null) {
int lkp_bfr_len = lkp_bfr.Len();
byte[] lkp_bry = lkp_bfr.Bfr();

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.brys.fmtrs; import gplx.*; import gplx.core.*; import gplx.core.brys.*;
public interface Bry_fmtr_eval_mgr {
boolean Enabled(); void Enabled_(boolean v);
byte[] Eval(byte[] cmd);

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.brys.fmtrs; import gplx.*; import gplx.core.*; import gplx.core.brys.*;
public class Bry_fmtr_eval_mgr_ {
public static Io_url Eval_url(Bry_fmtr_eval_mgr eval_mgr, byte[] fmt) {
if (eval_mgr == null) return Io_url_.new_any_(String_.new_u8(fmt));

@ -15,7 +15,8 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.brys.fmtrs; import gplx.*; import gplx.core.*; import gplx.core.brys.*;
import gplx.langs.gfs.*;
public class Bry_fmtr_eval_mgr_gfs implements Bry_fmtr_eval_mgr {
public boolean Enabled() {return enabled;} public void Enabled_(boolean v) {enabled = v;} private boolean enabled;
public byte[] Eval(byte[] cmd) {

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.brys.fmtrs; import gplx.*; import gplx.core.*; import gplx.core.brys.*;
public class Bry_fmtr_itm {
public boolean Arg;
public int ArgIdx;

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.brys.fmtrs; import gplx.*; import gplx.core.*; import gplx.core.brys.*;
import org.junit.*;
public class Bry_fmtr_tst {
@Test public void Idx_text() {tst_Format("a", "a");}

@ -15,12 +15,13 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
public class Bry_fmtr_vals implements Bry_fmtr_arg {
package gplx.core.brys.fmtrs; import gplx.*; import gplx.core.*; import gplx.core.brys.*;
import gplx.core.brys.*;
public class Bry_fmtr_vals extends gplx.core.brys.Bfr_arg_base {
private final Bry_fmtr fmtr; private Object[] vals;
Bry_fmtr_vals(Bry_fmtr fmtr) {this.fmtr = fmtr;}
public Bry_fmtr_vals Vals_(Object... v) {this.vals = v; return this;}
public void Fmt__do(Bry_bfr bfr) {
@Override public void Bfr_arg__add(Bry_bfr bfr) {
fmtr.Bld_bfr_ary(bfr, vals);
}
public static Bry_fmtr_vals new_fmt(String fmt, String... keys) {

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.gfo_ndes; import gplx.*; import gplx.core.*;
public class GfoFld {
public String Key() {return key;} private String key;
public ClassXtn Type() {return type;} ClassXtn type;

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.gfo_ndes; import gplx.*; import gplx.core.*;
public interface GfoFldList {
int Count();
boolean Has(String key);

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.gfo_ndes; import gplx.*; import gplx.core.*;
import gplx.core.strings.*;
public class GfoFldList_ {
public static final GfoFldList Null = new GfoFldList_null();

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.gfo_ndes; import gplx.*; import gplx.core.*;
import gplx.core.strings.*;
public class GfoNde implements GfoInvkAble {
public GfoFldList Flds() {return flds;} GfoFldList flds;

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.gfo_ndes; import gplx.*; import gplx.core.*;
public class GfoNdeFxt {
public GfoNde root_(GfoNde... subs) {return GfoNde_.root_(subs);}
public GfoNde tbl_(String name, GfoNde... rows) {return GfoNde_.tbl_(name, GfoFldList_.Null, rows);}

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.gfo_ndes; import gplx.*; import gplx.core.*;
import gplx.lists.*; /*ComparerAble*/
public interface GfoNdeList {
int Count();

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.gfo_ndes; import gplx.*; import gplx.core.*;
import gplx.lists.*; /*ComparerAble*/
public class GfoNdeList_ {
public static final GfoNdeList Null = new GfoNdeList_null();

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.gfo_ndes; import gplx.*; import gplx.core.*;
public class GfoNde_ {
public static final GfoNde[] Ary_empty = new GfoNde[0];
public static GfoNde[] ary_(GfoNde... ary) {return ary;}

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.gfo_regys; import gplx.*; import gplx.core.*;
public interface GfoMsgParser {
GfoMsg ParseToMsg(String s);
}

@ -15,7 +15,8 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.gfo_regys; import gplx.*; import gplx.core.*;
import gplx.langs.gfs.*;
public class GfoRegy implements GfoInvkAble {
public int Count() {return hash.Count();}
public Hash_adp Parsers() {return parsers;} Hash_adp parsers = Hash_adp_.new_();

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.gfo_regys; import gplx.*; import gplx.core.*;
public class GfoRegyItm {
public String Key() {return key;} private String key;
public Object Val() {return val;} Object val;

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.gfo_regys; import gplx.*; import gplx.core.*;
import org.junit.*;
public class GfoRegy_RegDir_tst {
@Before public void setup() {

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.gfo_regys; import gplx.*; import gplx.core.*;
import org.junit.*;
public class GfoRegy_basic_tst {
@Before public void setup() {

@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.core.ios; import gplx.*; import gplx.core.*;
import gplx.core.brys.fmtrs.*;
public class IoEngine_xrg_downloadFil {
public String Src() {return src;} public IoEngine_xrg_downloadFil Src_(String v) {src = v; return this;} private String src;
public Io_url Trg() {return trg;} public IoEngine_xrg_downloadFil Trg_(Io_url v) {trg = v; return this;} private Io_url trg;

@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.core.ios; import gplx.*; import gplx.core.*;
import gplx.langs.gfs.*;
public class IoItmFil extends IoItm_base {
@Override public int TypeId() {return IoItmFil.Type_Fil;} @Override public boolean Type_dir() {return false;} @Override public boolean Type_fil() {return true;} public static final int Type_Fil = 2;
public boolean Exists() {return size != Size_invalid;} // NOTE: questionable logic, but preserved for historical reasons; requires that length be set to -1 if !.exists

@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.core.ios; import gplx.*; import gplx.core.*;
import gplx.langs.gfs.*;
public abstract class IoItm_base implements GfoInvkAble, CompareAble {
public abstract int TypeId(); public abstract boolean Type_dir(); public abstract boolean Type_fil();
public Io_url Url() {return ownerDir == null ? url : ownerDir.Url().GenSubFil(name); /*NOTE: must call .Url*/} Io_url url;

@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.core.ios; import gplx.*; import gplx.core.*;
import gplx.langs.gfs.*;
public class IoUrlInfoRegy implements GfoInvkAble {
public void Reg(IoUrlInfo info) {hash.Add_if_dupe_use_nth(info.Key(), info);}
public IoUrlInfo Match(String raw) {

@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.core.ios; import gplx.*; import gplx.core.*;
import gplx.core.strings.*;
import gplx.core.strings.*; import gplx.langs.gfs.*;
public class IoUrlTypeRegy implements GfoInvkAble {
public String[] FetchAryOr(String key, String... or) {
IoUrlTypeGrp itm = (IoUrlTypeGrp)hash.Get_by(key);

@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.core.ios; import gplx.*; import gplx.core.*;
import gplx.stores.*; /*GfoNdeRdr_*/
import gplx.core.gfo_regys.*;
public class IoZipWkr {
public Io_url ExeUrl() {return (Io_url)GfoRegy.Instance.FetchValOrFail(Regy_ExeUrl);}
public String ExeArgFmt() {return (String)GfoRegy.Instance.FetchValOrFail(Regy_ExeArgFmt);}

@ -16,10 +16,10 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.core.ios; import gplx.*; import gplx.core.*;
import gplx.brys.*;
import gplx.core.brys.args.*; import gplx.core.brys.fmtrs.*;
public class Io_download_fmt {
private final Io_size_fmtr_arg size_fmtr_arg = new Io_size_fmtr_arg(), rate_fmtr_arg = new Io_size_fmtr_arg().Suffix_(Bry_.new_a7("ps"));
private final Bry_fmtr_arg_time prog_left_fmtr_arg = new Bry_fmtr_arg_time(); private final Bry_fmtr_arg_decimal_int prog_pct_fmtr_arg = new Bry_fmtr_arg_decimal_int().Places_(2);
private final Bfr_arg__time prog_left_fmtr_arg = new Bfr_arg__time(); private final Bfr_arg__decimal_int prog_pct_fmtr_arg = new Bfr_arg__decimal_int().Places_(2);
private long time_checkpoint_interval = 250;
private long time_checkpoint = 0;
private long time_prv = 0;

@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.core.ios; import gplx.*; import gplx.core.*;
import gplx.core.brys.*;
public class Io_size_ {
public static String To_str(long val) {
long cur = val; int pow = 0;
@ -98,10 +99,10 @@ public class Io_size_ {
return val == Int_.Min_value ? cur : (val * Io_mgr.Len_mb_long);
}
}
class Io_size_fmtr_arg implements Bry_fmtr_arg {
class Io_size_fmtr_arg extends gplx.core.brys.Bfr_arg_base {
public long Val() {return val;} public Io_size_fmtr_arg Val_(long v) {val = v; return this;} long val;
public byte[] Suffix() {return suffix;} public Io_size_fmtr_arg Suffix_(byte[] v) {suffix = v; return this;} private byte[] suffix;
public void Fmt__do(Bry_bfr bfr) {
@Override public void Bfr_arg__add(Bry_bfr bfr) {
long cur = val; int pow = 0;
while (cur >= 1024) {
cur /= 1024;

@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.core.log_msgs; import gplx.*; import gplx.core.*;
import gplx.core.brys.fmtrs.*;
public class Gfo_msg_itm implements Gfo_msg_obj {
public Gfo_msg_itm(Gfo_msg_grp owner, int uid, byte cmd, byte[] key_bry, byte[] fmt, boolean add_to_owner) {
this.owner = owner; this.uid = uid; this.cmd = cmd; this.key_bry = key_bry; this.fmt = fmt;

@ -16,20 +16,31 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.core.primitives; import gplx.*; import gplx.core.*;
public class Bry_obj_ref {
public byte[] Val() {return val;} public Bry_obj_ref Val_(byte[] v) {val = v; return this;} private byte[] val;
@Override public int hashCode() {return CalcHashCode(val, 0, val.length);}
@Override public boolean equals(Object obj) {return obj == null ? false : Bry_.Eq(val, ((Bry_obj_ref)obj).Val());} // NOTE: strange, but null check needed; throws null error; EX.WP: File:Eug<75>ne Delacroix - La libert<72> guidant le peuple.jpg
import gplx.core.brys.*;
public class Bry_obj_ref implements gplx.core.brys.Bfr_arg {
public byte[] Val() {return val;} private byte[] val;
public int Val_bgn() {return val_bgn;} private int val_bgn;
public int Val_end() {return val_end;} private int val_end;
public Bry_obj_ref Val_(byte[] val) {this.val = val; this.val_bgn = 0; this.val_end = val.length; return this;}
public Bry_obj_ref Mid_(byte[] val, int val_bgn, int val_end) {this.val = val; this.val_bgn = val_bgn; this.val_end = val_end; return this;}
@Override public int hashCode() {return CalcHashCode(val, val_bgn, val_end);}
@Override public boolean equals(Object obj) {
if (obj == null) return false; // NOTE: strange, but null check needed; throws null error; EX.WP: File:Eug<75>ne Delacroix - La libert<72> guidant le peuple.jpg
Bry_obj_ref comp = (Bry_obj_ref)obj;
return Bry_.Match(val, val_bgn, val_end, comp.val, comp.val_bgn, comp.val_end);
}
public void Bfr_arg__clear() {val = null;}
public boolean Bfr_arg__exists() {return val != null && val_end > val_bgn;}
public void Bfr_arg__add(Bry_bfr bfr) {
if (Bfr_arg__exists())
bfr.Add_mid(val, val_bgn, val_end);
}
public static int CalcHashCode(byte[] ary, int bgn, int end) {
int rv = 0;
for (int i = bgn; i < end; i++)
rv = (31 * rv) + ary[i];
return rv;
}
public static Bry_obj_ref null_() {return new_(null);}
public static Bry_obj_ref new_(byte[] val) {
Bry_obj_ref rv = new Bry_obj_ref();
rv.val = val;
return rv;
} private Bry_obj_ref() {}
public static Bry_obj_ref New_empty() {return New(Bry_.Empty);}
public static Bry_obj_ref New(byte[] val) {return new Bry_obj_ref().Val_(val);}
}

@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.langs.dsvs; import gplx.*; import gplx.langs.*;
import gplx.core.gfo_ndes.*;
public class DsvDataRdrOpts {
public boolean HasHeader() {return hasHeader;} public DsvDataRdrOpts HasHeader_(boolean val) {hasHeader = val; return this;} private boolean hasHeader = false;
public String NewLineSep() {return newLineSep;} public DsvDataRdrOpts NewLineSep_(String val) {newLineSep = val; return this;} private String newLineSep = String_.CrLf;

@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.langs.dsvs; import gplx.*; import gplx.langs.*;
import gplx.core.strings.*; import gplx.stores.*;
import gplx.core.strings.*; import gplx.core.gfo_ndes.*; import gplx.stores.*;
import gplx.core.texts.*; /*CharStream*/
public class DsvDataRdr_ {
public static DataRdr dsv_(String text) {return DsvParser.dsv_().ParseAsRdr(text);}

@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.langs.dsvs; import gplx.*; import gplx.langs.*;
import org.junit.*; import gplx.core.strings.*;
import org.junit.*; import gplx.core.strings.*; import gplx.core.gfo_ndes.*;
public class DsvDataRdr_csv_dat_tst {
@Before public void setup() {
fx.Parser_(DsvParser.csv_(false, GfoFldList_.Null));

@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.langs.dsvs; import gplx.*; import gplx.langs.*;
import org.junit.*;
import org.junit.*; import gplx.core.gfo_ndes.*;
public class DsvDataRdr_dsv_hdr_tst {
@Before public void setup() {fx.Clear();} DsvDataRdr_fxt fx = DsvDataRdr_fxt.new_();
@Test public void Names() {

@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.langs.dsvs; import gplx.*; import gplx.langs.*;
import org.junit.*;
import org.junit.*; import gplx.core.gfo_ndes.*;
public class DsvDataRdr_dsv_misc_tst {
@Before public void setup() {fx.Clear();} DsvDataRdr_fxt fx = DsvDataRdr_fxt.new_();
@Test public void CmdDlm_NearMatches() {

@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.langs.dsvs; import gplx.*; import gplx.langs.*;
import org.junit.*;
import org.junit.*; import gplx.core.gfo_ndes.*;
public class DsvDataRdr_layout_tst {
@Test public void TableName() {
run_parse_lines("table0, ,\" \",#");

@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.langs.dsvs; import gplx.*; import gplx.langs.*;
import gplx.core.strings.*;
import gplx.core.strings.*; import gplx.core.gfo_ndes.*;
public class DsvDataWtr extends DataWtr_base implements DataWtr {
public void InitWtr(String key, Object val) {
if (key == DsvStoreLayout.Key_const) layout = (DsvStoreLayout)val;

@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.langs.dsvs; import gplx.*; import gplx.langs.*;
import org.junit.*;
import org.junit.*; import gplx.core.gfo_ndes.*;
public class DsvDataWtr_csv_tst {
@Test public void Dat_Val_0() {
root = fx_nde.csv_dat_(); this.AddCsvRow(root);

@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.langs.dsvs; import gplx.*; import gplx.langs.*;
import org.junit.*;
import org.junit.*; import gplx.core.gfo_ndes.*;
public class DsvDataWtr_tbls_tst {
@Before public void setup() {
DsvStoreLayout layout = DsvStoreLayout.dsv_brief_();

@ -0,0 +1,90 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.langs.gfs; import gplx.*; import gplx.langs.*;
import gplx.core.gfo_regys.*;
public class GfsCore implements GfoInvkAble {
public GfoInvkAble Root() {return root;}
@gplx.Internal protected GfsRegy Root_as_regy() {return root;} GfsRegy root = GfsRegy.new_();
public void Clear() {root.Clear();}
public GfoMsgParser MsgParser() {return msgParser;} public GfsCore MsgParser_(GfoMsgParser v) {msgParser = v; return this;} GfoMsgParser msgParser;
public void Del(String key) {root.Del(key);}
public void AddLib(GfsLibIni... ary) {for (GfsLibIni itm : ary) itm.Ini(this);}
public void AddCmd(GfoInvkAble invk, String key) {root.AddCmd(invk, key);}
public void AddObj(GfoInvkAble invk, String key) {root.AddObj(invk, key);}
public void AddDeep(GfoInvkAble invk, String... ary) {
GfoInvkCmdMgrOwner cur = (GfoInvkCmdMgrOwner)((GfsRegyItm)root.Get_by(ary[0])).InvkAble();
for (int i = 1; i < ary.length - 1; i++)
cur = (GfoInvkCmdMgrOwner)cur.InvkMgr().Invk(GfsCtx.Instance, 0, ary[i], GfoMsg_.Null, cur);
cur.InvkMgr().Add_cmd(ary[ary.length - 1], invk);
}
public String FetchKey(GfoInvkAble invk) {return root.FetchByType(invk).Key();}
public Object ExecOne(GfsCtx ctx, GfoMsg msg) {return GfsCore_.Exec(ctx, root, msg, null, 0);}
public Object ExecOne_to(GfsCtx ctx, GfoInvkAble invk, GfoMsg msg) {return GfsCore_.Exec(ctx, invk, msg, null, 0);}
public Object ExecMany(GfsCtx ctx, GfoMsg rootMsg) {
Object rv = null;
for (int i = 0; i < rootMsg.Subs_count(); i++) {
GfoMsg subMsg = (GfoMsg)rootMsg.Subs_getAt(i);
rv = GfsCore_.Exec(ctx, root, subMsg, null, 0);
}
return rv;
}
public void ExecRegy(String key) {
GfoRegyItm itm = GfoRegy.Instance.FetchOrNull(key);
if (itm == null) {UsrDlg_.Instance.Warn(UsrMsg.new_("could not find script for key").Add("key", key)); return;}
Io_url url = itm.Url();
if (!Io_mgr.Instance.ExistsFil(url)) {
UsrDlg_.Instance.Warn(UsrMsg.new_("script url does not exist").Add("key", key).Add("url", url));
return;
}
this.ExecText(Io_mgr.Instance.LoadFilStr(url));
}
public Object ExecFile_ignoreMissing(Io_url url) {if (!Io_mgr.Instance.ExistsFil(url)) return null; return ExecText(Io_mgr.Instance.LoadFilStr(url));}
public Object ExecFile(Io_url url) {return ExecText(Io_mgr.Instance.LoadFilStr(url));}
public Object ExecFile_ignoreMissing(GfoInvkAble root, Io_url url) {
if (!Io_mgr.Instance.ExistsFil(url)) return null;
if (msgParser == null) throw Err_.new_wo_type("msgParser is null");
return Exec_bry(Io_mgr.Instance.LoadFilBry(url), root);
}
public Object Exec_bry(byte[] bry) {return Exec_bry(bry, root);}
public Object Exec_bry(byte[] bry, GfoInvkAble root) {
GfoMsg rootMsg = msgParser.ParseToMsg(String_.new_u8(bry));
Object rv = null;
GfsCtx ctx = GfsCtx.new_();
for (int i = 0; i < rootMsg.Subs_count(); i++) {
GfoMsg subMsg = (GfoMsg)rootMsg.Subs_getAt(i);
rv = GfsCore_.Exec(ctx, root, subMsg, null, 0);
}
return rv;
}
public Object ExecText(String text) {
if (msgParser == null) throw Err_.new_wo_type("msgParser is null");
GfsCtx ctx = GfsCtx.new_();
return ExecMany(ctx, msgParser.ParseToMsg(text));
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_ExecFil)) {
Io_url url = m.ReadIoUrl("url");
if (ctx.Deny()) return this;
return ExecFile(url);
}
else return GfoInvkAble_.Rv_unhandled;
// return this;
} public static final String Invk_ExecFil = "ExecFil";
public static final GfsCore Instance = new GfsCore();
@gplx.Internal protected static GfsCore new_() {return new GfsCore();}
}

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.langs.gfs; import gplx.*; import gplx.langs.*;
import gplx.core.strings.*;
class GfsCoreHelp implements GfoInvkAble {
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {

@ -15,79 +15,8 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
public class GfsCore implements GfoInvkAble {
public GfoInvkAble Root() {return root;}
@gplx.Internal protected GfsRegy Root_as_regy() {return root;} GfsRegy root = GfsRegy.new_();
public void Clear() {root.Clear();}
public GfoMsgParser MsgParser() {return msgParser;} public GfsCore MsgParser_(GfoMsgParser v) {msgParser = v; return this;} GfoMsgParser msgParser;
public void Del(String key) {root.Del(key);}
public void AddLib(GfsLibIni... ary) {for (GfsLibIni itm : ary) itm.Ini(this);}
public void AddCmd(GfoInvkAble invk, String key) {root.AddCmd(invk, key);}
public void AddObj(GfoInvkAble invk, String key) {root.AddObj(invk, key);}
public void AddDeep(GfoInvkAble invk, String... ary) {
GfoInvkCmdMgrOwner cur = (GfoInvkCmdMgrOwner)((GfsRegyItm)root.Get_by(ary[0])).InvkAble();
for (int i = 1; i < ary.length - 1; i++)
cur = (GfoInvkCmdMgrOwner)cur.InvkMgr().Invk(GfsCtx.Instance, 0, ary[i], GfoMsg_.Null, cur);
cur.InvkMgr().Add_cmd(ary[ary.length - 1], invk);
}
public String FetchKey(GfoInvkAble invk) {return root.FetchByType(invk).Key();}
public Object ExecOne(GfsCtx ctx, GfoMsg msg) {return GfsCore_.Exec(ctx, root, msg, null, 0);}
public Object ExecOne_to(GfsCtx ctx, GfoInvkAble invk, GfoMsg msg) {return GfsCore_.Exec(ctx, invk, msg, null, 0);}
public Object ExecMany(GfsCtx ctx, GfoMsg rootMsg) {
Object rv = null;
for (int i = 0; i < rootMsg.Subs_count(); i++) {
GfoMsg subMsg = (GfoMsg)rootMsg.Subs_getAt(i);
rv = GfsCore_.Exec(ctx, root, subMsg, null, 0);
}
return rv;
}
public void ExecRegy(String key) {
GfoRegyItm itm = GfoRegy.Instance.FetchOrNull(key);
if (itm == null) {UsrDlg_.Instance.Warn(UsrMsg.new_("could not find script for key").Add("key", key)); return;}
Io_url url = itm.Url();
if (!Io_mgr.Instance.ExistsFil(url)) {
UsrDlg_.Instance.Warn(UsrMsg.new_("script url does not exist").Add("key", key).Add("url", url));
return;
}
this.ExecText(Io_mgr.Instance.LoadFilStr(url));
}
public Object ExecFile_ignoreMissing(Io_url url) {if (!Io_mgr.Instance.ExistsFil(url)) return null; return ExecText(Io_mgr.Instance.LoadFilStr(url));}
public Object ExecFile(Io_url url) {return ExecText(Io_mgr.Instance.LoadFilStr(url));}
public Object ExecFile_ignoreMissing(GfoInvkAble root, Io_url url) {
if (!Io_mgr.Instance.ExistsFil(url)) return null;
if (msgParser == null) throw Err_.new_wo_type("msgParser is null");
return Exec_bry(Io_mgr.Instance.LoadFilBry(url), root);
}
public Object Exec_bry(byte[] bry) {return Exec_bry(bry, root);}
public Object Exec_bry(byte[] bry, GfoInvkAble root) {
GfoMsg rootMsg = msgParser.ParseToMsg(String_.new_u8(bry));
Object rv = null;
GfsCtx ctx = GfsCtx.new_();
for (int i = 0; i < rootMsg.Subs_count(); i++) {
GfoMsg subMsg = (GfoMsg)rootMsg.Subs_getAt(i);
rv = GfsCore_.Exec(ctx, root, subMsg, null, 0);
}
return rv;
}
public Object ExecText(String text) {
if (msgParser == null) throw Err_.new_wo_type("msgParser is null");
GfsCtx ctx = GfsCtx.new_();
return ExecMany(ctx, msgParser.ParseToMsg(text));
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_ExecFil)) {
Io_url url = m.ReadIoUrl("url");
if (ctx.Deny()) return this;
return ExecFile(url);
}
else return GfoInvkAble_.Rv_unhandled;
// return this;
} public static final String Invk_ExecFil = "ExecFil";
public static final GfsCore Instance = new GfsCore();
@gplx.Internal protected static GfsCore new_() {return new GfsCore();}
}
class GfsCore_ {
package gplx.langs.gfs; import gplx.*; import gplx.langs.*;
public class GfsCore_ {
public static final String Arg_primitive = "v";
public static Object Exec(GfsCtx ctx, GfoInvkAble owner_invk, GfoMsg owner_msg, Object owner_primitive, int depth) {
if (owner_msg.Args_count() == 0 && owner_msg.Subs_count() == 0 && String_.Eq(owner_msg.Key(), "")) {UsrDlg_.Instance.Warn("empty msg"); return GfoInvkAble_.Rv_unhandled;}

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.langs.gfs; import gplx.*; import gplx.langs.*;
import org.junit.*;
public class GfsCore_tst {
@Before public void setup() {

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.langs.gfs; import gplx.*; import gplx.langs.*;
public interface GfsLibIni {
void Ini(GfsCore core);
}

@ -15,7 +15,8 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.langs.gfs; import gplx.*; import gplx.langs.*;
import gplx.core.gfo_regys.*;
public class GfsLibIni_core implements GfsLibIni {
public void Ini(GfsCore core) {
core.AddCmd(GfsCoreHelp.new_(core), "help");

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.langs.gfs; import gplx.*; import gplx.langs.*;
class GfsRegy implements GfoInvkAble {
public int Count() {return hash.Count();}
public void Clear() {hash.Clear(); typeHash.Clear();}

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.langs.gfs; import gplx.*; import gplx.langs.*;
public class GfsTypeNames {
public static final String
String = "string"

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.langs.gfs; import gplx.*; import gplx.langs.*;
import org.junit.*;
public class Gfs_Date_tst {
@Before public void setup() {

@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
import java.lang.*;
import gplx.core.strings.*;
import gplx.core.strings.*; import gplx.langs.gfs.*;
public class String_ implements GfoInvkAble {
public static final Class<?> Cls_ref_type = String.class;
public static final String Cls_val_name = "str" + "ing";

@ -16,8 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
import gplx.core.primitives.*;
import gplx.core.encoders.*;
import gplx.core.primitives.*; import gplx.core.brys.*; import gplx.core.encoders.*;
public class Bry_bfr {
private Bry_bfr_mkr_mgr mkr_mgr; private int reset;
public byte[] Bfr() {return bfr;} private byte[] bfr;
@ -419,7 +418,7 @@ public class Bry_bfr {
else if (o_type == Boolean.class) Add_yn(Bool_.cast(o));
else if (o_type == Double.class) Add_double(Double_.cast(o));
else if (o_type == Float.class) Add_float(Float_.cast(o));
else ((Bry_fmtr_arg)o).Fmt__do(this);
else ((Bfr_arg)o).Bfr_arg__add(this);
return this;
}
public Bry_bfr Add_obj_strict(Object o) {
@ -436,7 +435,7 @@ public class Bry_bfr {
else if (o_type == Boolean.class) Add_bool(Bool_.cast(o));
else if (o_type == Double.class) Add_double(Double_.cast(o));
else if (o_type == Float.class) Add_float(Float_.cast(o));
else ((Bry_fmtr_arg)o).Fmt__do(this);
else ((Bfr_arg)o).Bfr_arg__add(this);
return this;
}
public Bry_bfr Add_yn(boolean v) {Add_byte(v ? Byte_ascii.Ltr_y : Byte_ascii.Ltr_n); return this;}
@ -556,7 +555,11 @@ public class Bry_bfr {
this.Mkr_rls();
}
@Override public int hashCode() {return Bry_obj_ref.CalcHashCode(bfr, 0, bfr_len);}
@Override public boolean equals(Object obj) {return obj == null ? false : Bry_.Match(bfr, 0, bfr_len, ((Bry_obj_ref)obj).Val());} // NOTE: strange, but null check needed; throws null error; PAGE:c:File:Eug<75>ne_Delacroix_-_La_libert<72>_guidant_le_peuple.jpg
@Override public boolean equals(Object obj) {
if (obj == null) return false; // NOTE: strange, but null check needed; throws null error; EX.WP: File:Eug<75>ne Delacroix - La libert<72> guidant le peuple.jpg
Bry_obj_ref comp = (Bry_obj_ref)obj;
return Bry_.Match(bfr, 0, bfr_len, comp.Val(), comp.Val_bgn(), comp.Val_end());
}
public void Resize(int v) {
bfr_max = v;
bfr = Bry_.Resize(bfr, 0, v);

@ -1,33 +0,0 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
import gplx.brys.*;
public class Bry_fmtr_arg_ {
public static Bry_fmtr_arg_bry bry_(String v) {return new Bry_fmtr_arg_bry(Bry_.new_u8(v));}
public static Bry_fmtr_arg_bry bry_(byte[] v) {return new Bry_fmtr_arg_bry(v);}
public static Bry_fmtr_arg_byt byt_(byte v) {return new Bry_fmtr_arg_byt(v);}
public static Bry_fmtr_arg_int int_(int v) {return new Bry_fmtr_arg_int(v);}
public static Bry_fmtr_arg_bfr bfr_(Bry_bfr v) {return new Bry_fmtr_arg_bfr(v);}
public static Bry_fmtr_arg_bfr_preserve bfr_retain_(Bry_bfr v) {return new Bry_fmtr_arg_bfr_preserve(v);}
public static Bry_fmtr_arg fmtr_(Bry_fmtr v, Bry_fmtr_arg... arg_ary) {return new Bry_fmtr_arg_fmtr(v, arg_ary);}
public static Bry_fmtr_arg_fmtr_objs fmtr_null_() {return new Bry_fmtr_arg_fmtr_objs(null, null);}
public static final Bry_fmtr_arg Noop = new Bry_fmtr_arg__noop();
}
class Bry_fmtr_arg__noop implements Bry_fmtr_arg {
public void Fmt__do(Bry_bfr bfr) {}
}

@ -1,23 +0,0 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.brys; import gplx.*;
public class Bry_fmtr_arg_fmtr implements Bry_fmtr_arg {
public Bry_fmtr_arg_fmtr Data_(Bry_fmtr v) {fmtr = v; return this;}
public void Fmt__do(Bry_bfr bfr) {fmtr.Bld_bfr(bfr, arg_ary);}
public Bry_fmtr_arg_fmtr(Bry_fmtr fmtr, Bry_fmtr_arg... arg_ary) {this.fmtr = fmtr; this.arg_ary = arg_ary;} Bry_fmtr fmtr; Bry_fmtr_arg[] arg_ary;
}

@ -1,23 +0,0 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.brys; import gplx.*;
public class Bry_fmtr_arg_int implements Bry_fmtr_arg {
public Bry_fmtr_arg_int Data_(int v) {val = Int_.cast(v); val_digits = Int_.DigitCount(val); return this;}
public void Fmt__do(Bry_bfr bfr) {bfr.Add_int_fixed(val, val_digits);}
public Bry_fmtr_arg_int(int v) {this.val = v; this.val_digits = Int_.DigitCount(v);} int val, val_digits;
}

@ -22,8 +22,8 @@ public class Ordered_hash_ {
public static Ordered_hash New_bry() {return new Ordered_hash_bry();}
}
class Ordered_hash_bry extends Ordered_hash_base {
private final Bry_obj_ref tmp_ref = Bry_obj_ref.null_();
@Override protected void Add_base(Object key, Object val) {super.Add_base(Bry_obj_ref.new_((byte[])key), val);}
private final Bry_obj_ref tmp_ref = Bry_obj_ref.New_empty();
@Override protected void Add_base(Object key, Object val) {super.Add_base(Bry_obj_ref.New((byte[])key), val);}
@Override protected void Del_base(Object key) {synchronized (tmp_ref) {super.Del_base(tmp_ref.Val_((byte[])key));}}
@Override protected boolean Has_base(Object key) {synchronized (tmp_ref) {return super.Has_base(tmp_ref.Val_((byte[])key));}}
@Override protected Object Fetch_base(Object key) {synchronized (tmp_ref) {return super.Fetch_base(tmp_ref.Val_((byte[])key));}}

@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
import gplx.langs.gfs.*;
public class GfoInvkXtoStr {
public static GfoMsg ReadMsg(GfoInvkAble invk, String k) {
GfsCtx ctx = GfsCtx.wtr_();

@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
import org.junit.*;
import org.junit.*; import gplx.langs.gfs.*;
public class GfoMsg_tst {
@Before public void setup() {
GfsCore.Instance.AddObj(new Mok(), "Mok");

@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
import gplx.core.gfo_ndes.*;
public interface DataWtr extends SrlMgr {
Hash_adp EnvVars();

@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
import gplx.stores.*; /*DsvDataWtr_*/
import gplx.stores.*; /*DsvDataWtr_*/ import gplx.core.gfo_ndes.*;
public class DataWtr_ {
public static final DataWtr Null = new DataWtr_null();
}

@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.stores; import gplx.*;
import gplx.core.gfo_ndes.*;
public class DataRdr_mem extends DataRdr_base implements GfoNdeRdr {
@Override public String NameOfNode() {return cur.Name();}
public GfoNde UnderNde() {return cur;}

@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.stores; import gplx.*;
import gplx.core.gfo_ndes.*;
public interface GfoNdeRdr extends DataRdr {
GfoNde UnderNde();
}

@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.stores; import gplx.*;
import gplx.core.gfo_ndes.*;
public class GfoNdeRdr_ {
public static GfoNdeRdr kvs_(KeyValList kvList) {
GfoFldList flds = GfoFldList_.new_();

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save