1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

v2.11.3.1

This commit is contained in:
gnosygnu
2015-11-15 21:08:17 -05:00
parent d9f45cec19
commit 8a5d58a973
418 changed files with 2694 additions and 1621 deletions

View File

@@ -24,11 +24,10 @@ public class Bry_rdr {
public int Src_end() {return src_end;} private int src_end;
public Bry_rdr Dflt_dlm_(byte b) {this.dflt_dlm = b; return this;} private byte dflt_dlm;
public Bry_rdr Fail_throws_err_(boolean v) {this.fail_throws_err = v; return this;} private boolean fail_throws_err = true;
public Bry_rdr Ctor_by_page(byte[] ctx, byte[] src, int src_len) {this.ctx = Quote(String_.new_u8(ctx)); this.src = src; this.src_end = src_len; this.pos = 0; return this;}
public Bry_rdr Init_by_page(byte[] ctx, byte[] src, int src_len) {this.ctx = Quote(String_.new_u8(ctx)); this.src = src; this.src_end = src_len; this.pos = 0; return this;}
public Bry_rdr Init_by_hook(String wkr, int err_bgn, int pos) {this.wkr = Quote(wkr); this.err_bgn = err_bgn; this.pos = pos; return this;}
public Bry_rdr Init_by_sub(Bry_rdr rdr, String wkr, int pos, int src_end) {
this.src = rdr.src; this.ctx = rdr.ctx; this.wkr = Quote(wkr); this.err_bgn = pos; this.pos = pos; this.src_end = src_end;
this.dflt_dlm = Byte_ascii.Null;
return this;
}
public int Move_to(int v) {this.pos = v; return pos;}
@@ -157,15 +156,15 @@ public class Bry_rdr {
arg_val = Quote(Object_.Xto_str_strict_or_null_mark(arg_val));
String err_msg = Msg_make(msg, arg_key, arg_val, excerpt_bgn, excerpt_end);
Gfo_usr_dlg_.Instance.Warn_many("", "", err_msg);
if (fail_throws_err) throw Err_.new_("Bry_rdr", err_msg);
if (fail_throws_err) throw Err_.new_("Bry_rdr", err_msg).Logged_y_();
return Bry_find_.Not_found;
}
public Err Err_make(String msg, String arg_key, Object arg_val, int excerpt_bgn, int excerpt_end) {return Err_.new_("Bry_rdr", Msg_make(msg, arg_key, arg_val, excerpt_bgn, excerpt_end));}
private String Msg_make(String msg, String arg_key, Object arg_val, int excerpt_bgn, int excerpt_end) {
if (String_.EqEmpty(arg_key))
return Err_msg.To_str(msg, "ctx", ctx, "wkr", wkr, "excerpt", Bry_.Mid_safe(src, excerpt_bgn, excerpt_end));
return String_.Replace(Err_msg.To_str(msg, "ctx", ctx, "wkr", wkr, "excerpt", Bry_.Mid_safe(src, excerpt_bgn, excerpt_end)), "\n", "\\n");
else
return Err_msg.To_str(msg, arg_key, arg_val, "ctx", ctx, "wkr", wkr, "excerpt", Quote(String_.new_u8(Bry_.Mid_by_len_safe(src, excerpt_bgn, excerpt_end))));
return String_.Replace(Err_msg.To_str(msg, arg_key, arg_val, "ctx", ctx, "wkr", wkr, "excerpt", Quote(String_.new_u8(Bry_.Mid_safe(src, excerpt_bgn, excerpt_end)))), "\n", "\\n");
}
private static String Quote(String v) {return "'" + v + "'";}
}

View File

@@ -0,0 +1,21 @@
/*
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.*;
public interface Clear_able {
void Clear();
}

View File

@@ -24,6 +24,12 @@ public class Int_flag_bldr {
this.val_ary = new int[pow_ary.length];
return this;
}
public int Encode() {return Int_flag_bldr_.To_int(pow_ary, val_ary);}
public void Decode(int v) {Int_flag_bldr_.To_int_ary(val_ary, pow_ary, v);}
public Int_flag_bldr Set(int idx, int val) {val_ary[idx] = val; return this;}
public Int_flag_bldr Set(int idx, byte val) {val_ary[idx] = val; return this;}
public Int_flag_bldr Set(int idx, boolean val) {val_ary[idx] = val ? 1 : 0; return this;}
public int Get_as_int(int idx) {return val_ary[idx];}
public byte Get_as_byte(int idx) {return (byte)val_ary[idx];}
public boolean Get_as_bool(int idx) {return val_ary[idx] == 1;}
public int Encode() {return Int_flag_bldr_.To_int(pow_ary, val_ary);}
public void Decode(int v) {Int_flag_bldr_.To_int_ary(val_ary, pow_ary, v);}
}

View File

@@ -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; import gplx.*; import gplx.core.*;
public interface Mid_able {
byte[] Mid__src();
int Mid__bgn();
int Mid__end();
}

View File

@@ -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.intls; import gplx.*; import gplx.core.*;
import gplx.core.brys.fmtrs.*;
class Gfo_i18n_itm {
public Gfo_i18n_itm(int src, byte[] key, byte[] val, boolean val_fmt_exists, Gfo_i18n_val_cmd val_cmd) {
this.src = src; this.key = key; this.val = val; this.val_fmt_exists = val_fmt_exists; this.val_cmd = val_cmd;

View File

@@ -16,19 +16,20 @@ 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.*;
import gplx.core.brys.*;
public class Bry_cache {
private final Hash_adp hash = Hash_adp_.new_(); private final Bry_obj_ref hash_ref = Bry_obj_ref.New_empty();
public byte[] Get_or_new(String v) {return Get_or_new(Bry_.new_u8(v));}
public byte[] Get_or_new(byte[] v) {
if (v.length == 0) return Bry_.Empty;
Object rv = hash.Get_by(hash_ref.Val_(v));
if (rv == null) {
Bry_obj_ref bry = Bry_obj_ref.new_(v);
Bry_obj_ref bry = Bry_obj_ref.New(v);
hash.Add_as_key_and_val(bry);
return v;
}
else
return ((Bry_obj_ref)rv).Val();
}
Hash_adp hash = Hash_adp_.new_(); Bry_obj_ref hash_ref = Bry_obj_ref.null_();
public static final Bry_cache Instance = new Bry_cache(); Bry_cache() {}
}

View File

@@ -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.threads; import gplx.*; import gplx.core.*;
import gplx.core.brys.fmtrs.*;
import gplx.gfui.*;
public class Gfo_thread_cmd_base implements Gfo_thread_cmd {
@gplx.Virtual public String Async_key() {return "undefined";}

View File

@@ -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.threads; import gplx.*; import gplx.core.*;
import gplx.core.brys.fmtrs.*;
import gplx.gfui.*;
public class Gfo_thread_cmd_download implements Gfo_thread_cmd {
public Gfo_thread_cmd Ctor(Gfo_usr_dlg usr_dlg, Gfui_kit kit) {this.usr_dlg = usr_dlg; this.kit = kit; xrg.Prog_dlg_(usr_dlg); return this;}

View File

@@ -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.threads; import gplx.*; import gplx.core.*;
import gplx.core.brys.fmtrs.*;
import gplx.gfui.*;
public class Gfo_thread_cmd_replace implements Gfo_thread_cmd {
public Gfo_thread_cmd Init(Gfo_usr_dlg usr_dlg, Gfui_kit kit, Io_url fil) {

View File

@@ -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.threads; import gplx.*; import gplx.core.*;
import gplx.core.brys.fmtrs.*;
import gplx.gfui.*; import gplx.xowa.bldrs.cmds.utils.*;
public class Gfo_thread_cmd_unzip implements Gfo_thread_cmd {
public Gfo_thread_cmd_unzip Init(Gfo_usr_dlg usr_dlg, Gfui_kit kit, ProcessAdp bzip2_process, ProcessAdp zip_process, ProcessAdp gz_process, Io_url src, Io_url trg) {

View File

@@ -19,5 +19,6 @@ package gplx.core.threads.poolables; import gplx.*; import gplx.core.*; import g
public interface Gfo_poolable_itm {
int Pool__idx();
void Pool__clear (Object[] args);
Gfo_poolable_itm Pool__make (int idx, Object[] args);
Gfo_poolable_itm Pool__make (Gfo_poolable_mgr mgr, int idx, Object[] args);
void Pool__rls();
}

View File

@@ -29,7 +29,7 @@ public class Gfo_poolable_mgr {
public void Clear_fast() {
this.pool = new Gfo_poolable_itm[pool_len];
for (int i = 0; i < pool_len; ++i)
pool[i] = prototype.Pool__make(i, make_args);
pool[i] = prototype.Pool__make(this, i, make_args);
this.free_ary = new int[pool_len];
pool_nxt = free_len = 0;
}
@@ -47,7 +47,7 @@ public class Gfo_poolable_mgr {
pool_idx = pool_nxt++;
rv = pool[pool_idx];
if (rv == null) {
rv = prototype.Pool__make(pool_idx, make_args);
rv = prototype.Pool__make(this, pool_idx, make_args);
pool[pool_idx] = rv;
}
}

View File

@@ -0,0 +1,21 @@
/*
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.threads.poolables; import gplx.*; import gplx.core.*; import gplx.core.threads.*;
public class Gfo_poolable_mgr_ {
public static Gfo_poolable_mgr New(int len, int max, Gfo_poolable_itm prototype) {return new Gfo_poolable_mgr(prototype, Object_.Ary_empty, Object_.Ary_empty, len, max);}
}

View File

@@ -61,7 +61,7 @@ public class Gfo_poolable_mgr_tst {
}
}
class Gfo_poolable_mgr_tstr {
private final Gfo_poolable_mgr mgr = new Gfo_poolable_mgr(new Sample_poolable_itm(-1, Object_.Ary_empty), Object_.Ary("make"), Object_.Ary("clear"), 2, 8);
private final Gfo_poolable_mgr mgr = new Gfo_poolable_mgr(new Sample_poolable_itm(null, -1, Object_.Ary_empty), Object_.Ary("make"), Object_.Ary("clear"), 2, 8);
public void Clear() {mgr.Clear_fast();}
public void Test__get(int expd_idx) {
Sample_poolable_itm actl_itm = (Sample_poolable_itm)mgr.Get_fast();
@@ -74,10 +74,12 @@ class Gfo_poolable_mgr_tstr {
public void Exec__rls(int idx) {mgr.Rls_fast(idx);}
}
class Sample_poolable_itm implements Gfo_poolable_itm {
public Sample_poolable_itm(int pool_idx, Object[] make_args) {this.pool_idx = pool_idx; this.pool__make_args = make_args;}
private Gfo_poolable_mgr pool_mgr;
public Sample_poolable_itm(Gfo_poolable_mgr pool_mgr, int pool_idx, Object[] make_args) {this.pool_mgr = pool_mgr; this.pool_idx = pool_idx; this.pool__make_args = make_args;}
public int Pool__idx() {return pool_idx;} private final int pool_idx;
public Object[] Pool__make_args() {return pool__make_args;} private final Object[] pool__make_args;
public Object[] Pool__clear_args() {return pool__clear_args;} private Object[] pool__clear_args;
public void Pool__clear (Object[] args) {this.pool__clear_args = args;}
public Gfo_poolable_itm Pool__make (int idx, Object[] args) {return new Sample_poolable_itm(idx, args);}
public void Pool__rls() {pool_mgr.Rls_safe(pool_idx);}
public Gfo_poolable_itm Pool__make (Gfo_poolable_mgr mgr, int idx, Object[] args) {return new Sample_poolable_itm(pool_mgr, idx, args);}
}