diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e0f1c770d0..1bbb62cde9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,10 +14,8 @@ jobs: $url = "http://static.red-lang.org/build/rebview.exe" $output = "$Env:GITHUB_WORKSPACE\rebview.exe" (New-Object System.Net.WebClient).DownloadFile($url, $output) - - name: run view test - run: | - rebview.exe -qws tests\run-core-tests.r --batch - rebview.exe -qws system\tests\run-all.r --batch + - name: run core test + run: rebview.exe -qws tests\run-core-tests.r --batch shell: cmd - uses: actions/upload-artifact@v1 @@ -26,6 +24,27 @@ jobs: name: core-test-log path: quick-test/quick-test.log + Core-Debug: + + runs-on: windows-latest + + steps: + - uses: actions/checkout@v1 + - name: setup red repo + run: | + $url = "http://static.red-lang.org/build/rebview.exe" + $output = "$Env:GITHUB_WORKSPACE\rebview.exe" + (New-Object System.Net.WebClient).DownloadFile($url, $output) + - name: run core test + run: rebview.exe -qws tests\run-core-tests.r --batch --debug + shell: cmd + + - uses: actions/upload-artifact@v1 + if: failure() + with: + name: core-debug-test-log + path: quick-test/quick-test.log + View: runs-on: windows-latest @@ -79,10 +98,8 @@ jobs: $url = "http://static.red-lang.org/build/rebview.exe" $output = "$Env:GITHUB_WORKSPACE\rebview.exe" (New-Object System.Net.WebClient).DownloadFile($url, $output) - - name: run view test - run: | - rebview.exe -qws tests\run-all.r --each - rebview.exe -qws system\tests\run-all.r --each + - name: run each test + run: rebview.exe -qws tests\run-core-tests.r --ci-each shell: cmd - uses: actions/upload-artifact@v1 @@ -90,3 +107,45 @@ jobs: with: name: each-test-log path: quick-test/quick-test.log + + Each-Mode-Debug: + + runs-on: windows-latest + + steps: + - uses: actions/checkout@v1 + - name: setup red repo + run: | + $url = "http://static.red-lang.org/build/rebview.exe" + $output = "$Env:GITHUB_WORKSPACE\rebview.exe" + (New-Object System.Net.WebClient).DownloadFile($url, $output) + - name: run each test + run: rebview.exe -qws tests\run-core-tests.r --ci-each --debug + shell: cmd + + - uses: actions/upload-artifact@v1 + if: failure() + with: + name: each-debug-test-log + path: quick-test/quick-test.log + + Red-System-Test: + + runs-on: windows-latest + + steps: + - uses: actions/checkout@v1 + - name: setup red repo + run: | + $url = "http://static.red-lang.org/build/rebview.exe" + $output = "$Env:GITHUB_WORKSPACE\rebview.exe" + (New-Object System.Net.WebClient).DownloadFile($url, $output) + - name: run Red/System test + run: rebview.exe -qws system\tests\run-all.r --batch + shell: cmd + + - uses: actions/upload-artifact@v1 + if: failure() + with: + name: rs-test-log + path: quick-test/quick-test.log \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 5fc69d2da2..dca625cf2f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,8 +30,10 @@ env: matrix: -# allow_failures: # Enable to disregard ARM build failures -# - env: OS=arm # Enable to disregard ARM build failures + allow_failures: # Enable to disregard ARM build failures + - env: OS=armel # Enable to disregard ARMel build failures + - env: OS=armhf # Enable to disregard ARMhf build failures + include: @@ -62,7 +64,7 @@ matrix: --entrypoint /red/quick-test/runnable/arm-tests/red/run-all.sh balenalib/armv5e-debian:latest - > - docker run -v ${PWD}:/red + travis_wait 15 docker run -v ${PWD}:/red -e LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/red/quick-test/runnable/arm-tests/system/' -w /red/quick-test/runnable/arm-tests/system/ --entrypoint /red/quick-test/runnable/arm-tests/system/run-all.sh @@ -81,7 +83,7 @@ matrix: --entrypoint /red/quick-test/runnable/arm-tests/red/run-all.sh balenalib/raspberry-pi2-debian:latest - > - docker run -v ${PWD}:/red + travis_wait 15 docker run -v ${PWD}:/red -e LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/red/quick-test/runnable/arm-tests/system/' -w /red/quick-test/runnable/arm-tests/system/ --entrypoint /red/quick-test/runnable/arm-tests/system/run-all.sh diff --git a/boot.red b/boot.red index eceb214486..9ff20c9a57 100644 --- a/boot.red +++ b/boot.red @@ -18,26 +18,25 @@ Red [ #include %environment/routines.red #include %environment/scalars.red #include %environment/colors.red + + #register-intrinsics #include %environment/functions.red #include %environment/system.red - #include %environment/lexer.red #include %environment/operators.red - #register-intrinsics - - #include %environment/codecs/png.red - #include %environment/codecs/jpeg.red - #include %environment/codecs/bmp.red - #include %environment/codecs/gif.red - #include %environment/codecs/json.red - #include %environment/codecs/csv.red + #include %environment/codecs/PNG.red + #include %environment/codecs/JPEG.red + #include %environment/codecs/BMP.red + #include %environment/codecs/GIF.red + #include %environment/codecs/JSON.red + #include %environment/codecs/CSV.red #include %environment/reactivity.red ;-- requires SET intrinsic #include %environment/networking.red #include %utils/preprocessor.r ;-- temporary code -- - #if not find [Windows macOS] config/OS [ + #if not find [Windows macOS Linux] config/OS [ unset [event! image!] image?: func ["Returns true if the value is this type" value [any-type!]][false] ] diff --git a/build/includes.r b/build/includes.r index 17433017b2..0373ff81ba 100644 --- a/build/includes.r +++ b/build/includes.r @@ -25,7 +25,6 @@ write %build/bin/sources.r set-cache [ ;%css-colors.red %datatypes.red %functions.red - %lexer.red %natives.red %networking.red %operators.red @@ -34,12 +33,12 @@ write %build/bin/sources.r set-cache [ %scalars.red %system.red %codecs/ [ - %bmp.red - %gif.red - %jpeg.red - %png.red - %csv.red - %json.red + %BMP.red + %GIF.red + %JPEG.red + %PNG.red + %CSV.red + %JSON.red ] %console/ [ %auto-complete.red @@ -85,6 +84,8 @@ write %build/bin/sources.r set-cache [ %dtoa.reds %hashtable.reds %interpreter.reds + %lexer.reds + %lexer-transitions.reds %macros.reds %natives.reds %ownership.reds @@ -110,6 +111,7 @@ write %build/bin/sources.r set-cache [ %common.reds %context.reds %datatype.reds + %date.reds %email.reds %error.reds %event.reds @@ -118,14 +120,17 @@ write %build/bin/sources.r set-cache [ %function.reds %get-path.reds %get-word.reds + %handle.reds %hash.reds %image.reds + %image-utils.reds %integer.reds %issue.reds %lit-path.reds %lit-word.reds %logic.reds %map.reds + %money.reds %native.reds %none.reds %op.reds @@ -136,6 +141,7 @@ write %build/bin/sources.r set-cache [ %percent.reds %point.reds %port.reds + %ref.reds %refinement.reds %routine.reds %series.reds @@ -151,9 +157,8 @@ write %build/bin/sources.r set-cache [ %unset.reds %url.reds %vector.reds + %vector2d.reds %word.reds - %handle.reds - %date.reds ] %platform/ [ %android.reds @@ -165,6 +170,7 @@ write %build/bin/sources.r set-cache [ %win32.reds %COM.reds %image-gdiplus.reds + %image-gdk.reds %image-quartz.reds %win32-ansi.reds %win32-print.reds @@ -221,6 +227,23 @@ write %build/bin/sources.r set-cache [ %tab-panel.reds %text-box.reds ] + %gtk3/ [ + %comdlgs.reds + %draw.reds + %events.reds + %css.reds + %color.reds + %font.reds + %gtk.reds + %gui.reds + %handlers.reds + %menu.reds + %para.reds + %rules.red + %tab-panel.reds + %text-box.reds + %text-list.reds + ] %test/ [ %draw.reds %events.reds diff --git a/compiler.r b/compiler.r index b0c336f62a..fbc9cc7ef7 100644 --- a/compiler.r +++ b/compiler.r @@ -36,6 +36,7 @@ red: context [ rebol-gctx: bind? 'rebol expr-stack: make block! 8 current-call: none + currencies: none ;-- extra user-defined currency codes from script's header unless value? 'Red [red: none] ;-- for %preprocessor to load @@ -69,6 +70,7 @@ red: context [ s-counter: 0 ;-- series suffix counter depth: 0 ;-- expression nesting level counter max-depth: 0 + root-slots: 0 ;-- extra root block slots counter booting?: none ;-- YES: compiling boot script nl: newline set 'float! 'float ;-- type names not defined in Rebol @@ -103,7 +105,7 @@ red: context [ standard-modules: [ ;-- Name ------ Entry file -------------- OS availability ----- - View %modules/view/view.red [Windows macOS] + View %modules/view/view.red [Windows macOS Linux] ] func-constructors: [ @@ -241,6 +243,25 @@ red: context [ clear next mark ;-- remove code at "upper" level ] + to-nibbles: func [src [string!] /local out][ + out: make string! 11 + foreach [high low] src [ + append out to char! add + shift/left (to integer! high - #"0") 4 + to integer! low - #"0" + ] + out + ] + + to-currency-code: func [code [string!] /local pos][ + code: to word! code + case [ + pos: find extracts/currencies code [index? pos] + all [currencies pos: find currencies code][(index? pos) + length? extracts/currencies] + 'else [0] + ] + ] + any-function?: func [value [word!]][ find [native! action! op! function! routine!] value ] @@ -281,6 +302,8 @@ red: context [ unicode-char?: func [value][value/1 = #"'"] float-special?: func [value][value/1 = #"."] tuple-value?: func [value][value/1 = #"~"] + money-value?: func [value][value/1 = #"$"] + ref-value?: func [value][value/1 = #"@"] percent-value?: func [value][#"%" = last value] date-special?: func [value][all [block? value value/1 = #!date!]] @@ -414,7 +437,7 @@ red: context [ ] emit decorate-symbol/no-alias name ][ - if new: select-ssa name [name: new] ;@@ add a check for function! type + if all [new: select-ssa name not find-function new new][name: new] emit case [ ;-- global word all [ literal @@ -450,7 +473,7 @@ red: context [ append/only blk duplicate-symbol name ] ][ - if new: select-ssa name [name: new] ;@@ add a check for function! type + if all [new: select-ssa name not find-function new new][name: new] either get? [ either all [ rebol-gctx <> obj @@ -820,7 +843,7 @@ red: context [ reduce [var set-var] ] - add-symbol: func [name [word!] /with original /local sym id alias][ + add-symbol: func [name [word!] /only /with original /local sym id alias][ unless find/case symbols name [ if find symbols name [ if find/case/skip aliases name 2 [exit] @@ -829,10 +852,11 @@ red: context [ ] sym: decorate-symbol name id: 1 + ((length? symbols) / 2) - repend symbols [name reduce [sym id]] + unless only [repend symbols [name reduce [sym id]]] repend sym-table [ to set-word! sym 'word/load mold any [original name] ] + root-slots: root-slots + 1 new-line skip tail sym-table -3 on ] ] @@ -847,10 +871,6 @@ red: context [ new ] - get-symbol-id: func [name [word!]][ - second select symbols name - ] - add-global: func [name [word!]][ unless any [ local-word? name @@ -1066,7 +1086,7 @@ red: context [ ] path: none ][ - bind path/1 'rebol ;-- force binding to global context + path/1: bind path/1 'rebol ;-- force binding to global context ] ] path @@ -1679,7 +1699,7 @@ red: context [ comp-literal: func [ /inactive /with val - /local value char? special? percent? map? tuple? dt-special? name w make-block type idx zone + /local value char? special? percent? map? tuple? money? ref? dt-special? name w make-block type idx zone ][ make-block: [ value: to block! value @@ -1701,6 +1721,8 @@ red: context [ special?: float-special? value percent?: percent-value? value tuple?: tuple-value? value + money?: money-value? value + ref?: ref-value? value ] ] scalar? :value @@ -1742,8 +1764,22 @@ red: context [ emit to integer! copy/part skip bin -8 -4 insert-lf -5 ] + money? [ + emit 'money/push + value: to string! next value + emit pick [true false] value/4 = #"-" + emit to-currency-code copy/part value 3 + emit to-nibbles copy skip value 4 + ] + ref? [ + idx: redbin/emit-string/root next value ;-- issue! is an any-string! in Rebol2 + emit 'ref/push + emit compose [as red-string! get-root (idx)] + insert-lf -5 + ] find [refinement! issue!] type?/word :value [ - add-symbol w: to word! form value + w: to word! form value + either issue? :value [add-symbol/only w][add-symbol w] type: to word! form type? :value either all [not issue? :value local-word? w][ @@ -1998,7 +2034,7 @@ red: context [ ] ctx: add-context spec - blk-idx: redbin/emit-context/root ctx spec no yes + blk-idx: redbin/emit-context/root ctx spec no yes 'object redirect-to literals [ ;-- store spec and body blocks emit compose [ @@ -2058,7 +2094,7 @@ red: context [ unless all [empty? locals-stack not iterator-pending?][ ;-- in a function or iteration block emit compose [ - (to set-word! ctx) _context/clone get-root (blk-idx) ;-- rebuild context + (to set-word! ctx) _context/clone-words get-root (blk-idx) CONTEXT_OBJECT ;-- rebuild context ] insert-lf -3 ] @@ -2335,7 +2371,10 @@ red: context [ comp-expression/close-path ;@@ optimize case for literal counter emit-argument-type-check 0 'loop 'stack/arguments - emit compose [(set-name) integer/get*] + emit compose [ + natives/coerce-counter* + (set-name) integer/get* + ] insert-lf -2 emit compose/deep [ either (name) <= 0 [(set-last-none)] @@ -2421,14 +2460,13 @@ red: context [ ] ][ [ + 'natives/coerce-counter* set-lim 'integer/get* '_context/set-integer name lim set-cnt 0 ] ] - insert-lf -2 - insert-lf -5 - insert-lf -7 + foreach idx [-2 -5 -7 -8][insert-lf idx] emit-stack-reset emit-open-frame 'repeat @@ -2833,7 +2871,7 @@ red: context [ push-locals symbols ;-- store spec and body blocks ctx: push-context copy symbols - ctx-idx: redbin/emit-context/root ctx symbols yes no + ctx-idx: redbin/emit-context/root ctx symbols yes no 'function spec-idx: redbin/emit-block spec redirect-to literals [ emit compose [ @@ -4245,36 +4283,6 @@ red: context [ ] true ] - #load [ ;-- temporary directive - change/part/only pc to do pc/2 pc/3 3 - comp-expression ;-- continue expression fetching - true - ] - #version [ - change pc form load-cache %version.r - comp-expression - true - ] - #git [ - change/only pc load-cache %build/git.r - comp-expression - true - ] - #build-date [ ;-- UTC date - change pc use [date][ - date: now - date: date - date/zone - date/zone: none - date - ] - comp-expression - true - ] - #build-config [ - change/only pc load find mold job #"[" - comp-expression - true - ] #register-intrinsics [ ;-- internal boot-level directive if booting? [ pc: next pc @@ -4683,8 +4691,8 @@ red: context [ unless empty? sys-global [ process-calls/global sys-global ;-- lazy #call processing ] - slots: redbin/index + 3000 - if job/dev-mode? [slots: slots + 100'000] ;-- Cannot know how many slot will be needed by the app + slots: redbin/index + 3000 + root-slots + if job/dev-mode? [slots: slots + 100'000] ;-- Cannot know how many slots will be needed by the app change/only find out slots pos: third last out @@ -4769,7 +4777,7 @@ red: context [ process-calls/global sys-global ;-- lazy #call processing ] - change/only find out redbin/index + 3000 + change/only find out redbin/index + 3000 + root-slots change/only find last out