Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3266afd1a4 |
@@ -30,8 +30,8 @@ android {
|
||||
* versionCode 每次发版 +1(Android 靠它判断"能不能覆盖安装",
|
||||
* 改小了会装不上)。
|
||||
*/
|
||||
versionCode = 206
|
||||
versionName = "2.0.6"
|
||||
versionCode = 207
|
||||
versionName = "2.0.7"
|
||||
|
||||
ndk {
|
||||
// Chaquopy 只支持这两个;Termux bootstrap 也只准备了这两份
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -211,8 +211,12 @@ OPS = (
|
||||
('div', '除 ÷', 'num', 'num', 2),
|
||||
('mod', '取余 %', 'num', 'num', 2),
|
||||
('concat', '拼接', 'str', 'str', 2),
|
||||
('eq', '等于 =', 'str', 'bool', 2),
|
||||
('ne', '不等于 ≠', 'str', 'bool', 2),
|
||||
('eq', '等于 =(数字)', 'num', 'bool', 2),
|
||||
('ne', '不等于 ≠(数字)', 'num', 'bool', 2),
|
||||
# ★ 文本相等单独一份:数字相等和文本相等**不是一回事** ——
|
||||
# "01" 和 "1" 作为文本不等,作为数字相等;拼写比较也不能先转成数字。
|
||||
('streq', '文本等于 ==', 'str', 'bool', 2),
|
||||
('strne', '文本不等于 !=', 'str', 'bool', 2),
|
||||
('gt', '大于 >', 'num', 'bool', 2),
|
||||
('lt', '小于 <', 'num', 'bool', 2),
|
||||
('gte', '大于等于 ≥', 'num', 'bool', 2),
|
||||
@@ -343,8 +347,17 @@ def apply_op(op_key: str, a, b=None):
|
||||
|
||||
if op_key == 'concat':
|
||||
return str(a) + str(b), ''
|
||||
if op_key in ('eq', 'ne'):
|
||||
# 文本相等:直接比字符串,不经过 as_num。
|
||||
# 两者不能混:01 和 1 作为文本不等、作为数字相等。
|
||||
if op_key in ('streq', 'strne'):
|
||||
same = str(a) == str(b)
|
||||
return cast_value(same if op_key == 'streq' else not same, 'bool'), ''
|
||||
if op_key in ('eq', 'ne'):
|
||||
x1, e3 = as_num(a)
|
||||
y1, e4 = as_num(b)
|
||||
if e3 or e4:
|
||||
return 'false', (e3 or e4)
|
||||
same = (x1 == y1)
|
||||
return cast_value(same if op_key == 'eq' else not same, 'bool'), ''
|
||||
|
||||
x, e1 = as_num(a)
|
||||
|
||||
34
scripts/verify-ops.py
Normal file
34
scripts/verify-ops.py
Normal file
@@ -0,0 +1,34 @@
|
||||
"""核对引擎和界面的算子表是否一致。
|
||||
|
||||
加算子时"只加一边"已经犯过好几次:
|
||||
· 引擎加了 gte/lte/and/or/xor/shl/shr,界面 OPS_UI 没加(用户"没看到大于等于")
|
||||
· 引擎有 neg/not,界面也选不到
|
||||
加完算子先跑它,别等用户发现。
|
||||
"""
|
||||
import os, re, sys
|
||||
WS = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
sys.path.insert(0, os.path.join(WS, 'android', 'kernel'))
|
||||
import meeting as M
|
||||
KT = os.path.join(WS, 'android', 'app', 'src', 'main', 'java',
|
||||
'com', 'doubao', 'lynxclone', 'ui', 'MeetingsScreen.kt')
|
||||
src = open(KT, encoding='utf-8').read()
|
||||
m = re.search(r'OPS_UI = listOf\((.*?)\n\s*\)', src, re.S)
|
||||
ui = set(re.findall(r'"(\w+)"\s+to\s+"', m.group(1))) if m else set()
|
||||
eng = {o[0] for o in M.OPS}
|
||||
sb = re.search(r'private fun opSpec\(key: String\)(.*?)private fun opLabel', src, re.S)
|
||||
ss = sb.group(1) if sb else ''
|
||||
spec = set(re.findall(r'"(\w+)"', ss))
|
||||
has_else = 'else ->' in ss
|
||||
miss_ui = sorted(eng - ui)
|
||||
miss_spec = [] if has_else else sorted(ui - spec)
|
||||
covered = sorted(ui - spec) if has_else else []
|
||||
extra = sorted(ui - eng)
|
||||
print(' 引擎 OPS %d 个' % len(eng))
|
||||
print(' 界面 OPS_UI %d 个' % len(ui))
|
||||
print(' 界面 opSpec %d 个%s' % (len(spec), '(有 else 兜底)' if has_else else ''))
|
||||
print(' %s 引擎有、界面选项里没有: %s' % ('X' if miss_ui else 'v', miss_ui or '无'))
|
||||
print(' %s 界面有选项、opSpec 没定义类型: %s' % ('X' if miss_spec else 'v', miss_spec or '无'))
|
||||
if covered:
|
||||
print(' (%s 由 else 兜底,正常)' % covered)
|
||||
print(' %s 界面有、引擎不认: %s' % ('X' if extra else 'v', extra or '无'))
|
||||
sys.exit(1 if (miss_ui or miss_spec or extra) else 0)
|
||||
Reference in New Issue
Block a user