root/create-distribution.r

Revision 75, 2.1 kB (checked in by ashley, 20 months ago)

Fixes for problems introduced in build 74
Widget documentation improved

Line 
1REBOL [
2        Title:          "Create RebGUI distribution"
3        Owner:          "Ashley G. Trüter"
4        Purpose:        "Merge RebGUI source files into a single file and remove unnecessary white-space."
5        History: {
6                30      Added build# to header
7                33      Cleaned up display and auto obtain build# from ctx-rebgui/build
8                65      Cleaned up comments
9                66      Removed need to load %rebgui-ctx.r
10                68      Added quiet mode when called from another script
11                72      Added quiet option if called from another script, eg. do/args %create-distribution.r 'quiet
12                73      Replaced trim/lines with replace/all "^/^/" "^/" so 'source works
13        }
14]
15
16build: to integer! trim/all skip copy/part find read %rebgui-ctx.r "build:" 12 6
17
18code: make string! 150000
19insert code rejoin ["REBOL [version: " build "]"]
20insert tail code mold/only/flat load %rebgui-ctx.r
21
22files: 1
23bytes: size? %rebgui-ctx.r
24
25string: find code "#include"
26
27while [not none? string] [
28        ;       find start and end of #include
29        p1: index? string
30        p2: index? find string ".r"
31        ;       extract source file name
32        f: second to block! copy/part at code p1 2 + p2 - p1
33        unless system/script/args [
34                if find f "/" [prin "^-"]
35                print f
36        ]
37        ;       increment file and byte count
38        files: files + 1
39        bytes: bytes + size? f
40        ;       replace #include with referenced source file
41        remove/part at code p1 2 + p2 - p1
42        insert at code p1 mold/only/flat load f
43        ;       find next #include
44        string: find code "#include"
45]
46
47;       remove extra newlines
48replace/all code "^/^/" "^/"
49;       tip compression
50replace/all code "^^-^^-^^-" ""
51replace/all code "^^-^^-" ""
52replace/all code "tip: {^/" "tip:{"
53replace/all code "^/^^-} " "}"
54;       compact block delimiters
55replace/all code "[ " "["
56replace/all code " ]" "]"
57replace/all code " [" "["
58replace/all code "] " "]"
59;       compact expression delimiters
60replace/all code "( " "("
61replace/all code " )" ")"
62
63write %rebgui.r code
64
65unless system/script/args [
66        print rejoin [
67                "^/Build# ==> " build " !!! Specified in %rebgui-ctx.r (ctx-rebgui/build) !!!"
68                "^/Files ===> " files
69                "^/Source ==> " bytes " bytes"
70                "^/Target ==> " n: size? %rebgui.r " bytes"
71                "^/Saving ==> " to integer! 1 - (n / bytes) * 100 "%"
72        ]
73        halt
74]
Note: See TracBrowser for help on using the browser.