From 754aa478186aaa3aff949cf5e1175ba1ee4a9f53 Mon Sep 17 00:00:00 2001 From: Aleksey Rakov Date: Sat, 15 Mar 2025 15:10:23 +0100 Subject: [PATCH 1/2] Iteration 37 (#711) * Iteration37 (#710) * [ADDED] CORE_MATH_TABLE core table * [ADDED] ppc64le : fexp * [ADDED] aarch64 : fexp * [FIXED]linux ide - compile the project * [FIXED] ide linux - displaying text * [ADDED] ppc64le : fln * [ADDED] Linux - open a file * working on #283 : unboxing duplicate object * working on xforms - supporting RadioButtonGroup * [ADDED] xforms : supporting RadioButton, Panel * [ADDED] API : forms'Combobox * [SM][ADDED] supporting $regex rules * supporting \d regex symbol * upndown - fixing an error with selecting radio button group before the control is created * [ADDED] aarch64 : fln * [IDE] Linux - set focus on activate * [ADDED] #708 : introducing macos subversion * #708 : introduce macOs elc version, dummy macholinker * reoginizing linux configuration to compile the library to lib60, instead of directly to \usr\... * #34 : introducing HttpClient draft * fixing net library --- .github/FUNDING.yml | 3 +- CHANGELOG.md | 7 + README.md | 10 + VERSION | 2 +- asm/aarch64/core60.asm | 273 ++++++- asm/amd64/core60.asm | 7 + asm/ppc64le/core60.asm | 252 +++++++ asm/x32/core60.asm | 7 + ...al.elc60.config.bak => local.elc60.config} | 0 bin/scripts/xforms60.es | 192 ++++- bin/templates/lib60.config | 2 - bin/templates/local.lib60.config | 6 - build/aarch64/build_package_arm64.script | 30 +- build/aarch64/control | 2 +- build/amd64/build_package_amd64.script | 30 +- build/amd64/control | 2 +- build/create_package_x86.bat | 8 + build/elena_inno.iss | 6 +- build/i386/build_package_i386.script | 30 +- build/i386/control | 2 +- build/ppc64le/build_package_ppc64le.script | 30 +- build/ppc64le/control | 2 +- doc/features | 17 + doc/todo.txt | 86 +-- elenasrc3/common/lists.h | 2 +- elenasrc3/common/streams.h | 6 +- elenasrc3/common/tree.h | 6 +- elenasrc3/elc/cliconst.h | 2 +- elenasrc3/elc/codeblocks/elc_mac_arm64.mak | 146 ++++ elenasrc3/elc/compiler.cpp | 258 ++++++- elenasrc3/elc/compiler.h | 35 +- elenasrc3/elc/compiling.cpp | 118 ++- elenasrc3/elc/compiling.h | 7 + elenasrc3/elc/linux/elc.cpp | 277 ++++--- elenasrc3/elc/linux/elfarmimage.h | 4 +- elenasrc3/elc/macos/elc.cpp | 251 ++++++ elenasrc3/elc/macos/machoarmimage.cpp | 11 + elenasrc3/elc/macos/machoarmimage.h | 45 ++ elenasrc3/elc/macos/machoarmlinker64.cpp | 11 + elenasrc3/elc/macos/machoarmlinker64.h | 30 + elenasrc3/elc/macos/machoimage.cpp | 22 + elenasrc3/elc/macos/machoimage.h | 78 ++ elenasrc3/elc/macos/macholinker.cpp | 17 + elenasrc3/elc/macos/macholinker.h | 33 + elenasrc3/elc/macos/macholinker64.cpp | 11 + elenasrc3/elc/macos/macholinker64.h | 30 + elenasrc3/elc/windows/elc.cpp | 108 +-- elenasrc3/elenart/rtcommon.h | 2 +- elenasrc3/elenasm/cfparser.cpp | 205 ++--- elenasrc3/elenasm/cfparser.h | 25 +- elenasrc3/elenasm/regex.cpp | 416 ++++++++++ elenasrc3/elenasm/regex.h | 431 +++++++++++ elenasrc3/elenasm/smcommon.h | 4 +- elenasrc3/elenasm/vs/elenasm.vcxproj | 2 + elenasrc3/engine/core.h | 3 +- elenasrc3/engine/elena.h | 8 + elenasrc3/engine/elenaconst.h | 4 +- elenasrc3/engine/elenamachine.cpp | 1 - elenasrc3/engine/gcroutines.cpp | 2 +- elenasrc3/engine/jitcompiler.cpp | 9 +- elenasrc3/engine/langcommon.h | 4 + elenasrc3/engine/libman.cpp | 2 + elenasrc3/engine/linux/presenter.cpp | 2 +- elenasrc3/engine/linux/presenter.h | 2 +- elenasrc3/engine/projectbase.h | 2 + elenasrc3/engine/rtmanager.cpp | 2 +- elenasrc3/engine/windows/presenter.cpp | 21 +- elenasrc3/gui/gtklinux/gtkcommon.cpp | 3 +- elenasrc3/gui/gtklinux/gtkcommon.h | 73 +- elenasrc3/gui/gtklinux/gtkgraphic.h | 57 +- elenasrc3/gui/gtklinux/gtktabbar.cpp | 24 +- elenasrc3/gui/gtklinux/gtktabbar.h | 4 +- elenasrc3/gui/gtklinux/gtktextframe.cpp | 7 +- elenasrc3/gui/gtklinux/gtktextframe.h | 4 +- elenasrc3/gui/gtklinux/gtktextview.cpp | 65 +- elenasrc3/gui/gtklinux/gtktextview.h | 14 +- elenasrc3/gui/text.h | 3 +- elenasrc3/ide/codeblocks/elide_gtk.cbp | 4 + elenasrc3/ide/eng/messages.h | 2 +- elenasrc3/ide/gtklinux/factory.cpp | 30 +- elenasrc3/ide/gtklinux/factory.h | 15 + elenasrc3/ide/gtklinux/gtkdialogs.cpp | 714 ++++++++++++++++++ elenasrc3/ide/gtklinux/gtkdialogs.h | 240 ++++++ elenasrc3/ide/gtklinux/gtkide.cpp | 41 +- elenasrc3/ide/gtklinux/gtkide.h | 16 +- elenasrc3/ide/gtklinux/gtkidetextview.cpp | 37 + elenasrc3/ide/gtklinux/gtkidetextview.h | 26 + elenasrc3/ide/gtklinux/textframe.cpp | 0 elenasrc3/ide/ideversion.h | 2 +- elenasrc3/tools/asmc/armassembler.cpp | 30 +- elenasrc3/tools/asmc/armassembler.h | 3 +- elenasrc3/tools/asmc/asmconst.h | 2 +- elenasrc3/tools/asmc/assembler.cpp | 5 +- elenasrc3/tools/asmc/assembler.h | 3 +- elenasrc3/tools/asmc/ppc64assembler.cpp | 16 +- elenasrc3/tools/asmc/ppc64assembler.h | 3 +- elenasrc3/tools/asmc/x86assembler.cpp | 7 +- elenasrc3/tools/asmc/x86assembler.h | 3 +- examples60/gui/helloworld/helloworld.xs | 2 +- recompile60.mac.sh | 1 + src60/core/system.core_routines.esm | 22 + src60/elena_api.linux.prjcol | 7 + ...xtensions.project => extensions.linux.prj} | 0 src60/forms/forms.prj | 2 +- src60/forms/win32_controls.l | 72 +- .../{ltests.project => ltests.linux.prj} | 0 src60/net/http/common.l | 19 +- src60/net/http/httpclient.l | 44 ++ src60/net/http/httpheaders.l | 23 + src60/net/http/httpresponse.l | 17 + src60/net/net.prj | 4 +- src60/system/io/lnx_files.l | 32 + src60/system/net/networkstream.l | 87 ++- src60/system/net/win_sockets.l | 99 ++- src60/system/pointers.l | 34 +- .../{system.project => system.linux.prj} | 10 +- src60/system/text/parsing/regex.l | 6 +- src60/system/winforms/win_common.l | 4 + src60/system/winforms/win_controls.l | 1 + tests60/sandbox/sandbox.l | 76 +- tests60/system_tests/basic.l | 26 +- tests60/system_tests/system_tests.prj | 20 + tests60/system_tests/system_tests.project | 32 - 123 files changed, 4886 insertions(+), 868 deletions(-) rename bin/{local.elc60.config.bak => local.elc60.config} (100%) create mode 100644 elenasrc3/elc/codeblocks/elc_mac_arm64.mak create mode 100644 elenasrc3/elc/macos/elc.cpp create mode 100644 elenasrc3/elc/macos/machoarmimage.cpp create mode 100644 elenasrc3/elc/macos/machoarmimage.h create mode 100644 elenasrc3/elc/macos/machoarmlinker64.cpp create mode 100644 elenasrc3/elc/macos/machoarmlinker64.h create mode 100644 elenasrc3/elc/macos/machoimage.cpp create mode 100644 elenasrc3/elc/macos/machoimage.h create mode 100644 elenasrc3/elc/macos/macholinker.cpp create mode 100644 elenasrc3/elc/macos/macholinker.h create mode 100644 elenasrc3/elc/macos/macholinker64.cpp create mode 100644 elenasrc3/elc/macos/macholinker64.h create mode 100644 elenasrc3/elenasm/regex.cpp create mode 100644 elenasrc3/elenasm/regex.h create mode 100644 elenasrc3/ide/gtklinux/gtkdialogs.cpp create mode 100644 elenasrc3/ide/gtklinux/gtkdialogs.h create mode 100644 elenasrc3/ide/gtklinux/gtkidetextview.cpp create mode 100644 elenasrc3/ide/gtklinux/gtkidetextview.h create mode 100644 elenasrc3/ide/gtklinux/textframe.cpp create mode 100644 recompile60.mac.sh create mode 100644 src60/elena_api.linux.prjcol rename src60/extensions/{extensions.project => extensions.linux.prj} (100%) rename src60/ltests/{ltests.project => ltests.linux.prj} (100%) create mode 100644 src60/net/http/httpheaders.l create mode 100644 src60/net/http/httpresponse.l rename src60/system/{system.project => system.linux.prj} (95%) delete mode 100644 tests60/system_tests/system_tests.project diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index af19cc93dc..7115c51f58 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -3,10 +3,9 @@ github: [arakov] patreon: elena_lang open_collective: # Replace with a single Open Collective username -ko_fi: https://buymeacoffee.com/elenaproglang +ko_fi: elenaprolang tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel community_bridge: # elena-lang liberapay: # Replace with a single Liberapay username issuehunt: # Replace with a single IssueHunt username otechie: # Replace with a single Otechie username -custom: https://paypal.me/elenaprolang diff --git a/CHANGELOG.md b/CHANGELOG.md index 117a86f8c8..2f4f6695ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## ELENA 6.6.0 +- ELENA + - [ADDED] user defined type alias + - ELC - [ADDED] new option "-xj" to turn on jump alignment - [ADDED] if:nil / if:not:nil / if:not template statements @@ -19,6 +22,7 @@ - [FIXED] ppc64le extopen / extclose opcode - [FIXED] #704 : Porting to FreeBSD/PowerPC64 - [FIXED] aarch64 extopen / extclose opcode + - [FIXED] #283 : unboxing duplicate object - API - [ADDED] net'http'HttpClient, net'http'Uri @@ -33,6 +37,9 @@ - IDE - [FIXED]debugger : step over multi-select statement +- Tools + - [ADDED][LDOC] static methods are in the separate category + ## ELENA 6.5.0 - ELENA diff --git a/README.md b/README.md index 7e6aa69f2a..bebda041e8 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,10 @@ ELENA is a general-purpose language with late binding. It is multi-paradigm, com - **Windows** : x86 (32-bit) / x86-64 (64-bit) - **Linux** : x86 (32-bit) / x86-64 (64-bit) / ppc64le / arm64 (a64) +## Platforms to be supported + +- **macOS** : arm64 (a64) + ## Source Download and Compilation To acquire the source code clone the git repository: @@ -126,3 +130,9 @@ Reach out with any questions you may have and we'll make sure to answer them as The compiler and executables distributed in this package fall under MIT License, for more information read the file LICENSE. + +
+ +[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/W7W01B4CV8) + +
diff --git a/VERSION b/VERSION index ba92e72f57..3eae443131 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.6.1 \ No newline at end of file +6.6.2 \ No newline at end of file diff --git a/asm/aarch64/core60.asm b/asm/aarch64/core60.asm index 0114c3b4f2..fac1d4776f 100644 --- a/asm/aarch64/core60.asm +++ b/asm/aarch64/core60.asm @@ -9,6 +9,7 @@ define THREAD_WAIT 10007h define CORE_TOC 20001h define SYSTEM_ENV 20002h define CORE_GC_TABLE 20003h +define CORE_MATH_TABLE 20004h define CORE_SINGLE_CONTENT 2000Bh define VOID 2000Dh define VOIDPTR 2000Eh @@ -68,6 +69,36 @@ structure % CORE_TOC dq 0 // ; address of import section end + +structure % CORE_MATH_TABLE + + dbl "1.4426950408889634074" // ; 00 : FM_DOUBLE_LOG2OFE + dbl "2.30933477057345225087e-2" // ; 08 : + dbl "2.02020656693165307700e1" // ; 16 : + dbl "1.51390680115615096133e3" // ; 24 : + dbl "1.0" // ; 32 : + dbl "0.5" // ; 40 : + dbl "2.33184211722314911771e2" // ; 48 + dbl "4.36821166879210612817e3" // ; 56 + + dbl "1.41421356237309504880" // ; 64 + + dbl "1.01875663804580931796e-4" // ; 72 + dbl "4.97494994976747001425e-1" // ; 80 + dbl "4.70579119878881725854e0" // ; 88 + dbl "1.44989225341610930846e1" // ; 96 + dbl "1.79368678507819816313e1" // ; 104 + dbl "7.70838733755885391666e0" // ; 112 + + dbl "1.12873587189167450590e1" // ; 120 + dbl "4.52279145837532221105e1" // ; 128 + dbl "8.29875266912776603211e1" // ; 136 + dbl "7.11544750618563894466e1" // ; 144 + dbl "2.31251620126765340583e1" // ; 152 + + dbl "6.9314718055994530942e-1" // ; 160 + +end structure % CORE_SINGLE_CONTENT @@ -1020,62 +1051,226 @@ end // ; fexpdp inline %07Ah -//; static double expo(double n) { -//; int a = 0, b = n > 0; -//; double c = 1, d = 1, e = 1; -//; for (b || (n = -n); e + .00001 < (e += (d *= n) / (c *= ++a));); -//; // approximately 15 iterations -//; return b ? e : 1 / e; + movz x17, rdata_ptr32lo : %CORE_MATH_TABLE + movk x17, rdata_ptr32hi : %CORE_MATH_TABLE, lsl #16 - mov x15, #0 - fmov d14, #"1E-4" // ; diff = 0.00001 + add x19, x29, __arg12_1 // ; dest (x19) - ldr d7, [x0] // ; n + ldr d17, [x0] // ; x (d17) - fcmp d7, #0 - blt labSkip - fneg d7, d7 - mov x15, #1 + // ; x = x * FM_DOUBLE_LOG2OFE + ldr d20, [x17] + fmul d17, d17, d20 -labSkip: - mov x4, #0 // ; a = 0 + // ; ipart = x + 0.5 + ldr d20, [x17, #40] + fadd d18, d17, d20 + // ; ipart(d18) + frintz d18, d18 // ; ipart = floor(ipart) - fmov d3, #"1E0" // ; e = 1 - fmov d5, d3 // ; c = 1 - fmov d6, d3 // ; d = 1 + fsub d19, d17, d18 // ; fpart = x - ipart; (d19) - // ; e = d3 a = x4, c = d5, d = d6 ; n = d7 + // ; FM_DOUBLE_INIT_EXP(epart,ipart); + frintx d20, d18 + fcvtzs x18, d20 + add x18, x18, #1023 + mov x20, #20 + lsl x18, x18, x20 + mov x20, #0 + str x20, [x19] + str w18, [x19, #4] -labNext: - // ; e + .00001 < (e += (d *= n) / (c *= ++a)) - fmov d13, d3 + fmul d17, d19, d19 // ; x = fpart*fpart; - add x4, x4, #1 // ; ++a - fmov d4, x4 - frintx d4, d4 + ldr d20, [x17, #8] // ; px = fm_exp2_p[0]; - fmul d5, d5, d4 // ; c *= (++a) - fmul d6, d6, d7 // ; d *= n - fdiv d12, d6, d5 // ; (d *= n) / (c *= ++a) - fadd d3, d3, d12 // ; e += (d *= n) / (c *= ++a) + // ; px = px*x + fm_exp2_p[1]; + fmul d20, d20, d17 + ldr d21, [x17, #16] + fadd d20, d20, d21 - fsub d13, d13, d3 - fcmp d13, d14 - bgt labNext + // ; qx = x + fm_exp2_q[0]; + ldr d22, [x17, #48] + fadd d22, d22, d17 - cmp x15, #0 - fmov d16, #"1E0" - bne labSkip2 - fdiv d3, d16, d3 + // ; px = px*x + fm_exp2_p[2]; + fmul d20, d20, d17 + ldr d21, [x17, #24] -labSkip2: - add x19, x29, __arg12_1 - str d3, [x19] + fadd d20, d20, d21 + + // ; qx = qx*x + fm_exp2_q[1]; + fmul d22, d22, d17 + ldr d21, [x17, #56] + fadd d22, d22, d21 + + // ; px = px * fpart; + fmul d20, d20, d19 + + // ; x = 1.0 + 2.0*(px/(qx-px)) + ldr d16, [x17, #32] + + fmov d17, d16 + + fadd d16, d16, d16 + + fsub d21, d22, d20 + fdiv d21, d20, d21 + fmul d16, d16, d21 + fadd d17, d17, d16 + + // ; epart.f*x; + ldr d20, [x19] + fmul d20, d20, d17 + str d20, [x19] end // ; fln inline %07Bh + + movz x17, rdata_ptr32lo : %CORE_MATH_TABLE + movk x17, rdata_ptr32hi : %CORE_MATH_TABLE, lsl #16 + + add x19, x29, __arg12_1 // ; dest (x19) + + ldr d17, [x0] // ; x (d17) + +//; udi_t val; +//; double z (d21), px(d18), qx(d19); +//; int32_t ipart (x18), fpart (x16); + +//; val.f = x; + str d17, [x19] + + //; extract exponent and part of the mantissa */ + +//; fpart = val.s.i1 & FM_DOUBLE_MMASK; + movz x20, #0FFFFh + movk x20, #0Fh, lsl #16 + + ldrsw x16, [x19, #4] + and x16, x16, x20 +//; ipart = val.s.i1 & FM_DOUBLE_EMASK; + movz x20, #0 + movk x20, #7FF0h, lsl #16 + ldrsw x18, [x19, #4] + and x18, x18, x20 + +//; /* set exponent to 0 to get the prefactor to 2**ipart */ +//; fpart |= FM_DOUBLE_EZERO; + movz x20, #0 + movk x20, #3FF0h, lsl #16 + orr x16, x16, x20 +//; val.s.i1 = fpart; + str w16, [x19, #4] +//; x = val.f; + ldr d17, [x19] + +//; /* extract exponent */ +//; ipart >>= FM_DOUBLE_MBITS; + movz x20, #20 + lsr x18, x18, x20 + +//; ipart -= FM_DOUBLE_BIAS; + movz x20, #1023 + sub x18, x18, x20 + +//; /* the polynomial is computed for sqrt(0.5) < x < sqrt(2), +//; but we have the mantissa in the interval 1 < x < 2. +//; adjust by dividing x by 2 and incrementing ipart, if needed. */ +//; if (x > FM_DOUBLE_SQRT2) { + ldr d20, [x17, #64] + fcmp d17, d20 + blt labSkip + beq labSkip + +//; x *= 0.5; + ldr d20, [x17, #40] + fmul d17, d17, d20 +//; ++ipart; + add x18, x18, #1 +//; } +labSkip: + +//; /* use polynomial approximation for log(1+x) */ +//; x -= 1.0; + ldr d20, [x17, #32] + fsub d17, d17, d20 + +//; px = fm_log2_p[0]; + ldr d18, [x17, #72] + +//; px = px * x + fm_log2_p[1]; + ldr d20, [x17, #80] + fmul d18, d18, d17 + fadd d18, d18, d20 + +//; px = px * x + fm_log2_p[2]; + ldr d20, [x17, #88] + fmul d18, d18, d17 + fadd d18, d18, d20 + +//; px = px * x + fm_log2_p[3]; + ldr d20, [x17, #96] + fmul d18, d18, d17 + fadd d18, d18, d20 + +//; px = px * x + fm_log2_p[4]; + ldr d20, [x17, #104] + fmul d18, d18, d17 + fadd d18, d18, d20 + +//; px = px * x + fm_log2_p[5]; + ldr d20, [x17, #112] + fmul d18, d18, d17 + fadd d18, d18, d20 + +//; qx = x + fm_log2_q[0]; + ldr d20, [x17, #120] + fadd d19, d17, d20 + +//; qx = qx * x + fm_log2_q[1]; + ldr d20, [x17, #128] + fmul d19, d19, d17 + fadd d19, d19, d20 + +//; qx = qx * x + fm_log2_q[2]; + ldr d20, [x17, #136] + fmul d19, d19, d17 + fadd d19, d19, d20 + +//; qx = qx * x + fm_log2_q[3]; + ldr d20, [x17, #144] + fmul d19, d19, d17 + fadd d19, d19, d20 + +//; qx = qx * x + fm_log2_q[4]; + ldr d20, [x17, #152] + fmul d19, d19, d17 + fadd d19, d19, d20 + +//; z = x * x; + fmul d21, d17, d17 + +//; z = x * (z * px / qx) - 0.5 * z + x; + fmul d20, d21, d18 + fdiv d20, d20, d19 + fmul d22, d20, d17 + + ldr d20, [x17, #40] + fmul d20, d20, d21 + fsub d22, d22, d20 + fadd d21, d22, d17 + +//; z += ((double)ipart) * FM_DOUBLE_LOGEOF2; + scvtf d20, x18 + ldr d18, [x17, #160] + fmul d20, d20, d18 + fadd d21, d21, d20 + + str d21, [x19] + end // ; fsin diff --git a/asm/amd64/core60.asm b/asm/amd64/core60.asm index 91468f6e82..a7ae9ba15b 100644 --- a/asm/amd64/core60.asm +++ b/asm/amd64/core60.asm @@ -11,6 +11,7 @@ define THREAD_WAIT 10007h define CORE_TOC 20001h define SYSTEM_ENV 20002h define CORE_GC_TABLE 20003h +define CORE_MATH_TABLE 20004h define CORE_SINGLE_CONTENT 2000Bh define VOID 2000Dh define VOIDPTR 2000Eh @@ -68,6 +69,12 @@ structure % CORE_TOC dq 0 // ; reserved end + +structure % CORE_MATH_TABLE + + dq 0 // ; reserved + +end structure % CORE_SINGLE_CONTENT diff --git a/asm/ppc64le/core60.asm b/asm/ppc64le/core60.asm index 53150e4246..88c766e309 100644 --- a/asm/ppc64le/core60.asm +++ b/asm/ppc64le/core60.asm @@ -9,6 +9,7 @@ define THREAD_WAIT 10007h define CORE_TOC 20001h define SYSTEM_ENV 20002h define CORE_GC_TABLE 20003h +define CORE_MATH_TABLE 20004h define CORE_SINGLE_CONTENT 2000Bh define VOID 2000Dh define VOIDPTR 2000Eh @@ -92,6 +93,36 @@ structure % CORE_TOC dq code : %PREPARE // ; address of alloc function end + +structure % CORE_MATH_TABLE + + dbl "1.4426950408889634074" // ; 00 : FM_DOUBLE_LOG2OFE + dbl "2.30933477057345225087e-2" // ; 08 : + dbl "2.02020656693165307700e1" // ; 16 : + dbl "1.51390680115615096133e3" // ; 24 : + dbl "1.0" // ; 32 : + dbl "0.5" // ; 40 : + dbl "2.33184211722314911771e2" // ; 48 + dbl "4.36821166879210612817e3" // ; 56 + + dbl "1.41421356237309504880" // ; 64 + + dbl "1.01875663804580931796e-4" // ; 72 + dbl "4.97494994976747001425e-1" // ; 80 + dbl "4.70579119878881725854e0" // ; 88 + dbl "1.44989225341610930846e1" // ; 96 + dbl "1.79368678507819816313e1" // ; 104 + dbl "7.70838733755885391666e0" // ; 112 + + dbl "1.12873587189167450590e1" // ; 120 + dbl "4.52279145837532221105e1" // ; 128 + dbl "8.29875266912776603211e1" // ; 136 + dbl "7.11544750618563894466e1" // ; 144 + dbl "2.31251620126765340583e1" // ; 152 + + dbl "6.9314718055994530942e-1" // ; 160 + +end structure % CORE_SINGLE_CONTENT @@ -1085,10 +1116,231 @@ end // ; fexpdp inline %07Ah + ld r17, toc_rdata(r2) + addis r17, r17, rdata_disp32hi : %CORE_MATH_TABLE + addi r17, r17, rdata_disp32lo : %CORE_MATH_TABLE + + addi r19, r31, __arg16_1 // ; dest (r19) + + lfd f17, 0(r3) // ; x (f17) + + // ; x = x * FM_DOUBLE_LOG2OFE + lfd f20, 0(r17) + fmul f17, f17, f20 + + // ; ipart = x + 0.5 + lfd f20, 40(r17) + fadd f18, f17, f20 + // ; ipart(f18) + friz f18, f18 // ; ipart = floor(ipart) + + fsub f19, f17, f18 // ; fpart = x - ipart; (f19) + + // ; FM_DOUBLE_INIT_EXP(epart,ipart); + fctidz f20, f18 + stfd f20, 0(r19) + ld r18, 0(r19) + li r20, 1023 + add r18, r18, r20 + li r20, 20 + sld r18, r18, r20 + li r20, 0 + std r20, 0(r19) + stw r18, 4(r19) + + fmul f17, f19, f19 // ; x = fpart*fpart; + + lfd f20, 8(r17) // ; px = fm_exp2_p[0]; + + // ; px = px*x + fm_exp2_p[1]; + fmul f20, f20, f17 + lfd f21, 16(r17) + fadd f20, f20, f21 + + // ; qx = x + fm_exp2_q[0]; + lfd f22, 48(r17) + fadd f22, f22, f17 + + // ; px = px*x + fm_exp2_p[2]; + fmul f20, f20, f17 + lfd f21, 24(r17) + fadd f20, f20, f21 + + // ; qx = qx*x + fm_exp2_q[1]; + fmul f22, f22, f17 + lfd f21, 56(r17) + fadd f22, f22, f21 + + // ; px = px * fpart; + fmul f20, f20, f19 + + // ; x = 1.0 + 2.0*(px/(qx-px)) + lfd f16, 32(r17) + + // ; mr f17, f16 + stfd f16, -8(r1) + lfd f17, -8(r1) + + fadd f16, f16, f16 + + fsub f21, f22, f20 + fdiv f21, f20, f21 + fmul f16, f16, f21 + fadd f17, f17, f16 + + // ; epart.f*x; + lfd f20, 0(r19) + fmul f20, f20, f17 + stfd f20, 0(r19) + end // ; fln inline %07Bh + + ld r17, toc_rdata(r2) + addis r17, r17, rdata_disp32hi : %CORE_MATH_TABLE + addi r17, r17, rdata_disp32lo : %CORE_MATH_TABLE + + addi r19, r31, __arg16_1 // ; dest (r19) + + lfd f17, 0(r3) // ; x (f17) + +//; udi_t val; +//; double z (f21), px(f18), qx(f19); +//; int32_t ipart (r18), fpart (r16); + +//; val.f = x; + stfd f17, 0(r19) + + //; extract exponent and part of the mantissa */ + +//; fpart = val.s.i1 & FM_DOUBLE_MMASK; + li r20, -1 + andi. r20, r20, 0FFFFh + addis r20, r20, 0Fh + lwz r16, 4(r19) + and r16, r16, r20 +//; ipart = val.s.i1 & FM_DOUBLE_EMASK; + lis r20, 7FF0h + lwz r18, 4(r19) + and r18, r18, r20 + +//; /* set exponent to 0 to get the prefactor to 2**ipart */ +//; fpart |= FM_DOUBLE_EZERO; + lis r20, 3FF0h + or r16, r16, r20 +//; val.s.i1 = fpart; + stw r16, 4(r19) +//; x = val.f; + lfd f17, 0(r19) + +//; /* extract exponent */ +//; ipart >>= FM_DOUBLE_MBITS; + li r20, 20 + srd r18, r18, r20 + +//; ipart -= FM_DOUBLE_BIAS; + li r20, 1023 + sub r18, r18, r20 + +//; /* the polynomial is computed for sqrt(0.5) < x < sqrt(2), +//; but we have the mantissa in the interval 1 < x < 2. +//; adjust by dividing x by 2 and incrementing ipart, if needed. */ +//; if (x > FM_DOUBLE_SQRT2) { + lfd f20, 64(r17) + fcmpu f17, f20 + blt labSkip + beq labSkip + +//; x *= 0.5; + lfd f20, 40(r17) + fmul f17, f17, f20 +//; ++ipart; + addi r18, r18, 1 +//; } +labSkip: + +//; /* use polynomial approximation for log(1+x) */ +//; x -= 1.0; + lfd f20, 32(r17) + fsub f17, f17, f20 + +//; px = fm_log2_p[0]; + lfd f18, 72(r17) + +//; px = px * x + fm_log2_p[1]; + lfd f20, 80(r17) + fmul f18, f18, f17 + fadd f18, f18, f20 + +//; px = px * x + fm_log2_p[2]; + lfd f20, 88(r17) + fmul f18, f18, f17 + fadd f18, f18, f20 + +//; px = px * x + fm_log2_p[3]; + lfd f20, 96(r17) + fmul f18, f18, f17 + fadd f18, f18, f20 + +//; px = px * x + fm_log2_p[4]; + lfd f20, 104(r17) + fmul f18, f18, f17 + fadd f18, f18, f20 + +//; px = px * x + fm_log2_p[5]; + lfd f20, 112(r17) + fmul f18, f18, f17 + fadd f18, f18, f20 + +//; qx = x + fm_log2_q[0]; + lfd f20, 120(r17) + fadd f19, f17, f20 + +//; qx = qx * x + fm_log2_q[1]; + lfd f20, 128(r17) + fmul f19, f19, f17 + fadd f19, f19, f20 + +//; qx = qx * x + fm_log2_q[2]; + lfd f20, 136(r17) + fmul f19, f19, f17 + fadd f19, f19, f20 + +//; qx = qx * x + fm_log2_q[3]; + lfd f20, 144(r17) + fmul f19, f19, f17 + fadd f19, f19, f20 + +//; qx = qx * x + fm_log2_q[4]; + lfd f20, 152(r17) + fmul f19, f19, f17 + fadd f19, f19, f20 + +//; z = x * x; + fmul f21, f17, f17 + +//; z = x * (z * px / qx) - 0.5 * z + x; + fmul f20, f21, f18 + fdiv f20, f20, f19 + fmul f22, f20, f17 + + lfd f20, 40(r17) + fmul f20, f20, f21 + fsub f22, f22, f20 + fadd f21, f22, f17 + +//; z += ((double)ipart) * FM_DOUBLE_LOGEOF2; + std r18, 0(r19) + lfd f20, 0(r19) + fcfid f20, f20 + lfd f18, 160(r17) + fmul f20, f20, f18 + fadd f21, f21, f20 + + stfd f21, 0(r19) + end // ; fsin diff --git a/asm/x32/core60.asm b/asm/x32/core60.asm index 06d68ea1e4..528861bf86 100644 --- a/asm/x32/core60.asm +++ b/asm/x32/core60.asm @@ -9,6 +9,7 @@ define THREAD_WAIT 10007h define CORE_TOC 20001h define SYSTEM_ENV 20002h define CORE_GC_TABLE 20003h +define CORE_MATH_TABLE 20004h define CORE_SINGLE_CONTENT 2000Bh define VOID 2000Dh define VOIDPTR 2000Eh @@ -71,6 +72,12 @@ structure % CORE_TOC end +structure % CORE_MATH_TABLE + + dd 0 // ; reserved + +end + structure % CORE_SINGLE_CONTENT dd 0 // ; et_critical_handler ; +x00 - pointer to ELENA critical handler diff --git a/bin/local.elc60.config.bak b/bin/local.elc60.config similarity index 100% rename from bin/local.elc60.config.bak rename to bin/local.elc60.config diff --git a/bin/scripts/xforms60.es b/bin/scripts/xforms60.es index 98d0872c12..b1ca4ab20e 100644 --- a/bin/scripts/xforms60.es +++ b/bin/scripts/xforms60.es @@ -22,6 +22,14 @@ root ( method ( nameattr( identifier = onInit ) code ( + expression ( + assign_operation ( + new_variable ( identifier = current ) + expression ( + object ( identifier = self ) + ) + ) + ) => { val_form_prop | form_prop }* ">" member* form_closing_tag <= @@ -31,7 +39,7 @@ root ( #define field_list ::= <= $buffer => $eps; - #define member ::= { label | button }; + #define member ::= { label | button | radiobuttongroup | panel | edit | combobox }; #define label ::= <= @@ -50,7 +58,7 @@ root ( <= expression ( message_operation ( - object ( identifier = self ) + object ( super_identifier = current ) message ( identifier = appendControl ) expression ( object ( identifier = current ) @@ -81,7 +89,7 @@ root ( <= expression ( message_operation ( - object ( identifier = self ) + object ( super_identifier = current ) message ( identifier = appendControl ) expression ( object ( identifier = current ) @@ -95,6 +103,145 @@ root ( #define button_declaration ::= %<= field ( type ( reference = forms'Button ) nameattr ( identifier = $current ) ) =>; + #define combobox ::= +<= + code ( + expression ( + assign_operation ( + new_variable ( identifier = current ) + message_operation ( + object ( reference = forms'Combobox ) + message ( identifier = new ) + ) + ) + ) +=> + "<" "Combobox" combobox_name_prop { val_prop | prop }* ">" combobox_closing_tag +<= + expression ( + message_operation ( + object ( super_identifier = current ) + message ( identifier = appendControl ) + expression ( + object ( identifier = current ) + ) + ) + ) + ) +=>; + + #define combobox_name_prop ::= ":" "Name" "=" combobox_declaration control_assigning; + + #define combobox_declaration ::= %<= field ( type ( reference = forms'Combobox ) nameattr ( identifier = $current ) ) =>; + + #define edit ::= +<= + code ( + expression ( + assign_operation ( + new_variable ( identifier = current ) + message_operation ( + object ( reference = forms'Edit ) + message ( identifier = new ) + ) + ) + ) +=> + "<" "Edit" edit_name_prop { val_prop | prop }* ">" edit_closing_tag +<= + expression ( + message_operation ( + object ( super_identifier = current ) + message ( identifier = appendControl ) + expression ( + object ( identifier = current ) + ) + ) + ) + ) +=>; + + #define edit_name_prop ::= ":" "Name" "=" edit_declaration control_assigning; + + #define edit_declaration ::= %<= field ( type ( reference = forms'Edit ) nameattr ( identifier = $current ) ) =>; + + #define radiobuttongroup ::= +<= + code ( + expression ( + assign_operation ( + new_variable ( identifier = current ) + message_operation ( + object ( reference = forms'RadioButtonGroup ) + message ( identifier = new ) + ) + ) + ) +=> + "<" "RadioButtonGroup" rbgroup_name_prop { val_prop | prop }* ">" item* rbgroup_closing_tag +<= + expression ( + message_operation ( + object ( super_identifier = current ) + message ( identifier = appendControl ) + expression ( + object ( identifier = current ) + ) + ) + ) + ) +=>; + + #define rbgroup_name_prop ::= ":" "Name" "=" rbgroup_declaration control_assigning; + + #define rbgroup_declaration ::= %<= field ( type ( reference = forms'RadioButtonGroup ) nameattr ( identifier = $current ) ) =>; + + #define panel ::= +<= + code ( + expression ( + assign_operation ( + new_variable ( identifier = current ) + message_operation ( + object ( reference = forms'Panel ) + message ( identifier = new ) + ) + ) + ) +=> + "<" "Panel" panel_name_prop { val_prop | prop }* ">" member* panel_closing_tag +<= + expression ( + message_operation ( + object ( super_identifier = current ) + message ( identifier = appendControl ) + expression ( + object ( identifier = current ) + ) + ) + ) + ) +=>; + + #define panel_name_prop ::= ":" "Name" "=" panel_declaration control_assigning; + + #define panel_declaration ::= %<= field ( type ( reference = forms'Panel ) nameattr ( identifier = $current ) ) =>; + + #define item ::= +<= + expression ( + message_operation ( + object ( identifier = current ) + message ( identifier = appendItem ) +=> + "<" "Item" itemval_prop ">" item_closing_tag +<= + ) + ) +=>; + + #define itemval_prop ::= "Caption" "=" prop_str_value; + #define control_assigning ::= <= expression ( @@ -190,6 +337,18 @@ root ( ) =>; + #define prop_value ::= +<= + expression ( + object ( + identifier = +=> + nonint_quote +<= + ) + ) +=>; + #define prop_value ::= <= expression ( @@ -198,7 +357,7 @@ root ( object ( identifier = => - nonint_quote + closure_quote <= ) ) @@ -218,11 +377,12 @@ root ( ) =>; - #define ident_value ::= <= identifier = $literal =>; - #define identifier ::= <= identifier = $identifier =>; - #define int_quote ::= <= $intliteral =>; - #define nonint_quote::= <= $nonintliteral =>; - #define quote ::= <= "$literal" =>; + #define ident_value ::= <= identifier = $literal =>; + #define identifier ::= <= identifier = $identifier =>; + #define int_quote ::= <= $regex "^""(?\d+)""$" =>; + #define nonint_quote ::= <= $regex "^""(?[a-zA-Z_]\w*)""$" =>; + #define closure_quote ::= <= $regex "^""&(?[a-zA-Z_]\w*)""$" =>; + #define quote ::= <= "$literal" =>; #define form_closing_tag ::= "<" "/" "Form" ">"; @@ -233,4 +393,18 @@ root ( #define button_closing_tag ::= "<" "/" "Button" ">"; + #define edit_closing_tag ::= + "<" "/" "Edit" ">"; + + #define rbgroup_closing_tag ::= + "<" "/" "RadioButtonGroup" ">"; + + #define item_closing_tag ::= + "<" "/" "Item" ">"; + + #define panel_closing_tag ::= + "<" "/" "Panel" ">"; + + #define combobox_closing_tag ::= + "<" "/" "Combobox" ">"; ]] diff --git a/bin/templates/lib60.config b/bin/templates/lib60.config index 6db2c2acba..d6cd268604 100644 --- a/bin/templates/lib60.config +++ b/bin/templates/lib60.config @@ -50,8 +50,6 @@ system'BaseLazyExpression system'Nullable#1 system'UnsafePointer - meta$preloadedSymbols - meta$preloadedSymbols system'YieldStateEnumerator diff --git a/bin/templates/local.lib60.config b/bin/templates/local.lib60.config index 0530a1e765..daca90e1e1 100644 --- a/bin/templates/local.lib60.config +++ b/bin/templates/local.lib60.config @@ -23,10 +23,6 @@ import system; - system'attributes'attributes - system'predefined'defaults - system'predefined'aliases - system'operations'statements system'Object system'nilValue system'IntNumber @@ -54,8 +50,6 @@ system'BaseLazyExpression system'Nullable#1 system'UnsafePointer - meta$preloadedSymbols - meta$preloadedSymbols system'YieldStateEnumerator diff --git a/build/aarch64/build_package_arm64.script b/build/aarch64/build_package_arm64.script index 46a5e0e2d6..92a7376352 100755 --- a/build/aarch64/build_package_arm64.script +++ b/build/aarch64/build_package_arm64.script @@ -1,6 +1,7 @@ #!/bin/bash -RELEASE=elena-6.6.1.aarch64-linux +RELEASE=elena-6.6.2.aarch64-linux +mkdir -p ../lib60_64 mkdir -p /usr/share/elena mkdir -p /etc/elena/ mkdir -p /etc/elena/templates/ @@ -85,7 +86,7 @@ fi # # echo compiling lib50 files - ../../bin/asm64-cli -bc64 ../../src60/core/system.core_routines.esm /usr/lib/elena/lib60_64 + ../../bin/asm64-cli -bc64 ../../src60/core/system.core_routines.esm ../../lib60_64 ret=$? if [ $ret -eq 0 ] then @@ -95,7 +96,7 @@ fi exit 1 fi - ../../bin/elena64-cli ../../src60/system/system.project + ../../bin/elena64-cli ../../src60/elena_api.linux.prjcol ret=$? if [ $ret -eq 2 ] then @@ -105,27 +106,10 @@ fi echo . fi - ../../bin/elena64-cli ../../src60/extensions/extensions.project - ret=$? - if [ $ret -eq 2 ] - then - echo "Failure" >&2 - exit 1 - else - echo . - fi - - ../../bin/elena64-cli ../../src60/ltests/ltests.project - ret=$? - if [ $ret -eq 2 ] - then - echo "Failure" >&2 - exit 1 - else - echo . - fi + cp ../../lib60_64/*.nl /usr/lib/elena/lib60_64 + cp ../../lib60_64/*.dnl /usr/lib/elena/lib60_64 - ../../bin/elena64-cli ../../tests60/system_tests/system_tests.project + elena64-cli ../../tests60/system_tests/system_tests.prj ret=$? if [ $ret -eq 2 ] then diff --git a/build/aarch64/control b/build/aarch64/control index c8b0e51e02..76ec1e5ad4 100644 --- a/build/aarch64/control +++ b/build/aarch64/control @@ -1,5 +1,5 @@ Package: elena-lang -Version: 6.6.1 +Version: 6.6.2 Architecture: aarch64 Maintainer: Alex Rakov Depends: libc6 (>= 2.1) diff --git a/build/amd64/build_package_amd64.script b/build/amd64/build_package_amd64.script index 5ba44dca30..4309011910 100755 --- a/build/amd64/build_package_amd64.script +++ b/build/amd64/build_package_amd64.script @@ -1,6 +1,7 @@ #!/bin/bash -RELEASE=elena-6.6.1.amd64-linux +RELEASE=elena-6.6.2.amd64-linux +mkdir -p ../lib60_64 mkdir -p /usr/share/elena mkdir -p /etc/elena/ mkdir -p /etc/elena/templates/ @@ -97,7 +98,7 @@ fi # # echo compiling lib50 files - ../../bin/asm64-cli -bc64 ../../src60/core/system.core_routines.esm /usr/lib/elena/lib60_64 + ../../bin/asm64-cli -bc64 ../../src60/core/system.core_routines.esm ../../lib60_64 ret=$? if [ $ret -eq 0 ] then @@ -107,7 +108,7 @@ fi exit 1 fi - ../../bin/elena64-cli ../../src60/system/system.project + ../../bin/elena64-cli ../../src60/elena_api.linux.prjcol ret=$? if [ $ret -eq 2 ] then @@ -117,27 +118,10 @@ fi echo . fi - ../../bin/elena64-cli ../../src60/extensions/extensions.project - ret=$? - if [ $ret -eq 2 ] - then - echo "Failure" >&2 - exit 1 - else - echo . - fi - - ../../bin/elena64-cli ../../src60/ltests/ltests.project - ret=$? - if [ $ret -eq 2 ] - then - echo "Failure" >&2 - exit 1 - else - echo . - fi + cp ../../lib60_64/*.nl /usr/lib/elena/lib60_64 + cp ../../lib60_64/*.dnl /usr/lib/elena/lib60_64 - ../../bin/elena64-cli ../../tests60/system_tests/system_tests.project + elena64-cli ../../tests60/system_tests/system_tests.prj ret=$? if [ $ret -eq 2 ] then diff --git a/build/amd64/control b/build/amd64/control index 005b5c58ea..6ef35ce178 100644 --- a/build/amd64/control +++ b/build/amd64/control @@ -1,5 +1,5 @@ Package: elena-lang -Version: 6.6.1 +Version: 6.6.2 Architecture: amd64 Maintainer: Alex Rakov Depends: libc6 (>= 2.1) diff --git a/build/create_package_x86.bat b/build/create_package_x86.bat index 510d1f5257..9f16033ad3 100644 --- a/build/create_package_x86.bat +++ b/build/create_package_x86.bat @@ -74,6 +74,11 @@ md %~dp0\x86\examples60\gui\helloworld md %~dp0\x86\examples60\db md %~dp0\x86\examples60\db\sqlite +md %~dp0\x86\examples60\threads +md %~dp0\x86\examples60\threads\async +md %~dp0\x86\examples60\threads\tasks +md %~dp0\x86\examples60\threads\threadpool + copy %~dp0\..\bin\asm-cli.exe %~dp0\x86\bin copy %~dp0\..\bin\elena-cli.exe %~dp0\x86\bin copy %~dp0\..\bin\elena-ide.exe %~dp0\x86\bin @@ -297,6 +302,9 @@ copy %~dp0\..\examples60\files\textdb\*.txt %~dp0\x86\examples60\files\textdb copy %~dp0\..\examples60\files\textfile\*.l %~dp0\x86\examples60\files\textfile copy %~dp0\..\examples60\files\textfile\*.txt %~dp0\x86\examples60\files\textfile +xcopy %~dp0\..\examples60\threads\*.l %~dp0\x86\examples60\threads /s +xcopy %~dp0\..\examples60\threads\*.prj %~dp0\x86\examples60\threads /s + goto:eof ::ERRORS ::--------------------- diff --git a/build/elena_inno.iss b/build/elena_inno.iss index 4f3eb8ab3d..66ef664798 100644 --- a/build/elena_inno.iss +++ b/build/elena_inno.iss @@ -7,8 +7,8 @@ ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) AppId={{3CAA69D3-0F98-44B1-A73E-E864BA51D5BD} AppName=ELENA Programming Language -AppVersion=6.6.1 -;AppVerName=ELENA Programming Language 6.5.0 +AppVersion=6.6.2 +;AppVerName=ELENA Programming Language 6.6.0 AppPublisher=Alexey Rakov AppPublisherURL=http://github.com/ELENA-LANG/elena-lang AppSupportURL=http://github.com/ELENA-LANG/elena-lang @@ -18,7 +18,7 @@ DefaultGroupName=ELENA Programming Language AllowNoIcons=yes LicenseFile=..\doc\license InfoAfterFile=..\CHANGELOG.md -OutputBaseFilename=elena-lang-6.5.0.x86-win-setup +OutputBaseFilename=elena-lang-6.6.2.x86-win-setup Compression=lzma SolidCompression=yes ChangesEnvironment=yes diff --git a/build/i386/build_package_i386.script b/build/i386/build_package_i386.script index 15c69ca273..2aa893271a 100755 --- a/build/i386/build_package_i386.script +++ b/build/i386/build_package_i386.script @@ -1,6 +1,7 @@ #!/bin/bash -RELEASE=elena-6.6.1.i386-linux +RELEASE=elena-6.6.2.i386-linux +mkdir -p ../lib60 mkdir -p /usr/share/elena mkdir -p /etc/elena/ mkdir -p /etc/elena/templates/ @@ -99,7 +100,7 @@ fi echo compiling lib60 files - ../../bin/asm-cli -bc32 ../../src60/core/system.core_routines.esm /usr/lib/elena/lib60 + ../../bin/asm-cli -bc32 ../../src60/core/system.core_routines.esm ../../lib60 ret=$? if [ $ret -eq 0 ] then @@ -109,7 +110,7 @@ echo compiling lib60 files exit 1 fi - ../../bin/elena-cli ../../src60/system/system.project + ../../bin/elena-cli ../../src60/elena_api.linux.prjcol ret=$? if [ $ret -eq 2 ] then @@ -119,27 +120,10 @@ echo compiling lib60 files echo . fi - ../../bin/elena-cli ../../src60/extensions/extensions.project - ret=$? - if [ $ret -eq 2 ] - then - echo "Failure" >&2 - exit 1 - else - echo . - fi - - ../../bin/elena-cli ../../src60/ltests/ltests.project - ret=$? - if [ $ret -eq 2 ] - then - echo "Failure" >&2 - exit 1 - else - echo . - fi + cp ../../lib60/*.nl /usr/lib/elena/lib60 + cp ../../lib60/*.dnl /usr/lib/elena/lib60 - ../../bin/elena-cli ../../tests60/system_tests/system_tests.project + elena-cli ../../tests60/system_tests/system_tests.prj ret=$? if [ $ret -eq 2 ] then diff --git a/build/i386/control b/build/i386/control index 6b60abeba6..e8744dca25 100644 --- a/build/i386/control +++ b/build/i386/control @@ -1,5 +1,5 @@ Package: elena-lang -Version: 6.6.1 +Version: 6.6.2 Architecture: i386 Maintainer: Alex Rakov Depends: libc6 (>= 2.1) diff --git a/build/ppc64le/build_package_ppc64le.script b/build/ppc64le/build_package_ppc64le.script index 182a54d626..c807419d4a 100755 --- a/build/ppc64le/build_package_ppc64le.script +++ b/build/ppc64le/build_package_ppc64le.script @@ -1,6 +1,7 @@ #!/bin/bash -RELEASE=elena-6.6.1.ppc64le-linux +RELEASE=elena-6.6.2.ppc64le-linux +mkdir -p ../lib60_64 mkdir -p /usr/share/elena mkdir -p /etc/elena/ mkdir -p /etc/elena/templates/ @@ -85,7 +86,7 @@ fi # # echo compiling lib50 files - ../../bin/asm64-cli -bc64 ../../src60/core/system.core_routines.esm /usr/lib/elena/lib60_64 + ../../bin/asm64-cli -bc64 ../../src60/core/system.core_routines.esm ../../lib60_64 ret=$? if [ $ret -eq 0 ] then @@ -95,7 +96,7 @@ fi exit 1 fi - ../../bin/elena64-cli ../../src60/system/system.project + ../../bin/elena64-cli ../../src60/elena_api.linux.prjcol ret=$? if [ $ret -eq 2 ] then @@ -105,27 +106,10 @@ fi echo . fi - ../../bin/elena64-cli ../../src60/extensions/extensions.project - ret=$? - if [ $ret -eq 2 ] - then - echo "Failure" >&2 - exit 1 - else - echo . - fi - - ../../bin/elena64-cli ../../src60/ltests/ltests.project - ret=$? - if [ $ret -eq 2 ] - then - echo "Failure" >&2 - exit 1 - else - echo . - fi + cp ../../lib60_64/*.nl /usr/lib/elena/lib60_64 + cp ../../lib60_64/*.dnl /usr/lib/elena/lib60_64 - ../../bin/elena64-cli ../../tests60/system_tests/system_tests.project + elena64-cli ../../tests60/system_tests/system_tests.prj ret=$? if [ $ret -eq 2 ] then diff --git a/build/ppc64le/control b/build/ppc64le/control index 7e95aa9864..3f0a0e7cc7 100644 --- a/build/ppc64le/control +++ b/build/ppc64le/control @@ -1,5 +1,5 @@ Package: elena-lang -Version: 6.6.1 +Version: 6.6.2 Architecture: ppc64le Maintainer: Alex Rakov Depends: libc6 (>= 2.1) diff --git a/doc/features b/doc/features index 2f2bbaf815..5334167efe 100644 --- a/doc/features +++ b/doc/features @@ -199,3 +199,20 @@ public program() console.writeLine($"Processor type:{Environment.ProcessorType}"); console.writeLine($"Processor count:{Environment.ProcessorCount}"); } + +---------------------------------------------------------------------------- + Accessing a variable from the upper scope +---------------------------------------------------------------------------- + +import extensions; + +public program() +{ + var variable := "Level 0"; + { + var variable := "Level 1"; + + console.printLine(super variable); + console.printLine(variable); + } +} diff --git a/doc/todo.txt b/doc/todo.txt index 101cbcde5a..9ff643e3d6 100644 --- a/doc/todo.txt +++ b/doc/todo.txt @@ -3,84 +3,60 @@ In development: ------ [development] - ### EPIC: elena 6.6 ### - - === Iteration 36 (13.03) === - -------------------------------------- - * aarch64 : fix exceptionTest, methodNotFoundTest - -------------------------------------- - * fix extopen / extclose + ### EPIC: elena 6.7 ### - === Iteration 37 === + === Iteration 38 (05.04) === -------------------------------------- dev: - - upndown (connector) + - upndown (connector - interaction) - #496 - #622 - * #34 : web api - - http client (https get, post, put, patch, delete, head, options, trace) + - #34 : http client (http get, https get (https://github.com/HISONA/https_client), post, put, patch, delete, head, options, trace), web api + - MTA support for Linux + - #708 : compile the project (elc, og, sg, asm, ecv), create Linker + - implement ExtensionMessage.equal + ide: + - linux - select tab, save, close + - fix syntax highlighting (see system'net:win_common.l) + - ide : windows gen: - - lpad : generate a code based on a record + - lpad / elt : declare an extension, parse it and apply to the input maint: - - #702 + - pi samples for ppc64, aarch64 + - test all x86-64 examples - unit tests : bt optimization - - test binary file operations - - api refactoring : all symbols must start with a capital letter - - redesign winforms - - api : add descriptions - - threading samples must be included into release files - - ide : windows - - review pi performance (must < 6) - - linux editor - open / close / save / exit - - test binary file reader / writer - - matrix sample : review the code, it should be possible to use the lambda function without specifying the exact output type - - implement ExtensionMessage.equal - - support subexpression for "?." and "\." (e.g. object.__getClass()\.__dto_properties()) - - support function call with double colon (e.g. ::printing() - is always a function) - - redesign switch statement : it should be possible to use as an expression as well (so we cannot use => anymore : e.g. - console.printLine(x => 1 { "first" } 2 { "second" } 3 { "third" }) ) console.printLine(x $sel 1 => "first", 2 => "second", 3 => "third") - warn if typecasting method returns itself, it leads to infinite call - + - test binary file reader / writer + - api : add descriptions + - api refactoring : all symbols must start with a capital letter (e.g. printingLn) port: + - chat sample + - rosetta code : moving to 6.5 + - x86-64 : mta - test net examples for mta + - test all x86-64 examples (net) + - pi samples for ppc64, aarch64 tools: - #658 : connect with ldbg from VSCode prom: bi-posting weekly -------------------------------------- - * ide : linux - open, edit, save, close - * ide : linux - show the file - * fixing #283 - * fix chat server - it is blocked - * x86-64 : mta - test net examples for mta - * rosetta code : moving to 6.5 - * http client : get (quick & dirty) - * test all x86 examples (net) - * redesign chat sample : send, leave - * IDE : fix syntax highlighting (see system'net:win_common.l) - * redesign chat sample : connect - * user defined type alias - * declare and use alias with meta operations - * it must be possible to declare them inside the module; it must be possible to import module containing - the custom aliases - * type alias - * fix pi sample for aarch64 - -------------------------------------- - * fix pi sample for ppc64le - -------------------------------------- - * ppc64 : ln - * ppc64 : exp + -------------------------------------- + -------------------------------------- - === Iteration 38 === + === Iteration 39 === -------------------------------------- dev: gen: maint: + - review pi performance (must < 6) port: prom: -------------------------------------- -------------------------------------- -------------------------------------- - === Iteration 39 === + ### EPIC: elena 6.8 ### + + === Iteration 40 === -------------------------------------- dev: gen: @@ -91,9 +67,7 @@ In development: -------------------------------------- -------------------------------------- - ### EPIC: elena 6.7 ### - - === Iteration 40 === + === Iteration 41 === -------------------------------------- dev: gen: diff --git a/elenasrc3/common/lists.h b/elenasrc3/common/lists.h index f87c002ae1..28941c7851 100644 --- a/elenasrc3/common/lists.h +++ b/elenasrc3/common/lists.h @@ -1028,7 +1028,7 @@ namespace elena_lang } Queue(T defItem) - : _list(_defaultItem) + : _list(defItem) { _defaultItem = defItem; } diff --git a/elenasrc3/common/streams.h b/elenasrc3/common/streams.h index 2bf5a1b1d9..f5101adf4b 100644 --- a/elenasrc3/common/streams.h +++ b/elenasrc3/common/streams.h @@ -3,7 +3,7 @@ // // This header contains the declaration of abstract stream reader // and writer classes -// (C)2021-2024, by Aleksey Rakov +// (C)2021-2025, by Aleksey Rakov //--------------------------------------------------------------------------- #ifndef STREAMS_H @@ -337,6 +337,10 @@ namespace elena_lang { return write(&value, sizeof(size_t)); } + bool writeDouble(double value) + { + return write(&value, sizeof(double)); + } virtual bool writeBytes(unsigned char ch, pos_t count) { diff --git a/elenasrc3/common/tree.h b/elenasrc3/common/tree.h index 5f46bfab8b..8db4071b0e 100644 --- a/elenasrc3/common/tree.h +++ b/elenasrc3/common/tree.h @@ -3,7 +3,7 @@ // // This file contains ELENA Tree template classes // -// (C)2021-2024, by Aleksey Rakov +// (C)2021-2025, by Aleksey Rakov //--------------------------------------------------------------------------- #ifndef TREE_H @@ -301,7 +301,7 @@ namespace elena_lang this->arg.strArgPosition = INVALID_POS; _tree->save(_position, key, arg); - } + } void setStrArgument(ustr_t value) { this->arg.value = 0; @@ -501,7 +501,7 @@ namespace elena_lang // enclose the node with a new one Node encloseNode(Key key, int argument = 0) { - NodeRecord* record = (NodeRecord*)_tree->_body.get(_position); + //NodeRecord* record = (NodeRecord*)_tree->_body.get(_position); _tree->injectChild(_position, this->key, this->arg); diff --git a/elenasrc3/elc/cliconst.h b/elenasrc3/elc/cliconst.h index 9f826b8f23..a03b045369 100644 --- a/elenasrc3/elc/cliconst.h +++ b/elenasrc3/elc/cliconst.h @@ -13,7 +13,7 @@ namespace elena_lang { - #define ELC_REVISION_NUMBER 0x007B + #define ELC_REVISION_NUMBER 0x0084 #if defined _M_IX86 || _M_X64 diff --git a/elenasrc3/elc/codeblocks/elc_mac_arm64.mak b/elenasrc3/elc/codeblocks/elc_mac_arm64.mak new file mode 100644 index 0000000000..890e1c7ff6 --- /dev/null +++ b/elenasrc3/elc/codeblocks/elc_mac_arm64.mak @@ -0,0 +1,146 @@ +#------------------------------------------------------------------------------# +# ELENA make file # +#------------------------------------------------------------------------------# + +WORKDIR = `pwd` + +CC = gcc +CXX = g++ +AR = ar +LD = g++ +WINDRES = windres + +INC = -I.. -I../../engine -I../../common +CFLAGS = -Wall -std=c++20 -march=armv8-a +RESINC = +LIBDIR = +LIB = +LDFLAGS = -static-libgcc -static-libstdc++ -ldl -march=armv8-a + +INC_RELEASE = $(INC) +CFLAGS_RELEASE = $(CFLAGS) -O3 +RESINC_RELEASE = $(RESINC) +RCFLAGS_RELEASE = $(RCFLAGS) +LIBDIR_RELEASE = $(LIBDIR) +LIB_RELEASE = $(LIB) +LDFLAGS_RELEASE = $(LDFLAGS) -s +OBJDIR_RELEASE = ../../temp/elena64-cli +DEP_RELEASE = +OUT_RELEASE = ../../../bin/elena64-cli + +OBJ_RELEASE = $(OBJDIR_RELEASE)/__/__/common/config.o $(OBJDIR_RELEASE)/__/__/common/dump.o $(OBJDIR_RELEASE)/__/__/common/files.o $(OBJDIR_RELEASE)/__/__/common/paths.o $(OBJDIR_RELEASE)/__/__/common/ustring.o $(OBJDIR_RELEASE)/__/__/common/xmltree.o $(OBJDIR_RELEASE)/__/__/engine/bcwriter.o $(OBJDIR_RELEASE)/__/__/engine/codescope.o $(OBJDIR_RELEASE)/__/__/engine/jitcompiler.o $(OBJDIR_RELEASE)/__/__/engine/jitlinker.o $(OBJDIR_RELEASE)/__/__/engine/libman.o $(OBJDIR_RELEASE)/__/__/engine/module.o $(OBJDIR_RELEASE)/__/__/engine/parsertable.o $(OBJDIR_RELEASE)/__/__/engine/section.o $(OBJDIR_RELEASE)/__/__/engine/arm64compiler.o $(OBJDIR_RELEASE)/__/__/engine/syntaxtree.o $(OBJDIR_RELEASE)/__/__/engine/bytecode.o $(OBJDIR_RELEASE)/__/__/engine/xmlprojectbase.o $(OBJDIR_RELEASE)/__/codeimage.o $(OBJDIR_RELEASE)/__/compiler.o $(OBJDIR_RELEASE)/__/compiling.o $(OBJDIR_RELEASE)/__/derivation.o $(OBJDIR_RELEASE)/__/macos/elc.o $(OBJDIR_RELEASE)/__/parser.o $(OBJDIR_RELEASE)/__/separser.o $(OBJDIR_RELEASE)/__/project.o $(OBJDIR_RELEASE)/__/source.o $(OBJDIR_RELEASE)/__/modulescope.o $(OBJDIR_RELEASE)/__/compilerlogic.o + +all: release + +clean: clean_release + +before_release: + test -d ../../../bin || mkdir -p ../../../bin + test -d $(OBJDIR_RELEASE)/__ || mkdir -p $(OBJDIR_RELEASE)/__ + test -d $(OBJDIR_RELEASE)/__/__/engine || mkdir -p $(OBJDIR_RELEASE)/__/__/engine + test -d $(OBJDIR_RELEASE)/__/__/engine/macos || mkdir -p $(OBJDIR_RELEASE)/__/__/engine/macos + test -d $(OBJDIR_RELEASE)/__/macos || mkdir -p $(OBJDIR_RELEASE)/__/macos + test -d $(OBJDIR_RELEASE)/__/__/common || mkdir -p $(OBJDIR_RELEASE)/__/__/common + +after_release: + +release: before_release out_release after_release + +out_release: before_release $(OBJ_RELEASE) $(DEP_RELEASE) + $(LD) $(LIBDIR_RELEASE) -o $(OUT_RELEASE) $(OBJ_RELEASE) $(LDFLAGS_RELEASE) $(LIB_RELEASE) + +$(OBJDIR_RELEASE)/__/__/common/config.o: ../../common/config.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../../common/config.cpp -o $(OBJDIR_RELEASE)/__/__/common/config.o + +$(OBJDIR_RELEASE)/__/__/common/dump.o: ../../common/dump.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../../common/dump.cpp -o $(OBJDIR_RELEASE)/__/__/common/dump.o + +$(OBJDIR_RELEASE)/__/__/common/files.o: ../../common/files.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../../common/files.cpp -o $(OBJDIR_RELEASE)/__/__/common/files.o + +$(OBJDIR_RELEASE)/__/__/common/paths.o: ../../common/paths.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../../common/paths.cpp -o $(OBJDIR_RELEASE)/__/__/common/paths.o + +$(OBJDIR_RELEASE)/__/__/common/ustring.o: ../../common/ustring.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../../common/ustring.cpp -o $(OBJDIR_RELEASE)/__/__/common/ustring.o + +$(OBJDIR_RELEASE)/__/__/common/xmltree.o: ../../common/xmltree.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../../common/xmltree.cpp -o $(OBJDIR_RELEASE)/__/__/common/xmltree.o + +$(OBJDIR_RELEASE)/__/__/engine/bcwriter.o: ../../engine/bcwriter.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../../engine/bcwriter.cpp -o $(OBJDIR_RELEASE)/__/__/engine/bcwriter.o + +$(OBJDIR_RELEASE)/__/__/engine/codescope.o: ../../engine/codescope.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../../engine/codescope.cpp -o $(OBJDIR_RELEASE)/__/__/engine/codescope.o + +$(OBJDIR_RELEASE)/__/__/engine/jitcompiler.o: ../../engine/jitcompiler.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../../engine/jitcompiler.cpp -o $(OBJDIR_RELEASE)/__/__/engine/jitcompiler.o + +$(OBJDIR_RELEASE)/__/__/engine/jitlinker.o: ../../engine/jitlinker.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../../engine/jitlinker.cpp -o $(OBJDIR_RELEASE)/__/__/engine/jitlinker.o + +$(OBJDIR_RELEASE)/__/__/engine/libman.o: ../../engine/libman.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../../engine/libman.cpp -o $(OBJDIR_RELEASE)/__/__/engine/libman.o + +$(OBJDIR_RELEASE)/__/__/engine/module.o: ../../engine/module.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../../engine/module.cpp -o $(OBJDIR_RELEASE)/__/__/engine/module.o + +$(OBJDIR_RELEASE)/__/__/engine/parsertable.o: ../../engine/parsertable.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../../engine/parsertable.cpp -o $(OBJDIR_RELEASE)/__/__/engine/parsertable.o + +$(OBJDIR_RELEASE)/__/__/engine/section.o: ../../engine/section.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../../engine/section.cpp -o $(OBJDIR_RELEASE)/__/__/engine/section.o + +$(OBJDIR_RELEASE)/__/__/engine/arm64compiler.o: ../../engine/arm64compiler.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../../engine/arm64compiler.cpp -o $(OBJDIR_RELEASE)/__/__/engine/arm64compiler.o + +$(OBJDIR_RELEASE)/__/__/engine/syntaxtree.o: ../../engine/syntaxtree.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../../engine/syntaxtree.cpp -o $(OBJDIR_RELEASE)/__/__/engine/syntaxtree.o + +$(OBJDIR_RELEASE)/__/__/engine/bytecode.o: ../../engine/bytecode.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../../engine/bytecode.cpp -o $(OBJDIR_RELEASE)/__/__/engine/bytecode.o + +$(OBJDIR_RELEASE)/__/__/engine/xmlprojectbase.o: ../../engine/xmlprojectbase.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../../engine/xmlprojectbase.cpp -o $(OBJDIR_RELEASE)/__/__/engine/xmlprojectbase.o + +$(OBJDIR_RELEASE)/__/codeimage.o: ../codeimage.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../codeimage.cpp -o $(OBJDIR_RELEASE)/__/codeimage.o + +$(OBJDIR_RELEASE)/__/compiler.o: ../compiler.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../compiler.cpp -o $(OBJDIR_RELEASE)/__/compiler.o + +$(OBJDIR_RELEASE)/__/compiling.o: ../compiling.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../compiling.cpp -o $(OBJDIR_RELEASE)/__/compiling.o + +$(OBJDIR_RELEASE)/__/derivation.o: ../derivation.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../derivation.cpp -o $(OBJDIR_RELEASE)/__/derivation.o + +$(OBJDIR_RELEASE)/__/compilerlogic.o: ../compilerlogic.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../compilerlogic.cpp -o $(OBJDIR_RELEASE)/__/compilerlogic.o + +$(OBJDIR_RELEASE)/__/modulescope.o: ../modulescope.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../modulescope.cpp -o $(OBJDIR_RELEASE)/__/modulescope.o + +$(OBJDIR_RELEASE)/__/macos/elc.o: ../macos/elc.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../macos/elc.cpp -o $(OBJDIR_RELEASE)/__/macos/elc.o + +$(OBJDIR_RELEASE)/__/parser.o: ../parser.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../parser.cpp -o $(OBJDIR_RELEASE)/__/parser.o + +$(OBJDIR_RELEASE)/__/separser.o: ../separser.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../separser.cpp -o $(OBJDIR_RELEASE)/__/separser.o + +$(OBJDIR_RELEASE)/__/project.o: ../project.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../project.cpp -o $(OBJDIR_RELEASE)/__/project.o + +$(OBJDIR_RELEASE)/__/source.o: ../source.cpp + $(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c ../source.cpp -o $(OBJDIR_RELEASE)/__/source.o + +clean_release: + rm -f $(OBJ_RELEASE) $(OUT_RELEASE) + rm -rf $(OBJDIR_RELEASE)/__ + rm -rf $(OBJDIR_RELEASE)/__/__/engine + rm -rf $(OBJDIR_RELEASE)/__/macos + rm -rf $(OBJDIR_RELEASE)/__/__/common + +.PHONY: before_release after_release clean_release diff --git a/elenasrc3/elc/compiler.cpp b/elenasrc3/elc/compiler.cpp index a07e1b6c06..b2a725ef2b 100644 --- a/elenasrc3/elc/compiler.cpp +++ b/elenasrc3/elc/compiler.cpp @@ -6,6 +6,8 @@ // (C)2021-2025, by Aleksey Rakov //--------------------------------------------------------------------------- +//#define FULL_OUTOUT_INFO 1 + #include "compiler.h" #include "langcommon.h" #include @@ -13,7 +15,11 @@ #include "bytecode.h" -//#define FULL_OUTOUT_INFO 1 +#ifdef FULL_OUTOUT_INFO + +#include "serializer.h" + +#endif using namespace elena_lang; @@ -52,12 +58,18 @@ MethodHint operator | (const ref_t& l, const MethodHint& r) // } //} -//inline void storeNode(SyntaxNode node) -//{ -// DynamicUStr target; -// -// SyntaxTreeSerializer::save(node, target); -//} +#ifdef FULL_OUTOUT_INFO + +inline void printTree(PresenterBase* presenter, SyntaxNode node) +{ + DynamicUStr target; + + SyntaxTreeSerializer::save(node, target); + + presenter->print(target.str()); +} + +#endif // FULL_OUTOUT_INFO //inline void storeNode(BuildNode node) //{ @@ -912,7 +924,7 @@ ObjectInfo Compiler::NamespaceScope::defineObjectInfo(ref_t reference, Expressio info.reference = reference; } else { - if (checkMode) { + if (checkMode && !metaOne) { ClassInfo classInfo; if (moduleScope->loadClassInfo(classInfo, reference, true) != 0) { // if it is an extension @@ -1600,14 +1612,14 @@ bool Compiler::CodeScope::resolveAutoType(ObjectInfo& info, TypeInfo typeInfo, i // --- Compiler::ExprScope --- Compiler::ExprScope::ExprScope(SourceScope* parent) - : Scope(parent), tempLocals({}) + : Scope(parent), trackingClosureLocals(false), unboxingConflictFound(false), tempLocals({}), trackingLocals({}) { allocatedArgs = 0; tempAllocated2 = tempAllocated1 = 0; } Compiler::ExprScope::ExprScope(CodeScope* parent) - : Scope(parent), tempLocals({}) + : Scope(parent), trackingClosureLocals(false), unboxingConflictFound(false), tempLocals({}), trackingLocals({}) { allocatedArgs = 0; tempAllocated1 = parent->allocated1; @@ -1621,6 +1633,21 @@ int Compiler::ExprScope::newTempLocal() return tempAllocated1; } +ObjectInfo Compiler::ExprScope :: mapIdentifier(ustr_t identifier, bool referenceOne, ExpressionAttribute attr) +{ + ObjectInfo info = Scope::mapIdentifier(identifier, referenceOne, attr); + if (unboxingConflictFound && !trackingClosureLocals && info.kind != ObjectKind::Unknown) { + ObjectKey key = { info.kind, info.reference }; + + ObjectInfo temp = tempLocals.get(key); + if (temp.mode == TargetMode::RefUnboxingRequired) { + return temp; + } + } + + return info; +} + ObjectInfo Compiler::ExprScope::mapGlobal(ustr_t globalReference) { NamespaceScope* nsScope = Scope::getScope(*this, ScopeLevel::Namespace); @@ -1768,7 +1795,10 @@ ObjectInfo Compiler::InlineClassScope::mapIdentifier(ustr_t identifier, bool ref else { Outer outer = outers.get(identifier); if (outer.reference != INVALID_REF) { - return { ObjectKind::Outer, outer.outerObject.typeInfo, outer.reference, outer.outerObject.reference }; + if (outer.outerObject.kind == ObjectKind::TempLocal && outer.outerObject.mode == TargetMode::RefUnboxingRequired) { + return { ObjectKind::OuterField, outer.outerObject.typeInfo, outer.reference, TargetMode::RefUnboxingRequired }; + } + else return { ObjectKind::Outer, outer.outerObject.typeInfo, outer.reference, outer.outerObject.reference }; } else { outer.outerObject = parent->mapIdentifier(identifier, referenceOne, attr); @@ -1784,6 +1814,7 @@ ObjectInfo Compiler::InlineClassScope::mapIdentifier(ustr_t identifier, bool ref case ObjectKind::Param: case ObjectKind::ParamAddress: case ObjectKind::Local: + case ObjectKind::TempLocal: case ObjectKind::Outer: case ObjectKind::OuterField: case ObjectKind::OuterSelf: @@ -1802,6 +1833,10 @@ ObjectInfo Compiler::InlineClassScope::mapIdentifier(ustr_t identifier, bool ref if (outer.outerObject.kind == ObjectKind::OuterSelf) { return { ObjectKind::OuterSelf, outer.outerObject.typeInfo, outer.reference }; } + else if (outer.outerObject.kind == ObjectKind::TempLocal && outer.outerObject.mode == TargetMode::RefUnboxingRequired) { + // NOTE : recognize the updatable captured variable + return { ObjectKind::OuterField, outer.outerObject.typeInfo, outer.reference, TargetMode::RefUnboxingRequired }; + } else return { ObjectKind::Outer, outer.outerObject.typeInfo, outer.reference }; } case ObjectKind::Unknown: @@ -1822,25 +1857,30 @@ ObjectInfo Compiler::InlineClassScope::mapIdentifier(ustr_t identifier, bool ref bool Compiler::InlineClassScope::markAsPresaved(ObjectInfo object) { - if (object.kind == ObjectKind::Outer) { + if (object.kind == ObjectKind::Outer || (object.kind == ObjectKind::OuterField && object.mode == TargetMode::RefUnboxingRequired)) { auto it = outers.start(); while (!it.eof()) { if ((*it).reference == object.reference) { - if ((*it).outerObject.kind == ObjectKind::Local || (*it).outerObject.kind == ObjectKind::LocalAddress) { - (*it).updated = true; - - return true; - } - else if ((*it).outerObject.kind == ObjectKind::Outer) { - InlineClassScope* closure = (InlineClassScope*)parent->getScope(Scope::ScopeLevel::Class); - if (closure->markAsPresaved((*it).outerObject)) { + switch ((*it).outerObject.kind) { + case ObjectKind::Local: + case ObjectKind::TempLocal: + case ObjectKind::LocalAddress: (*it).updated = true; return true; + case ObjectKind::Outer: + { + InlineClassScope* closure = (InlineClassScope*)parent->getScope(Scope::ScopeLevel::Class); + if (closure->markAsPresaved((*it).outerObject)) { + (*it).updated = true; + + return true; + } + else return false; } - else return false; + default: + break; } - break; } it++; @@ -5089,6 +5129,11 @@ void Compiler::declareTemplate(TemplateScope& scope, SyntaxNode& node) saveTemplate(scope, node); +#ifdef FULL_OUTOUT_INFO + _presenter->print("\nSyntax tree:\n"); + printTree(_presenter, node); +#endif + node.setKey(SyntaxKey::Idle); } @@ -6804,7 +6849,7 @@ ObjectInfo Compiler::mapConstant(Scope& scope, SyntaxNode node) ObjectInfo Compiler::mapIntConstant(Scope& scope, SyntaxNode node, int radix) { - int integer = StrConvertor::toInt(node.identifier(), radix); + int integer = node.identifier().empty() ? 0 : StrConvertor::toInt(node.identifier(), radix); if (errno == ERANGE) scope.raiseError(errInvalidIntNumber, node); @@ -11044,6 +11089,11 @@ bool Compiler::Class::isParentDeclared(SyntaxNode node) void Compiler::Class::declare(SyntaxNode node) { +#ifdef FULL_OUTOUT_INFO + compiler->_presenter->print("\nSyntax tree:\n"); + printTree(compiler->_presenter, node); +#endif + bool extensionDeclaration = isExtensionDeclaration(node); resolveClassPostfixes(node, extensionDeclaration); @@ -11370,6 +11420,45 @@ ObjectInfo Compiler::Expression::compileSymbolRoot(SyntaxNode bodyNode, EAttr mo return retVal; } +inline int countClosures(SyntaxNode node) +{ + SyntaxNode current = node.firstChild(); + int counter = 0; + while (current != SyntaxKey::None) { + switch (current.key) { + case SyntaxKey::Expression: + case SyntaxKey::Object: + case SyntaxKey::MessageOperation: + case SyntaxKey::PropertyOperation: + counter += countClosures(current); + break; + case SyntaxKey::NestedBlock: + case SyntaxKey::ClosureBlock: + case SyntaxKey::LazyOperation: + counter++; + break; + default: + break; + } + + current = current.nextNode(); + } + + return counter; +} + +inline bool isClosureConflictExpected(SyntaxNode node) +{ + SyntaxNode current = node == SyntaxKey::Expression ? node.firstChild() : node; + switch (current.key) { + case SyntaxKey::MessageOperation: + case SyntaxKey::PropertyOperation: + return countClosures(current) > 1; + default: + return false; + } +} + ObjectInfo Compiler::Expression::compileRoot(SyntaxNode node, EAttr mode) { SyntaxNode current = node.firstChild(); @@ -11384,6 +11473,12 @@ ObjectInfo Compiler::Expression::compileRoot(SyntaxNode node, EAttr mode) Compiler::addBreakpoint(*writer, findObjectNode(node), BuildKey::Breakpoint); } + if (isClosureConflictExpected(node)) { + scope.trackingClosureLocals = true; + + mode = mode | EAttr::LookaheadExprMode; + } + auto retVal = compile(node, 0, mode, nullptr); //if (isBoxingRequired(retVal)) { @@ -11723,6 +11818,19 @@ ObjectInfo Compiler::Expression :: compileObject(SyntaxNode node, ExpressionAttr else return compile(node, 0, mode, updatedOuterArgs); } +void Compiler::Expression :: prepareConflictResolution() +{ + scope.trackingClosureLocals = false; + + for (auto it = scope.trackingLocals.start(); !it.eof(); ++it) { + if ((*it).mode == TrackingMode::Updated) { + ObjectInfo local = { it.key().value1, (*it).typeInfo, it.key().value2 }; + + scope.tempLocals.add(it.key(), boxRefArgumentInPlace(local)); + } + } +} + ObjectInfo Compiler::Expression::compileLookAhead(SyntaxNode node, ref_t targetRef, ExpressionAttribute mode) { BuildNode lastNode = writer->CurrentNode().lastChild(); @@ -11741,8 +11849,11 @@ ObjectInfo Compiler::Expression::compileLookAhead(SyntaxNode node, ref_t targetR break; } - if (!targetRef && compiler->_logic->isEmbeddable(*scope.moduleScope, retVal.typeInfo.typeRef)) { - targetRef = retVal.typeInfo.typeRef; + bool overrideTarget = !targetRef && compiler->_logic->isEmbeddable(*scope.moduleScope, retVal.typeInfo.typeRef); + if (overrideTarget || scope.unboxingConflictFound) { + if (overrideTarget) + targetRef = retVal.typeInfo.typeRef; + // bad luck, we must rollback the changes and compile again lastNode = lastNode.nextNode(); while (lastNode != BuildKey::None) { @@ -11751,6 +11862,10 @@ ObjectInfo Compiler::Expression::compileLookAhead(SyntaxNode node, ref_t targetR lastNode = lastNode.nextNode(); } + if (scope.unboxingConflictFound) { + prepareConflictResolution(); + } + switch (node.key) { case SyntaxKey::MessageOperation: retVal = compileMessageOperation(node, targetRef, mode); @@ -13437,6 +13552,22 @@ void Compiler::Expression :: compileNestedInitializing(InlineClassScope& classSc break; } + // HOTFIX : tracking possible conflict with closure unwrapping + bool needToBeTracked = arg.kind == ObjectKind::Local && scope.trackingClosureLocals; + if (needToBeTracked) { + ObjectKey key = { arg.kind, arg.reference }; + + TrackingMode trackInfo = scope.trackingLocals.get(key).mode; + if (((*it).updated && trackInfo != TrackingMode::None) + || trackInfo == TrackingMode::Updated) + { + scope.unboxingConflictFound = true; + } + + scope.trackingLocals.erase(key); + scope.trackingLocals.add(key, { arg.typeInfo, (*it).updated ? TrackingMode::Updated : TrackingMode::Captched }); + } + if (updatedOuterArgs && (*it).updated) { if (!preservedContext) { updatedOuterArgs->add({ ObjectKind::ContextInfo }); @@ -14240,7 +14371,7 @@ ObjectInfo Compiler::Expression::boxArgumentLocally(ObjectInfo info, } } -ObjectInfo Compiler::Expression::unboxArguments(ObjectInfo retVal, ArgumentsInfo* updatedOuterArgs) +ObjectInfo Compiler::Expression :: unboxArguments(ObjectInfo retVal, ArgumentsInfo* updatedOuterArgs) { // unbox the arguments if required bool resultSaved = false; @@ -14266,9 +14397,18 @@ ObjectInfo Compiler::Expression::unboxArguments(ObjectInfo retVal, ArgumentsInfo unboxArgumentLocaly(temp, key); } else if (temp.mode == TargetMode::RefUnboxingRequired) { - temp.kind = ObjectKind::Local; + if (temp.kind == ObjectKind::LocalReference) { + temp.kind = ObjectKind::Local; - compileAssigningOp({ ObjectKind::Local, temp.typeInfo, key.value2 }, temp, dummy); + compileAssigningOp({ ObjectKind::Local, temp.typeInfo, key.value2 }, temp, dummy); + } + else { + writeObjectInfo(temp); + writer->appendNode(BuildKey::Field); + compileAssigningOp( + { ObjectKind::Local, temp.typeInfo, key.value2 }, + { ObjectKind::Object, temp.typeInfo, 0 }, dummy); + } } else if (key.value1 == ObjectKind::RefLocal) { writeObjectInfo(temp); @@ -14413,7 +14553,12 @@ bool Compiler::Expression::compileAssigningOp(ObjectInfo target, ObjectInfo expr fieldMode = true; break; case ObjectKind::OuterField: - scope.markAsAssigned(target); + if (target.mode == TargetMode::RefUnboxingRequired) { + InlineClassScope* closure = Scope::getScope(scope, Scope::ScopeLevel::Class); + if (!closure->markAsPresaved(target)) + return false; + } + else scope.markAsAssigned(target); operationType = BuildKey::FieldAssigning; operand = target.extra; fieldFieldMode = fieldMode = true; @@ -14585,8 +14730,31 @@ ObjectInfo Compiler::Expression::compileBranchingOperation(SyntaxNode node, Obje else { context.weakMessage = compiler->resolveOperatorMessage(scope.moduleScope, operatorId); + // HOTFIX : to deal with conflicting unboxing captured locals + scope.trackingClosureLocals = true; + BuildNode lastNode = writer->CurrentNode().lastChild(); + roperand = compileClosure(rnode, 0, EAttr::None, updatedOuterArgs); roperand2 = compileClosure(r2node, 0, EAttr::None, updatedOuterArgs); + + scope.trackingClosureLocals = false; + if (scope.unboxingConflictFound) { + // bad luck, we have to rollback the latest changes and compile them again + lastNode = lastNode.nextNode(); + while (lastNode != BuildKey::None) { + lastNode.setKey(BuildKey::Idle); + + lastNode = lastNode.nextNode(); + } + + prepareConflictResolution(); + updatedOuterArgs->clear(); + + roperand = compileClosure(rnode, 0, EAttr::None, updatedOuterArgs); + roperand2 = compileClosure(r2node, 0, EAttr::None, updatedOuterArgs); + + scope.unboxingConflictFound = false; + } } ArgumentsInfo messageArguments; @@ -15325,7 +15493,7 @@ ObjectInfo Compiler::Expression::boxArgument(ObjectInfo info, bool stackSafe, bo retVal = boxArgumentInPlace(info, targetRef); } - else retVal = boxRefArgumentInPlace(info, targetRef); + else retVal = boxRefArgumentLocallyInPlace(info, targetRef); if (!boxInPlace) scope.tempLocals.add(key, retVal); @@ -15483,7 +15651,7 @@ void Compiler::Expression::unboxOuterArgs(ArgumentsInfo* updatedOuterArgs) closure.extra = info.reference; compileAssigningOp(source, closure, dummy); } - else if (source.kind == ObjectKind::Outer) { + else if (source.kind == ObjectKind::Outer || (source.kind == ObjectKind::TempLocal && source.mode == TargetMode::RefUnboxingRequired)) { // ignore outer fields } else assert(false); @@ -15625,7 +15793,7 @@ ObjectInfo Compiler::Expression::boxArgumentInPlace(ObjectInfo info, ref_t targe return tempLocal; } -ObjectInfo Compiler::Expression::boxRefArgumentInPlace(ObjectInfo info, ref_t targetRef) +ObjectInfo Compiler::Expression :: boxRefArgumentLocallyInPlace(ObjectInfo info, ref_t targetRef) { bool dummy = false; ref_t typeRef = targetRef; @@ -15643,6 +15811,32 @@ ObjectInfo Compiler::Expression::boxRefArgumentInPlace(ObjectInfo info, ref_t ta return tempLocal; } +ObjectInfo Compiler::Expression :: boxRefArgumentInPlace(ObjectInfo info, ref_t targetRef) +{ + bool dummy = false; + ref_t typeRef = targetRef; + if (!typeRef) + typeRef = compiler->resolveStrongType(scope, info.typeInfo); + + ObjectInfo tempLocal = declareTempLocal(typeRef); + tempLocal.mode = TargetMode::RefUnboxingRequired; + + info.kind = ObjectKind::TempLocal; + + writeObjectInfo(info); + writer->appendNode(BuildKey::SavingInStack, 0); + + // create a wrapper + writer->newNode(BuildKey::CreatingClass, 1); + writer->appendNode(BuildKey::Type, scope.moduleScope->buildins.superReference); + writer->closeNode(); + writer->appendNode(BuildKey::FieldAssigning, 0); + + compileAssigningOp(tempLocal, { ObjectKind::Object }, dummy); + + return tempLocal; +} + ObjectInfo Compiler::Expression :: boxVariadicArgument(ObjectInfo info) { bool dummy = false; diff --git a/elenasrc3/elc/compiler.h b/elenasrc3/elc/compiler.h index 068a91f851..099c59cfdf 100644 --- a/elenasrc3/elc/compiler.h +++ b/elenasrc3/elc/compiler.h @@ -121,6 +121,13 @@ namespace elena_lang Weak, }; + enum class TrackingMode + { + None = 0, + Captched, + Updated + }; + enum DeclResult : int { Success = 0, @@ -249,8 +256,25 @@ namespace elena_lang } }; + struct ObjectTrackingInfo + { + TypeInfo typeInfo; + TrackingMode mode; + + ObjectTrackingInfo() + : typeInfo({}), mode(TrackingMode::None) + { + } + ObjectTrackingInfo(TypeInfo typeInfo, TrackingMode mode) + : typeInfo(typeInfo), mode(mode) + { + + } + }; + typedef Pair ObjectKey; - typedef MemoryMap, Map_GetKey> ObjectKeys; + typedef MemoryMap, Map_GetKey> ObjectKeyMap; + typedef Map ObjectTrackingMap; typedef CachedList TemplateTypeList; struct Parameter @@ -967,7 +991,10 @@ namespace elena_lang struct ExprScope : Scope { - ObjectKeys tempLocals; + bool trackingClosureLocals; + bool unboxingConflictFound; + ObjectKeyMap tempLocals; + ObjectTrackingMap trackingLocals; // is used to keep track of used in the closure local variables (when trackingClosureLocals is on) pos_t allocatedArgs; pos_t tempAllocated1; @@ -1015,6 +1042,7 @@ namespace elena_lang else return {}; } + ObjectInfo mapIdentifier(ustr_t identifier, bool referenceOne, ExpressionAttribute attr) override; ObjectInfo mapMember(ustr_t identifier) override; ObjectInfo mapGlobal(ustr_t globalReference) override; @@ -1318,6 +1346,8 @@ namespace elena_lang bool checkValidity(ObjectInfo target, CheckMethodResult& result, bool allowPrivateCall); bool checkValidity(ObjectInfo target, MessageResolution& resolution, bool allowPrivateCall); + void prepareConflictResolution(); + ObjectInfo compileLookAhead(SyntaxNode node, ref_t targetRef, ExpressionAttribute attrs); @@ -1396,6 +1426,7 @@ namespace elena_lang ObjectInfo boxLocally(ObjectInfo info, bool stackSafe); ObjectInfo boxPtrLocally(ObjectInfo info); ObjectInfo boxArgumentInPlace(ObjectInfo info, ref_t targetRef = 0); + ObjectInfo boxRefArgumentLocallyInPlace(ObjectInfo info, ref_t targetRef = 0); ObjectInfo boxRefArgumentInPlace(ObjectInfo info, ref_t targetRef = 0); ObjectInfo boxVariadicArgument(ObjectInfo info); diff --git a/elenasrc3/elc/compiling.cpp b/elenasrc3/elc/compiling.cpp index 363e2b8d20..6c54df8c21 100644 --- a/elenasrc3/elc/compiling.cpp +++ b/elenasrc3/elc/compiling.cpp @@ -326,7 +326,8 @@ CompilingProcess :: CompilingProcess(path_t appPath, path_t exeExtension, ) : _appPath(appPath), _templateGenerator(this), - _forwards(nullptr) + _forwards(nullptr), + _parser(nullptr) { _exeExtension = exeExtension; _modulePrologName = modulePrologName; @@ -688,7 +689,7 @@ void CompilingProcess :: compile(ProjectBase& project, LexicalMap::Iterator lexical_it = project.getLexicalIterator(); compiled |= buildModule( - env, + env, lexical_it, *module_it, &syntaxTree, &project, moduleSettings, @@ -706,6 +707,10 @@ void CompilingProcess :: compile(ProjectBase& project, void CompilingProcess :: link(Project& project, LinkerBase& linker, bool withTLS) { + // ignore link operation for trace mode + if (project.BoolSetting(ProjectOption::TracingMode)) + return; + PlatformType uiType = project.UITargetType(); _presenter->print(ELC_LINKING); @@ -763,7 +768,10 @@ void CompilingProcess :: cleanUp(ProjectBase& project) _libraryProvider.resolvePath(module_it->name(), path); // remove a module - PathUtil::removeFile(*path); + if (!PathUtil::removeFile(*path) && _verbose) { + if (PathUtil::ifExist(*path)) + _presenter->printPath("cannot remove file %s\n", *path); + } // remove a debug module path.changeExtension("dnl"); @@ -895,3 +903,107 @@ int CompilingProcess :: build(Project& project, return ERROR_RET_CODE; } } + +// --- CommandHelper --- + +void CommandHelper :: handleOption(ustr_t arg, IdentifierString& profile, Project& project, CompilingProcess& process, + ErrorProcessor& errorProcessor, bool& cleanMode) +{ + switch (arg[1]) { + case 'e': + if (arg.compare("-el5")) { + project.setSyntaxVersion(SyntaxVersion::L5); + } + else if (arg.compare("-el6")) { + project.setSyntaxVersion(SyntaxVersion::L6); + } + break; + case 'f': + process.addForward(arg + 2); + break; + case 'l': + profile.copy(arg + 2); + break; + case 'm': + project.addBoolSetting(ProjectOption::MappingOutputMode, true); + break; + case 'o': + if (arg[2] == '0') { + project.addIntSetting(ProjectOption::OptimizationMode, optNone); + } + else if (arg[2] == '1') { + project.addIntSetting(ProjectOption::OptimizationMode, optLow); + } + else if (arg[2] == '2') { + project.addIntSetting(ProjectOption::OptimizationMode, optMiddle); + } + else if (arg[2] == '3') { + project.addIntSetting(ProjectOption::OptimizationMode, optHigh); + } + break; + case 'p': + { + PathString path(arg + 2); + + project.setBasePath(*path); + break; + } + case 'r': + cleanMode = true; + break; + case 's': + { + ustr_t setting = arg + 2; + if (setting.compareSub("stackReserv:", 0, 12)) { + ustr_t valStr = setting + 12; + int val = StrConvertor::toInt(valStr, 10); + project.addIntSetting(ProjectOption::StackReserved, val); + } + break; + } + case 'v': + process.setVerboseOn(); + break; + case 'w': + if (arg[2] == '0') { + errorProcessor.setWarningLevel(WarningLevel::Level0); + } + else if (arg[2] == '1') { + errorProcessor.setWarningLevel(WarningLevel::Level1); + } + else if (arg[2] == '2') { + errorProcessor.setWarningLevel(WarningLevel::Level2); + } + else if (arg[2] == '3') { + errorProcessor.setWarningLevel(WarningLevel::Level3); + } + break; + case 'x': + if (arg[2] == 'b') { + project.addBoolSetting(ProjectOption::ConditionalBoxing, arg[3] != '-'); + } + else if (arg[2] == 'e') { + project.addBoolSetting(ProjectOption::EvaluateOp, arg[3] != '-'); + } + else if (arg[2] == 'j') { + project.addBoolSetting(ProjectOption::WithJumpAlignment, arg[3] != '-'); + } + else if (arg[2] == 'm') { + project.addBoolSetting(ProjectOption::ModuleExtensionAutoLoad, arg[3] != '-'); + } + else if (arg[2] == 'p') { + project.addBoolSetting(ProjectOption::GenerateParamNameInfo, arg[3] != '-'); + } + else if (arg[2] == 's') { + project.addBoolSetting(ProjectOption::StrictTypeEnforcing, arg[3] != '-'); + } + break; + case '-': + if (arg.compare("--tracing")) { + project.addBoolSetting(ProjectOption::TracingMode, true); + } + break; + default: + break; + } +} diff --git a/elenasrc3/elc/compiling.h b/elenasrc3/elc/compiling.h index e88a798e52..5ab42ac70f 100644 --- a/elenasrc3/elc/compiling.h +++ b/elenasrc3/elc/compiling.h @@ -169,6 +169,13 @@ namespace elena_lang freeobj(_compiler); } }; + + class CommandHelper + { + public: + static void handleOption(ustr_t arg, IdentifierString& profile, Project& project, CompilingProcess& process, + ErrorProcessor& errorProcessor, bool& cleanMode); + }; } #endif // COMPLING_H diff --git a/elenasrc3/elc/linux/elc.cpp b/elenasrc3/elc/linux/elc.cpp index bd5e0930cc..68a51910f9 100644 --- a/elenasrc3/elc/linux/elc.cpp +++ b/elenasrc3/elc/linux/elc.cpp @@ -3,7 +3,7 @@ // // This file contains the main body of the Linux command-line compiler // -// (C)2021-2024, by Aleksey Rakov +// (C)2021-2025, by Aleksey Rakov //--------------------------------------------------------------------------- #include "elena.h" @@ -160,168 +160,161 @@ JITCompilerBase* createJITCompiler(LibraryLoaderBase* loader, PlatformType platf } } +void handleOption(char* arg, IdentifierString& profile, Project& project, CompilingProcess& process, + ErrorProcessor& errorProcessor, path_t dataPath, bool& cleanMode) +{ + switch (arg[1]) { + case 't': + { + IdentifierString configName(arg + 2); + + project.loadConfigByName(dataPath, *configName, true); + break; + } + case 'p': + project.setBasePath(arg + 2); + break; + default: + { + IdentifierString argStr(arg); + + CommandHelper::handleOption(*argStr, profile, project, process, errorProcessor, cleanMode); + break; + } + } +} + +int compileProject(int argc, char** argv, path_t dataPath, ErrorProcessor& errorProcessor, + CompilingProcess& process) +{ + bool cleanMode = false; + + Project project(dataPath, CURRENT_PLATFORM, &Presenter::getInstance()); + LinuxLinker linker(&errorProcessor, &LinuxImageFormatter::getInstance(&project)); + + // Initializing... + path_t defaultConfigPath = PathHelper::retrieveFilePath(LOCAL_DEFAULT_CONFIG); + if (defaultConfigPath.compare(LOCAL_DEFAULT_CONFIG)) { + // if the local config file was not found + defaultConfigPath = DEFAULT_CONFIG; + } + + PathString configPath(dataPath, PathHelper::retrieveFilePath(defaultConfigPath)); + project.loadConfig(*configPath, nullptr, false); + + IdentifierString profile; + for (int i = 1; i < argc; i++) { + if (argv[i][0] == '-') { + handleOption(argv[i], profile, project, process, + errorProcessor, dataPath, cleanMode); + } + else if (PathUtil::checkExtension(argv[i], "prj")) { + PathString path(argv[i]); + if (!project.loadProject(*path, *profile)) { + return ERROR_RET_CODE; + } + + if (profile.empty() && project.availableProfileList.count() != 0) { + IdentifierString profileList; + for (auto it = project.availableProfileList.start(); !it.eof(); ++it) { + if (profileList.length() != 0) + profileList.append(", "); + + profileList.append(*it); + } + + Presenter::getInstance().printLine(ELC_PROFILE_WARNING, *profileList); + } + } + else if (PathUtil::checkExtension(argv[i], "prjcol")) { + Presenter::getInstance().printLine(ELC_PRJ_COLLECTION_WARNING); + return -2; + } + else { + FileNameString fileName(argv[i]); + + project.addSource(*fileName, argv[i], nullptr, nullptr); + } + } + + if (cleanMode) { + return process.clean(project); + } + else { + // Building... + return process.build(project, linker, + DEFAULT_STACKALIGNMENT, + DEFAULT_RAW_STACKALIGNMENT, + DEFAULT_EHTABLE_ENTRY_SIZE, + MINIMAL_ARG_LIST, + *profile); + } +} + +int compileProjectCollection(int argc, char** argv, path_t path, path_t dataPath, + ErrorProcessor& errorProcessor, CompilingProcess& process) +{ + Presenter* presenter = &Presenter::getInstance(); + + int retVal = 0; + ProjectCollection collection; + + if (!collection.load(path)) { + presenter->printPath(presenter->getMessage(wrnInvalidConfig), path); + + return ERROR_RET_CODE; + } + + for (auto it = collection.paths.start(); !it.eof(); ++it) { + size_t destLen = FILENAME_MAX; + char projectPath[FILENAME_MAX]; + StrConvertor::copy(projectPath, (*it).str(), (*it).length(), destLen); + projectPath[destLen] = 0; + + argv[argc - 1] = projectPath; + presenter->printPath(ELC_COMPILING_PROJECT, projectPath); + + int result = compileProject(argc, argv, dataPath, errorProcessor, process); + if (result == ERROR_RET_CODE) { + return ERROR_RET_CODE; + } + else if (result == WARNING_RET_CODE) { + retVal = WARNING_RET_CODE; + } + } + + return retVal; +} + const char* dataFileList[] = { BC_RULES_FILE, BT_RULES_FILE, SYNTAX60_FILE }; int main(int argc, char* argv[]) { try { - bool cleanMode = false; - PathString dataPath(PathHelper::retrievePath(dataFileList, 3, DATA_PATH)); JITSettings defaultCoreSettings = { DEFAULT_MGSIZE, DEFAULT_YGSIZE, DEFAULT_STACKRESERV, 1, true, true }; ErrorProcessor errorProcessor(&Presenter::getInstance()); - Project project(*dataPath, CURRENT_PLATFORM, &Presenter::getInstance()); - LinuxLinker linker(&errorProcessor, &LinuxImageFormatter::getInstance(&project)); CompilingProcess process(*dataPath, nullptr, "", "", "", &Presenter::getInstance(), &errorProcessor, VA_ALIGNMENT, defaultCoreSettings, createJITCompiler); process.greeting(); - // Initializing... - path_t defaultConfigPath = PathHelper::retrieveFilePath(LOCAL_DEFAULT_CONFIG); - if (defaultConfigPath.compare(LOCAL_DEFAULT_CONFIG)) { - // if the local config file was not found - defaultConfigPath = DEFAULT_CONFIG; - } - - PathString configPath(*dataPath, PathHelper::retrieveFilePath(defaultConfigPath)); - project.loadConfig(*configPath, nullptr, false); - - // Reading command-line arguments... + // Reading command-line arguments... if (argc < 2) { Presenter::getInstance().printLine(ELC_HELP_INFO); - return -3; - } - - IdentifierString profile; - for (int i = 1; i < argc; i++) { - if (argv[i][0] == '-') { - switch (argv[i][1]) { - case 'f': - { - IdentifierString setting(argv[i] + 2); - process.addForward(*setting); - - break; - } - case 'l': - profile.copy(argv[i] + 2); - break; - case 'm': - project.addBoolSetting(ProjectOption::MappingOutputMode, true); - break; - case 'o': - if (argv[i][2] == '0') { - project.addIntSetting(ProjectOption::OptimizationMode, optNone); - } - else if (argv[i][2] == '1') { - project.addIntSetting(ProjectOption::OptimizationMode, optLow); - } - else if (argv[i][2] == '2') { - project.addIntSetting(ProjectOption::OptimizationMode, optMiddle); - } - else if (argv[i][2] == '3') { - project.addIntSetting(ProjectOption::OptimizationMode, optHigh); - } - break; - case 'p': - project.setBasePath(argv[i] + 2); - break; - case 'r': - cleanMode = true; - break; - case 's': - { - IdentifierString setting(argv[i] + 2); - if (setting.compare("stackReserv:", 0, 12)) { - ustr_t valStr = *setting + 12; - int val = StrConvertor::toInt(valStr, 10); - project.addIntSetting(ProjectOption::StackReserved, val); - } - break; - } - case 't': - { - IdentifierString configName(argv[i] + 2); - - project.loadConfigByName(*dataPath, *configName, true); - break; - } - case 'v': - process.setVerboseOn(); - break; - case 'w': - if (argv[i][2] == '0') { - errorProcessor.setWarningLevel(WarningLevel::Level0); - } - else if (argv[i][2] == '1') { - errorProcessor.setWarningLevel(WarningLevel::Level1); - } - else if (argv[i][2] == '2') { - errorProcessor.setWarningLevel(WarningLevel::Level2); - } - else if (argv[i][2] == '3') { - errorProcessor.setWarningLevel(WarningLevel::Level3); - } - break; - case 'x': - if (argv[i][2] == 'b') { - project.addBoolSetting(ProjectOption::ConditionalBoxing, argv[i][3] != '-'); - } - else if (argv[i][2] == 'e') { - project.addBoolSetting(ProjectOption::EvaluateOp, argv[i][3] != '-'); - } - else if (argv[i][2] == 'p') { - project.addBoolSetting(ProjectOption::GenerateParamNameInfo, argv[i][3] != '-'); - } - break; - default: - break; - } - } - else if (PathUtil::checkExtension(argv[i], "project")) { - PathString path(argv[i]); - - if (!project.loadProject(*path, *profile)) { - errorProcessor.raisePathError(errProjectAlreadyLoaded, *path); - } - else if (profile.empty() && project.availableProfileList.count() != 0) { - IdentifierString profileList; - for (auto it = project.availableProfileList.start(); !it.eof(); ++it) { - if (profileList.length() != 0) - profileList.append(", "); - - profileList.append(*it); - } - - Presenter::getInstance().printLine(ELC_PROFILE_WARNING, *profileList); - } - } - else { - FileNameString fileName(argv[i]); - - project.addSource(*fileName, argv[i], nullptr, nullptr); - } - } - - if (cleanMode) { - return process.clean(project); + return -2; } - else { - // Building... - return process.build(project, linker, - DEFAULT_STACKALIGNMENT, - DEFAULT_RAW_STACKALIGNMENT, - DEFAULT_EHTABLE_ENTRY_SIZE, - MINIMAL_ARG_LIST, - *profile); + else if (argv[argc - 1][0] != '-' && PathUtil::checkExtension(argv[argc - 1], "prjcol")) { + return compileProjectCollection(argc, argv, argv[argc - 1], + *dataPath, errorProcessor, process); } + else return compileProject(argc, argv, *dataPath, errorProcessor, process); } - catch (CLIException e) + catch (CLIException) { - return -2; + return ERROR_RET_CODE; } } diff --git a/elenasrc3/elc/linux/elfarmimage.h b/elenasrc3/elc/linux/elfarmimage.h index d30ff8c49c..adb41afb7d 100644 --- a/elenasrc3/elc/linux/elfarmimage.h +++ b/elenasrc3/elc/linux/elfarmimage.h @@ -6,8 +6,8 @@ // (C)2021-2023, by Aleksey Rakov //--------------------------------------------------------------------------- -#ifndef ELFPPCIMAGE_H -#define ELFPPCIMAGE_H +#ifndef ELFARMIMAGE_H +#define ELFARMIMAGE_H #include "elfimage.h" diff --git a/elenasrc3/elc/macos/elc.cpp b/elenasrc3/elc/macos/elc.cpp new file mode 100644 index 0000000000..8d31208b39 --- /dev/null +++ b/elenasrc3/elc/macos/elc.cpp @@ -0,0 +1,251 @@ +//--------------------------------------------------------------------------- +// E L E N A P r o j e c t: ELENA command-Line Compiler +// +// This file contains the main body of the macOS command-line compiler +// +// (C)2025, by Aleksey Rakov +//--------------------------------------------------------------------------- + +#include "elena.h" +// -------------------------------------------------------------------------- +#include "cliconst.h" +#include "compiling.h" +#include "project.h" +//#include "elfimage.h" + +#if defined(__aarch64__) + +//#include "elfarmlinker64.h" +//#include "arm64compiler.h" +//#include "elfarmimage.h" + +#endif + +#include "constants.h" +#include "messages.h" +#include "linux/presenter.h" +//#include "linux/pathmanager.h" + +#include + +using namespace elena_lang; + +#if defined(__aarch64__) + +constexpr auto CURRENT_PLATFORM = PlatformType::MacOS_ARM64; + +constexpr int MINIMAL_ARG_LIST = 2; + +constexpr auto DEFAULT_STACKALIGNMENT = 2; +constexpr auto DEFAULT_RAW_STACKALIGNMENT = 16; +constexpr auto DEFAULT_EHTABLE_ENTRY_SIZE = 32; + +typedef MachOARM64Linker MacOSLinker; +typedef MachOARM64ImageFormatter MacOSImageFormatter; + +#endif + +constexpr int DEFAULT_MGSIZE = 688128; +constexpr int DEFAULT_YGSIZE = 204800; +constexpr int DEFAULT_STACKRESERV = 0x100000; + +class Presenter : public LinuxConsolePresenter +{ +public: + ustr_t getMessage(int code) + { + for(size_t i = 0; i < MessageLength; i++) { + if (Messages[i].value1 == code) + return Messages[i].value2; + } + + return errMsgUnrecognizedError; + } + + static Presenter& getInstance() + { + static Presenter instance; + + return instance; + } + +private: + Presenter() = default; + +public: + Presenter(Presenter const&) = delete; + void operator=(Presenter const&) = delete; + + ~Presenter() = default; +}; + +JITCompilerBase* createJITCompiler(LibraryLoaderBase* loader, PlatformType platform) +{ + switch (platform) { +#if defined(__aarch64__) + case PlatformType::MacOS_ARM64: + return new ARM64JITCompiler(); +#endif + default: + return nullptr; + } +} + +void handleOption(char* arg, IdentifierString& profile, Project& project, CompilingProcess& process, + ErrorProcessor& errorProcessor, path_t dataPath, bool& cleanMode) +{ + switch (arg[1]) { + case 't': + { + IdentifierString configName(arg + 2); + + project.loadConfigByName(dataPath, *configName, true); + break; + } + case 'p': + project.setBasePath(arg + 2); + break; + default: + { + IdentifierString argStr(arg); + + CommandHelper::handleOption(*argStr, profile, project, process, errorProcessor, cleanMode); + break; + } + } +} + +int compileProject(int argc, char** argv, path_t dataPath, ErrorProcessor& errorProcessor, + CompilingProcess& process) +{ + bool cleanMode = false; + + Project project(dataPath, CURRENT_PLATFORM, &Presenter::getInstance()); + MacOSLinker linker(&errorProcessor, &MacOSImageFormatter::getInstance(&project)); + + // Initializing... + path_t defaultConfigPath /*= PathHelper::retrieveFilePath(LOCAL_DEFAULT_CONFIG)*/; +// if (defaultConfigPath.compare(LOCAL_DEFAULT_CONFIG)) { + // if the local config file was not found + defaultConfigPath = DEFAULT_CONFIG; +// } + + PathString configPath(dataPath, /*PathHelper::retrieveFilePath(*/defaultConfigPath/*)*/); + project.loadConfig(*configPath, nullptr, false); + + IdentifierString profile; + for (int i = 1; i < argc; i++) { + if (argv[i][0] == '-') { + handleOption(argv[i], profile, project, process, + errorProcessor, dataPath, cleanMode); + } + else if (PathUtil::checkExtension(argv[i], "prj")) { + PathString path(argv[i]); + if (!project.loadProject(*path, *profile)) { + return ERROR_RET_CODE; + } + + if (profile.empty() && project.availableProfileList.count() != 0) { + IdentifierString profileList; + for (auto it = project.availableProfileList.start(); !it.eof(); ++it) { + if (profileList.length() != 0) + profileList.append(", "); + + profileList.append(*it); + } + + Presenter::getInstance().printLine(ELC_PROFILE_WARNING, *profileList); + } + } + else if (PathUtil::checkExtension(argv[i], "prjcol")) { + Presenter::getInstance().printLine(ELC_PRJ_COLLECTION_WARNING); + return -2; + } + else { + FileNameString fileName(argv[i]); + + project.addSource(*fileName, argv[i], nullptr, nullptr); + } + } + + if (cleanMode) { + return process.clean(project); + } + else { + // Building... + return process.build(project, linker, + DEFAULT_STACKALIGNMENT, + DEFAULT_RAW_STACKALIGNMENT, + DEFAULT_EHTABLE_ENTRY_SIZE, + MINIMAL_ARG_LIST, + *profile); + } +} + +int compileProjectCollection(int argc, char** argv, path_t path, path_t dataPath, + ErrorProcessor& errorProcessor, CompilingProcess& process) +{ + Presenter* presenter = &Presenter::getInstance(); + + int retVal = 0; + ProjectCollection collection; + + if (!collection.load(path)) { + presenter->printPath(presenter->getMessage(wrnInvalidConfig), path); + + return ERROR_RET_CODE; + } + + for (auto it = collection.paths.start(); !it.eof(); ++it) { + size_t destLen = FILENAME_MAX; + char projectPath[FILENAME_MAX]; + StrConvertor::copy(projectPath, (*it).str(), (*it).length(), destLen); + projectPath[destLen] = 0; + + argv[argc - 1] = projectPath; + presenter->printPath(ELC_COMPILING_PROJECT, projectPath); + + int result = compileProject(argc, argv, dataPath, errorProcessor, process); + if (result == ERROR_RET_CODE) { + return ERROR_RET_CODE; + } + else if (result == WARNING_RET_CODE) { + retVal = WARNING_RET_CODE; + } + } + + return retVal; +} + +//const char* dataFileList[] = { BC_RULES_FILE, BT_RULES_FILE, SYNTAX60_FILE }; + +int main(int argc, char* argv[]) +{ + try + { + PathString dataPath(/*PathHelper::retrievePath(dataFileList, 3, */DATA_PATH/*)*/); + + JITSettings defaultCoreSettings = { DEFAULT_MGSIZE, DEFAULT_YGSIZE, DEFAULT_STACKRESERV, 1, true, true }; + ErrorProcessor errorProcessor(&Presenter::getInstance()); + CompilingProcess process(*dataPath, nullptr, "", "", "", + &Presenter::getInstance(), &errorProcessor, + VA_ALIGNMENT, defaultCoreSettings, createJITCompiler); + + process.greeting(); + + // Reading command-line arguments... + if (argc < 2) { + Presenter::getInstance().printLine(ELC_HELP_INFO); + return -2; + } + else if (argv[argc - 1][0] != '-' && PathUtil::checkExtension(argv[argc - 1], "prjcol")) { + return compileProjectCollection(argc, argv, argv[argc - 1], + *dataPath, errorProcessor, process); + } + else return compileProject(argc, argv, *dataPath, errorProcessor, process); + } + catch (CLIException) + { + return ERROR_RET_CODE; + } +} diff --git a/elenasrc3/elc/macos/machoarmimage.cpp b/elenasrc3/elc/macos/machoarmimage.cpp new file mode 100644 index 0000000000..e37a3489e1 --- /dev/null +++ b/elenasrc3/elc/macos/machoarmimage.cpp @@ -0,0 +1,11 @@ +//--------------------------------------------------------------------------- +// E L E N A P r o j e c t: ELENA Compiler +// +// This file contains ELENA Executive MachO Image class implementation +// supported platform: ARM64 +// (C)2025, by Aleksey Rakov +//--------------------------------------------------------------------------- + +#include "clicommon.h" +// -------------------------------------------------------------------------- +#include "machoarmimage.h" diff --git a/elenasrc3/elc/macos/machoarmimage.h b/elenasrc3/elc/macos/machoarmimage.h new file mode 100644 index 0000000000..3f8ffe8af1 --- /dev/null +++ b/elenasrc3/elc/macos/machoarmimage.h @@ -0,0 +1,45 @@ +//--------------------------------------------------------------------------- +// E L E N A P r o j e c t: ELENA Compiler +// +// This header contains ELENA Executive MachO Image class declaration +// supported platform: ARM64 +// (C)2025, by Aleksey Rakov +//--------------------------------------------------------------------------- + +#ifndef ELFPPCIMAGE_H +#define ELFPPCIMAGE_H + +#include "machoimage.h" + +namespace elena_lang +{ + // --- ElfARM64ImageFormatter --- + class MachOARM64ImageFormatter : public MachO64ImageFormatter + { + MachOARM64ImageFormatter(ForwardResolverBase* resolver) + : MachO64ImageFormatter(resolver) + { + } + + //int getRelocationType() override; + + //void fillElfData(ImageProviderBase& provider, ElfData& elfData, pos_t fileAlignment, + // RelocationMap& importMapping) override; + + //void writePLTStartEntry(MemoryWriter& codeWriter, ref_t gotReference, pos_t disp) override; + //pos_t writePLTEntry(MemoryWriter& codeWriter, pos_t symbolIndex, ref_t gotReference, pos_t gofOffset, int entryIndex) override; + + //void fixSection(MemoryBase* section, AddressSpace& map) override; + //void fixImportSection(MemoryBase* section, AddressSpace& map) override; + + public: + static MachOARM64ImageFormatter& getInstance(ForwardResolverBase* resolver) + { + static MachOARM64ImageFormatter instance(resolver); + + return instance; + } + }; +} + +#endif \ No newline at end of file diff --git a/elenasrc3/elc/macos/machoarmlinker64.cpp b/elenasrc3/elc/macos/machoarmlinker64.cpp new file mode 100644 index 0000000000..1eab168a6c --- /dev/null +++ b/elenasrc3/elc/macos/machoarmlinker64.cpp @@ -0,0 +1,11 @@ +//--------------------------------------------------------------------------- +// E L E N A P r o j e c t: ELENA Compiler +// +// This header contains ELENA Executive Linker class body +// Supported platforms: MacOS ARM64 +// (C)2025, by Aleksey Rakov +//--------------------------------------------------------------------------- + +#include "machoarmlinker64.h" + +using namespace elena_lang; diff --git a/elenasrc3/elc/macos/machoarmlinker64.h b/elenasrc3/elc/macos/machoarmlinker64.h new file mode 100644 index 0000000000..1e96073cd5 --- /dev/null +++ b/elenasrc3/elc/macos/machoarmlinker64.h @@ -0,0 +1,30 @@ +//--------------------------------------------------------------------------- +// E L E N A P r o j e c t: ELENA Compiler +// +// This header contains ELENA Executive Linker class declaration +// Supported platforms: Linux ARM64 +// (C)2025, by Aleksey Rakov +//--------------------------------------------------------------------------- + +#ifndef MACHOARMLINKER64_H +#define MACHOARMLINKER64_H + +#include "macholinker64.h" + +namespace elena_lang +{ + // --- MachOARM64Linker --- + class MachOARM64Linker : public MachOLinker64 + { + protected: + + public: + MachOARM64Linker(ErrorProcessorBase* errorProcessor) + : MachOLinker64(errorProcessor) + { + + } + }; +} + +#endif diff --git a/elenasrc3/elc/macos/machoimage.cpp b/elenasrc3/elc/macos/machoimage.cpp new file mode 100644 index 0000000000..dbc7c5f4e6 --- /dev/null +++ b/elenasrc3/elc/macos/machoimage.cpp @@ -0,0 +1,22 @@ +//--------------------------------------------------------------------------- +// E L E N A P r o j e c t: ELENA Compiler +// +// This file contains ELENA Executive MachO Image class implementation +// +// (C)2025, by Aleksey Rakov +//--------------------------------------------------------------------------- + +#include "clicommon.h" +// -------------------------------------------------------------------------- +#include "elfimage.h" +#include "elfcommon.h" + +using namespace elena_lang; + +// --- MachOImageFormatter --- + +void MachOImageFormatter:: prepareImage(ImageProviderBase& provider, AddressSpace& map, ImageSections& sections, + pos_t sectionAlignment, pos_t fileAlignment, bool withDebugInfo) +{ + // !! temporally stub +} diff --git a/elenasrc3/elc/macos/machoimage.h b/elenasrc3/elc/macos/machoimage.h new file mode 100644 index 0000000000..a42bdfb4e0 --- /dev/null +++ b/elenasrc3/elc/macos/machoimage.h @@ -0,0 +1,78 @@ +//--------------------------------------------------------------------------- +// E L E N A P r o j e c t: ELENA Compiler +// +// This header contains ELENA Executive MachO Image class declaration +// supported platform: ARM64 +// (C)2025, by Aleksey Rakov +//--------------------------------------------------------------------------- + +#ifndef MACHOIMAGE_H +#define MACHOIMAGE_H + +namespace elena_lang +{ + //typedef List LibraryList; + + // --- MachOImageFormatter --- + class MachOImageFormatter : public ImageFormatter + { + protected: + ForwardResolverBase* _resolver; + + //struct ElfData + //{ + // ReferenceMap functions; + // LibraryList libraries; + + // pos_t dynamicOffset; + // pos_t dynamicSize; + + // ElfData() + // : functions(0), libraries(nullptr) + // { + // dynamicOffset = dynamicSize = 0; + // } + //}; + + MachOImageFormatter(ForwardResolverBase* resolver) + { + _resolver = resolver; + } + + //virtual pos_t fillImportTable(AddressMap::Iterator it, ElfData& elfData); + //virtual void fillElfData(ImageProviderBase& provider, ElfData& elfData, pos_t fileAlignment, RelocationMap& importMapping) = 0; + + //virtual void fixSection(MemoryBase* section, AddressSpace& map) = 0; + //virtual void fixImportSection(MemoryBase* section, AddressSpace& map) = 0; + + //void mapImage(ImageProviderBase& provider, AddressSpace& map, ImageSections& sections, pos_t sectionAlignment, + // pos_t fileAlignment, ElfData& elfData); + //void fixImage(ImageProviderBase& provider, AddressSpace& map, bool withDebugInfo); + + public: + void prepareImage(ImageProviderBase& provider, AddressSpace& map, ImageSections& sections, + pos_t sectionAlignment, pos_t fileAlignment, bool withDebugInfo) override; + }; + + // --- MachO64ImageFormatter --- + class MachO64ImageFormatter : public MachOImageFormatter + { + protected: + MachO64ImageFormatter(ForwardResolverBase* resolver) + : MachOImageFormatter(resolver) + { + + } + + //virtual void writePLTStartEntry(MemoryWriter& codeWriter, ref_t gotReference, pos_t disp) = 0; + //virtual pos_t writePLTEntry(MemoryWriter& codeWriter, pos_t symbolIndex, ref_t gotReference, pos_t gofOffset, int entryIndex) = 0; + + //virtual int getRelocationType() = 0; + + //void fillElfData(ImageProviderBase& provider, ElfData& elfData, pos_t fileAlignment, RelocationMap& importMapping) override; + public: + + }; +} + +#endif diff --git a/elenasrc3/elc/macos/macholinker.cpp b/elenasrc3/elc/macos/macholinker.cpp new file mode 100644 index 0000000000..cc5b3dee28 --- /dev/null +++ b/elenasrc3/elc/macos/macholinker.cpp @@ -0,0 +1,17 @@ +//--------------------------------------------------------------------------- +// E L E N A P r o j e c t: ELENA Compiler +// +// This file contains ELENA Executive Linker class implementation +// Supported platforms: MacOS +// (C)2025, by Aleksey Rakov +//--------------------------------------------------------------------------- + +#include "macholinker.h" + +using namespace elena_lang; + +LinkResult MachOLinker :: run(ProjectBase& project, ImageProviderBase& provider, PlatformType, path_t) +{ + // !! temporal stub + return {}; +} \ No newline at end of file diff --git a/elenasrc3/elc/macos/macholinker.h b/elenasrc3/elc/macos/macholinker.h new file mode 100644 index 0000000000..f6a3cd1398 --- /dev/null +++ b/elenasrc3/elc/macos/macholinker.h @@ -0,0 +1,33 @@ +//--------------------------------------------------------------------------- +// E L E N A P r o j e c t: ELENA Compiler +// +// This header contains ELENA Executive Linker class declaration +// Supported platforms: MacOS +// (C)2025, by Aleksey Rakov +//--------------------------------------------------------------------------- + +#ifndef MACHOLINKER_H +#define MACHOLINKER_H + +#include "clicommon.h" + +namespace elena_lang +{ + // --- ElfLinker --- + class MachOLinker : public LinkerBase + { + protected: + + public: + LinkResult run(ProjectBase& project, ImageProviderBase& code, PlatformType uiType, + path_t exeExtension) override; + + MachOLinker(ErrorProcessorBase* errorProcessor/*, ImageFormatter* imageFormatter*/) + : LinkerBase(errorProcessor) + { + _imageFormatter = imageFormatter; + } + }; +} + +#endif diff --git a/elenasrc3/elc/macos/macholinker64.cpp b/elenasrc3/elc/macos/macholinker64.cpp new file mode 100644 index 0000000000..4e9e44af8d --- /dev/null +++ b/elenasrc3/elc/macos/macholinker64.cpp @@ -0,0 +1,11 @@ +//--------------------------------------------------------------------------- +// E L E N A P r o j e c t: ELENA Compiler +// +// This header contains ELENA Executive Linker class body +// Supported platforms: MacOS 64 +// (C)2025, by Aleksey Rakov +//--------------------------------------------------------------------------- + +#include "macholinker64.h" + +using namespace elena_lang; diff --git a/elenasrc3/elc/macos/macholinker64.h b/elenasrc3/elc/macos/macholinker64.h new file mode 100644 index 0000000000..6ee74b6e59 --- /dev/null +++ b/elenasrc3/elc/macos/macholinker64.h @@ -0,0 +1,30 @@ +//--------------------------------------------------------------------------- +// E L E N A P r o j e c t: ELENA Compiler +// +// This header contains ELENA Executive Linker class declaration +// Supported platforms: MacOS 64 +// (C)2025, by Aleksey Rakov +//--------------------------------------------------------------------------- + +#ifndef MACHOLINKER64_H +#define MACHOLINKER64_H + +#include "macholinker.h" + +namespace elena_lang +{ + // --- ElfLinker --- + class MachOLinker64 : public MachOLinker + { + protected: + + public: + MachOLinker64(ErrorProcessorBase* errorProcessor/*, ImageFormatter* imageFormatter*/) + : MachOLinker(errorProcessor) + { + _imageFormatter = imageFormatter; + } + }; +} + +#endif diff --git a/elenasrc3/elc/windows/elc.cpp b/elenasrc3/elc/windows/elc.cpp index 050995007a..90c4aa2ff1 100644 --- a/elenasrc3/elc/windows/elc.cpp +++ b/elenasrc3/elc/windows/elc.cpp @@ -3,7 +3,7 @@ // // This file contains the main body of the win32 / win64 command-line compiler // -// (C)2021-2024, by Aleksey Rakov +// (C)2021-2025, by Aleksey Rakov //--------------------------------------------------------------------------- #include @@ -39,7 +39,7 @@ constexpr auto CURRENT_PLATFORM = PlatformType::Win_x86; constexpr int DEFAULT_MGSIZE = 344064; constexpr int DEFAULT_YGSIZE = 86016; -constexpr int DEFAULT_SACKRESERV = 0x200000; +constexpr int DEFAULT_STACKRESERV = 0x200000; constexpr int MINIMAL_ARG_LIST = 1; @@ -56,7 +56,7 @@ constexpr auto CURRENT_PLATFORM = PlatformType::Win_x86_64; constexpr int DEFAULT_MGSIZE = 688128; constexpr int DEFAULT_YGSIZE = 204800; -constexpr int DEFAULT_SACKRESERV = 0x200000; +constexpr int DEFAULT_STACKRESERV = 0x200000; constexpr int MINIMAL_ARG_LIST = 2; @@ -123,108 +123,22 @@ JITCompilerBase* createJITCompiler(LibraryLoaderBase* loader, PlatformType platf void handleOption(wchar_t* arg, IdentifierString& profile, Project& project, CompilingProcess& process, ErrorProcessor& errorProcessor, path_t appPath, bool& cleanMode) { - switch (arg[1]) { - case 'e': - if (wstr_t(arg).compare(L"-el5")) { - project.setSyntaxVersion(SyntaxVersion::L5); - } - else if (wstr_t(arg).compare(L"-el6")) { - project.setSyntaxVersion(SyntaxVersion::L6); - } - break; - case 'f': - { - IdentifierString setting(arg + 2); - process.addForward(*setting); - - break; - } - case 'l': - { - IdentifierString setting(arg + 2); - profile.copy(*setting); - break; - } - case 'm': - project.addBoolSetting(ProjectOption::MappingOutputMode, true); - break; - case 'o': - if (arg[2] == '0') { - project.addIntSetting(ProjectOption::OptimizationMode, optNone); - } - else if (arg[2] == '1') { - project.addIntSetting(ProjectOption::OptimizationMode, optLow); - } - else if (arg[2] == '2') { - project.addIntSetting(ProjectOption::OptimizationMode, optMiddle); - } - else if (arg[2] == '3') { - project.addIntSetting(ProjectOption::OptimizationMode, optHigh); - } - break; - case 'p': - project.setBasePath(arg + 2); - break; - case 'r': - cleanMode = true; - break; - case 's': - { - IdentifierString setting(arg + 2); - if (setting.compare("stackReserv:", 0, 12)) { - ustr_t valStr = *setting + 12; - int val = StrConvertor::toInt(valStr, 10); - project.addIntSetting(ProjectOption::StackReserved, val); - } - break; - } + switch(arg[1]) { case 't': { IdentifierString configName(arg + 2); - if(!project.loadConfigByName(appPath, *configName, true)) + if (!project.loadConfigByName(appPath, *configName, true)) errorProcessor.info(wrnInvalidConfig, *configName); break; } - case 'v': - process.setVerboseOn(); - break; - case 'w': - if (arg[2] == '0') { - errorProcessor.setWarningLevel(WarningLevel::Level0); - } - else if (arg[2] == '1') { - errorProcessor.setWarningLevel(WarningLevel::Level1); - } - else if (arg[2] == '2') { - errorProcessor.setWarningLevel(WarningLevel::Level2); - } - else if (arg[2] == '3') { - errorProcessor.setWarningLevel(WarningLevel::Level3); - } - break; - case 'x': - if (arg[2] == 'b') { - project.addBoolSetting(ProjectOption::ConditionalBoxing, arg[3] != '-'); - } - else if (arg[2] == 'e') { - project.addBoolSetting(ProjectOption::EvaluateOp, arg[3] != '-'); - } - else if (arg[2] == 'j') { - project.addBoolSetting(ProjectOption::WithJumpAlignment, arg[3] != '-'); - } - else if (arg[2] == 'm') { - project.addBoolSetting(ProjectOption::ModuleExtensionAutoLoad, arg[3] != '-'); - } - else if (arg[2] == 'p') { - project.addBoolSetting(ProjectOption::GenerateParamNameInfo, arg[3] != '-'); - } - else if (arg[2] == 's') { - project.addBoolSetting(ProjectOption::StrictTypeEnforcing, arg[3] != '-'); - } - break; default: + { + IdentifierString argStr(arg); + + CommandHelper::handleOption(*argStr, profile, project, process, errorProcessor, cleanMode); break; + } } } @@ -331,7 +245,7 @@ int main() PathString appPath; getAppPath(appPath); - JITSettings defaultCoreSettings = { DEFAULT_MGSIZE, DEFAULT_YGSIZE, DEFAULT_SACKRESERV, 1, true, true }; + JITSettings defaultCoreSettings = { DEFAULT_MGSIZE, DEFAULT_YGSIZE, DEFAULT_STACKRESERV, 1, true, true }; ErrorProcessor errorProcessor(&Presenter::getInstance()); CompilingProcess process(*appPath, L"exe", L"", L"", L"", &Presenter::getInstance(), &errorProcessor, diff --git a/elenasrc3/elenart/rtcommon.h b/elenasrc3/elenart/rtcommon.h index 871eea561e..d258a76808 100644 --- a/elenasrc3/elenart/rtcommon.h +++ b/elenasrc3/elenart/rtcommon.h @@ -14,7 +14,7 @@ namespace elena_lang { -#define ELENART_REVISION_NUMBER 0x0009 +#define ELENART_REVISION_NUMBER 0x000A } diff --git a/elenasrc3/elenasm/cfparser.cpp b/elenasrc3/elenasm/cfparser.cpp index c778f896f1..a8182817da 100644 --- a/elenasrc3/elenasm/cfparser.cpp +++ b/elenasrc3/elenasm/cfparser.cpp @@ -1,12 +1,13 @@ //--------------------------------------------------------------------------- // E L E N A P r o j e c t: ELENA VM Script Engine // -// (C)2023-2024, by Aleksey Rakov +// (C)2023-2025, by Aleksey Rakov //--------------------------------------------------------------------------- #include "elena.h" // -------------------------------------------------------------------------- #include "cfparser.h" +#include "regex.h" using namespace elena_lang; @@ -21,9 +22,8 @@ constexpr auto EOL_KEYWORD = "$eol"; constexpr auto ANYCHR_KEYWORD = "$chr"; // > 32 constexpr auto CURRENT_KEYWORD = "$current"; constexpr auto CHARACTER_KEYWORD = "$character"; -constexpr auto INTLITERAL_KEYWORD = "$intliteral"; // NOTE : quote containing a number -constexpr auto NONINTLITERAL_KEYWORD = "$nonintliteral"; // NOTE : quote containing a number constexpr auto BUFFER_KEYWORD = "$buffer"; // NOTE : quote containing a number +constexpr auto REGEX_KEYWORD = "$regex"; constexpr auto REFERENCE_MODE = 1; constexpr auto IDENTIFIER_MODE = 2; @@ -38,9 +38,8 @@ constexpr auto EXCLUDE_MODE = 10; constexpr auto CHARACTER_MODE = 11; constexpr auto IF_MODE = 12; constexpr auto IFNOT_MODE = 13; -constexpr auto INTLITERAL_MODE = 14; constexpr auto BUFFER_MODE = 15; -constexpr auto NONINTLITERAL_MODE = 16; +constexpr auto REGEX_MODE = 17; constexpr auto WITHFORWARD_MASK = 0x80000000; constexpr auto POSTFIXSAVE_MODE = 0x80000000; @@ -54,38 +53,82 @@ inline void readToken(ScriptEngineReaderBase& reader, ScriptBookmark& bm, ustr_t throw SyntaxError("invalid grammar rule", bm.lineInfo); } -void saveReference(ScriptEngineReaderBase& scriptReader, ScriptEngineCFParser* parser, ref_t ptr, ScriptEngineLog& log) +class ReferenceSaver : public ScriptEngineCFParser::SaverBase { - ScriptBookmark bm; - parser->readScriptBookmark(ptr, bm); +public: + void saveTo(ScriptEngineReaderBase& scriptReader, ScriptEngineCFParser* parser, ref_t ptr, ScriptEngineLog& log) override + { + ScriptBookmark bm; + parser->readScriptBookmark(ptr, bm); + + log.writeCoord(bm.lineInfo); + log.write(scriptReader.lookup(bm)); + } - log.writeCoord(bm.lineInfo); - log.write(scriptReader.lookup(bm)); -} + static ScriptEngineCFParser::SaverBase* getInstance() + { + static ReferenceSaver instance; + + return &instance; + } +}; -void saveLiteralContent(ScriptEngineReaderBase& scriptReader, ScriptEngineCFParser* parser, ref_t ptr, ScriptEngineLog& log) +class LiteralContentSaver : public ScriptEngineCFParser::SaverBase { - ScriptBookmark bm; - parser->readScriptBookmark(ptr, bm); +public: + void saveTo(ScriptEngineReaderBase& scriptReader, ScriptEngineCFParser* parser, ref_t ptr, ScriptEngineLog& log) override + { + ScriptBookmark bm; + parser->readScriptBookmark(ptr, bm); + + log.writeCoord(bm.lineInfo); + log.write(scriptReader.lookup(bm)); + } - log.writeCoord(bm.lineInfo); - log.write(scriptReader.lookup(bm)); -} + static ScriptEngineCFParser::SaverBase* getInstance() + { + static LiteralContentSaver instance; -void saveLiteral(ScriptEngineReaderBase& scriptReader, ScriptEngineCFParser* parser, ref_t ptr, ScriptEngineLog& log) + return &instance; + } +}; + +class LiteralSaver : public ScriptEngineCFParser::SaverBase { - ScriptBookmark bm; - parser->readScriptBookmark(ptr, bm); +public: + void saveTo(ScriptEngineReaderBase& scriptReader, ScriptEngineCFParser* parser, ref_t ptr, ScriptEngineLog& log) override + { + ScriptBookmark bm; + parser->readScriptBookmark(ptr, bm); + + log.writeCoord(bm.lineInfo); + log.writeQuote(scriptReader.lookup(bm)); + } - log.writeCoord(bm.lineInfo); - log.writeQuote(scriptReader.lookup(bm)); -} + static ScriptEngineCFParser::SaverBase* getInstance() + { + static LiteralSaver instance; + + return &instance; + } +}; -void saveBuffer(ScriptEngineReaderBase& scriptReader, ScriptEngineCFParser* parser, ref_t ptr, ScriptEngineLog& log) +class BufferSaver : public ScriptEngineCFParser::SaverBase { - parser->flushBuffer(log); - parser->clearBuffer(); -} +public: + void saveTo(ScriptEngineReaderBase& scriptReader, ScriptEngineCFParser* parser, ref_t ptr, ScriptEngineLog& log) override + { + parser->flushBuffer(log); + parser->clearBuffer(); + } + + static ScriptEngineCFParser::SaverBase* getInstance() + { + static BufferSaver instance; + + return &instance; + } +}; bool nonterminalApplyRule(ScriptEngineCFParser::Rule&, ScriptBookmark&, ScriptEngineReaderBase&, ScriptEngineCFParser*) { @@ -102,30 +145,6 @@ bool normalLiteralApplyRule(ScriptEngineCFParser::Rule&, ScriptBookmark& bm, Scr return (bm.state == dfaQuote); } -bool normalIntLiteralApplyRule(ScriptEngineCFParser::Rule&, ScriptBookmark& bm, ScriptEngineReaderBase& reader, ScriptEngineCFParser*) -{ - if (bm.state == dfaQuote) { - ustr_t value = reader.lookup(bm); - for (pos_t i = 0; i < getlength(value); i++) { - if (value[i] < '0' || value[i] > '9') - return false; - } - - return true; - } - return false; -} - -bool normalNonIntLiteralApplyRule(ScriptEngineCFParser::Rule&, ScriptBookmark& bm, ScriptEngineReaderBase& reader, ScriptEngineCFParser*) -{ - if (bm.state == dfaQuote) { - ustr_t value = reader.lookup(bm); - if (value[0] < '0' || value[0] > '9') - return true; - } - return false; -} - bool normalNumericApplyRule(ScriptEngineCFParser::Rule&, ScriptBookmark& bm, ScriptEngineReaderBase&, ScriptEngineCFParser*) { return (bm.state == dfaInteger || bm.state == dfaLong || bm.state == dfaReal); @@ -187,6 +206,11 @@ bool normalApplyRule(ScriptEngineCFParser::Rule& rule, ScriptBookmark& bm, Scrip return bm.state != dfaEOF && parser->compareToken(reader, bm, rule.terminal); } +bool regexApplyRule(ScriptEngineCFParser::Rule& rule, ScriptBookmark& bm, ScriptEngineReaderBase& reader, ScriptEngineCFParser* parser) +{ + return rule.saver->isMatched(reader.lookup(bm), bm.state); +} + // --- ScriptEngineCFParser --- inline pos_t createKey(pos_t id, int index) @@ -281,6 +305,18 @@ void ScriptEngineCFParser :: setScriptPtr(ScriptBookmark& bm, Rule& rule, bool p } } +ScriptEngineCFParser::SaverBase* ScriptEngineCFParser::createRegEx(ScriptBookmark& bm, ustr_t regex) +{ + auto regEx = RegExFactory::generate(regex); + if (!regEx) { + throw SyntaxError("invalid grammar rule", bm.lineInfo); + } + + _regExList.add(regEx); + + return regEx; +} + void ScriptEngineCFParser :: defineApplyRule(Rule& rule, int mode, RuleTypeModifier modifier) { if (rule.type == RuleType::Normal) { @@ -297,12 +333,6 @@ void ScriptEngineCFParser :: defineApplyRule(Rule& rule, int mode, RuleTypeModif case LITERAL_MODE: rule.apply = normalLiteralApplyRule; break; - case INTLITERAL_MODE: - rule.apply = normalIntLiteralApplyRule; - break; - case NONINTLITERAL_MODE: - rule.apply = normalNonIntLiteralApplyRule; - break; case NUMERIC_MODE: rule.apply = normalNumericApplyRule; break; @@ -343,6 +373,9 @@ void ScriptEngineCFParser :: defineApplyRule(Rule& rule, int mode, RuleTypeModif case EXCLUDE_MODE: rule.apply = excludeApplyRule; break; + case REGEX_MODE: + rule.apply = regexApplyRule; + break; default: rule.apply = normalApplyRule; break; @@ -384,56 +417,52 @@ void ScriptEngineCFParser :: saveScript(ScriptEngineReaderBase& reader, Rule& ru if (forwardMode) throw SyntaxError("invalid grammar rule", bm.lineInfo); - if (rule.saveTo != nullptr || (!prefixMode && !reader.compare(CURRENT_KEYWORD))) + if (rule.saver != nullptr || (!prefixMode && !reader.compare(CURRENT_KEYWORD))) throw SyntaxError("invalid grammar rule", bm.lineInfo); if (reader.compare(REFERENCE_KEYWORD)) { rule.terminal = INVALID_REF; - rule.saveTo = saveReference; + rule.saver = ReferenceSaver::getInstance(); mode = REFERENCE_MODE; } else if (reader.compare(IDENTIFIER_KEYWORD)) { rule.terminal = INVALID_REF; - rule.saveTo = saveReference; + rule.saver = ReferenceSaver::getInstance(); mode = IDENTIFIER_MODE; } else if (reader.compare(CHARACTER_KEYWORD)) { rule.terminal = INVALID_REF; - rule.saveTo = saveLiteralContent; + rule.saver = LiteralContentSaver::getInstance(); mode = CHARACTER_MODE; } else if (reader.compare(LITERAL_KEYWORD)) { rule.terminal = INVALID_REF; - rule.saveTo = saveLiteralContent; + rule.saver = LiteralContentSaver::getInstance(); mode = LITERAL_MODE; } - else if (reader.compare(INTLITERAL_KEYWORD)) { - rule.terminal = INVALID_REF; - rule.saveTo = saveReference; - - mode = INTLITERAL_MODE; - } - else if (reader.compare(NONINTLITERAL_KEYWORD)) { - rule.terminal = INVALID_REF; - rule.saveTo = saveReference; - - mode = NONINTLITERAL_MODE; - } else if (reader.compare(NUMERIC_KEYWORD)) { rule.terminal = INVALID_REF; - rule.saveTo = saveReference; + rule.saver = ReferenceSaver::getInstance(); mode = NUMERIC_MODE; } if (reader.compare(CURRENT_KEYWORD)) { - rule.saveTo = saveReference; + rule.saver = ReferenceSaver::getInstance(); } else if (reader.compare(BUFFER_KEYWORD)) { - rule.saveTo = saveBuffer; + rule.saver = BufferSaver::getInstance(); + } + else if (reader.compare(REGEX_KEYWORD)) { + bm = reader.read(); + + rule.terminal = INVALID_REF; + rule.saver = createRegEx(bm, reader.lookup(bm)); + + mode = REGEX_MODE; } writer.writeChar((char)0); @@ -444,7 +473,7 @@ void ScriptEngineCFParser :: saveScript(ScriptEngineReaderBase& reader, Rule& ru throw SyntaxError("invalid grammar rule", bm.lineInfo); rule.terminal = INVALID_REF; - rule.saveTo = saveLiteral; + rule.saver = LiteralSaver::getInstance(); mode = REFERENCE_MODE; @@ -456,7 +485,7 @@ void ScriptEngineCFParser :: saveScript(ScriptEngineReaderBase& reader, Rule& ru throw SyntaxError("invalid grammar rule", bm.lineInfo); rule.terminal = INVALID_REF; - rule.saveTo = saveLiteral; + rule.saver = LiteralSaver::getInstance(); mode = IDENTIFIER_MODE; @@ -468,7 +497,7 @@ void ScriptEngineCFParser :: saveScript(ScriptEngineReaderBase& reader, Rule& ru throw SyntaxError("invalid grammar rule", bm.lineInfo); rule.terminal = INVALID_REF; - rule.saveTo = saveLiteral; + rule.saver = LiteralSaver::getInstance(); mode = LITERAL_MODE; @@ -480,7 +509,7 @@ void ScriptEngineCFParser :: saveScript(ScriptEngineReaderBase& reader, Rule& ru throw SyntaxError("invalid grammar rule", bm.lineInfo); rule.terminal = INVALID_REF; - rule.saveTo = saveLiteral; + rule.saver = LiteralSaver::getInstance(); mode = NUMERIC_MODE; @@ -492,7 +521,7 @@ void ScriptEngineCFParser :: saveScript(ScriptEngineReaderBase& reader, Rule& ru throw SyntaxError("invalid grammar rule", bm.lineInfo); rule.terminal = INVALID_REF; - rule.saveTo = saveLiteral; + rule.saver = LiteralSaver::getInstance(); mode = CHARACTER_MODE; @@ -1150,8 +1179,8 @@ void ScriptEngineCFParser :: saveRuleOutput(Rule& rule, pos_t terminal, ScriptEn if (!test(rule.type, RuleType::WithForward)) lineLen += log.write(getBodyText(rule.prefix1Ptr)); - if (rule.saveTo != NULL) - rule.saveTo(scriptReader, this, terminal, log); + if (rule.saver != NULL) + rule.saver->saveTo(scriptReader, this, terminal, log); // HOTFIX: to prevent too long line if (lineLen > 0x10) { @@ -1229,7 +1258,7 @@ void ScriptEngineCFParser :: generateOutput(pos_t offset, ScriptEngineReaderBase // NOTE: reset level to -1 to match the backward calculated levels level = -1; Stack postfixes(0); - Stack functions(0); + Stack functions(nullptr); while (stack.count() > 0) { item = stack.pop(); if (item.ruleKey == 0) { @@ -1242,10 +1271,10 @@ void ScriptEngineCFParser :: generateOutput(pos_t offset, ScriptEngineReaderBase log.write(getBodyText(ptr)); - auto saveTo = functions.pop(); + auto saver = functions.pop(); int terminal = postfixes.pop(); - saveTo(scriptReader, this, terminal, log); + saver->saveTo(scriptReader, this, terminal, log); ptr = postfixes.pop(); } @@ -1284,7 +1313,7 @@ void ScriptEngineCFParser :: generateOutput(pos_t offset, ScriptEngineReaderBase postfixes.push(rule.postfix2Ptr); postfixes.push(item.terminal); - functions.push(rule.saveTo); + functions.push(rule.saver); postfixes.push(rule.prefix2Ptr | POSTFIXSAVE_MODE); } else postfixes.push(rule.prefix2Ptr); diff --git a/elenasrc3/elenasm/cfparser.h b/elenasrc3/elenasm/cfparser.h index 6b3174a6d5..0d662f2b54 100644 --- a/elenasrc3/elenasm/cfparser.h +++ b/elenasrc3/elenasm/cfparser.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // E L E N A P r o j e c t: ELENA Script Engine // -// (C)2023-24, by Aleksey Rakov +// (C)2023-25, by Aleksey Rakov //--------------------------------------------------------------------------- #ifndef CFPARSER_H @@ -47,7 +47,16 @@ namespace elena_lang BufferMode }; - typedef void (*SaveToSign)(ScriptEngineReaderBase& scriptReader, ScriptEngineCFParser* parser, ref_t ptr, ScriptEngineLog& log); + class SaverBase + { + public: + virtual bool isMatched(ustr_t token, char state) + { + return true; + } + + virtual void saveTo(ScriptEngineReaderBase& scriptReader, ScriptEngineCFParser* parser, ref_t ptr, ScriptEngineLog& log) = 0; + }; struct Rule { @@ -60,7 +69,8 @@ namespace elena_lang pos_t postfix2Ptr; bool(*apply)(Rule& rule, ScriptBookmark& bm, ScriptEngineReaderBase& reader, ScriptEngineCFParser* parser); - SaveToSign saveTo; + + SaverBase* saver; Rule() { @@ -70,7 +80,7 @@ namespace elena_lang postfix2Ptr = prefix2Ptr = 0; apply = nullptr; - saveTo = nullptr; + saver = nullptr; } }; @@ -120,6 +130,7 @@ namespace elena_lang //typedef MemoryHashTable SyntaxTable; typedef HashTable SyntaxTable; typedef Queue DerivationQueue; + typedef List RegExList; protected: ScriptEngineParserBase* _baseParser; @@ -131,6 +142,8 @@ namespace elena_lang bool _symbolMode; bool _generating; + RegExList _regExList; + ref_t mapRuleId(ustr_t name) { return mapKey(_names, name, _names.count() + 1); @@ -173,6 +186,8 @@ namespace elena_lang void insertForwards(Stack>& forwards, int level, ScriptEngineLog& log); + SaverBase* createRegEx(ScriptBookmark& bm, ustr_t regex); + public: void flushBuffer(ScriptEngineLog& log) { @@ -199,7 +214,7 @@ namespace elena_lang void parse(ScriptEngineReaderBase& reader, MemoryDump* output) override; ScriptEngineCFParser(ScriptEngineParserBase* baseParser) - : _table({}), _names(0) + : _table({}), _names(0), _regExList(nullptr) { _baseParser = baseParser; diff --git a/elenasrc3/elenasm/regex.cpp b/elenasrc3/elenasm/regex.cpp new file mode 100644 index 0000000000..28e7a8abc7 --- /dev/null +++ b/elenasrc3/elenasm/regex.cpp @@ -0,0 +1,416 @@ +//--------------------------------------------------------------------------- +// E L E N A P r o j e c t: ELENA command-Line Compiler +// +// This file contains the pattern engine implementation +// +// (C)2025, by Aleksey Rakov +//--------------------------------------------------------------------------- + +#include "elena.h" +// -------------------------------------------------------------------------- +#include "regex.h" + +using namespace elena_lang; + +const char* Postfix = "+*?"; +const char* Reserved = "$^[]+*?()\\"; + +// --- RegExFactory --- + +PatternRule* RegExFactory :: defineEscRule(char ch) +{ + if (ch == 'w') { + return new AnyWordChar(); + } + else if (ch == 'd') { + return new DigitChar(); + } + + return new CharRule(ch); +} + +PatternRule* RegExFactory :: defineRule(char ch) +{ + if (ch == '.') { + return new AnyRule(); + } + + if (ustr_t(Reserved).find(ch) != NOTFOUND_POS) + { + return nullptr; + } + + return new CharRule(ch); +} + +PatternRule* RegExFactory :: defineRule(ustr_t regex, size_t& start, char ch) +{ + size_t i = start; + PatternRule* rule = nullptr; + if (regex[i + 1] == '-') { + i += 2; + + char lastCh = regex[i]; + rule = new CharRangeRule(ch, lastCh); + } + else if (ch == '\\') { + i++; + ch = regex[i]; + rule = defineEscRule(ch); + } + else rule = defineRule(ch); + + start = i; + + return rule; +} + + +PatternRule* RegExFactory :: parseGroup(ustr_t regex, size_t& start, size_t end, PatternPool& pool) +{ + size_t i = start + 1; + + auto orList = new List(nullptr); + while (i < end) { + char ch = regex[i]; + + if (ch == ']') { + i++; + break; + } + else { + PatternRule* rule = defineRule(regex, i, ch); + if (rule != nullptr) { + pool.add(rule);// keep the list of unique rules + orList->add(rule); + } + else return nullptr; + } + + i++; + } + + start = i; + if (orList->count() == 1) { + auto rule = *orList->start(); + + freeobj(orList); + + return rule; + } + + PatternRule* orRule = new OrRule(orList); + pool.add(orRule);// keep the list of unique rules + + return orRule; +} + +PatternRule* RegExFactory :: parseBrackets(ustr_t pattern, size_t& start, size_t end, PatternPool& pool) +{ + bool selectMode = true; + auto orList = new List(nullptr); + + size_t i = start + 1; + + if (pattern[i] == '?') { + i++; + + if (pattern.compareSub("", i, 9)) { + selectMode = true; + i += 9; + } + else + { + freeobj(orList); + + return nullptr; + } + } + + bool closed = false; + while (i < end) { + PatternRule* rule = parseLine(pattern, i, end, ')', pool); + if (!rule) { + freeobj(orList); + + return nullptr; + } + + orList->add(rule); + if (pattern[i] == ')') { + i++; + closed = true; + + break; + } + + i++; + } + + if (!closed) { + freeobj(orList); + + return nullptr; + } + + start = i; + if (orList->count() == 1) { + auto rule = new NestedRule(*orList->start()); + + if (selectMode) { + rule->setMode(1); + } + + pool.add(rule); // keep the list of unique rules + + freeobj(orList); + + return rule; + } + else if (selectMode) { + freeobj(orList); + + return nullptr; + } + + auto orRule = new OrRule(orList); + pool.add(orRule); // keep the list of unique rules + + return orRule; +} + +PatternRule* RegExFactory :: parseLine(ustr_t pattern, size_t& start, size_t end, char terminator, PatternPool& pool) +{ + auto list = new List(nullptr); + if (parseLine(pattern, *list, start, end, terminator, pool)) { + auto first = linkRules(*list); + + freeobj(list); + + return first; + } + + return nullptr; +} + +PatternRule* RegExFactory :: linkRules(List& rules) +{ + for (auto it = rules.start(); !it.eof(); ++it) + { + auto next = it; + next++; + + if (!next.eof()) { + (*it)->setNext(*next); + + if ((*it)->getMode() == 1) { + (*next)->setMode(2); + } + } + + } + + return *rules.start(); +} + +bool RegExFactory :: parseLine(ustr_t pattern, List& rules, size_t& start, size_t end, char terminator, PatternPool& pool) +{ + ustr_t postfix(Postfix); + + size_t i = start; + while (i < end) { + char ch = pattern[i]; + + if (ch == terminator || ch == '|') { + break; + } + else if (postfix.find(ch) != NOTFOUND_POS) { + if (rules.count() == 0) + return false; + + PatternRule* rule = nullptr; + switch (ch) { + case '?': + rule = new OptionalRule(*rules.end()); + pool.add(rule); // keep the list of unique rules + break; + case '*': + rule = new RecursiveRule(*rules.end()); + pool.add(rule); // keep the list of unique rules + break; + case '+': + { + PatternRule* last = *rules.end(); + PatternRule* nested = new NestedRule(last); + rule = new RecursiveRule(last); + *(rules.end()) = nested; + rules.add(rule); + + pool.add(rule); // keep the list of unique rules + pool.add(nested); // keep the list of unique rules + + break; + } + default: + break; + } + + *(rules.end()) = rule; + } + else { + bool continueMode = false; + PatternRule* rule = nullptr; + + switch (ch) + { + case '[': + rule = parseGroup(pattern, i, end, pool); + continueMode = true; + break; + case '(': + rule = parseBrackets(pattern, i, end, pool); + continueMode = true; + break; + default: + rule = defineRule(pattern, i, ch); + pool.add(rule); // keep the list of unique rules + break; + } + + if (!rule) + return false; + + rules.add(rule); + + if (continueMode) + continue; + } + + i++; + } + + start = i; + return true; +} + +PatternRule* RegExFactory :: parsePattern(ustr_t regex, List& rules, size_t start, size_t end, PatternPool& pool) +{ + if (!parseLine(regex, rules, start, end, 0, pool)) { + return nullptr; + } + + if (start < end) { + return nullptr; + } + + rules.add(EOLRule::getInstance()); + + return linkRules(rules); +} + +ScriptEngineCFParser::SaverBase* RegExFactory :: generate(ustr_t pattern) +{ + if (pattern.startsWith("^\"") && pattern.endsWith("\"$")) { + auto rules = new List(nullptr); + PatternPool* pool = new PatternPool(nullptr); + + auto startRule = parsePattern(pattern, *rules, 2, pattern.length() - 2, *pool); + if (startRule) { + auto re = new QuoteRegEx(startRule, pool); + + freeobj(rules); + + return re; + } + else { + freeobj(rules); + freeobj(pool); + + return nullptr; + } + } + + return nullptr; +} + +// --- RegEx --- + +bool RegEx :: isMatched(ustr_t token, char) +{ + Stack parents(nullptr); + + size_t len = token.length(); + size_t index = 0; + PatternRule* current = _startRule; + while (index < len) { + char ch = token[index]; + + current = current->makeStep(token, index, ch, parents); + if(!current) { + return false; + } + + index++; + }; + + return current->makeStep(token, len, '\0', parents) != nullptr; +} + +void RegEx :: extract(ScriptEngineLog& log, ustr_t token) +{ + Stack parents(nullptr); + + size_t len = token.length(); + size_t index = 0; + size_t start = 0; + size_t end = len; + PatternRule* current = _startRule; + while (index < len) { + switch (current->getMode()) { + case 1: + start = index; + break; + case 2: + end = index; + break; + default: + break; + } + + char ch = token[index]; + + current = current->makeStep(token, index, ch, parents); + if (!current) { + break; + } + + index++; + }; + + if (end == len) { + log.write(token + start); + } + else if ((end - start) < IDENTIFIER_LEN) { + IdentifierString tmp(token + start, end - start); + + log.write(tmp.str()); + } + else { + DynamicString tmp; + tmp.copy(token + start, end - start); + + log.write(tmp.str()); + } +} + +// --- QuoteRegEx --- + +void QuoteRegEx :: saveTo(ScriptEngineReaderBase& scriptReader, ScriptEngineCFParser* parser, ref_t ptr, ScriptEngineLog& log) +{ + ScriptBookmark bm; + parser->readScriptBookmark(ptr, bm); + + log.writeCoord(bm.lineInfo); + + extract(log, scriptReader.lookup(bm)); +} \ No newline at end of file diff --git a/elenasrc3/elenasm/regex.h b/elenasrc3/elenasm/regex.h new file mode 100644 index 0000000000..3c2ed37efd --- /dev/null +++ b/elenasrc3/elenasm/regex.h @@ -0,0 +1,431 @@ +//--------------------------------------------------------------------------- +// E L E N A P r o j e c t: ELENA command-Line Compiler +// +// This file contains the regex engine declaration +// +// (C)2025, by Aleksey Rakov +//--------------------------------------------------------------------------- + +#ifndef REGEX_H +#define REGEX_H + +#include "cfparser.h" + +namespace elena_lang +{ + // --- RegEx --- + class PatternRule + { + protected: + + public: + virtual void setNext(PatternRule* next) = 0; + + static bool isLetter(char ch) + { + if (ch >= 0x41 && ch <= 0x5A) + { + return true; + }; + + if (ch >= 0x61 && ch <= 0x7A) + { + return true; + }; + + if (ch >= 0x370 && ch <= 0x3FB) + { + return true; + }; + + if (ch >= 0x400 && ch <= 0x4FF) + { + return true; + }; + + return false; + } + + static bool isDigit(char ch) + { + if (ch >= '0' && ch <= '9') + { + return true; + }; + + return false; + } + + virtual void setMode(int mode) = 0; + virtual int getMode() = 0; + + virtual PatternRule* gotoNext(Stack& parents) = 0; + virtual PatternRule* makeStep(ustr_t s, int index, char ch, Stack& parents) = 0; + + virtual ~PatternRule() = default; + }; + + typedef List PatternPool; + + class LinkRule : public PatternRule + { + protected: + PatternRule* nextRule; + int _mode; + + public: + void setMode(int mode) override + { + _mode = mode; + } + + int getMode() override + { + return _mode; + } + + void setNext(PatternRule* next) override + { + nextRule = next; + } + + PatternRule* gotoNext(Stack& parents) override + { + if (!nextRule) { + return parents.pop()->gotoNext(parents); + } + + return nextRule; + } + + LinkRule() + : _mode(0) + { + } + }; + + class GroupRule : public LinkRule + { + protected: + List* _rules; + + public: + GroupRule() + { + _rules = nullptr; + } + GroupRule(List* rules) + { + _rules = rules; + } + + ~GroupRule() override + { + freeobj(_rules); + } + }; + + class NestedRule : public LinkRule + { + protected: + PatternRule* child; + + public: + PatternRule* makeStep(ustr_t s, int index, char ch, Stack& parents) override + { + parents.push(this); + PatternRule* next = child->makeStep(s, index, ch, parents); + if (!next) { + parents.pop(); + }; + + return next; + } + + NestedRule(PatternRule* child) + : child(child) + { + + } + }; + + class OptionalRule : public NestedRule + { + public: + PatternRule* makeStep(ustr_t s, int index, char ch, Stack& parents) override + { + parents.push(this); + PatternRule* next = child->makeStep(s, index, ch, parents); + if (!next) { + parents.pop(); + + return gotoNext(parents)->makeStep(s, index, ch, parents); + }; + + return next; + } + + OptionalRule(PatternRule* child) + : NestedRule(child) + { + + } + }; + + class RecursiveRule : public NestedRule + { + public: + PatternRule* gotoNext(Stack& parents) override + { + return this; + } + + PatternRule* makeStep(ustr_t s, int index, char ch, Stack& parents) override + { + parents.push(this); + PatternRule* next = child->makeStep(s, index, ch, parents); + if (!next) { + parents.pop(); + + return NestedRule::gotoNext(parents)->makeStep(s, index, ch, parents); + }; + + return next; + } + + RecursiveRule(PatternRule* child) + : NestedRule(child) + { + + } + }; + + class OrRule : public GroupRule + { + public: + PatternRule* makeStep(ustr_t s, int index, char ch, Stack& parents) override + { + parents.push(this); + + for (auto it = _rules->start(); !it.eof(); ++it) { + PatternRule* next = (*it)->makeStep(s, index, ch, parents); + if (next) { + return next; + } + } + + parents.pop(); + + return nullptr; + } + + OrRule(List* list) + : GroupRule(list) + { + } + }; + + class CharRangeRule : public LinkRule + { + char chFrom; + char chTill; + + public: + PatternRule* makeStep(ustr_t s, int index, char ch, Stack& parents) override + { + if (ch >= chFrom && ch <= chTill) { + return gotoNext(parents); + } + + return nullptr; + } + + CharRangeRule(char from, char till) + : chFrom(from), chTill(till) + { + } + }; + + class AnyWordChar : public LinkRule + { + public: + PatternRule* makeStep(ustr_t s, int index, char ch, Stack& parents) override + { + if (PatternRule::isLetter(ch)) { + return gotoNext(parents); + } + if (PatternRule::isDigit(ch)) { + return gotoNext(parents); + } + + return nullptr; + } + + AnyWordChar() + { + } + }; + + class DigitChar : public LinkRule + { + public: + PatternRule* makeStep(ustr_t s, int index, char ch, Stack& parents) override + { + if (PatternRule::isDigit(ch)) { + return gotoNext(parents); + } + + return nullptr; + } + + DigitChar() + { + } + }; + + class AnyRule : public LinkRule + { + public: + PatternRule* makeStep(ustr_t s, int index, char ch, Stack& parents) override + { + if (ch == 10 || ch == 0) { + return nullptr; + } + + if (index < s.length_int()) { + return gotoNext(parents); + } + + return nullptr; + } + + AnyRule() + { + } + }; + + class CharRule : public LinkRule + { + protected: + char _ch; + + public: + PatternRule* makeStep(ustr_t s, int index, char ch, Stack& parents) override + { + if (_ch == ch) { + return gotoNext(parents); + } + + return nullptr; + } + + CharRule(char ch) + : _ch(ch) + { + + } + }; + + class EOLRule : public PatternRule + { + public: + void setNext(PatternRule* next) override + { + throw AbortError(); + } + + PatternRule* makeStep(ustr_t s, int index, char ch, Stack& parents) override + { + return ch == 0 ? this : nullptr; + } + + PatternRule* gotoNext(Stack& parents) override + { + return nullptr; + } + + int getMode() override + { + return 0; + } + + void setMode(int mode) override + { + if (mode != 2) { + throw AbortError(); + } + } + + static PatternRule* getInstance() + { + static EOLRule rule; + + return &rule; + } + }; + + class RegEx : public ScriptEngineCFParser::SaverBase + { + protected: + PatternRule* _startRule; + PatternPool* _pool; + + public: + bool isMatched(ustr_t token, char) override; + + void extract(ScriptEngineLog& log, ustr_t token); + + RegEx(PatternRule* startRule, PatternPool* pool) + : _startRule(startRule), _pool(pool) + { + } + + virtual ~RegEx() + { + freeobj(_pool); + } + }; + + class QuoteRegEx : public RegEx + { + public: + bool isMatched(ustr_t token, char state) override + { + if (state == dfaQuote) { + return RegEx::isMatched(token, state); + } + } + + void saveTo(ScriptEngineReaderBase& scriptReader, ScriptEngineCFParser* parser, ref_t ptr, ScriptEngineLog& log) override; + + QuoteRegEx(PatternRule* startRule, PatternPool* pool) + : RegEx(startRule, pool) + { + + } + }; + + // --- RegExFactory --- + class RegExFactory + { + static PatternRule* defineEscRule(char ch); + static PatternRule* defineRule(ustr_t regex, size_t& start, char ch); + static PatternRule* defineRule(char ch); + + static PatternRule* parseGroup(ustr_t regex, size_t& start, size_t end, PatternPool& pool); + static PatternRule* parseBrackets(ustr_t regex, size_t& start, size_t end, PatternPool& pool); + + static PatternRule* parseLine(ustr_t regex, size_t& start, size_t end, char terminator, PatternPool& pool); + + static PatternRule* linkRules(List& rules); + + static bool parseLine(ustr_t regex, List& rules, size_t& start, size_t end, char terminator, PatternPool& pool); + static PatternRule* parsePattern(ustr_t regex, List& rules, size_t start, size_t end, PatternPool& pool); + + public: + static ScriptEngineCFParser::SaverBase* generate(ustr_t regex); + }; + +} + +#endif diff --git a/elenasrc3/elenasm/smcommon.h b/elenasrc3/elenasm/smcommon.h index 036a404af8..6b0a437783 100644 --- a/elenasrc3/elenasm/smcommon.h +++ b/elenasrc3/elenasm/smcommon.h @@ -3,13 +3,13 @@ // // This file contains the compiler common interfaces & types // -// (C)2021-2024, by Aleksey Rakov +// (C)2021-2025, by Aleksey Rakov //--------------------------------------------------------------------------- #ifndef RTCOMMON_H #define RTCOMMON_H -#define ELENASM_REVISION_NUMBER 0x0013 +#define ELENASM_REVISION_NUMBER 0x0015 namespace elena_lang { diff --git a/elenasrc3/elenasm/vs/elenasm.vcxproj b/elenasrc3/elenasm/vs/elenasm.vcxproj index 83f30356ca..27e4ab5020 100644 --- a/elenasrc3/elenasm/vs/elenasm.vcxproj +++ b/elenasrc3/elenasm/vs/elenasm.vcxproj @@ -183,6 +183,7 @@ + @@ -199,6 +200,7 @@ + diff --git a/elenasrc3/engine/core.h b/elenasrc3/engine/core.h index dea8b47a6a..f1ab164a9f 100644 --- a/elenasrc3/engine/core.h +++ b/elenasrc3/engine/core.h @@ -2,7 +2,7 @@ // // This file contains common ELENA Core constants // -// (C)2021-2024, by Aleksey Rakov +// (C)2021-2025, by Aleksey Rakov //------------------------------------------------------------------------------ #ifndef CORE_H @@ -53,6 +53,7 @@ namespace elena_lang constexpr ref_t CORE_TOC = 0x20001; constexpr ref_t SYSTEM_ENV = 0x20002; constexpr ref_t CORE_GC_TABLE = 0x20003; + constexpr ref_t CORE_MATH_TABLE = 0x20004; constexpr ref_t CORE_SINGLE_CONTENT = 0x2000B; constexpr ref_t VOIDOBJ = 0x2000D; constexpr ref_t VOIDPTR = 0x2000E; diff --git a/elenasrc3/engine/elena.h b/elenasrc3/engine/elena.h index 13f80b592f..46c054b90e 100644 --- a/elenasrc3/engine/elena.h +++ b/elenasrc3/engine/elena.h @@ -710,6 +710,14 @@ namespace elena_lang StrConvertor::copy(_string + len, s, getlength(s), subLen); _string[len + subLen] = 0; } + void appendUstr(const char* s, size_t str_len) + { + size_t len = length(); + + size_t subLen = MESSAGE_LEN - length(); + StrConvertor::copy(_string + len, s, str_len, subLen); + _string[len + subLen] = 0; + } WideMessage() { diff --git a/elenasrc3/engine/elenaconst.h b/elenasrc3/engine/elenaconst.h index 71978e3989..1f195e657f 100644 --- a/elenasrc3/engine/elenaconst.h +++ b/elenasrc3/engine/elenaconst.h @@ -13,7 +13,7 @@ namespace elena_lang { // --- Common ELENA Engine constants --- #define ENGINE_MAJOR_VERSION 6 // ELENA Engine version - #define ENGINE_MINOR_VERSION 5 + #define ENGINE_MINOR_VERSION 6 constexpr auto LINE_LEN = 0x1000; // the maximal source line length constexpr auto IDENTIFIER_LEN = 0x0300; // the maximal identifier length @@ -220,6 +220,8 @@ namespace elena_lang Linux_PPC64le = 0x00025, Linux_PPC32le = 0x00026, + MacOS_ARM64 = 0x00034, + TargetMask = 0x00F00, Standalone = 0x00000, VMClient = 0x00100, diff --git a/elenasrc3/engine/elenamachine.cpp b/elenasrc3/engine/elenamachine.cpp index c778444ea8..638de5cf75 100644 --- a/elenasrc3/engine/elenamachine.cpp +++ b/elenasrc3/engine/elenamachine.cpp @@ -367,7 +367,6 @@ bool SystemRoutineProvider :: CheckMessage(MemoryBase* msection, void* classPtr, RTManager manager(msection, nullptr); VMTHeader* header = (VMTHeader*)((uintptr_t)classPtr - elVMTClassOffset); - size_t counter = 0; // NOTE : skip the dispatcher for (pos_t i = 1; i < header->count; i++) { if (((VMTEntry*)classPtr)[i].message == message) diff --git a/elenasrc3/engine/gcroutines.cpp b/elenasrc3/engine/gcroutines.cpp index 78ed792d0a..3782b55a58 100644 --- a/elenasrc3/engine/gcroutines.cpp +++ b/elenasrc3/engine/gcroutines.cpp @@ -433,7 +433,7 @@ void* SystemRoutineProvider :: GCRoutine(GCTable* table, GCRoot* roots, size_t s CollectMG2YGRoots(table, shadowPtr); // ; collect perm yg roots - if (table->gc_perm_current > table->gc_perm_current) + if (table->gc_perm_current > table->gc_perm_end) CollectPermYGRoots(table, shadowPtr); // ; save gc_yg_current to mark objects diff --git a/elenasrc3/engine/jitcompiler.cpp b/elenasrc3/engine/jitcompiler.cpp index ba9c9bf75a..4adce0fa5a 100644 --- a/elenasrc3/engine/jitcompiler.cpp +++ b/elenasrc3/engine/jitcompiler.cpp @@ -3,7 +3,7 @@ // // This file contains ELENA JIT compiler class implementation. // -// (C)2021-2024, by Aleksey Rakov +// (C)2021-2025, by Aleksey Rakov //--------------------------------------------------------------------------- #include "elena.h" @@ -75,11 +75,11 @@ constexpr ref_t coreVariables[coreVariableNumber] = CORE_GC_TABLE, CORE_SINGLE_CONTENT, CORE_THREAD_TABLE }; -constexpr int coreConstantNumber = 4; +constexpr int coreConstantNumber = 5; constexpr ref_t coreConstants[coreConstantNumber] = { // NOTE: SYSTEM_ENV should be the last one to add correctly extra fields: GCMGSize, GCYGSize - CORE_TOC, VOIDOBJ, VOIDPTR, SYSTEM_ENV + CORE_TOC, VOIDOBJ, VOIDPTR, CORE_MATH_TABLE, SYSTEM_ENV }; // preloaded gc routines @@ -943,10 +943,9 @@ void elena_lang::loadFrameDispOp(JITCompilerScope* scope) scope->constants->dataOffset), 0); break; default: - // to make compiler happy + writeCoreReference(scope, entries->reference, entries->offset, code); break; } - //else writeCoreReference(); entries++; count--; diff --git a/elenasrc3/engine/langcommon.h b/elenasrc3/engine/langcommon.h index 53cc113557..30161b1e9a 100644 --- a/elenasrc3/engine/langcommon.h +++ b/elenasrc3/engine/langcommon.h @@ -731,6 +731,8 @@ namespace elena_lang constexpr auto LINUX_PPC64le_KEY = "Linux_PPC64le"; constexpr auto LINUX_ARM64_KEY = "Linux_ARM64"; + constexpr auto MACOS_ARM64_KEY = "MacOS_ARM64"; + constexpr auto LIBRARY_KEY = "Library"; constexpr auto CONSOLE_KEY = "STA Console"; constexpr auto GUI_KEY = "STA GUI"; @@ -796,6 +798,8 @@ namespace elena_lang return LINUX_PPC64le_KEY; case PlatformType::Linux_ARM64: return LINUX_ARM64_KEY; + case PlatformType::MacOS_ARM64: + return MACOS_ARM64_KEY; default: return nullptr; } diff --git a/elenasrc3/engine/libman.cpp b/elenasrc3/engine/libman.cpp index 161ab0ba24..a98ef62bd8 100644 --- a/elenasrc3/engine/libman.cpp +++ b/elenasrc3/engine/libman.cpp @@ -498,6 +498,8 @@ ReferenceInfo LibraryProvider :: retrieveReferenceInfo(ustr_t referenceName, For ModuleBase* LibraryProvider :: createModule(ustr_t name) { + assert(!_modules.exist(name)); + auto module = new Module(name); _modules.add(name, module); diff --git a/elenasrc3/engine/linux/presenter.cpp b/elenasrc3/engine/linux/presenter.cpp index faaacabdd6..9dda270926 100644 --- a/elenasrc3/engine/linux/presenter.cpp +++ b/elenasrc3/engine/linux/presenter.cpp @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // E L E N A P r o j e c t: ELENA command-Line Compiler // -// This file contains the Windows Presenter implementation +// This file contains the Linux Presenter implementation // // (C)2021-2024, by Aleksey Rakov //--------------------------------------------------------------------------- diff --git a/elenasrc3/engine/linux/presenter.h b/elenasrc3/engine/linux/presenter.h index 060c8e4b6f..b9c089f831 100644 --- a/elenasrc3/engine/linux/presenter.h +++ b/elenasrc3/engine/linux/presenter.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // E L E N A P r o j e c t: ELENA command-Line Compiler // -// This file contains the Windows Presenter declaration +// This file contains the Linux Presenter declaration // // (C)2021-2024, by Aleksey Rakov //--------------------------------------------------------------------------- diff --git a/elenasrc3/engine/projectbase.h b/elenasrc3/engine/projectbase.h index c89b6190a2..f79d0df643 100644 --- a/elenasrc3/engine/projectbase.h +++ b/elenasrc3/engine/projectbase.h @@ -75,6 +75,8 @@ namespace elena_lang ConditionalBoxing, EvaluateOp, + TracingMode, + Prolog, Epilog, diff --git a/elenasrc3/engine/rtmanager.cpp b/elenasrc3/engine/rtmanager.cpp index f92d74d749..6701cf7d72 100644 --- a/elenasrc3/engine/rtmanager.cpp +++ b/elenasrc3/engine/rtmanager.cpp @@ -51,7 +51,7 @@ bool RTManager :: readAddressInfo(addr_t retAddress, LibraryLoaderBase& provider if (!vmMode) { reader.read(&tempAddr, sizeof(tempAddr)); - ustr_t ns = reader.getString(DEFAULT_STR); + /*ustr_t ns = */reader.getString(DEFAULT_STR); } // search through debug section until the ret point is inside two consecutive steps within the same object diff --git a/elenasrc3/engine/windows/presenter.cpp b/elenasrc3/engine/windows/presenter.cpp index 553b5a6902..9c346ea9d3 100644 --- a/elenasrc3/engine/windows/presenter.cpp +++ b/elenasrc3/engine/windows/presenter.cpp @@ -107,9 +107,24 @@ void WinConsolePresenter :: printPath(ustr_t msg, path_t arg) void WinConsolePresenter :: print(ustr_t msg) { - WideMessage wstr(msg); - - ::print(wstr.str()); + size_t len = msg.length(); + if (len < MESSAGE_LEN) { + WideMessage wstr(msg); + + ::print(wstr.str()); + } + else { + while (len > 0) { + WideMessage wstr; + size_t sublen = _min(msg.length(), MESSAGE_LEN); + + wstr.appendUstr(msg, sublen); + ::print(wstr.str()); + + len -= sublen; + msg = msg + sublen; + } + } } void WinConsolePresenter :: print(ustr_t msg, ustr_t path, int col, int row, ustr_t s) diff --git a/elenasrc3/gui/gtklinux/gtkcommon.cpp b/elenasrc3/gui/gtklinux/gtkcommon.cpp index 8cf1871430..419a0582b2 100644 --- a/elenasrc3/gui/gtklinux/gtkcommon.cpp +++ b/elenasrc3/gui/gtklinux/gtkcommon.cpp @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // E L E N A P r o j e c t: ELENA IDE // GTK Common Window Implementation -// (C)2024, by Alexei Rakov +// (C)2024-2025, by Alexei Rakov //--------------------------------------------------------------------------- #include "gtkcommon.h" @@ -26,4 +26,5 @@ int WindowApp :: run(GUIControlBase* mainWindow, bool maximized, EventBase* star void WindowApp :: notify(EventBase* event) { + _eventBroadcaster->sendMessage(event); } diff --git a/elenasrc3/gui/gtklinux/gtkcommon.h b/elenasrc3/gui/gtklinux/gtkcommon.h index 8ce12b538b..752fab543f 100644 --- a/elenasrc3/gui/gtklinux/gtkcommon.h +++ b/elenasrc3/gui/gtklinux/gtkcommon.h @@ -1,70 +1,22 @@ //--------------------------------------------------------------------------- // E L E N A P r o j e c t: ELENA IDE -// GTK Common Header File -// (C)2024, by Aleksey Rakov +// GUI common classes header File +// (C)2021-2025, by Aleksey Rakov //--------------------------------------------------------------------------- #ifndef GTKCOMMON_H #define GTKCOMMON_H -#include #include "guicommon.h" +#include namespace elena_lang { - // --- Color --- - struct Color + // --- BroadcasterBase --- + class BroadcasterBase { - double red; - double green; - double blue; - double alpha; - - bool operator == (Color& color) - { - if (red == color.red && green == color.green && blue == color.blue && alpha == color.alpha) { - return true; - } - else return false; - } - - bool operator != (Color& color) - { - if (red != color.red || green != color.green || blue != color.blue || alpha != color.alpha) { - return true; - } - else return false; - } - - void set(double red, double green, double blue) - { - this->red = red; - this->green = green; - this->blue = blue; - this->alpha = 1.0; - } - - void set(double red, double green, double blue, double alpha) - { - this->red = red; - this->green = green; - this->blue = blue; - this->alpha = alpha; - } - - Color() - { - set(0, 0, 0); - } - Color(double red, double green, double blue) - { - set(red, green, blue); - } - - Color(double red, double green, double blue, double alpha) - { - set(red, green, blue, alpha); - } + public: + virtual void sendMessage(EventBase* event) = 0; }; // --- WindowBase --- @@ -115,11 +67,18 @@ namespace elena_lang // --- WindowApp --- class WindowApp : public GUIApp { + BroadcasterBase* _eventBroadcaster; + public: + int run(GUIControlBase* mainWindow, bool maximized, EventBase* startEvent) override; + void notify(EventBase* event) override; - int run(GUIControlBase* mainWindow, bool maximized, EventBase* startEvent) override; + WindowApp(BroadcasterBase* eventBroadcaster) + { + _eventBroadcaster = eventBroadcaster; + } }; } -#endif // GTKCOMMON_H +#endif diff --git a/elenasrc3/gui/gtklinux/gtkgraphic.h b/elenasrc3/gui/gtklinux/gtkgraphic.h index e23b065065..1cd9d0bb95 100644 --- a/elenasrc3/gui/gtklinux/gtkgraphic.h +++ b/elenasrc3/gui/gtklinux/gtkgraphic.h @@ -12,6 +12,62 @@ namespace elena_lang { +// --- Colour --- + +struct Color +{ + double red; + double green; + double blue; + double alpha; + + bool operator == (Color& color) + { + if (red == color.red && green == color.green && blue == color.blue && alpha == color.alpha) { + return true; + } + else return false; + } + + bool operator != (Color& color) + { + if (red != color.red || green != color.green || blue != color.blue || alpha != color.alpha) { + return true; + } + else return false; + } + + void set(double red, double green, double blue) + { + this->red = red; + this->green = green; + this->blue = blue; + this->alpha = 1.0; + } + + void set(double red, double green, double blue, double alpha) + { + this->red = red; + this->green = green; + this->blue = blue; + this->alpha = alpha; + } + + Color() + { + set(0, 0, 0); + } + Color(double red, double green, double blue) + { + set(red, green, blue); + } + + Color(double red, double green, double blue, double alpha) + { + set(red, green, blue, alpha); + } +}; + // --- Font --- struct Font : public FontBase @@ -117,4 +173,3 @@ struct Canvas } // elena_lang #endif // gtkgraphicH - diff --git a/elenasrc3/gui/gtklinux/gtktabbar.cpp b/elenasrc3/gui/gtklinux/gtktabbar.cpp index 99fefbb205..98def95b2c 100644 --- a/elenasrc3/gui/gtklinux/gtktabbar.cpp +++ b/elenasrc3/gui/gtklinux/gtktabbar.cpp @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // E L E N A P r o j e c t: ELENA IDE // GTK+ TabBar Implementation File -// (C)2021-2024, by Aleksey Rakov +// (C)2021-2025, by Aleksey Rakov //--------------------------------------------------------------------------- @@ -27,3 +27,25 @@ void TabBar :: addTab(const char* name, Gtk::Widget* control) append_page(*hb, name); // !! temporal } + +Gtk::Widget* TabBar :: getCurrentControl() +{ + Gtk::HBox* hb = dynamic_cast(get_nth_page(get_current_page())); + + auto list = hb->get_children(); + + return list[0]; +} + +/*Gtk::Widget* TabBar :: getTabControl(int index) const +{ + if (index == -1) + return nullptr; + + TabPages::Iterator it = _tabs.start(); + while (index > 0) { + index--; + it++; + } + return (*it)->control; +}*/ diff --git a/elenasrc3/gui/gtklinux/gtktabbar.h b/elenasrc3/gui/gtklinux/gtktabbar.h index 55ea27e1a5..1635b002ca 100644 --- a/elenasrc3/gui/gtklinux/gtktabbar.h +++ b/elenasrc3/gui/gtklinux/gtktabbar.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // E L E N A P r o j e c t: ELENA IDE // GTK+ TabBar Header File -// (C)2024, by Aleksey Rakov +// (C)2024-2025, by Aleksey Rakov //--------------------------------------------------------------------------- #ifndef GTKTABBAR_H @@ -17,6 +17,8 @@ namespace elena_lang public: void addTab(const char* name, Gtk::Widget* control); + Gtk::Widget* getCurrentControl(); + TabBar(); }; } diff --git a/elenasrc3/gui/gtklinux/gtktextframe.cpp b/elenasrc3/gui/gtklinux/gtktextframe.cpp index 2931b642ed..03b19f1252 100644 --- a/elenasrc3/gui/gtklinux/gtktextframe.cpp +++ b/elenasrc3/gui/gtklinux/gtktextframe.cpp @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // E L E N A P r o j e c t: ELENA IDE // Linux EditFrame container File -// (C)2021-2022, by Aleksey Rakov +// (C)2021-2025, by Aleksey Rakov //--------------------------------------------------------------------------- #include "gtklinux/gtktextframe.h" @@ -51,3 +51,8 @@ void TextViewFrame :: beforeDocumentClose(int index) void TextViewFrame :: onDocumentClose(int index, bool empty) { } + +TextViewWindow* TextViewFrame :: getCurrentTextView() +{ + return dynamic_cast(getCurrentControl()); +} diff --git a/elenasrc3/gui/gtklinux/gtktextframe.h b/elenasrc3/gui/gtklinux/gtktextframe.h index b8e201c4d9..458de65dd8 100644 --- a/elenasrc3/gui/gtklinux/gtktextframe.h +++ b/elenasrc3/gui/gtklinux/gtktextframe.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // E L E N A P r o j e c t: ELENA IDE // Linux EditFrame container File -// (C)2021-2024, by Aleksey Rakov +// (C)2021-2025, by Aleksey Rakov //--------------------------------------------------------------------------- #ifndef GTKTEXTFRAME_H @@ -21,6 +21,8 @@ namespace elena_lang ViewStyles* _styles; TextViewControllerBase* _controller; + TextViewWindow* getCurrentTextView(); + public: void onDocumentNew(int index) override; void onDocumentSelect(int index) override; diff --git a/elenasrc3/gui/gtklinux/gtktextview.cpp b/elenasrc3/gui/gtklinux/gtktextview.cpp index d84cdd1159..c2cf90d94e 100644 --- a/elenasrc3/gui/gtklinux/gtktextview.cpp +++ b/elenasrc3/gui/gtklinux/gtktextview.cpp @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // E L E N A P r o j e c t: ELENA IDE // GTK+ TextView Control Implementation File -// (C)2021-2024, by Aleksey Rakov +// (C)2021-2025, by Aleksey Rakov //--------------------------------------------------------------------------- #include "gtklinux/gtktextview.h" @@ -189,17 +189,15 @@ void TextViewWindow::TextDrawingArea :: onResize(int x, int y, int width, int he update(true); } -void TextView::TextDrawingArea :: onEditorChange() +void TextViewWindow::TextDrawingArea :: onDocumentUpdate(DocumentChangeStatus& changeStatus) { -// if (_document->status.isViewChanged()) { -// _cached = false; -// -// refresh(); -// } + if (changeStatus.isViewChanged()) { + //_cached = false; + _caret_x = 0; + } + _caretChanged = changeStatus.caretChanged; update(false); - - _view->_textview_changed.emit(); } void TextViewWindow::TextDrawingArea :: paint(Canvas& canvas , int viewWidth, int viewHeight) @@ -330,7 +328,7 @@ void TextViewWindow::TextDrawingArea :: resizeDocument(int width, int height) void TextViewWindow::TextDrawingArea :: update(bool resized) { if (_model) { - auto docView = _model->DocView(); + //auto docView = _model->DocView(); _view->updateVScroller(resized); // if (docView->status.maxColChanged) { @@ -412,7 +410,7 @@ bool TextViewWindow::TextDrawingArea :: on_key_press_event(GdkEventKey* event) } else return Gtk::DrawingArea::on_key_press_event(event); } - onEditorChange(); + //onEditorChange(); return true; } @@ -439,10 +437,9 @@ bool TextViewWindow::TextDrawingArea :: on_button_press_event(GdkEventButton* ev // if (margin) { // notify(IDE_EDITOR_MARGINCLICKED); // } - _captureMouse(); + //_captureMouse(); - // refresh(true); - onEditorChange(); + // refresh(true); onDocumentUpdate(status); } return true; @@ -450,16 +447,16 @@ bool TextViewWindow::TextDrawingArea :: on_button_press_event(GdkEventButton* ev else return false; } -bool TextView::TextDrawingArea :: mouseToScreen(Point point, int& col, int& row, bool& margin) +bool TextViewWindow::TextDrawingArea :: mouseToScreen(Point point, int& col, int& row, bool& margin) { // //Rectangle rect = getRectangle(); - Style defaultStyle = _styles[STYLE_DEFAULT]; - if (defaultStyle.valid) { - int marginWidth = _styles.getMarginWidth() + getLineNumberMargin(); - int offset = defaultStyle.avgCharWidth / 2; + Style* defaultStyle = _styles->getStyle(STYLE_DEFAULT); + if (defaultStyle->valid) { + int marginWidth = getLineNumberMargin(); + int offset = defaultStyle->avgCharWidth / 2; - col = (point.x/* - rect.topLeft.x*/ - marginWidth + offset) / defaultStyle.avgCharWidth; - row = (point.y/* - rect.topLeft.y*/) / (_styles.getLineHeight()); + col = (point.x/* - rect.topLeft.x*/ - marginWidth + offset) / defaultStyle->avgCharWidth; + row = (point.y/* - rect.topLeft.y*/) / (_styles->getLineHeight()); margin = (point.x/* - rect.topLeft.x*/ < marginWidth); return true; @@ -467,25 +464,32 @@ bool TextView::TextDrawingArea :: mouseToScreen(Point point, int& col, int& row, else return false; } -bool TextView::TextDrawingArea :: on_button_release_event (GdkEventButton* event) +bool TextViewWindow::TextDrawingArea :: on_button_release_event (GdkEventButton* event) { //_releaseMouse(); return true; } -bool TextView::TextDrawingArea :: on_scroll_event(GdkEventScroll* scroll_event) +bool TextViewWindow::TextDrawingArea :: on_scroll_event(GdkEventScroll* scroll_event) { - if (_document) { + DocumentChangeStatus status = {}; + + auto docView = _model->DocView(); + if (docView) { int offset = (scroll_event->direction == GDK_SCROLL_UP) ? -1 : 1; - if (_ELENA_::test(scroll_event->state, GDK_CONTROL_MASK)) { - offset *= _document->getSize().y; + if (test((int)scroll_event->state, GDK_CONTROL_MASK)) { + offset *= docView->getSize().y; } - _document->vscroll(offset); + docView->vscroll(status, offset); + + onDocumentUpdate(status); - onEditorChange(); + return true; } + + return false; } // --- TextViewWindow --- @@ -504,3 +508,8 @@ void TextViewWindow :: updateVScroller(bool resized) // if (resized) // _vadjustment->changed(); } + +void TextViewWindow :: onDocumentUpdate(DocumentChangeStatus& changeStatus) +{ + _area.onDocumentUpdate(changeStatus); +} diff --git a/elenasrc3/gui/gtklinux/gtktextview.h b/elenasrc3/gui/gtklinux/gtktextview.h index 6c334b4fc8..553eb28761 100644 --- a/elenasrc3/gui/gtklinux/gtktextview.h +++ b/elenasrc3/gui/gtklinux/gtktextview.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // E L E N A P r o j e c t: ELENA IDE // GTK TextView Control Header File -// (C)2021-2024, by Aleksey Rakov +// (C)2021-2025, by Aleksey Rakov //--------------------------------------------------------------------------- #ifndef GTKTEXTVIEW_H @@ -107,7 +107,6 @@ namespace elena_lang bool on_scroll_event (GdkEventScroll* scroll_event) override; void onResize(int x, int y, int width, int height); - void onEditorChange(); bool mouseToScreen(Point point, int& col, int& row, bool& margin); @@ -118,14 +117,23 @@ namespace elena_lang void paint(Canvas& canvas, int viewWidth, int viewHeight); public: + void onDocumentUpdate(DocumentChangeStatus& changeStatus); + TextDrawingArea(TextViewWindow* view, TextViewModelBase* model, TextViewControllerBase* controller, ViewStyles* styles); }; protected: - TextDrawingArea _area; + TextDrawingArea _area; + + void on_grab_focus() override + { + _area.grab_focus(); + } public: + void onDocumentUpdate(DocumentChangeStatus& changeStatus); + void updateVScroller(bool resized); TextViewWindow(TextViewModelBase* model, TextViewControllerBase* controller, diff --git a/elenasrc3/gui/text.h b/elenasrc3/gui/text.h index 8c0774a044..647778e692 100644 --- a/elenasrc3/gui/text.h +++ b/elenasrc3/gui/text.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // E L E N A P r o j e c t: ELENA IDE // Text class header -// (C)2021-2023, by Aleksey Rakov +// (C)2021-2025, by Aleksey Rakov //--------------------------------------------------------------------------- #ifndef TEXT_H @@ -117,6 +117,7 @@ namespace elena_lang return true; } + else return true; } else return false; #elif _MSC_VER diff --git a/elenasrc3/ide/codeblocks/elide_gtk.cbp b/elenasrc3/ide/codeblocks/elide_gtk.cbp index aa75f8664b..d810e4db5c 100644 --- a/elenasrc3/ide/codeblocks/elide_gtk.cbp +++ b/elenasrc3/ide/codeblocks/elide_gtk.cbp @@ -126,6 +126,10 @@ + + + + diff --git a/elenasrc3/ide/eng/messages.h b/elenasrc3/ide/eng/messages.h index df37aea22f..458a84950a 100644 --- a/elenasrc3/ide/eng/messages.h +++ b/elenasrc3/ide/eng/messages.h @@ -9,7 +9,7 @@ namespace elena_lang { - constexpr auto APP_NAME = _T("ELENA IDE 6.1"); + constexpr auto APP_NAME = _T("ELENA IDE 6.6"); constexpr auto OPEN_FILE_CAPTION = _T("Open File"); constexpr auto OPEN_PROJECT_CAPTION = _T("Open Project"); diff --git a/elenasrc3/ide/gtklinux/factory.cpp b/elenasrc3/ide/gtklinux/factory.cpp index 8f4915a800..facd3322af 100644 --- a/elenasrc3/ide/gtklinux/factory.cpp +++ b/elenasrc3/ide/gtklinux/factory.cpp @@ -1,13 +1,13 @@ //--------------------------------------------------------------------------- // E L E N A P r o j e c t: ELENA IDE // IDE windows factory -// (C)2021-2022, by Aleksey Rakov +// (C)2021-2025, by Aleksey Rakov //--------------------------------------------------------------------------- #include "factory.h" #include "gtklinux/gtkcommon.h" #include "gtklinux/gtkide.h" -#include "gtklinux/gtktextframe.h" +#include "gtklinux/gtkidetextview.h" #include "gtklinux/gtktextview.h" //#include "text.h" //#include "sourceformatter.h" @@ -66,6 +66,24 @@ StyleInfo darkStyles[STYLE_MAX + 1] = { constexpr auto STYLE_SCHEME_COUNT = 3; +// --- IDEBroadcaster --- + +IDEBroadcaster :: IDEBroadcaster() +{ +} + +void IDEBroadcaster :: sendMessage(EventBase* event) +{ + int eventId = event->eventId(); + switch (eventId) { + case EVENT_TEXTVIEW_MODEL_CHANGED: + textview_changed.emit(*(TextViewModelEvent*)event); + break; + default: + break; + } +} + // --- IDEFactory --- IDEFactory :: IDEFactory(IDEModel* ideModel, IDEController* controller, @@ -98,7 +116,9 @@ Gtk::Widget* IDEFactory :: createTextControl() reloadStyles(viewModel); //TextViewWindow* view = new TextViewWindow(/*_model->viewModel(), &_styles*//*, &_controller->sourceController*/); - TextViewFrame* frame = new TextViewFrame(_model->viewModel(), &_controller->sourceController, &_styles); + IDETextViewFrame* frame = new IDETextViewFrame(_model->viewModel(), &_controller->sourceController, &_styles); + + _broadcaster.textview_changed.connect(sigc::mem_fun(*frame, &IDETextViewFrame::on_text_model_change)); return frame; } @@ -139,12 +159,14 @@ GUIControlBase* IDEFactory :: createMainWindow(NotifierBase* notifier, ProcessBa ideWindow->populate(counter, children); ideWindow->setLayout(textIndex, -1, -1, -1, -1); + _broadcaster.textview_changed.connect(sigc::mem_fun(*ideWindow, >KIDEWindow::on_text_model_change)); + return new WindowWrapper(ideWindow); } GUIApp* IDEFactory :: createApp() { - WindowApp* app = new WindowApp(); + WindowApp* app = new WindowApp(&_broadcaster); return app; } diff --git a/elenasrc3/ide/gtklinux/factory.h b/elenasrc3/ide/gtklinux/factory.h index 4942a9cfc7..e17de9163f 100644 --- a/elenasrc3/ide/gtklinux/factory.h +++ b/elenasrc3/ide/gtklinux/factory.h @@ -17,10 +17,25 @@ namespace elena_lang { + typedef sigc::signal type_textview_changed; + + // --- IDEBroadcaster --- + class IDEBroadcaster : public BroadcasterBase + { + public: + type_textview_changed textview_changed; + + void sendMessage(EventBase* event) override; + + IDEBroadcaster(); + }; + // --- IDEFactory --- class IDEFactory : public GUIFactoryBase, public ViewFactoryBase { protected: + IDEBroadcaster _broadcaster; + FontFactory _fontFactory; ViewStyles _styles; StyleInfo* _schemes[3]; diff --git a/elenasrc3/ide/gtklinux/gtkdialogs.cpp b/elenasrc3/ide/gtklinux/gtkdialogs.cpp new file mode 100644 index 0000000000..0ae250431b --- /dev/null +++ b/elenasrc3/ide/gtklinux/gtkdialogs.cpp @@ -0,0 +1,714 @@ +//--------------------------------------------------------------------------- +// E L E N A P r o j e c t: ELENA IDE +// GTK Static dialog implementations +// (C)2025, by Aleksey Rakov +//--------------------------------------------------------------------------- + +#include "gtkdialogs.h" + +//#include "Resource.h" +//#include "eng/messages.h" + +using namespace elena_lang; + +//// --- MsgBox --- +// +//int MsgBox :: show(HWND owner, const wchar_t* message, int type) +//{ +// return ::MessageBox(owner, message, APP_NAME, type); +//} +// +//int MsgBox :: showQuestion(HWND owner, const wchar_t* message) +//{ +// return show(owner, message, MB_YESNOCANCEL | MB_ICONQUESTION); +//} + +// --- FileDialog --- + +//const wchar_t* FileDialog::ProjectFilter = _T("ELENA Project file\0*.prj\0All types\0*.*\0\0"); +//const wchar_t* FileDialog::SourceFilter = _T("ELENA source file\0*.l\0All types\0*.*\0\0"); +// +FileDialog :: FileDialog(Gtk::Window* owner, const char** filter, int filterCounter, + const char* caption, const char* initialDir) +{ + _owner = owner; + _caption = caption; + _filter = filter; + _filterCounter = filterCounter; + _initialDir = initialDir; +} + +bool FileDialog :: openFile(PathString& path) +{ + Gtk::FileChooserDialog dialog(_caption, Gtk::FILE_CHOOSER_ACTION_OPEN); + dialog.set_transient_for(*_owner); + + if (!emptystr(_initialDir)) + dialog.set_current_folder (_initialDir); + + dialog.add_button("_Cancel", Gtk::RESPONSE_CANCEL); + dialog.add_button("_Open", Gtk::RESPONSE_OK); + + for (int i = 0; i < _filterCounter; i += 2) { + Glib::RefPtr filter_l = Gtk::FileFilter::create(); + + filter_l->set_name(_filter[i + 1]); + filter_l->add_pattern(_filter[i]); + dialog.add_filter(filter_l); + } + + int result = dialog.run(); + if (result == Gtk::RESPONSE_OK) { + std::string filename = dialog.get_filename(); + + path.copy(filename.c_str()); + + return true; + } + return false; +} + +bool FileDialog :: openFiles(List& files) +{ + Gtk::FileChooserDialog dialog(_caption, Gtk::FILE_CHOOSER_ACTION_OPEN); + dialog.set_transient_for(*_owner); + + if (!emptystr(_initialDir)) + dialog.set_current_folder (_initialDir); + + dialog.add_button("_Cancel", Gtk::RESPONSE_CANCEL); + dialog.add_button("_Open", Gtk::RESPONSE_OK); + + for (int i = 0; i < _filterCounter; i += 2) { + Glib::RefPtr filter_l = Gtk::FileFilter::create(); + + filter_l->set_name(_filter[i + 1]); + filter_l->add_pattern(_filter[i]); + dialog.add_filter(filter_l); + } + + int result = dialog.run(); + if (result == Gtk::RESPONSE_OK) { + std::string filename = dialog.get_filename(); + + files.add(StrUtil::clone(filename.c_str())); + + return true; + } + return false; + + return false; +} + +bool FileDialog :: saveFile(path_t ext, PathString& path) +{ +// _struct.Flags = _defaultFlags | OFN_PATHMUSTEXIST; +// _struct.lpstrDefExt = ext; +// +// if (::GetSaveFileName(&_struct)) { +// path.copy(_fileName); +// +// return true; +// } + /*else */return false; +} + +//MessageDialogBase::Answer MessageDialog :: question(text_str message, text_str param) +//{ +// WideMessage wideMessage(message); +// wideMessage.append(param); +// +// int result = MsgBox::show(_owner->handle(), *wideMessage, MB_YESNOCANCEL | MB_ICONQUESTION); +// +// if (MsgBox::isYes(result)) { +// return Answer::Yes; +// } +// else if (MsgBox::isCancel(result)) { +// return Answer::Cancel; +// } +// else return Answer::No; +//} +// +//MessageDialogBase::Answer MessageDialog :: question(text_str message) +//{ +// int result = MsgBox::show(_owner->handle(), message, MB_YESNOCANCEL | MB_ICONQUESTION); +// +// if (MsgBox::isYes(result)) { +// return Answer::Yes; +// } +// else if (MsgBox::isCancel(result)) { +// return Answer::Cancel; +// } +// else return Answer::No; +//} +// +//void MessageDialog :: info(text_str message) +//{ +// ::MessageBox(_owner->handle(), message, APP_NAME, MB_OK | MB_ICONWARNING); +//} +// +//// --- WinDialog --- +// +//BOOL CALLBACK WinDialog::DialogProc(HWND hWnd, size_t message, WPARAM wParam, LPARAM lParam) +//{ +// WinDialog* dialog = (WinDialog*)::GetWindowLongPtr(hWnd, GWLP_USERDATA); +// switch (message) { +// case WM_INITDIALOG: +// dialog = (WinDialog*)lParam; +// dialog->_handle = hWnd; +// ::SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)lParam); +// +// dialog->onCreate(); +// +// return 0; +// case WM_COMMAND: +// dialog->doCommand(LOWORD(wParam), HIWORD(wParam)); +// return TRUE; +// default: +// return FALSE; +// } +//} +// +//void WinDialog :: doCommand(int id, int command) +//{ +// switch (id) { +// case IDOK: +// onOK(); +// ::EndDialog(_handle, IDOK); +// break; +// case IDCANCEL: +// ::EndDialog(_handle, IDCANCEL); +// break; +// } +//} +// +//int WinDialog :: show() +//{ +// return (int)::DialogBoxParam(_instance, MAKEINTRESOURCE(_dialogId), +// _owner->handle(), (DLGPROC)DialogProc, (LPARAM)this); +//} +// +//void WinDialog :: clearComboBoxItem(int id) +//{ +// LRESULT counter = ::SendDlgItemMessage(_handle, id, CB_GETCOUNT, 0, 0); +// while (counter > 0) { +// ::SendDlgItemMessage(_handle, id, CB_DELETESTRING, 0, 0); +// +// counter--; +// } +//} +// +//void WinDialog :: addComboBoxItem(int id, const wchar_t* text) +//{ +// ::SendDlgItemMessage(_handle, id, CB_ADDSTRING, 0, (LPARAM)text); +//} +// +//void WinDialog :: setComboBoxIndex(int id, int index) +//{ +// ::SendDlgItemMessage(_handle, id, CB_SETCURSEL, index, 0); +//} +// +//int WinDialog :: getComboBoxIndex(int id) +//{ +// return (int)::SendDlgItemMessage(_handle, id, CB_GETCURSEL, 0, 0); +//} +// +//void WinDialog :: addListItem(int id, const wchar_t* text) +//{ +// ::SendDlgItemMessage(_handle, id, LB_ADDSTRING, 0, (LPARAM)text); +//} +// +//int WinDialog :: getListSelCount(int id) +//{ +// return (int)::SendDlgItemMessage(_handle, id, LB_GETSELCOUNT, 0, 0); +//} +// +//int WinDialog :: getListIndex(int id) +//{ +// return (int)::SendDlgItemMessage(_handle, id, LB_GETCURSEL, 0, 0); +//} +// +//void WinDialog :: setText(int id, const wchar_t* text) +//{ +// ::SendDlgItemMessage(_handle, id, WM_SETTEXT, 0, (LPARAM)text); +//} +// +//void WinDialog :: setIntText(int id, int value) +//{ +// String s; +// s.appendInt(value); +// +// ::SendDlgItemMessage(_handle, id, WM_SETTEXT, 0, (LPARAM)(s.str())); +//} +// +//void WinDialog :: setTextLimit(int id, int maxLength) +//{ +// ::SendDlgItemMessage(_handle, id, EM_SETLIMITTEXT, maxLength, 0); +//} +// +//void WinDialog :: getText(int id, wchar_t** text, int length) +//{ +// ::SendDlgItemMessage(_handle, id, WM_GETTEXT, length, (LPARAM)text); +//} +// +//int WinDialog :: getIntText(int id) +//{ +// wchar_t s[13]; +// +// ::SendDlgItemMessage(_handle, id, WM_GETTEXT, 12, (LPARAM)s); +// +// return StrConvertor::toInt(s, 10); +//} +// +//void WinDialog :: setCheckState(int id, bool value) +//{ +// ::SendDlgItemMessage(_handle, id, BM_SETCHECK, value ? BST_CHECKED : BST_UNCHECKED, 0); +//} +// +//void WinDialog :: setUndefinedCheckState(int id) +//{ +// ::SendDlgItemMessage(_handle, id, BM_SETCHECK, BST_INDETERMINATE, 0); +//} +// +//bool WinDialog :: getCheckState(int id) +//{ +// return test((int)::SendDlgItemMessage(_handle, id, BM_GETCHECK, 0, 0), BST_CHECKED); +//} +// +//bool WinDialog :: isUndefined(int id) +//{ +// return test((int)::SendDlgItemMessage(_handle, id, BM_GETCHECK, 0, 0), BST_INDETERMINATE); +//} +// +//void WinDialog :: enable(int id, bool enabled) +//{ +// ::EnableWindow(::GetDlgItem(_handle, id), enabled ? TRUE : FALSE); +//} +// +//// --- ProjectSettings --- +// +//ProjectSettings :: ProjectSettings(HINSTANCE instance, WindowBase* owner, ProjectModel* model) +// : WinDialog(instance, owner, IDD_SETTINGS) +//{ +// _model = model; +//} +// +//void ProjectSettings :: loadTemplateList() +//{ +// int selected = 0; +// int current = 0; +// for (auto it = _model->projectTypeList.start(); !it.eof(); ++it) { +// ustr_t key = *it; +// if (_model->templateName.compare(key)) { +// selected = current; +// } +// +// WideMessage caption(key); +// addComboBoxItem(IDC_SETTINGS_TEPMPLATE, *caption); +// current++; +// } +// +// setComboBoxIndex(IDC_SETTINGS_TEPMPLATE, selected); +//} +// +//void ProjectSettings :: loadProfileList() +//{ +// int selected = 0; +// int current = 0; +// for (auto it = _model->profileList.start(); !it.eof(); ++it) { +// ustr_t key = *it; +// if (_model->profile.compare(key)) { +// selected = current; +// } +// +// WideMessage caption(key); +// addComboBoxItem(IDC_SETTINGS_PROFILE, *caption); +// current++; +// } +// +// setComboBoxIndex(IDC_SETTINGS_PROFILE, selected); +//} +// +//void ProjectSettings :: onCreate() +//{ +// setTextLimit(IDC_SETTINGS_PACKAGE, IDENTIFIER_LEN); +// +// WideMessage caption(*_model->package); +// setText(IDC_SETTINGS_PACKAGE, caption.str()); +// +// WideMessage optionCaption(*_model->options); +// setText(IDC_SETTINGS_OPTIONS, optionCaption.str()); +// +// WideMessage targetCaption(*_model->target); +// setText(IDC_SETTINGS_TARGET, targetCaption.str()); +// +// setText(IDC_SETTINGS_OUTPUT, *_model->outputPath); +// +// setText(IDC_SETTINGS_ARGUMENT, *_model->debugArguments); +// +// addComboBoxItem(IDC_SETTINGS_DEBUG, _T("Disabled")); +// addComboBoxItem(IDC_SETTINGS_DEBUG, _T("Enabled")); +// +// //int mode = _project->getDebugMode(); +// //if (mode != 0) { +// setComboBoxIndex(IDC_SETTINGS_DEBUG, 1); +// //} +// //else setComboBoxIndex(IDC_SETTINGS_DEBUG, 0); +// +// if (_model->strictType == FLAG_UNDEFINED) { +// setUndefinedCheckState(IDC_SETTINGS_STRICTTYPE); +// } +// else setCheckState(IDC_SETTINGS_STRICTTYPE, _model->strictType == -1); +// +// loadTemplateList(); +// loadProfileList(); +//} +// +//void ProjectSettings :: onOK() +//{ +// wchar_t name[IDENTIFIER_LEN + 1]; +// +// if (getComboBoxIndex(IDC_SETTINGS_TEPMPLATE) != -1) { +// getText(IDC_SETTINGS_TEPMPLATE, (wchar_t**)(&name), IDENTIFIER_LEN); +// +// IdentifierString value(name); +// _model->templateName.copy(*value); +// } +// +// if (getComboBoxIndex(IDC_SETTINGS_PROFILE) != -1) { +// getText(IDC_SETTINGS_PROFILE, (wchar_t**)(&name), IDENTIFIER_LEN); +// +// IdentifierString value(name); +// _model->profile.copy(*value); +// } +// +// getText(IDC_SETTINGS_PACKAGE, (wchar_t**)(&name), IDENTIFIER_LEN); +// if (getlength(name) > 0) { +// IdentifierString value(name); +// _model->package.copy(*value); +// } +// else _model->package.clear(); +// +// getText(IDC_SETTINGS_OPTIONS, (wchar_t**)(&name), IDENTIFIER_LEN); +// if (getlength(name) > 0) { +// IdentifierString value(name); +// _model->options.copy(*value); +// } +// else _model->options.clear(); +// +// getText(IDC_SETTINGS_TARGET, (wchar_t**)(&name), IDENTIFIER_LEN); +// if (getlength(name) > 0) { +// IdentifierString value(name); +// _model->target.copy(*value); +// } +// else _model->target.clear(); +// +// getText(IDC_SETTINGS_OUTPUT, (wchar_t**)(&name), IDENTIFIER_LEN); +// _model->outputPath.copy(name); +// +// getText(IDC_SETTINGS_ARGUMENT, (wchar_t**)(&name), IDENTIFIER_LEN); +// _model->debugArguments.copy(name); +// +// if (isUndefined(IDC_SETTINGS_STRICTTYPE)) { +// _model->strictType = FLAG_UNDEFINED; +// } +// else if (getCheckState(IDC_SETTINGS_STRICTTYPE)) { +// _model->strictType = -1; +// } +// else _model->strictType = 0; +// +// if (!_model->singleSourceProject) +// _model->notSaved = true; +//} +// +//bool ProjectSettings :: showModal() +//{ +// return show() == IDOK; +//} +// +//// --- EditorSettings --- +// +//EditorSettings :: EditorSettings(HINSTANCE instance, WindowBase* owner, TextViewModelBase* model) +// : WinDialog(instance, owner, IDD_EDITOR_SETTINGS) +//{ +// _model = model; +//} +// +//void EditorSettings::onCreate() +//{ +// addComboBoxItem(IDC_EDITOR_COLORSCHEME, _T("Default")); +// addComboBoxItem(IDC_EDITOR_COLORSCHEME, _T("Classic")); +// addComboBoxItem(IDC_EDITOR_COLORSCHEME, _T("Dark")); +// +// setComboBoxIndex(IDC_EDITOR_COLORSCHEME, _model->schemeIndex); +// +// setCheckState(IDC_EDITOR_HIGHLIGHSYNTAXFLAG, _model->highlightSyntax); +// setCheckState(IDC_EDITOR_LINENUMBERFLAG, _model->lineNumbersVisible); +// +// // populate font size combo box +// String size; +// for (int i = 8; i < 25; i++) { +// size.appendInt(i); +// addComboBoxItem(IDC_EDITOR_FONTSIZE, size.str()); +// size.clear(); +// } +// +// setComboBoxIndex(IDC_EDITOR_FONTSIZE, _model->fontSize - 8); +//} +// +//void EditorSettings :: onOK() +//{ +// int index = getComboBoxIndex(IDC_EDITOR_COLORSCHEME); +// if (index != -1) +// _model->schemeIndex = index; +// +// int fontSize = getComboBoxIndex(IDC_EDITOR_COLORSCHEME) + 8; +// if (_model->fontSize != fontSize) { +// _model->fontSize = fontSize; +// } +// +// bool value = getCheckState(IDC_EDITOR_HIGHLIGHSYNTAXFLAG); +// if (_model->highlightSyntax != value) +// _model->setHighlightMode(value); +// +// _model->lineNumbersVisible = getCheckState(IDC_EDITOR_LINENUMBERFLAG); +//} +// +//bool EditorSettings :: showModal() +//{ +// return show() == IDOK; +//} +// +//// --- IDESettings --- +// +//IDESettings :: IDESettings(HINSTANCE instance, WindowBase* owner, IDEModel* model) +// : WinDialog(instance, owner, IDD_IDE_SETTINGS) +//{ +// _model = model; +//} +// +//void IDESettings :: onCreate() +//{ +// setCheckState(IDC_IDE_REMEMBERPATH, _model->rememberLastPath); +// setCheckState(IDC_IDE_REMEMBERPROJECT, _model->rememberLastProject); +// setCheckState(IDC_IDE_PERSIST_CONSOLE, _model->projectModel.withPersistentConsole); +// setCheckState(IDC_IDE_APPMAXIMIZED, _model->appMaximized); +// setCheckState(IDC_IDE_AUTORECOMPILE, _model->projectModel.autoRecompile); +// setCheckState(IDC_IDE_AUTOSAVE, _model->autoSave); +//} +// +//void IDESettings :: onOK() +//{ +// _model->rememberLastPath = getCheckState(IDC_IDE_REMEMBERPATH); +// _model->rememberLastProject = getCheckState(IDC_IDE_REMEMBERPROJECT); +// _model->appMaximized = getCheckState(IDC_IDE_APPMAXIMIZED); +// _model->projectModel.withPersistentConsole = getCheckState(IDC_IDE_PERSIST_CONSOLE); +// _model->projectModel.autoRecompile = getCheckState(IDC_IDE_AUTORECOMPILE); +// _model->autoSave = getCheckState(IDC_IDE_AUTOSAVE); +//} +// +//bool IDESettings :: showModal() +//{ +// return show() == IDOK; +//} +// +//// --- DebuggerSettings --- +// +//DebuggerSettings :: DebuggerSettings(HINSTANCE instance, WindowBase* owner, ProjectModel* model) +// : WinDialog(instance, owner, IDD_DEBUGGER_SETTINGS) +//{ +// _model = model; +//} +// +//void DebuggerSettings :: onCreate() +//{ +// setText(IDC_DEBUGGER_SRCPATH, *_model->paths.librarySourceRoot); +// setText(IDC_DEBUGGER_LIBPATH, *_model->paths.libraryRoot); +//} +// +//void DebuggerSettings :: onOK() +//{ +// wchar_t value[IDENTIFIER_LEN + 1]; +// +// getText(IDC_DEBUGGER_SRCPATH, (wchar_t**)(&value), IDENTIFIER_LEN); +// _model->paths.librarySourceRoot.copy(value); +// +// getText(IDC_DEBUGGER_LIBPATH, (wchar_t**)(&value), IDENTIFIER_LEN); +// _model->paths.libraryRoot.copy(value); +//} +// +//bool DebuggerSettings::showModal() +//{ +// return show() == IDOK; +//} +// +//// --- FindDialog --- +// +//FindDialog :: FindDialog(HINSTANCE instance, WindowBase* owner, bool replaceMode, FindModel* model) +// : WinDialog(instance, owner, replaceMode ? IDD_EDITOR_REPLACE : IDD_EDITOR_FIND) +//{ +// _replaceMode = replaceMode; +// _model = model; +//} +// +//void FindDialog :: copyHistory(int id, SearchHistory* history) +//{ +// clearComboBoxItem(id); +// +// SearchHistory::Iterator it = history->start(); +// while (!it.eof()) { +// addComboBoxItem(id, *it); +// +// ++it; +// } +//} +// +//bool FindDialog :: showModal() +//{ +// return show() == IDOK; +//} +// +//void FindDialog :: onCreate() +//{ +// setText(IDC_FIND_TEXT, _model->text.str()); +// if (_replaceMode) { +// setText(IDC_REPLACE_TEXT, _model->newText.str()); +// } +// setCheckState(IDC_FIND_CASE, _model->matchCase); +// setCheckState(IDC_FIND_WHOLE, _model->wholeWord); +// +// copyHistory(IDC_FIND_TEXT, &_model->searchHistory); +// +// //if (_replaceHistory) { +// // copyHistory(IDC_REPLACE_TEXT, _replaceHistory); +// //} +//} +// +//void FindDialog :: onOK() +//{ +// wchar_t s[200]; +// +// getText(IDC_FIND_TEXT, (wchar_t**)(&s), 255); +// _model->text.copy(s); +// +// if (_replaceMode) { +// getText(IDC_REPLACE_TEXT, (wchar_t**)(&s), 255); +// _model->newText.copy(s); +// } +// +// _model->matchCase = getCheckState(IDC_FIND_CASE); +// _model->wholeWord = getCheckState(IDC_FIND_WHOLE); +//} +// +//// --- GoToLineDialog --- +// +//GoToLineDialog :: GoToLineDialog(HINSTANCE instance, WindowBase* owner) +// : WinDialog(instance, owner, IDD_GOTOLINE) +//{ +//} +// +//void GoToLineDialog :: onCreate() +//{ +// setIntText(IDC_GOTOLINE_LINENUMBER, _lineNumber); +//} +// +//void GoToLineDialog :: onOK() +//{ +// _lineNumber = getIntText(IDC_GOTOLINE_LINENUMBER); +//} +// +//bool GoToLineDialog :: showModal(int& row) +//{ +// _lineNumber = row; +// +// if (show() == IDOK) { +// row = _lineNumber; +// +// return true; +// } +// +// return false; +//} +// +//// --- WindowListDialog --- +// +//WindowListDialog :: WindowListDialog(HINSTANCE instance, WindowBase* owner, TextViewModel* model) +// : WinDialog(instance, owner, IDD_WINDOWS) +//{ +// _model = model; +// _selectedIndex = -1; +//} +// +//void WindowListDialog :: onListChange() +//{ +// enable(IDOK, (getListSelCount(IDC_WINDOWS_LIST) == 1)); +//} +// +//void WindowListDialog :: doCommand(int id, int command) +//{ +// switch (id) { +// case IDC_WINDOWS_LIST: +// if (command == LBN_SELCHANGE) { +// onListChange(); +// } +// break; +// case IDC_WINDOWS_CLOSE: +// _selectedIndex = getSelectedWindow(); +// ::EndDialog(_handle, -2); +// break; +// default: +// WinDialog::doCommand(id, command); +// break; +// } +//} +// +//int WindowListDialog :: getSelectedWindow() +//{ +// return getListIndex(IDC_WINDOWS_LIST); +//} +// +//void WindowListDialog :: onOK() +//{ +// _selectedIndex = getSelectedWindow(); +//} +// +//void WindowListDialog :: onCreate() +//{ +// int count = _model->getDocumentCount(); +// for (int i = 1; i <= count; i++) { +// path_t path = _model->getDocumentPath(i); +// +// addListItem(IDC_WINDOWS_LIST, path); +// } +//} +// +//WindowListDialogBase::SelectResult WindowListDialog :: selectWindow() +//{ +// int retVal = show(); +// +// if (retVal == IDOK) { +// return { _selectedIndex + 1, Mode::Activate }; +// } +// if (retVal == -2) { +// return { _selectedIndex + 1, Mode::Close }; +// } +// +// return { 0, Mode::None }; +//} +// +//// --- AboutDialog --- +// +//AboutDialog :: AboutDialog(HINSTANCE instance, WindowBase* owner) +// : WinDialog(instance, owner, IDD_ABOUT) +//{ +//} +// +//void AboutDialog :: onCreate() +//{ +// setText(IDC_ABOUT_LICENCE_TEXT, MIT_LICENSE); +// setText(IDC_ABOUT_HOME, ELENA_HOMEPAGE); +//} +// +//void AboutDialog :: onOK() +//{ +//} diff --git a/elenasrc3/ide/gtklinux/gtkdialogs.h b/elenasrc3/ide/gtklinux/gtkdialogs.h new file mode 100644 index 0000000000..250d973c60 --- /dev/null +++ b/elenasrc3/ide/gtklinux/gtkdialogs.h @@ -0,0 +1,240 @@ +//--------------------------------------------------------------------------- +// E L E N A P r o j e c t: ELENA IDE +// GTK: Static dialogs header +// (C)2025, by Aleksey Rakov +//--------------------------------------------------------------------------- + +#ifndef GTKDIALOGS_H +#define GTKDIALOGS_H + +#include "controller.h" +#include "gtklinux/gtkcommon.h" +//#include "editcontrol.h" +//#include "ideproject.h" +//#include "ideview.h" + +namespace elena_lang +{ +// class MsgBox +// { +// public: +// static int show(HWND owner, const wchar_t* message, int type); +// +// static int showQuestion(HWND owner, const wchar_t* message); +// +// static bool isCancel(int result) { return result == IDCANCEL; } +// static bool isYes(int result) { return result == IDYES; } +// static bool isNo(int result) { return result == IDNO; } +// }; + + // --- FileDialog --- + class FileDialog : public FileDialogBase + { + Gtk::Window* _owner; + + const char* _initialDir; + const char* _caption; + + const char** _filter; + int _filterCounter; +// +// OPENFILENAME _struct; +// wchar_t _fileName[MAX_PATH * 8]; // ?? +// int _defaultFlags; +// + public: +// static const wchar_t* ProjectFilter; +// static const wchar_t* SourceFilter; + + bool openFile(PathString& path) override; + bool openFiles(List& files) override; + bool saveFile(path_t ext, PathString& path) override; + + FileDialog(Gtk::Window* owner, const char** filter, int filterCounter, const char* caption, + const char* initialDir = nullptr); + }; +// +// class MessageDialog : public MessageDialogBase +// { +// WindowBase* _owner; +// +// public: +// Answer question(text_str message, text_str param) override; +// Answer question(text_str message) override; +// +// void info(text_str message) override; +// +// MessageDialog(WindowBase* owner) +// { +// _owner = owner; +// } +// }; +// +// class WinDialog +// { +// protected: +// HINSTANCE _instance; +// HWND _handle; +// +// WindowBase* _owner; +// int _dialogId; +// +// virtual void onCreate() = 0; +// virtual void onOK() = 0; +// +// virtual void doCommand(int id, int command); +// +// void enable(int id, bool enabled); +// +// void addComboBoxItem(int id, const wchar_t* text); +// void setComboBoxIndex(int id, int index); +// int getComboBoxIndex(int id); +// void clearComboBoxItem(int id); +// +// void addListItem(int id, const wchar_t* text); +// int getListSelCount(int id); +// int getListIndex(int id); +// +// void setText(int id, const wchar_t* text); +// void setIntText(int id, int value); +// void getText(int id, wchar_t** text, int length); +// int getIntText(int id); +// void setTextLimit(int id, int maxLength); +// +// void setCheckState(int id, bool value); +// void setUndefinedCheckState(int id); +// bool getCheckState(int id); +// bool isUndefined(int id); +// +// public: +// static BOOL CALLBACK DialogProc(HWND hwnd, size_t message, WPARAM wParam, LPARAM lParam); +// +// int show(); +// +// WinDialog(HINSTANCE instance, WindowBase* owner, int dialogId) +// : _handle(nullptr) +// { +// _instance = instance; +// _owner = owner; +// _dialogId = dialogId; +// } +// }; +// +// class ProjectSettings : public WinDialog, public ProjectSettingsBase +// { +// ProjectModel* _model; +// +// void loadTemplateList(); +// void loadProfileList(); +// +// void onCreate() override; +// void onOK() override; +// +// public: +// bool showModal() override; +// +// ProjectSettings(HINSTANCE instance, WindowBase* owner, ProjectModel* model); +// }; +// +// class EditorSettings : public WinDialog, public EditorSettingsBase +// { +// TextViewModelBase* _model; +// +// void onCreate() override; +// void onOK() override; +// +// public: +// bool showModal() override; +// +// EditorSettings(HINSTANCE instance, WindowBase* owner, TextViewModelBase* model); +// }; +// +// class IDESettings : public WinDialog, public IDESettingsBase +// { +// IDEModel* _model; +// +// void onCreate() override; +// void onOK() override; +// +// public: +// bool showModal() override; +// +// IDESettings(HINSTANCE instance, WindowBase* owner, IDEModel* model); +// }; +// +// class DebuggerSettings : public WinDialog, public DebuggerSettingsBase +// { +// ProjectModel* _model; +// +// void onCreate() override; +// void onOK() override; +// +// public: +// bool showModal() override; +// +// DebuggerSettings(HINSTANCE instance, WindowBase* owner, ProjectModel* model); +// }; +// +// class FindDialog : public WinDialog, public FindDialogBase +// { +// FindModel* _model; +// bool _replaceMode; +// +// void copyHistory(int id, SearchHistory* history); +// +// void onCreate() override; +// void onOK() override; +// +// public: +// bool showModal() override; +// +// FindDialog(HINSTANCE instance, WindowBase* owner, bool replaceMode, FindModel* model); +// }; +// +// // --- GoToLineDialog --- +// +// class GoToLineDialog : public WinDialog, public GotoDialogBase +// { +// int _lineNumber; +// +// void onCreate() override; +// void onOK() override; +// +// public: +// bool showModal(int& row) override; +// +// GoToLineDialog(HINSTANCE instance, WindowBase* owner); +// }; +// +// class WindowListDialog : public WinDialog, public WindowListDialogBase +// { +// TextViewModel* _model; +// int _selectedIndex; +// +// void doCommand(int id, int command) override; +// +// void onListChange(); +// +// int getSelectedWindow(); +// +// public: +// SelectResult selectWindow() override; +// +// void onCreate() override; +// void onOK() override; +// +// WindowListDialog(HINSTANCE instance, WindowBase* owner, TextViewModel* model); +// }; +// +// class AboutDialog : public WinDialog +// { +// public: +// void onCreate() override; +// void onOK() override; +// +// AboutDialog(HINSTANCE instance, WindowBase* owner); +// }; + +} + +#endif diff --git a/elenasrc3/ide/gtklinux/gtkide.cpp b/elenasrc3/ide/gtklinux/gtkide.cpp index a8f3cd30fb..ff227e747d 100644 --- a/elenasrc3/ide/gtklinux/gtkide.cpp +++ b/elenasrc3/ide/gtklinux/gtkide.cpp @@ -1,14 +1,14 @@ //--------------------------------------------------------------------------- // E L E N A P r o j e c t: ELENA IDE // Linux-GTK+ GTK IDE -// (C)2024, by Aleksey Rakov +// (C)2024-2025, by Aleksey Rakov //--------------------------------------------------------------------------- #include "gtklinux/gtkide.h" +#include "eng/messages.h" using namespace elena_lang; - static Glib::ustring ui_info = "" " " @@ -126,9 +126,18 @@ static Glib::ustring ui_info = // " " ""; +const char* SOURCE_FILE_FILTER[] = +{ + "*.l", + "ELENA source file", + "*", + "Any files" +}; + // --- GTKIDEWindow --- GTKIDEWindow :: GTKIDEWindow(IDEController* controller, IDEModel* model) + : fileDialog(this, SOURCE_FILE_FILTER, 4, OPEN_FILE_CAPTION, *model->projectModel.paths.lastPath) { _model = model; _controller = controller; @@ -228,3 +237,31 @@ void GTKIDEWindow :: populateMenu() loadUI(ui_info, "/MenuBar"); } + +void GTKIDEWindow :: on_text_model_change(TextViewModelEvent event) +{ +// if (test(rec->status, STATUS_COLORSCHEME_CHANGED)) { +// onColorSchemeChange(); +// } +// + onDocumentUpdate(event.changeStatus); + onIDEStatusChange(event.status); +// if (test(rec->status, STATUS_FRAME_CHANGED)) { +// onDocumentSelection(); +// } +} + +void GTKIDEWindow :: onDocumentUpdate(DocumentChangeStatus changeStatus) +{ +} + +void GTKIDEWindow :: onIDEStatusChange(int status) +{ + //if (test(rec->status, STATUS_FRAME_VISIBILITY_CHANGED)) { + // if (_model->sourceViewModel.isAssigned()) { + //_children[_model->ideScheme.textFrameId]->show(); + //_children[_model->ideScheme.textFrameId]->setFocus(); + // } + //else _children[_model->ideScheme.textFrameId]->hide(); + //} +} diff --git a/elenasrc3/ide/gtklinux/gtkide.h b/elenasrc3/ide/gtklinux/gtkide.h index f379386652..b80752a095 100644 --- a/elenasrc3/ide/gtklinux/gtkide.h +++ b/elenasrc3/ide/gtklinux/gtkide.h @@ -1,18 +1,19 @@ //--------------------------------------------------------------------------- // E L E N A P r o j e c t: ELENA Linux-GTK IDE // -// (C)2024, by Aleksey Rakov +// (C)2024-2025, by Aleksey Rakov //--------------------------------------------------------------------------- #ifndef GTKIDE_H #define GTKIDE_H #include "gtklinux/gtksdi.h" +#include "gtklinux/gtkdialogs.h" #include "idecontroller.h" - namespace elena_lang { + // --- GTKIDEView --- class GTKIDEWindow : public SDIWindow @@ -21,6 +22,8 @@ class GTKIDEWindow : public SDIWindow IDEModel* _model; IDEController* _controller; + FileDialog fileDialog; + void populateMenu(); // event signals @@ -34,7 +37,9 @@ class GTKIDEWindow : public SDIWindow } void on_menu_file_open_source() { - //_controller->doOpenFile(); + _controller->doOpenFile(fileDialog, _model); + //_recentFileList.reload(); + //_recentProjectList.reload(); } void on_menu_file_open_project() { @@ -262,7 +267,12 @@ class GTKIDEWindow : public SDIWindow { } + void onDocumentUpdate(DocumentChangeStatus changeStatus); + void onIDEStatusChange(int status); + public: + void on_text_model_change(TextViewModelEvent event); + GTKIDEWindow(/*const char* caption, */IDEController* controller, IDEModel* model); }; diff --git a/elenasrc3/ide/gtklinux/gtkidetextview.cpp b/elenasrc3/ide/gtklinux/gtkidetextview.cpp new file mode 100644 index 0000000000..c566964dd6 --- /dev/null +++ b/elenasrc3/ide/gtklinux/gtkidetextview.cpp @@ -0,0 +1,37 @@ +//--------------------------------------------------------------------------- +// E L E N A P r o j e c t: ELENA IDE +// Linux TextView container implementation +// (C)2025, by Aleksey Rakov +//--------------------------------------------------------------------------- + +#include "gtklinux/gtkidetextview.h" + +using namespace elena_lang; + +// --- IDETextViewFrame --- + +IDETextViewFrame :: IDETextViewFrame(TextViewModel* model, TextViewControllerBase* controller, ViewStyles* styles) + : TextViewFrame(model, controller, styles) +{ + +} + +void IDETextViewFrame :: on_text_model_change(TextViewModelEvent event) +{ + auto client = getCurrentTextView(); + if (client) + client->onDocumentUpdate(event.changeStatus); + + if (test(event.status, STATUS_FRAME_VISIBILITY_CHANGED)) { + if (client) + client->grab_focus(); + + //grab_focus(); + } + // if (_model->sourceViewModel.isAssigned()) { + //_children[_model->ideScheme.textFrameId]->show(); + //_children[_model->ideScheme.textFrameId]->setFocus(); + // } + //else _children[_model->ideScheme.textFrameId]->hide(); + //} +} diff --git a/elenasrc3/ide/gtklinux/gtkidetextview.h b/elenasrc3/ide/gtklinux/gtkidetextview.h new file mode 100644 index 0000000000..9461f0af98 --- /dev/null +++ b/elenasrc3/ide/gtklinux/gtkidetextview.h @@ -0,0 +1,26 @@ +//--------------------------------------------------------------------------- +// E L E N A P r o j e c t: ELENA IDE +// Linux TextView container declaration +// (C)2025, by Aleksey Rakov +//--------------------------------------------------------------------------- + +#ifndef GTKIDETEXTFRAME_H +#define GTKIDETEXTFRAME_H + +#include "gtklinux/gtktextframe.h" +#include "idecommon.h" + +namespace elena_lang +{ + +class IDETextViewFrame : public TextViewFrame +{ +public: + void on_text_model_change(TextViewModelEvent event); + + IDETextViewFrame(TextViewModel* model, TextViewControllerBase* controller, ViewStyles* styles); +}; + +} // _GUI_ + +#endif // winideH diff --git a/elenasrc3/ide/gtklinux/textframe.cpp b/elenasrc3/ide/gtklinux/textframe.cpp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/elenasrc3/ide/ideversion.h b/elenasrc3/ide/ideversion.h index 483f561f32..62ed0a82af 100644 --- a/elenasrc3/ide/ideversion.h +++ b/elenasrc3/ide/ideversion.h @@ -1,2 +1,2 @@ -#define IDE_REVISION_NUMBER 19 +#define IDE_REVISION_NUMBER 21 diff --git a/elenasrc3/tools/asmc/armassembler.cpp b/elenasrc3/tools/asmc/armassembler.cpp index 5ea51e5b05..f71134ff6b 100644 --- a/elenasrc3/tools/asmc/armassembler.cpp +++ b/elenasrc3/tools/asmc/armassembler.cpp @@ -3,7 +3,7 @@ // // This file contains AARCH64 Assembler implementation // -// (C)2021-2023, by Aleksey Rakov +// (C)2021-2025, by Aleksey Rakov //--------------------------------------------------------------------------- #include "elena.h" @@ -1148,6 +1148,12 @@ bool Arm64Assembler :: compileLDR(ScriptToken& tokenInfo, ARMOperand rt, ARMOper else if (rt.isDR() && ptr.isPostindex()) { writer.writeDWord(ARMHelper::makeImm9Opcode(3, 7, 1, 0, 1, 0, ptr.imm, 1, ptr.type, rt.type)); } + else if (rt.isDR() && ptr.isPreindex()) { + writer.writeDWord(ARMHelper::makeImm9Opcode(3, 7, 1, 0, 1, 0, ptr.imm, 3, ptr.type, rt.type)); + } + else if (rt.isDR() && ptr.isUnsigned()) { + writer.writeDWord(ARMHelper::makeImm12Opcode(3, 7, 1, 1, 1, ptr.imm >> 3, ptr.type, rt.type)); + } else return false; return true; @@ -1203,7 +1209,7 @@ bool Arm64Assembler :: compileLDRSW(ScriptToken& tokenInfo, ARMOperand rt, ARMOp writeReference(tokenInfo, ptr.reference, writer, ASM_INVALID_SOURCE); } else if (rt.isXR() && ptr.isUnsigned()) { - writer.writeDWord(ARMHelper::makeImm12Opcode(2, 7, 0, 1, 2, ptr.imm >> 3, ptr.type, rt.type)); + writer.writeDWord(ARMHelper::makeImm12Opcode(2, 7, 0, 1, 2, ptr.imm >> 2, ptr.type, rt.type)); } else return false; @@ -1448,6 +1454,9 @@ bool Arm64Assembler :: compileSTR(ScriptToken& tokenInfo, ARMOperand rt, ARMOper if (ptr.reference) writeReference(tokenInfo, ptr.reference, writer, ASM_INVALID_SOURCE); } + else if (rt.isWR() && ptr.isUnsigned()) { + writer.writeDWord(ARMHelper::makeImm12Opcode(2, 7, 0, 1, 0, ptr.imm >> 2, ptr.type, rt.type)); + } else if (rt.isXR() && ptr.isPostindex()) { writer.writeDWord(ARMHelper::makeImm9Opcode(3, 7, 0, 0, 0, 0, ptr.imm, 1, ptr.type, rt.type)); } @@ -1460,6 +1469,9 @@ bool Arm64Assembler :: compileSTR(ScriptToken& tokenInfo, ARMOperand rt, ARMOper else if (rt.isDR() && ptr.isPostindex()) { writer.writeDWord(ARMHelper::makeImm9Opcode(3, 7, 1, 0, 0, 0, ptr.imm, 1, ptr.type, rt.type)); } + else if (rt.isDR() && ptr.isUnsigned()) { + writer.writeDWord(ARMHelper::makeImm12Opcode(3, 7, 1, 1, 0, ptr.imm >> 3, ptr.type, rt.type)); + } else return false; return true; @@ -2937,6 +2949,20 @@ void Arm64Assembler::compileDQField(ScriptToken& tokenInfo, MemoryWriter& writer else writer.writeQWord(d); } +void Arm64Assembler :: compileDoubleField(ScriptToken& tokenInfo, MemoryWriter& writer) +{ + read(tokenInfo); + + if (tokenInfo.state == dfaQuote) { + double val = StrConvertor::toDouble(*tokenInfo.token); + + writer.writeDouble(val); + + read(tokenInfo); + } + else throw SyntaxError(ASM_INVALID_COMMAND, tokenInfo.lineInfo); +} + void Arm64Assembler :: compileProcedure(ScriptToken& tokenInfo) { ARMLabelHelper helper; diff --git a/elenasrc3/tools/asmc/armassembler.h b/elenasrc3/tools/asmc/armassembler.h index 5391ef075a..442d59f5b6 100644 --- a/elenasrc3/tools/asmc/armassembler.h +++ b/elenasrc3/tools/asmc/armassembler.h @@ -3,7 +3,7 @@ // // This header contains AARCH64 Assembler declarations // -// (C)2021-2022, by Aleksey Rakov +// (C)2021-2025, by Aleksey Rakov //--------------------------------------------------------------------------- #ifndef ARMASSEMBLER_H @@ -185,6 +185,7 @@ namespace elena_lang void compileDWField(ScriptToken& tokenInfo, MemoryWriter& writer) override; void compileDDField(ScriptToken& tokenInfo, MemoryWriter& writer) override; void compileDQField(ScriptToken& tokenInfo, MemoryWriter& writer) override; + void compileDoubleField(ScriptToken& tokenInfo, MemoryWriter& writer) override; void compileProcedure(ScriptToken& tokenInfo) override; diff --git a/elenasrc3/tools/asmc/asmconst.h b/elenasrc3/tools/asmc/asmconst.h index b15c9eb01f..a1545d57d6 100644 --- a/elenasrc3/tools/asmc/asmconst.h +++ b/elenasrc3/tools/asmc/asmconst.h @@ -12,7 +12,7 @@ namespace elena_lang { - #define ASM_REVISION_NUMBER 0x0008 + #define ASM_REVISION_NUMBER 0x000B constexpr auto N_ARGUMENT1 = "__n_1"; constexpr auto N_ARGUMENT2 = "__n_2"; diff --git a/elenasrc3/tools/asmc/assembler.cpp b/elenasrc3/tools/asmc/assembler.cpp index c40f8d2b6a..0f830b1248 100644 --- a/elenasrc3/tools/asmc/assembler.cpp +++ b/elenasrc3/tools/asmc/assembler.cpp @@ -3,7 +3,7 @@ // // This file contains the implementation of ELENA Assembler // classes. -// (C)2021-2023, by Aleksey Rakov +// (C)2021-2025, by Aleksey Rakov //--------------------------------------------------------------------------- #include "elena.h" @@ -431,6 +431,9 @@ void AssemblerBase :: compileStructure(ScriptToken& tokenInfo) else if (tokenInfo.compare("dq")) { compileDQField(tokenInfo, writer); } + else if (tokenInfo.compare("dbl")) { + compileDoubleField(tokenInfo, writer); + } else throw SyntaxError(ASM_SYNTAXERROR, tokenInfo.lineInfo); } } diff --git a/elenasrc3/tools/asmc/assembler.h b/elenasrc3/tools/asmc/assembler.h index 98c278afa4..a48f03a523 100644 --- a/elenasrc3/tools/asmc/assembler.h +++ b/elenasrc3/tools/asmc/assembler.h @@ -3,7 +3,7 @@ // // This header contains abstract Assembler declarations // -// (C)2021-2023, by Aleksey Rakov +// (C)2021-2025, by Aleksey Rakov //--------------------------------------------------------------------------- #ifndef ASSEMBLER_H @@ -148,6 +148,7 @@ namespace elena_lang virtual void compileDWField(ScriptToken& tokenInfo, MemoryWriter& writer) = 0; virtual void compileDDField(ScriptToken& tokenInfo, MemoryWriter& writer) = 0; virtual void compileDQField(ScriptToken& tokenInfo, MemoryWriter& writer) = 0; + virtual void compileDoubleField(ScriptToken& tokenInfo, MemoryWriter& writer) = 0; virtual void compileProcedure(ScriptToken& tokenInfo) = 0; diff --git a/elenasrc3/tools/asmc/ppc64assembler.cpp b/elenasrc3/tools/asmc/ppc64assembler.cpp index 97c92e9bac..1c977a15fb 100644 --- a/elenasrc3/tools/asmc/ppc64assembler.cpp +++ b/elenasrc3/tools/asmc/ppc64assembler.cpp @@ -3,7 +3,7 @@ // // This file contains PPC64 Assembler implementation // -// (C)2021-2022, by Aleksey Rakov +// (C)2021-2025, by Aleksey Rakov //--------------------------------------------------------------------------- #include "elena.h" @@ -1923,6 +1923,20 @@ void PPC64Assembler::compileDQField(ScriptToken& tokenInfo, MemoryWriter& writer else writer.writeQWord(d); } +void PPC64Assembler::compileDoubleField(ScriptToken& tokenInfo, MemoryWriter& writer) +{ + read(tokenInfo); + + if (tokenInfo.state == dfaQuote) { + double val = StrConvertor::toDouble(*tokenInfo.token); + + writer.writeDouble(val); + + read(tokenInfo); + } + else throw SyntaxError(ASM_INVALID_COMMAND, tokenInfo.lineInfo); +} + bool PPC64Assembler :: compileAOpCode(ScriptToken& tokenInfo, MemoryWriter& writer) { if (tokenInfo.compare("addi")) { diff --git a/elenasrc3/tools/asmc/ppc64assembler.h b/elenasrc3/tools/asmc/ppc64assembler.h index b0a57254ee..52c864e1c1 100644 --- a/elenasrc3/tools/asmc/ppc64assembler.h +++ b/elenasrc3/tools/asmc/ppc64assembler.h @@ -3,7 +3,7 @@ // // This header contains PPC64 Assembler declarations // -// (C)2021-2022, by Aleksey Rakov +// (C)2021-2025, by Aleksey Rakov //--------------------------------------------------------------------------- #ifndef PPC64ASSEMBLER_H @@ -148,6 +148,7 @@ namespace elena_lang void compileDWField(ScriptToken& tokenInfo, MemoryWriter& writer) override; void compileDDField(ScriptToken& tokenInfo, MemoryWriter& writer) override; void compileDQField(ScriptToken& tokenInfo, MemoryWriter& writer) override; + void compileDoubleField(ScriptToken& tokenInfo, MemoryWriter& writer) override; bool compileAOpCode(ScriptToken& tokenInfo, MemoryWriter& writer) override; bool compileBOpCode(ScriptToken& tokenInfo, MemoryWriter& writer, LabelScope& labelScope) override; diff --git a/elenasrc3/tools/asmc/x86assembler.cpp b/elenasrc3/tools/asmc/x86assembler.cpp index 4fbde60660..77874b3469 100644 --- a/elenasrc3/tools/asmc/x86assembler.cpp +++ b/elenasrc3/tools/asmc/x86assembler.cpp @@ -3,7 +3,7 @@ // // This file contains the implementation of ELENA Intel X86 Assembler // classes. -// (C)2021-2024, by Aleksey Rakov +// (C)2021-2025, by Aleksey Rakov //--------------------------------------------------------------------------- #include "elena.h" @@ -1460,6 +1460,11 @@ void X86Assembler :: compileDQField(ScriptToken& tokenInfo, MemoryWriter& writer else throw SyntaxError(ASM_INVALID_COMMAND, tokenInfo.lineInfo); } +void X86Assembler :: compileDoubleField(ScriptToken& tokenInfo, MemoryWriter& writer) +{ + throw SyntaxError(ASM_INVALID_COMMAND, tokenInfo.lineInfo); +} + bool X86Assembler :: compileAdc(X86Operand source, X86Operand target, MemoryWriter& writer) { if (source.type == X86OperandType::EAX && target.type == X86OperandType::DD) { diff --git a/elenasrc3/tools/asmc/x86assembler.h b/elenasrc3/tools/asmc/x86assembler.h index b9ff795c1b..4552ab53f8 100644 --- a/elenasrc3/tools/asmc/x86assembler.h +++ b/elenasrc3/tools/asmc/x86assembler.h @@ -3,7 +3,7 @@ // // This header contains x86 and x86-64 Assembler declarations // -// (C)2021-2024, by Aleksey Rakov +// (C)2021-2025, by Aleksey Rakov //--------------------------------------------------------------------------- #ifndef X86ASSEMBLER_H @@ -207,6 +207,7 @@ namespace elena_lang void compileDWField(ScriptToken& tokenInfo, MemoryWriter& writer) override; void compileDDField(ScriptToken& tokenInfo, MemoryWriter& writer) override; void compileDQField(ScriptToken& tokenInfo, MemoryWriter& writer) override; + void compileDoubleField(ScriptToken& tokenInfo, MemoryWriter& writer) override; bool compileAOpCode(ScriptToken& tokenInfo, MemoryWriter& writer) override; bool compileBOpCode(ScriptToken& tokenInfo, MemoryWriter& writer, LabelScope& labelScope) override; diff --git a/examples60/gui/helloworld/helloworld.xs b/examples60/gui/helloworld/helloworld.xs index dd4ae1a801..ddd4a8d5d8 100644 --- a/examples60/gui/helloworld/helloworld.xs +++ b/examples60/gui/helloworld/helloworld.xs @@ -1,6 +1,6 @@
-
\ No newline at end of file diff --git a/recompile60.mac.sh b/recompile60.mac.sh new file mode 100644 index 0000000000..a9bf588e2f --- /dev/null +++ b/recompile60.mac.sh @@ -0,0 +1 @@ +#!/bin/bash diff --git a/src60/core/system.core_routines.esm b/src60/core/system.core_routines.esm index 8f663844d1..b2dcfe48e9 100644 --- a/src60/core/system.core_routines.esm +++ b/src60/core/system.core_routines.esm @@ -1181,6 +1181,17 @@ procedure __readIntPtrVal end +procedure __readPtrVal + + peek sp:0 + get i:0 + load + peek sp:1 + save + peek sp:0 + +end + procedure __readRealPtrVal peek sp:0 @@ -1192,6 +1203,17 @@ procedure __readRealPtrVal end +procedure __readLongPtrVal + + peek sp:0 + get i:0 + lload + peek sp:1 + lsave + peek sp:0 + +end + procedure __clearPtr(self) xflush sp:0 diff --git a/src60/elena_api.linux.prjcol b/src60/elena_api.linux.prjcol new file mode 100644 index 0000000000..7a185cdea8 --- /dev/null +++ b/src60/elena_api.linux.prjcol @@ -0,0 +1,7 @@ + + + system/system.linux.prj + extensions/extensions.linux.prj + ltests/ltests.linux.prj + + \ No newline at end of file diff --git a/src60/extensions/extensions.project b/src60/extensions/extensions.linux.prj similarity index 100% rename from src60/extensions/extensions.project rename to src60/extensions/extensions.linux.prj diff --git a/src60/forms/forms.prj b/src60/forms/forms.prj index 10747cc76e..9160cf818a 100644 --- a/src60/forms/forms.prj +++ b/src60/forms/forms.prj @@ -17,7 +17,7 @@ ELENA GUI Library - 6.5.0 + 6.6.0 Aleksey Rakov diff --git a/src60/forms/win32_controls.l b/src60/forms/win32_controls.l index 15cd840101..abdb73616b 100644 --- a/src60/forms/win32_controls.l +++ b/src60/forms/win32_controls.l @@ -316,7 +316,6 @@ abstract class BaseEdit : BaseWinControl retVal := styles } - } // --- Edit --- @@ -476,6 +475,66 @@ public closed class RadioButton : BaseButton, interface } } +// --- BaseList --- + +abstract class BaseList : BaseWinControl +{ + List _items; + + protected constructor new() + <= super new() + { + _items := new List(); + } + + internal updateStyles(ref int retVal) + { + int styles := retVal; + + if(_visible) + { styles := styles | WS_VISIBLE }; + if(_tabStop) + { styles := styles | WS_TABSTOP }; + + retVal := styles + } + + appendItem(string s) + { + _items.append(s); + } +} + +// --- Combobox --- + +public sealed class Combobox : BaseList, interface +{ + constructor new() + <= super new() + { + } + + internal createHandle() + { + WindowHandle parent := _parent; + + int styles := WS_CHILD | CBS_DROPDOWNLIST; + self.updateStyles(ref styles); + + _region.read(out int x, out int y, out int width, out int height); + + _handle := new WindowHandle( + 0, + ComboboxClass, + WideString.MinValue, + styles, + x, y, width, height, + parent, + CurrentInstance, + UnsafePointer.Default) + } +} + // --- Paintbox --- class PaintboxListener : WindowCallback @@ -879,9 +938,14 @@ public sealed class RadioButtonGroup : BasePanel, interface parent, CurrentInstance, paramPtr); - - if(_selected != -1 && nil != onIndexChanged) - { onIndexChanged(self) } + + if (_selected != -1) { + setChecked(true); + + if(nil != onIndexChanged) + { onIndexChanged(self) } + } + } int SelectedIndex diff --git a/src60/ltests/ltests.project b/src60/ltests/ltests.linux.prj similarity index 100% rename from src60/ltests/ltests.project rename to src60/ltests/ltests.linux.prj diff --git a/src60/net/http/common.l b/src60/net/http/common.l index 05bedec2e1..f359e0672d 100644 --- a/src60/net/http/common.l +++ b/src60/net/http/common.l @@ -1,4 +1,5 @@ import system'text'parsing; +import system'net; internal static RegEx UrlRegEx = new RegEx("^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]((\.|-+)?[0-9a-zA-Z])*(:(0-9)*)?(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_=]*)?$"); @@ -6,6 +7,7 @@ public sealed class Uri { string _scheme; string _host; + string _ip; string _port; string _path; string _query; @@ -21,9 +23,21 @@ public sealed class Uri get string Host() = _host; - get string Port() + get string IP() + = _query; + + get string PortValue() = _port ?? String.MinValue; + get short Port() + { + if:not:nil(_port) { + ^ ShortConvertor.convert(_port, 10); + }; + + ^ 0; + } + get string Path() = _path ?? String.MinValue; @@ -72,6 +86,9 @@ public sealed class Uri _query := url.Substring(index, len - index); }; + hostent h := hostent.load(_host); + _ip := h.IP; + ^ true; } diff --git a/src60/net/http/httpclient.l b/src60/net/http/httpclient.l index e69de29bb2..55c414aced 100644 --- a/src60/net/http/httpclient.l +++ b/src60/net/http/httpclient.l @@ -0,0 +1,44 @@ +import system'net; +import system'threading; + +public class HttpClient +{ + HttpHeaders _headers; + Socket _socket; + + constructor new() + { + _headers := new HttpHeaders(); + } + + HttpHeaders Headers + = _headers; + + async Task getAsync(Uri uri) + { + /* Create TCP socket */ + _socket := new Socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + + /* Set remote->sin_addr.s_addr */ + SOCKADDR_IN remote := default; + + remote.Ip_address := uri.IP; + remote.Port := uri.Port; + + /* Connect */ + _socket.open(remote); + + /* Send headers to server */ + NetworkStream stream := new NetworkStream(_socket); + + :await stream.writeAsync(_headers.Value); + + ^ HttpResponse.assign(stream); + + } + + close() + { + _socket.close() + } +} \ No newline at end of file diff --git a/src60/net/http/httpheaders.l b/src60/net/http/httpheaders.l new file mode 100644 index 0000000000..d8869a0730 --- /dev/null +++ b/src60/net/http/httpheaders.l @@ -0,0 +1,23 @@ +import system'text; + +public class HttpHeaders +{ + StringBuilder content; + + constructor() + { + content := new StringBuilder(); + } + + add(string name, string content) + { + content + .append(name) + .append(":") + .append(content) + .append($13$10); + } + + get string Value() + => content; +} \ No newline at end of file diff --git a/src60/net/http/httpresponse.l b/src60/net/http/httpresponse.l new file mode 100644 index 0000000000..ee530ab9c2 --- /dev/null +++ b/src60/net/http/httpresponse.l @@ -0,0 +1,17 @@ +import system'net; +import system'threading; + +public class HttpResponse +{ + NetworkStream _stream; + + internal constructor assign(NetworkStream stream) + { + _stream := stream + } + + async Task ReadAsStringAsync() + { + + } +} \ No newline at end of file diff --git a/src60/net/net.prj b/src60/net/net.prj index 857cb9d639..62bed2577b 100644 --- a/src60/net/net.prj +++ b/src60/net/net.prj @@ -15,7 +15,7 @@ ELENA Network Provider Library - 6.5.0 + 6.6.0 Aleksey Rakov @@ -26,6 +26,8 @@ http\common.l + http\httpheaders.l + http\httpresponse.l http\httpclient.l diff --git a/src60/system/io/lnx_files.l b/src60/system/io/lnx_files.l index 8a7df41948..9687cfe8a7 100644 --- a/src60/system/io/lnx_files.l +++ b/src60/system/io/lnx_files.l @@ -2,6 +2,8 @@ import system'text; namespace io { + const int F_OK = 0; + const int SEEK_SET = 0; const int SEEK_CUR = 1; const int SEEK_END = 2; @@ -102,9 +104,39 @@ namespace io singleton fileControl { TextReader newReader(path) = TextStreamReader.new(path); + + TextWriter writer(path) = StreamWriter.new(FileStream.openForReWrite(path), UTF8Encoder); + + TextWriter writer(string path, Encoder encoder) = StreamWriter.new(FileStream.openForReWrite(path), encoder); + + TextWriter logger(path) = StreamWriter.new(FileStream.openForAppend(path), UTF8Encoder); + + bool isAvailable(path) + { + int ret := extern libc.access(path as::String, F_OK); + + ^ ret == 0 + } + + bool delete(path) + { + int ret := extern libc.remove(path as::String); + + ^ ret == 0 + } } singleton directoryControl { + bool isAvailable(path) + { + string s := path as::String; + if:not(s.endingWith("/")) + s := s + "/"; + + int ret := extern libc.access(s, F_OK); + + ^ ret == 0 + } } } \ No newline at end of file diff --git a/src60/system/net/networkstream.l b/src60/system/net/networkstream.l index 4dcba21987..8ba1fc3bcc 100644 --- a/src60/system/net/networkstream.l +++ b/src60/system/net/networkstream.l @@ -1,5 +1,6 @@ import system; import system'io; +import system'text; import system'threading; public class NetworkStream : Stream @@ -47,20 +48,57 @@ public class NetworkStream : Stream int read(byte[] dump, int length) = _socket.receive(dump, length, 0); - write(byte[] dump, int length) + int write(byte[] dump, int length) { - _socket.send(dump, length, 0); + int retVal := _socket.send(dump, length, 0); + + ^ retVal } indexed internal Task readAsync(byte[] dump, int length) = _socket.receiveAsync(dump, length, 0); - indexed internal Task writeAsync(byte[] dump, int length) + indexed internal Task writeAsync(byte[] dump, int length) = _socket.sendAsync(dump, length, 0); indexed internal bool isDataAvailable = _socket.available() != 0; + indexed async internal Task writeAsync(string s) + { + byte tmp[1024]; + int len := s.Length; + int index := 0; + while (len > 0) { + int sublen := 1024; + if (len < sublen) { + sublen := len; + }; + + int converted := UTF8Encoder.toByteArray(s, index, ref sublen, tmp, 0, 1024); + + converted := :await self.writeAsync(tmp, converted); + + index += converted; + len -= converted; + }; + } + + indexed async internal Task readAsStringAsync() + { + MemoryBuffer buffer := MemoryBuffer.allocate(); + + byte tmp[1024]; + int read := :await self.readAsync(tmp, 1024); + while (read > 0) { + buffer.write(0, read, tmp); + + read := :await self.readAsync(tmp, 1024); + }; + + ^ UTF8Encoding.toString(0, buffer.Length, buffer.Value); + } + close() { if (_ownStream) @@ -76,9 +114,50 @@ public extension AsyncStreamExtension : NetworkStream Task readAsync(byte[] dump, int length) = self.readAsync(dump, length); - Task writeAsync(byte[] dump, int length) + Task writeAsync(byte[] dump, int length) = self.writeAsync(dump, length); + Task writeAsync(string s) + = self.writeAsync(s); + + Task readAsStringAsync() + = self.readAsStringAsync(); + +// async Task writeAsync(string s) +// { +// byte tmp[1024]; +// int len := s.Length; +// int index := 0; +// while (len > 0) { +// int sublen := 1024; +// if (len < sublen) { +// sublen := len; +// }; +// +// int converted := UTF8Encoder.toByteArray(s, index, ref sublen, tmp, 0, 1024); +// +// converted := :await self.writeAsync(tmp, converted); +// +// index += converted; +// len -= converted; +// }; +// } + +// async Task readAsStringAsync() +// { +// MemoryBuffer buffer := MemoryBuffer.allocate(); +// +// byte tmp[1024]; +// int read := :await self.readAsync(tmp, 1024); +// while (read > 0) { +// buffer.write(0, read, tmp); +// +// read := :await self.readAsync(tmp, 1024); +// }; +// +// ^ UTF8Encoding.toString(0, buffer.Length, buffer.Value); +// } + bool isDataAvailable = self.isDataAvailable; } diff --git a/src60/system/net/win_sockets.l b/src60/system/net/win_sockets.l index 2fe003ed28..76986fea53 100644 --- a/src60/system/net/win_sockets.l +++ b/src60/system/net/win_sockets.l @@ -79,23 +79,93 @@ public sealed struct IN_ADDR } } +// --- hostent --- +public sealed struct hostent +{ + pointer h_name; + pointer h_aliases; + short h_addrtype; + short h_length; + pointer h_addr_list; + + static hostent load(string host) + { + hostent tmp := default; + + pointer ptr := extern WS2_32.gethostbyname(host); + + ptr.copyToUnsafe(tmp, $size tmp); + + ^ tmp + } + + get string IP() + { + if (h_addrtype == AF_INET) { + pointer addr := h_addr_list.Value; + pointer paddr_in := addr.Value; + + IN_ADDR addr_in := default; + addr_in.Value := paddr_in.getLongValue(); + + pointer pip := extern WS2_32.inet_ntoa(addr_in); + + ^ pip.getStringUnsafe(); + } + else { + SocketException.new("gethostbyname failed").raise() + }; + + ^ nil; + } +} + // --- SOCKADDR_IN --- public sealed packed SOCKADDR_IN { - short family : prop; - short port : prop; + short family; + short port; IN_ADDR sin_addr; byte sin_zero[4]; get constructor Default() = default; - set ip_address(string ip) + short Family { - long addr := extern WS2_32.inet_addr(ip); - - sin_addr.Value := addr + get() { ^ family } + + set(val) + { + family := val + } + } + + set Ip_address(string ip) + { + family := AF_INET; + + int retVal := extern WS2_32.inet_pton(AF_INET, ip, sin_addr); + + if (retVal < 0) { + SocketException.new("Can't set remote->sin_addr.s_addr", retVal).raise(); + } + else if (retVal == 0) { + SocketException.new("Not a valid IP", retVal).raise(); + } + } + + set Port(short value) + { + port := extern WS2_32.htons(value); + } + + get short Port() + { + short val := extern WS2_32.ntohs(port); + + ^ val } } @@ -211,6 +281,17 @@ public sealed const struct Socket { SocketException.new("Error at socket").raise() } } + open(SOCKADDR_IN sockAddr) + { + int retVal := extern WS2_32.connect( + _handle, + sockAddr, + $size sockAddr); + + if (SOCKET_ERROR == retVal) + { SocketException.new("Error at socket").raise() } + } + bind(pointer sockAddrPtr, int nameLen) { int retVal := extern WS2_32.bind(_handle, sockAddrPtr, nameLen); @@ -237,9 +318,9 @@ public sealed const struct Socket connect(string ip_address, int port) { SOCKADDR_IN addr := SOCKADDR_IN.Default; - addr.port := port; - addr.family := system'net'AF_INET; - addr.ip_address := ip_address; + addr.Port := port; + addr.Family := system'net'AF_INET; + addr.Ip_address := ip_address; pointer ptr := addr; int retVal := extern WS2_32.connect(_handle, ptr, SOCKADDR_IN_SIZE); diff --git a/src60/system/pointers.l b/src60/system/pointers.l index 98e89a10b0..686d624827 100644 --- a/src60/system/pointers.l +++ b/src60/system/pointers.l @@ -40,8 +40,10 @@ public sealed const struct UnsafePointer private clear() : external(system'core_routines'__clearPtr); private readIntPtr(out int retVal) : external(system'core_routines'__readIntPtr); + private readPtrValue(out UnsafePointer retVal) : external(system'core_routines'__readPtrVal); private readIntPtrValue(out int retVal) : external(system'core_routines'__readIntPtrVal); private readRealPtrValue(out real retVal) : external(system'core_routines'__readRealPtrVal); + private readLongPtrValue(out long retVal) : external(system'core_routines'__readLongPtrVal); private assignPtr(object obj) : external(system'core_routines'__assignPtr); constructor() @@ -88,7 +90,14 @@ public sealed const struct UnsafePointer ^ retVal } - get int Value() + get pointer Value() + { + self.readPtrValue(out pointer retVal); + + ^ retVal + } + + get retoverload int Value() { self.readIntPtrValue(out int retVal); @@ -102,6 +111,13 @@ public sealed const struct UnsafePointer ^ retVal } + get retoverload long Value() + { + self.readLongPtrValue(out long retVal); + + ^ retVal + } + get retoverload string Value() { ^ PrimitivePointerOperations.readString(self); @@ -112,6 +128,22 @@ public sealed const struct UnsafePointer ^ PrimitivePointerOperations.readWideString(self); } + long getLongValue() + { + long val := self.Value; + + ^ val; + } + + string getStringUnsafe() + { + string str := self.Value; + + ^ str + } + + copyToUnsafe(object ptr, int length) : external(system'core_routines'__ptrCopyTo); + copyTo(byte[] target, int len) : external(system'core_routines'__ptrCopyTo); copyTo(byte[] target, int index, int len) : external(system'core_routines'__ptrCopySubTo); } diff --git a/src60/system/system.project b/src60/system/system.linux.prj similarity index 95% rename from src60/system/system.project rename to src60/system/system.linux.prj index 7e4d453943..550fad335e 100644 --- a/src60/system/system.project +++ b/src60/system/system.linux.prj @@ -1,7 +1,7 @@ - /usr/lib/elena/lib60 + ../../lib60 @@ -12,7 +12,7 @@ - /usr/lib/elena/lib60_64 + ../../lib60_64 @@ -23,7 +23,7 @@ - /usr/lib/elena/lib60_64 + ../../lib60_64 @@ -34,7 +34,7 @@ - /usr/lib/elena/lib60_64 + ../../lib60_64 @@ -50,7 +50,7 @@ ELENA Standard Library - 6.5.0 + 6.6.0 Aleksey Rakov diff --git a/src60/system/text/parsing/regex.l b/src60/system/text/parsing/regex.l index f67f83a502..4740d58ffe 100644 --- a/src60/system/text/parsing/regex.l +++ b/src60/system/text/parsing/regex.l @@ -244,8 +244,8 @@ public sealed class RegEx private PatternRule? defineRule(char ch) { - ch => - $47: { ^ new AnyRule() }; + ch => + $46: { ^ new AnyRule() }; if (isReserved(ch)) { ^ nil }; @@ -436,7 +436,7 @@ public sealed class RegEx List list := new List(); parseLine(list, pattern, ref i, len, $36); - if (i < len && pattern[i] == $36) { + if (i < len && pattern[i] == $36) { list.append(EOLRule); i++; diff --git a/src60/system/winforms/win_common.l b/src60/system/winforms/win_common.l index 9e1d461af0..a1f69f39c9 100644 --- a/src60/system/winforms/win_common.l +++ b/src60/system/winforms/win_common.l @@ -70,6 +70,10 @@ public const int BS_AUTORADIOBUTTON = 9; public const int BST_CHECKED = 1; public const int BST_UNCHECKED = 0; +// --- combobox styles --- +public const int CBS_DROPDOWNLIST = 3; +public const int CBS_DROPDOWN = 2; + // --- Notifications --- public const int BN_CLICKED = 0000h; public const int EN_CHANGE = 0300h; diff --git a/src60/system/winforms/win_controls.l b/src60/system/winforms/win_controls.l index 8713d2fac6..453d93e600 100644 --- a/src60/system/winforms/win_controls.l +++ b/src60/system/winforms/win_controls.l @@ -5,6 +5,7 @@ import system'drawing; public const wide ButtonClass = "Button"w; public const wide EditClass = "Edit"w; public const wide StaticClass = "Static"w; +public const wide ComboboxClass = "Combobox"w; // --- WindowHandle --- diff --git a/tests60/sandbox/sandbox.l b/tests60/sandbox/sandbox.l index 55a74ffb70..78169e0623 100644 --- a/tests60/sandbox/sandbox.l +++ b/tests60/sandbox/sandbox.l @@ -1,75 +1,11 @@ import extensions; -//import system'math; -// -//public extension lazyOp -//{ -// whileFalse(Func action) -// { -// until(self) -// { -// action() -// } -// } -//} -// -//public program() -//{ -// var n := 1; -// -// (:lazy (n.sqr().mod(100) == 64)).whileFalse({ n := n + 1 }); -// -// console.printLine(n) -//} -//#new __symbol aliases; - -//#let aliases["myint"] := system'IntNumber; - -//#load sandbox'aliases; - -//myint X = 2; -/* -class MyException : Exception -{ - constructor new(s) - <= super new(s); -} -*/ -class MyException2 : Exception +public program() { - constructor new(s) - <= super new(s); -} + real r := 1.0; -singleton ExecTester -{ -/* break() - { - MyException.new("OnError handler works").raise() - } -*/ - break2() - { - MyException2.new("OnError2 handler works").raise() - } -/* - break3() - { - MyException2.new("Nested OnError2 handler works").raise() - }*/ -} + real z := r.exp(); + console.printLine(z); -public program() -{ -/* try - { - ExecTester.break2() - } - catch:: - { - function(MyException2 e) - { - } - };*/ - console.write("."); -} + console.printLine(z.ln()); +} \ No newline at end of file diff --git a/tests60/system_tests/basic.l b/tests60/system_tests/basic.l index 361d5c447f..50ca86802e 100644 --- a/tests60/system_tests/basic.l +++ b/tests60/system_tests/basic.l @@ -1411,20 +1411,24 @@ public duplicateBoxing() : testCase() t := 2; t2 += 1; }); - + console.write("."); + Assert.ifTrue(t == 2); Assert.ifTrue(t2 == 2); + console.write("."); -// var mode := -1; -// var value := false; -// value ? { mode := 0 } : { mode := 1 } ; -// -// Assert.ifTrue(mode == 1); -// -// value := true; -// value ? { mode := 0 } : { mode := 1 } ; -// -// Assert.ifTrue(mode == 0); + var mode := -1; + var value := false; + value ? { mode := 0 } ! { mode := 1 }; + + Assert.ifTrue(mode == 1); + console.write("."); + + mode := -1; + value := true; + value ? { mode := 0 } ! { mode := 1 }; + + Assert.ifTrue(mode == 0); console.write(".") } diff --git a/tests60/system_tests/system_tests.prj b/tests60/system_tests/system_tests.prj index 8c2e75a518..c94bea0737 100644 --- a/tests60/system_tests/system_tests.prj +++ b/tests60/system_tests/system_tests.prj @@ -9,6 +9,26 @@ system_tests64.exe + + + 4129 + + + + + 4130 + + + + + 4133 + + + + + 4132 + + system_tests diff --git a/tests60/system_tests/system_tests.project b/tests60/system_tests/system_tests.project deleted file mode 100644 index ea1cfa66e0..0000000000 --- a/tests60/system_tests/system_tests.project +++ /dev/null @@ -1,32 +0,0 @@ - - - - 4129 - - - - - 4130 - - - - - 4133 - - - - - 4132 - - - - system_tests - - - - - main.l - basic.l - - - \ No newline at end of file From 5ff9d2743e0e8af86f53c8ecd7fc52f7086ab718 Mon Sep 17 00:00:00 2001 From: arakov Date: Sun, 4 May 2025 18:43:22 +0200 Subject: [PATCH 2/2] removing files --- build/aarch64/build_package_arm64.script | 198 ------------- build/aarch64/control | 12 - build/amd64/build_package_amd64.script | 210 -------------- build/amd64/control | 12 - build/create_package_x64.bat | 211 -------------- build/create_package_x86.bat | 313 --------------------- build/i386/build_package_i386.script | 208 -------------- build/i386/control | 12 - build/ppc64le/build_package_ppc64le.script | 198 ------------- build/ppc64le/control | 12 - build/rebuild_data60_x64.bat | 53 ---- build/rebuild_data60_x86.bat | 53 ---- build/rebuild_lib60_x64.bat | 81 ------ build/rebuild_lib60_x86.bat | 116 -------- 14 files changed, 1689 deletions(-) delete mode 100755 build/aarch64/build_package_arm64.script delete mode 100644 build/aarch64/control delete mode 100755 build/amd64/build_package_amd64.script delete mode 100644 build/amd64/control delete mode 100644 build/create_package_x64.bat delete mode 100644 build/create_package_x86.bat delete mode 100755 build/i386/build_package_i386.script delete mode 100644 build/i386/control delete mode 100755 build/ppc64le/build_package_ppc64le.script delete mode 100644 build/ppc64le/control delete mode 100644 build/rebuild_data60_x64.bat delete mode 100644 build/rebuild_data60_x86.bat delete mode 100644 build/rebuild_lib60_x64.bat delete mode 100644 build/rebuild_lib60_x86.bat diff --git a/build/aarch64/build_package_arm64.script b/build/aarch64/build_package_arm64.script deleted file mode 100755 index 92a7376352..0000000000 --- a/build/aarch64/build_package_arm64.script +++ /dev/null @@ -1,198 +0,0 @@ -#!/bin/bash -RELEASE=elena-6.6.2.aarch64-linux - -mkdir -p ../lib60_64 -mkdir -p /usr/share/elena -mkdir -p /etc/elena/ -mkdir -p /etc/elena/templates/ -mkdir -p /usr/lib/elena/core/aarch64/ -mkdir -p /usr/lib/elena/lib60_64 - -cp ../../bin/libelenart60_64.so /usr/lib/elena/ -cp ../../bin/libelenasm60_64.so /usr/lib/elena/ -# cp ../bin/libelenavm.so /usr/lib/elena/ -cp ../../bin/elena64-cli /usr/bin/ - -cp ../../bin/elc60.config /etc/elena/ -# cp ../bin/elenavm.config /etc/elena/ -cp ../../bin/templates/*.config /etc/elena/templates/ - -echo compiling data files - -../../bin/sg64-cli ../../dat/sg/syntax60.txt -ret=$? -if [ $ret -eq 0 ] -then - echo . -else - echo "Failure" >&2 - exit 1 -fi - -../../bin/og64-cli ../../dat/og/bc_rules60.txt -ret=$? -if [ $ret -eq 0 ] -then - echo . -else - echo "Failure" >&2 - exit 1 -fi - -../../bin/og64-cli -s ../../dat/og/bt_rules60.txt -ret=$? -if [ $ret -eq 0 ] -then - echo . -else - echo "Failure" >&2 - exit 1 -fi - -cp ../../dat/og/*.dat /usr/share/elena/ -cp ../../dat/sg/syntax60.dat /usr/share/elena - -echo compiling assembly files - -../../bin/asm64-cli -arm64 ../../asm/aarch64/core60.asm /usr/lib/elena/core/aarch64 -ret=$? -if [ $ret -eq 0 ] -then - echo . -else - echo "Failure" >&2 - exit 1 -fi - -../../bin/asm64-cli -arm64 ../../asm/aarch64/core60_lnx.asm /usr/lib/elena/core/aarch64 -ret=$? -if [ $ret -eq 0 ] -then - echo . -else - echo "Failure" >&2 - exit 1 -fi - -# ../bin/elena-asm2binx ../asm/x32/coreapi.asm /usr/lib/elena/core/x32 -# ret=$? -# if [ $ret -eq 0 ] -# then -# echo . -# else -# echo "Failure" >&2 -# exit 1 -# fi -# -# echo compiling lib50 files - - ../../bin/asm64-cli -bc64 ../../src60/core/system.core_routines.esm ../../lib60_64 - ret=$? - if [ $ret -eq 0 ] - then - echo . - else - echo "Failure" >&2 - exit 1 - fi - - ../../bin/elena64-cli ../../src60/elena_api.linux.prjcol - ret=$? - if [ $ret -eq 2 ] - then - echo "Failure" >&2 - exit 1 - else - echo . - fi - - cp ../../lib60_64/*.nl /usr/lib/elena/lib60_64 - cp ../../lib60_64/*.dnl /usr/lib/elena/lib60_64 - - elena64-cli ../../tests60/system_tests/system_tests.prj - ret=$? - if [ $ret -eq 2 ] - then - echo "Failure" >&2 - exit 1 - else - echo . - fi - - ../../tests60/system_tests/system_tests - ret=$? - if [ $ret -eq 2 ] - then - echo "Failure" >&2 - exit 1 - else - echo . - fi - - echo "Do you wish to create a package?" - select yn in "Yes" "No"; do - case $yn in - Yes ) break;; - No ) exit;; - esac - done - - mkdir -p ./$RELEASE/etc/elena/ - mkdir -p ./$RELEASE/etc/elena/templates/ - mkdir -p ./$RELEASE/usr/share/elena/ - mkdir -p ./$RELEASE/usr/lib/elena/core/aarch64/ - mkdir -p ./$RELEASE/usr/lib/elena/lib60_64/ - mkdir -p ./$RELEASE/usr/bin/ - mkdir -p ./$RELEASE/usr/elena-lang - - mkdir -p ./$RELEASE/usr/elena-lang/examples60/console/helloworld/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/console/sum/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/console/words/ - - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/accumulator/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/ackermann/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/addfield/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/anonymrec/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/aplusb/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/applycallback/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/arithmeticint/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/arithmeval/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/arithmmean/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/arrayconcat/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/arraymode/ - - echo copying configuration - - cp ../../bin/*.config ./$RELEASE/etc/elena/ - cp ../../bin/templates/*.config ./$RELEASE/etc/elena/templates - - echo compiling shared files - - cp ../../dat/og/bt_rules60.dat ./$RELEASE/usr/share/elena - cp ../../dat/og/bc_rules60.dat ./$RELEASE/usr/share/elena - cp ../../dat/sg/syntax60.dat ./$RELEASE/usr/share/elena - - echo copying binaries - - cp ../../bin/elena64-cli ./$RELEASE/usr/bin/ - cp ../../bin/libelenart60_64.so ./$RELEASE/usr/lib/elena/ - - echo compiling core - - cp /usr/lib/elena/core/aarch64/*.bin ./$RELEASE/usr/lib/elena/core/aarch64/ - - echo compiling lib60 - - cp /usr/lib/elena/lib60_64/*.* ./$RELEASE/usr/lib/elena/lib60_64/ - - cp -r ../../examples60 $RELEASE/usr/elena-lang - cp -r ../../src60 $RELEASE/usr/elena-lang - - mkdir ./$RELEASE/DEBIAN - cp ./control ./$RELEASE/DEBIAN - - dpkg-deb --build $RELEASE - - alien -r -c -v *.deb - -exit 0 diff --git a/build/aarch64/control b/build/aarch64/control deleted file mode 100644 index 76ec1e5ad4..0000000000 --- a/build/aarch64/control +++ /dev/null @@ -1,12 +0,0 @@ -Package: elena-lang -Version: 6.6.2 -Architecture: aarch64 -Maintainer: Alex Rakov -Depends: libc6 (>= 2.1) -Section: elena-lang -Priority: optional -Homepage: https://elena-lang.github.io/ -Description: ELENA is a general-purpose, object-oriented, - polymorphic language with late binding. It features message dispatching - / manipulation, a script engine / interpreter and group object / mixin - support. Package includes command-line compiler,elena lib60 api,samples diff --git a/build/amd64/build_package_amd64.script b/build/amd64/build_package_amd64.script deleted file mode 100755 index 4309011910..0000000000 --- a/build/amd64/build_package_amd64.script +++ /dev/null @@ -1,210 +0,0 @@ -#!/bin/bash -RELEASE=elena-6.6.2.amd64-linux - -mkdir -p ../lib60_64 -mkdir -p /usr/share/elena -mkdir -p /etc/elena/ -mkdir -p /etc/elena/templates/ -mkdir -p /usr/lib/elena/core/x32/ -mkdir -p /usr/lib/elena/core/amd64/ -mkdir -p /usr/lib/elena/lib60_64 - -cp ../../bin/libelenart60_64.so /usr/lib/elena/ -cp ../../bin/libelenasm60_64.so /usr/lib/elena/ -# cp ../bin/libelenavm.so /usr/lib/elena/ -cp ../../bin/elena64-cli /usr/bin/ - -cp ../../bin/elc60.config /etc/elena/ -# cp ../bin/elenavm.config /etc/elena/ -cp ../../bin/templates/*.config /etc/elena/templates/ - -echo compiling data files - -../../bin/sg64-cli ../../dat/sg/syntax60.txt -ret=$? -if [ $ret -eq 0 ] -then - echo . -else - echo "Failure" >&2 - exit 1 -fi - -# ../bin/elena-og ../dat/og/rules.txt -# ret=$? -# if [ $ret -eq 0 ] -# then -# echo . -# else -# echo "Failure" >&2 -# exit 1 -# fi - -../../bin/og64-cli ../../dat/og/bc_rules60.txt -ret=$? -if [ $ret -eq 0 ] -then - echo . -else - echo "Failure" >&2 - exit 1 -fi - -../../bin/og64-cli -s ../../dat/og/bt_rules60.txt -ret=$? -if [ $ret -eq 0 ] -then - echo . -else - echo "Failure" >&2 - exit 1 -fi - - -cp ../../dat/og/*.dat /usr/share/elena/ -cp ../../dat/sg/syntax60.dat /usr/share/elena - -echo compiling assembly files - -../../bin/asm64-cli -amd64 ../../asm/amd64/core60.asm /usr/lib/elena/core/amd64 -ret=$? -if [ $ret -eq 0 ] -then - echo . -else - echo "Failure" >&2 - exit 1 -fi - -../../bin/asm64-cli -amd64 ../../asm/amd64/core60_lnx.asm /usr/lib/elena/core/amd64 -ret=$? -if [ $ret -eq 0 ] -then - echo . -else - echo "Failure" >&2 - exit 1 -fi - -# ../bin/elena-asm2binx ../asm/x32/coreapi.asm /usr/lib/elena/core/x32 -# ret=$? -# if [ $ret -eq 0 ] -# then -# echo . -# else -# echo "Failure" >&2 -# exit 1 -# fi -# -# echo compiling lib50 files - - ../../bin/asm64-cli -bc64 ../../src60/core/system.core_routines.esm ../../lib60_64 - ret=$? - if [ $ret -eq 0 ] - then - echo . - else - echo "Failure" >&2 - exit 1 - fi - - ../../bin/elena64-cli ../../src60/elena_api.linux.prjcol - ret=$? - if [ $ret -eq 2 ] - then - echo "Failure" >&2 - exit 1 - else - echo . - fi - - cp ../../lib60_64/*.nl /usr/lib/elena/lib60_64 - cp ../../lib60_64/*.dnl /usr/lib/elena/lib60_64 - - elena64-cli ../../tests60/system_tests/system_tests.prj - ret=$? - if [ $ret -eq 2 ] - then - echo "Failure" >&2 - exit 1 - else - echo . - fi - - ../../tests60/system_tests/system_tests - ret=$? - if [ $ret -eq 2 ] - then - echo "Failure" >&2 - exit 1 - else - echo . - fi - - echo "Do you wish to create a package?" - select yn in "Yes" "No"; do - case $yn in - Yes ) break;; - No ) exit;; - esac - done - - mkdir -p ./$RELEASE/etc/elena/ - mkdir -p ./$RELEASE/etc/elena/templates/ - mkdir -p ./$RELEASE/usr/share/elena/ - mkdir -p ./$RELEASE/usr/lib/elena/core/amd64/ - mkdir -p ./$RELEASE/usr/lib/elena/lib60_64/ - mkdir -p ./$RELEASE/usr/bin/ - mkdir -p ./$RELEASE/usr/elena-lang - - mkdir -p ./$RELEASE/usr/elena-lang/examples60/console/helloworld/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/console/sum/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/console/words/ - - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/accumulator/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/ackermann/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/addfield/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/anonymrec/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/aplusb/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/applycallback/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/arithmeticint/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/arithmeval/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/arithmmean/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/arrayconcat/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/arraymode/ - - echo copying configuration - - cp ../../bin/*.config ./$RELEASE/etc/elena/ - cp ../../bin/templates/*.config ./$RELEASE/etc/elena/templates - - echo compiling shared files - - cp ../../dat/og/bt_rules60.dat ./$RELEASE/usr/share/elena - cp ../../dat/og/bc_rules60.dat ./$RELEASE/usr/share/elena - cp ../../dat/sg/syntax60.dat ./$RELEASE/usr/share/elena - - echo copying binaries - - cp ../../bin/elena64-cli ./$RELEASE/usr/bin/ - cp ../../bin/libelenart60_64.so ./$RELEASE/usr/lib/elena/ - - echo compiling core - - cp /usr/lib/elena/core/amd64/*.bin ./$RELEASE/usr/lib/elena/core/amd64/ - - echo compiling lib60 - - cp /usr/lib/elena/lib60_64/*.* ./$RELEASE/usr/lib/elena/lib60_64/ - - cp -r ../../examples60 $RELEASE/usr/elena-lang - cp -r ../../src60 $RELEASE/usr/elena-lang - - mkdir ./$RELEASE/DEBIAN - cp ./control ./$RELEASE/DEBIAN - - dpkg-deb --build $RELEASE - - alien -r -c -v *.deb - -exit 0 \ No newline at end of file diff --git a/build/amd64/control b/build/amd64/control deleted file mode 100644 index 6ef35ce178..0000000000 --- a/build/amd64/control +++ /dev/null @@ -1,12 +0,0 @@ -Package: elena-lang -Version: 6.6.2 -Architecture: amd64 -Maintainer: Alex Rakov -Depends: libc6 (>= 2.1) -Section: elena-lang -Priority: optional -Homepage: https://elena-lang.github.io/ -Description: ELENA is a general-purpose, object-oriented, - polymorphic language with late binding. It features message dispatching - / manipulation, a script engine / interpreter and group object / mixin - support. Package includes command-line compiler,elena lib60 api,samples diff --git a/build/create_package_x64.bat b/build/create_package_x64.bat deleted file mode 100644 index 6874fbd8f4..0000000000 --- a/build/create_package_x64.bat +++ /dev/null @@ -1,211 +0,0 @@ -@echo off - -ECHO =========== Compiling ELENA files ================== - -md %~dp0\x64 -md %~dp0\x64\bin -md %~dp0\x64\bin\templates -md %~dp0\x64\bin\scripts -md %~dp0\x64\bin\amd64 -md %~dp0\x64\doc -md %~dp0\x64\examples60 -md %~dp0\x64\examples60\console -md %~dp0\x64\examples60\console\helloworld -md %~dp0\x64\examples60\console\sum -md %~dp0\x64\examples60\console\words -md %~dp0\x64\examples60\console\binary -md %~dp0\x64\examples60\console\bsort -md %~dp0\x64\examples60\console\datetime -md %~dp0\x64\examples60\console\goods -md %~dp0\x64\examples60\console\replace -md %~dp0\x64\examples60\rosetta\accumulator -md %~dp0\x64\examples60\rosetta\ackermann -md %~dp0\x64\examples60\rosetta\addfield -md %~dp0\x64\examples60\rosetta\anonymrec -md %~dp0\x64\examples60\rosetta\aplusb -md %~dp0\x64\examples60\rosetta\applycallback -md %~dp0\x64\examples60\rosetta\arithmeticint -md %~dp0\x64\examples60\rosetta\arithmeval -md %~dp0\x64\examples60\rosetta\arithmmean -md %~dp0\x64\examples60\rosetta\arrayconcat -md %~dp0\x64\examples60\rosetta\arraymode -md %~dp0\x64\examples60\rosetta\arrays -md %~dp0\x64\examples60\rosetta\associativearrays -md %~dp0\x64\examples60\rosetta\bestshuffle -md %~dp0\x64\examples60\rosetta\binary -md %~dp0\x64\examples60\rosetta\bitwise -md %~dp0\x64\examples60\rosetta\brackets -md %~dp0\x64\examples60\rosetta\bullscows -md %~dp0\x64\examples60\rosetta\caesar -md %~dp0\x64\examples60\rosetta\calendar -md %~dp0\x64\examples60\rosetta\charmatch -md %~dp0\x64\examples60\rosetta\combinations -md %~dp0\x64\examples60\rosetta\doors -md %~dp0\x64\examples60\rosetta\evolutionary -md %~dp0\x64\examples60\rosetta\firstclass -md %~dp0\x64\examples60\rosetta\loop_multiple_arrays -md %~dp0\x64\examples60\rosetta\median -md %~dp0\x64\examples60\rosetta\ninetynine -md %~dp0\x64\examples60\rosetta\reverse_words_in_string -md %~dp0\x64\examples60\rosetta\smavg -md %~dp0\x64\examples60\rosetta\string_append - -copy %~dp0\..\bin\asm64-cli.exe %~dp0\x64\bin -copy %~dp0\..\bin\elena64-cli.exe %~dp0\x64\bin -copy %~dp0\..\bin\elena64-ide.exe %~dp0\x64\bin -copy %~dp0\..\bin\sg64-cli.exe %~dp0\x64\bin -copy %~dp0\..\bin\og64-cli.exe %~dp0\x64\bin -copy %~dp0\..\bin\ecv64-cli.exe %~dp0\x64\bin -copy %~dp0\..\bin\elenart60_64.dll %~dp0\x64\bin -copy %~dp0\..\bin\winstub.ex_ %~dp0\x64\bin -copy %~dp0\..\bin\elc60.cfg %~dp0\x64\bin -copy %~dp0\..\bin\elenart60.cfg %~dp0\x64\bin -copy %~dp0\..\bin\elenavm60.cfg %~dp0\x64\bin - -copy %~dp0\..\bin\amd64\core60.bin %~dp0\x64\bin\amd64 -copy %~dp0\..\bin\amd64\core60_win.bin %~dp0\x64\bin\amd64 -copy %~dp0\..\bin\amd64\corex60.bin %~dp0\x64\bin\amd64 -copy %~dp0\..\bin\amd64\core60_win_client.bin %~dp0\x64\bin\amd64 - -copy %~dp0\..\bin\templates\*.cfg %~dp0\x64\bin\templates\ -copy %~dp0\..\bin\scripts\*.es %~dp0\x64\bin\scripts\ - -copy %~dp0\..\doc\license %~dp0\x64\doc\ -copy %~dp0\..\doc\contributors %~dp0\x64\doc\ -copy %~dp0\..\readme.md %~dp0\x64\ -copy %~dp0\..\CHANGELOG.md %~dp0\x64\ -copy %~dp0\..\VERSION %~dp0\x64\ - -md %~dp0\x64\src60\system -xcopy %~dp0\..\src60\system\*.l %~dp0\x64\src60\system /s -xcopy %~dp0\..\src60\system\*.prj %~dp0\x64\src60\system /s - -md %~dp0\x64\src60\extensions -xcopy %~dp0\..\src60\extensions\*.l %~dp0\x64\src60\extensions /s -xcopy %~dp0\..\src60\extensions\*.prj %~dp0\x64\src60\extensions /s - -md %~dp0\x64\src60\algorithms -xcopy %~dp0\..\src60\algorithms\*.l %~dp0\x64\src60\algorithms /s -xcopy %~dp0\..\src60\algorithms\*.prj %~dp0\x64\src60\algorithms /s - -md %~dp0\x64\src60\cellular -xcopy %~dp0\..\src60\cellular\*.l %~dp0\x64\src60\cellular /s -xcopy %~dp0\..\src60\cellular\*.prj %~dp0\x64\src60\cellular /s - -md %~dp0\x64\src60\sqlite -xcopy %~dp0\..\src60\sqlite\*.l %~dp0\x64\src60\sqlite /s -xcopy %~dp0\..\src60\sqlite\*.prj %~dp0\x64\src60\sqlite /s - -md %~dp0\x64\src60\forms -xcopy %~dp0\..\src60\forms\*.l %~dp0\x64\src60\forms /s -xcopy %~dp0\..\src60\forms\*.prj %~dp0\x64\src60\forms /s - -md %~dp0\x64\src60\xforms -xcopy %~dp0\..\src60\xforms\*.l %~dp0\x64\src60\xforms /s -xcopy %~dp0\..\src60\xforms\*.prj %~dp0\x64\src60\xforms /s - -md %~dp0\x64\src60\net -xcopy %~dp0\..\src60\net\*.l %~dp0\x64\src60\net /s -xcopy %~dp0\..\src60\net\*.prj %~dp0\x64\src60\net /s - -md %~dp0\x64\src60\ltests -xcopy %~dp0\..\src60\ltests\*.l %~dp0\x64\src60\ltests /s -xcopy %~dp0\..\src60\ltests\*.prj %~dp0\x64\src60\ltests /s - -copy %~dp0\..\src60\elena_api.prjcol %~dp0\x64\src60\ - -%~dp0\..\bin\sg64-cli.exe %~dp0\..\dat\sg\syntax60.txt -@echo off -if %ERRORLEVEL% EQU -2 GOTO CompilerError -@echo on - -move %~dp0..\dat\sg\syntax60.dat %~dp0\x64\bin\ - -%~dp0\..\bin\og64-cli %~dp0\..\dat\og\bc_rules60.txt -%~dp0\..\bin\og64-cli -s %~dp0\..\dat\og\bt_rules60.txt - -move %~dp0..\dat\og\bt_rules60.dat %~dp0\x64\bin\ -move %~dp0..\dat\og\bc_rules60.dat %~dp0\x64\bin\ - -md %~dp0\lib60_64 - -%~dp0\..\bin\asm64-cli -bc64 %~dp0\..\src60\core\system.core_routines.esm %~dp0\x64\lib60_64 -@echo off -if %ERRORLEVEL% EQU -2 GOTO CompilerError -@echo on - -%~dp0\..\bin\asm64-cli -bc64 %~dp0\..\src60\core\system.win_core_routines.esm %~dp0\x64\lib60_64 -@echo off -if %ERRORLEVEL% EQU -2 GOTO CompilerError -@echo on - -%~dp0\x64\bin\elena64-cli %~dp0x64\src60\elena_api.prjcol -@echo off -if %ERRORLEVEL% EQU -2 GOTO CompilerError -@echo on - -%~dp0\..\bin\asm64-cli -amd64 %~dp0\..\asm\amd64\core60.asm bin\amd64 -@echo off -if %ERRORLEVEL% EQU -2 GOTO CompilerError -@echo on - -%~dp0\..\bin\asm64-cli -amd64 %~dp0\..\asm\amd64\core60_win.asm bin\amd64 -@echo off -if %ERRORLEVEL% EQU -2 GOTO CompilerError -@echo on - -copy %~dp0\..\examples60\console\helloworld\*.l %~dp0\x64\examples60\console\helloworld -copy %~dp0\..\examples60\console\helloworld\*.prj %~dp0\x64\examples60\console\helloworld - -copy %~dp0\..\examples60\console\sum\*.l %~dp0\x64\examples60\console\sum -copy %~dp0\..\examples60\console\sum\*.prj %~dp0\x64\examples60\console\sum - -copy %~dp0\..\examples60\console\words\*.l %~dp0\x64\examples60\console\words -copy %~dp0\..\examples60\console\binary\*.l %~dp0\x64\examples60\console\binary -copy %~dp0\..\examples60\console\bsort\*.l %~dp0\x64\examples60\console\bsort -copy %~dp0\..\examples60\console\datetime\*.l %~dp0\x64\examples60\console\datetime -copy %~dp0\..\examples60\console\datetime\*.prj %~dp0\x64\examples60\console\datetime -copy %~dp0\..\examples60\console\goods\*.l %~dp0\x64\examples60\console\goods -copy %~dp0\..\examples60\console\goods\*.txt %~dp0\x64\examples60\console\goods -copy %~dp0\..\examples60\console\replace\*.l %~dp0\x64\examples60\console\replace - -copy %~dp0\..\examples60\rosetta\accumulator\*.l %~dp0\x64\examples60\rosetta\accumulator -copy %~dp0\..\examples60\rosetta\ackermann\*.l %~dp0\x64\examples60\rosetta\ackermann -copy %~dp0\..\examples60\rosetta\addfield\*.l %~dp0\x64\examples60\rosetta\addfield -copy %~dp0\..\examples60\rosetta\anonymrec\*.l %~dp0\x64\examples60\rosetta\anonymrec -copy %~dp0\..\examples60\rosetta\aplusb\*.l %~dp0\x64\examples60\rosetta\aplusb -copy %~dp0\..\examples60\rosetta\applycallback\*.l %~dp0\x64\examples60\rosetta\applycallback -copy %~dp0\..\examples60\rosetta\arithmeticint\*.l %~dp0\x64\examples60\rosetta\arithmeticint -copy %~dp0\..\examples60\rosetta\arithmeval\*.l %~dp0\x64\examples60\rosetta\arithmeval -copy %~dp0\..\examples60\rosetta\arithmmean\*.l %~dp0\x64\examples60\rosetta\arithmmean -copy %~dp0\..\examples60\rosetta\arrayconcat\*.l %~dp0\x64\examples60\rosetta\arrayconcat -copy %~dp0\..\examples60\rosetta\arraymode\*.l %~dp0\x64\examples60\rosetta\arraymode -copy %~dp0\..\examples60\rosetta\arrays\*.l %~dp0\x64\examples60\rosetta\arrays - -copy %~dp0\..\examples60\rosetta\associativearrays\*.l %~dp0\x64\examples60\rosetta\associativearrays -copy %~dp0\..\examples60\rosetta\bestshuffle\*.l %~dp0\x64\examples60\rosetta\bestshuffle -copy %~dp0\..\examples60\rosetta\binary\*.l %~dp0\x64\examples60\rosetta\binary -copy %~dp0\..\examples60\rosetta\bitwise\*.l %~dp0\x64\examples60\rosetta\bitwise -copy %~dp0\..\examples60\rosetta\brackets\*.l %~dp0\x64\examples60\rosetta\brackets -copy %~dp0\..\examples60\rosetta\bullscows\*.l %~dp0\x64\examples60\rosetta\bullscows -copy %~dp0\..\examples60\rosetta\caesar\*.l %~dp0\x64\examples60\rosetta\caesar -copy %~dp0\..\examples60\rosetta\calendar\*.l %~dp0\x64\examples60\rosetta\calendar -copy %~dp0\..\examples60\rosetta\charmatch\*.l %~dp0\x64\examples60\rosetta\charmatch -copy %~dp0\..\examples60\rosetta\combinations\*.l %~dp0\x64\examples60\rosetta\combinations -copy %~dp0\..\examples60\rosetta\doors\*.l %~dp0\x64\examples60\rosetta\doors -copy %~dp0\..\examples60\rosetta\evolutionary\*.l %~dp0\x64\examples60\rosetta\evolutionary -copy %~dp0\..\examples60\rosetta\firstclass\*.l %~dp0\x64\examples60\rosetta\firstclass -copy %~dp0\..\examples60\rosetta\loop_multiple_arrays\*.l %~dp0\x64\examples60\rosetta\loop_multiple_arrays -copy %~dp0\..\examples60\rosetta\median\*.l %~dp0\x64\examples60\rosetta\median -copy %~dp0\..\examples60\rosetta\ninetynine\*.l %~dp0\x64\examples60\rosetta\ninetynine -copy %~dp0\..\examples60\rosetta\reverse_words_in_string\*.l %~dp0\x64\examples60\rosetta\reverse_words_in_string -copy %~dp0\..\examples60\rosetta\smavg\*.l %~dp0\x64\examples60\rosetta\smavg -copy %~dp0\..\examples60\rosetta\string_append\*.l %~dp0\x64\examples60\rosetta\string_append -copy %~dp0\..\examples60\rosetta\twentyfour\*.l %~dp0\x64\examples60\rosetta\twentyfour - -goto:eof -::ERRORS -::--------------------- -:CompilerError -echo The MSBuild returns error %ERRORLEVEL% -goto:eof diff --git a/build/create_package_x86.bat b/build/create_package_x86.bat deleted file mode 100644 index 9f16033ad3..0000000000 --- a/build/create_package_x86.bat +++ /dev/null @@ -1,313 +0,0 @@ -@echo off - -ECHO =========== Compiling ELENA files ================== - -md %~dp0\x86 -md %~dp0\x86\bin -md %~dp0\x86\bin\templates -md %~dp0\x86\bin\scripts -md %~dp0\x86\bin\x32 -md %~dp0\x86\doc -md %~dp0\x86\examples60 -md %~dp0\x86\examples60\console -md %~dp0\x86\examples60\console\helloworld -md %~dp0\x86\examples60\console\sum -md %~dp0\x86\examples60\console\words -md %~dp0\x86\examples60\console\binary -md %~dp0\x86\examples60\console\bsort -md %~dp0\x86\examples60\console\datetime -md %~dp0\x86\examples60\console\goods -md %~dp0\x86\examples60\console\replace -md %~dp0\x86\examples60\console\pi -md %~dp0\x86\examples60\console\matrix -md %~dp0\x86\examples60\console\random -md %~dp0\x86\examples60\files -md %~dp0\x86\examples60\files\textdb -md %~dp0\x86\examples60\files\textfile -md %~dp0\x86\examples60\scripts\calc -md %~dp0\x86\examples60\scripts\interpreter -md %~dp0\x86\examples60\scripts\js -md %~dp0\x86\examples60\scripts\ls -md %~dp0\x86\examples60\rosetta\accumulator -md %~dp0\x86\examples60\rosetta\ackermann -md %~dp0\x86\examples60\rosetta\addfield -md %~dp0\x86\examples60\rosetta\anonymrec -md %~dp0\x86\examples60\rosetta\aplusb -md %~dp0\x86\examples60\rosetta\applycallback -md %~dp0\x86\examples60\rosetta\arithmeticint -md %~dp0\x86\examples60\rosetta\arithmeval -md %~dp0\x86\examples60\rosetta\arithmmean -md %~dp0\x86\examples60\rosetta\arrayconcat -md %~dp0\x86\examples60\rosetta\arraymode -md %~dp0\x86\examples60\rosetta\arrays -md %~dp0\x86\examples60\rosetta\associativearrays -md %~dp0\x86\examples60\rosetta\bestshuffle -md %~dp0\x86\examples60\rosetta\binary -md %~dp0\x86\examples60\rosetta\bitwise -md %~dp0\x86\examples60\rosetta\brackets -md %~dp0\x86\examples60\rosetta\bullscows -md %~dp0\x86\examples60\rosetta\caesar -md %~dp0\x86\examples60\rosetta\calendar -md %~dp0\x86\examples60\rosetta\charmatch -md %~dp0\x86\examples60\rosetta\combinations -md %~dp0\x86\examples60\rosetta\doors -md %~dp0\x86\examples60\rosetta\evolutionary -md %~dp0\x86\examples60\rosetta\firstclass -md %~dp0\x86\examples60\rosetta\loop_multiple_arrays -md %~dp0\x86\examples60\rosetta\median -md %~dp0\x86\examples60\rosetta\ninetynine -md %~dp0\x86\examples60\rosetta\reverse_words_in_string -md %~dp0\x86\examples60\rosetta\smavg -md %~dp0\x86\examples60\rosetta\string_append - -md %~dp0\x86\examples60\gui\c_a_g -md %~dp0\x86\examples60\gui\c_a_g\formulas -md %~dp0\x86\examples60\gui\c_a_g\formulas\Circulo -md %~dp0\x86\examples60\gui\c_a_g\formulas\Paralelogramos -md %~dp0\x86\examples60\gui\c_a_g\formulas\Trapezio -md %~dp0\x86\examples60\gui\c_a_g\formulas\Triangulos - -md %~dp0\x86\examples60\gui\agenda -md %~dp0\x86\examples60\gui\graphs -md %~dp0\x86\examples60\gui\helloworld - -md %~dp0\x86\examples60\db -md %~dp0\x86\examples60\db\sqlite - -md %~dp0\x86\examples60\threads -md %~dp0\x86\examples60\threads\async -md %~dp0\x86\examples60\threads\tasks -md %~dp0\x86\examples60\threads\threadpool - -copy %~dp0\..\bin\asm-cli.exe %~dp0\x86\bin -copy %~dp0\..\bin\elena-cli.exe %~dp0\x86\bin -copy %~dp0\..\bin\elena-ide.exe %~dp0\x86\bin -copy %~dp0\..\bin\sg-cli.exe %~dp0\x86\bin -copy %~dp0\..\bin\og-cli.exe %~dp0\x86\bin -copy %~dp0\..\bin\ecv-cli.exe %~dp0\x86\bin -copy %~dp0\..\bin\elt-cli.exe %~dp0\x86\bin -copy %~dp0\..\bin\elenart60.dll %~dp0\x86\bin -copy %~dp0\..\bin\elenasm60.dll %~dp0\x86\bin -copy %~dp0\..\bin\elenavm60.dll %~dp0\x86\bin -copy %~dp0\..\bin\winstub.ex_ %~dp0\x86\bin -copy %~dp0\..\bin\elc60.cfg %~dp0\x86\bin -copy %~dp0\..\bin\elenart60.cfg %~dp0\x86\bin -copy %~dp0\..\bin\elenavm60.cfg %~dp0\x86\bin -copy %~dp0\..\bin\elt60.es %~dp0\x86\bin -copy %~dp0\..\bin\command60.es %~dp0\x86\bin - -copy %~dp0\..\bin\x86\core60.bin %~dp0\x86\bin\x86\ -copy %~dp0\..\bin\x86\core60_win.bin %~dp0\x86\bin\x86\ -copy %~dp0\..\bin\x86\core60_win_client.bin %~dp0\x86\bin\x86\ -copy %~dp0\..\bin\x86\corex60.bin %~dp0\x86\bin\x86\ -copy %~dp0\..\bin\x86\corex60_win.bin %~dp0\x86\bin\x86\ - -copy %~dp0\..\bin\templates\*.cfg %~dp0\x86\bin\templates\ -copy %~dp0\..\bin\scripts\*.es %~dp0\x86\bin\scripts\ - -copy %~dp0\..\doc\license %~dp0\x86\doc\ -copy %~dp0\..\doc\contributors %~dp0\x86\doc\ -copy %~dp0\..\readme.md %~dp0\x86\ -copy %~dp0\..\CHANGELOG.md %~dp0\x86\ -copy %~dp0\..\VERSION %~dp0\x86\ - -md %~dp0\x86\src60\system -xcopy %~dp0\..\src60\system\*.l %~dp0\x86\src60\system /s -xcopy %~dp0\..\src60\system\*.prj %~dp0\x86\src60\system /s - -md %~dp0\x86\src60\extensions -xcopy %~dp0\..\src60\extensions\*.l %~dp0\x86\src60\extensions /s -xcopy %~dp0\..\src60\extensions\*.prj %~dp0\x86\src60\extensions /s - -md %~dp0\x86\src60\algorithms -xcopy %~dp0\..\src60\algorithms\*.l %~dp0\x86\src60\algorithms /s -xcopy %~dp0\..\src60\algorithms\*.prj %~dp0\x86\src60\algorithms /s - -md %~dp0\x86\src60\cellular -xcopy %~dp0\..\src60\cellular\*.l %~dp0\x86\src60\cellular /s -xcopy %~dp0\..\src60\cellular\*.prj %~dp0\x86\src60\cellular /s - -md %~dp0\x86\src60\sqlite -xcopy %~dp0\..\src60\sqlite\*.l %~dp0\x86\src60\sqlite /s -xcopy %~dp0\..\src60\sqlite\*.prj %~dp0\x86\src60\sqlite /s - -md %~dp0\x86\src60\forms -xcopy %~dp0\..\src60\forms\*.l %~dp0\x86\src60\forms /s -xcopy %~dp0\..\src60\forms\*.prj %~dp0\x86\src60\forms /s - -md %~dp0\x86\src60\xforms -xcopy %~dp0\..\src60\xforms\*.l %~dp0\x86\src60\xforms /s -xcopy %~dp0\..\src60\xforms\*.prj %~dp0\x86\src60\xforms /s - -md %~dp0\x86\src60\ltests -xcopy %~dp0\..\src60\ltests\*.l %~dp0\x86\src60\ltests /s -xcopy %~dp0\..\src60\ltests\*.prj %~dp0\x86\src60\ltests /s - -md %~dp0\x86\src60\net -xcopy %~dp0\..\src60\net\*.l %~dp0\x86\src60\net /s -xcopy %~dp0\..\src60\net\*.prj %~dp0\x86\src60\net /s - -copy %~dp0\..\src60\elena_api.prjcol %~dp0\x86\src60\ - -%~dp0\..\bin\sg-cli.exe %~dp0\..\dat\sg\syntax60.txt -@echo off -if %ERRORLEVEL% EQU -2 GOTO CompilerError -@echo on - -move %~dp0..\dat\sg\syntax60.dat %~dp0\x86\bin\ - -%~dp0\..\bin\og-cli %~dp0\..\dat\og\bc_rules60.txt -%~dp0\..\bin\og-cli -s %~dp0\..\dat\og\bt_rules60.txt - -move %~dp0..\dat\og\bt_rules60.dat %~dp0\x86\bin\ -move %~dp0..\dat\og\bc_rules60.dat %~dp0\x86\bin\ - -md %~dp0\lib60 - -%~dp0\..\bin\asm-cli -bc32 %~dp0\..\src60\core\system.core_routines.esm %~dp0\x86\lib60 -@echo off -if %ERRORLEVEL% EQU -2 GOTO CompilerError -@echo on - -%~dp0\..\bin\asm-cli -bc32 %~dp0\..\src60\core\system.win_core_routines.esm %~dp0\x86\lib60 -@echo off -if %ERRORLEVEL% EQU -2 GOTO CompilerError -@echo on - -%~dp0\x86\bin\elena-cli %~dp0x86\src60\elena_api.prjcol -@echo off -if %ERRORLEVEL% EQU -2 GOTO CompilerError -@echo on - -%~dp0\..\bin\asm-cli -x86 %~dp0\..\asm\x32\core60.asm %~dp0\x86\bin\x32 -@echo off -if %ERRORLEVEL% EQU -2 GOTO CompilerError -@echo on - -%~dp0\..\bin\asm-cli -x86 %~dp0\..\asm\x32\core60_win.asm %~dp0\x86\bin\x32 -@echo off -if %ERRORLEVEL% EQU -2 GOTO CompilerError -@echo on - -%~dp0\..\bin\asm-cli -x86 %~dp0\..\asm\x32\corex60_win.asm %~dp0\x86\bin\x32 -@echo off -if %ERRORLEVEL% EQU -2 GOTO CompilerError -@echo on - -%~dp0\..\bin\asm-cli -x86 %~dp0\..\asm\x32\corex60.asm %~dp0\x86\bin\x32 -@echo off -if %ERRORLEVEL% EQU -2 GOTO CompilerError -@echo on - -%~dp0\..\bin\asm-cli -x86 %~dp0\..\asm\x32\core60_win_client.asm %~dp0\x86\bin\x32 -@echo off -if %ERRORLEVEL% EQU -2 GOTO CompilerError -@echo on - -copy %~dp0\..\examples60\console\helloworld\*.l %~dp0\x86\examples60\console\helloworld -copy %~dp0\..\examples60\console\helloworld\*.prj %~dp0\x86\examples60\console\helloworld - -copy %~dp0\..\examples60\console\sum\*.l %~dp0\x86\examples60\console\sum -copy %~dp0\..\examples60\console\sum\*.prj %~dp0\x86\examples60\console\sum - -copy %~dp0\..\examples60\console\words\*.l %~dp0\x86\examples60\console\words -copy %~dp0\..\examples60\console\binary\*.l %~dp0\x86\examples60\console\binary -copy %~dp0\..\examples60\console\bsort\*.l %~dp0\x86\examples60\console\bsort -copy %~dp0\..\examples60\console\datetime\*.l %~dp0\x86\examples60\console\datetime -copy %~dp0\..\examples60\console\datetime\*.prj %~dp0\x86\examples60\console\datetime -copy %~dp0\..\examples60\console\goods\*.l %~dp0\x86\examples60\console\goods -copy %~dp0\..\examples60\console\goods\*.txt %~dp0\x86\examples60\console\goods -copy %~dp0\..\examples60\console\replace\*.l %~dp0\x86\examples60\console\replace -copy %~dp0\..\examples60\console\pi\*.l %~dp0\x86\examples60\console\pi -copy %~dp0\..\examples60\console\matrix\*.l %~dp0\x86\examples60\console\matrix -copy %~dp0\..\examples60\console\matrix\*.prj %~dp0\x86\examples60\console\matrix -copy %~dp0\..\examples60\console\random\*.l %~dp0\x86\examples60\console\random - -copy %~dp0\..\examples60\scripts\calc\*.l %~dp0\x86\examples60\scripts\calc -copy %~dp0\..\examples60\scripts\calc\*.es %~dp0\x86\examples60\scripts\calc -copy %~dp0\..\examples60\scripts\calc\*.prj %~dp0\x86\examples60\scripts\calc - -copy %~dp0\..\examples60\scripts\interpreter\*.l %~dp0\x86\examples60\scripts\interpreter -copy %~dp0\..\examples60\scripts\interpreter\*.es %~dp0\x86\examples60\scripts\interpreter -copy %~dp0\..\examples60\scripts\interpreter\*.prj %~dp0\x86\examples60\scripts\interpreter -copy %~dp0\..\examples60\scripts\interpreter\*.txt %~dp0\x86\examples60\scripts\interpreter - -copy %~dp0\..\examples60\scripts\js\*.l %~dp0\x86\examples60\scripts\js -copy %~dp0\..\examples60\scripts\js\*.js %~dp0\x86\examples60\scripts\js -copy %~dp0\..\examples60\scripts\js\*.prj %~dp0\x86\examples60\scripts\js - -copy %~dp0\..\examples60\scripts\ls\*.l %~dp0\x86\examples60\scripts\ls -copy %~dp0\..\examples60\scripts\ls\*.ls %~dp0\x86\examples60\scripts\ls -copy %~dp0\..\examples60\scripts\ls\*.prj %~dp0\x86\examples60\scripts\ls - -copy %~dp0\..\examples60\rosetta\accumulator\*.l %~dp0\x86\examples60\rosetta\accumulator -copy %~dp0\..\examples60\rosetta\ackermann\*.l %~dp0\x86\examples60\rosetta\ackermann -copy %~dp0\..\examples60\rosetta\addfield\*.l %~dp0\x86\examples60\rosetta\addfield -copy %~dp0\..\examples60\rosetta\anonymrec\*.l %~dp0\x86\examples60\rosetta\anonymrec -copy %~dp0\..\examples60\rosetta\aplusb\*.l %~dp0\x86\examples60\rosetta\aplusb -copy %~dp0\..\examples60\rosetta\applycallback\*.l %~dp0\x86\examples60\rosetta\applycallback -copy %~dp0\..\examples60\rosetta\arithmeticint\*.l %~dp0\x86\examples60\rosetta\arithmeticint -copy %~dp0\..\examples60\rosetta\arithmeval\*.l %~dp0\x86\examples60\rosetta\arithmeval -copy %~dp0\..\examples60\rosetta\arithmmean\*.l %~dp0\x86\examples60\rosetta\arithmmean -copy %~dp0\..\examples60\rosetta\arrayconcat\*.l %~dp0\x86\examples60\rosetta\arrayconcat -copy %~dp0\..\examples60\rosetta\arraymode\*.l %~dp0\x86\examples60\rosetta\arraymode -copy %~dp0\..\examples60\rosetta\arrays\*.l %~dp0\x86\examples60\rosetta\arrays - -copy %~dp0\..\examples60\rosetta\associativearrays\*.l %~dp0\x86\examples60\rosetta\associativearrays -copy %~dp0\..\examples60\rosetta\bestshuffle\*.l %~dp0\x86\examples60\rosetta\bestshuffle -copy %~dp0\..\examples60\rosetta\binary\*.l %~dp0\x86\examples60\rosetta\binary -copy %~dp0\..\examples60\rosetta\bitwise\*.l %~dp0\x86\examples60\rosetta\bitwise -copy %~dp0\..\examples60\rosetta\brackets\*.l %~dp0\x86\examples60\rosetta\brackets -copy %~dp0\..\examples60\rosetta\bullscows\*.l %~dp0\x86\examples60\rosetta\bullscows -copy %~dp0\..\examples60\rosetta\caesar\*.l %~dp0\x86\examples60\rosetta\caesar -copy %~dp0\..\examples60\rosetta\calendar\*.l %~dp0\x86\examples60\rosetta\calendar -copy %~dp0\..\examples60\rosetta\charmatch\*.l %~dp0\x86\examples60\rosetta\charmatch -copy %~dp0\..\examples60\rosetta\combinations\*.l %~dp0\x86\examples60\rosetta\combinations -copy %~dp0\..\examples60\rosetta\doors\*.l %~dp0\x86\examples60\rosetta\doors -copy %~dp0\..\examples60\rosetta\evolutionary\*.l %~dp0\x86\examples60\rosetta\evolutionary -copy %~dp0\..\examples60\rosetta\firstclass\*.l %~dp0\x86\examples60\rosetta\firstclass -copy %~dp0\..\examples60\rosetta\loop_multiple_arrays\*.l %~dp0\x86\examples60\rosetta\loop_multiple_arrays -copy %~dp0\..\examples60\rosetta\median\*.l %~dp0\x86\examples60\rosetta\median -copy %~dp0\..\examples60\rosetta\ninetynine\*.l %~dp0\x86\examples60\rosetta\ninetynine -copy %~dp0\..\examples60\rosetta\reverse_words_in_string\*.l %~dp0\x86\examples60\rosetta\reverse_words_in_string -copy %~dp0\..\examples60\rosetta\smavg\*.l %~dp0\x86\examples60\rosetta\smavg -copy %~dp0\..\examples60\rosetta\string_append\*.l %~dp0\x86\examples60\rosetta\string_append -copy %~dp0\..\examples60\rosetta\twentyfour\*.l %~dp0\x86\examples60\rosetta\twentyfour - -copy %~dp0\..\examples60\gui\c_a_g\*.l %~dp0\x86\examples60\gui\c_a_g -copy %~dp0\..\examples60\gui\c_a_g\*.prj %~dp0\x86\examples60\gui\c_a_g - -copy %~dp0\..\examples60\gui\c_a_g\formulas\Circulo\*.bmp %~dp0\x86\examples60\gui\c_a_g\formulas\Circulo -copy %~dp0\..\examples60\gui\c_a_g\formulas\Paralelogramos\*.bmp %~dp0\x86\examples60\gui\c_a_g\formulas\Paralelogramos -copy %~dp0\..\examples60\gui\c_a_g\formulas\Trapezio\*.bmp %~dp0\x86\examples60\gui\c_a_g\formulas\Trapezio -copy %~dp0\..\examples60\gui\c_a_g\formulas\Triangulos\*.bmp %~dp0\x86\examples60\gui\c_a_g\formulas\Triangulos - -copy %~dp0\..\examples60\gui\agenda\*.l %~dp0\x86\examples60\gui\agenda -copy %~dp0\..\examples60\gui\agenda\*.prj %~dp0\x86\examples60\gui\agenda - -copy %~dp0\..\examples60\gui\graphs\*.l %~dp0\x86\examples60\gui\graphs -copy %~dp0\..\examples60\gui\graphs\*.prj %~dp0\x86\examples60\gui\graphs - -copy %~dp0\..\examples60\gui\helloworld\*.l %~dp0\x86\examples60\gui\helloworld -copy %~dp0\..\examples60\gui\helloworld\*.prj %~dp0\x86\examples60\gui\helloworld -copy %~dp0\..\examples60\gui\helloworld\*.xs %~dp0\x86\examples60\gui\helloworld - -copy %~dp0\..\examples60\db\sqlite\*.l %~dp0\x86\examples60\db\sqlite -copy %~dp0\..\examples60\db\sqlite\*.prj %~dp0\x86\examples60\db\sqlite - -copy %~dp0\..\examples60\files\textdb\*.l %~dp0\x86\examples60\files\textdb -copy %~dp0\..\examples60\files\textdb\*.prj %~dp0\x86\examples60\files\textdb -copy %~dp0\..\examples60\files\textdb\*.txt %~dp0\x86\examples60\files\textdb - -copy %~dp0\..\examples60\files\textfile\*.l %~dp0\x86\examples60\files\textfile -copy %~dp0\..\examples60\files\textfile\*.txt %~dp0\x86\examples60\files\textfile - -xcopy %~dp0\..\examples60\threads\*.l %~dp0\x86\examples60\threads /s -xcopy %~dp0\..\examples60\threads\*.prj %~dp0\x86\examples60\threads /s - -goto:eof -::ERRORS -::--------------------- -:CompilerError -echo The MSBuild returns error %ERRORLEVEL% -goto:eof diff --git a/build/i386/build_package_i386.script b/build/i386/build_package_i386.script deleted file mode 100755 index 2aa893271a..0000000000 --- a/build/i386/build_package_i386.script +++ /dev/null @@ -1,208 +0,0 @@ -#!/bin/bash -RELEASE=elena-6.6.2.i386-linux - -mkdir -p ../lib60 -mkdir -p /usr/share/elena -mkdir -p /etc/elena/ -mkdir -p /etc/elena/templates/ -mkdir -p /usr/lib/elena/core/x32/ -mkdir -p /usr/lib/elena/core/amd64/ -mkdir -p /usr/lib/elena/lib60 - -cp ../../bin/libelenart60.so /usr/lib/elena/ -cp ../../bin/libelenasm60.so /usr/lib/elena/ -# cp ../bin/libelenavm.so /usr/lib/elena/ -cp ../../bin/elena-cli /usr/bin/ - -cp ../../bin/elc60.config /etc/elena/ -cp ../../bin/elenart60.config /etc/elena/ -# cp ../bin/elenavm.config /etc/elena/ -cp ../../bin/templates/*.config /etc/elena/templates/ - -echo compiling data files - -../../bin/sg-cli ../../dat/sg/syntax60.txt -ret=$? -if [ $ret -eq 0 ] -then - echo . -else - echo "Failure" >&2 - exit 1 -fi - -# ../bin/elena-og ../dat/og/rules.txt -# ret=$? -# if [ $ret -eq 0 ] -# then -# echo . -# else -# echo "Failure" >&2 -# exit 1 -# fi - -../../bin/og-cli ../../dat/og/bc_rules60.txt -ret=$? -if [ $ret -eq 0 ] -then - echo . -else - echo "Failure" >&2 - exit 1 -fi - -../../bin/og-cli -s ../../dat/og/bt_rules60.txt -ret=$? -if [ $ret -eq 0 ] -then - echo . -else - echo "Failure" >&2 - exit 1 -fi - -cp ../../dat/og/*.dat /usr/share/elena/ -cp ../../dat/og/*.dat ../../bin -cp ../../dat/sg/syntax60.dat /usr/share/elena -cp ../../dat/sg/syntax60.dat ../../bin - -echo compiling assembly files - -../../bin/asm-cli -x86 ../../asm/x32/core60.asm /usr/lib/elena/core/x32 -ret=$? -if [ $ret -eq 0 ] -then - echo . -else - echo "Failure" >&2 - exit 1 -fi - -../../bin/asm-cli -x86 ../../asm/x32/core60_lnx.asm /usr/lib/elena/core/x32 -ret=$? -if [ $ret -eq 0 ] -then - echo . -else - echo "Failure" >&2 - exit 1 -fi - -# ../bin/elena-asm2binx ../asm/x32/coreapi.asm /usr/lib/elena/core/x32 -# ret=$? -# if [ $ret -eq 0 ] -# then -# echo . -# else -# echo "Failure" >&2 -# exit 1 -# fi - -echo compiling lib60 files - - ../../bin/asm-cli -bc32 ../../src60/core/system.core_routines.esm ../../lib60 - ret=$? - if [ $ret -eq 0 ] - then - echo . - else - echo "Failure" >&2 - exit 1 - fi - - ../../bin/elena-cli ../../src60/elena_api.linux.prjcol - ret=$? - if [ $ret -eq 2 ] - then - echo "Failure" >&2 - exit 1 - else - echo . - fi - - cp ../../lib60/*.nl /usr/lib/elena/lib60 - cp ../../lib60/*.dnl /usr/lib/elena/lib60 - - elena-cli ../../tests60/system_tests/system_tests.prj - ret=$? - if [ $ret -eq 2 ] - then - echo "Failure" >&2 - exit 1 - else - echo . - fi - - ../../tests60/system_tests/system_tests - ret=$? - if [ $ret -eq 2 ] - then - echo "Failure" >&2 - exit 1 - else - echo . - fi - - echo "Do you wish to create a package?" - select yn in "Yes" "No"; do - case $yn in - Yes ) break;; - No ) exit;; - esac - done - - mkdir -p ./$RELEASE/etc/elena/ - mkdir -p ./$RELEASE/etc/elena/templates/ - mkdir -p ./$RELEASE/usr/share/elena/ - mkdir -p ./$RELEASE/usr/lib/elena/core/x32/ - mkdir -p ./$RELEASE/usr/lib/elena/lib60/ - mkdir -p ./$RELEASE/usr/bin/ - mkdir -p ./$RELEASE/usr/elena-lang - - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/accumulator/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/ackermann/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/addfield/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/anonymrec/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/aplusb/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/applycallback/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/arithmeticint/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/arithmeval/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/arithmmean/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/arrayconcat/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/arraymode/ - - echo copying configuration - - cp ../../bin/*.config ./$RELEASE/etc/elena/ - cp ../../bin/templates/*.config ./$RELEASE/etc/elena/templates - - echo compiling shared files - - cp ../../dat/og/bt_rules60.dat ./$RELEASE/usr/share/elena - cp ../../dat/og/bc_rules60.dat ./$RELEASE/usr/share/elena - cp ../../dat/sg/syntax60.dat ./$RELEASE/usr/share/elena - - echo copying binaries - - cp ../../bin/elena-cli ./$RELEASE/usr/bin/ - cp ../../bin/libelenart60.so ./$RELEASE/usr/lib/elena/ - - echo compiling core - - cp /usr/lib/elena/core/x32/*.bin ./$RELEASE/usr/lib/elena/core/x32/ - - echo compiling lib60 - - cp /usr/lib/elena/lib60/*.* ./$RELEASE/usr/lib/elena/lib60/ - - cp -r ../../examples60 $RELEASE/usr/elena-lang - cp -r ../../src60 $RELEASE/usr/elena-lang - - mkdir ./$RELEASE/DEBIAN - cp ./control ./$RELEASE/DEBIAN - - dpkg-deb --build $RELEASE - - alien -r -c -v *.deb - -exit 0 \ No newline at end of file diff --git a/build/i386/control b/build/i386/control deleted file mode 100644 index e8744dca25..0000000000 --- a/build/i386/control +++ /dev/null @@ -1,12 +0,0 @@ -Package: elena-lang -Version: 6.6.2 -Architecture: i386 -Maintainer: Alex Rakov -Depends: libc6 (>= 2.1) -Section: elena-lang -Priority: optional -Homepage: https://elena-lang.github.io/ -Description: ELENA is a general-purpose, object-oriented, - polymorphic language with late binding. It features message dispatching - / manipulation, a script engine / interpreter and group object / mixin - support. Package includes command-line compiler,elena lib60 api,samples diff --git a/build/ppc64le/build_package_ppc64le.script b/build/ppc64le/build_package_ppc64le.script deleted file mode 100755 index c807419d4a..0000000000 --- a/build/ppc64le/build_package_ppc64le.script +++ /dev/null @@ -1,198 +0,0 @@ -#!/bin/bash -RELEASE=elena-6.6.2.ppc64le-linux - -mkdir -p ../lib60_64 -mkdir -p /usr/share/elena -mkdir -p /etc/elena/ -mkdir -p /etc/elena/templates/ -mkdir -p /usr/lib/elena/core/ppc64le/ -mkdir -p /usr/lib/elena/lib60_64 - -cp ../../bin/libelenart60_64.so /usr/lib/elena/ -cp ../../bin/libelenasm60_64.so /usr/lib/elena/ -# cp ../bin/libelenavm.so /usr/lib/elena/ -cp ../../bin/elena64-cli /usr/bin/ - -cp ../../bin/elc60.config /etc/elena/ -# cp ../bin/elenavm.config /etc/elena/ -cp ../../bin/templates/*.config /etc/elena/templates/ - -echo compiling data files - -../../bin/sg64-cli ../../dat/sg/syntax60.txt -ret=$? -if [ $ret -eq 0 ] -then - echo . -else - echo "Failure" >&2 - exit 1 -fi - -../../bin/og64-cli ../../dat/og/bc_rules60.txt -ret=$? -if [ $ret -eq 0 ] -then - echo . -else - echo "Failure" >&2 - exit 1 -fi - -../../bin/og64-cli -s ../../dat/og/bt_rules60.txt -ret=$? -if [ $ret -eq 0 ] -then - echo . -else - echo "Failure" >&2 - exit 1 -fi - -cp ../../dat/og/*.dat /usr/share/elena/ -cp ../../dat/sg/syntax60.dat /usr/share/elena - -echo compiling assembly files - -../../bin/asm64-cli -ppc64le ../../asm/ppc64le/core60.asm /usr/lib/elena/core/ppc64le -ret=$? -if [ $ret -eq 0 ] -then - echo . -else - echo "Failure" >&2 - exit 1 -fi - -../../bin/asm64-cli -ppc64le ../../asm/ppc64le/core60_lnx.asm /usr/lib/elena/core/ppc64le -ret=$? -if [ $ret -eq 0 ] -then - echo . -else - echo "Failure" >&2 - exit 1 -fi - -# ../bin/elena-asm2binx ../asm/x32/coreapi.asm /usr/lib/elena/core/x32 -# ret=$? -# if [ $ret -eq 0 ] -# then -# echo . -# else -# echo "Failure" >&2 -# exit 1 -# fi -# -# echo compiling lib50 files - - ../../bin/asm64-cli -bc64 ../../src60/core/system.core_routines.esm ../../lib60_64 - ret=$? - if [ $ret -eq 0 ] - then - echo . - else - echo "Failure" >&2 - exit 1 - fi - - ../../bin/elena64-cli ../../src60/elena_api.linux.prjcol - ret=$? - if [ $ret -eq 2 ] - then - echo "Failure" >&2 - exit 1 - else - echo . - fi - - cp ../../lib60_64/*.nl /usr/lib/elena/lib60_64 - cp ../../lib60_64/*.dnl /usr/lib/elena/lib60_64 - - elena64-cli ../../tests60/system_tests/system_tests.prj - ret=$? - if [ $ret -eq 2 ] - then - echo "Failure" >&2 - exit 1 - else - echo . - fi - - ../../tests60/system_tests/system_tests - ret=$? - if [ $ret -eq 2 ] - then - echo "Failure" >&2 - exit 1 - else - echo . - fi - - echo "Do you wish to create a package?" - select yn in "Yes" "No"; do - case $yn in - Yes ) break;; - No ) exit;; - esac - done - - mkdir -p ./$RELEASE/etc/elena/ - mkdir -p ./$RELEASE/etc/elena/templates/ - mkdir -p ./$RELEASE/usr/share/elena/ - mkdir -p ./$RELEASE/usr/lib/elena/core/ppc64le/ - mkdir -p ./$RELEASE/usr/lib/elena/lib60_64/ - mkdir -p ./$RELEASE/usr/bin/ - mkdir -p ./$RELEASE/usr/elena-lang - - mkdir -p ./$RELEASE/usr/elena-lang/examples60/console/helloworld/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/console/sum/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/console/words/ - - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/accumulator/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/ackermann/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/addfield/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/anonymrec/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/aplusb/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/applycallback/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/arithmeticint/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/arithmeval/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/arithmmean/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/arrayconcat/ - mkdir -p ./$RELEASE/usr/elena-lang/examples60/rosetta/arraymode/ - - echo copying configuration - - cp ../../bin/*.config ./$RELEASE/etc/elena/ - cp ../../bin/templates/*.config ./$RELEASE/etc/elena/templates - - echo compiling shared files - - cp ../../dat/og/bt_rules60.dat ./$RELEASE/usr/share/elena - cp ../../dat/og/bc_rules60.dat ./$RELEASE/usr/share/elena - cp ../../dat/sg/syntax60.dat ./$RELEASE/usr/share/elena - - echo copying binaries - - cp ../../bin/elena64-cli ./$RELEASE/usr/bin/ - cp ../../bin/libelenart60_64.so ./$RELEASE/usr/lib/elena/ - - echo compiling core - - cp /usr/lib/elena/core/ppc64le/*.bin ./$RELEASE/usr/lib/elena/core/ppc64le/ - - echo compiling lib60 - - cp /usr/lib/elena/lib60_64/*.* ./$RELEASE/usr/lib/elena/lib60_64/ - - cp -r ../../examples60 $RELEASE/usr/elena-lang - cp -r ../../src60 $RELEASE/usr/elena-lang - - mkdir ./$RELEASE/DEBIAN - cp ./control ./$RELEASE/DEBIAN - - dpkg-deb --build $RELEASE - - alien -r -c -v *.deb - -exit 0 diff --git a/build/ppc64le/control b/build/ppc64le/control deleted file mode 100644 index 3f0a0e7cc7..0000000000 --- a/build/ppc64le/control +++ /dev/null @@ -1,12 +0,0 @@ -Package: elena-lang -Version: 6.6.2 -Architecture: ppc64le -Maintainer: Alex Rakov -Depends: libc6 (>= 2.1) -Section: elena-lang -Priority: optional -Homepage: https://elena-lang.github.io/ -Description: ELENA is a general-purpose, object-oriented, - polymorphic language with late binding. It features message dispatching - / manipulation, a script engine / interpreter and group object / mixin - support. Package includes command-line compiler,elena lib60 api,samples diff --git a/build/rebuild_data60_x64.bat b/build/rebuild_data60_x64.bat deleted file mode 100644 index cbc329c444..0000000000 --- a/build/rebuild_data60_x64.bat +++ /dev/null @@ -1,53 +0,0 @@ -REM NOTE : the script MUST be called from the root folder - -bin\sg64-cli dat\sg\syntax60.txt -@echo off -if %ERRORLEVEL% EQU -1 GOTO Asm2BinError -@echo on - -move dat\sg\syntax60.dat bin - -bin\sg64-cli dat\sg\syntax50.txt -@echo off -if %ERRORLEVEL% EQU -1 GOTO Asm2BinError -@echo on - -move dat\sg\syntax50.dat bin - -bin\og64-cli dat\og\bc_rules60.txt -@echo off -if %ERRORLEVEL% EQU -1 GOTO Asm2BinError -@echo on -move dat\og\bc_rules60.dat bin - -bin\og64-cli -s dat\og\bt_rules60.txt -@echo off -if %ERRORLEVEL% EQU -1 GOTO Asm2BinError -@echo on -move dat\og\bt_rules60.dat bin - -@echo off -echo === Done === -@echo on - -@echo off -goto:eof -@echo on - -:Asm2BinError -echo ASM2BINX returns error %ERRORLEVEL% -@echo off -goto:eof -@echo on - -:CompilerError -echo ELC returns error %ERRORLEVEL% -@echo off -goto:eof -@echo on - -:TestError -echo System tests fail %ERRORLEVEL% -@echo off -goto:eof -@echo on diff --git a/build/rebuild_data60_x86.bat b/build/rebuild_data60_x86.bat deleted file mode 100644 index 961552a4b8..0000000000 --- a/build/rebuild_data60_x86.bat +++ /dev/null @@ -1,53 +0,0 @@ -REM NOTE : the script MUST be called from the root folder - -.\bin\sg-cli dat\sg\syntax60.txt -@echo off -if %ERRORLEVEL% EQU -1 GOTO Asm2BinError -@echo on - -move dat\sg\syntax60.dat bin - -.\bin\sg-cli dat\sg\syntax50.txt -@echo off -if %ERRORLEVEL% EQU -1 GOTO Asm2BinError -@echo on - -move dat\sg\syntax50.dat bin - -bin\og-cli dat\og\bc_rules60.txt -@echo off -if %ERRORLEVEL% EQU -1 GOTO Asm2BinError -@echo on -move dat\og\bc_rules60.dat bin - -bin\og-cli -s dat\og\bt_rules60.txt -@echo off -if %ERRORLEVEL% EQU -1 GOTO Asm2BinError -@echo on -move dat\og\bt_rules60.dat bin - -@echo off -echo === Done === -@echo on - -@echo off -goto:eof -@echo on - -:Asm2BinError -echo ASM2BINX returns error %ERRORLEVEL% -@echo off -goto:eof -@echo on - -:CompilerError -echo ELC returns error %ERRORLEVEL% -@echo off -goto:eof -@echo on - -:TestError -echo System tests fail %ERRORLEVEL% -@echo off -goto:eof -@echo on \ No newline at end of file diff --git a/build/rebuild_lib60_x64.bat b/build/rebuild_lib60_x64.bat deleted file mode 100644 index fe8ddd239c..0000000000 --- a/build/rebuild_lib60_x64.bat +++ /dev/null @@ -1,81 +0,0 @@ -REM NOTE : the script MUST be called from the root folder - -bin\asm64-cli -amd64 asm\amd64\core60.asm bin\amd64 -@echo off -if %ERRORLEVEL% EQU -1 GOTO Asm2BinError -@echo on - -bin\asm64-cli -amd64 asm\amd64\core60_win.asm bin\amd64 -@echo off -if %ERRORLEVEL% EQU -1 GOTO Asm2BinError -@echo on - -bin\asm64-cli -amd64 asm\amd64\corex60.asm bin\amd64 -@echo off -if %ERRORLEVEL% EQU -1 GOTO Asm2BinError -@echo on - -bin\asm64-cli -amd64 asm\amd64\corex60_win.asm bin\amd64 -@echo off -if %ERRORLEVEL% EQU -1 GOTO Asm2BinError -@echo on - -bin\asm64-cli -amd64 asm\amd64\core60_win_client.asm bin\amd64 -@echo off -if %ERRORLEVEL% EQU -1 GOTO Asm2BinError -@echo on - -bin\asm64-cli -bc64 src60\core\system.core_routines.esm lib60_64 -@echo off -if %ERRORLEVEL% EQU -1 GOTO Asm2BinError -@echo on - -bin\asm64-cli -bc64 src60\core\system.win_core_routines.esm lib60_64 -@echo off -if %ERRORLEVEL% EQU -1 GOTO Asm2BinError -@echo on - -bin\elena64-cli src60\elena_api.prjcol -@echo off -if %ERRORLEVEL% EQU -2 GOTO CompilerError -@echo on - -bin\elena64-cli tests60\system_tests\system_tests.prj -@echo off -if %ERRORLEVEL% EQU -2 GOTO CompilerError -@echo on - -echo system api test for amd64 -copy bin\elenart60_64.dll tests60\system_tests\ -copy bin\elenasm60_64.dll tests60\system_tests\ - -tests60\system_tests\system_tests64.exe -@echo off -if %ERRORLEVEL% NEQ 0 GOTO TestError -@echo on - -@echo off -echo === Done === -@echo on - -@echo off -goto:eof -@echo on - -:Asm2BinError -echo ASM2BINX returns error %ERRORLEVEL% -@echo off -goto:eof -@echo on - -:CompilerError -echo ELC returns error %ERRORLEVEL% -@echo off -goto:eof -@echo on - -:TestError -echo System tests fail %ERRORLEVEL% -@echo off -goto:eof -@echo on diff --git a/build/rebuild_lib60_x86.bat b/build/rebuild_lib60_x86.bat deleted file mode 100644 index 9da306d99f..0000000000 --- a/build/rebuild_lib60_x86.bat +++ /dev/null @@ -1,116 +0,0 @@ -REM NOTE : the script MUST be called from the root folder - -bin\asm-cli -x86 asm\x32\core60.asm bin\x32 -@echo off -if %ERRORLEVEL% EQU -1 GOTO Asm2BinError -@echo on - -bin\asm-cli -x86 asm\x32\corex60.asm bin\x32 -@echo off -if %ERRORLEVEL% EQU -1 GOTO Asm2BinError -@echo on - -bin\asm-cli -x86 asm\x32\core60_win.asm bin\x32 -@echo off -if %ERRORLEVEL% EQU -1 GOTO Asm2BinError -@echo on - -bin\asm-cli -x86 asm\x32\corex60_win.asm bin\x32 -@echo off -if %ERRORLEVEL% EQU -1 GOTO Asm2BinError -@echo on - -bin\asm-cli -x86 asm\x32\core60_win_client.asm bin\x32 -@echo off -if %ERRORLEVEL% EQU -1 GOTO Asm2BinError -@echo on - -bin\asm-cli -bc32 src60\core\system.core_routines.esm lib60 -@echo off -if %ERRORLEVEL% EQU -1 GOTO Asm2BinError -@echo on - -bin\asm-cli -bc32 src60\core\system.win_core_routines.esm lib60 -@echo off -if %ERRORLEVEL% EQU -1 GOTO Asm2BinError -@echo on - -bin\elena-cli src60\elena_api.prjcol -@echo off -if %ERRORLEVEL% EQU -2 GOTO CompilerError -@echo on - -bin\ldoc system doc\api -bin\ldoc system'collections'threadsafe doc\api -bin\ldoc system'routines doc\api -bin\ldoc system'runtime doc\api -bin\ldoc system'threading doc\api -bin\ldoc system'dynamic doc\api -bin\ldoc system'drawing doc\api -bin\ldoc system'winforms doc\api -bin\ldoc system'net doc\api -bin\ldoc extensions doc\api -bin\ldoc extensions'routines doc\api -bin\ldoc extensions'scripting doc\api -bin\ldoc extensions'dynamic doc\api -bin\ldoc extensions'io doc\api -bin\ldoc cellular doc\api -bin\ldoc algorithms doc\api -bin\ldoc sqlite doc\api -bin\ldoc forms doc\api -bin\ldoc ltests doc\api -bin\ldoc net doc\api - -bin\elena-cli tests60\system_tests\system_tests.prj -@echo off -if %ERRORLEVEL% EQU -2 GOTO CompilerError -@echo on - -echo system api test for x86 -copy bin\elenart60.dll tests60\system_tests\ -copy bin\elenasm60.dll tests60\system_tests\ - -tests60\system_tests\system_tests.exe -@echo off -if %ERRORLEVEL% NEQ 0 GOTO TestError -@echo on - -REM bin\elena-cli tests60\script_tests\script_tests.prj -REM @echo off -REM if %ERRORLEVEL% EQU -2 GOTO CompilerError -REM @echo on - -REM echo system api test for x86 -REM copy bin\elenart60.dll tests60\script_tests\ -REM copy bin\elenasm60.dll tests60\script_tests\ - -REM tests60\script_tests\script_tests.exe -REM @echo off -REM if %ERRORLEVEL% NEQ 0 GOTO TestError -REM @echo on - -@echo off -echo === Done === -@echo on - -@echo off -goto:eof -@echo on - -:Asm2BinError -echo ASM2BINX returns error %ERRORLEVEL% -@echo off -goto:eof -@echo on - -:CompilerError -echo ELC returns error %ERRORLEVEL% -@echo off -goto:eof -@echo on - -:TestError -echo System tests fail %ERRORLEVEL% -@echo off -goto:eof -@echo on \ No newline at end of file