feat(panic): FUCK [panic] mode=strict|fallback + realtest image variant
- UTSM panic_full returns in fallback mode (logs [PANIC:FALLBACK] + code + hit count); panic_halt keeps always-halt sites (CPU exception, VMM-E11 LA57, VMM-E15 DSK jump, UTSM-E42 test hook). Call sites given safe continuations. - Mode passed to DSK/FirstInit/login/desktop via DSK_BOOT_FLAG_PANIC_FALLBACK; DKM kernel_api.panic / kern.log.panic return to driver; ext4 fatal aborts the op via setjmp/longjmp and DSK falls back to FAT32 ESP. - build.ps1/Makefile: dev=strict, release=fallback, new realtest (release options + strict); default -Variant all; serialized iso packing under -j. - Fix '*/' inside comments (dkm.h, kernel_api.h, bus.c) that broke the build. - Includes pending work: dkm_bus service bus, mt7920/wlan drivers, desktop files/startmenu/prank, pe-tools, diskinfo, docs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -390,6 +390,68 @@ void editor_on_draw(void *state, app_ctx *ctx) {
|
||||
}
|
||||
void editor_on_destroy(void *state) { (void)state; }
|
||||
|
||||
/* 文件资源管理器把文本文件送进窗口编辑器(单实例 ADDR_EDWIN)。 */
|
||||
void editor_open_text(const char *disp, const u8 *data, u32 size) {
|
||||
int id = -1;
|
||||
int found = 0;
|
||||
int ascii = 1;
|
||||
editor_state *s;
|
||||
u32 cap = EDITOR_BUF_SIZE - 1;
|
||||
if (!disp) disp = "";
|
||||
if (!data) { data = (const u8 *)""; size = 0; }
|
||||
for (int i = 0; i < g_app_count; i++) {
|
||||
const char *n = g_apps[i].name;
|
||||
if (!n || !g_apps[i].on_create) continue;
|
||||
if (n[0]=='e' && n[1]=='d' && n[2]=='i' && n[3]=='t' &&
|
||||
n[4]=='o' && n[5]=='r' && n[6]==0) { id = i; break; }
|
||||
}
|
||||
if (id < 0) {
|
||||
slog("fileman: editor missing");
|
||||
return;
|
||||
}
|
||||
launch_app(id);
|
||||
for (int i = 0; i < g_win_count; i++) {
|
||||
if (g_windows[i].app_id == id && g_windows[i].visible) { found = 1; break; }
|
||||
}
|
||||
if (!found) return;
|
||||
|
||||
s = (editor_state *)ADDR_EDWIN;
|
||||
if (size > cap) size = cap;
|
||||
s->text_len = 0;
|
||||
for (u32 k = 0; k < size && s->text_len < (int)cap; k++) {
|
||||
char c = (char)data[k];
|
||||
if (c == '\r') continue;
|
||||
if ((unsigned char)c >= 32 || c == '\n' || c == '\t')
|
||||
s->text[s->text_len++] = c;
|
||||
}
|
||||
s->text[s->text_len] = 0;
|
||||
s->cursor_pos = 0;
|
||||
s->cursor_line = 0;
|
||||
s->cursor_col = 0;
|
||||
s->scroll_y = 0;
|
||||
s->modified = 0;
|
||||
s->has_file = 0;
|
||||
s->disp[0] = 0;
|
||||
|
||||
for (int k = 0; disp[k]; k++) {
|
||||
if ((unsigned char)disp[k] < 32 || (unsigned char)disp[k] > 126) ascii = 0;
|
||||
}
|
||||
for (int i = 0; i < g_win_count; i++) {
|
||||
desktop_window *w = &g_windows[i];
|
||||
int p = 0;
|
||||
const char *prefix = "Editor";
|
||||
if (w->app_id != id || !w->visible) continue;
|
||||
while (prefix[p] && p < 46) { w->title[p] = prefix[p]; p++; }
|
||||
if (ascii && disp[0]) {
|
||||
const char *sep = " - ";
|
||||
while (*sep && p < 46) w->title[p++] = *sep++;
|
||||
for (int k = 0; disp[k] && p < 47; k++) w->title[p++] = disp[k];
|
||||
}
|
||||
w->title[p] = 0;
|
||||
w->dirty = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* ============================================================
|
||||
* 计算器 (Calculator)
|
||||
* ============================================================ */
|
||||
|
||||
Reference in New Issue
Block a user