View documentation | View script | License |
Download script | History | Other scripts by: arnold |
28-Mar 19:29 UTC
[0.047] 15.812k
[0.047] 15.812k
Archive version of: redcompiler.r ... version: 3 ... arnold 29-Nov-2012REBOL [ Title: "Red compiler and Runner" File: %redcompiler.r Date: 29-nov-2012 Author: "Arnold van Hofwegen" Purpose: "GUI to help with compile and run your Red(/System) scripts." ] ;---------------------------------------------------------- ; GUI for compiling Red(/System) scripts. ; How to use this script? ; Select the map red-system for the directory ; Select your script (in the tests directory). ; Hit compile and hope for the best. ; When your script compiles run it as usual on your system. ; if not, learn to type unview/all and reset your directory. ;-- ; Function ;-- compile-script: func [/local args-string compile-message compile-string filnam confirm-compile ] [ print "compiling" compile-message: copy "" compile-string: copy "" dir: txt-red-dir/text filnam: replace copy txt-red-script/text dir "" ;--------------- ; normal compile ; do/args %red.r "%tests/hello.red" ; do/args %rsc.r "%tests/hello.reds" ;--------------- either ".reds" = to-string suffix? filnam [ ;print "Red/System" compile-string: append compile-string "do/args %rsc.r " filnam: replace filnam "red-system/" "" ][ compile-string: append compile-string "do/args %red.r " ] compile-string: append compile-string {"} ;-- " ;-------- ; Verbose ; do/args %rsc.r "-v 5 %tests/hello.reds" ;-- args-string: copy "" probe chk-verbose/data if chk-verbose/data [ args-string: "-v " args-string: append args-string chc-verbose/text args-string: append args-string " " ] compile-string: append compile-string args-string ;---------------- ; Cross compiling ; Target ID Description ; MSDOS Windows, x86, console-only applications ; Windows Windows, x86, native applications ; Linux GNU/Linux, x86 ; Linux-ARM GNU/Linux, ARMv5 ; Darwin Mac OS X Intel, console-only applications ; Syllable Syllable OS, x86 ; Android Android, ARMv5 ; From Windows, to emit Linux executables: ; do/args %rsc.r "-t Linux %tests/hello.reds" ; From Linux, to emit Windows console executables: ; do/args %rsc.r "-t MSDOS %tests/hello.reds" ;-- if chk-cross/data [ args-string: "-t " compile-string: append compile-string args-string if rd-dos/data [compile-string: append compile-string "MSDOS "] if rd-win/data [compile-string: append compile-string "Windows "] if rd-lin/data [compile-string: append compile-string "Linux "] if rd-lia/data [compile-string: append compile-string "Linux-Arm "] if rd-dar/data [compile-string: append compile-string "Darwin "] ;-- only console if rd-mac/data [compile-string: append compile-string "Darwin "] ;-- not yet available if rd-syl/data [compile-string: append compile-string "Syllable "] if rd-and/data [compile-string: append compile-string "Android "] ] compile-string: append compile-string "%" compile-string: append compile-string filnam compile-string: append compile-string {"} ;-- " compile-message: append compile-message "Compile using the string: " compile-message: append compile-message compile-string confirm-compile: request/confirm compile-message either confirm-compile [ ;alert "Sorry not implemented yet!" do compile-string ][ alert "Too bad, I wanted to do that!" ] ] ;********************************************************** ; Layout applicatiescherm ;********************************************************** cross-comp-panel: layout [ origin 2x2 size 400x100 backcolor white across rd-dos: radio false 'crosstype text "MSdos" rd-win: radio false 'crosstype text "Windows" rd-dar: radio false 'crosstype text "Darwin Mac OS X console" return rd-mac: radio false 'crosstype text "Mac OS X" rd-lin: radio true 'crosstype text "Linux" rd-syl: radio false 'crosstype text "Syllable" return rd-lia: radio false 'crosstype text "Linux-ARM" rd-and: radio false 'crosstype text "Android" ] empty-panel: layout [ origin 2x2 size 400x100 ] main: layout [ origin 20x20 below btn-request-dir: button 300 "Where is your Red directory?" [txt-red-dir/text: request-dir "Select your Red directory" change-dir txt-red-dir/text show txt-red-dir] txt-red-dir-here: text 250 " Your Red(/System) scripts are in:" txt-red-dir: text 300 " Please choose the directory " btn-request-file: button 300 "Which Red(/System) script to compile?" [txt-red-script/text: request-file/only "Select your Red script" show txt-red-script] txt-red-script: text 500 " Please give the script to compile " across chk-verbose: check text "Compile using verbose mode" chc-verbose: choice "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" return chk-cross: check [either chk-cross/data [ pnl-crossinfo/pane: cross-comp-panel ][ pnl-crossinfo/pane: empty-panel ] show pnl-crossinfo] txt-cross: text "Cross compiling" pnl-crossinfo: box 400x100 white return btn-compile: button "Compile script" [ compile-script ] btn-quit: button "Stop" [;change-dir save-dir unview/all] ] ;********************************************************** ; Uiteindelijke programma ;********************************************************** save-dir: what-dir cross-comp-panel/offset: 0x0 empty-panel/offset: 0x0 pnl-crossinfo/pane: empty-panel view main change-dir save-dir Notes
|