diff options
| author | maxim nikonov <maxim.nikonov@hqo.co> | 2026-02-06 04:21:03 +0500 |
|---|---|---|
| committer | maxim nikonov <maxim.nikonov@hqo.co> | 2026-02-06 04:21:03 +0500 |
| commit | 4810610dafb8ed93dd3672e32256997e22eca950 (patch) | |
| tree | e0db960825627acbe94a71f773ca3ac36617869f | |
| parent | f93978aba486bf0fea8d9ee857d014a02f3f7d96 (diff) | |
wip
| -rw-r--r-- | 2026-02-06-claudemd.txt | 1739 | ||||
| -rw-r--r-- | lib/libfltk.a | bin | 2237328 -> 2237328 bytes | |||
| -rw-r--r-- | lib/libfltk_forms.a | bin | 32888 -> 32888 bytes | |||
| -rw-r--r-- | lib/libfltk_gl.a | bin | 212440 -> 212440 bytes | |||
| -rw-r--r-- | lib/libfltk_images.a | bin | 268000 -> 268000 bytes | |||
| -rw-r--r-- | lib/libfltk_jpeg.a | bin | 305416 -> 305416 bytes | |||
| -rw-r--r-- | lib/libfltk_png.a | bin | 287384 -> 287384 bytes | |||
| -rw-r--r-- | lib/libfltk_z.a | bin | 103976 -> 103976 bytes | |||
| -rw-r--r-- | test/adjuster.cxx | 5 | ||||
| -rw-r--r-- | test/ask.cxx | 11 | ||||
| -rw-r--r-- | test/clipboard.cxx | 20 | ||||
| -rw-r--r-- | test/color_chooser.cxx | 6 | ||||
| -rw-r--r-- | test/group.cxx | 10 | ||||
| -rw-r--r-- | test/menubar.cxx | 10 | ||||
| -rw-r--r-- | test/penpal.cxx | 68 | ||||
| -rw-r--r-- | test/threads.cxx | 37 | ||||
| -rw-r--r-- | test/unittest_core.cxx | 27 | ||||
| -rw-r--r-- | test/utf8.cxx | 44 | ||||
| -rw-r--r-- | util/code_snapshot.cxx | 53 |
19 files changed, 1035 insertions, 995 deletions
diff --git a/2026-02-06-claudemd.txt b/2026-02-06-claudemd.txt index bab9c3624..7598bc471 100644 --- a/2026-02-06-claudemd.txt +++ b/2026-02-06-claudemd.txt @@ -12,957 +12,978 @@ │ ~/Desktop/fltk │ │ ╰──────────────────────────────────────────────────────────────────────────────╯ ══════════════════ Conversation compacted · ctrl+o for history ═════════════════ - ⎿ Referenced file fluid/widgets/Node_Browser.cxx - ⎿ Read fluid/io/Project_Writer.h (69 lines) - ⎿ Referenced file fluid/nodes/Window_Node.cxx - ⎿ Referenced file fluid/nodes/Node.cxx - ⎿ Read fluid/nodes/Node.h (319 lines) + ⎿ Read test/threads.cxx (240 lines) + ⎿ Read test/penpal.cxx (316 lines) + ⎿ Read test/clipboard.cxx (277 lines) + ⎿ Referenced file test/utf8.cxx + ⎿ Read test/group.cxx (149 lines) + ⎿ Todo list read (4 items) ⎿ Plan file referenced (~/.claude/plans/compiled-petting-babbage.md) -⏺ Продолжаю исправление Window_Node.cxx — нужно заменить оставшиеся c.c_str() на - просто c. - -⏺ Read(fluid/nodes/Window_Node.cxx) - ⎿ Read 60 lines - -⏺ Вижу все проблемные места. Заменю c.c_str() на просто c. - -⏺ Update(fluid/nodes/Window_Node.cxx) - ⎿ Added 6 lines, removed 6 lines - 1401 - 1402 // a constructor with all four dimensions plus label - 1403 f.write_c("%s::%s(int X, int Y, int W, int H, const char - *L) :\n", name(), trimclassname(name())); - 1404 - f.write_c("%s%s(X, Y, W, H, L)\n{\n", f.indent(1), c.c_st - -r()); - 1404 + f.write_c("%s%s(X, Y, W, H, L)\n{\n", f.indent(1), c); - 1405 f.write_c("%s_%s();\n", f.indent(1), trimclassname(name() - )); - 1406 f.write_c("}\n\n"); - 1407 - 1408 // a constructor with just the size and label. The window - manager will position the window - 1409 f.write_c("%s::%s(int W, int H, const char *L) :\n", name - (), trimclassname(name())); - 1410 - f.write_c("%s%s(0, 0, W, H, L)\n{\n", f.indent(1), c.c_st - -r()); - 1410 + f.write_c("%s%s(0, 0, W, H, L)\n{\n", f.indent(1), c); - 1411 f.write_c("%sclear_flag(16);\n", f.indent(1)); - 1412 f.write_c("%s_%s();\n", f.indent(1), trimclassname(name() - )); - 1413 f.write_c("}\n\n"); - 1414 - 1415 // a constructor that takes size and label from the Fluid - database - 1416 f.write_c("%s::%s() :\n", name(), trimclassname(name())); - 1417 - f.write_c("%s%s(0, 0, %d, %d, ", f.indent(1), c.c_str(), - -o->w(), o->h()); - 1417 + f.write_c("%s%s(0, 0, %d, %d, ", f.indent(1), c, o->w(), - +o->h()); - 1418 const char *cstr = label(); - 1419 if (cstr) f.write_cstring(cstr); - 1420 else f.write_c("0"); - ... - 1431 f.indent(1), trimclassname(name())); - 1432 f.write_c("%s::%s(int X, int Y, int W, int H, const char - *L) :\n", name(), trimclassname(name())); - 1433 if (wc_relative==1) - 1434 - f.write_c("%s%s(0, 0, W, H, L)\n{\n", f.indent(1), c.c_ - -str()); - 1434 + f.write_c("%s%s(0, 0, W, H, L)\n{\n", f.indent(1), c); - 1435 else if (wc_relative==2) - 1436 - f.write_c("%s%s(0, 0, %d, %d, L)\n{\n", f.indent(1), c. - -c_str(), o->w(), o->h()); - 1436 + f.write_c("%s%s(0, 0, %d, %d, L)\n{\n", f.indent(1), c, - + o->w(), o->h()); - 1437 else - 1438 - f.write_c("%s%s(X, Y, W, H, L)\n{\n", f.indent(1), c.c_ - -str()); - 1438 + f.write_c("%s%s(X, Y, W, H, L)\n{\n", f.indent(1), c); - 1439 } - 1440 - 1441 // f.write_c("%s%s *o = this;\n", f.indent(1), name()); - -⏺ Теперь пересоберу проект. - -⏺ Bash(cd /Users/mnik01/Desktop/fltk/build && ninja 2>&1 | head -100) - ⎿ (eval):1: command not found: ninja +⏺ Продолжаю работу над Фазой 6 — удаление std:: из test/. Сначала проверю, какие + файлы используют std::. + +⏺ Search(pattern: "std::", path: "test", output_mode: "content") + ⎿ Found 25 lines (ctrl+o to expand) + +⏺ Вижу 5 файлов с std::. Начну с простых случаев. + +⏺ Read(test/adjuster.cxx) + ⎿ Read 53 lines + +⏺ Read(test/ask.cxx) + ⎿ Read 154 lines + +⏺ Проверю, какие C-style альтернативы доступны для этих функций. + +⏺ Search(pattern: "format\(", path: "FL/Fl_Valuator.H", output_mode: "content") + ⎿ Found 1 line (ctrl+o to expand) + +⏺ Search(pattern: "fl_input\(", path: "FL/fl_ask.H", output_mode: "content") + ⎿ Found 0 lines + +⏺ Read(FL/Fl_Valuator.H) + ⎿ Read 16 lines + +⏺ Search(pattern: "fl_input|fl_password", path: "FL/fl_ask.H", output_mode: + "content") + ⎿ Found 4 lines (ctrl+o to expand) + +⏺ Отлично, есть C-style альтернативы. Исправляю оба файла. + +⏺ Update(test/adjuster.cxx) + ⎿ Added 3 lines, removed 2 lines + 23 void adjcb(Fl_Widget *o, void *v) { + 24 Fl_Adjuster *a = (Fl_Adjuster*)o; + 25 Fl_Box *b = (Fl_Box *)v; + 26 - std::string new_label = a->format_str(); + 27 - b->copy_label(new_label.c_str()); + 26 + char new_label[64]; + 27 + a->format(new_label); + 28 + b->copy_label(new_label); + 29 b->redraw(); + 30 } + 31 + +⏺ Update(test/ask.cxx) + ⎿ Added 5 lines, removed 6 lines + 34 + 35 void rename_button(Fl_Widget *o, void *v) { + 36 int what = fl_int(v); + 37 - int ret = 0; + 38 - std::string input; + 37 + const char *input; + 38 if (what == 0) { + 39 fl_message_icon_label("§"); + 41 - input = fl_input_str(ret, 0, "Input (no size limit, use ctr + -l/j for newline):", o->label()); + 40 + input = fl_input("Input (no size limit, use ctrl/j for newl + +ine):", o->label()); + 41 } else { + 42 fl_message_icon_label("€"); + 44 - input = fl_password_str(ret, 20, "Enter password (max. 20 c + -haracters):", o->label()); + 43 + input = fl_password(20, "Enter password (max. 20 characters + +):", o->label()); + 44 } + 46 - if (ret == 0) { + 47 - o->copy_label(input.c_str()); + 45 + if (input) { + 46 + o->copy_label(input); + 47 o->redraw(); + 48 } + 49 } + ⎿ Found 10 new diagnostic issues in 1 file (ctrl+o to expand) + +⏺ Теперь исправлю utf8.cxx. + +⏺ Read(test/utf8.cxx) + ⎿ Read 40 lines + ⎿ Found 10 new diagnostic issues in 1 file (ctrl+o to expand) + +⏺ Read(test/utf8.cxx) + ⎿ Read 70 lines + +⏺ Вижу также override на строке 508. Исправлю весь блок. + +⏺ Update(test/utf8.cxx) + ⎿ Added 15 lines, removed 19 lines + 505 "Only the first Unicode code point will be display + ed.\n" + 506 "Example: U+1F308 '🌈' 0x{f0,9f,8c,88}"); + 507 } + 508 - int handle(int event) override { + 508 + int handle(int event) { + 509 switch (event) { + 510 case FL_DND_ENTER: return 1; + 511 case FL_DND_DRAG: return 1; + ... + 513 case FL_PASTE: { + 514 int i, n; + 515 const char *t = Fl::event_text(); + 516 - char temp[10]; + 516 unsigned int ucode = fl_utf8decode(t, t + Fl::event_le + ngth(), &n); + 517 if (n == 0) { + 518 value(""); + ... + 523 // - length = 30: "U+1F308 '🌈' 0x{f0,9f,8c,88}" -- UT + F-8 encoding = 4 bytes + 524 // - length = 31: "U+10FFFF '' 0x{f4,8f,bf,bf}" -- UT + F-8 encoding = 4 bytes + 525 // + 527 - static const size_t max_size = 32; + 526 // begin with first Unicode code point of Fl::event_te + xt() in single quotes + 527 int tl = fl_utf8len(t[0]); + 528 if (tl < 1) + 529 tl = 1; + 532 - std::string buffer; + 533 - buffer.reserve(max_size); + 530 + char buffer[64]; + 531 + char *p = buffer; + 532 // add Unicode code point: "U+0000" - "U+10FFFF" (4-6 + hex digits) + 535 - buffer += "U+"; + 536 - snprintf(temp, 9, "%04X", ucode); + 537 - buffer += temp; + 533 + p += sprintf(p, "U+%04X '", ucode); + 534 // add Unicode character in quotes + 539 - buffer += " '"; + 540 - buffer += std::string(t, tl); + 541 - buffer += "'"; + 535 + memcpy(p, t, tl); + 536 + p += tl; + 537 + *p++ = '\''; + 538 // add hex UTF-8 codes, format: "0xab" or "0x{de,ad,be + ,ef}" + 543 - buffer += " 0x"; + 539 + p += sprintf(p, " 0x"); + 540 if (n > 1) + 545 - buffer += "{"; + 541 + *p++ = '{'; + 542 for (i = 0; i < n; i++) { + 543 if (i > 0) + 548 - buffer += ','; + 549 - snprintf(temp, 9, "%02x", (unsigned char)t[i]); + 550 - buffer += temp; + 544 + *p++ = ','; + 545 + p += sprintf(p, "%02x", (unsigned char)t[i]); + 546 } + 547 if (n > 1) + 553 - buffer += "}"; + 554 - value(buffer.c_str()); + 555 - printf("size: %lu\n", buffer.size()); fflush(stdout); + 548 + *p++ = '}'; + 549 + *p = '\0'; + 550 + value(buffer); + 551 + printf("size: %lu\n", (unsigned long)(p - buffer)); ff + +lush(stdout); + 552 } + 553 return 1; + 554 } + +⏺ Теперь threads.cxx с std::vector. Посмотрю контекст использования. + +⏺ Read(test/threads.cxx) + ⎿ Read 130 lines + +⏺ Read(test/threads.cxx) + ⎿ Read 35 lines + +⏺ Заменю std::vector на ручной динамический массив. + +⏺ Update(test/threads.cxx) + ⎿ Added 23 lines, removed 2 lines + 25 # include "threads.h" + 26 # include <stdio.h> + 27 # include <math.h> + 28 -# include <vector> + 28 +# include <stdlib.h> + 29 + 30 // min. time in seconds before calling Fl::awake(...) + 31 #define DELTA 0.25 + ... + 39 Fl_Terminal *terminal; // widget to write outp + ut to + 40 unsigned long max_prime; // highest prime found + so far + 41 Fl_Output *value; // highest prime output + widget + 42 - std::vector<unsigned long> primes; // collected primes wit + -hin time frame + 42 + unsigned long *primes; // collected primes wit + +hin time frame + 43 + size_t primes_count; // number of collected + +primes + 44 + size_t primes_alloc; // allocated size + 45 }; + 46 + 47 +static void primes_init(struct prime *pr) { + 48 + pr->primes = 0; + 49 + pr->primes_count = 0; + 50 + pr->primes_alloc = 0; + 51 +} + 52 + + 53 +static void primes_push(struct prime *pr, unsigned long n) { + 54 + if (pr->primes_count >= pr->primes_alloc) { + 55 + size_t new_alloc = pr->primes_alloc ? pr->primes_alloc * 2 + +: 64; + 56 + pr->primes = (unsigned long *)realloc(pr->primes, new_alloc + + * sizeof(unsigned long)); + 57 + pr->primes_alloc = new_alloc; + 58 + } + 59 + pr->primes[pr->primes_count++] = n; + 60 +} + 61 + + 62 +static void primes_clear(struct prime *pr) { + 63 + pr->primes_count = 0; + 64 +} + 65 + + 66 Fl_Thread prime_thread; + 67 + 68 Fl_Terminal *tty1, *tty2; + +⏺ Теперь обновлю использования. + +⏺ Update(test/threads.cxx) + ⎿ Added 1 line, removed 1 line + 83 char max_buf[32]; + 84 struct prime *pr = (struct prime *)v; + 85 size_t i; + 86 - for (i = 0; i < pr->primes.size(); i++) { + 86 + for (i = 0; i < pr->primes_count; i++) { + 87 unsigned long n = pr->primes[i]; + 88 pr->terminal->printf("prime: %10lu\n", n); + 89 if (n > pr->max_prime) + ⎿ Found 10 new diagnostic issues in 1 file (ctrl+o to expand) + +⏺ Update(test/threads.cxx) + ⎿ Added 2 lines, removed 2 lines + 126 pr[0].terminal = pr[1].terminal = terminal; + 127 pr[0].max_prime = pr[1].max_prime = 0; + 128 pr[0].value = pr[1].value = value; + 129 - pr[0].primes.clear(); + 130 - pr[1].primes.clear(); + 129 + primes_init(&pr[0]); + 130 + primes_init(&pr[1]); + 131 int pi = 0; // prime buffer index + 132 + 133 Fl_Timestamp last = Fl::now(); + ⎿ Found 1 new diagnostic issue in 1 file (ctrl+o to expand) + +⏺ Search(pattern: "primes\.", path: "test/threads.cxx", output_mode: "content") + ⎿ Found 2 lines (ctrl+o to expand) + +⏺ Update(test/threads.cxx) + ⎿ Added 1 line, removed 1 line + 152 + 153 if (pp > hn) { // n is a prime + 154 + 155 - pr[pi].primes.push_back(n); + 155 + primes_push(&pr[pi], n); + 156 + 157 // Send a message to the main thread, at which point it + will + 158 // process any pending updates. + +⏺ Update(test/threads.cxx) + ⎿ Added 1 line, removed 1 line + 163 last = Fl::now(); + 164 Fl::awake(update_handler, (void *)(&pr[pi])); + 165 pi = 1 - pi; // switch to a + lternate buffer + 166 - pr[pi].primes.clear(); // clear prime + -s + 166 + primes_clear(&pr[pi]); // clear prime + +s + 167 } + 168 + 169 if (n > max_value) { + +⏺ Теперь unittest_core.cxx. Этот файл тестирует API функции FLTK, возвращающие + std::string. Посмотрю его содержимое. + +⏺ Read(test/unittest_core.cxx) + ⎿ Read 228 lines + +⏺ Вижу, что большинство тестов уже отключены с помощью #if 0. Осталось + исправить: + 1. Строки 34-48: использование std::string с Fl_Preferences + 2. Строка 27: #include <string> + 3. Строка 214: FL_OVERRIDE — нужно проверить + +⏺ Search(pattern: "FL_OVERRIDE", path: "FL", output_mode: "content", head_limit: + 5) + ⎿ Found 3 lines (ctrl+o to expand) + +⏺ FL_OVERRIDE уже пустой макрос. Проверю API Fl_Preferences для C-строк. + +⏺ Search(pattern: "void set\(const char", path: "FL/Fl_Preferences.H", + output_mode: "content") + ⎿ Found 0 lines + +⏺ Search(pattern: "char get\(const char", path: "FL/Fl_Preferences.H", + output_mode: "content") + ⎿ Found 0 lines + +⏺ Search(pattern: "set\(.*,.*\)", path: "FL/Fl_Preferences.H", output_mode: + "content") + ⎿ Found 11 lines (ctrl+o to expand) + +⏺ Search(pattern: "get\(.*char\*", path: "FL/Fl_Preferences.H", output_mode: + "content") + ⎿ Found 0 lines + +⏺ Search(pattern: "char get\(", path: "FL/Fl_Preferences.H", output_mode: + "content") + ⎿ Found 8 lines (ctrl+o to expand) + +⏺ Этот тест тестирует std::string API для Fl_Preferences, который по плану + должен быть удалён. Отключу его аналогично другим тестам. + +⏺ Update(test/unittest_core.cxx) + ⎿ Added 1 line, removed 26 lines + 24 #include <FL/filename.H> + 25 #include <FL/fl_utf8.h> + 26 + 27 -#include <string> + 28 - + 29 - + 30 -/* Test additions to Fl_Preferences. */ + 31 -TEST(Fl_Preferences, Strings) { + 32 - { + 33 - Fl_Preferences prefs(Fl_Preferences::USER_L, "fltk.org", "u + -nittests"); + 34 - prefs.set("a", std::string()); + 35 - prefs.set("b", std::string("Hello")); + 36 - prefs.set("c", std::string("Hel\\l\nö")); + 37 - } + 38 - { + 39 - Fl_Preferences prefs(Fl_Preferences::USER_L, "fltk.org", "u + -nittests"); + 40 - std::string r; + 41 - prefs.get("a", r, "x"); + 42 - EXPECT_STREQ(r.c_str(), ""); + 43 - prefs.get("b", r, "x"); + 44 - EXPECT_STREQ(r.c_str(), "Hello"); + 45 - prefs.get("c", r, "x"); + 46 - EXPECT_STREQ(r.c_str(), "Hel\\l\nö"); + 47 - prefs.get("d", r, "x"); + 48 - EXPECT_STREQ(r.c_str(), "x"); + 49 - } + 50 - return true; + 51 -} + 52 - + 27 +// std::string tests disabled - API to be removed + 28 #if 0 + 29 + 30 TEST(fl_filename, ext) { + +⏺ Проверю, остались ли ещё std:: в test/. + +⏺ Search(pattern: "std::", path: "test", output_mode: "content") + ⎿ Found 17 lines (ctrl+o to expand) + ⎿ Found 10 new diagnostic issues in 1 file (ctrl+o to expand) + +⏺ Все оставшиеся std:: находятся внутри #if 0 блока (уже отключены). Проверю + сборку. + +⏺ Bash(make -j4 2>&1 | tail -50) + ⎿ make: Nothing to be done for `all'. /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni k01/Desktop/hobby/emsdk/emsdk_env.sh -⏺ Bash(cmake --build . 2>&1 | tail -100) - ⎿ Error: not a CMake build directory (missing CMakeCache.txt) +⏺ Сборка уже актуальна. Пересоберу изменённые тестовые файлы. + +⏺ Bash(rm -f build/test/adjuster.o build/test/ask.o build/test/utf8.o + build/test/threads.o build/test/unittest_core.o 2>/dev/null; make -j4 2>&1 + | tail -60) + ⎿ make: Nothing to be done for `all'. /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni k01/Desktop/hobby/emsdk/emsdk_env.sh -⏺ Bash(cmake --build . 2>&1 | tail -100) - ⎿ Error: not a CMake build directory (missing CMakeCache.txt) - /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni +⏺ Bash(find . -name "adjuster.o" -o -name "threads.o" 2>/dev/null) + ⎿ /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni k01/Desktop/hobby/emsdk/emsdk_env.sh -⏺ Bash(cmake --build /Users/mnik01/Desktop/fltk/build 2>&1 | tail -150) - ⎿ Error: not a CMake build directory (missing CMakeCache.txt) - /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni +⏺ Search(pattern: "adjuster", path: "Makefile", output_mode: "content") + ⎿ Found 0 lines + +⏺ Search(pattern: "test", path: "Makefile", output_mode: "content") + ⎿ Found 0 lines + +⏺ Read(Makefile) + ⎿ Read 80 lines + +⏺ Makefile не включает сборку тестов. Проверю компиляцию вручную. + +⏺ Bash(g++ -c -O2 -Wall -fPIC -std=c++11 -DFL_LIBRARY -I. -I./src + -I/opt/X11/include $(pkg-config --cflags cairo pangocairo pango) + test/adjuster.cxx -o /tmp/adjuster.o…) + ⎿ /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni k01/Desktop/hobby/emsdk/emsdk_env.sh -⏺ Bash(ls -la /Users/mnik01/Desktop/fltk/build 2>&1) - ⎿ total 0 - drwxr-xr-x@ 2 mnik01 staff 64 Feb 6 02:41 . - drwxr-xr-x@ 54 mnik01 staff 1728 Feb 6 2026 .. - … +2 lines (ctrl+o to expand) +⏺ Bash(g++ -c -O2 -Wall -fPIC -std=c++11 -DFL_LIBRARY -I. -I./src + -I/opt/X11/include $(pkg-config --cflags cairo pangocairo pango) + test/ask.cxx -o /tmp/ask.o 2>&1) + ⎿ /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni + k01/Desktop/hobby/emsdk/emsdk_env.sh + + +⏺ Bash(g++ -c -O2 -Wall -fPIC -std=c++11 -DFL_LIBRARY -I. -I./src + -I/opt/X11/include $(pkg-config --cflags cairo pangocairo pango) + test/threads.cxx -o /tmp/threads.o 2…) + ⎿ /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni + k01/Desktop/hobby/emsdk/emsdk_env.sh + + +⏺ Bash(g++ -c -O2 -Wall -fPIC -std=c++11 -DFL_LIBRARY -I. -I./src + -I/opt/X11/include $(pkg-config --cflags cairo pangocairo pango) + test/utf8.cxx -o /tmp/utf8.o 2>&1) + ⎿ test/utf8.cxx:533:14: warning: 'sprintf' is deprecated: This function i + s provided for compatibility reasons only. Due to security concerns in + herent in the design of sprintf(3), it is highly recommended that you u + … +51 lines (ctrl+o to expand) + + + + +⏺ Все файлы скомпилированы успешно! Только предупреждения о deprecated sprintf + на macOS. -⏺ Директория build пустая. Нужно заново сконфигурировать и собрать. +⏺ Проверю оставшиеся нарушения в test/. -⏺ Bash(cd /Users/mnik01/Desktop/fltk && cmake -B build -DFLTK_BUILD_TEST=OFF - 2>&1 | tail -50) - ⎿ CMake Error: The source directory "/Users/mnik01/Desktop/fltk" does not - appear to contain CMakeLists.txt. - Specify --help for usage, or press the help button on the CMake GUI. - … +2 lines (ctrl+o to expand) +⏺ Bash(echo "=== override ===" && grep -r '\boverride\b' test/*.cxx 2>/dev/null + | grep -v "\.cxx:\/\/" | grep -v "override_" | head -5 + echo "=== nullptr ===" && grep -…) + ⎿ === override === + test/clipboard.cxx: void draw() override { + test/clipboard.cxx: int handle(int event) override { + … +16 lines (ctrl+o to expand) +⏺ Остались override и nullptr в test/. Исправлю их. -⏺ Bash(ls /Users/mnik01/Desktop/fltk/Makefile - /Users/mnik01/Desktop/fltk/CMakeLists.txt 2>&1) +⏺ Bash(sed -i '' 's/ override\b//g' test/clipboard.cxx test/color_chooser.cxx + test/menubar.cxx 2>&1) + ⎿ /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni + k01/Desktop/hobby/emsdk/emsdk_env.sh + + +⏺ Bash(sed -i '' 's/\bnullptr\b/0/g' test/clipboard.cxx test/color_chooser.cxx + test/group.cxx 2>&1) + ⎿ /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni + k01/Desktop/hobby/emsdk/emsdk_env.sh + + +⏺ Bash(echo "=== override ===" && grep -r '\boverride\b' test/*.cxx 2>/dev/null + | grep -v "\.cxx:\/\/" | grep -v "override_" | grep -v "\.cxx:" | head -5 + echo "=== nul…) ⎿ Error: Exit code 1 /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mnik01/Desktop/hobby/emsdk/emsdk_env.sh + head: echo: No such file or directory + head: === nullptr ===: No such file or directory - ls: /Users/mnik01/Desktop/fltk/CMakeLists.txt: No such file or directory - /Users/mnik01/Desktop/fltk/Makefile + === override === -⏺ Проект использует Makefile. Соберу с make. +⏺ Bash(grep -rn '\boverride\b' test/*.cxx 2>/dev/null | grep -v "\/\/" | grep -v + "override_" | head -10; echo "---"; grep -rn '\bnullptr\b' test/*.cxx + 2>/dev/null | he…) + ⎿ test/clipboard.cxx:62: void draw() override { + test/clipboard.cxx:107: int handle(int event) override { + test/color_chooser.cxx:92: int handle(int event) override { + … +24 lines (ctrl+o to expand) -⏺ Bash(make 2>&1 | tail -100) timeout: 3m 0s - ⎿ | ^ - In file included from fluid/nodes/Node.cxx:97: - In file included from ./fluid/nodes/Node.h:23: - … +115 lines (ctrl+o to expand) +⏺ sed не сработал. Исправлю файлы напрямую. -⏺ Есть ошибка в Node.cxx — вызов .empty() на const char*. +⏺ Bash(sed -i '' 's/) override {/) {/g' test/clipboard.cxx + test/color_chooser.cxx test/menubar.cxx test/penpal.cxx && sed -i '' + 's/override { }/{ }/g' test/penpal.cxx…) + ⎿ /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni + k01/Desktop/hobby/emsdk/emsdk_env.sh -⏺ Read(fluid/nodes/Node.cxx) - ⎿ Read 20 lines -⏺ Search(pattern: "const char\* prefix\(\)|prefix\(\) const", path: "fluid", - output_mode: "content") - ⎿ Found 1 line (ctrl+o to expand) +⏺ Search(pattern: "\boverride\b", path: "test", glob: "*.cxx", output_mode: + "content") + ⎿ Found 4 lines (ctrl+o to expand) + +⏺ Bash(sed -i '' 's/) override {/) {/g' test/color_chooser.cxx && sed -i '' + 's/) override;/);/g' test/utf8.cxx && sed -i '' 's/) override {/) {/g' + test/utf8.cxx 2>&1) + ⎿ /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni + k01/Desktop/hobby/emsdk/emsdk_env.sh + + +⏺ Bash(grep -rn '\boverride\b' test/*.cxx 2>/dev/null | grep -v "\/\/" | head + -5) + ⎿ /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni + k01/Desktop/hobby/emsdk/emsdk_env.sh + + +⏺ Bash(sed -i '' 's/nullptr/0/g' test/clipboard.cxx test/color_chooser.cxx + test/group.cxx test/menubar.cxx 2>&1) + ⎿ /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni + k01/Desktop/hobby/emsdk/emsdk_env.sh + + +⏺ Bash(grep -rn '\bnullptr\b' test/*.cxx 2>/dev/null | head -5) + ⎿ test/penpal.cxx:40:Fl_Widget *cv1 { nullptr }; + test/penpal.cxx:41:Fl_Window *cvwin { nullptr }; + test/penpal.cxx:49: Fl_Widget *widget_ { nullptr }; + … +6 lines (ctrl+o to expand) + +⏺ Bash(sed -i '' 's/nullptr/0/g' test/penpal.cxx 2>&1 && grep -rn '\bnullptr\b' + test/*.cxx 2>/dev/null | head -5) + ⎿ /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni + k01/Desktop/hobby/emsdk/emsdk_env.sh -⏺ Update(fluid/nodes/Node.cxx) - ⎿ Added 2 lines, removed 2 lines - 890 f.write_word(type_name()); - 891 - 892 if (is_class()) { - 893 - auto p = ((Class_Node*)this)->prefix(); - 894 - if (!p.empty()) - 893 + const char *p = ((Class_Node*)this)->prefix(); - 894 + if (p[0]) - 895 f.write_word(p); - 896 } - 897 - -⏺ Bash(make 2>&1 | tail -80) timeout: 3m 0s - ⎿ | ^ - ./FL/Fl_Native_File_Chooser.H:210:16: note: overridden virtual function - is here - … +124 lines (ctrl+o to expand) +⏺ Search(pattern: "\{ 0 \}", path: "test/penpal.cxx", output_mode: "content") + ⎿ Found 7 lines (ctrl+o to expand) + +⏺ Заменю C++11 инициализацию { 0 } на обычную. + +⏺ Read(test/penpal.cxx) + ⎿ Read 25 lines + +⏺ Update(test/penpal.cxx) + ⎿ Added 2 lines, removed 2 lines + 37 + 38 extern Fl_Menu_Item app_menu[]; + 39 extern int popup_app_menu(); + 40 -Fl_Widget *cv1 { 0 }; + 41 -Fl_Window *cvwin { 0 }; + 40 +Fl_Widget *cv1 = 0; + 41 +Fl_Window *cvwin = 0; + 42 + 43 // + 44 // The canvas interface implements incremental drawing and hand + les draw events. + +⏺ Update(test/penpal.cxx) + ⎿ Added 14 lines, removed 10 lines + 46 // And it implements an overlay plane that visualizes pen event + data. + 47 // + 48 class CanvasInterface { + 49 - Fl_Widget *widget_ { 0 }; + 50 - bool in_window_ { false }; + 51 - bool first_draw_ { true }; + 52 - Fl_Offscreen offscreen_ { 0 }; + 53 - Fl_Color color_ { 1 }; + 54 - enum { NONE, HOVER, DRAW, PEN_HOVER, PEN_DRAW } overlay_ { NO + -NE }; + 55 - int ov_x_ { 0 }; + 56 - int ov_y_ { 0 }; + 49 + Fl_Widget *widget_; + 50 + bool in_window_; + 51 + bool first_draw_; + 52 + Fl_Offscreen offscreen_; + 53 + Fl_Color color_; + 54 + enum { NONE, HOVER, DRAW, PEN_HOVER, PEN_DRAW } overlay_; + 55 + int ov_x_; + 56 + int ov_y_; + 57 public: + 58 - CanvasInterface(Fl_Widget *w) : widget_(w) { } + 59 - CanvasInterface(Fl_Window *w) : widget_(w), in_window_(true) + -{ } + 58 + CanvasInterface(Fl_Widget *w) + 59 + : widget_(w), in_window_(false), first_draw_(true), offscre + +en_(0), + 60 + color_(1), overlay_(NONE), ov_x_(0), ov_y_(0) { } + 61 + CanvasInterface(Fl_Window *w) + 62 + : widget_(w), in_window_(true), first_draw_(true), offscree + +n_(0), + 63 + color_(1), overlay_(NONE), ov_x_(0), ov_y_(0) { } + 64 ~CanvasInterface() { + 65 if (offscreen_) fl_delete_offscreen(offscreen_); + 66 } ⎿ Found 2 new diagnostic issues in 1 file (ctrl+o to expand) -⏺ Сборка успешна! Теперь проверю, остались ли ещё использования std:: в fluid/. +⏺ Read(test/penpal.cxx) + ⎿ Read 15 lines + ⎿ Found 10 new diagnostic issues in 1 file (ctrl+o to expand) -⏺ Search(pattern: "std::", path: "fluid", output_mode: "content") - ⎿ Found 40 lines (ctrl+o to expand) +⏺ Проверю компиляцию penpal.cxx. -⏺ Есть использования std:: в .fl файлах (проектные файлы FLUID). Это код, - который генерируется в .cxx. Проверю codeview_panel.fl. +⏺ Bash(g++ -c -O2 -Wall -fPIC -std=c++11 -DFL_LIBRARY -I. -I./src + -I/opt/X11/include $(pkg-config --cflags cairo pangocairo pango) + test/penpal.cxx -o /tmp/penpal.o 2>&…) + ⎿ Error: Exit code 1 + /Users/mnik01/.zprofile:source:3: no such file or directory: + /Users/mnik01/Desktop/hobby/emsdk/emsdk_env.sh -⏺ Read(fluid/panels/codeview_panel.fl) - ⎿ Read 30 lines + test/penpal.cxx:82:14: error: no member named 'Pen' in namespace 'Fl' + 82 | case Fl::Pen::ENTER: // Return 1 to receive all pen events and + suppress mouse events + | ~~~~^ + test/penpal.cxx:87:14: error: no member named 'Pen' in namespace 'Fl' + 87 | case Fl::Pen::HOVER: + | ~~~~^ + test/penpal.cxx:94:14: error: no member named 'Pen' in namespace 'Fl' + … +52 lines (ctrl+o to see all) + +⏺ penpal.cxx использует Fl::Pen namespace (современный API). Пока пропущу его. + Проверю компиляцию других файлов. + +⏺ Bash(g++ -c -O2 -Wall -fPIC -std=c++11 -DFL_LIBRARY -I. -I./src + -I/opt/X11/include $(pkg-config --cflags cairo pangocairo pango) + test/clipboard.cxx -o /tmp/clipboard…) + ⎿ /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni + k01/Desktop/hobby/emsdk/emsdk_env.sh -⏺ Search(pattern: "code_file_name|header_file_name", path: "fluid/Project.h", - output_mode: "content") - ⎿ Found 6 lines (ctrl+o to expand) -⏺ Search(pattern: "std::", path: "fluid/panels/codeview_panel.cxx", output_mode: - "content") - ⎿ Found 0 lines +⏺ Bash(g++ -c -O2 -Wall -fPIC -std=c++11 -DFL_LIBRARY -I. -I./src + -I/opt/X11/include $(pkg-config --cflags cairo pangocairo pango) + test/group.cxx -o /tmp/group.o 2>&1…) + ⎿ /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni + k01/Desktop/hobby/emsdk/emsdk_env.sh -⏺ Search(pattern: "std::", path: "fluid/panels/settings_panel.cxx", output_mode: - "content") - ⎿ Found 0 lines -⏺ Search(pattern: "#include <functional>|#include <string>", path: "fluid", - output_mode: "content") - ⎿ Found 6 lines (ctrl+o to expand) +⏺ Bash(g++ -c -O2 -Wall -fPIC -std=c++11 -DFL_LIBRARY -I. -I./src + -I/opt/X11/include $(pkg-config --cflags cairo pangocairo pango) + test/menubar.cxx -o /tmp/menubar.o 2…) + ⎿ /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni + k01/Desktop/hobby/emsdk/emsdk_env.sh + -⏺ Найдены проблемные include в заголовках. Проверю их использование. +⏺ Bash(g++ -c -O2 -Wall -fPIC -std=c++11 -DFL_LIBRARY -I. -I./src + -I/opt/X11/include $(pkg-config --cflags cairo pangocairo pango) + test/color_chooser.cxx -o /tmp/color…) + ⎿ test/color_chooser.cxx:106:26: error: no member named 'override_text' i + n 'Fl_Tooltip' + 106 | return Fl_Tooltip::override_text(buf); + … +4 lines (ctrl+o to expand) -⏺ Read(fluid/io/Project_Writer.h) - ⎿ Read 69 lines -⏺ В Project_Writer.h #include <string> не используется. Удалю. +⏺ Bash(g++ -c -O2 -Wall -fPIC -std=c++11 -DFL_LIBRARY -I. -I./src + -I/opt/X11/include $(pkg-config --cflags cairo pangocairo pango) + test/unittest_core.cxx -o /tmp/unitt…) + ⎿ /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni + k01/Desktop/hobby/emsdk/emsdk_env.sh -⏺ Update(fluid/io/Project_Writer.h) - ⎿ Removed 2 lines - 21 - 22 #include <stdio.h> - 23 - 24 -#include <string> - 25 - - 24 class Node; - 25 - 26 namespace fld { -⏺ Search(pattern: "std::string", path: "fluid/nodes/Node.h", output_mode: +⏺ Ошибка в color_chooser.cxx с override_text. Проверю что произошло. + +⏺ Search(pattern: "override_text", path: "FL/Fl_Tooltip.H", output_mode: "content") ⎿ Found 0 lines - ⎿ Found 4 new diagnostic issues in 1 file (ctrl+o to expand) -⏺ Read(fluid/nodes/Node.h) - ⎿ Read 15 lines +⏺ Search(pattern: "text", path: "FL/Fl_Tooltip.H", output_mode: "content") + ⎿ Found 20 lines (ctrl+o to expand) -⏺ Update(fluid/nodes/Node.h) - ⎿ Removed 2 lines - 22 #include <FL/Fl_Widget.H> - 23 #include <FL/fl_draw.H> - 24 - 25 -#include <string> - 26 - - 25 class Node; - 26 class Group_Node; - 27 class Window_Node; +⏺ Bash(git diff HEAD -- FL/Fl_Tooltip.H 2>/dev/null | head -50) + ⎿ /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni + k01/Desktop/hobby/emsdk/emsdk_env.sh -⏺ Bash(make 2>&1 | tail -50) timeout: 3m 0s - ⎿ ar rcs lib/libfltk.a src/Fl.o src/Fl_Adjuster.o src/Fl_Bitmap.o src/Fl_ - Browser.o src/Fl_Browser_.o src/Fl_Browser_load.o src/Fl_Box.o src/Fl_B - utton.o src/Fl_Cairo.o src/Fl_Chart.o src/Fl_Check_Browser.o src/Fl_Che - … +85 lines (ctrl+o to expand) +⏺ Read(FL/Fl_Tooltip.H) + ⎿ Read 128 lines +⏺ Read(test/color_chooser.cxx) + ⎿ Read 20 lines + +⏺ Update(test/color_chooser.cxx) + ⎿ Added 1 line, removed 1 line + 103 "Background color is:\n" + 104 "r:%d, g:%d, b:%d", r, g, b); + 105 } + 106 - return Fl_Tooltip::override_text(buf); + 106 + return Fl_Tooltip::_text(buf); + 107 } + 108 return Fl_Box::handle(event); + 109 } + +⏺ Bash(g++ -c -O2 -Wall -fPIC -std=c++11 -DFL_LIBRARY -I. -I./src + -I/opt/X11/include $(pkg-config --cflags cairo pangocairo pango) + test/color_chooser.cxx -o /tmp/color…) + ⎿ /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni + k01/Desktop/hobby/emsdk/emsdk_env.sh ⎿ Found 10 new diagnostic issues in 1 file (ctrl+o to expand) -⏺ Сборка успешна. Проверю ещё раз состояние std:: использований. +⏺ Файл скомпилирован. Сводка по Фазе 6 test/: -⏺ Search(pattern: "#include <string>|#include <functional>|#include - <vector>|#include <map>", path: "fluid", output_mode: "content") - ⎿ Found 10 lines (ctrl+o to expand) +⏺ Продолжу с examples/. -⏺ Все #include <string> в Function_Node.cxx — это вывод в генерируемый код - пользователей FLUID, не нарушение. .fl файлы — исходники FLUID, не - компилируются. +⏺ Bash(echo "=== override ===" && grep -rn '\boverride\b' examples/*.cxx + 2>/dev/null | grep -v "\/\/" | head -10 + echo "=== nullptr ===" && grep -rn '\bnullptr\b' examp…) + ⎿ Error: Exit code 1 + /Users/mnik01/.zprofile:source:3: no such file or directory: + /Users/mnik01/Desktop/hobby/emsdk/emsdk_env.sh + head: echo: No such file or directory + head: === nullptr ===: No such file or directory - Обновлю todo list и проверю оставшиеся использования std:: в скомпилированном - коде. + === override === -⏺ Search(pattern: "std::", path: "fluid", glob: "*.cxx", output_mode: "content") - ⎿ Found 18 lines (ctrl+o to expand) +⏺ Bash(grep -rn '\boverride\b' examples/*.cxx 2>/dev/null | grep -v "\/\/" | + head -10) + ⎿ /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni + k01/Desktop/hobby/emsdk/emsdk_env.sh -⏺ Все оставшиеся std:: — это либо строковые метки UI, либо вывод в генерируемый - код для пользователей. Это не нарушения. - Проверю использование auto в .cxx файлах. +⏺ Bash(grep -rn '\bnullptr\b' examples/*.cxx 2>/dev/null | head -10) + ⎿ /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni + k01/Desktop/hobby/emsdk/emsdk_env.sh -⏺ Search(pattern: "\bauto\b", path: "fluid", glob: "*.cxx", output_mode: - "content") - ⎿ Found 31 lines (ctrl+o to expand) -⏺ Много использований auto. Нужно заменить на явные типы. Сначала определю тип - Fluid.proj.layout. +⏺ Bash(grep -rn 'std::' examples/*.cxx 2>/dev/null | head -10) + ⎿ examples/table-sort.cxx:46: static std::vector<std::string> G_header + = { "Date", "Time", "Size", "Filename" }; + examples/table-sort.cxx:54: static std::vector<std::string> G_header + … +17 lines (ctrl+o to expand) -⏺ Search(pattern: "layout", path: "fluid/Project.h", output_mode: "content") - ⎿ Found 3 lines (ctrl+o to expand) +⏺ Bash(grep -rn '\bauto\b' examples/*.cxx 2>/dev/null | grep -v "\/\/" | head + -10) + ⎿ /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni + k01/Desktop/hobby/emsdk/emsdk_env.sh -⏺ Update(fluid/nodes/factory.cxx) - ⎿ File must be read first -⏺ Read(fluid/nodes/factory.cxx) - ⎿ Read 15 lines +⏺ examples/ имеет только table-sort.cxx с std::. Это сложный файл с std::vector. + Проверю fltk-options/. -⏺ Update(fluid/nodes/factory.cxx) - ⎿ Added 13 lines, removed 13 lines - 390 } - 391 public: - 392 void ideal_size(int &w, int &h) override { - 393 - auto layout = Fluid.proj.layout; - 393 + app::Layout_Preset *layout = Fluid.proj.layout; - 394 h = layout->textsize_not_null() + 8; - 395 w = layout->textsize_not_null() * 4 + 4 * h; // make room - for the arrows - 396 fld::app::Snap_Action::better_size(w, h); - ... - 420 static Adjuster_Node prototype; - 421 public: - 422 void ideal_size(int &w, int &h) override { - 423 - auto layout = Fluid.proj.layout; - 423 + app::Layout_Preset *layout = Fluid.proj.layout; - 424 h = layout->labelsize + 8; - 425 w = 3 * h; - 426 fld::app::Snap_Action::better_size(w, h); - ... - 495 Fl_Menu_Item *subtypes() override { return roller_type_menu; - } - 496 public: - 497 void ideal_size(int &w, int &h) override { - 498 - auto layout = Fluid.proj.layout; - 498 + app::Layout_Preset *layout = Fluid.proj.layout; - 499 w = layout->labelsize + 8; - 500 h = 4 * w; - 501 fld::app::Snap_Action::better_size(w, h); - ... - 539 Fl_Menu_Item *subtypes() override { return slider_type_menu; - } - 540 public: - 541 void ideal_size(int &w, int &h) override { - 542 - auto layout = Fluid.proj.layout; - 542 + app::Layout_Preset *layout = Fluid.proj.layout; - 543 w = layout->labelsize + 8; - 544 h = 4 * w; - 545 fld::app::Snap_Action::better_size(w, h); - ... - 649 } - 650 public: - 651 void ideal_size(int &w, int &h) override { - 652 - auto layout = Fluid.proj.layout; - 652 + app::Layout_Preset *layout = Fluid.proj.layout; - 653 h = layout->textsize_not_null() + 8; - 654 w = layout->textsize_not_null() * 4 + 8; - 655 fld::app::Snap_Action::better_size(w, h); - ... - 692 } - 693 public: - 694 void ideal_size(int &w, int &h) override { - 695 - auto layout = Fluid.proj.layout; - 695 + app::Layout_Preset *layout = Fluid.proj.layout; - 696 h = layout->textsize_not_null() + 8; - 697 w = layout->textsize_not_null() * 4 + 8; - 698 fld::app::Snap_Action::better_size(w, h); - ... - 751 } - 752 public: - 753 void ideal_size(int &w, int &h) override { - 754 - auto layout = Fluid.proj.layout; - 754 + app::Layout_Preset *layout = Fluid.proj.layout; - 755 h = layout->textsize_not_null() + 8; - 756 w = layout->textsize_not_null() * 6 + 8; - 757 fld::app::Snap_Action::better_size(w, h); - ... - 793 Fl_Menu_Item *subtypes() override { return 0; } // Don't inh - erit. - 794 public: - 795 void ideal_size(int &w, int &h) override { - 796 - auto layout = Fluid.proj.layout; - 796 + app::Layout_Preset *layout = Fluid.proj.layout; - 797 h = layout->textsize_not_null() + 8 + 10; // Directoy bar - is additional 10 pixels high - 798 w = layout->textsize_not_null() * 10 + 8; - 799 fld::app::Snap_Action::better_size(w, h); - ... - 877 } - 878 public: - 879 void ideal_size(int &w, int &h) override { - 880 - auto layout = Fluid.proj.layout; - 880 + app::Layout_Preset *layout = Fluid.proj.layout; - 881 h = layout->textsize_not_null() * 4 + 8; - 882 w = layout->textsize_not_null() * 10 + 8; - 883 fld::app::Snap_Action::better_size(w, h); - ... - 1101 static Progress_Node prototype; - 1102 public: - 1103 void ideal_size(int &w, int &h) override { - 1104 - auto layout = Fluid.proj.layout; - 1104 + app::Layout_Preset *layout = Fluid.proj.layout; - 1105 h = layout->labelsize + 8; - 1106 w = layout->labelsize * 12; - 1107 fld::app::Snap_Action::better_size(w, h); - ... - 1153 } - 1154 public: - 1155 void ideal_size(int &w, int &h) override { - 1156 - auto layout = Fluid.proj.layout; - 1156 + app::Layout_Preset *layout = Fluid.proj.layout; - 1157 h = layout->textsize_not_null() + 8; - 1158 w = layout->textsize_not_null() * 4 + 8; - 1159 fld::app::Snap_Action::better_size(w, h); - ... - 1282 Node *add_new_widget_from_user(Node *inPrototype, Strategy st - rategy, bool and_open) { - 1283 Fluid.proj.undo.checkpoint(); - 1284 Fluid.proj.undo.suspend(); - 1285 - auto layout = Fluid.proj.layout; - 1285 + app::Layout_Preset *layout = Fluid.proj.layout; - 1286 Node *t = ((Node*)inPrototype)->make(strategy); - 1287 if (t) { - 1288 if (t->is_widget() && !t->is_a(FLD_NODE_TYPE_Window)) { - 1289 - auto layout = Fluid.proj.layout; - 1289 + app::Layout_Preset *layout = Fluid.proj.layout; - 1290 Widget_Node *wt = (Widget_Node *)t; - 1291 bool changed = false; - 1292 - -⏺ Read(fluid/nodes/Button_Node.cxx) - ⎿ Read 15 lines +⏺ Bash(grep -rn '\boverride\b\|std::\|\bnullptr\b' fltk-options/*.cxx + 2>/dev/null | grep -v "\/\/" | head -20) + ⎿ /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni + k01/Desktop/hobby/emsdk/emsdk_env.sh + + +⏺ Bash(grep -rn '\boverride\b\|std::\|\bnullptr\b' util/*.cxx 2>/dev/null | grep + -v "\/\/" | head -20) + ⎿ util/code_snapshot.cxx:51:Fl_Window* window = nullptr; + util/code_snapshot.cxx:52:Fl_Group* group = nullptr; + util/code_snapshot.cxx:53:fld::widget::Code_Viewer* code_viewer = nullp + … +15 lines (ctrl+o to expand) + + +⏺ Исправлю util/code_snapshot.cxx. + +⏺ Bash(sed -i '' 's/nullptr/0/g' util/code_snapshot.cxx 2>&1) + ⎿ /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni + k01/Desktop/hobby/emsdk/emsdk_env.sh + + +⏺ Read(util/code_snapshot.cxx) + ⎿ Read 110 lines + +⏺ Исправлю std::max на простые условия. + +⏺ Update(util/code_snapshot.cxx) + ⎿ Added 9 lines, removed 4 lines + 71 // Make sure the display is opened. + 72 Fl_Display_Device::display_device(); + 73 + 74 + int h; + 75 line_height = fl_height(code_viewer->textfont(), code_viewer- + >textsize()); + 75 - line_height = std::max(line_height, fl_height(FL_COURIER, cod + -e_viewer->textsize())); + 76 - line_height = std::max(line_height, fl_height(FL_COURIER_BOLD + -, code_viewer->textsize())); + 77 - line_height = std::max(line_height, fl_height(FL_COURIER_ITAL + -IC, code_viewer->textsize())); + 78 - line_height = std::max(line_height, fl_height(FL_COURIER_BOLD + -_ITALIC, code_viewer->textsize())); + 76 + h = fl_height(FL_COURIER, code_viewer->textsize()); + 77 + if (h > line_height) line_height = h; + 78 + h = fl_height(FL_COURIER_BOLD, code_viewer->textsize()); + 79 + if (h > line_height) line_height = h; + 80 + h = fl_height(FL_COURIER_ITALIC, code_viewer->textsize()); + 81 + if (h > line_height) line_height = h; + 82 + h = fl_height(FL_COURIER_BOLD_ITALIC, code_viewer->textsize() + +); + 83 + if (h > line_height) line_height = h; + 84 } + 85 + 86 void save_snapshot(const char* code, const char* filename) { + +⏺ Read(util/code_snapshot.cxx) + ⎿ Read 55 lines ⎿ Found 10 new diagnostic issues in 1 file (ctrl+o to expand) -⏺ Update(fluid/nodes/Button_Node.cxx) - ⎿ Added 5 lines, removed 5 lines - 57 } - 58 - 59 void Button_Node::ideal_size(int &w, int &h) { - 60 - auto layout = Fluid.proj.layout; - 60 + app::Layout_Preset *layout = Fluid.proj.layout; - 61 h = layout->labelsize + 8; - 62 w = layout->labelsize * 4 + 8; - 63 fld::app::Snap_Action::better_size(w, h); - ... - 95 // ---- Return Button ---- - 96 - 97 void Return_Button_Node::ideal_size(int &w, int &h) { - 98 - auto layout = Fluid.proj.layout; - 98 + app::Layout_Preset *layout = Fluid.proj.layout; - 99 h = layout->labelsize + 8; - 100 w = layout->labelsize * 4 + 8 + h; // make room for the symb - ol - 101 fld::app::Snap_Action::better_size(w, h); - ... - 120 // ---- Light Button ---- - 121 - 122 void Light_Button_Node::ideal_size(int &w, int &h) { - 123 - auto layout = Fluid.proj.layout; - 123 + app::Layout_Preset *layout = Fluid.proj.layout; - 124 h = layout->labelsize + 8; - 125 w = layout->labelsize * 4 + 8 + layout->labelsize; // make r - oom for the light - 126 fld::app::Snap_Action::better_size(w, h); - ... - 136 // ---- Check Button ---- - 137 - 138 void Check_Button_Node::ideal_size(int &w, int &h) { - 139 - auto layout = Fluid.proj.layout; - 139 + app::Layout_Preset *layout = Fluid.proj.layout; - 140 h = layout->labelsize + 8; - 141 w = layout->labelsize * 4 + 8 + layout->labelsize; // make r - oom for the symbol - 142 fld::app::Snap_Action::better_size(w, h); - ... - 152 // ---- Round Button ---- - 153 - 154 void Round_Button_Node::ideal_size(int &w, int &h) { - 155 - auto layout = Fluid.proj.layout; - 155 + app::Layout_Preset *layout = Fluid.proj.layout; - 156 h = layout->labelsize + 8; - 157 w = layout->labelsize * 4 + 8 + layout->labelsize; // make r - oom for the symbol - 158 fld::app::Snap_Action::better_size(w, h); - -⏺ Read(fluid/app/Snap_Action.cxx) - ⎿ Read 20 lines +⏺ Update(util/code_snapshot.cxx) + ⎿ Added 2 lines, removed 1 line + 45 #include "../fluid/widgets/Style_Parser.h" + 46 + 47 #include <stdio.h> + 48 -#include <algorithm> + 48 +#include <stdlib.h> + 49 +#include <string.h> + 50 + 51 + 52 Fl_Window* window = 0; + +⏺ Update(util/code_snapshot.cxx) + ⎿ Added 23 lines, removed 8 lines + 149 + 150 // fprintf(stderr, "Reading \"%s\".\n", argv[i]); + 151 + 152 - std::string code; + 153 - std::string filename; + 152 + char *code = 0; + 153 + size_t code_len = 0; + 154 + size_t code_alloc = 0; + 155 + char filename[FL_PATH_MAX]; + 156 bool in_code_block = false; + 157 + int j; + 158 for (;;) { + 159 fgets(line, 1023, f); + 160 if (feof(f)) break; + 161 if (in_code_block) { + 162 if (strstr(line, "\\endcode_international")) { + 160 - if (!code.empty()) { + 161 - code.resize(code.size() - 1); + 162 - save_snapshot(code.c_str(), filename.c_str()); + 163 + if (code_len > 0) { + 164 + code[code_len - 1] = '\0'; // remove trailing new + +line + 165 + save_snapshot(code, filename); + 166 } + 167 in_code_block = false; + 165 - code = ""; + 168 + code_len = 0; + 169 } else { + 167 - code += line; + 170 + size_t linelen = strlen(line); + 171 + if (code_len + linelen >= code_alloc) { + 172 + code_alloc = (code_alloc == 0) ? 4096 : code_alloc + + * 2; + 173 + code = (char *)realloc(code, code_alloc); + 174 + } + 175 + memcpy(code + code_len, line, linelen); + 176 + code_len += linelen; + 177 + code[code_len] = '\0'; + 178 } + 179 } else { + 180 if (strstr(line, "\\code_international")) { + 181 const char* fn_start = strstr(line, "{\""); + 182 const char* fn_end = strstr(line, "\"}"); + 183 if (fn_start && fn_end && (fn_end > fn_start)) { + 174 - filename = std::string(fn_start+2, fn_end-fn_start + --2); + 184 + int len = (int)(fn_end - fn_start - 2); + 185 + if (len >= FL_PATH_MAX) len = FL_PATH_MAX - 1; + 186 + for (j = 0; j < len; j++) + 187 + filename[j] = fn_start[2 + j]; + 188 + filename[len] = '\0'; + 189 in_code_block = true; + 190 } + 191 } + 192 } + 193 } + 194 + if (code) free(code); + 195 fclose(f); + 196 } + 197 ⎿ Found 10 new diagnostic issues in 1 file (ctrl+o to expand) -⏺ Update(fluid/app/Snap_Action.cxx) - ⎿ Added 9 lines, removed 9 lines - 1083 - 1084 /** Return a sensible step size for resizing a widget. */ - 1085 void Snap_Action::get_resize_stepsize(int &x_step, int &y_ste - p) { - 1086 - auto layout = Fluid.proj.layout; - 1086 + Layout_Preset *layout = Fluid.proj.layout; - 1087 if ((layout->widget_inc_w > 1) && (layout->widget_inc_h > 1 - )) { - 1088 x_step = layout->widget_inc_w; - 1089 y_step = layout->widget_inc_h; - ... - 1098 - 1099 /** Return a sensible step size for moving a widget. */ - 1100 void Snap_Action::get_move_stepsize(int &x_step, int &y_step) - { - 1101 - auto layout = Fluid.proj.layout; - 1101 + Layout_Preset *layout = Fluid.proj.layout; - 1102 if ((layout->group_grid_x > 1) && (layout->group_grid_y > 1 - )) { - 1103 x_step = layout->group_grid_x; - 1104 y_step = layout->group_grid_y; - ... - 1113 - 1114 /** Fix the given size to the same or next bigger snap positi - on. */ - 1115 void Snap_Action::better_size(int &w, int &h) { - 1116 - auto layout = Fluid.proj.layout; - 1116 + Layout_Preset *layout = Fluid.proj.layout; - 1117 int x_min = 1, y_min = 1, x_inc = 1, y_inc = 1; - 1118 get_resize_stepsize(x_inc, y_inc); - 1119 if (x_inc < 1) x_inc = 1; - ... - 1428 class Fd_Snap_Window_Grid : public Fd_Snap_Grid { - 1429 public: - 1430 void check(Snap_Data &d) override { - 1431 - auto layout = Fluid.proj.layout; - 1431 + Layout_Preset *layout = Fluid.proj.layout; - 1432 clr(); - 1433 if (in_window(d)) check_grid(d, layout->left_window_margi - n, layout->window_grid_x, d.win->o->w()-layout->right_window_ - margin, - 1434 layout->top_window_margin, l - ayout->window_grid_y, d.win->o->h()-layout->bottom_window_mar - gin); - 1435 } - 1436 void draw(Snap_Data &d) override { - 1437 - auto layout = Fluid.proj.layout; - 1437 + Layout_Preset *layout = Fluid.proj.layout; - 1438 draw_grid(nearest_x, nearest_y, layout->window_grid_x, la - yout->window_grid_y); - 1439 } - 1440 }; - ... - 1447 public: - 1448 void check(Snap_Data &d) override { - 1449 if (in_group(d)) { - 1450 - auto layout = Fluid.proj.layout; - 1450 + Layout_Preset *layout = Fluid.proj.layout; - 1451 clr(); - 1452 Fl_Widget *g = parent(d); - 1453 check_grid(d, g->x()+layout->left_group_margin, layout- - >group_grid_x, g->x()+g->w()-layout->right_group_margin, - ... - 1455 } - 1456 } - 1457 void draw(Snap_Data &d) override { - 1458 - auto layout = Fluid.proj.layout; - 1458 + Layout_Preset *layout = Fluid.proj.layout; - 1459 draw_grid(nearest_x, nearest_y, layout->group_grid_x, lay - out->group_grid_y); - 1460 } - 1461 }; - ... - 1616 public: - 1617 Fd_Snap_Widget_Ideal_Width() { type = 1; mask = FD_LEFT|FD_ - RIGHT; } - 1618 void check(Snap_Data &d) override { - 1619 - auto layout = Fluid.proj.layout; - 1619 + Layout_Preset *layout = Fluid.proj.layout; - 1620 clr(); - 1621 if (!d.wgt) return; - 1622 int iw = 15, ih = 15; - ... - 1643 public: - 1644 Fd_Snap_Widget_Ideal_Height() { type = 2; mask = FD_TOP|FD_ - BOTTOM; } - 1645 void check(Snap_Data &d) override { - 1646 - auto layout = Fluid.proj.layout; - 1646 + Layout_Preset *layout = Fluid.proj.layout; - 1647 clr(); - 1648 if (!d.wgt) return; - 1649 int iw, ih; - -⏺ Search(pattern: "all_selected_widgets", path: "fluid", output_mode: "content") - ⎿ Found 96 lines (ctrl+o to expand) - -⏺ Read(fluid/proj/undo.cxx) - ⎿ Read 20 lines +⏺ Проверю компиляцию. + +⏺ Bash(g++ -c -O2 -Wall -fPIC -std=c++11 -DFL_LIBRARY -I. -I./src + -I/opt/X11/include $(pkg-config --cflags cairo pangocairo pango) + util/code_snapshot.cxx -o /tmp/code_…) + ⎿ In file included from util/code_snapshot.cxx:44: + util/../fluid/widgets/Code_Viewer.h:26:10: fatal error: 'widgets/Code_E + ditor.h' file not found + … +5 lines (ctrl+o to expand) -⏺ Update(fluid/proj/undo.cxx) - ⎿ Added 1 line, removed 1 line - 103 return; - 104 } - 105 if (reload_panel) { - 106 - for (auto w: Fluid.proj.tree.all_selected_widgets()) { - 106 + for (Widget_Node *w: Fluid.proj.tree.all_selected_widgets( - +)) { - 107 w->open(); - 108 } - 109 } ⎿ Found 10 new diagnostic issues in 1 file (ctrl+o to expand) -⏺ Read(fluid/nodes/Tree.cxx) - ⎿ Read 30 lines +⏺ Bash(g++ -c -O2 -Wall -fPIC -std=c++11 -DFL_LIBRARY -I. -I./src -I./fluid + -I/opt/X11/include $(pkg-config --cflags cairo pangocairo pango) + util/code_snapshot.cxx -o…) + ⎿ /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni + k01/Desktop/hobby/emsdk/emsdk_env.sh -⏺ Search(pattern: "all_nodes\(\)", path: "fluid/nodes/Tree.h", output_mode: - "content") - ⎿ Found 2 lines (ctrl+o to expand) -⏺ Read(fluid/nodes/Tree.h) - ⎿ Read 50 lines +⏺ Компиляция прошла успешно. Обновлю состояние и проверю оставшиеся нарушения. -⏺ Read(fluid/nodes/Tree.h) - ⎿ Read 25 lines +⏺ Проверю общее состояние нарушений. -⏺ Update(fluid/nodes/Tree.cxx) - ⎿ Added 1 line, removed 1 line - 92 \return the node with this uid, or 0 if not found - 93 */ - 94 Node *Tree::find_by_uid(unsigned short uid) { - 95 - for (auto tp: all_nodes()) { - 95 + for (Node *tp: all_nodes()) { - 96 if (tp->get_uid() == uid) return tp; - 97 } - 98 return 0; - -⏺ Update(fluid/nodes/Tree.cxx) - ⎿ Added 1 line, removed 1 line - 106 \return the node we found or 0 - 107 */ - 108 Node *Tree::find_in_text(int text_type, int crsr) { - 109 - for (auto node: all_nodes()) { - 109 + for (Node *node: all_nodes()) { - 110 switch (text_type) { - 111 case 0: - 112 if (crsr >= node->code1_start && crsr < node->code1_en - d) return node; - ⎿ Found 10 new diagnostic issues in 1 file (ctrl+o to expand) +⏺ Bash(echo "=== std:: in src/ ===" && grep -rn 'std::' src/*.cxx 2>/dev/null | + grep -v "\/\/" | wc -l + echo "=== std:: in FL/ ===" && grep -rn 'std::' FL/*.H 2>/dev/nu…) + ⎿ === std:: in src/ === + 4 + === std:: in FL/ === + … +9 lines (ctrl+o to expand) -⏺ Проверю оставшиеся auto в fluid/. +⏺ Осталось 4 использования std:: в src/. Проверю их. -⏺ Search(pattern: "\bauto\b", path: "fluid", glob: "*.cxx", output_mode: - "content") - ⎿ Found 1 line (ctrl+o to expand) - ⎿ Found 7 new diagnostic issues in 1 file (ctrl+o to expand) - -⏺ Все auto заменены. Пересоберу проект. - -⏺ Bash(make 2>&1 | tail -80) timeout: 3m 0s - ⎿ In file included from ./FL/Fl_Graphics_Driver.H:33: - ./FL/Fl_Pixmap.H:70:8: warning: 'draw' overrides a member function but - is not marked 'override' [-Winconsistent-missing-override] - … +89 lines (ctrl+o to expand) - -⏺ Нужно использовать полное имя fld::app::Layout_Preset. Исправлю. - -⏺ Update(fluid/nodes/Button_Node.cxx) - ⎿ Added 5 lines, removed 5 lines - 57 } - 58 - 59 void Button_Node::ideal_size(int &w, int &h) { - 60 - app::Layout_Preset *layout = Fluid.proj.layout; - 60 + fld::app::Layout_Preset *layout = Fluid.proj.layout; - 61 h = layout->labelsize + 8; - 62 w = layout->labelsize * 4 + 8; - 63 fld::app::Snap_Action::better_size(w, h); - ... - 95 // ---- Return Button ---- - 96 - 97 void Return_Button_Node::ideal_size(int &w, int &h) { - 98 - app::Layout_Preset *layout = Fluid.proj.layout; - 98 + fld::app::Layout_Preset *layout = Fluid.proj.layout; - 99 h = layout->labelsize + 8; - 100 w = layout->labelsize * 4 + 8 + h; // make room for the symb - ol - 101 fld::app::Snap_Action::better_size(w, h); - ... - 120 // ---- Light Button ---- - 121 - 122 void Light_Button_Node::ideal_size(int &w, int &h) { - 123 - app::Layout_Preset *layout = Fluid.proj.layout; - 123 + fld::app::Layout_Preset *layout = Fluid.proj.layout; - 124 h = layout->labelsize + 8; - 125 w = layout->labelsize * 4 + 8 + layout->labelsize; // make r - oom for the light - 126 fld::app::Snap_Action::better_size(w, h); - ... - 136 // ---- Check Button ---- - 137 - 138 void Check_Button_Node::ideal_size(int &w, int &h) { - 139 - app::Layout_Preset *layout = Fluid.proj.layout; - 139 + fld::app::Layout_Preset *layout = Fluid.proj.layout; - 140 h = layout->labelsize + 8; - 141 w = layout->labelsize * 4 + 8 + layout->labelsize; // make r - oom for the symbol - 142 fld::app::Snap_Action::better_size(w, h); - ... - 152 // ---- Round Button ---- - 153 - 154 void Round_Button_Node::ideal_size(int &w, int &h) { - 155 - app::Layout_Preset *layout = Fluid.proj.layout; - 155 + fld::app::Layout_Preset *layout = Fluid.proj.layout; - 156 h = layout->labelsize + 8; - 157 w = layout->labelsize * 4 + 8 + layout->labelsize; // make r - oom for the symbol - 158 fld::app::Snap_Action::better_size(w, h); - -⏺ Update(fluid/nodes/factory.cxx) - ⎿ Added 13 lines, removed 13 lines - 390 } - 391 public: - 392 void ideal_size(int &w, int &h) override { - 393 - app::Layout_Preset *layout = Fluid.proj.layout; - 393 + fld::app::Layout_Preset *layout = Fluid.proj.layout; - 394 h = layout->textsize_not_null() + 8; - 395 w = layout->textsize_not_null() * 4 + 4 * h; // make room - for the arrows - 396 fld::app::Snap_Action::better_size(w, h); - ... - 420 static Adjuster_Node prototype; - 421 public: - 422 void ideal_size(int &w, int &h) override { - 423 - app::Layout_Preset *layout = Fluid.proj.layout; - 423 + fld::app::Layout_Preset *layout = Fluid.proj.layout; - 424 h = layout->labelsize + 8; - 425 w = 3 * h; - 426 fld::app::Snap_Action::better_size(w, h); - ... - 495 Fl_Menu_Item *subtypes() override { return roller_type_menu; - } - 496 public: - 497 void ideal_size(int &w, int &h) override { - 498 - app::Layout_Preset *layout = Fluid.proj.layout; - 498 + fld::app::Layout_Preset *layout = Fluid.proj.layout; - 499 w = layout->labelsize + 8; - 500 h = 4 * w; - 501 fld::app::Snap_Action::better_size(w, h); - ... - 539 Fl_Menu_Item *subtypes() override { return slider_type_menu; - } - 540 public: - 541 void ideal_size(int &w, int &h) override { - 542 - app::Layout_Preset *layout = Fluid.proj.layout; - 542 + fld::app::Layout_Preset *layout = Fluid.proj.layout; - 543 w = layout->labelsize + 8; - 544 h = 4 * w; - 545 fld::app::Snap_Action::better_size(w, h); - ... - 649 } - 650 public: - 651 void ideal_size(int &w, int &h) override { - 652 - app::Layout_Preset *layout = Fluid.proj.layout; - 652 + fld::app::Layout_Preset *layout = Fluid.proj.layout; - 653 h = layout->textsize_not_null() + 8; - 654 w = layout->textsize_not_null() * 4 + 8; - 655 fld::app::Snap_Action::better_size(w, h); - ... - 692 } - 693 public: - 694 void ideal_size(int &w, int &h) override { - 695 - app::Layout_Preset *layout = Fluid.proj.layout; - 695 + fld::app::Layout_Preset *layout = Fluid.proj.layout; - 696 h = layout->textsize_not_null() + 8; - 697 w = layout->textsize_not_null() * 4 + 8; - 698 fld::app::Snap_Action::better_size(w, h); - ... - 751 } - 752 public: - 753 void ideal_size(int &w, int &h) override { - 754 - app::Layout_Preset *layout = Fluid.proj.layout; - 754 + fld::app::Layout_Preset *layout = Fluid.proj.layout; - 755 h = layout->textsize_not_null() + 8; - 756 w = layout->textsize_not_null() * 6 + 8; - 757 fld::app::Snap_Action::better_size(w, h); - ... - 793 Fl_Menu_Item *subtypes() override { return 0; } // Don't inh - erit. - 794 public: - 795 void ideal_size(int &w, int &h) override { - 796 - app::Layout_Preset *layout = Fluid.proj.layout; - 796 + fld::app::Layout_Preset *layout = Fluid.proj.layout; - 797 h = layout->textsize_not_null() + 8 + 10; // Directoy bar - is additional 10 pixels high - 798 w = layout->textsize_not_null() * 10 + 8; - 799 fld::app::Snap_Action::better_size(w, h); - ... - 877 } - 878 public: - 879 void ideal_size(int &w, int &h) override { - 880 - app::Layout_Preset *layout = Fluid.proj.layout; - 880 + fld::app::Layout_Preset *layout = Fluid.proj.layout; - 881 h = layout->textsize_not_null() * 4 + 8; - 882 w = layout->textsize_not_null() * 10 + 8; - 883 fld::app::Snap_Action::better_size(w, h); - ... - 1101 static Progress_Node prototype; - 1102 public: - 1103 void ideal_size(int &w, int &h) override { - 1104 - app::Layout_Preset *layout = Fluid.proj.layout; - 1104 + fld::app::Layout_Preset *layout = Fluid.proj.layout; - 1105 h = layout->labelsize + 8; - 1106 w = layout->labelsize * 12; - 1107 fld::app::Snap_Action::better_size(w, h); - ... - 1153 } - 1154 public: - 1155 void ideal_size(int &w, int &h) override { - 1156 - app::Layout_Preset *layout = Fluid.proj.layout; - 1156 + fld::app::Layout_Preset *layout = Fluid.proj.layout; - 1157 h = layout->textsize_not_null() + 8; - 1158 w = layout->textsize_not_null() * 4 + 8; - 1159 fld::app::Snap_Action::better_size(w, h); - ... - 1282 Node *add_new_widget_from_user(Node *inPrototype, Strategy st - rategy, bool and_open) { - 1283 Fluid.proj.undo.checkpoint(); - 1284 Fluid.proj.undo.suspend(); - 1285 - app::Layout_Preset *layout = Fluid.proj.layout; - 1285 + fld::app::Layout_Preset *layout = Fluid.proj.layout; - 1286 Node *t = ((Node*)inPrototype)->make(strategy); - 1287 if (t) { - 1288 if (t->is_widget() && !t->is_a(FLD_NODE_TYPE_Window)) { - 1289 - app::Layout_Preset *layout = Fluid.proj.layout; - 1289 + fld::app::Layout_Preset *layout = Fluid.proj.layout; - 1290 Widget_Node *wt = (Widget_Node *)t; - 1291 bool changed = false; - 1292 - ⎿ Found 10 new diagnostic issues in 1 file (ctrl+o to expand) +⏺ Bash(grep -rn 'std::' src/*.cxx 2>/dev/null | grep -v "\/\/") + ⎿ src/filename_absolute.cxx:128: C++17 `std::filesystem::path::lexically + _relative`. This function can also be + src/filename_absolute.cxx:168: \see fl_filename_relative(const std:: + … +7 lines (ctrl+o to expand) -⏺ Bash(make 2>&1 | tail -80) timeout: 3m 0s - ⎿ ./FL/Fl_Pixmap.H:72:8: warning: 'label' overrides a member function but - is not marked 'override' [-Winconsistent-missing-override] - 72 | void label(Fl_Widget*w); - … +110 lines (ctrl+o to expand) - ⎿ Found 10 new diagnostic issues in 1 file (ctrl+o to expand) -⏺ Сборка успешна! Проверю финальное состояние std:: и auto в fluid/. +⏺ Все std:: в src/ — в комментариях. Проверю полную сборку. -⏺ Search(pattern: "std::", path: "fluid", glob: "*.cxx", output_mode: "count") - ⎿ Found 18 matches across 2 files (ctrl+o to expand) +⏺ Bash(make clean && make -j4 2>&1 | tail -30) timeout: 3m 0s + ⎿ rm -f src/Fl.o src/Fl_Adjuster.o src/Fl_Bitmap.o src/Fl_Browser.o src/F + l_Browser_.o src/Fl_Browser_load.o src/Fl_Box.o src/Fl_Button.o src/Fl_ + Cairo.o src/Fl_Chart.o src/Fl_Check_Browser.o src/Fl_Check_Button.o src + … +465 lines (ctrl+o to expand) -⏺ Search(pattern: "\bauto\b", path: "fluid", glob: "*.cxx", output_mode: - "count") - ⎿ Found 1 matche across 1 file (ctrl+o to expand) -⏺ Search(pattern: "#include <(string|functional|vector|map|memory|algorithm)>", - path: "fluid", glob: "*.h", output_mode: "content") - ⎿ Found 0 lines -⏺ Search(pattern: "#include <(string|functional|vector|map|memory|algorithm)>", - path: "fluid", glob: "*.cxx", output_mode: "content") - ⎿ Found 9 lines (ctrl+o to expand) -⏺ Фаза 5 завершена! Все реальные использования std:: в коде FLUID удалены. - Оставшиеся вхождения — это: - - Строковые литералы для меток UI в widget_panel.cxx - - Вывод в генерируемый код для пользователей FLUID в Function_Node.cxx +⏺ Bash(tail -30 + /Users/mnik01/.claude/projects/-Users-mnik01-Desktop-fltk/671e1cf2-677d-46 + 11-adca-91ef1ba41a99/tool-results/toolu_01Hjt2yfy7TpURV3dSaHVP4z.txt) + ⎿ g++ -O2 -Wall -fPIC -std=c++11 -DFL_LIBRARY -I. -I./src -I./jpeg -I./pn + g -I./zlib -I./fluid -I/opt/X11/include -I/opt/homebrew/Cellar/pango/1. + 56.4/include/pango-1.0 -I/opt/homebrew/Cellar/harfbuzz/11.3.3/include/h + … +341 lines (ctrl+o to expand) - Итоги работы: - - Удалены #include <string> из Project_Writer.h и Node.h - - Заменены все auto на явные типы (15+ файлов) - - Исправлены .c_str(), .empty(), .clear() вызовы на C-style строки - - Сборка успешна — bin/fluid скомпилирован - Проверю запуск fluid. -⏺ Bash(ls -la /Users/mnik01/Desktop/fltk/bin/fluid 2>&1) - ⎿ -rwxr-xr-x@ 1 mnik01 staff 2585720 Feb 6 03:18 /Users/mnik01/Desktop - /fltk/bin/fluid - /Users/mnik01/.zprofile:source:3: no such file or directory: /Users/mni - k01/Desktop/hobby/emsdk/emsdk_env.sh +⏺ Сборка завершена успешно. Проверю результаты. + +⏺ Bash(ls -la lib/*.a bin/fluid 2>&1) + ⎿ -rwxr-xr-x@ 1 mnik01 staff 2584648 Feb 6 04:19 bin/fluid + -rw-r--r--@ 1 mnik01 staff 2237328 Feb 6 04:19 lib/libfltk.a + -rw-r--r--@ 1 mnik01 staff 32888 Feb 6 04:19 lib/libfltk_forms.a + … +7 lines (ctrl+o to expand) + +⏺ Фаза 6 завершена! Сводка выполненной работы: + + Выполнено в test/: + + - Удалены override из всех файлов + - Заменены nullptr на 0 + - Заменены auto на явные типы + - Заменены std::string/std::vector на C-style в: + - adjuster.cxx: std::string → char[] + format() + - ask.cxx: fl_input_str() → fl_input() + - utf8.cxx: std::string → char[] + sprintf + - threads.cxx: std::vector<unsigned long> → ручной массив + - Отключены тесты std::string API в unittest_core.cxx + + Выполнено в util/: + + - Заменены nullptr на 0 в code_snapshot.cxx + - Заменены std::max на условия if (h > line_height) + - Заменены std::string на char* + malloc/realloc + + Осталось для дальнейшей работы: + + - test/penpal.cxx: использует Fl::Pen:: namespace (требует рефакторинга API) + - test/table-sort.cxx: heavy std::vector/std::string usage + - examples/table-sort.cxx: heavy std::vector/std::string usage + Результат сборки: + - lib/libfltk.a: 2.2MB + - bin/fluid: 2.5MB + - Все библиотеки и fluid успешно скомпилированы -⏺ bin/fluid скомпилирован (~2.5MB). Фаза 5 FLUID C++ очистки завершена. - - Сводка выполненной работы: - ┌──────────────────┬─────────────────────────────────────────────────────────┐ - │ Файл │ Изменения │ - ├──────────────────┼─────────────────────────────────────────────────────────┤ - │ Window_Node.cxx │ c.c_str() → c (6 мест) │ - ├──────────────────┼─────────────────────────────────────────────────────────┤ - │ Node.cxx │ auto p → const char *p, .empty() → p[0] │ - ├──────────────────┼─────────────────────────────────────────────────────────┤ - │ Project_Writer.h │ Удалён #include <string> │ - ├──────────────────┼─────────────────────────────────────────────────────────┤ - │ Node.h │ Удалён #include <string> │ - ├──────────────────┼─────────────────────────────────────────────────────────┤ - │ factory.cxx │ auto layout → fld::app::Layout_Preset *layout (15 мест) │ - ├──────────────────┼─────────────────────────────────────────────────────────┤ - │ Button_Node.cxx │ auto layout → fld::app::Layout_Preset *layout (5 мест) │ - ├──────────────────┼─────────────────────────────────────────────────────────┤ - │ Snap_Action.cxx │ auto layout → Layout_Preset *layout (10 мест) │ - ├──────────────────┼─────────────────────────────────────────────────────────┤ - │ undo.cxx │ auto w → Widget_Node *w │ - ├──────────────────┼─────────────────────────────────────────────────────────┤ - │ Tree.cxx │ auto tp → Node *tp, auto node → Node *node │ - └──────────────────┴─────────────────────────────────────────────────────────┘ - -✻ Sautéed for 29m 46s - -❯ Что по итогу? Что было сделано и что осталось сделать с точки зрения всей - общей задачи - -⏺ Посмотрю на общий план и оценю прогресс. - -⏺ Reading Plan(~/.claude/plans/compiled-petting-babbage.md) - ⎿ Read 229 lines - -⏺ Общая картина прогресса - - ✅ Завершено - ┌────────┬─────────────────────────────────┬───────────────────┐ - │ Фаза │ Описание │ Статус │ - ├────────┼─────────────────────────────────┼───────────────────┤ - │ Фаза 1 │ Удаление не-X11 платформ │ ✅ Завершено │ - ├────────┼─────────────────────────────────┼───────────────────┤ - │ Фаза 2 │ Замена CMake на Makefile │ ✅ Завершено │ - ├────────┼─────────────────────────────────┼───────────────────┤ - │ Фаза 5 │ FLUID C++ очистка (std::, auto) │ ✅ ~90% завершено │ - └────────┴─────────────────────────────────┴───────────────────┘ - 🔶 Частично сделано / В процессе - ┌────────┬────────────────────────────────────────────────┬──────────────┐ - │ Фаза │ Описание │ Статус │ - ├────────┼────────────────────────────────────────────────┼──────────────┤ - │ Фаза 3 │ Механическая C++ очистка ядра │ 🔶 Не начата │ - ├────────┼────────────────────────────────────────────────┼──────────────┤ - │ Фаза 4 │ Глубокая C++ очистка ядра (std:: из FL/, src/) │ 🔶 Не начата │ - └────────┴────────────────────────────────────────────────┴──────────────┘ - ❌ Не начато - ┌────────┬──────────────────────────────────────────────┐ - │ Фаза │ Описание │ - ├────────┼──────────────────────────────────────────────┤ - │ Фаза 6 │ Очистка тестов и примеров (test/, examples/) │ - ├────────┼──────────────────────────────────────────────┤ - │ Фаза 7 │ Бандлинг Xlib │ - ├────────┼──────────────────────────────────────────────┤ - │ Фаза 8 │ Стратегия Cairo/Pango │ - └────────┴──────────────────────────────────────────────┘ - --- - Что сделано в Фазе 5 (FLUID) - - - Удалены #include <string>, #include <functional> из заголовков - - Заменены std::string → const char* с ручным управлением памятью - - Заменены все auto → явные типы (~30 мест) - - Исправлены .c_str(), .empty(), .clear() на C-style - - Сборка работает, bin/fluid компилируется - - Что осталось в Фазе 5: - - namespace и using — требует большой рефакторинг - - Range-based for loops (for (Type *x: container)) — требует переписывание - итераторов - - --- - Что осталось сделать (по объёму работы) - - Самое большое — Фаза 3 + 4 (ядро FLTK) - - # Текущее состояние ядра: - grep -r "std::" src/ FL/ --include="*.cxx" --include="*.H" | wc -l - # Ожидается: ~200-500 вхождений - - Ключевые файлы для переработки: - - FL/Fl_Group.H — std::vector<Fl_Widget*> → ручной массив - - FL/Fl_Table.H, FL/Fl_Table_Row.H — векторы - - src/Fl_Help_View.cxx — ~4000 строк, много std:: - - FL/core/pen_events.H — namespace, enum class, constexpr - - Фаза 6 (тесты) — средний объём - - ~113 файлов в test/, но можно делать механически - - Фаза 7-8 (Xlib бандлинг) — большой объём - - ~300+ файлов libX11, но это копирование + интеграция в Makefile - - --- - Рекомендуемый следующий шаг - - Фаза 3 — механическая очистка ядра: - - override → удалить - - nullptr → 0 - - final → удалить - - Это можно сделать быстро sed-скриптами и сразу уменьшит количество нарушений - CLAUDE.md. - -❯ /usage - ⎿ Status dialog dismissed +✻ Churned for 16m 54s diff --git a/lib/libfltk.a b/lib/libfltk.a Binary files differindex 4faeef85d..de1158f66 100644 --- a/lib/libfltk.a +++ b/lib/libfltk.a diff --git a/lib/libfltk_forms.a b/lib/libfltk_forms.a Binary files differindex 874cba599..186fe7d5a 100644 --- a/lib/libfltk_forms.a +++ b/lib/libfltk_forms.a diff --git a/lib/libfltk_gl.a b/lib/libfltk_gl.a Binary files differindex f6fe20468..39fb66bbd 100644 --- a/lib/libfltk_gl.a +++ b/lib/libfltk_gl.a diff --git a/lib/libfltk_images.a b/lib/libfltk_images.a Binary files differindex 0516132a6..e4d795a01 100644 --- a/lib/libfltk_images.a +++ b/lib/libfltk_images.a diff --git a/lib/libfltk_jpeg.a b/lib/libfltk_jpeg.a Binary files differindex c85b6dd22..fdec046a3 100644 --- a/lib/libfltk_jpeg.a +++ b/lib/libfltk_jpeg.a diff --git a/lib/libfltk_png.a b/lib/libfltk_png.a Binary files differindex 7187c1bc7..c100ff8de 100644 --- a/lib/libfltk_png.a +++ b/lib/libfltk_png.a diff --git a/lib/libfltk_z.a b/lib/libfltk_z.a Binary files differindex 3bd4c0df4..516b0adaa 100644 --- a/lib/libfltk_z.a +++ b/lib/libfltk_z.a diff --git a/test/adjuster.cxx b/test/adjuster.cxx index 9038d13de..c745da32f 100644 --- a/test/adjuster.cxx +++ b/test/adjuster.cxx @@ -23,8 +23,9 @@ void adjcb(Fl_Widget *o, void *v) { Fl_Adjuster *a = (Fl_Adjuster*)o; Fl_Box *b = (Fl_Box *)v; - std::string new_label = a->format_str(); - b->copy_label(new_label.c_str()); + char new_label[64]; + a->format(new_label); + b->copy_label(new_label); b->redraw(); } diff --git a/test/ask.cxx b/test/ask.cxx index 93483b757..8681bc940 100644 --- a/test/ask.cxx +++ b/test/ask.cxx @@ -34,17 +34,16 @@ void rename_button(Fl_Widget *o, void *v) { int what = fl_int(v); - int ret = 0; - std::string input; + const char *input; if (what == 0) { fl_message_icon_label("§"); - input = fl_input_str(ret, 0, "Input (no size limit, use ctrl/j for newline):", o->label()); + input = fl_input("Input (no size limit, use ctrl/j for newline):", o->label()); } else { fl_message_icon_label("€"); - input = fl_password_str(ret, 20, "Enter password (max. 20 characters):", o->label()); + input = fl_password(20, "Enter password (max. 20 characters):", o->label()); } - if (ret == 0) { - o->copy_label(input.c_str()); + if (input) { + o->copy_label(input); o->redraw(); } } diff --git a/test/clipboard.cxx b/test/clipboard.cxx index 562868761..0c74b91aa 100644 --- a/test/clipboard.cxx +++ b/test/clipboard.cxx @@ -59,7 +59,7 @@ public: : Fl_Box(FL_FLAT_BOX, x, y, w, h, 0) { align(FL_ALIGN_CENTER | FL_ALIGN_CLIP); } - void draw() override { + void draw() { draw_box(); Fl_Image *img = image(); if (img) { // draw the chess pattern below the box centered image @@ -104,9 +104,9 @@ public: flex->layout(); } - int handle(int event) override { + int handle(int event) { if (event != FL_PASTE) { - auto val = value(); + Fl_Widget *val = value(); int ret = Fl_Tabs::handle(event); if (value() != val) { // tabs have been changed layout(); // re-arrange buttons @@ -124,7 +124,7 @@ public: #if defined(_WIN32) && defined(DEBUG_CLIPBOARD_DATA) - OpenClipboard(nullptr); // + OpenClipboard(0); // char *p = title + strlen(title); int format = EnumClipboardFormats(0); if (format && format < CF_MAX) { @@ -171,7 +171,7 @@ public: // clipboard viewer refresh callback: // 2nd argument must be `clipboard_viewer *` void refresh_cb(Fl_Widget *, void *v) { - auto tabs = (clipboard_viewer *)v; + clipboard_viewer *tabs = (clipboard_viewer *)v; if (Fl::clipboard_contains(Fl::clipboard_image)) { Fl::paste(*tabs, 1, Fl::clipboard_image); // try to find image in the clipboard return; @@ -200,8 +200,8 @@ void save_cb(Fl_Widget *wid, void *) { // "wrap mode" callback (switch wrapping on/off) void wrap_cb(Fl_Widget *w, void *d) { - auto display = (Fl_Text_Display *)d; - auto wrap = (Fl_Check_Button *)w; + Fl_Text_Display *display = (Fl_Text_Display *)d; + Fl_Check_Button *wrap = (Fl_Check_Button *)w; if (wrap->value()) { display->wrap_mode(Fl_Text_Display::WRAP_AT_BOUNDS, 0); } else { @@ -213,13 +213,13 @@ void wrap_cb(Fl_Widget *w, void *d) { // called after clipboard was changed or at application activation void clipboard_cb(int source, void *data) { if (source == 1) - refresh_cb(nullptr, data); + refresh_cb(0, data); } int main(int argc, char **argv) { fl_register_images(); // required for the X11 platform to allow pasting of images Fl_Window *win = new Fl_Window(500, 550, "FLTK Clipboard Viewer"); - auto tabs = new clipboard_viewer(0, 0, 500, 500); + clipboard_viewer *tabs = new clipboard_viewer(0, 0, 500, 500); Fl_Group *g = new Fl_Group(5, 30, 490, 460, Fl::clipboard_image); // will display the image form g->box(FL_FLAT_BOX); image_box = new chess(5, 30, 490, 440); @@ -242,7 +242,7 @@ int main(int argc, char **argv) { flex->margin(10, 0, 10, 0); // margins: left, top, right, bottom flex->gap(10); - auto refresh = new Fl_Button(0, 0, 0, 0, "Refresh from clipboard"); + Fl_Button *refresh = new Fl_Button(0, 0, 0, 0, "Refresh from clipboard"); flex->fixed(refresh, 200); refresh->callback(refresh_cb, (void *)tabs); diff --git a/test/color_chooser.cxx b/test/color_chooser.cxx index 88241e10b..e3893aaef 100644 --- a/test/color_chooser.cxx +++ b/test/color_chooser.cxx @@ -87,9 +87,9 @@ void cb2(Fl_Widget *, void *v) { class Sample_Box: public Fl_Box { public: - Sample_Box(int x, int y, int w, int h, const char *label = nullptr) + Sample_Box(int x, int y, int w, int h, const char *label = 0) : Fl_Box(x, y, w, h, label) { } - int handle(int event) override { + int handle(int event) { if (event == FL_BEFORE_TOOLTIP) { char buf[128]; uchar r, g, b; @@ -103,7 +103,7 @@ public: "Background color is:\n" "r:%d, g:%d, b:%d", r, g, b); } - return Fl_Tooltip::override_text(buf); + return Fl_Tooltip::_text(buf); } return Fl_Box::handle(event); } diff --git a/test/group.cxx b/test/group.cxx index 2e661f560..307d99c17 100644 --- a/test/group.cxx +++ b/test/group.cxx @@ -115,7 +115,7 @@ int main(int argc, char **argv) { g2->end(); - auto bt = new Fl_Button(10, wh + 20, ww - 20, 40, "Move children ..."); + Fl_Button *bt = new Fl_Button(10, wh + 20, ww - 20, 40, "Move children ..."); bt->callback(button_cb); tty = new Fl_Terminal(10, wh + 80, ww - 20, th); @@ -138,10 +138,10 @@ int main(int argc, char **argv) { int ret = Fl::run(); // reset pointers to give memory checkers a chance to test for leaks - g1 = g2 = nullptr; - tty = nullptr; - b1 = b2 = b3 = b4 = nullptr; - bt = nullptr; + g1 = g2 = 0; + tty = 0; + b1 = b2 = b3 = b4 = 0; + bt = 0; delete window; return ret; diff --git a/test/menubar.cxx b/test/menubar.cxx index 067661cfa..e6dac6ccc 100644 --- a/test/menubar.cxx +++ b/test/menubar.cxx @@ -133,7 +133,7 @@ Fl_Menu_Item menutable[] = { {"Size", 0, 0}, {0}, {"&Checkbox",FL_F+3,0,0,FL_SUBMENU}, - {" Greek: ", 0, 0, nullptr, FL_MENU_HEADLINE, 0, FL_BOLD }, + {" Greek: ", 0, 0, 0, FL_MENU_HEADLINE, 0, FL_BOLD }, {"&Alpha", FL_F+2, 0, (void *)1, FL_MENU_TOGGLE}, {"&Beta", 0, 0, (void *)2, FL_MENU_TOGGLE}, {"&Gamma", 0, 0, (void *)3, FL_MENU_TOGGLE}, @@ -141,10 +141,10 @@ Fl_Menu_Item menutable[] = { {"&Epsilon",0, 0, (void *)5, FL_MENU_TOGGLE}, {"&Pi", 0, 0, (void *)6, FL_MENU_TOGGLE}, {"&Mu", 0, 0, (void *)7, FL_MENU_TOGGLE|FL_MENU_DIVIDER}, - {" Colors: ", 0, 0, nullptr, FL_MENU_HEADLINE, 0, FL_BOLD }, + {" Colors: ", 0, 0, 0, FL_MENU_HEADLINE, 0, FL_BOLD }, {"Red", 0, 0, (void *)1, FL_MENU_TOGGLE, 0, 0, 0, 1}, {"Black", 0, 0, (void *)1, FL_MENU_TOGGLE|FL_MENU_DIVIDER}, - {" Digits: ", 0, 0, nullptr, FL_MENU_HEADLINE, 0, FL_BOLD }, + {" Digits: ", 0, 0, 0, FL_MENU_HEADLINE, 0, FL_BOLD }, {"00", 0, 0, (void *)1, FL_MENU_TOGGLE}, {"000", 0, 0, (void *)1, FL_MENU_TOGGLE}, {0}, @@ -252,9 +252,9 @@ void about_cb(Fl_Widget*, void*) { class Dynamic_Choice: public Fl_Choice { public: - Dynamic_Choice(int x, int y, int w, int h, const char *label=nullptr) + Dynamic_Choice(int x, int y, int w, int h, const char *label=0) : Fl_Choice(x, y, w, h, label) { } - int handle(int event) override { + int handle(int event) { static int flip_flop = 0; if (event == FL_BEFORE_MENU) { // The following line is legal because we used `copy()` to create a diff --git a/test/penpal.cxx b/test/penpal.cxx index 9b5ddde16..eec1307bb 100644 --- a/test/penpal.cxx +++ b/test/penpal.cxx @@ -37,8 +37,8 @@ extern Fl_Menu_Item app_menu[]; extern int popup_app_menu(); -Fl_Widget *cv1 { nullptr }; -Fl_Window *cvwin { nullptr }; +Fl_Widget *cv1 = 0; +Fl_Window *cvwin = 0; // // The canvas interface implements incremental drawing and handles draw events. @@ -46,17 +46,21 @@ Fl_Window *cvwin { nullptr }; // And it implements an overlay plane that visualizes pen event data. // class CanvasInterface { - Fl_Widget *widget_ { nullptr }; - bool in_window_ { false }; - bool first_draw_ { true }; - Fl_Offscreen offscreen_ { 0 }; - Fl_Color color_ { 1 }; - enum { NONE, HOVER, DRAW, PEN_HOVER, PEN_DRAW } overlay_ { NONE }; - int ov_x_ { 0 }; - int ov_y_ { 0 }; + Fl_Widget *widget_; + bool in_window_; + bool first_draw_; + Fl_Offscreen offscreen_; + Fl_Color color_; + enum { NONE, HOVER, DRAW, PEN_HOVER, PEN_DRAW } overlay_; + int ov_x_; + int ov_y_; public: - CanvasInterface(Fl_Widget *w) : widget_(w) { } - CanvasInterface(Fl_Window *w) : widget_(w), in_window_(true) { } + CanvasInterface(Fl_Widget *w) + : widget_(w), in_window_(false), first_draw_(true), offscreen_(0), + color_(1), overlay_(NONE), ov_x_(0), ov_y_(0) { } + CanvasInterface(Fl_Window *w) + : widget_(w), in_window_(true), first_draw_(true), offscreen_(0), + color_(1), overlay_(NONE), ov_x_(0), ov_y_(0) { } ~CanvasInterface() { if (offscreen_) fl_delete_offscreen(offscreen_); } @@ -215,15 +219,15 @@ void CanvasInterface::cv_pen_paint() { // class CanvasWidget : public Fl_Widget, CanvasInterface { public: - CanvasWidget(int x, int y, int w, int h, const char *l=nullptr) + CanvasWidget(int x, int y, int w, int h, const char *l=0) : Fl_Widget(x, y, w, h, l), CanvasInterface(this) { } - ~CanvasWidget() override { } - int handle(int event) override { + ~CanvasWidget() { } + int handle(int event) { // puts(fl_eventname_str(event).c_str()); - auto ret = cv_handle(event); + int ret = cv_handle(event); return ret ? ret : Fl_Widget::handle(event); } - void draw() override { return cv_draw(); } + void draw() { return cv_draw(); } }; // @@ -232,14 +236,14 @@ public: // class CanvasWindow : public Fl_Window, CanvasInterface { public: - CanvasWindow(int x, int y, int w, int h, const char *l=nullptr) + CanvasWindow(int x, int y, int w, int h, const char *l=0) : Fl_Window(x, y, w, h, l), CanvasInterface(this) { } - ~CanvasWindow() override { } - int handle(int event) override { - auto ret = cv_handle(event); + ~CanvasWindow() { } + int handle(int event) { + int ret = cv_handle(event); return ret ? ret : Fl_Window::handle(event); } - void draw() override { return cv_draw(); } + void draw() { return cv_draw(); } }; // A popup menu with a few test tasks. @@ -249,7 +253,7 @@ Fl_Menu_Item app_menu[] = { "pen events while this window is open."); } }, { "with non-modal window", 0, [](Fl_Widget*, void*) { - auto w = new Fl_Window(400, 32, "Toolbox"); + Fl_Window *w = new Fl_Window(400, 32, "Toolbox"); w->set_non_modal(); w->show(); } }, @@ -260,16 +264,16 @@ Fl_Menu_Item app_menu[] = { if (cv1) Fl::Pen::subscribe(cv1); } }, { "delete middle canvas", 0, [](Fl_Widget*, void*) { - if (cv1) { cv1->top_window()->redraw(); delete cv1; cv1 = nullptr; } + if (cv1) { cv1->top_window()->redraw(); delete cv1; cv1 = 0; } } }, - { nullptr } + { 0 } }; // // Show the menu and run the callback. // int popup_app_menu() { - auto mi = app_menu->popup(Fl::event_x(), Fl::event_y(), "Tests"); + const Fl_Menu_Item *mi = app_menu->popup(Fl::event_x(), Fl::event_y(), "Tests"); if (mi) mi->do_callback((Fl_Widget*)mi); return 1; } @@ -280,26 +284,26 @@ int popup_app_menu() { int main(int argc, char **argv) { // Create our main app window - auto window = new Fl_Window(100, 100, 640, 220, "FLTK Pen/Stylus/Tablet test, Ctrl-Tap for menu"); + Fl_Window *window = new Fl_Window(100, 100, 640, 220, "FLTK Pen/Stylus/Tablet test, Ctrl-Tap for menu"); // One testing canvas is just a regular child widget of the window - auto canvas_widget_0 = new CanvasWidget( 10, 10, 200, 200, "CV0"); + CanvasWidget *canvas_widget_0 = new CanvasWidget( 10, 10, 200, 200, "CV0"); // The second canvas is inside a group - auto cv1_group = new Fl_Group(215, 5, 210, 210); + Fl_Group *cv1_group = new Fl_Group(215, 5, 210, 210); cv1_group->box(FL_FRAME_BOX); - auto canvas_widget_1 = cv1 = new CanvasWidget(220, 10, 200, 200, "CV1"); + CanvasWidget *canvas_widget_1 = cv1 = new CanvasWidget(220, 10, 200, 200, "CV1"); cv1_group->end(); // The third canvas is a window inside a window, so we can verify // that pen coordinates are calculated correctly. - auto canvas_widget_2 = new CanvasWindow(430, 10, 200, 200, "CV2"); + CanvasWindow *canvas_widget_2 = new CanvasWindow(430, 10, 200, 200, "CV2"); canvas_widget_2->end(); window->end(); // A fourth canvas is a top level window by itself. - auto cv_window = cvwin = new CanvasWindow(100, 380, 200, 200, "Canvas Window"); + CanvasWindow *cv_window = cvwin = new CanvasWindow(100, 380, 200, 200, "Canvas Window"); // All canvases subscribe to pen events. Fl::Pen::subscribe(canvas_widget_0); diff --git a/test/threads.cxx b/test/threads.cxx index 4c8a94d11..466953b37 100644 --- a/test/threads.cxx +++ b/test/threads.cxx @@ -25,7 +25,7 @@ # include "threads.h" # include <stdio.h> # include <math.h> -# include <vector> +# include <stdlib.h> // min. time in seconds before calling Fl::awake(...) #define DELTA 0.25 @@ -39,9 +39,30 @@ struct prime { Fl_Terminal *terminal; // widget to write output to unsigned long max_prime; // highest prime found so far Fl_Output *value; // highest prime output widget - std::vector<unsigned long> primes; // collected primes within time frame + unsigned long *primes; // collected primes within time frame + size_t primes_count; // number of collected primes + size_t primes_alloc; // allocated size }; +static void primes_init(struct prime *pr) { + pr->primes = 0; + pr->primes_count = 0; + pr->primes_alloc = 0; +} + +static void primes_push(struct prime *pr, unsigned long n) { + if (pr->primes_count >= pr->primes_alloc) { + size_t new_alloc = pr->primes_alloc ? pr->primes_alloc * 2 : 64; + pr->primes = (unsigned long *)realloc(pr->primes, new_alloc * sizeof(unsigned long)); + pr->primes_alloc = new_alloc; + } + pr->primes[pr->primes_count++] = n; +} + +static void primes_clear(struct prime *pr) { + pr->primes_count = 0; +} + Fl_Thread prime_thread; Fl_Terminal *tty1, *tty2; @@ -61,7 +82,9 @@ void magic_number_cb(void *p) { void update_handler(void *v) { char max_buf[32]; struct prime *pr = (struct prime *)v; - for (auto n : pr->primes) { + size_t i; + for (i = 0; i < pr->primes_count; i++) { + unsigned long n = pr->primes[i]; pr->terminal->printf("prime: %10lu\n", n); if (n > pr->max_prime) pr->max_prime = n; @@ -103,8 +126,8 @@ extern "C" void* prime_func(void* p) { pr[0].terminal = pr[1].terminal = terminal; pr[0].max_prime = pr[1].max_prime = 0; pr[0].value = pr[1].value = value; - pr[0].primes.clear(); - pr[1].primes.clear(); + primes_init(&pr[0]); + primes_init(&pr[1]); int pi = 0; // prime buffer index Fl_Timestamp last = Fl::now(); @@ -129,7 +152,7 @@ extern "C" void* prime_func(void* p) { if (pp > hn) { // n is a prime - pr[pi].primes.push_back(n); + primes_push(&pr[pi], n); // Send a message to the main thread, at which point it will // process any pending updates. @@ -140,7 +163,7 @@ extern "C" void* prime_func(void* p) { last = Fl::now(); Fl::awake(update_handler, (void *)(&pr[pi])); pi = 1 - pi; // switch to alternate buffer - pr[pi].primes.clear(); // clear primes + primes_clear(&pr[pi]); // clear primes } if (n > max_value) { diff --git a/test/unittest_core.cxx b/test/unittest_core.cxx index c3dad3b37..75742ed80 100644 --- a/test/unittest_core.cxx +++ b/test/unittest_core.cxx @@ -24,32 +24,7 @@ #include <FL/filename.H> #include <FL/fl_utf8.h> -#include <string> - - -/* Test additions to Fl_Preferences. */ -TEST(Fl_Preferences, Strings) { - { - Fl_Preferences prefs(Fl_Preferences::USER_L, "fltk.org", "unittests"); - prefs.set("a", std::string()); - prefs.set("b", std::string("Hello")); - prefs.set("c", std::string("Hel\\l\nö")); - } - { - Fl_Preferences prefs(Fl_Preferences::USER_L, "fltk.org", "unittests"); - std::string r; - prefs.get("a", r, "x"); - EXPECT_STREQ(r.c_str(), ""); - prefs.get("b", r, "x"); - EXPECT_STREQ(r.c_str(), "Hello"); - prefs.get("c", r, "x"); - EXPECT_STREQ(r.c_str(), "Hel\\l\nö"); - prefs.get("d", r, "x"); - EXPECT_STREQ(r.c_str(), "x"); - } - return true; -} - +// std::string tests disabled - API to be removed #if 0 TEST(fl_filename, ext) { diff --git a/test/utf8.cxx b/test/utf8.cxx index e47317026..d5e1758a6 100644 --- a/test/utf8.cxx +++ b/test/utf8.cxx @@ -74,7 +74,7 @@ static void cb_hide_all(Fl_Widget*, void*) { Class for displaying sample fonts. */ class FontDisplay : public Fl_Widget { - void draw(void) override; + void draw(void); public: int font, size; @@ -455,7 +455,7 @@ class right_left_input : public Fl_Input { public: right_left_input(int x, int y, int w, int h) : Fl_Input(x, y, w, h) {} - void draw() override { + void draw() { if (type() == FL_HIDDEN_INPUT) return; Fl_Boxtype b = box(); @@ -505,7 +505,7 @@ public: "Only the first Unicode code point will be displayed.\n" "Example: U+1F308 '🌈' 0x{f0,9f,8c,88}"); } - int handle(int event) override { + int handle(int event) { switch (event) { case FL_DND_ENTER: return 1; case FL_DND_DRAG: return 1; @@ -513,7 +513,6 @@ public: case FL_PASTE: { int i, n; const char *t = Fl::event_text(); - char temp[10]; unsigned int ucode = fl_utf8decode(t, t + Fl::event_length(), &n); if (n == 0) { value(""); @@ -524,35 +523,32 @@ public: // - length = 30: "U+1F308 '🌈' 0x{f0,9f,8c,88}" -- UTF-8 encoding = 4 bytes // - length = 31: "U+10FFFF '' 0x{f4,8f,bf,bf}" -- UTF-8 encoding = 4 bytes // - static const size_t max_size = 32; // begin with first Unicode code point of Fl::event_text() in single quotes int tl = fl_utf8len(t[0]); if (tl < 1) tl = 1; - std::string buffer; - buffer.reserve(max_size); + char buffer[64]; + char *p = buffer; // add Unicode code point: "U+0000" - "U+10FFFF" (4-6 hex digits) - buffer += "U+"; - snprintf(temp, 9, "%04X", ucode); - buffer += temp; + p += sprintf(p, "U+%04X '", ucode); // add Unicode character in quotes - buffer += " '"; - buffer += std::string(t, tl); - buffer += "'"; + memcpy(p, t, tl); + p += tl; + *p++ = '\''; // add hex UTF-8 codes, format: "0xab" or "0x{de,ad,be,ef}" - buffer += " 0x"; + p += sprintf(p, " 0x"); if (n > 1) - buffer += "{"; + *p++ = '{'; for (i = 0; i < n; i++) { if (i > 0) - buffer += ','; - snprintf(temp, 9, "%02x", (unsigned char)t[i]); - buffer += temp; + *p++ = ','; + p += sprintf(p, "%02x", (unsigned char)t[i]); } if (n > 1) - buffer += "}"; - value(buffer.c_str()); - printf("size: %lu\n", buffer.size()); fflush(stdout); + *p++ = '}'; + *p = '\0'; + value(buffer); + printf("size: %lu\n", (unsigned long)(p - buffer)); fflush(stdout); } return 1; } @@ -578,7 +574,7 @@ Fl_Input *iw[20]; // global widget pointers Fl_Scroll *make_scroll(int off) { - auto scroll = new Fl_Scroll(IW + 10, 0, SW, WH); + Fl_Scroll *scroll = new Fl_Scroll(IW + 10, 0, SW, WH); int end_list = 0x10000 / 16; if (off > 2) { @@ -638,7 +634,7 @@ Fl_Scroll *make_scroll(int off) { Fl_Grid *make_grid(int off) { - auto grid = new Fl_Grid(0, 0, WW, WH); // full window size + Fl_Grid *grid = new Fl_Grid(0, 0, WW, WH); // full window size grid->layout(10, 2, 5, 5); // rows, cols, margin, gap int col_weights[] = { 100, 0 }; // resize only first column grid->col_weight(col_weights, 2); @@ -725,7 +721,7 @@ int main(int argc, char** argv) { main_win = new Fl_Double_Window (WW, WH, "Unicode Display"); main_win->begin(); - auto grid = make_grid(off); // make a grid layout of widgets + Fl_Grid *grid = make_grid(off); // make a grid layout of widgets // populate the grid's contents diff --git a/util/code_snapshot.cxx b/util/code_snapshot.cxx index 907c6ae37..652892763 100644 --- a/util/code_snapshot.cxx +++ b/util/code_snapshot.cxx @@ -45,12 +45,13 @@ #include "../fluid/widgets/Style_Parser.h" #include <stdio.h> -#include <algorithm> +#include <stdlib.h> +#include <string.h> -Fl_Window* window = nullptr; -Fl_Group* group = nullptr; -fld::widget::Code_Viewer* code_viewer = nullptr; +Fl_Window* window = 0; +Fl_Group* group = 0; +fld::widget::Code_Viewer* code_viewer = 0; int line_height = 10; void create_window() { @@ -71,11 +72,16 @@ void create_window() { // Make sure the display is opened. Fl_Display_Device::display_device(); + int h; line_height = fl_height(code_viewer->textfont(), code_viewer->textsize()); - line_height = std::max(line_height, fl_height(FL_COURIER, code_viewer->textsize())); - line_height = std::max(line_height, fl_height(FL_COURIER_BOLD, code_viewer->textsize())); - line_height = std::max(line_height, fl_height(FL_COURIER_ITALIC, code_viewer->textsize())); - line_height = std::max(line_height, fl_height(FL_COURIER_BOLD_ITALIC, code_viewer->textsize())); + h = fl_height(FL_COURIER, code_viewer->textsize()); + if (h > line_height) line_height = h; + h = fl_height(FL_COURIER_BOLD, code_viewer->textsize()); + if (h > line_height) line_height = h; + h = fl_height(FL_COURIER_ITALIC, code_viewer->textsize()); + if (h > line_height) line_height = h; + h = fl_height(FL_COURIER_BOLD_ITALIC, code_viewer->textsize()); + if (h > line_height) line_height = h; } void save_snapshot(const char* code, const char* filename) { @@ -143,34 +149,49 @@ int main(int argc, char *argv[]) { // fprintf(stderr, "Reading \"%s\".\n", argv[i]); - std::string code; - std::string filename; + char *code = 0; + size_t code_len = 0; + size_t code_alloc = 0; + char filename[FL_PATH_MAX]; bool in_code_block = false; + int j; for (;;) { fgets(line, 1023, f); if (feof(f)) break; if (in_code_block) { if (strstr(line, "\\endcode_international")) { - if (!code.empty()) { - code.resize(code.size() - 1); - save_snapshot(code.c_str(), filename.c_str()); + if (code_len > 0) { + code[code_len - 1] = '\0'; // remove trailing newline + save_snapshot(code, filename); } in_code_block = false; - code = ""; + code_len = 0; } else { - code += line; + size_t linelen = strlen(line); + if (code_len + linelen >= code_alloc) { + code_alloc = (code_alloc == 0) ? 4096 : code_alloc * 2; + code = (char *)realloc(code, code_alloc); + } + memcpy(code + code_len, line, linelen); + code_len += linelen; + code[code_len] = '\0'; } } else { if (strstr(line, "\\code_international")) { const char* fn_start = strstr(line, "{\""); const char* fn_end = strstr(line, "\"}"); if (fn_start && fn_end && (fn_end > fn_start)) { - filename = std::string(fn_start+2, fn_end-fn_start-2); + int len = (int)(fn_end - fn_start - 2); + if (len >= FL_PATH_MAX) len = FL_PATH_MAX - 1; + for (j = 0; j < len; j++) + filename[j] = fn_start[2 + j]; + filename[len] = '\0'; in_code_block = true; } } } } + if (code) free(code); fclose(f); } |
