1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00
This commit is contained in:
gnosygnu
2015-09-13 21:54:44 -04:00
parent 2145f6382c
commit 5fe27b5b3b
649 changed files with 4726 additions and 3432 deletions

View File

@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.langs; import gplx.*; import gplx.xowa.*;
import gplx.intl.*;
import gplx.xowa.apps.fsys.*; import gplx.xowa.bldrs.langs.*; import gplx.xowa.langs.vnts.*;
import gplx.xowa.apps.fsys.*; import gplx.xowa.apps.langs.*; import gplx.xowa.bldrs.langs.*; import gplx.xowa.langs.vnts.*;
public class Xoa_lang_mgr implements GfoInvkAble {
private final Xoa_fsys_mgr fsys_mgr; private final Gfo_msg_log msg_log; private final Xol_lang lang_en;
private final Ordered_hash hash = Ordered_hash_.new_bry_(); private final Hash_adp_bry fallback_regy = Hash_adp_bry.cs();

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.xowa.langs; import gplx.*; import gplx.xowa.*;
import gplx.xowa.parsers.tmpls.*;
public class Xol_func_name_itm {
public byte Tid() {return tid;} private byte tid = Xot_defn_.Tid_null;
public Xot_defn Func() {return func;} private Xot_defn func = Xot_defn_.Null;

View File

@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.langs; import gplx.*; import gplx.xowa.*;
import gplx.core.btries.*; import gplx.intl.*; import gplx.xowa.xtns.pfuncs.*;
import gplx.xowa.parsers.tmpls.*;
public class Xol_func_name_regy {
private final Xoa_lang_mgr lang_mgr; private final Xol_lang lang;
private final Xol_func_name_itm finder = new Xol_func_name_itm();

View File

@@ -38,6 +38,7 @@ class Xol_case_itm_byt implements Xol_case_itm {
}
}
public byte Tid() {return tid;} private byte tid;
public boolean Is_single_byte() {return true;}
public byte[] Src_ary() {return src_ary;} private byte[] src_ary;
public byte[] Trg_ary() {return trg_ary;} private byte[] trg_ary;
public byte Src_byte() {return src_byte;} private byte src_byte;
@@ -47,11 +48,7 @@ class Xol_case_itm_byt implements Xol_case_itm {
public void Case_reuse_upper(byte[] ary, int bgn, int len) {ary[bgn] = upper_byte;}
public void Case_reuse_lower(byte[] ary, int bgn, int len) {ary[bgn] = lower_byte;}
public Xol_case_itm Clone() {return new Xol_case_itm_byt(tid, src_byte, trg_byte);}
public int Utf8_id_lower() {return lower_byte;}
public boolean Eq_lo(Gfo_case_itm trg_obj) {
Xol_case_itm_byt trg_itm = (Xol_case_itm_byt)trg_obj;
return lower_byte == trg_itm.lower_byte;
}
public int Utf8_id_lo() {return lower_byte;}
public int Hashcode_lo() {return lower_byte;}
public int Len_lo() {return 1;}
public byte[] Asymmetric_bry() {return null;}
@@ -69,6 +66,7 @@ class Xol_case_itm_bry implements Xol_case_itm {
hashcode_ci_lo = Bry_obj_ref.CalcHashCode(lower_ary, 0, len_lo);
}
public byte Tid() {return tid;} public Xol_case_itm_bry Tid_(byte v) {tid = v; return this;} private byte tid;
public boolean Is_single_byte() {return false;}
public byte[] Src_ary() {return src_ary;} private byte[] src_ary;
public byte[] Trg_ary() {return trg_ary;} private byte[] trg_ary;
public void Case_build_upper(Bry_bfr bfr) {bfr.Add(upper_ary);} private byte[] upper_ary;
@@ -84,10 +82,6 @@ class Xol_case_itm_bry implements Xol_case_itm {
public Xol_case_itm Clone() {return new Xol_case_itm_bry(tid, src_ary, trg_ary);}
public int Len_lo() {return len_lo;} private int len_lo;
public int Utf8_id_lo() {return utf8_id_lo;} private int utf8_id_lo;
public boolean Eq_lo(Gfo_case_itm trg_obj) {
Xol_case_itm_bry trg_itm = (Xol_case_itm_bry)trg_obj;
return utf8_id_lo == trg_itm.utf8_id_lo;
}
public byte[] Asymmetric_bry() {return asymmetric_bry;} private byte[] asymmetric_bry;
public int Hashcode_lo() {return hashcode_ci_lo;} private int hashcode_ci_lo;
}

View File

@@ -39,6 +39,13 @@ public class Xol_case_mgr_tst {
fxt.Test_reuse_1st_upper("É");
fxt.Lower("Ι", "ι"); // PURPOSE:test reversal; PAGE:en.d:ἀρχιερεύς DATE:2014-09-02
}
@Test public void Turkish_redirect() { // PURPOSE: lowercase redirect should match uppercase for asymmetric brys; PAGE:tr.w:Zvishavane DATE:2015-09-07
Hash_adp_bry hash = Hash_adp_bry.c__u8(Bool_.N, Xol_case_mgr_.U8());
byte[] upper = Bry_.new_u8("YÖNLENDİRME");
byte[] lower = Bry_.new_u8("yönlendirme");
hash.Add(upper, upper); // add upper to hash
Tfds.Eq_bry(upper, (byte[])hash.Get_by_bry(lower)); // get upper by using lower
}
// @Test public void Hack() {
// Xol_case_itm[] ary = Xol_case_mgr_.Utf_8;
// Bry_bfr bfr = Bry_bfr.new_();

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.xowa.langs.durations; import gplx.*; import gplx.xowa.*; import gplx.xowa.langs.*;
import gplx.xowa.parsers.*;
public class Xol_duration_mgr {
private Xol_msg_itm[] interval_msgs = null;
public Xol_duration_mgr(Xol_lang lang) {this.lang = lang;} private Xol_lang lang;

View File

@@ -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.xowa.langs.msgs; import gplx.*; import gplx.xowa.*; import gplx.xowa.langs.*;
import gplx.php.*;
import gplx.php.*; import gplx.xowa.parsers.*;
public class Xol_msg_mgr_ {
// public static String Get_msg_val_gui_or_null(Xol_lang lang, byte[] pre, byte[] key, byte[] suf) {
// String rv = Get_msg_val_gui_or_null(lang, pre, key, suf);

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.xowa.langs.vnts; import gplx.*; import gplx.xowa.*; import gplx.xowa.langs.*;
import gplx.xowa.parsers.*;
public class Xop_vnt_eqgt_tkn extends Xop_tkn_itm_base {
public Xop_vnt_eqgt_tkn(int bgn, int end) {this.Tkn_ini_pos(false, bgn, end);}
@Override public byte Tkn_tid() {return Xop_tkn_itm_.Tid_vnt_eqgt;}

View File

@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.langs.vnts; import gplx.*; import gplx.xowa.*; import gplx.xowa.langs.*;
import gplx.core.btries.*;
import gplx.xowa.parsers.*;
class Xop_vnt_flag_parser {
private Xop_vnt_flag_lang_bldr flag_lang_bldr;
public Xop_vnt_flag_parser(Xol_vnt_mgr vnt_mgr) {flag_lang_bldr = new Xop_vnt_flag_lang_bldr(vnt_mgr);}
@@ -26,7 +27,7 @@ class Xop_vnt_flag_parser {
public int Rslt_tkn_pos() {return rslt_tkn_pos;} private int rslt_tkn_pos;
public int Rslt_pipe_last() {return rslt_pipe_last;} private int rslt_pipe_last;
public Xop_vnt_flag[] Rslt_flags() {return rslt_flags;} private Xop_vnt_flag[] rslt_flags;
public void Parse(Xowe_wiki wiki, Xop_vnt_tkn vnt_tkn, int pipe_tkn_count, byte[] src) {
public void Parse(Xowe_wiki wiki, Xoa_url page_url, Xop_vnt_tkn vnt_tkn, int pipe_tkn_count, byte[] src) {
this.Clear();
rslt_flags = new Xop_vnt_flag[pipe_tkn_count];
int rv_idx = 0;
@@ -52,7 +53,7 @@ class Xop_vnt_flag_parser {
case Xop_tkn_itm_.Tid_newLine: // skip ws
break;
default:
wiki.Appe().Usr_dlg().Log_many("", "", "unknown tkn in vnt flag; tid=~{0} txt=~{1}", sub.Tkn_tid(), String_.new_u8(src, sub.Src_bgn(), sub.Src_end()));
wiki.Appe().Usr_dlg().Log_many("", "", "unknown tkn in vnt flag; url=~{0} tid=~{1} txt=~{2}", page_url.To_str(), sub.Tkn_tid(), String_.new_u8(src, sub.Src_bgn(), sub.Src_end()));
flag_bfr.Add_mid(src, sub.Src_bgn(), sub.Src_end());
break;
}

View File

@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.langs.vnts; import gplx.*; import gplx.xowa.*; import gplx.xowa.langs.*;
import gplx.xowa.html.*;
import gplx.xowa.parsers.*;
public class Xop_vnt_html_wtr {
public static void Write(Bry_bfr bfr, Xoh_html_wtr html_wtr, Xop_ctx ctx, Xoh_wtr_ctx hctx, Xoae_page page, byte[] src, Xop_vnt_tkn vnt) {
byte[] cur_lang_vnt = ctx.Wiki().Lang().Vnt_mgr().Cur_vnt();

View File

@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.langs.vnts; import gplx.*; import gplx.xowa.*; import gplx.xowa.langs.*;
import gplx.core.btries.*;
import gplx.xowa.parsers.*;
public class Xop_vnt_lxr_ {
public static void set_(Xowe_wiki wiki) {
Btrie_fast_mgr wiki_trie = wiki.Parser().Wtxt_trie();
@@ -75,7 +76,7 @@ class Xop_vnt_lxr_end implements Xop_lxr {
int rule_subs_bgn = 0;
int pipe_tkn_count = vnt_tkn.Vnt_pipe_tkn_count();
if (pipe_tkn_count > 0) {
flag_parser.Parse(wiki, vnt_tkn, pipe_tkn_count, src);
flag_parser.Parse(wiki, ctx.Cur_page().Url(), vnt_tkn, pipe_tkn_count, src);
vnt_flag_ary = flag_parser.Rslt_flags();
rule_subs_bgn = flag_parser.Rslt_tkn_pos();
vnt_tkn.Vnt_pipe_idx_last_(flag_parser.Rslt_pipe_last());

View File

@@ -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.xowa.langs.vnts; import gplx.*; import gplx.xowa.*; import gplx.xowa.langs.*;
import org.junit.*;
import org.junit.*; import gplx.xowa.parsers.*; import gplx.xowa.parsers.miscs.*;
public class Xop_vnt_lxr_tst {
private Xop_vnt_lxr_fxt fxt = new Xop_vnt_lxr_fxt();
@Before public void init() {fxt.Clear();}

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.xowa.langs.vnts; import gplx.*; import gplx.xowa.*; import gplx.xowa.langs.*;
import gplx.xowa.parsers.*;
public class Xop_vnt_rule extends Xop_tkn_itm_base {
public Xop_vnt_rule(byte[] rule_macro, byte[] rule_lang, Xop_tkn_itm[] rule_subs) {this.rule_macro = rule_macro; this.rule_lang = rule_lang; this.rule_subs = rule_subs;}
@Override public byte Tkn_tid() {return Xop_tkn_itm_.Tid_vnt_rule;}

View File

@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.langs.vnts; import gplx.*; import gplx.xowa.*; import gplx.xowa.langs.*;
import gplx.core.btries.*;
import gplx.xowa.parsers.*; import gplx.xowa.parsers.miscs.*;
class Xop_vnt_rules_parser {
private byte mode;
private Xop_vnt_tkn vnt_tkn;

View File

@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.langs.vnts; import gplx.*; import gplx.xowa.*; import gplx.xowa.langs.*;
import gplx.xowa.html.*;
import gplx.xowa.parsers.*;
public class Xop_vnt_tkn extends Xop_tkn_itm_base {
public Xop_vnt_tkn(int bgn, int end) {
this.Tkn_ini_pos(false, bgn, end);