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

uca category support and other changes

This commit is contained in:
gnosygnu
2016-10-12 08:57:22 -04:00
parent e3b393650d
commit 3fc2e0741f
187 changed files with 3486 additions and 2984 deletions

View File

@@ -30,24 +30,24 @@ public class Xotdb_dir_info {
ext_bry = Wtr_ext(v);
ext_str = String_.new_a7(ext_bry);
return this;
} byte ext_tid = gplx.core.ios.streams.Io_stream_.Tid_raw;
} byte ext_tid = gplx.core.ios.streams.Io_stream_tid_.Tid__raw;
public static final String Wtr_xdat_str = ".xdat", Wtr_zip_str = ".zip", Wtr_gz_str = ".gz", Wtr_bz2_str = ".bz2";
public static final byte[] Wtr_xdat_bry = Bry_.new_a7(Wtr_xdat_str), Wtr_zip_bry = Bry_.new_a7(Wtr_zip_str), Wtr_gz_bry = Bry_.new_a7(Wtr_gz_str), Wtr_bz2_bry = Bry_.new_a7(Wtr_bz2_str);
public static String Wtr_dir(byte v) {
switch (v) {
case gplx.core.ios.streams.Io_stream_.Tid_raw : return "";
case gplx.core.ios.streams.Io_stream_.Tid_zip : return "_zip";
case gplx.core.ios.streams.Io_stream_.Tid_gzip : return "_gz";
case gplx.core.ios.streams.Io_stream_.Tid_bzip2 : return "_bz2";
case gplx.core.ios.streams.Io_stream_tid_.Tid__raw : return "";
case gplx.core.ios.streams.Io_stream_tid_.Tid__zip : return "_zip";
case gplx.core.ios.streams.Io_stream_tid_.Tid__gzip : return "_gz";
case gplx.core.ios.streams.Io_stream_tid_.Tid__bzip2 : return "_bz2";
default : throw Err_.new_unhandled(v);
}
}
public static byte[] Wtr_ext(byte v) {
switch (v) {
case gplx.core.ios.streams.Io_stream_.Tid_raw : return Wtr_xdat_bry;
case gplx.core.ios.streams.Io_stream_.Tid_zip : return Wtr_zip_bry;
case gplx.core.ios.streams.Io_stream_.Tid_gzip : return Wtr_gz_bry;
case gplx.core.ios.streams.Io_stream_.Tid_bzip2 : return Wtr_bz2_bry;
case gplx.core.ios.streams.Io_stream_tid_.Tid__raw : return Wtr_xdat_bry;
case gplx.core.ios.streams.Io_stream_tid_.Tid__zip : return Wtr_zip_bry;
case gplx.core.ios.streams.Io_stream_tid_.Tid__gzip : return Wtr_gz_bry;
case gplx.core.ios.streams.Io_stream_tid_.Tid__bzip2 : return Wtr_bz2_bry;
default : throw Err_.new_unhandled(v);
}
}

View File

@@ -56,14 +56,14 @@ public class Xotdb_fsys_mgr {
private static void Scan_dirs_zip(Xotdb_fsys_mgr fsys_mgr, byte id) {
Io_url[] dirs = Io_mgr.Instance.QueryDir_args(fsys_mgr.Ns_dir().GenSubDir_nest("000")).FilPath_("*page*").DirOnly_().Recur_(false).ExecAsUrlAry();
int len = dirs.length;
byte tid = gplx.core.ios.streams.Io_stream_.Tid_raw; // needed for Xoa_xowa_exec_tst
byte tid = gplx.core.ios.streams.Io_stream_tid_.Tid__raw; // needed for Xoa_xowa_exec_tst
for (int i = 0; i < len; i++) {
Io_url dir = dirs[i];
String dir_name = dir.NameOnly();
if (String_.Eq(dir_name, "page")) {tid = gplx.core.ios.streams.Io_stream_.Tid_raw; break;}
else if (String_.Eq(dir_name, "page_zip")) tid = gplx.core.ios.streams.Io_stream_.Tid_zip;
else if (String_.Eq(dir_name, "page_gz")) tid = gplx.core.ios.streams.Io_stream_.Tid_gzip;
else if (String_.Eq(dir_name, "page_bz2")) tid = gplx.core.ios.streams.Io_stream_.Tid_bzip2;
if (String_.Eq(dir_name, "page")) {tid = gplx.core.ios.streams.Io_stream_tid_.Tid__raw; break;}
else if (String_.Eq(dir_name, "page_zip")) tid = gplx.core.ios.streams.Io_stream_tid_.Tid__zip;
else if (String_.Eq(dir_name, "page_gz")) tid = gplx.core.ios.streams.Io_stream_tid_.Tid__gzip;
else if (String_.Eq(dir_name, "page_bz2")) tid = gplx.core.ios.streams.Io_stream_tid_.Tid__bzip2;
}
fsys_mgr.Tdb_dir_regy()[id].Ext_tid_(tid);
}

View File

@@ -31,7 +31,7 @@ class Xow_fsys_mgr_fxt {
wiki = Xoa_app_fxt.Make__wiki__edit(app);
}
Xoae_app app; Xowe_wiki wiki;
public Xow_fsys_mgr_fxt Zip_(byte tid, boolean v) {wiki.Tdb_fsys_mgr().Tdb_dir_regy()[tid].Ext_tid_(v ? gplx.core.ios.streams.Io_stream_.Tid_zip : gplx.core.ios.streams.Io_stream_.Tid_raw); return this;}
public Xow_fsys_mgr_fxt Zip_(byte tid, boolean v) {wiki.Tdb_fsys_mgr().Tdb_dir_regy()[tid].Ext_tid_(v ? gplx.core.ios.streams.Io_stream_tid_.Tid__zip : gplx.core.ios.streams.Io_stream_tid_.Tid__raw); return this;}
public void Url_ns_fil(byte tid, int ns_id, int fil_idx, String expd) {
Tfds.Eq(expd, wiki.Tdb_fsys_mgr().Url_ns_fil(tid, ns_id, fil_idx).Raw());
}

View File

@@ -37,7 +37,7 @@ public class Xob_hive_mgr {
}
Xob_xdat_file xdat_load_(Xob_xdat_file xdat, byte dir_tid, Xow_ns ns, int fil_idx) {
Io_url xdat_url = fsys_mgr.Url_ns_fil(dir_tid, ns.Id(), fil_idx);
byte[] xdat_bry = gplx.core.ios.streams.Io_stream_rdr_.Load_all(xdat_url);
byte[] xdat_bry = Io_mgr.Instance.LoadFilBry(xdat_url);
xdat.Parse(xdat_bry, xdat_bry.length, xdat_url);
return xdat;
}
@@ -115,7 +115,7 @@ public class Xob_hive_mgr {
byte dir_tid = Xotdb_dir_info_.Tid_ttl;
int xdat_idx = Regy__find_file_ns(key, dir_tid, ns.Num_str());
Io_url xdat_url = fsys_mgr.Url_ns_fil(dir_tid, ns.Id(), xdat_idx);
byte[] xdat_bry = gplx.core.ios.streams.Io_stream_rdr_.Load_all(xdat_url);
byte[] xdat_bry = Io_mgr.Instance.LoadFilBry(xdat_url);
xdat.Parse(xdat_bry, xdat_bry.length, xdat_url);
xdat.Find(xdat_itm, key, Xotdb_page_itm_.Txt_ttl_pos, Byte_ascii.Tab, false);
Find_nearby_add_fwd(list, dir_tid, ns, include_redirects, count, xdat_idx, xdat_itm.Itm_idx());
@@ -132,7 +132,7 @@ public class Xob_hive_mgr {
// while (loop) {
// if (fil_idx == -1) break;
// Io_url xdat_url = fsys_mgr.Url_ns_fil(dir_tid, ns.Id(), fil_idx);
// byte[] xdat_bry = gplx.core.ios.streams.Io_stream_rdr_.Load_all(xdat_url);
// byte[] xdat_bry = Io_mgr.Instance.LoadFilBry(xdat_url);
// xdat.Parse(xdat_bry, xdat_bry.length, xdat_url);
// int row_idx = first && row_bgn != -1 ? row_bgn : xdat.Count() - 1;
// first = false;
@@ -155,7 +155,7 @@ public class Xob_hive_mgr {
while (loop) {
if (fil_idx == regy_len) break;
Io_url xdat_url = fsys_mgr.Url_ns_fil(dir_tid, ns.Id(), fil_idx);
byte[] xdat_bry = gplx.core.ios.streams.Io_stream_rdr_.Load_all(xdat_url);
byte[] xdat_bry = Io_mgr.Instance.LoadFilBry(xdat_url);
xdat.Parse(xdat_bry, xdat_bry.length, xdat_url);
int row_idx = first ? row_bgn : 0;
int rows_len = xdat.Count();
@@ -186,7 +186,7 @@ public class Xob_hive_mgr {
int Regy__find_file_by_url(byte[] key, Io_url regy_url) {regy.Init(regy_url); return regy.Files_find(key);} private Xowd_regy_mgr regy = new Xowd_regy_mgr();
private void Xdat__create_row(byte dir_tid, byte[] key, byte[] row, int xdat_idx) {
Io_url xdat_url = fsys_mgr.Url_site_fil(dir_tid, xdat_idx);
byte[] xdat_bry = gplx.core.ios.streams.Io_stream_rdr_.Load_all(xdat_url);
byte[] xdat_bry = Io_mgr.Instance.LoadFilBry(xdat_url);
Xob_xdat_file xdat_fil = new Xob_xdat_file();
if (xdat_bry.length > 0) // if file is not empty, load it and parse it
xdat_fil.Parse(xdat_bry, xdat_bry.length, xdat_url);

View File

@@ -103,7 +103,7 @@ public class Xob_xdat_file {
public void Save(Io_url url) {
Bry_bfr bfr = Bry_bfr_.New();
Srl_save_bry(bfr);
Io_stream_wtr wtr = Io_stream_wtr_.new_by_url_(url);
Io_stream_wtr wtr = Io_stream_wtr_.New_by_url(url);
try {
wtr.Open();
wtr.Write(bfr.Bfr(), 0, bfr.Len());

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.wikis.tdbs.xdats; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*; import gplx.xowa.wikis.tdbs.*;
import gplx.core.ios.*; import gplx.core.ios.streams.*; import gplx.core.encoders.*; import gplx.xowa.wikis.tdbs.*;
public class Xob_xdat_file_wtr {
public static Xob_xdat_file_wtr new_file_(int fil_max, Io_url root_dir) {return new Xob_xdat_file_wtr(fil_max, root_dir, Io_stream_.Tid_raw);}
public static Xob_xdat_file_wtr new_file_(int fil_max, Io_url root_dir) {return new Xob_xdat_file_wtr(fil_max, root_dir, Io_stream_tid_.Tid__raw);}
public static Xob_xdat_file_wtr new_by_tid_(int fil_max, Io_url root_dir, byte dir_tid, byte tid) {return new Xob_xdat_file_wtr(fil_max, root_dir.GenSubDir(Xotdb_dir_info_.Tid_name(dir_tid) + Xotdb_dir_info.Wtr_dir(tid)), tid);}
Xob_xdat_file_wtr(int fil_max, Io_url root_dir, byte wtr_tid) {
this.fil_max = fil_max;
@@ -27,7 +27,7 @@ public class Xob_xdat_file_wtr {
bfr = Bry_bfr_.New_w_size(fil_max);
idx = new int[fil_max / 8]; // ASSUME: any given row must at least be 8 bytes long
Url_gen(fil_idx); // set 1st url
wtr = Io_stream_wtr_.new_by_tid_(wtr_tid);
wtr = Io_stream_wtr_.New_by_tid(wtr_tid);
} int fil_max; Io_stream_wtr wtr; byte[] fil_ext;
public int Fil_idx() {return fil_idx;} public Xob_xdat_file_wtr Fil_idx_(int v) {fil_idx = v; return this;} private int fil_idx;
public int Ns_ord_idx() {return ns_ord_idx;} public Xob_xdat_file_wtr Ns_ord_idx_(int v) {ns_ord_idx = v; return this;} private int ns_ord_idx; // NOTE: optional; needed for page cmd which will flush all wtrs, but needs ns_idx for stats