Drag and Drop on Window

February 13th, 2014

This script show how to use shell32.dll in order to have use “drag and drop” to move file inside you application.
I launched the script and obtained:
Drag some files and drop them on this window...

then I dropped a file in the window and obtained:
You dropped 1 files.
at coordinate 63x313
1. /C/Documents and Settings/max/Desktop/Good day.pdf
Finishing drag operation
Unregistering window from DragAcceptFiles queue

Here is the source code:

REBOL [
    Title:   "System Port - Drag Accept Demo"
    File:   %sys-port-drag-accept.r
    Author: "Gregg Irwin"
    EMail:   greggirwin@acm.org
    Version: 0.0.1
    Date:     25-sep-2003
    Purpose: {
        Demo using system port to catch WM_DROPFILE messages for drag-n-drop
        support.
    }
]
; Stripped version of win-shell object for demo purposes.
win-shell: make object! [
    win-lib:   load/library %shell32.dll
    null-buff: func [
        {Returns a null-filled string buffer of the specified length.}
        len [integer!]
    ][head insert/dup make string! len #”^@” len ]
    drag-accept-files: make routine! [
        hWnd     [integer!]
        fAccept [integer!]
        return: [integer!]
    ] win-lib “DragAcceptFiles”
    drag-finish: make routine! [
        hDrop   [integer!]
        return: [integer!]
    ] win-lib “DragFinish”
    point: make struct! [
        x [integer!]
        y [integer!]
    ] none
    drag-query-point: make routine! compose/deep [
        {Returns nonzero if the drop occurred in the client area of the window,
        or zero if the drop did not occur in the client area of the window.}

        hDrop   [integer!]
        lpPoint [struct! [(first point)]]
        return: [integer!]
    ] win-lib “DragQueryPoint”
    drag-query-file: make routine! [
        hWnd     [integer!]
        iFile   [integer!]
        lpszFile[string!]
        cb       [integer!]
        return: [integer!]
    ] win-lib “DragQueryFile”
    drag-query-filename-size: make routine! [
        hWnd     [integer!]
        iFile   [integer!]
        lpszFile[integer!]
        cb       [integer!]
        return: [integer!]
    ] win-lib “DragQueryFile”
    num-files-dropped?: func [hdrop [integer!]] [drag-query-file hdrop -1 “” 0 ]
    ; When they give us a filename index, we’ll subtract one for them,
    ; because Windows has the list as zero based, but I’d much rather let
    ; everything be one based on the REBOL side.
    dropped-filename-size?: func [
        hdrop [integer!] index [integer!]
    ][drag-query-filename-size hdrop index - 1 0 0 ]
    dropped-filename?: func [
        hdrop [integer!] index [integer!] /local result len
    ][
        result: null-buff add 1 dropped-filename-size? hdrop index
        len: drag-query-file hdrop index - 1 result length? result
        copy/part result len
    ]
]
my-hwnd?: does [second get-modes system/ports/system [window]]
WM_DESTROY:   2   ; &H2
WM_DROPFILES: 563 ; &H233

enable-system-trap: does [
    ; Trap OS interrupts
    if not system/ports/system [
        if none? attempt [system/ports/system: open [scheme: ’system]][print “NOTE: Missing System Port” exit ]
    ]
    if find get-modes system/ports/system ’system-modes ‘winmsg [
        set-modes system/ports/system [winmsg: WM_DROPFILES]
    ]
    append system/ports/wait-list system/ports/system
]
check-system-trap: func [port /local msg pt] [
    if not port? port [return none]
    if any [port/scheme <> ’system   port <> system/ports/system][return port]
    if not system/ports/system [return none]
    while [msg: pick system/ports/system 1] [
        ;print [”msg:” mold msg]
        if msg/1 = ‘winmsg [
            if msg/2   = WM_DROPFILES [
                print [
                    “You dropped “ win-shell/num-files-dropped? msg/3 “files.”
                ]
                pt: make struct! win-shell/point [0 0]
                win-shell/drag-query-point msg/3 pt
                print [” at coordinate “ to pair! reduce [pt/x pt/y]]
                repeat i win-shell/num-files-dropped? msg/3 [
                    file: to-rebol-file win-shell/dropped-filename? msg/3 i
                    print [
                        tab join i “.” tab either dir? file [dirize file][file]
                    ]
                ]
                print “Finishing drag operation”
                win-shell/drag-finish msg/3
                print “Unregistering window from DragAcceptFiles queue”
                win-shell/drag-accept-files my-hwnd? to integer! false
                ; (do something with files here)
                halt
            ]
        ]
    ]
    none
]
print “Drag some files and drop them on this window…^/”
win-shell/drag-accept-files my-hwnd? to integer! true
enable-system-trap
forever [
    wake-port: wait []
    if wake-port [check-system-trap wake-port]
]
Print This Post Print This Post
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Creating a 3D surface

January 27th, 2014

The following script permits you to see a 3D surface giving a z=f(x,y) function:

Just enter youf function in the text area and press apply. You can set point of view and camera direction of view using the text field.

To Rotate the surface use the following keys:

  • [ & ] - rotate left/right
  • { & } - rotate forard/back
  • “<” & “>” - roll left/right

To move the surface use the following function keys:

  • F1: move the surface left
  • F2: move the surface right
  • F3: move the surface up
  • F4: move the surface down
  • F5: move the surface back
  • F6: move the surface forward

Here is the source code:

rebol [
    Title:   "3D-Surface Plot"
    Date:     06-August-2007
    File:     %surface.r
    Version: 1.0.0
    Email: phil.bevan@gmail.com
    Category: [demo]
    Purpose:
    {
        Draw a surface with 3-D Perspective and allow roation
    }
    License: {Copyright (c) <2007>, <Phil Bevan>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.}
    History: [0.0.1 - Initial Version - test purposes only ]
    Email: phil.bevan@gmail.com
]
objs: []
;
; reb-3d.r
;

screen: 0×0
sox: 500
soy: 300
screen/x: sox * 2
screen/y: soy * 2
pen-color: black
anti-alias: true
camera: [0 0 6 0 0 800 800] ; x y z a1 a2 xsc ysc

; draw order for all faces
draw-o: []
; draw block
draw-bl: []
fn-rot: func [obj [block!]][
    context [
; print “Rot”
; r1: now/time/precise
        c1: cosine obj/1/4
        c2: cosine obj/1/5
        c3: cosine obj/1/6
        s1: sine obj/1/4
        s2: sine obj/1/5
        s3: sine obj/1/6
; r2: now/time/precise

        clear obj/3
        clear obj/4
        obj/3: copy/deep obj/2
        ; calculate the perspective of the points after the roation & translation
        foreach point obj/3 [
            ; Roation about z axis
            x1: (point/1 * c1) - (point/2 * s1)
            y1: (point/1 * s1) + (point/2 * c1)
            z1: point/3
            ; Roation about y axis
            x2: (x1 * c2) + (point/3 * s2)
            y2: y1
            z2: - (x1 * s2) + (point/3 * c2)
            x3: x2 + obj/1/1
            y3: (y2 * c3) - (z2 * s3) + obj/1/2
            z3: (y2 * s3) + (z2 * c3) + obj/1/3
            poke point 1 (x3 + camera/1)
            poke point 2 (y3 + camera/2)
            poke point 3 (z3 + camera/3)
            x: point/1 / point/3 * camera/6
            y: point/2 / point/3 * camera/7
            append obj/4 to pair! reduce[(x + sox) (soy - y)]
        ]
; c: 0
; r3: now/time/precise

        foreach f obj/5 [
; c: c + 1
            p1: f/1/1
            p2: f/1/2
            p3: f/1/3
            d1: reduce [(obj/3/:p2/1 - obj/3/:p1/1) (obj/3/:p2/2 - obj/3/:p1/2) (obj/3/:p2/3 - obj/3/:p1/3)] ; dist^2 between p2 & p1
            d2: reduce [(obj/3/:p3/1 - obj/3/:p1/1) (obj/3/:p3/2 - obj/3/:p1/2) (obj/3/:p3/3 - obj/3/:p1/3)] ; dist^2 between p3 & p1
            poke f 4 (-2 * obj/3/:p1/3 - d1/3 - d2/3) ; 2 * z-dist from camera
            n1: (d1/2 * d2/3) - (d1/3 * d2/2) ; normal x
            n2: - (d1/1 * d2/3) + (d1/3 * d2/1) ; normal y
            n3: (d1/1 * d2/2) - (d1/2 * d2/1) ; normal z
            v: 0 > ((obj/3/:p1/1 * n1) + (obj/3/:p1/2 * n2) + (obj/3/:p1/3 * n3))
            poke f 2 v
        ]
; r4: now/time/precise

;print [”Rotation times” r2 - r1 r3 - r2 r4 - r3]

    ]
]
; if c = 1255 [probe f probe obj/3/:p1 probe obj/3/:p2 probe obj/3/:p3 print [”^/Distance^/” d1 “^/” d2 “^/Normal^/” n1 n2 n3 “^/” ((obj/3/:p1/1 * n1) + (obj/3/:p1/2 * n2) + (obj/3/:p1/3 * n3))]]

fn-show: func [][
    context [
    ; setup the faces to be shown
    pts: []
    clear draw-o
    foreach o objs [
        foreach f o/5 [
            if any [f/2 = true f/3/1 = 3 f/3/1 = 4 f/3/1 = 5][
                append draw-o f/4
                switch f/3/1 [
                    1 [append/only draw-o reduce [‘image (pick bmps f/3/2) pick o/4 f/1/1 pick o/4 f/1/2 pick o/4 f/1/3 pick o/4 f/1/4]]
                    2 [
                        pts: copy reduce [‘fill-pen (pick clrs f/3/2) ‘polygon]
                        foreach coord f/1 [append pts pick o/4 coord]
                        append/only draw-o pts
                    ]
                    3 [
                        either f/2 [cl: pick clrs f/3/2][cl: pick clrs f/3/3]
                        pts: copy reduce [‘fill-pen cl ‘polygon]
                        foreach coord f/1 [append pts pick o/4 coord]
                        append/only draw-o pts
                    ]
                    4 [
                        pts: copy reduce [‘pen 0.0.0 ‘line]
                        foreach coord f/1 [append pts pick o/4 coord]
                        append pts pick o/4 f/1/1
                        append/only draw-o pts
                    ]
                    5 [append/only draw-o reduce [‘image (pick bmps f/3/2) pick o/4 f/1/1 pick o/4 f/1/2 pick o/4 f/1/3 pick o/4 f/1/4]]
                ]
            ]
        ]
    ]
    ; sort the faces
    sort/skip draw-o 2
    ; reset the draw-block
    clear draw-bl
    append draw-bl reduce [‘pen pen-color]
    either anti-alias [append draw-bl reduce [‘anti-alias ‘on]][append draw-bl reduce [‘anti-alias ‘off]]
    ; create the draw block
    forskip draw-o 2 [append draw-bl draw-o/2]
    ; show the face
    show f-box
    ]
]
;
; surface-obj.r
;

fn-append-pt: func [x [number!] y [number!] z [number!] pts [block!] ][
    append/only pts reduce [x y z]
]
fn-append-fc: func [p1 [integer!] p2 [integer!] p3 [integer!] p4 [integer!] ip-col [integer!] /local fc col][
    either p4 = 0
        [fc: reduce [p1 p2 p3]]
        [fc: reduce [p1 p2 p3 p4]]
    col: reduce [2 ip-col]
    facet: reduce [fc false col 0]
    append/only facets facet
]
fn-gen-plane: func [ip-col-1 [tuple!] ip-col-2 [tuple!] x1 [number!] y1 [number!] x2 [number!] y2 [number!] nsx [integer!] nsy [integer!]][
    context [
        pts: []
        facets: []
        obj: []
        obj-col: []
        npx: nsx + 1
        npy: nsy + 1
        cols: reduce[ip-col-1 ip-col-2]
        ; points & face
        clear pts
        for i y1 y2 (y2 - y1) / nsy [
            for j x1 x2 (x2 - x1) / nsx [
                ; points
                fn-append-pt i j 0 pts
            ]
        ]
        for i (y1 + ((y2 - y1) / nsy / 2)) (y2) (y2 - y1) / nsy [
            for j (x1 + ((x2 - x1) / nsx / 2))   (x2) (x2 - x1) / nsx [
                ; points
                fn-append-pt i j 0 pts
            ]
        ]
        ; faces
; print [”AAA” npx npy]
        clear facets
        for i 1 npy - 1 1 [
            for j 1 npx - 1 1 [
                ; top facets
                fc: reduce [
                    (npx * npy) + ((i - 1) * (npx - 1)) + j
                    (i - 1) * npx + j + 1
                    (i - 1) * npx + j
                ]
                facet: reduce [fc false copy [3 1 4] 0]
                append/only facets facet
                fc: reduce [
                    (npx * npy) + ((i - 1) * (npx - 1)) + j
                    (i - 1) * npx + j
                    i * npx + j
                ]
                facet: reduce [fc false copy [3 2 3] 0]
                append/only facets facet
                fc: reduce [
                    (npx * npy) + ((i - 1) * (npx - 1)) + j
                    i * npx + j
                    i * npx + j + 1
                ]
                facet: reduce [fc false copy [3 1 4] 0]
                append/only facets facet
                fc: reduce [
                    (npx * npy) + ((i - 1) * (npx - 1)) + j
                    i * npx + j + 1
                    (i - 1) * npx + j + 1
                ]
                facet: reduce [fc false copy [3 2 3] 0]
                append/only facets facet
            ]
        ]
        ; print length? facets

        ; create the object
        append obj reduce [
            ; angles & co-ordinates
            [0 0 0 0 0 0] ;obj/1
            pts
            []
            []
            facets
            cols
        ]
        append/only objs obj
    ]
]
;
; Main line
;

clrs: reduce [white orange red white 255.255.200 50.50.200 100.100.150 255.25.10 blue green yellow]
; foreach o objs [fn-rot o]

fn-show-cam: func [][
    f-cx/text: to string! camera/1
    f-cy/text: to string! camera/2
    f-cz/text: to string! camera/3
    if f-panel/show? [show [f-cx f-cy f-cz]]
]
fn-show-angles: func [][
    f-cx/text: to string! camera/1
    f-cy/text: to string! camera/2
    f-cz/text: to string! camera/3
]
help-text: {
Welcome to Surface.r.
To Rotate the surface use the following keys:
“[” & “]” - rotate left/right
“{” & “}” - rotate forard/back
“<” & “>” - roll left/right
To move the surface use the following function keys:
F1: move the surface left
F2: move the surface right
F3: move the surface up
F4: move the surface down
F5: move the surface back
F6: move the surface forward
}

fn-surface-help: func [][
    lv-lay: layout [
        backdrop 0.0.0 effect [gradient 0×1 130.255.230 0.150.0]
        vh1 “3D Surface Help”
        vtext help-text 400×600 as-is
    ]
    view/new lv-lay
]
fn-prefs: func [/hide-panel /local lv-err xl-new yl-new xh-new yh-new][
    if error? lv-err: try [xl-new: to decimal! f-xl/text][
        focus f-xl
        show f-xl
        alert “Invalid low x value”
        return
    ]
    if error? lv-err: try [yl-new: to decimal! f-yl/text][
        focus f-yl
        show f-yl
        alert “Invalid low y value”
        return
    ]
    if error? lv-err: try [xh-new: to decimal! f-xh/text][
        focus f-xh
        show f-xh
        alert “Invalid high x value”
        return
    ]
    if error? lv-err: try [yh-new: to decimal! f-yh/text][
        focus f-yh
        show f-yh
        alert “Invalid high y value”
        return
    ]
    if xh-new <= xl-new [
        focus f-xh
        show f-xh
        alert “The high x value must be greater than the low x value”
        return
    ]
    if yh-new <= yl-new [
        focus f-yh
        show f-yh
        alert “The high y value must be greater than the low y value”
        return
    ]
    xl: xl-new
    yl: yl-new
    xh: xh-new
    yh: yh-new
    if error? lv-err: try [squares-x-new: to integer! f-xsq/text][
        focus f-xsq
        show f-xsq
        alert “Invalid no of x squares”
        return
    ]
    if error? lv-err: try [squares-y-new: to integer! f-ysq/text][
        focus f-ysq
        show f-ysq
        alert “Invalid no of y squares”
        return
    ]
    if squares-x-new < 4 [
        focus f-xsq
        show f-xsq
        alert “No of squares must be >= 4″
        return
    ]
    if squares-x-new > 64 [
        focus f-xsq
        show f-xsq
        alert “No of squares must be <= 64″
        return
    ]
    if squares-y-new < 4 [
        focus f-ysq
        show f-ysq
        alert “No of squares must be >= 4″
        return
    ]
    if squares-y-new > 64 [
        focus f-ysq
        show f-ysq
        alert “No of squares must be <= 64″
        return
    ]
    squares-x: squares-x-new
    squares-y: squares-y-new
    fn-str: f-fun-str/text
    if error? lv-err: try [camera/1: to decimal! f-cx/text][
        focus f-cx
        show f-cx
        alert “The x Camera value is invalid”
        return
    ]
    if error? lv-err: try [camera/2: to decimal! f-cy/text][
        focus f-cy
        show f-cy
        alert “The y Camera value is invalid”
        return
    ]
    if error? lv-err: try [camera/3: to decimal! f-cz/text][
        focus f-cz
        show f-cz
        alert “The z Camera value is invalid”
        return
    ]
    anti-alias: f-anti-alias/data
    either f-pen/data [pen-color: f-pen-col/color][pen-color: none]
    poke clrs 2 f-top-c1/color
    poke clrs 1 f-top-c2/color
    poke clrs 3 f-btm-c1/color
    poke clrs 4 f-btm-c2/color
    clear objs
    fn-gen-plane white red xl yl xh yh squares-x squares-y
    fn-height fn-str xl xh yl yh squares-x squares-y
    foreach o objs [fn-rot o]
    fn-show
    if hide-panel [hide f-panel]
]
fn-high-chg: func [dx [integer!] dy [integer!]] [
    context [
        if error? lv-err: try [x: to integer! f-x-high/text][return]
        if error? lv-err: try [y: to integer! f-y-high/text][return]
        if all [dx = -1 x > 1][f-x-high/text: to string! (x - 1) x: x - 1]
        if all [dy = -1 y > 1][f-y-high/text: to string! (y - 1) y: y - 1]
        if all [dx = 1 x < squares-x][f-x-high/text: to string! (x + 1) x: x + 1]
        if all [dy = 1 y < squares-y][f-y-high/text: to string! (y + 1) y: y + 1]
        show [f-x-high f-y-high]
        poke clrs 6 f-htop-c1/color
        poke clrs 5 f-htop-c2/color
        poke clrs 8 f-hbtm-c1/color
        poke clrs 7 f-hbtm-c2/color
        fn-highlight x y 5 6 7 8
    ]
]
fn-highlight: func [x [integer!] y [integer!] col1 [integer!] col2 [integer!] col3 [integer!] col4 [integer!]][
    context [
        ; restore original colours
        if (high-sq-cols/1) > 0 [
            high-sq: high-sq-cols/1
            poke objs/1/5/:high-sq/3 2 high-sq-cols/2
            poke objs/1/5/:high-sq/3 3 high-sq-cols/3
            high-sq: high-sq + 1
            poke objs/1/5/:high-sq/3 2 high-sq-cols/4
            poke objs/1/5/:high-sq/3 3 high-sq-cols/5
            high-sq: high-sq + 1
            poke objs/1/5/:high-sq/3 2 high-sq-cols/6
            poke objs/1/5/:high-sq/3 3 high-sq-cols/7
            high-sq: high-sq + 1
            poke objs/1/5/:high-sq/3 2 high-sq-cols/8
            poke objs/1/5/:high-sq/3 3 high-sq-cols/9
        ]
        h-sq: (squares-x * squares-y) + ((x - 1) + ((y - 1) * squares-x)) + 1
        f-xh-val/text: to string! objs/1/2/:h-sq/1
        f-yh-val/text: to string! objs/1/2/:h-sq/2
        f-high-val/text: to string! objs/1/2/:h-sq/3
        show [f-xh-val f-yh-val f-high-val]
        ; set hightlight
        high-sq: 4 * ((x - 1) + ((y - 1) * squares-x)) + 1
        poke high-sq-cols 1 high-sq
        poke high-sq-cols 2 objs/1/5/:high-sq/3/2
        poke high-sq-cols 3 objs/1/5/:high-sq/3/3
        poke objs/1/5/:high-sq/3 2 col1
        poke objs/1/5/:high-sq/3 3 col3
        high-sq: high-sq + 1
        poke high-sq-cols 4 objs/1/5/:high-sq/3/2
        poke high-sq-cols 5 objs/1/5/:high-sq/3/3
        poke objs/1/5/:high-sq/3 2 col2
        poke objs/1/5/:high-sq/3 3 col4
        high-sq: high-sq + 1
        poke high-sq-cols 6 objs/1/5/:high-sq/3/2
        poke high-sq-cols 7 objs/1/5/:high-sq/3/3
        poke objs/1/5/:high-sq/3 2 col1
        poke objs/1/5/:high-sq/3 3 col3
        high-sq: high-sq + 1
        poke high-sq-cols 8 objs/1/5/:high-sq/3/2
        poke high-sq-cols 9 objs/1/5/:high-sq/3/3
        poke objs/1/5/:high-sq/3 2 col2
        poke objs/1/5/:high-sq/3 3 col4
        fn-show
    ]
]
fn-high-prefs: func [/hide-panel][
    if error? lv-err: try [x: to integer! f-x-high/text][
        focus f-x-high
        show f-x-high
        alert “Invalid x value”
        return
    ]
    if x < 1 [
        focus f-x-high
        show f-x-high
        alert “x value cannot be less than 1″
        return
    ]
    if x > squares-x [
        focus f-x-high
        show f-x-high
        alert “x value grater than the number of squres in the x direction”
        return
    ]
    if error? lv-err: try [y: to integer! f-y-high/text][
        focus f-y-high
        show f-y-high
        alert “Invalid y value”
        return
    ]
    if y < 1 [
        focus f-y-high
        show f-y-high
        alert “y value cannot be less than 1″
        return
    ]
    if y > squares-y [
        focus f-y-high
        show f-y-high
        alert “y value grater than the number of squres in the y direction”
        return
    ]
    poke clrs 6 f-htop-c1/color
    poke clrs 5 f-htop-c2/color
    poke clrs 8 f-hbtm-c1/color
    poke clrs 7 f-hbtm-c2/color
    fn-highlight x y 5 6 7 8
    if hide-panel [hide f-panel-h]
]
lv-lay: layout [
    backdrop 0.0.0 effect [gradient 0×1 130.255.230 0.150.0]
    origin 0×0
    at 0×0
    space 0×0
    across
    f-box: box screen effect [draw draw-bl] rate 60 edge [size: 1×1 color: gray effect: ‘bevel]
    feel [
        engage: func [face action event][
            if all[action = ‘time   rot][
                st: now/time/precise
                theta1: theta1 + 5
                theta2: theta2 + 7
                if theta1 > 360 [theta1: theta1 - 360]
                if theta2 > 360 [theta2: theta2 - 360]
                objs/1/1/4: objs/1/1/4 + 5
                objs/1/1/5: objs/1/1/5 + 7
                if objs/1/1/4 > 360 [objs/1/1/4: objs/1/1/4 - 360]
                if objs/1/1/5 > 360 [objs/1/1/5: objs/1/1/5 - 360]
                rots: now/time/precise
                foreach o objs [fn-rot o]
                rote: now/time/precise
                fn-show
                shoe: now/time/precise
                print [now/time/precise - st rote - rots shoe - rote]
            ]
        ]
    ]
    return
    sensor 0×0 keycode [F1 F2 F3 F4 F5 F6 F7 #”>” #”<” #”{” #”}” #”[” #”]”] [
        switch value [
            #”[” [objs/1/1/4: objs/1/1/4 + 5 fn-rot objs/1 if objs/1/1/4 > 360 [objs/1/1/4: objs/1/1/4 - 360] fn-show-angles]
            #”]” [objs/1/1/4: objs/1/1/4 - 5 fn-rot objs/1 if objs/1/1/4 < 0 [objs/1/1/4: objs/1/1/4 + 360] fn-show-angles]
            #”<” [objs/1/1/5: objs/1/1/5 + 5 fn-rot objs/1 if objs/1/1/5 > 360 [objs/1/1/5: objs/1/1/5 - 360] fn-show-angles]
            #”>” [objs/1/1/5: objs/1/1/5 - 5 fn-rot objs/1 if objs/1/1/5 < 0 [objs/1/1/5: objs/1/1/5 + 360] fn-show-angles]
            #”{” [objs/1/1/6: objs/1/1/6 - 5 fn-rot objs/1 if objs/1/1/6 < 0 [objs/1/1/6: objs/1/1/6 + 360] fn-show-angles]
            #”}” [objs/1/1/6: objs/1/1/6 + 5 fn-rot objs/1 if objs/1/1/6 > 360 [objs/1/1/6: objs/1/1/6 - 360] fn-show-angles]
            F1 [camera/1: camera/1 - 0.1 fn-show-cam]
            F2 [camera/1: camera/1 + 0.1 fn-show-cam]
            F3 [camera/2: camera/2 + 0.1 fn-show-cam]
            F4 [camera/2: camera/2 - 0.1 fn-show-cam]
            F5 [camera/3: camera/3 + 0.1 fn-show-cam]
            F6 [camera/3: camera/3 - 0.1 fn-show-cam]
        ]
        foreach o objs [fn-rot o]
        fn-show
    ]
    btn “Details” [show f-panel]
    btn “Help” [fn-surface-help]
    at 4×4
    f-panel: panel [
        across
        origin 4×4
        at 4×4
        space 4×4
        vtext “X” right 20
        f-xl: field 100
        f-xh: field 100
        return
        vtext “Y” right 20
        f-yl: field 100
        f-yh: field 100
        return
        vtext “Camera”
        return
        vtext “x” 20
        f-cx: field 204
        return
        vtext “y” 20
        f-cy: field 204
        return
        vtext “z” 20
        f-cz: field 204
        return
        f-fun-str: area 228×200 font-name “Courier” wrap
        return
        vtext “No of X-Squares” 100
        f-xsq: field 124
        return
        vtext “No of Y-Squares” 100
        f-ysq: field 124
        return
        f-anti-alias: check-line “Anti-Alias” true
        return
        f-pen: check-line “Pen”
        f-pen-col: box black 20×20 edge [size: 1×1] [
            lv-val: request-color/color f-pen-col/color
            either lv-val = none [f-pen/data: false]
            [f-pen/data: true f-pen-col/color: lv-val]
            show [f-pen f-pen-col]
        ]
        return
        vtext “Colors (Top)” 100
        f-top-c1: box 20×20 orange edge [size: 1×1] [
            lv-val: request-color/color f-top-c1/color
            if lv-val <> none [f-top-c1/color: lv-val]
            show [f-top-c1]
        ]
        f-top-c2: box 20×20 white edge [size: 1×1][
            lv-val: request-color/color f-top-c2/color
            if lv-val <> none [f-top-c2/color: lv-val]
            show [f-top-c2]
        ]
        return
        vtext “Colors (Bottom)” 100
        f-btm-c1: box 20×20 red edge [size: 1×1] [
            lv-val: request-color/color f-btm-c1/color
            if lv-val <> none [f-btm-c1/color: lv-val]
            show [f-btm-c1]
        ]
        f-btm-c2: box 20×20 white edge [size: 1×1][
            lv-val: request-color/color f-btm-c2/color
            if lv-val <> none [f-btm-c2/color: lv-val]
            show [f-btm-c1]
        ]
        return
        btn “Hightlight Square” [show f-panel-h] 112
        return
        btn “Hide” 112 [fn-prefs/hide-panel ]
        btn “Apply” 112 [fn-prefs]
    ] edge [size: 2×2 effect: ‘ibevel]
    f-panel-h: panel [
        across
        origin 4×4
        at 4×4
        space 4×4
        vtext “Highlight square”
        return
        vtext “x:”
        f-x-high: field “1″ 100
        space 0×0
        arrow left [fn-high-chg -1 0]
        space 4×4
        arrow right [fn-high-chg 1 0]
        return
        vtext “y:”
        f-y-high: field “1″ 100
        space 0×0
        arrow left [fn-high-chg 0 -1]
        space 4×4
        arrow right [fn-high-chg 0 1]
        return
        vtext “Colors (Top)” 100
        f-htop-c1: box 20×20 0.0.150 edge [size: 1×1] [
            lv-val: request-color/color f-htop-c1/color
            if lv-val <> none [f-htop-c1/color: lv-val]
            show [f-htop-c1]
        ]
        f-htop-c2: box 20×20 0.0.200 edge [size: 1×1][
            lv-val: request-color/color f-htop-c2/color
            if lv-val <> none [f-htop-c2/color: lv-val]
            show [f-htop-c2]
        ]
        return
        vtext “Colors (Bottom)” 100
        f-hbtm-c1: box 20×20 200.200.200 edge [size: 1×1] [
            lv-val: request-color/color f-hbtm-c1/color
            if lv-val <> none [f-hbtm-c1/color: lv-val]
            show [f-hbtm-c1]
        ]
        f-hbtm-c2: box 20×20 255.200.200 edge [size: 1×1][
            lv-val: request-color/color f-hbtm-c2/color
            if lv-val <> none [f-hbtm-c2/color: lv-val]
            show [f-hbtm-c1]
        ]
        return
        vtext “x:” 50
        f-xh-val: info “0.0″ 174 silver
        return
        vtext “y:” 50
        f-yh-val: info “0.0″ 174 silver
        return
        vtext “f(x,y)” 50
        f-high-val: info “0.0″ 174 silver
        return
        btn “Hide” 112 [fn-high-prefs/hide-panel ]
        btn “Apply” 112 [fn-high-prefs ]
    ] edge [size: 2×2 effect: ‘ibevel] with [show?: false]
]
; create a function
create-function: function [t-func [string!]] [f]
[
    ; return a newly created function
    if error? try [f: to-block load t-func]
        [return none]
    function [x [any-type!] y [any-type!]] [] f
]
rot: false
dist: 0.0
theta1: 0.0
theta2: 0.0
fn-height: func [fn [string!] x1 [decimal! integer!] x2 [decimal! integer!] y1 [decimal! integer!] y2 [decimal! integer!] xs [decimal! integer!] ys [decimal! integer!] /local c h][
    f-fx: create-function fn
    c: 0
    ; corners
    for i y1 (y2 + (((y2 - y1) / ys / 10))) (y2 - y1) / ys [
        for j x1 (x2 + ((x2 - x1) / xs / 10)) (x2 - x1) / xs [
            ; evaluate function

            if error? lv-err: try [h: f-fx i j][
                focus f-x-high
                show f-x-high
                alert rejoin [“Unable to evaluate function at “ i ” , “ j]
                h: 0
            ]
            c: c + 1
            objs/1/2/:c/3: h
        ]
    ]
    ; centers
    c: (xs + 1) * (ys + 1)
    for i y1 + ((y2 - y1) / ys / 2) y2 - ((y2 - y1) / ys / 2) + ((y2 - y1) / ys / 10) (y2 - y1) / ys [
        for j x1 + ((x2 - x1) / xs / 2) x2 - ((x2 - x1) / xs / 2) + ((x2 - x1) / xs / 10) (x2 - x1) / xs [
            ; function goes here
            h: f-fx i j
            c: c + 1
            objs/1/2/:c/3: h
        ]
    ]
]
fn-str: “(2 * exp - ( ((0.5   * x) * (0.5 * x)) + ((0.5 * (y + -3.0)) * (0.5 * (y + -3.0)) ) )) + (4 * exp - ( ((0.5 * (x + 3.0)) * (0.5 * (x + 3.0))) + ((0.5 * (y + 3.0)) * (0.5 * (y + 3.0))) ) )”
; fn-str: “((i) * (i)) + ((j) * (j)) / 20″
f-fun-str/text: fn-str
xl: -8
yl: -8
xh: 8
yh: 8
f-xl/text: to string! xl
f-yl/text: to string! yl
f-xh/text: to string! xh
f-yh/text: to string! yh
squares-x: 16
squares-y: 16
f-xsq/text: to string! squares-x
f-ysq/text: to string! squares-y
high-sq-cols: [0 0 0 0 0 0 0 0 0]
f-fun-str/text: fn-str
f-cx/text: “0″
f-cy/text: “0″
f-cz/text: “20″
fn-prefs
; initial camera
objs/1/1/6: 250
objs/1/1/4: 60
pen-color: none
anti-alias: true
foreach o objs [fn-rot o]
fn-show
view lv-lay
quit
Print This Post Print This Post
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Econdings

January 22nd, 2014

The following code contains functions and charset to check or convert string encoding.
Here the most important function:

  • encoding?  This function return one fo the following:
    • “us-ascii”
    • “utf-8″
    • “iso-8859-1″
    • “macintosh”
    • “windows-1252″

There are also other converting functions.
Here is the source code:

REBOL [
  Title: "string encoding utilities"
  Version: 1.2.2
  Date: 10-Jul-2010
  Author: "Peter W A Wood"
  File: %str-enc-utils.r
  Purpose: {     A set of string utilities created to help with text encoding in 8-bit   character strings   }
  license: 'mit
]
str-enc-utils: make object! [
 
  ;; constants
  replacement-char: #”?”
 
  ;; standard bitsets
  ascii: charset [#”^(00)” - #”^(7F)”]
  non-ascii: charset [#”^(80)” - #”^(FF)”]
  characters: charset [#”^(00)” - #”^(FF)”]
  ch128-159: charset [#”^(80)” - #”^(9F)”]
  ch160-255: charset [#”^(A0)” - #”^(FF)”]
  ch128-255: charset [#”^(80)” - #”^(FF)”]
  alpha: charset [#”a” - #”z” #”A” - #”Z”]
  digit: charset [#”0″ - #”9″]
  alphanumeric: union alpha digit
  letter-hyphen: union alphanumeric charset [“-”]
  byte: charset [#”^(00)” - #”^(FF)”]
 
  ;; UTF-8 bitsets
  first-2-byte: charset [#”^(C2)” - #”^(DF)”]
  first-3-byte: charset [#”^(E0)” - #”^(EF)”]
  first-4-byte: charset [#”^(F0)” - #”^(F4)”]
  subsequent-byte: charset [#”^(80)” - #”^(BF)”]
  not-subsequent-byte: complement subsequent-byte
  invalid: charset [#”^(C0)” - #”^(C1)” #”^(F5)” - #”^(FF)”]
 
  ;; 8-bit bitsets
  x80-xBF: charset [#”^(80)” - #”^(BF)”]
  xA0-xBF: charset [#”^(A0)” - #”^(BF)”]
  xC0-xFF: charset [#”^(C0)” - #”^(FF)”]
 
  ;; reduced bitsets
  ascii-less-ampltgt: charset [
    #”^(00)” - #”^(25)”
    #”^(27)” - #”^(3B)”
    #”^(3D)”
    #”^(3F)” - #”^(7F)”
  ]
  ascii-less-cr-lf: charset [#”^(00)” - #”^(09)” #”^(0B)” - #”^(0C)” #”^(0E)” - #”^(7F)” ]
  characters-less-gt: charset [
    #”^(00)” - #”^(3D)”
    #”^(3F)” - #”^(7F)”
  ]
   
  ;; standard patterns
  a-tag: [“<” some characters-less-gt “>”]
  a-utf-8-two-byte: [first-2-byte subsequent-byte]
  a-utf-8-three-byte: [first-3-byte 2 subsequent-byte]
  a-utf-8-four-byte: [first-4-byte 3 subsequent-byte]
  invalid-utf-8-two-byte: [first-2-byte not-subsequent-byte]
  invalid-utf-8-three-byte: [
    first-3-byte [
      subsequent-byte not-subsequent-byte
      |
      not-subsequent-byte subsequent-byte
      |
      2 not-subsequent-byte
    ]
  ]
  invalid-utf-8-four-byte: [
    first-4-byte [
      subsequent-byte not-subsequent-byte subsequent-byte
      |
      subsequent-byte not-subsequent-byte not-subsequent-byte
      |
      subsequent-byte subsequent-byte not-subsequent-byte
      |
      not-subsequent-byte not-subsequent-byte subsequent-byte
      |
      not-subsequent-byte subsequent-byte not-subsequent-byte
      |
      not-subsequent-byte subsequent-byte subsequent-byte
      |
      3 not-subsequent-byte
    ]
  ]
 
  ;; BOMs
  BOM: [
    “utf-32be” “^(00)^(00)^(FE)^(FF)”
    “utf-32le” “^(FF)^(FE)^(00)^(00)”
    “utf-16be” “^(FE)^(FF)”
    “utf-16le” “^(FF)^(FE)”
    “utf-8″ “^(EF)^(BB)^(BF)”
  ]
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                             ;;
;;   bom?                                                                       ;;
;;                                                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  bom?: make function! [
    {Checks a string to see if it starts with a Unicode Byte Order Mark (BOM).
      Returns one of the following:
        “utf-32be”
        “utf-32le”
        “utf-16be”
        “utf-16le”
        “utf-8″
        #[none]
    }

    str [string!]
  ][
   
    foreach [encoding bom] BOM [
      if find/part str bom length? bom [
        return encoding
      ]
    ]
   
    #[none]
  ]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end of bom? ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                             ;;
;;   encoding?                                                                 ;;
;;                                                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  
  encoding?: make function! [
    {Ascertains the character encoding of a string by applying a few rules of
    thumb.
    Returns the following:
      “us-ascii”
      “utf-8″
      “iso-8859-1″
      “macintosh”
      “windows-1252″
    One of the following may possibly be returned but only if there is a
    Unicode Byte Order Mark at the beginning of the string:
      “utf-32be”
      “utf-32le”
      “utf-16be”
      “utf-16le”
    }

    str [string!]
    /local
      count-chars   {object to hold parse rules and reuslts to count the
                    different types of characters in a string.}

      bom           {temporary variable to hold the type of BOM}
  ][
    count-chars: make object! [
     
      ;; local
     
      ;; accumulators
    number-of: make object! [
      ascii: 0
      crs: 0
      crlfs: 0
      lfs: 0
      macroman: 0
      upper-80-9f: 0
      upper-a0-ff: 0
      utf-8-2: 0
      utf-8-3: 0
      utf-8-4: 0
      invalid-utf-8: 0
    ]
     
    ;; bitsets
      macroman: charset [#”^(81)” #”^(8D)” #”^(90)” #”^(9D)”]
     
      ;; character sequences
      ascii-chars: [some ascii-less-cr-lf]
     
      ;; rules
      ascii-rule: [
        copy substr ascii-chars (
          number-of/ascii: number-of/ascii + length? substr
        )
      ]
     
      byte-rule: [
        byte
        parse-input: (parse-input: back parse-input) :parse-input
     
      ]
     
      cr-rule: [
        cr (
          number-of/crs: number-of/crs + 1
          number-of/ascii: number-of/ascii + 1
        )
      ]
     
      crlf-rule: [
        crlf (
          number-of/crlfs: number-of/crlfs + 1
          number-of/crs: number-of/crs + 1
          number-of/lfs: number-of/lfs + 1
          number-of/ascii: number-of/ascii + 2
        )
      ]
     
      invalid-utf-8-rule: [
        invalid (
          number-of/invalid-utf-8: number-of/invalid-utf-8 + 1
        )
        parse-input: (parse-input: back parse-input) :parse-input
     
      ]
     
      invalid-utf-8-2-rule: [
        a-utf-8-two-byte (
          number-of/invalid-utf-8: number-of/invalid-utf-8 + 1
        )
        parse-input: (parse-input: back back parse-input) :parse-input
     
      ]
     
      invalid-utf-8-3-rule: [
        a-utf-8-three-byte (
          number-of/invalid-utf-8: number-of/invalid-utf-8 + 1
        )
        parse-input: (parse-input: back back back parse-input) :parse-input
      ]
     
      invalid-utf-8-4-rule: [
        a-utf-8-four-byte (
          number-of/invalid-utf-8: number-of/invalid-utf-8 + 1
        )
        parse-input: (parse-input: back back back back parse-input) :parse-input
         
      ]
     
      lf-rule: [
        lf (
          number-of/lfs: number-of/lfs + 1
          number-of/ascii: number-of/ascii + 1
        )
      ]
     
      macroman-rule: [
        macroman (
          number-of/macroman: number-of/macroman + 1
          number-of/upper-80-9f: number-of/upper-80-9f + 1
        )
      ]
     
      upper-80-9f-rule: [
        ch128-159 (
          number-of/upper-80-9f: number-of/upper-80-9f + 1
        )
      ]
     
      upper-a0-ff-rule: [
        ch160-255 (
          number-of/upper-a0-ff: number-of/upper-a0-ff + 1
        )
      ]
     
      utf-8-2-rule: [
        a-utf-8-two-byte (
          number-of/utf-8-2: number-of/utf-8-2 + 1
        )
        parse-input: (parse-input: back back parse-input) :parse-input
     
      ]
     
      utf-8-3-rule: [
        a-utf-8-three-byte (
          number-of/utf-8-3: number-of/utf-8-3 + 1
        )
        parse-input: (parse-input: back back back parse-input) :parse-input
      ]
     
      utf-8-4-rule: [
        a-utf-8-four-byte (
          number-of/utf-8-4: number-of/utf-8-4 + 1
        )
        parse-input: (parse-input: back back back back parse-input) :parse-input
         
      ]
       
      rules: [
        any [
          crlf-rule
          |
          [cr-rule | lf-rule]
          |
          [
            utf-8-2-rule
            |
            utf-8-3-rule
            |
            utf-8-4-rule
            |
            invalid-utf-8-rule
            |
            invalid-utf-8-2-rule
            |
            invalid-utf-8-3-rule
            |
            invalid-utf-8-4-rule
            |
            byte-rule
          ]
          [
            ascii-rule
            |
            upper-a0-ff-rule
            |
            macroman-rule
            |
            upper-80-9f-rule
          ]
        ]
      ]
    ]
   
    ;; check for a BOM
    if bom: bom? str [return bom]
   
    ;; count the types of characters in the input string
    parse/all str count-chars/rules
   
    ;; apply rules of thumb
    if count-chars/number-of/ascii = length? str [return “us-ascii” ]
    if count-chars/number-of/invalid-utf-8 <
      ( count-chars/number-of/utf-8-2 +
        count-chars/number-of/utf-8-3 +
        count-chars/number-of/utf-8-4
      )
    [return “utf-8″ ]
   
    if all [
      count-chars/number-of/upper-a0-ff > 0
      count-chars/number-of/upper-80-9f = 0
    ][return “iso-8859-1″ ]
   
    if any [
      count-chars/number-of/macroman > 0
      all [
        count-chars/number-of/crs > 0
        count-chars/number-of/lfs = 0
      ]
    ][return “macintosh” ]
   
    return “windows-1252″
   
  ]  
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end of encoding? ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                             ;;
;;   macroman-to-utf-8                                                       ;;
;;                                                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  macroman-to-utf-8: make function! [
    {
      Converts a MacRoman encoded string to UTF-8.
      Invalid characters are replaced
    }

    input-string [string!]
    /local
      extra-rules
      trans-table
  ][
    ;; translation table
    trans-table: [
      “^(80)” “^(C3)^(84)”
      “^(81)” “^(C3)^(85)”
      “^(82)” “^(C3)^(87)”
      “^(83)” “^(C3)^(89)”
      “^(84)” “^(C3)^(91)”
      “^(85)” “^(C3)^(96)”
      “^(86)” “^(C3)^(9C)”
      “^(87)” “^(C3)^(A1)”
      “^(88)” “^(C3)^(A0)”
      “^(89)” “^(C3)^(A2)”
      “^(8A)” “^(C3)^(A4)”
      “^(8B)” “^(C3)^(A3)”
      “^(8C)” “^(C3)^(A5)”
      “^(8D)” “^(C3)^(A7)”
      “^(8E)” “^(C3)^(A9)”
      “^(8F)” “^(C3)^(A8)”
      “^(90)” “^(C3)^(AA)”
      “^(91)” “^(C3)^(AB)”
      “^(92)” “^(C3)^(AD)”
      “^(93)” “^(C3)^(AC)”
      “^(94)” “^(C3)^(AE)”
      “^(95)” “^(C3)^(AF)”
      “^(96)” “^(C3)^(B1)”
      “^(97)” “^(C3)^(B3)”
      “^(98)” “^(C3)^(B2)”
      “^(99)” “^(C3)^(B4)”
      “^(9A)” “^(C3)^(B6)”
      “^(9B)” “^(C3)^(B5)”
      “^(9C)” “^(C3)^(BA)”
      “^(9D)” “^(C3)^(B9)”
      “^(9E)” “^(C3)^(BB)”
      “^(9F)” “^(C3)^(BC)”
      “^(A0)” “^(E2)^(80)^(A0)”
      “^(A1)” “^(C2)^(B0)”
      “^(A2)” “^(C2)^(A2)”
      “^(A3)” “^(C2)^(A3)”
      “^(A4)” “^(C2)^(A7)”
      “^(A5)” “^(E2)^(80)^(A2)”
      “^(A6)” “^(C2)^(B6)”
      “^(A7)” “^(C3)^(9F)”
      “^(A8)” “^(C2)^(AE)”
      “^(A9)” “^(C2)^(A9)”
      “^(AA)” “^(E2)^(84)^(A2)”
      “^(AB)” “^(C2)^(B4)”
      “^(AC)” “^(C2)^(A8)”
      “^(AD)” “^(E2)^(89)^(A0)”
      “^(AE)” “^(C3)^(86)”
      “^(AF)” “^(C3)^(98)”
      “^(B0)” “^(E2)^(88)^(9E)”
      “^(B1)” “^(C2)^(B1)”
      “^(B2)” “^(E2)^(89)^(A4)”
      “^(B3)” “^(E2)^(89)^(A5)”
      “^(B4)” “^(C2)^(A5)”
      “^(B5)” “^(C2)^(B5)”
      “^(B6)” “^(E2)^(88)^(82)”
      “^(B7)” “^(E2)^(88)^(91)”
      “^(B8)” “^(E2)^(88)^(8F)”
      “^(B9)” “^(CF)^(80)”
      “^(BA)” “^(E2)^(88)^(AB)”
      “^(BB)” “^(C2)^(AA)”
      “^(BC)” “^(C2)^(BA)”
      “^(BD)” “^(CE)^(A9)”
      “^(BE)” “^(C3)^(A6)”
      “^(BF)” “^(C3)^(B8)”
      “^(C0)” “^(C2)^(BF)”
      “^(C1)” “^(C2)^(A1)”
      “^(C2)” “^(C2)^(AC)”
      “^(C3)” “^(E2)^(88)^(9A)”
      “^(C4)” “^(C6)^(92)”
      “^(C5)” “^(E2)^(89)^(88)”
      “^(C6)” “^(E2)^(88)^(86)”
      “^(C7)” “^(C2)^(AB)”
      “^(C8)” “^(C2)^(BB)”
      “^(C9)” “^(E2)^(80)^(A6)”
      “^(CA)” “^(C2)^(A0)”
      “^(CB)” “^(C3)^(80)”
      “^(CC)” “^(C3)^(83)”
      “^(CD)” “^(C3)^(95)”
      “^(CE)” “^(C5)^(92)”
      “^(CF)” “^(C5)^(93)”
      “^(D0)” “^(E2)^(80)^(93)”
      “^(D1)” “^(E2)^(80)^(94)”
      “^(D2)” “^(E2)^(80)^(9C)”
      “^(D3)” “^(E2)^(80)^(9D)”
      “^(D4)” “^(E2)^(80)^(98)”
      “^(D5)” “^(E2)^(80)^(99)”
      “^(D6)” “^(C3)^(B7)”
      “^(D7)” “^(E2)^(97)^(8A)”
      “^(D8)” “^(C3)^(BF)”
      “^(D9)” “^(C5)^(B8)”
      “^(DA)” “^(E2)^(81)^(84)”
      “^(DB)” “^(E2)^(82)^(AC)”
      “^(DC)” “^(E2)^(80)^(B9)”
      “^(DD)” “^(E2)^(80)^(BA)”
      “^(DE)” “^(EF)^(AC)^(81)”
      “^(DF)” “^(EF)^(AC)^(82)”
      “^(E0)” “^(E2)^(80)^(A1)”
      “^(E1)” “^(C2)^(B7)”
      “^(E2)” “^(E2)^(80)^(9A)”
      “^(E3)” “^(E2)^(80)^(9E)”
      “^(E4)” “^(E2)^(80)^(B0)”
      “^(E5)” “^(C3)^(82)”
      “^(E6)” “^(C3)^(8A)”
      “^(E7)” “^(C3)^(81)”
      “^(E8)” “^(C3)^(8B)”
      “^(E9)” “^(C3)^(88)”
      “^(EA)” “^(C3)^(8D)”
      “^(EB)” “^(C3)^(8E)”
      “^(EC)” “^(C3)^(8F)”
      “^(ED)” “^(C3)^(8C)”
      “^(EE)” “^(C3)^(93)”
      “^(EF)” “^(C3)^(94)”
      “^(F0)” “^(EF)^(A3)^(BF)”
      “^(F1)” “^(C3)^(92)”
      “^(F2)” “^(C3)^(9A)”
      “^(F3)” “^(C3)^(9B)”
      “^(F4)” “^(C3)^(99)”
      “^(F5)” “^(C4)^(B1)”
      “^(F6)” “^(CB)^(86)”
      “^(F7)” “^(CB)^(9C)”
      “^(F8)” “^(C2)^(AF)”
      “^(F9)” “^(CB)^(98)”
      “^(FA)” “^(CB)^(99)”
      “^(FB)” “^(CB)^(9A)”
      “^(FC)” “^(C2)^(B8)”
      “^(FD)” “^(CB)^(9D)”
      “^(FE)” “^(CB)^(9B)”
      “^(FF)” “^(CB)^(87)”
    ]
                                 
    ;; Define the additional rules to be applied before the default rules
    extra-rules: [
      copy transfer ch128-255 (
        insert tail output-string select/case trans-table transfer
      )
    ]
   
    iso-8859-to-utf-8/addl-rules input-string extra-rules
  ]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end of macroman-to-utf-8 ;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                             ;;
;;   mail-encoding?                                                             ;;
;;                                                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  
  mail-encoding?: make function! [
    {Returns the charset of the first Content-type entry in a mail message}
    mail-str [string!]
    /local
      cset     ;; character set
  ][
   
    either parse/all mail-str [
      to “Content-type” thru “charset=” copy cset some letter-hyphen to end end
    ][lowercase cset ][
      #[none]
    ]
  ]  
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end of mail-encoding? ;;;;;;;;;;;;;;;;;;;;;;;;;;;
   

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                             ;;
;;   iso-8859-1-to-html                                                         ;;
;;                                                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::::::::::::

  iso-8859-1-to-html: make function! [
    {Converts an ISO-8859-1 encoded string to pure ASCII with characters 128
      and above converted to html escape sequences}

    input-string [string!]
    /esc-lt-gt-amp   {Escape <, > and &}
    /keep-tags   {leave < ….> alone}
    /local
      output-string
      rule
      transfer
      escape
      no-refinement-rule
      esc-lt-gt-amp-rule
      keep-tags-rule
      standard-rule
      variable-rule
  ][
   
    no-refinement-rule: [
      copy transfer   [some ascii] (
        insert tail output-string transfer
      )
    ]
   
    esc-lt-gt-amp-rule: [
      “<” (insert tail output-string “&lt;”)
      |
      “>” (insert tail output-string “&gt;”)
      |
      “&” (insert tail output-string “&amp;”)
      |
      copy transfer [some ascii-less-ampltgt] (
        print “here”
        insert tail output-string transfer
      )
    ]
    keep-tags-rule: [
      copy transfer a-tag (
        insert tail output-string transfer
      )
    ]
   
    ;; rule to deal with characters above 127
    standard-rule: [
      some ch128-159         ;; ignore characters in this range
      |
      copy escape ch160-255 (
        insert tail output-string join “&#” [to integer! first escape “;”]
      )
      |
      skip
    ]
   
    ;; assemble the parse rule according to the refinements
   
    either esc-lt-gt-amp [
      either keep-tags [
        rule: [
          any [
            keep-tags-rule
            |
            esc-lt-gt-amp-rule
            |
            standard-rule
          ]
        ]
      ][
        rule: [
          any [
            esc-lt-gt-amp-rule
            |
            standard-rule
          ]
        ]
      ]
    ][
      rule: [
        any [
          no-refinement-rule
          |
          standard-rule
        ]
      ]
    ]
 
    output-string: copy “”
    parse/all input-string rule
    head output-string
   
  ]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end of iso-8859-1-to-hmtl;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                             ;;
;;   iso-8859-to-utf-8                                                         ;;
;;                                                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  iso-8859-to-utf-8: make function! [
    {
      Converts an ISO-8859 encoded string to UTF-8.
      The default processing assumes the input is ISO-8859-1
      The /addl-rules refinement allows rules to be supplied for other ecodings
    }

    input-string [string!]
    /addl-rules
    extra-rules [block!]
    /local
      output-string
      rule
      ascii-rule
      rule-80-BF
      C0-FF-rule
      transfer
  ][
    ;; temporary variables and constants
    output-string: copy “”
    transfer: none
   
    ;; sub-rules
    ascii-rule: [
      copy transfer [some ascii] (
        insert tail output-string transfer
      )
    ]
   
    rule-80-BF: [
      ;; characters in the range 80-BF relate to C280-C2BF
      copy transfer x80-xBF (
        insert tail output-string compose [#”^(C2)” (transfer)]
      )
    ]
   
    C0-FF-rule: [
      ;; characters in the range C0-FF relate to C380-C3BF
      copy transfer xC0-xFF (
        insert tail output-string compose [
          #”^(C3)” (#”^(40)” xor to char! transfer)
        ]
      )
    ]
   
    rule: [
      any [
        ascii-rule
        |
        rule-80-BF
        |
        C0-FF-rule
      ]
    ]
   
    ;; add the extra rules to the rule
    if addl-rules [
      bind extra-rules ‘output-string
      insert find/tail second rule ‘ascii-rule [| extra-rules]
    ]
   
    parse/all/case input-string rule
    head output-string
  ]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end of iso-8859-to-utf-8 ;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                             ;;
;;   iso-8859-1-to-utf-8                                                       ;;
;;                                                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  iso-8859-1-to-utf-8: make function! [
    {
      Converts an ISO-8859-1 encoded string to UTF-8.
    }

    input-string [string!]
  ][iso-8859-to-utf-8 input-string ]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end of iso-8859-1-to-utf-8 ;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                             ;;
;;   iso-8859-2-to-utf-8                                                       ;;
;;                                                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  iso-8859-2-to-utf-8: make function! [
    {
      Converts an ISO-8859-2 encoded string to UTF-8.
      Invalid characters are replaced
    }

    input-string [string!]
    /local
      extra-rules
      trans-table
  ][
    ;; translation table
    trans-table: [
      “^(A0)” “^(C2)^(A0)”
      “^(A1)” “^(C4)^(84)”
      “^(A2)” “^(CB)^(98)”
      “^(A3)” “^(C5)^(81)”
      “^(A4)” “^(C2)^(A4)”
      “^(A5)” “^(C4)^(BD)”
      “^(A6)” “^(C5)^(9A)”
      “^(A7)” “^(C2)^(A7)”
      “^(A8)” “^(C2)^(A8)”
      “^(A9)” “^(C5)^(A0)”
      “^(AA)” “^(C5)^(9E)”
      “^(AB)” “^(C5)^(A4)”
      “^(AC)” “^(C5)^(B9)”
      “^(AD)” “^(C2)^(AD)”
      “^(AE)” “^(C5)^(BD)”
      “^(AF)” “^(C5)^(BB)”
      “^(B0)” “^(C2)^(B0)”
      “^(B1)” “^(C4)^(85)”
      “^(B2)” “^(CB)^(9B)”
      “^(B3)” “^(C5)^(82)”
      “^(B4)” “^(C2)^(B4)”
      “^(B5)” “^(C4)^(BE)”
      “^(B6)” “^(C5)^(9B)”
      “^(B7)” “^(CB)^(87)”
      “^(B8)” “^(C2)^(B8)”
      “^(B9)” “^(C5)^(A1)”
      “^(BA)” “^(C5)^(9F)”
      “^(BB)” “^(C5)^(A5)”
      “^(BC)” “^(C5)^(BA)”
      “^(BD)” “^(CB)^(9D)”
      “^(BE)” “^(C5)^(BE)”
      “^(BF)” “^(C5)^(BC)”
      “^(C0)” “^(C5)^(94)”
      “^(C1)” “^(C3)^(81)”
      “^(C2)” “^(C3)^(82)”
      “^(C3)” “^(C4)^(82)”
      “^(C4)” “^(C3)^(84)”
      “^(C5)” “^(C4)^(B9)”
      “^(C6)” “^(C4)^(86)”
      “^(C7)” “^(C3)^(87)”
      “^(C8)” “^(C4)^(8C)”
      “^(C9)” “^(C3)^(89)”
      “^(CA)” “^(C4)^(98)”
      “^(CB)” “^(C3)^(8B)”
      “^(CC)” “^(C4)^(9A)”
      “^(CD)” “^(C3)^(8D)”
      “^(CE)” “^(C3)^(8E)”
      “^(CF)” “^(C4)^(8E)”
      “^(D0)” “^(C4)^(90)”
      “^(D1)” “^(C5)^(83)”
      “^(D2)” “^(C5)^(87)”
      “^(D3)” “^(C3)^(93)”
      “^(D4)” “^(C3)^(94)”
      “^(D5)” “^(C5)^(90)”
      “^(D6)” “^(C3)^(96)”
      “^(D7)” “^(C3)^(97)”
      “^(D8)” “^(C5)^(98)”
      “^(D9)” “^(C5)^(AE)”
      “^(DA)” “^(C3)^(9A)”
      “^(DB)” “^(C5)^(B0)”
      “^(DC)” “^(C3)^(9C)”
      “^(DD)” “^(C3)^(9D)”
      “^(DE)” “^(C5)^(A2)”
      “^(DF)” “^(C3)^(9F)”
      “^(E0)” “^(C5)^(95)”
      “^(E1)” “^(C3)^(A1)”
      “^(E2)” “^(C3)^(A2)”
      “^(E3)” “^(C4)^(83)”
      “^(E4)” “^(C3)^(A4)”
      “^(E5)” “^(C4)^(BA)”
      “^(E6)” “^(C4)^(87)”
      “^(E7)” “^(C3)^(A7)”
      “^(E8)” “^(C4)^(8D)”
      “^(E9)” “^(C3)^(A9)”
      “^(EA)” “^(C4)^(99)”
      “^(EB)” “^(C3)^(AB)”
      “^(EC)” “^(C4)^(9B)”
      “^(ED)” “^(C3)^(AD)”
      “^(EE)” “^(C3)^(AE)”
      “^(EF)” “^(C4)^(8F)”
      “^(F0)” “^(C4)^(91)”
      “^(F1)” “^(C5)^(84)”
      “^(F2)” “^(C5)^(88)”
      “^(F3)” “^(C3)^(B3)”
      “^(F4)” “^(C3)^(B4)”
      “^(F5)” “^(C5)^(91)”
      “^(F6)” “^(C3)^(B6)”
      “^(F7)” “^(C3)^(B7)”
      “^(F8)” “^(C5)^(99)”
      “^(F9)” “^(C5)^(AF)”
      “^(FA)” “^(C3)^(BA)”
      “^(FB)” “^(C5)^(B1)”
      “^(FC)” “^(C3)^(BC)”
      “^(FD)” “^(C3)^(BD)”
      “^(FE)” “^(C5)^(A3)”
      “^(FF)” “^(CB)^(99)”
    ]
                                 
    ;; Define the additional rules to be applied before the default rules
    extra-rules: [
      copy transfer ch160-255 (
        insert tail output-string select/case trans-table transfer
      )
    ]
   
    iso-8859-to-utf-8/addl-rules input-string extra-rules
  ]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end of iso-8859-2-to-utf-8 ;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                             ;;
;;   iso-8859-9-to-utf-8                                                       ;;
;;                                                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  iso-8859-9-to-utf-8: make function! [
    {
      Converts an ISO-8859-9 encoded string to UTF-8.
    }

    input-string [string!]
    /local
      extra-rules
  ][
    ;; Define the additional rules to be applied before the default rules
    extra-rules: [
      #”^(D0)” (insert tail output-string {^(C4)^(9E)})
      |
      #”^(DD)” (insert tail output-string {^(C4)^(B0)})
      |
      #”^(DE)” (insert tail output-string {^(C5)^(9E)})
      |
      #”^(F0)” (insert tail output-string {^(C4)^(9F)})
      |
      #”^(FD)” (insert tail output-string {^(C4)^(B1)})
      |
      #”^(FE)” (insert tail output-string {^(C5)^(9F)})
    ]
   
    iso-8859-to-utf-8/addl-rules input-string extra-rules
  ]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end of iso-8859-9-to-utf-8 ;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                             ;;
;;   iso-8859-15-to-utf-8                                                       ;;
;;                                                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  iso-8859-15-to-utf-8: make function! [
    {
      Converts an ISO-8859-15 encoded string to UTF-8.
    }

    input-string [string!]
    /local
      extra-rules
  ][
    ;; Define the additional rules to be applied before the default rules
    extra-rules: [
      #”^(A4)” (insert tail output-string {^(E2)^(82)^(AC)})
      |
      #”^(A6)” (insert tail output-string {^(C5)^(A0)})
      |
      #”^(A8)” (insert tail output-string {^(C5)^(A1)})
      |
      #”^(B4)” (insert tail output-string {^(C5)^(BD)})
      |
      #”^(B8)” (insert tail output-string {^(C5)^(BE)})
      |
      #”^(BC)” (insert tail output-string {^(C5)^(92)})
      |
      #”^(BD)” (insert tail output-string {^(C5)^(94)})
      |
      #”^(BE)” (insert tail output-string {^(C5)^(B8)})
    ]
   
    iso-8859-to-utf-8/addl-rules input-string extra-rules
  ]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end of iso-8859-15-to-utf-8 ;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                             ;;
;;   strip-bom                                                                 ;;
;;                                                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  strip-bom: make function! [
    {Strips any BOM from the start of a string and returns the string.
      Note: the input string is modified.
    }

    str [string!]
    /local
      bom “store result of bom?”
  ][
   
    either bom: bom? str [
      remove/part str length? str-enc-utils/BOM/:bom
    ][str ]
  ]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end of strip-bom   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                             ;;
;;   utf-8-to-iso-8859                                                         ;;
;;                                                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  utf-8-to-iso-8859: make function! [
    {
      Converts a UTF-8 encoded string to ISO-8859 and similar eoncodings
      These are a lossy conversion:
        Characters that cannot be converted are changed to “?”
        (That includes any invalid UTF-8 characters in the input)
      The default processing assumes the input is ISO-8859-1
      The /addl-rules refinement allows rules to be supplied for other ecodings
    }

    input-string [string!]
    /addl-rules
      extra-rules [block!]
    /local
      output-string
      rule
      ascii-rule
      nbsp-rule
      xA0-xBF
      C2A0-C2BF
      C2A0-C2BF-rule
      x80-xBF
      C380-C3BF
      C380-C3BF-rule
      transfer
  ][
    ;; temporary variables and constants
    output-string: copy “”
    transfer: none
   
    ;; bit sets
    xA0-xBF: charset [#”^(A0)” - #”^(BF)”]
    x80-xBF: charset [#”^(80)” - #”^(BF)”]
   
    ;; character sequences
    C2A0-C2BF: [#”^(C2)” xA0-xBF]
    C380-C3BF: [#”^(C3)” x80-xBF]
   
    ;; sub-rules
    ascii-rule: [
      copy transfer [some ascii] (
        insert tail output-string transfer
      )
    ]
   
    C2A0-C2BF-rule: [
      ;; characters in the range C2A0-C2BF relate to A0-BF
      copy transfer C2A0-C2BF (insert tail output-string second transfer)
    ]
   
    C380-C3BF-rule: [
      ;; characters in the range C380-C3BF relate to C0-FF
      copy transfer C380-C3BF (
        insert tail output-string #”^(40)” or second transfer
      )
    ]
   
    rule: [
      any [
        ascii-rule
        |
        C2A0-C2BF-rule
        |
        C380-C3BF-rule
        |
        [
          [a-utf-8-two-byte | a-utf-8-three-byte | a-utf-8-four-byte] (
            insert tail output-string replacement-char
          )
        ]
        |
        skip (insert tail output-string replacement-char)
      ]
    ]
   
    ;; add the extra rules to the rule
    if addl-rules [
      bind extra-rules ‘output-string
      insert find/tail second rule ‘ascii-rule [| extra-rules]
    ]
   
    parse/all/case input-string rule
    head output-string
  ]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end of utf-8-to-iso-8859 ;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                             ;;
;;   utf-8-to-iso-8859-1                                                       ;;
;;                                                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  utf-8-to-iso-8859-1: make function! [
    {
      Converts a UTF-8 encoded string to ISO-8859-1.
      This is a lossy conversion:
        Characters that cannot be converted are changed to “?”
        (That includes any invalid UTF-8 characters in the input)
    }

    input-string [string!]
  ][str-enc-utils/utf-8-to-iso-8859 input-string ]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end of utf-8-to-iso-8859-1 ;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                             ;;
;;   utf-8-to-iso-8859-15                                                       ;;
;;                                                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
utf-8-to-iso-8859-15: make function! [
    {
      Converts a UTF-8 encoded string to ISO-8859-15.
      This is a lossy conversion:
        Characters that cannot be converted are changed to “?”
        (That includes any invalid UTF-8 characters in the input)
    }

    input-string [string!]
    /local
      extra-rules
  ][
    ;; Define the additional rules to be applied before the default rules
    extra-rules: [
      {^(E2)^(82)^(AC)} (insert tail output-string #”^(A4)”)
      |
      {^(C5)^(A0)} (insert tail output-string #”^(A6)”)
      |
      {^(C5)^(A1)} (insert tail output-string #”^(A8)”)
      |
      {^(C5)^(BD)} (insert tail output-string #”^(B4)”)
      |
      {^(C5)^(BE)} (insert tail output-string #”^(B8)”)
      |
      {^(C5)^(92)} (insert tail output-string #”^(BC)”)
      |
      {^(C5)^(94)} (insert tail output-string #”^(BD)”)
      |
      {^(C5)^(B8)} (insert tail output-string #”^(BE)”)
    ]
   
    utf-8-to-iso-8859/addl-rules input-string extra-rules
  ]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end of utf-8-to-iso-8859-15 ;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                             ;;
;;   utf-8-to-macroman                                                       ;;
;;                                                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  utf-8-to-macroman: make function! [
    {
      Converts a UTF-8 encoded string to MacRoman.
      This is a lossy conversion:
        Characters that cannot be converted are changed to “?”
        (That includes any invalid UTF-8 characters in the input)
    }

    input-string [string!]
    /local
      extra-rules
      trans-table
  ][
   
    ;; Define the additional rules to be applied before the default rules
    extra-rules: [
      “^(C3)^(84)”           (insert tail output-string #”^(80)”) |
      “^(C3)^(85)”           (insert tail output-string #”^(81)”) |
      “^(C3)^(87)”           (insert tail output-string #”^(82)”) |
      “^(C3)^(89)”           (insert tail output-string #”^(83)”) |
      “^(C3)^(91)”           (insert tail output-string #”^(84)”) |
      “^(C3)^(96)”           (insert tail output-string #”^(85)”) |
      “^(C3)^(9C)”           (insert tail output-string #”^(86)”) |
      “^(C3)^(A1)”           (insert tail output-string #”^(87)”) |
      “^(C3)^(A0)”           (insert tail output-string #”^(88)”) |
      “^(C3)^(A2)”           (insert tail output-string #”^(89)”) |
      “^(C3)^(A4)”           (insert tail output-string #”^(8A)”) |
      “^(C3)^(A3)”           (insert tail output-string #”^(8B)”) |
      “^(C3)^(A5)”           (insert tail output-string #”^(8C)”) |
      “^(C3)^(A7)”           (insert tail output-string #”^(8D)”) |
      “^(C3)^(A9)”           (insert tail output-string #”^(8E)”) |
      “^(C3)^(A8)”           (insert tail output-string #”^(8F)”) |
      “^(C3)^(AA)”           (insert tail output-string #”^(90)”) |
      “^(C3)^(AB)”           (insert tail output-string #”^(91)”) |
      “^(C3)^(AD)”           (insert tail output-string #”^(92)”) |
      “^(C3)^(AC)”           (insert tail output-string #”^(93)”) |
      “^(C3)^(AE)”           (insert tail output-string #”^(94)”) |
      “^(C3)^(AF)”           (insert tail output-string #”^(95)”) |
      “^(C3)^(B1)”           (insert tail output-string #”^(96)”) |
      “^(C3)^(B3)”           (insert tail output-string #”^(97)”) |
      “^(C3)^(B2)”           (insert tail output-string #”^(98)”) |
      “^(C3)^(B4)”           (insert tail output-string #”^(99)”) |
      “^(C3)^(B6)”           (insert tail output-string #”^(9A)”) |
      “^(C3)^(B5)”           (insert tail output-string #”^(9B)”) |
      “^(C3)^(BA)”           (insert tail output-string #”^(9C)”) |
      “^(C3)^(B9)”           (insert tail output-string #”^(9D)”) |
      “^(C3)^(BB)”           (insert tail output-string #”^(9E)”) |
      “^(C3)^(BC)”           (insert tail output-string #”^(9F)”) |
      “^(E2)^(80)^(A0)”     (insert tail output-string #”^(A0)”) |
      “^(C2)^(B0)”           (insert tail output-string #”^(A1)”) |
      “^(C2)^(A2)”           (insert tail output-string #”^(A2)”) |
      “^(C2)^(A3)”           (insert tail output-string #”^(A3)”) |
      “^(C2)^(A7)”           (insert tail output-string #”^(A4)”) |
      “^(E2)^(80)^(A2)”     (insert tail output-string #”^(A5)”) |
      “^(C2)^(B6)”           (insert tail output-string #”^(A6)”) |
      “^(C3)^(9F)”           (insert tail output-string #”^(A7)”) |
      “^(C2)^(AE)”           (insert tail output-string #”^(A8)”) |
      “^(C2)^(A9)”           (insert tail output-string #”^(A9)”) |
      “^(E2)^(84)^(A2)”     (insert tail output-string #”^(AA)”) |
      “^(C2)^(B4)”           (insert tail output-string #”^(AB)”) |
      “^(C2)^(A8)”           (insert tail output-string #”^(AC)”) |
      “^(E2)^(89)^(A0)”     (insert tail output-string #”^(AD)”) |
      “^(C3)^(86)”           (insert tail output-string #”^(AE)”) |
      “^(C3)^(98)”           (insert tail output-string #”^(AF)”) |
      “^(E2)^(88)^(9E)”     (insert tail output-string #”^(B0)”) |
      “^(C2)^(B1)”           (insert tail output-string #”^(B1)”) |
      “^(E2)^(89)^(A4)”     (insert tail output-string #”^(B2)”) |
      “^(E2)^(89)^(A5)”     (insert tail output-string #”^(B3)”) |
      “^(C2)^(A5)”           (insert tail output-string #”^(B4)”) |
      “^(C2)^(B5)”           (insert tail output-string #”^(B5)”) |
      “^(E2)^(88)^(82)”     (insert tail output-string #”^(B6)”) |
      “^(E2)^(88)^(91)”     (insert tail output-string #”^(B7)”) |
      “^(E2)^(88)^(8F)”     (insert tail output-string #”^(B8)”) |
      “^(CF)^(80)”           (insert tail output-string #”^(B9)”) |
      “^(E2)^(88)^(AB)”     (insert tail output-string #”^(BA)”) |
      “^(C2)^(AA)”           (insert tail output-string #”^(BB)”) |
      “^(C2)^(BA)”           (insert tail output-string #”^(BC)”) |
      “^(CE)^(A9)”           (insert tail output-string #”^(BD)”) |
      “^(C3)^(A6)”           (insert tail output-string #”^(BE)”) |
      “^(C3)^(B8)”           (insert tail output-string #”^(BF)”) |
      “^(C2)^(BF)”           (insert tail output-string #”^(C0)”) |
      “^(C2)^(A1)”           (insert tail output-string #”^(C1)”) |
      “^(C2)^(AC)”           (insert tail output-string #”^(C2)”) |
      “^(E2)^(88)^(9A)”     (insert tail output-string #”^(C3)”) |
      “^(C6)^(92)”           (insert tail output-string #”^(C4)”) |
      “^(E2)^(89)^(88)”     (insert tail output-string #”^(C5)”) |
      “^(E2)^(88)^(86)”     (insert tail output-string #”^(C6)”) |
      “^(C2)^(AB)”           (insert tail output-string #”^(C7)”) |
      “^(C2)^(BB)”           (insert tail output-string #”^(C8)”) |
      “^(E2)^(80)^(A6)”     (insert tail output-string #”^(C9)”) |
      “^(C2)^(A0)”           (insert tail output-string #”^(CA)”) |
      “^(C3)^(80)”           (insert tail output-string #”^(CB)”) |
      “^(C3)^(83)”           (insert tail output-string #”^(CC)”) |
      “^(C3)^(95)”           (insert tail output-string #”^(CD)”) |
      “^(C5)^(92)”           (insert tail output-string #”^(CE)”) |
      “^(C5)^(93)”           (insert tail output-string #”^(CF)”) |
      “^(E2)^(80)^(93)”     (insert tail output-string #”^(D0)”) |
      “^(E2)^(80)^(94)”     (insert tail output-string #”^(D1)”) |
      “^(E2)^(80)^(9C)”     (insert tail output-string #”^(D2)”) |
      “^(E2)^(80)^(9D)”     (insert tail output-string #”^(D3)”) |
      “^(E2)^(80)^(98)”     (insert tail output-string #”^(D4)”) |
      “^(E2)^(80)^(99)”     (insert tail output-string #”^(D5)”) |
      “^(C3)^(B7)”           (insert tail output-string #”^(D6)”) |
      “^(E2)^(97)^(8A)”     (insert tail output-string #”^(D7)”) |
      “^(C3)^(BF)”           (insert tail output-string #”^(D8)”) |
      “^(C5)^(B8)”           (insert tail output-string #”^(D9)”) |
      “^(E2)^(81)^(84)”     (insert tail output-string #”^(DA)”) |
      “^(E2)^(82)^(AC)”     (insert tail output-string #”^(DB)”) |
      “^(E2)^(80)^(B9)”     (insert tail output-string #”^(DC)”) |
      “^(E2)^(80)^(BA)”     (insert tail output-string #”^(DD)”) |
      “^(EF)^(AC)^(81)”     (insert tail output-string #”^(DE)”) |
      “^(EF)^(AC)^(82)”     (insert tail output-string #”^(DF)”) |
      “^(E2)^(80)^(A1)”     (insert tail output-string #”^(E0)”) |
      “^(C2)^(B7)”           (insert tail output-string #”^(E1)”) |
      “^(E2)^(80)^(9A)”     (insert tail output-string #”^(E2)”) |
      “^(E2)^(80)^(9E)”     (insert tail output-string #”^(E3)”) |
      “^(E2)^(80)^(B0)”     (insert tail output-string #”^(E4)”) |
      “^(C3)^(82)”           (insert tail output-string #”^(E5)”) |
      “^(C3)^(8A)”           (insert tail output-string #”^(E6)”) |
      “^(C3)^(81)”           (insert tail output-string #”^(E7)”) |
      “^(C3)^(8B)”           (insert tail output-string #”^(E8)”) |
      “^(C3)^(88)”           (insert tail output-string #”^(E9)”) |
      “^(C3)^(8D)”           (insert tail output-string #”^(EA)”) |
      “^(C3)^(8E)”           (insert tail output-string #”^(EB)”) |
      “^(C3)^(8F)”           (insert tail output-string #”^(EC)”) |
      “^(C3)^(8C)”           (insert tail output-string #”^(ED)”) |
      “^(C3)^(93)”           (insert tail output-string #”^(EE)”) |
      “^(C3)^(94)”           (insert tail output-string #”^(EF)”) |
      “^(EF)^(A3)^(BF)”     (insert tail output-string #”^(F0)”) |
      “^(C3)^(92)”           (insert tail output-string #”^(F1)”) |
      “^(C3)^(9A)”           (insert tail output-string #”^(F2)”) |
      “^(C3)^(9B)”           (insert tail output-string #”^(F3)”) |
      “^(C3)^(99)”           (insert tail output-string #”^(F4)”) |
      “^(C4)^(B1)”           (insert tail output-string #”^(F5)”) |
      “^(CB)^(86)”           (insert tail output-string #”^(F6)”) |
      “^(CB)^(9C)”           (insert tail output-string #”^(F7)”) |
      “^(C2)^(AF)”           (insert tail output-string #”^(F8)”) |
      “^(CB)^(98)”           (insert tail output-string #”^(F9)”) |
      “^(CB)^(99)”           (insert tail output-string #”^(FA)”) |
      “^(CB)^(9A)”           (insert tail output-string #”^(FB)”) |
      “^(C2)^(B8)”           (insert tail output-string #”^(FC)”) |
      “^(CB)^(9D)”           (insert tail output-string #”^(FD)”) |
      “^(CB)^(9B)”           (insert tail output-string #”^(FE)”) |
      “^(CB)^(87)”           (insert tail output-string #”^(FF)”)
    ]
                                 
    ;; Define the additional rules to be applied before the default rules
   
   
    utf-8-to-iso-8859/addl-rules input-string extra-rules
  ]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end of utf-8-to-macroman ;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                             ;;
;;   utf-8-to-win-1252                                                       ;;
;;                                                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  utf-8-to-win-1252: make function! [
    {
      Converts a win-1252 encoded string to UTF-8.
      This is a lossy conversion:
        Characters that cannot be converted are changed to “?”
        (That includes any invalid UTF-8 characters in the input)
    }

    input-string [string!]
    /local
      extra-rules
      trans-table
  ][
    ;; Define the additional rules to be applied before the default rules
    extra-rules: [
      {^(E2)^(82)^(A0)}     (insert tail output-string #”^(80)”) |
      {^(E2)^(80)^(9A)}     (insert tail output-string #”^(82)”) |
      {^(C6)^(92)}           (insert tail output-string #”^(83)”) |
      {^(E2)^(80)^(9E)}     (insert tail output-string #”^(84)”) |
      {^(E2)^(80)^(A6)}     (insert tail output-string #”^(85)”) |
      {^(E2)^(80)^(A0)}     (insert tail output-string #”^(86)”) |
      {^(E2)^(80)^(A1)}     (insert tail output-string #”^(87)”) |
      {^(CB)^(86)}           (insert tail output-string #”^(88)”) |
      {^(E2)^(80)^(B0)}     (insert tail output-string #”^(89)”) |
      {^(C5)^(A0)}           (insert tail output-string #”^(8A)”) |
      {^(E2)^(80)^(B9)}     (insert tail output-string #”^(8B)”) |
      {^(C5)^(92)}           (insert tail output-string #”^(8C)”) |
      {^(C5)^(BD)}           (insert tail output-string #”^(8E)”) |
      {^(E2)^(80)^(98)}     (insert tail output-string #”^(91)”) |
      {^(E2)^(80)^(99)}     (insert tail output-string #”^(92)”) |
      {^(E2)^(80)^(9C)}     (insert tail output-string #”^(93)”) |
      {^(E2)^(80)^(9D)}     (insert tail output-string #”^(94)”) |
      {^(E2)^(80)^(A2)}     (insert tail output-string #”^(95)”) |
      {^(E2)^(80)^(93)}     (insert tail output-string #”^(96)”) |
      {^(E2)^(84)^(84)}     (insert tail output-string #”^(97)”) |
      {^(CB)^(96)}           (insert tail output-string #”^(98)”) |
      {^(E2)^(84)^(A2)}     (insert tail output-string #”^(99)”) |
      {^(C5)^(A1)}           (insert tail output-string #”^(9A)”) |
      {^(E2)^(80)^(BA)}     (insert tail output-string #”^(9B)”) |
      {^(C5)^(93)}           (insert tail output-string #”^(9C)”) |
      {^(C5)^(BE)}           (insert tail output-string #”^(9E)”) |
      {^(C5)^(B8)}           (insert tail output-string #”^(9F)”)
    ]
   
    utf-8-to-iso-8859/addl-rules input-string extra-rules
  ]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end of utf-8-to-win-1252 ;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                             ;;
;;   win-1252-to-utf-8                                                       ;;
;;                                                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  win-1252-to-utf-8: make function! [
    {
      Converts a win-1252 encoded string to UTF-8.
      Invalid characters are replaced
    }

    input-string [string!]
    /local
      extra-rules
      trans-table
  ][
    ;; translation table
    trans-table: compose [
      “^(80)” {^(E2)^(82)^(A0)}
      “^(81)” (replacement-char)
      “^(82)” {^(E2)^(80)^(9A)}
      “^(83)” {^(C6)^(92)}
      “^(84)” {^(E2)^(80)^(9E)}
      “^(85)” {^(E2)^(80)^(A6)}
      “^(86)” {^(E2)^(80)^(A0)}
      “^(87)” {^(E2)^(80)^(A1)}
      “^(88)” {^(CB)^(86)}
      “^(89)” {^(E2)^(80)^(B0)}
      “^(8A)” {^(C5)^(A0)}
      “^(8B)” {^(E2)^(80)^(B9)}
      “^(8C)” {^(C5)^(92)}
      “^(8D)” (replacement-char)
      “^(8E)” {^(C5)^(BD)}
      “^(8F)” (replacement-char)
      “^(90)” (replacement-char)
      “^(91)” {^(E2)^(80)^(98)}
      “^(92)” {^(E2)^(80)^(99)}
      “^(93)” {^(E2)^(80)^(9C)}
      “^(94)” {^(E2)^(80)^(9D)}
      “^(95)” {^(E2)^(80)^(A2)}
      “^(96)” {^(E2)^(80)^(93)}
      “^(97)” {^(E2)^(84)^(84)}
      “^(98)” {^(CB)^(96)}
      “^(99)” {^(E2)^(84)^(A2)}
      “^(9A)” {^(C5)^(A1)}
      “^(9B)” {^(E2)^(80)^(BA)}
      “^(9C)” {^(C5)^(93)}
      “^(9D)” (replacement-char)
      “^(9E)” {^(C5)^(BE)}
      “^(9F)” {^(C5)^(B8)}
    ]
   
    ;; Define the additional rules to be applied before the default rules
    extra-rules: [
      copy transfer ch128-159 (
        insert tail output-string select/case trans-table transfer
      )
    ]
   
    iso-8859-to-utf-8/addl-rules input-string extra-rules
  ]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end of win-1252-to-utf-8 ;;;;;;;;;;;;;;;;;;;;;

]

Print This Post Print This Post
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Sticky notes

January 15th, 2014

The following script permit you to create sticky notes:

  • press the “New” button to create a sticky note
  • press the X  to delete a note
  • press the editor button to edit a note
  • press and continue to press the arrow resize a note


Here is the source code:

REBOL [
    Title:   "Sticky Notes"
    Date:   10-Dec-2008
    File:   %sticky-notes.r
    Purpose: {Simple but useful sticky note application.
    Click on New to create new note item.
    Use icons on note items to edit, delete & resize the item.
    Click on an item to move, hold CTRL to align.
    All notes will be saved (compressed) under %notes.dat when you
    click on Save or Quit.
    }
    Version: 1.0.0
    Author: "Endo"
]
delete-img: make image! [16×16 #{
000000000000000000000000000000000000000000000000000000000000
4A06065D0F10250C0C0603030000000000000000000000000000004A0C0C
7F28284521210B0707000000000000480202A01918B74D4C6D3837211010
060404000000000000000000490605A61816CF5B589158572517170C0202
4702029F1312D65A55F1A499D76F60852C233115140E0A0A000000350302
9A100BD93524F58F7DDF9990744644371010901312D6514AF5917FFE8769
FA603DDD39229229253A1E1E00000033010190120AE4472CFE7D5DFB9E8A
CD857E844645C05C56F48C78FE876AFB7556EB4B34CE1B109713123B1414
0000000C00003306049C3024EE6D54FE8263F89F8CE49C93F2927FFD7F60
F77358E24939C216108B02023F02020D02020000000000000800003A0907
A73325F15433FE5E38FE6A49FD5C37F25336D93225B10C09700101290000
0600000000000000000000000000003701007A0E07DB381BFE5027FF5228
F94924DC3121A41211540101180000020000000000000000000000000000
460101980804C72615F05D3FFA7D62FB8267FA6A4AE1442E812C28180909
0101010000000000000000000000004801019F0905D42515F25539F16751
DD473CDF5547F6775EF55838BD41324825230A0808000000000000000000
4901019E0907D5291CEE5239E7513FCB261F9B08077F110EC54A3DF5684D
ED4E32A33D34321D1D040404000000000000600202B81E18E65141DF4336
BC17137D03023300001801015C130FC84A3DF3654CE14F3B883A35221616
0403030000002F01017F1410C62823AA0E0C6201011F0000040000020000
160101661512CD5145EF6855CE473D69302F110C0C0100000C0000300101
5A02023F00001100000100000000000000000300001C0201711A16CB4139
CE2B268C29291E0F0F000000000000050000070000040000000000000000
0000000000000000000600002402026F08088505053F0707090303000000
000000000000000000000000000000000000000000000000000000000000
0900001E0000210000080000000000000000
}
#{
FFFFFFFFFFFFFFFFFFFF
FCECF3FFFFFFFFFFFFFD
EAE8FCFFFFFCD2859BE1
FDFFFFFFFBD47977D6FD
FCD163162170CCF6FFFC
CE6115187BE0CF631201
011155B9FFF6971D0102
25785A11010000042A8F
FFFCC9530B0004120B01
0001082C7CCCFFFFF8BE
4808000000000211459A
DFFAFFFFFFF192190000
00021B62B8EEFEFFFFFF
FBCC5A0C0000000648C1
F6FFFFFFFFFBCB5D1001
020502022CA6F5FFFFFF
FBCD5C10010622452304
0748C2FAFFFFE7791202
0C398CC58D25030E62D7
FEFFED84181954AAE7FB
E68720031982E9FFFDD0
7C84C7F3FFFFFEE27C1B
0744C8FCFFFBECEDFBFF
FFFFFFFEDC784082DEFE
FFFFFFFFFFFFFFFFFFFF
FCDAB6DAFAFF
}
]
edit-img: make image! [16×16 #{
000000000000000000000000010101070707090A09080908050605030302
000000000000000000000000000000000000000000000000000000000000
0C0D0D3E43414F55534B514D404641333834292C291F221F161815090A09
0101010000000000000000000000000202022E3334949E9EA4AFAF9AA6A5
8F9C9983908E7C898674807C67716B3F453D0C0C0A000000000000000000
0000000F1212747E80D7E2E4DBE7E9CFDEE1BED1D5AAC3C898B7BD8BADB3
83A4A86D7C77201F19010100000000000000030404394244B4C4C7E1F0F3
E1F1F5DBEEF2CFE8EEBDDFE6A6D3DD92C8D48EC0CB82939029261E020101
000000000000131819758A8ECAE1E6D4EBF0CDE8EEC8E5ECC0E2E9B2DBE4
9FD2DD8FCAD79FCAD49199932D281D020201000000040606394B4F99BEC5
B9DEE6C1E2E9BEE1E8B3DBE4A9D6E09FD2DD92CCD88FC8D5B1D1D894988F
302A1D030201010101141F215F899292CAD5A0D2DDA9D7E1AAD7E1A3D4DE
97CEDA8CC8D585C4D299CBD6C0D5DA92948B332C1D040301060B0C2C5057
62AAB974BECE85C6D495CDD993CCD88FCAD688C6D37FC2D082C1CFADD3DB
C4D4D78D8E83372E1C050401122C32317C8C44A5B94FACBF6DB9C981C2D0
80C1D07CC0CE79BECC78BDCB8FC5D1BFD9DFC0CDD08787793A301B060502
2466742790A62696AE309AB158ACBE6BB5C56CB5C56BB5C56AB5C575B8C7
A4CCD5C5D9DFB8C4C6827F6E3F331C080603337685348EA13096AC399DB3
55AABD5CACBE5BABBD5BAABC5EABBD7FB9C6B6D1D8C4D6DBAEB9BA7F7A65
483A1F0B0804101F2219333928515A558C9773B1BE6DB3C363B0C15BACBD
61ACBD96C1CBBED3D8C0D0D5A3AEAE7C755E4E40230D0A05000000010202
080A0B2F36385966696F868B7A9EA57BABB688B7C1AFC9D0BED1D6BBC9CC
919C9C5956483028180806030000000000000000000303030A0A0A171818
2B2E2F454C4D656E70899294A2ACAF9CA5A65960611A1C1B060503010100
0000000000000000000000000000000000000101010505050F0F0F212222
3C3E3E3F4141161717020303000000000000
}
#{
FFFFFFFFFFF9F6FAFDFF
FFFFFFFFFFFFFFFFFFFF
F5B997A6B8C8D6E3EEF9
FFFFFFFFFFFECD4C191E
2936465974B0F0FFFFFF
FFF08614010101020406
0E3FC8FEFFFFFDC44208
0000000000000020B4FD
FFFFEB84280700000000
0000001BABFCFFFBBF58
2B080000000000000016
A2FBFFE68B5031070000
00000000001299F9F7BC
6F5B3305000000000000
000F8FF7D8906B612D03
000000000000000C85F4
996B65591F0100000000
0000000A7BF17F635940
0F000000000000000008
70EDDCC5A25110030100
00000000000866E5FFFE
F3BC7B502E1609030001
0C3E97ECFFFFFFFCF2E0
C39D724929245CBAEEFE
FFFFFFFFFFFFFEF9EBD2
AEA2D4F8FFFF
}
]
resize-img: make image! [16×16 #{
0000000000000000000000000000000000000000000E380E143714060C06
000000000000000000000000000000000000000000000000000000000000
0000000000000000000E660D2A77271A2D19060806000000000000000000
000000000000000000000000000000000000000000000000041F04156F11
66BA5B5D905621361F0A0D0A000000000000000000000000000000042704
0D480C1446141848171A4F181F631C338E2CA1DC92AEE29E5A9A4C294426
0E130E020302000000000000000000074B062B992466B05D82BA7D88C284
89C78390D184BDEEAAC1F2A991DD7458A1472B4C280B100B010101000000
0000000A610747B2319CDD80C3ECB0C7EEB5C2EFADB1EC959DE8779AE773
9DE67980D55D56A4422A4E260D120D04040401210012770C50BB3074D145
81D85484DC5782DD557CDC4C76DB4477D9457FD95379D54C6FCD4754A83F
2C582917221703360220871461C43B72D04373D24474D34472D4426FD33D
6DD23A71D2407DD55281D55675D14C4FBD352C9126234823054D03369B26
83D4619CDE7A9DDE7C9BDE7993DB6F84D65A7BD34E8BD8649DDE7C8CD76C
51BD3918970F085D07092109076F053DA82D7FD26590D87995DA7E98DB80
9BDC80A3E085A2E083A4E0858BD76E4BBA37138E0C014F01001600000200
0262010F680B1F8018248B1E2991212F972447AD3692D877AAE48E86D56A
40B42E0E8609014300001000000100000000001400001100001900001D00
012000023101277D1E8BD77182D66937B0280A7D06013800000B00000100
000000000000000000000000000000000000000300022D012F8F2269CB53
32AB25077204003000000800000000000000000000000000000000000000
000000000000000000023F011994111FA016066804002500000500000000
000000000000000000000000000000000000000000000000000000002C00
026602025801001D00000300000000000000000000000000000000000000
000000000000000000000000000000000D00001B00001200000200000000
000000000000000000000000000000000000
}
#{
FFFFFFFFFFFFFFFCF5FC
FFFFFFFFFFFFFFFFFFFF
FFFFFFE4A5CFF9FFFFFF
FFFFFFFFFFFFFFFFFEC4
3E57C0F6FFFFFFFFFFFF
F4E7DED9D1901C0C49B3
F3FFFFFFFFF3A6635046
3B240600093DA6EFFFFF
FFDC5109040201010000
00063299E9FEFDC12E01
00000000000000000429
8CDDF79B170000000000
0000000000042B8EEB73
0A000000000000000000
010E47A1D65105010000
0000000000011353B1EA
E0793628211A0C010000
021961BFF3FFFBE1C3B5
AA97490600042170CBF7
FFFFFFFFFEFCFAE66807
062B81D5F9FFFFFFFFFF
FFFFFFE1560D3692DFFC
FFFFFFFFFFFFFFFFFFE6
734FA1E7FDFFFFFFFFFF
FFFFFFFFFFF9CEBFEAFE
FFFFFFFFFFFF
}
]
random/seed now
base-face: make face [
    size: 200×80
    offset: 100×100
    text: “New Note”
    color: white
    edge: make edge [size: 1×1 color: black]
    effect: [gradient 0×1]
    indent: 3×2
    data: true   ;means this is a notes item
    font: make font [
        name: “Verdana”
        size: 12
        style: [bold]
        color: white
        align: ‘left
        valign: ‘top
        space: 0×0
        shadow: 1×1
    ]
]
;I took this function from %chess-board.r
move-to-end: func [series item /local item-index item-value] [
    item-index: find series item
    item-value: first item-index
    remove item-index
    append series item-value
    show last series
    show item-value
]
button-face: make face [
    size: 16×16
    color: none
    edge: none
]
drag-feel: make face/feel [
    engage: func [f a e] [
        if find [down] a [move-to-end main-window/pane f data: e/offset mode: ‘move]
        if find [alt-down] a [move-to-end main-window/pane f data: e/offset - f/para/scroll mode: ’scroll]
        if find [over away] a [
            if/else mode = ‘move [
                f/offset: f/offset + e/offset - data
                if e/control [ ;snap to grid
                    f/offset: (f/offset / 10) * 10
                ]
            ] [
                f/para/scroll: to-pair reduce [0 second e/offset - data]
            ]
            show f
        ]
    ]
]
delete-feel: make face/feel [
    engage: func [f a e] [
        if a = ‘down [
            if request/confirm “Delete Item?” [
                remove find main-window/pane f/parent-face
                show main-window
            ]
        ]
    ]
]
resize-feel: make face/feel [
    engage: func [f a e] [
        if find [down alt-down] a [data: e/offset]
        if find [over away] a [
            old-size: f/parent-face/size
            f/parent-face/size: f/parent-face/size + e/offset - data
            if any [f/parent-face/size/x < 60 f/parent-face/size/y < 40] [f/parent-face/size: old-size ]
            data: e/offset
            f/parent-face/line-list: none   ;if you remove this word wrap won’t work if text length > 200
            show f/parent-face
        ]
    ]
]
edit-feel: make face/feel [
    engage: func [f a e] [
        if a = ‘down [
            edit-area/text: copy f/parent-face/text
            inform/offset/title edit-window (main-window/offset + f/parent-face/offset + 30×50) “Enter Note”
            if edit-area/text <> “_cancel_” [
                f/parent-face/text: copy edit-area/text
                f/parent-face/line-list: none
                show f/parent-face
                save-note-list
            ]
        ]
    ]
]
add-new-item: func [item [block!]] [
    append main-window/pane make base-face [
        feel: drag-feel offset: item/1 size: item/2 color: item/3 text: item/4
        para: make para [
            origin: 2×16
            ;indent: 10×10
            wrap?: on
        ]
        pane: reduce [
            ;delete button
            make button-face [
                image: delete-img
                offset: 0×0
                feel: delete-feel
            ]
            ;edit button
            make button-face [
                image: edit-img
                offset: 16×0
                feel: edit-feel
            ]
            ;resize button
            make button-face [
                image: resize-img
                offset: 32×0
                feel: resize-feel
            ]
        ]
    ]
]
load-note-list: does [
    foreach item items [
        add-new-item to-block item
    ]
]
save-note-list: has [f] [
    items: copy []
    foreach f main-window/pane [
        if f/data [
            append/only items reduce [f/offset f/size f/color f/text]
        ]
    ]
    save %notes.dat compress mold items
    ;save %notes.dat items   ;uncompressed file
]
edit-window: layout [
    backcolor 120.140.120
    backeffect [grid 110.130.110]
    edit-area: area wrap copy “”
    across
    button “OK” [hide-popup]
    button “Cancel” [edit-area/text: copy “_cancel_” hide-popup]
]
main-window: layout [
    size 800×600
    backcolor 100.120.100
    backeffect [grid 10×10 110.130.110]
    across
    button “New”     [add-new-item reduce [100×100 200×80 random 255.255.255 “New Note”] show main-window]
    button “Save”   [save-note-list]
    button “Quit”   [save-note-list quit]
]
if items: attempt [load decompress load %notes.dat] [load-note-list]
;if items: attempt [load %notes.dat] [load-note-list]   ;load from uncompressed file

view main-window
Print This Post Print This Post
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Placing an image on a sphere

December 2nd, 2013

Rebol programmers continue to surprise me, the following script can place any image on the surface of a rotating 3D sphere! Mr. Phil Bevan is a 3D master!

Here is the source code:

rebol [
    Title:   "Mapping a picture onto a 3D Sphere"
    Date:     19-Feb-2006
    File:     %sphere.r
    Version: 1.0.1
    Email: phil.bevan@gmail.com
    Category: [demo]
    License: {Copyright (c) <2006>, <Phil Bevan>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
}
    Purpose:   " A 3D Perspective demo"
    license:   'mit
    History: [
        0.0.1 - Initial Version
        1.0.0 - Initial Release
        1.0.1 - Allow selection of Image
        2.0.1 - start with earth image ; by Massimiliano Vessi
      ]
]
objs: [
[
    [0 0 0 0 340 135] [[0.418113853070614 0.0 3.97808758147309] [0.408977062214588 8.69307581462395E-2 3.97808758147309] [0.381966011250105 0.17006222502143 3.97808758147309] [0.338261212717716 0.245761156614089 3.97808758147309] [0.279772776032178 0.310719146369842 3.97808758147309] [0.209056926535307 0.362097218433346 3.97808758147309] [0.12920428618241 0.397649904516082 3.97808758147309] [4.37047985323887E-2 0.415823381635519 3.97808758147309] [-4.37047985323888E-2 0.415823381635519 3.97808758147309] [-0.129204286182409 0.397649904516082 3.97808758147309] [-0.209056926535307 0.362097218433346 3.97808758147309] [-0.279772776032178 0.310719146369842 3.97808758147309] [-0.338261212717716 0.245761156614089 3.97808758147309] [-0.381966011250105 0.17006222502143 3.97808758147309] [-0.408977062214588 8.69307581462395E-2 3.97808758147309] [-0.418113853070614 0.0 3.97808758147309] [-0.408977062214588 -8.69307581462397E-2 3.97808758147309] [-0.381966011250105 -0.17006222502143 3.97808758147309] [-0.338261212717716 -0.245761156614089 3.97808758147309] [-0.279772776032178 -0.310719146369842 3.97808758147309] [-0.209056926535307 -0.362097218433346 3.97808758147309] [-0.129204286182409 -0.397649904516082 3.97808758147309] [-4.37047985323886E-2 -0.415823381635519 3.97808758147309] [4.3704798532389E-2 -0.415823381635519 3.97808758147309] [0.12920428618241 -0.397649904516082 3.97808758147309] [0.209056926535307 -0.362097218433346 3.97808758147309] [0.279772776032178 -0.310719146369842 3.97808758147309] [0.338261212717716 -0.245761156614089 3.97808758147309] [0.381966011250105 -0.17006222502143 3.97808758147309] [0.408977062214588 -8.69307581462396E-2 3.97808758147309] [0.967687582398671 0.0 3.88118290510399] [0.946541286983157 0.201193561439857 3.88118290510399] [0.884026595317456 0.393593998810972 3.88118290510399] [0.782875699406132 0.568792489760496 3.88118290510399] [0.64750937877636 0.719132019538302 3.88118290510399] [0.483843791199336 0.838042029283996 3.88118290510399] [0.299031908206797 0.920325580978159 3.88118290510399] [0.101150895911324 0.962386488571468 3.88118290510399] [-0.101150895911324 0.962386488571468 3.88118290510399] [-0.299031908206796 0.920325580978159 3.88118290510399] [-0.483843791199335 0.838042029283996 3.88118290510399] [-0.64750937877636 0.719132019538302 3.88118290510399] [-0.782875699406132 0.568792489760496 3.88118290510399] [-0.884026595317456 0.393593998810972 3.88118290510399] [-0.946541286983157 0.201193561439857 3.88118290510399] [-0.967687582398671 0.0 3.88118290510399] [-0.946541286983157 -0.201193561439858 3.88118290510399] [-0.884026595317456 -0.393593998810972 3.88118290510399] [-0.782875699406132 -0.568792489760496 3.88118290510399] [-0.64750937877636 -0.719132019538302 3.88118290510399] [-0.483843791199336 -0.838042029283996 3.88118290510399] [-0.299031908206796 -0.920325580978159 3.88118290510399] [-0.101150895911324 -0.962386488571468 3.88118290510399] [0.101150895911324 -0.962386488571468 3.88118290510399] [0.299031908206797 -0.920325580978159 3.88118290510399] [0.483843791199336 -0.838042029283996 3.88118290510399] [0.64750937877636 -0.719132019538302 3.88118290510399] [0.782875699406132 -0.568792489760496 3.88118290510399] [0.884026595317456 -0.393593998810972 3.88118290510399] [0.946541286983157 -0.201193561439858 3.88118290510399] [1.49842637366365 0.0 3.70873541826715] [1.46568216227535 0.311540360914333 3.70873541826715] [1.3688806072723 0.609464913120197 3.70873541826715] [1.21225240111352 0.880752924085583 3.70873541826715] [1.00264294799366 1.113547805947 3.70873541826715] [0.749213186831824 1.29767530529331 3.70873541826715] [0.463039214281692 1.42508816686133 3.70873541826715] [0.156628206158784 1.49021783720578 3.70873541826715] [-0.156628206158784 1.49021783720578 3.70873541826715] [-0.463039214281692 1.42508816686133 3.70873541826715] [-0.749213186831824 1.29767530529331 3.70873541826715] [-1.00264294799366 1.113547805947 3.70873541826715] [-1.21225240111352 0.880752924085583 3.70873541826715] [-1.3688806072723 0.609464913120197 3.70873541826715] [-1.46568216227535 0.311540360914333 3.70873541826715] [-1.49842637366365 0.0 3.70873541826715] [-1.46568216227535 -0.311540360914333 3.70873541826715] [-1.3688806072723 -0.609464913120197 3.70873541826715] [-1.21225240111352 -0.880752924085583 3.70873541826715] [-1.00264294799366 -1.113547805947 3.70873541826715] [-0.749213186831824 -1.29767530529331 3.70873541826715] [-0.463039214281692 -1.42508816686133 3.70873541826715] [-0.156628206158783 -1.49021783720578 3.70873541826715] [0.156628206158785 -1.49021783720578 3.70873541826715] [0.463039214281692 -1.42508816686133 3.70873541826715] [0.749213186831824 -1.29767530529331 3.70873541826715] [1.00264294799366 -1.113547805947 3.70873541826715] [1.21225240111352 -0.880752924085583 3.70873541826715] [1.3688806072723 -0.609464913120196 3.70873541826715] [1.46568216227535 -0.311540360914333 3.70873541826715] [2.0 0.0 3.46410161513775] [1.95629520146761 0.415823381635519 3.46410161513775] [1.8270909152852 0.8134732861516 3.46410161513775] [1.61803398874989 1.17557050458495 3.46410161513775] [1.33826121271772 1.48628965095479 3.46410161513775] [1.0 1.73205080756888 3.46410161513775] [0.618033988749895 1.90211303259031 3.46410161513775] [0.209056926535307 1.98904379073655 3.46410161513775] [-0.209056926535307 1.98904379073655 3.46410161513775] [-0.618033988749895 1.90211303259031 3.46410161513775] [-0.999999999999999 1.73205080756888 3.46410161513775] [-1.33826121271772 1.48628965095479 3.46410161513775] [-1.61803398874989 1.17557050458495 3.46410161513775] [-1.8270909152852 0.813473286151601 3.46410161513775] [-1.95629520146761 0.415823381635519 3.46410161513775] [-2.0 0.0 3.46410161513775] [-1.95629520146761 -0.415823381635519 3.46410161513775] [-1.8270909152852 -0.813473286151601 3.46410161513775] [-1.61803398874989 -1.17557050458495 3.46410161513775] [-1.33826121271772 -1.48628965095479 3.46410161513775] [-1.0 -1.73205080756888 3.46410161513775] [-0.618033988749895 -1.90211303259031 3.46410161513775] [-0.209056926535306 -1.98904379073655 3.46410161513775] [0.209056926535308 -1.98904379073655 3.46410161513775] [0.618033988749895 -1.90211303259031 3.46410161513775] [1.0 -1.73205080756888 3.46410161513775] [1.33826121271772 -1.48628965095479 3.46410161513775] [1.61803398874989 -1.17557050458495 3.46410161513775] [1.8270909152852 -0.8134732861516 3.46410161513775] [1.95629520146761 -0.415823381635519 3.46410161513775] [2.46264590130263 0.0 3.15204301442689] [2.40883117981611 0.512012873225255 3.15204301442689] [2.24973897691719 1.00164832698021 3.15204301442689] [1.99232238528164 1.44750694240419 3.15204301442689] [1.64783174518579 1.83010255853617 3.15204301442689] [1.23132295065132 2.13271391105371 3.15204301442689] [0.760999434630323 2.34211543176142 3.15204301442689] [0.25741659163555 2.4491552693844 3.15204301442689] [-0.25741659163555 2.4491552693844 3.15204301442689] [-0.760999434630323 2.34211543176142 3.15204301442689] [-1.23132295065132 2.13271391105371 3.15204301442689] [-1.64783174518579 1.83010255853617 3.15204301442689] [-1.99232238528164 1.44750694240419 3.15204301442689] [-2.24973897691719 1.00164832698021 3.15204301442689] [-2.40883117981611 0.512012873225255 3.15204301442689] [-2.46264590130263 0.0 3.15204301442689] [-2.40883117981611 -0.512012873225256 3.15204301442689] [-2.24973897691719 -1.00164832698021 3.15204301442689] [-1.99232238528164 -1.44750694240419 3.15204301442689] [-1.64783174518579 -1.83010255853617 3.15204301442689] [-1.23132295065132 -2.1327139110537 3.15204301442689] [-0.760999434630323 -2.34211543176142 3.15204301442689] [-0.257416591635549 -2.4491552693844 3.15204301442689] [0.257416591635551 -2.4491552693844 3.15204301442689] [0.760999434630323 -2.34211543176142 3.15204301442689] [1.23132295065132 -2.1327139110537 3.15204301442689] [1.64783174518579 -1.83010255853617 3.15204301442689] [1.99232238528164 -1.44750694240419 3.15204301442689] [2.24973897691719 -1.00164832698021 3.15204301442689] [2.40883117981611 -0.512012873225256 3.15204301442689] [2.8773592013546 0.0 2.77863348183599] [2.81448199925435 0.598236616643673 2.77863348183599] [2.62859842840364 1.17032742248224 2.77863348183599] [2.327832492817 1.69126930410429 2.77863348183599] [1.92532910711465 2.13829460152644 2.77863348183599] [1.4386796006773 2.49186616418599 2.77863348183599] [0.889152892139699 2.73653121817012 2.77863348183599] [0.300765935586639 2.86159672658652 2.77863348183599] [-0.30076593558664 2.86159672658652 2.77863348183599] [-0.889152892139699 2.73653121817012 2.77863348183599] [-1.4386796006773 2.49186616418599 2.77863348183599] [-1.92532910711465 2.13829460152644 2.77863348183599] [-2.327832492817 1.69126930410429 2.77863348183599] [-2.62859842840364 1.17032742248224 2.77863348183599] [-2.81448199925435 0.598236616643673 2.77863348183599] [-2.8773592013546 0.0 2.77863348183599] [-2.81448199925435 -0.598236616643675 2.77863348183599] [-2.62859842840364 -1.17032742248224 2.77863348183599] [-2.327832492817 -1.69126930410429 2.77863348183599] [-1.92532910711465 -2.13829460152644 2.77863348183599] [-1.4386796006773 -2.49186616418599 2.77863348183599] [-0.889152892139699 -2.73653121817012 2.77863348183599] [-0.300765935586638 -2.86159672658652 2.77863348183599] [0.300765935586641 -2.86159672658652 2.77863348183599] [0.889152892139699 -2.73653121817012 2.77863348183599] [1.4386796006773 -2.49186616418599 2.77863348183599] [1.92532910711465 -2.13829460152644 2.77863348183599] [2.327832492817 -1.69126930410429 2.77863348183599] [2.62859842840364 -1.17032742248224 2.77863348183599] [2.81448199925435 -0.598236616643674 2.77863348183599] [3.23606797749979 0.0 2.35114100916989] [3.16535212800292 0.672816364803188 2.35114100916989] [2.95629520146761 1.31622742593336 2.35114100916989] [2.61803398874989 1.90211303259031 2.35114100916989] [2.16535212800292 2.40486717237207 2.35114100916989] [1.6180339887499 2.80251707688815 2.35114100916989] [1.0 3.07768353717525 2.35114100916989] [0.338261212717716 3.21834045852367 2.35114100916989] [-0.338261212717717 3.21834045852367 2.35114100916989] [-1.0 3.07768353717525 2.35114100916989] [-1.61803398874989 2.80251707688815 2.35114100916989] [-2.16535212800292 2.40486717237207 2.35114100916989] [-2.61803398874989 1.90211303259031 2.35114100916989] [-2.95629520146761 1.31622742593336 2.35114100916989] [-3.16535212800292 0.672816364803188 2.35114100916989] [-3.23606797749979 0.0 2.35114100916989] [-3.16535212800292 -0.672816364803189 2.35114100916989] [-2.95629520146761 -1.31622742593336 2.35114100916989] [-2.61803398874989 -1.90211303259031 2.35114100916989] [-2.16535212800292 -2.40486717237207 2.35114100916989] [-1.6180339887499 -2.80251707688815 2.35114100916989] [-1.0 -3.07768353717525 2.35114100916989] [-0.338261212717715 -3.21834045852367 2.35114100916989] [0.338261212717719 -3.21834045852367 2.35114100916989] [1.0 -3.07768353717525 2.35114100916989] [1.6180339887499 -2.80251707688815 2.35114100916989] [2.16535212800292 -2.40486717237207 2.35114100916989] [2.61803398874989 -1.90211303259031 2.35114100916989] [2.95629520146761 -1.31622742593336 2.35114100916989] [3.16535212800292 -0.672816364803189 2.35114100916989] [3.53179037143571 0.0 1.87788625114356] [3.45461227811459 0.73430050773908 1.87788625114356] [3.22645105117096 1.43650855972519 1.87788625114356] [2.8572784310613 2.07593429451846 1.87788625114356] [2.36322903277115 2.62463173920333 1.87788625114356] [1.76589518571785 3.0586201825046 1.87788625114356] [1.09138324534344 3.35893224694241 1.87788625114356] [0.36917262010967 3.51244285424366 1.87788625114356] [-0.36917262010967 3.51244285424366 1.87788625114356] [-1.09138324534344 3.35893224694241 1.87788625114356] [-1.76589518571785 3.0586201825046 1.87788625114356] [-2.36322903277115 2.62463173920333 1.87788625114356] [-2.8572784310613 2.07593429451847 1.87788625114356] [-3.22645105117096 1.43650855972519 1.87788625114356] [-3.45461227811459 0.73430050773908 1.87788625114356] [-3.53179037143571 0.0 1.87788625114356] [-3.45461227811459 -0.734300507739082 1.87788625114356] [-3.22645105117096 -1.43650855972519 1.87788625114356] [-2.8572784310613 -2.07593429451847 1.87788625114356] [-2.36322903277115 -2.62463173920333 1.87788625114356] [-1.76589518571785 -3.0586201825046 1.87788625114356] [-1.09138324534344 -3.35893224694241 1.87788625114356] [-0.369172620109668 -3.51244285424366 1.87788625114356] [0.369172620109672 -3.51244285424366 1.87788625114356] [1.09138324534344 -3.35893224694241 1.87788625114356] [1.76589518571785 -3.0586201825046 1.87788625114356] [2.36322903277115 -2.62463173920333 1.87788625114356] [2.8572784310613 -2.07593429451846 1.87788625114356] [3.22645105117097 -1.43650855972519 1.87788625114356] [3.45461227811459 -0.734300507739081 1.87788625114356] [3.75877048314363 0.0 1.36808057330268] [3.67663232979599 0.781492326546279 1.36808057330268] [3.43380770119695 1.52882968840625 1.36808057330268] [3.04090919881813 2.20934985674408 1.36808057330268] [2.51510837254968 2.79331083470536 1.36808057330268] [1.87938524157182 3.25519072539749 1.36808057330268] [1.16152395724631 3.57480316125163 1.36808057330268] [0.392898502378819 3.73817954515033 1.36808057330268] [-0.39289850237882 3.73817954515033 1.36808057330268] [-1.16152395724631 3.57480316125164 1.36808057330268] [-1.87938524157182 3.25519072539749 1.36808057330268] [-2.51510837254968 2.79331083470536 1.36808057330268] [-3.04090919881813 2.20934985674408 1.36808057330268] [-3.43380770119695 1.52882968840625 1.36808057330268] [-3.67663232979599 0.781492326546279 1.36808057330268] [-3.75877048314363 0.0 1.36808057330268] [-3.67663232979599 -0.78149232654628 1.36808057330268] [-3.43380770119695 -1.52882968840625 1.36808057330268] [-3.04090919881813 -2.20934985674408 1.36808057330268] [-2.51510837254968 -2.79331083470536 1.36808057330268] [-1.87938524157182 -3.25519072539749 1.36808057330268] [-1.16152395724631 -3.57480316125164 1.36808057330268] [-0.392898502378818 -3.73817954515033 1.36808057330268] [0.392898502378822 -3.73817954515033 1.36808057330268] [1.16152395724631 -3.57480316125163 1.36808057330268] [1.87938524157182 -3.25519072539749 1.36808057330268] [2.51510837254968 -2.79331083470536 1.36808057330268] [3.04090919881813 -2.20934985674408 1.36808057330268] [3.43380770119695 -1.52882968840624 1.36808057330268] [3.67663232979599 -0.78149232654628 1.36808057330268] [3.91259040293522 0.0 0.831646763271038] [3.8270909152852 0.8134732861516 0.831646763271038] [3.57432919021751 1.59139388622046 0.831646763271038] [3.16535212800292 2.29976293710639 0.831646763271038] [2.61803398874989 2.90762131215382 0.831646763271038] [1.95629520146761 3.3884026835451 0.831646763271038] [1.20905692653531 3.72109459830542 0.831646763271038] [0.408977062214588 3.89115682332685 0.831646763271038] [-0.408977062214588 3.89115682332685 0.831646763271038] [-1.20905692653531 3.72109459830542 0.831646763271038] [-1.95629520146761 3.3884026835451 0.831646763271038] [-2.61803398874989 2.90762131215382 0.831646763271038] [-3.16535212800292 2.29976293710639 0.831646763271038] [-3.57432919021751 1.59139388622047 0.831646763271038] [-3.8270909152852 0.8134732861516 0.831646763271038] [-3.91259040293522 0.0 0.831646763271038] [-3.8270909152852 -0.813473286151602 0.831646763271038] [-3.57432919021751 -1.59139388622047 0.831646763271038] [-3.16535212800292 -2.29976293710639 0.831646763271038] [-2.61803398874989 -2.90762131215382 0.831646763271038] [-1.95629520146761 -3.38840268354509 0.831646763271038] [-1.20905692653531 -3.72109459830542 0.831646763271038] [-0.408977062214586 -3.89115682332685 0.831646763271038] [0.40897706221459 -3.89115682332685 0.831646763271038] [1.20905692653531 -3.72109459830542 0.831646763271038] [1.95629520146761 -3.38840268354509 0.831646763271038] [2.61803398874989 -2.90762131215382 0.831646763271038] [3.16535212800292 -2.29976293710639 0.831646763271038] [3.57432919021751 -1.59139388622046 0.831646763271038] [3.8270909152852 -0.813473286151602 0.831646763271038] [3.9902562010393 0.0 0.279025894976501] [3.90305952935978 0.829620913554129 0.279025894976501] [3.64528042728967 1.62298341222312 0.279025894976501] [3.22818507855081 2.34541374783949 0.279025894976501] [2.67000255132862 2.96533824813144 0.279025894976501] [1.99512810051965 3.45566323770842 0.279025894976501] [1.23305697803116 3.79495916168557 0.279025894976501] [0.417095348738863 3.96839716006261 0.279025894976501] [-0.417095348738863 3.96839716006261 0.279025894976501] [-1.23305697803116 3.79495916168557 0.279025894976501] [-1.99512810051965 3.45566323770842 0.279025894976501] [-2.67000255132862 2.96533824813144 0.279025894976501] [-3.22818507855081 2.34541374783949 0.279025894976501] [-3.64528042728967 1.62298341222312 0.279025894976501] [-3.90305952935978 0.829620913554129 0.279025894976501] [-3.9902562010393 0.0 0.279025894976501] [-3.90305952935978 -0.829620913554131 0.279025894976501] [-3.64528042728967 -1.62298341222312 0.279025894976501] [-3.22818507855081 -2.34541374783949 0.279025894976501] [-2.67000255132862 -2.96533824813144 0.279025894976501] [-1.99512810051965 -3.45566323770842 0.279025894976501] [-1.23305697803116 -3.79495916168557 0.279025894976501] [-0.417095348738861 -3.96839716006261 0.279025894976501] [0.417095348738865 -3.96839716006261 0.279025894976501] [1.23305697803116 -3.79495916168557 0.279025894976501] [1.99512810051965 -3.45566323770842 0.279025894976501] [2.67000255132862 -2.96533824813144 0.279025894976501] [3.22818507855081 -2.34541374783949 0.279025894976501] [3.64528042728967 -1.62298341222312 0.279025894976501] [3.90305952935978 -0.82962091355413 0.279025894976501] [3.9902562010393 0.0 -0.279025894976501] [3.90305952935978 0.829620913554129 -0.279025894976501] [3.64528042728967 1.62298341222312 -0.279025894976501] [3.22818507855081 2.34541374783949 -0.279025894976501] [2.67000255132862 2.96533824813144 -0.279025894976501] [1.99512810051965 3.45566323770842 -0.279025894976501] [1.23305697803116 3.79495916168557 -0.279025894976501] [0.417095348738863 3.96839716006261 -0.279025894976501] [-0.417095348738863 3.96839716006261 -0.279025894976501] [-1.23305697803116 3.79495916168557 -0.279025894976501] [-1.99512810051965 3.45566323770842 -0.279025894976501] [-2.67000255132862 2.96533824813144 -0.279025894976501] [-3.22818507855081 2.34541374783949 -0.279025894976501] [-3.64528042728967 1.62298341222312 -0.279025894976501] [-3.90305952935978 0.829620913554129 -0.279025894976501] [-3.9902562010393 0.0 -0.279025894976501] [-3.90305952935978 -0.829620913554131 -0.279025894976501] [-3.64528042728967 -1.62298341222312 -0.279025894976501] [-3.22818507855081 -2.34541374783949 -0.279025894976501] [-2.67000255132862 -2.96533824813144 -0.279025894976501] [-1.99512810051965 -3.45566323770842 -0.279025894976501] [-1.23305697803116 -3.79495916168557 -0.279025894976501] [-0.417095348738861 -3.96839716006261 -0.279025894976501] [0.417095348738865 -3.96839716006261 -0.279025894976501] [1.23305697803116 -3.79495916168557 -0.279025894976501] [1.99512810051965 -3.45566323770842 -0.279025894976501] [2.67000255132862 -2.96533824813144 -0.279025894976501] [3.22818507855081 -2.34541374783949 -0.279025894976501] [3.64528042728967 -1.62298341222312 -0.279025894976501] [3.90305952935978 -0.82962091355413 -0.279025894976501] [3.91259040293522 0.0 -0.831646763271037] [3.8270909152852 0.813473286151601 -0.831646763271037] [3.57432919021751 1.59139388622047 -0.831646763271037] [3.16535212800292 2.29976293710639 -0.831646763271037] [2.61803398874989 2.90762131215382 -0.831646763271037] [1.95629520146761 3.3884026835451 -0.831646763271037] [1.20905692653531 3.72109459830542 -0.831646763271037] [0.408977062214588 3.89115682332685 -0.831646763271037] [-0.408977062214588 3.89115682332685 -0.831646763271037] [-1.20905692653531 3.72109459830542 -0.831646763271037] [-1.95629520146761 3.3884026835451 -0.831646763271037] [-2.61803398874989 2.90762131215382 -0.831646763271037] [-3.16535212800292 2.29976293710639 -0.831646763271037] [-3.57432919021751 1.59139388622047 -0.831646763271037] [-3.8270909152852 0.8134732861516 -0.831646763271037] [-3.91259040293522 0.0 -0.831646763271037] [-3.8270909152852 -0.813473286151602 -0.831646763271037] [-3.57432919021751 -1.59139388622047 -0.831646763271037] [-3.16535212800292 -2.29976293710639 -0.831646763271037] [-2.61803398874989 -2.90762131215382 -0.831646763271037] [-1.95629520146761 -3.3884026835451 -0.831646763271037] [-1.20905692653531 -3.72109459830542 -0.831646763271037] [-0.408977062214587 -3.89115682332685 -0.831646763271037] [0.40897706221459 -3.89115682332685 -0.831646763271037] [1.20905692653531 -3.72109459830542 -0.831646763271037] [1.95629520146761 -3.3884026835451 -0.831646763271037] [2.61803398874989 -2.90762131215382 -0.831646763271037] [3.16535212800292 -2.29976293710639 -0.831646763271037] [3.57432919021751 -1.59139388622046 -0.831646763271037] [3.8270909152852 -0.813473286151602 -0.831646763271037] [3.75877048314363 0.0 -1.36808057330268] [3.67663232979599 0.781492326546279 -1.36808057330268] [3.43380770119695 1.52882968840625 -1.36808057330268] [3.04090919881813 2.20934985674408 -1.36808057330268] [2.51510837254968 2.79331083470536 -1.36808057330268] [1.87938524157182 3.25519072539749 -1.36808057330268] [1.16152395724631 3.57480316125163 -1.36808057330268] [0.392898502378819 3.73817954515033 -1.36808057330268] [-0.39289850237882 3.73817954515033 -1.36808057330268] [-1.16152395724631 3.57480316125164 -1.36808057330268] [-1.87938524157182 3.25519072539749 -1.36808057330268] [-2.51510837254968 2.79331083470536 -1.36808057330268] [-3.04090919881813 2.20934985674408 -1.36808057330268] [-3.43380770119695 1.52882968840625 -1.36808057330268] [-3.67663232979599 0.781492326546279 -1.36808057330268] [-3.75877048314363 0.0 -1.36808057330268] [-3.67663232979599 -0.78149232654628 -1.36808057330268] [-3.43380770119695 -1.52882968840625 -1.36808057330268] [-3.04090919881813 -2.20934985674408 -1.36808057330268] [-2.51510837254968 -2.79331083470536 -1.36808057330268] [-1.87938524157182 -3.25519072539749 -1.36808057330268] [-1.16152395724631 -3.57480316125164 -1.36808057330268] [-0.392898502378818 -3.73817954515033 -1.36808057330268] [0.392898502378822 -3.73817954515033 -1.36808057330268] [1.16152395724631 -3.57480316125163 -1.36808057330268] [1.87938524157182 -3.25519072539749 -1.36808057330268] [2.51510837254968 -2.79331083470536 -1.36808057330268] [3.04090919881813 -2.20934985674408 -1.36808057330268] [3.43380770119695 -1.52882968840624 -1.36808057330268] [3.67663232979599 -0.78149232654628 -1.36808057330268] [3.53179037143571 0.0 -1.87788625114356] [3.45461227811459 0.73430050773908 -1.87788625114356] [3.22645105117096 1.43650855972519 -1.87788625114356] [2.8572784310613 2.07593429451846 -1.87788625114356] [2.36322903277115 2.62463173920333 -1.87788625114356] [1.76589518571785 3.0586201825046 -1.87788625114356] [1.09138324534344 3.35893224694241 -1.87788625114356] [0.36917262010967 3.51244285424366 -1.87788625114356] [-0.36917262010967 3.51244285424366 -1.87788625114356] [-1.09138324534344 3.35893224694241 -1.87788625114356] [-1.76589518571785 3.0586201825046 -1.87788625114356] [-2.36322903277115 2.62463173920333 -1.87788625114356] [-2.8572784310613 2.07593429451847 -1.87788625114356] [-3.22645105117096 1.43650855972519 -1.87788625114356] [-3.45461227811459 0.73430050773908 -1.87788625114356] [-3.53179037143571 0.0 -1.87788625114356] [-3.45461227811459 -0.734300507739082 -1.87788625114356] [-3.22645105117096 -1.43650855972519 -1.87788625114356] [-2.8572784310613 -2.07593429451847 -1.87788625114356] [-2.36322903277115 -2.62463173920333 -1.87788625114356] [-1.76589518571785 -3.0586201825046 -1.87788625114356] [-1.09138324534344 -3.35893224694241 -1.87788625114356] [-0.369172620109668 -3.51244285424366 -1.87788625114356] [0.369172620109672 -3.51244285424366 -1.87788625114356] [1.09138324534344 -3.35893224694241 -1.87788625114356] [1.76589518571785 -3.0586201825046 -1.87788625114356] [2.36322903277115 -2.62463173920333 -1.87788625114356] [2.8572784310613 -2.07593429451846 -1.87788625114356] [3.22645105117097 -1.43650855972519 -1.87788625114356] [3.45461227811459 -0.734300507739081 -1.87788625114356] [3.23606797749979 0.0 -2.35114100916989] [3.16535212800292 0.672816364803188 -2.35114100916989] [2.95629520146761 1.31622742593336 -2.35114100916989] [2.61803398874989 1.90211303259031 -2.35114100916989] [2.16535212800292 2.40486717237207 -2.35114100916989] [1.6180339887499 2.80251707688815 -2.35114100916989] [1.0 3.07768353717525 -2.35114100916989] [0.338261212717716 3.21834045852367 -2.35114100916989] [-0.338261212717717 3.21834045852367 -2.35114100916989] [-1.0 3.07768353717525 -2.35114100916989] [-1.61803398874989 2.80251707688815 -2.35114100916989] [-2.16535212800292 2.40486717237207 -2.35114100916989] [-2.61803398874989 1.90211303259031 -2.35114100916989] [-2.95629520146761 1.31622742593336 -2.35114100916989] [-3.16535212800292 0.672816364803188 -2.35114100916989] [-3.23606797749979 0.0 -2.35114100916989] [-3.16535212800292 -0.672816364803189 -2.35114100916989] [-2.95629520146761 -1.31622742593336 -2.35114100916989] [-2.61803398874989 -1.90211303259031 -2.35114100916989] [-2.16535212800292 -2.40486717237207 -2.35114100916989] [-1.6180339887499 -2.80251707688815 -2.35114100916989] [-1.0 -3.07768353717525 -2.35114100916989] [-0.338261212717715 -3.21834045852367 -2.35114100916989] [0.338261212717719 -3.21834045852367 -2.35114100916989] [1.0 -3.07768353717525 -2.35114100916989] [1.6180339887499 -2.80251707688815 -2.35114100916989] [2.16535212800292 -2.40486717237207 -2.35114100916989] [2.61803398874989 -1.90211303259031 -2.35114100916989] [2.95629520146761 -1.31622742593336 -2.35114100916989] [3.16535212800292 -0.672816364803189 -2.35114100916989] [2.8773592013546 0.0 -2.77863348183599] [2.81448199925435 0.598236616643673 -2.77863348183599] [2.62859842840364 1.17032742248224 -2.77863348183599] [2.327832492817 1.69126930410429 -2.77863348183599] [1.92532910711465 2.13829460152644 -2.77863348183599] [1.4386796006773 2.49186616418599 -2.77863348183599] [0.889152892139699 2.73653121817012 -2.77863348183599] [0.300765935586639 2.86159672658652 -2.77863348183599] [-0.30076593558664 2.86159672658652 -2.77863348183599] [-0.889152892139699 2.73653121817012 -2.77863348183599] [-1.4386796006773 2.49186616418599 -2.77863348183599] [-1.92532910711465 2.13829460152644 -2.77863348183599] [-2.327832492817 1.69126930410429 -2.77863348183599] [-2.62859842840364 1.17032742248224 -2.77863348183599] [-2.81448199925435 0.598236616643673 -2.77863348183599] [-2.8773592013546 0.0 -2.77863348183599] [-2.81448199925435 -0.598236616643675 -2.77863348183599] [-2.62859842840364 -1.17032742248224 -2.77863348183599] [-2.327832492817 -1.69126930410429 -2.77863348183599] [-1.92532910711465 -2.13829460152644 -2.77863348183599] [-1.4386796006773 -2.49186616418599 -2.77863348183599] [-0.889152892139699 -2.73653121817012 -2.77863348183599] [-0.300765935586638 -2.86159672658652 -2.77863348183599] [0.300765935586641 -2.86159672658652 -2.77863348183599] [0.889152892139699 -2.73653121817012 -2.77863348183599] [1.4386796006773 -2.49186616418599 -2.77863348183599] [1.92532910711465 -2.13829460152644 -2.77863348183599] [2.327832492817 -1.69126930410429 -2.77863348183599] [2.62859842840364 -1.17032742248224 -2.77863348183599] [2.81448199925435 -0.598236616643674 -2.77863348183599] [2.46264590130263 0.0 -3.15204301442689] [2.40883117981611 0.512012873225255 -3.15204301442689] [2.24973897691719 1.00164832698021 -3.15204301442689] [1.99232238528164 1.44750694240419 -3.15204301442689] [1.64783174518579 1.83010255853617 -3.15204301442689] [1.23132295065132 2.1327139110537 -3.15204301442689] [0.760999434630323 2.34211543176142 -3.15204301442689] [0.25741659163555 2.4491552693844 -3.15204301442689] [-0.25741659163555 2.4491552693844 -3.15204301442689] [-0.760999434630323 2.34211543176142 -3.15204301442689] [-1.23132295065132 2.13271391105371 -3.15204301442689] [-1.64783174518579 1.83010255853617 -3.15204301442689] [-1.99232238528164 1.44750694240419 -3.15204301442689] [-2.24973897691719 1.00164832698021 -3.15204301442689] [-2.40883117981611 0.512012873225255 -3.15204301442689] [-2.46264590130263 0.0 -3.15204301442689] [-2.40883117981611 -0.512012873225256 -3.15204301442689] [-2.24973897691719 -1.00164832698021 -3.15204301442689] [-1.99232238528164 -1.44750694240419 -3.15204301442689] [-1.64783174518579 -1.83010255853617 -3.15204301442689] [-1.23132295065132 -2.1327139110537 -3.15204301442689] [-0.760999434630323 -2.34211543176142 -3.15204301442689] [-0.257416591635549 -2.4491552693844 -3.15204301442689] [0.257416591635551 -2.4491552693844 -3.15204301442689] [0.760999434630323 -2.34211543176142 -3.15204301442689] [1.23132295065132 -2.1327139110537 -3.15204301442689] [1.64783174518579 -1.83010255853617 -3.15204301442689] [1.99232238528164 -1.44750694240419 -3.15204301442689] [2.24973897691719 -1.00164832698021 -3.15204301442689] [2.40883117981611 -0.512012873225256 -3.15204301442689] [2.0 0.0 -3.46410161513775] [1.95629520146761 0.415823381635519 -3.46410161513775] [1.8270909152852 0.8134732861516 -3.46410161513775] [1.61803398874989 1.17557050458495 -3.46410161513775] [1.33826121271772 1.48628965095479 -3.46410161513775] [1.0 1.73205080756888 -3.46410161513775] [0.618033988749895 1.90211303259031 -3.46410161513775] [0.209056926535307 1.98904379073655 -3.46410161513775] [-0.209056926535307 1.98904379073655 -3.46410161513775] [-0.618033988749895 1.90211303259031 -3.46410161513775] [-0.999999999999999 1.73205080756888 -3.46410161513775] [-1.33826121271772 1.48628965095479 -3.46410161513775] [-1.61803398874989 1.17557050458495 -3.46410161513775] [-1.8270909152852 0.813473286151601 -3.46410161513775] [-1.95629520146761 0.415823381635519 -3.46410161513775] [-2.0 0.0 -3.46410161513775] [-1.95629520146761 -0.415823381635519 -3.46410161513775] [-1.8270909152852 -0.813473286151601 -3.46410161513775] [-1.61803398874989 -1.17557050458495 -3.46410161513775] [-1.33826121271772 -1.48628965095479 -3.46410161513775] [-1.0 -1.73205080756888 -3.46410161513775] [-0.618033988749895 -1.90211303259031 -3.46410161513775] [-0.209056926535306 -1.98904379073655 -3.46410161513775] [0.209056926535308 -1.98904379073655 -3.46410161513775] [0.618033988749895 -1.90211303259031 -3.46410161513775] [1.0 -1.73205080756888 -3.46410161513775] [1.33826121271772 -1.48628965095479 -3.46410161513775] [1.61803398874989 -1.17557050458495 -3.46410161513775] [1.8270909152852 -0.8134732861516 -3.46410161513775] [1.95629520146761 -0.415823381635519 -3.46410161513775] [1.49842637366365 0.0 -3.70873541826715] [1.46568216227535 0.311540360914333 -3.70873541826715] [1.3688806072723 0.609464913120196 -3.70873541826715] [1.21225240111352 0.880752924085582 -3.70873541826715] [1.00264294799366 1.113547805947 -3.70873541826715] [0.749213186831824 1.29767530529331 -3.70873541826715] [0.463039214281692 1.42508816686133 -3.70873541826715] [0.156628206158784 1.49021783720578 -3.70873541826715] [-0.156628206158784 1.49021783720578 -3.70873541826715] [-0.463039214281692 1.42508816686133 -3.70873541826715] [-0.749213186831823 1.29767530529331 -3.70873541826715] [-1.00264294799366 1.113547805947 -3.70873541826715] [-1.21225240111352 0.880752924085583 -3.70873541826715] [-1.3688806072723 0.609464913120197 -3.70873541826715] [-1.46568216227535 0.311540360914333 -3.70873541826715] [-1.49842637366365 0.0 -3.70873541826715] [-1.46568216227535 -0.311540360914333 -3.70873541826715] [-1.3688806072723 -0.609464913120197 -3.70873541826715] [-1.21225240111352 -0.880752924085583 -3.70873541826715] [-1.00264294799366 -1.113547805947 -3.70873541826715] [-0.749213186831824 -1.29767530529331 -3.70873541826715] [-0.463039214281692 -1.42508816686133 -3.70873541826715] [-0.156628206158783 -1.49021783720578 -3.70873541826715] [0.156628206158785 -1.49021783720578 -3.70873541826715] [0.463039214281692 -1.42508816686133 -3.70873541826715] [0.749213186831824 -1.29767530529331 -3.70873541826715] [1.00264294799366 -1.113547805947 -3.70873541826715] [1.21225240111352 -0.880752924085582 -3.70873541826715] [1.3688806072723 -0.609464913120196 -3.70873541826715] [1.46568216227535 -0.311540360914333 -3.70873541826715] [0.967687582398669 0.0 -3.88118290510399] [0.946541286983155 0.201193561439857 -3.88118290510399] [0.884026595317454 0.393593998810972 -3.88118290510399] [0.782875699406131 0.568792489760495 -3.88118290510399] [0.647509378776359 0.719132019538301 -3.88118290510399] [0.483843791199335 0.838042029283995 -3.88118290510399] [0.299031908206796 0.920325580978158 -3.88118290510399] [0.101150895911324 0.962386488571467 -3.88118290510399] [-0.101150895911324 0.962386488571467 -3.88118290510399] [-0.299031908206796 0.920325580978158 -3.88118290510399] [-0.483843791199334 0.838042029283995 -3.88118290510399] [-0.647509378776359 0.719132019538301 -3.88118290510399] [-0.782875699406131 0.568792489760495 -3.88118290510399] [-0.884026595317454 0.393593998810972 -3.88118290510399] [-0.946541286983155 0.201193561439857 -3.88118290510399] [-0.967687582398669 0.0 -3.88118290510399] [-0.946541286983155 -0.201193561439858 -3.88118290510399] [-0.884026595317454 -0.393593998810972 -3.88118290510399] [-0.782875699406131 -0.568792489760495 -3.88118290510399] [-0.647509378776359 -0.719132019538301 -3.88118290510399] [-0.483843791199335 -0.838042029283995 -3.88118290510399] [-0.299031908206796 -0.920325580978158 -3.88118290510399] [-0.101150895911323 -0.962386488571467 -3.88118290510399] [0.101150895911324 -0.962386488571467 -3.88118290510399] [0.299031908206796 -0.920325580978158 -3.88118290510399] [0.483843791199335 -0.838042029283995 -3.88118290510399] [0.647509378776359 -0.719132019538301 -3.88118290510399] [0.782875699406131 -0.568792489760495 -3.88118290510399] [0.884026595317454 -0.393593998810971 -3.88118290510399] [0.946541286983155 -0.201193561439857 -3.88118290510399] [0.418113853070615 0.0 -3.97808758147309] [0.408977062214589 8.69307581462398E-2 -3.97808758147309] [0.381966011250106 0.17006222502143 -3.97808758147309] [0.338261212717717 0.245761156614089 -3.97808758147309] [0.279772776032179 0.310719146369843 -3.97808758147309] [0.209056926535308 0.362097218433347 -3.97808758147309] [0.12920428618241 0.397649904516083 -3.97808758147309] [4.37047985323888E-2 0.41582338163552 -3.97808758147309] [-4.37047985323889E-2 0.41582338163552 -3.97808758147309] [-0.12920428618241 0.397649904516083 -3.97808758147309] [-0.209056926535307 0.362097218433347 -3.97808758147309] [-0.279772776032179 0.310719146369843 -3.97808758147309] [-0.338261212717717 0.245761156614089 -3.97808758147309] [-0.381966011250106 0.17006222502143 -3.97808758147309] [-0.408977062214589 8.69307581462397E-2 -3.97808758147309] [-0.418113853070615 0.0 -3.97808758147309] [-0.408977062214589 -8.69307581462399E-2 -3.97808758147309] [-0.381966011250106 -0.17006222502143 -3.97808758147309] [-0.338261212717717 -0.245761156614089 -3.97808758147309] [-0.279772776032179 -0.310719146369843 -3.97808758147309] [-0.209056926535308 -0.362097218433347 -3.97808758147309] [-0.12920428618241 -0.397649904516083 -3.97808758147309] [-4.37047985323887E-2 -0.41582338163552 -3.97808758147309] [4.37047985323891E-2 -0.41582338163552 -3.97808758147309] [0.12920428618241 -0.397649904516083 -3.97808758147309] [0.209056926535308 -0.362097218433347 -3.97808758147309] [0.279772776032179 -0.310719146369843 -3.97808758147309] [0.338261212717717 -0.245761156614089 -3.97808758147309] [0.381966011250106 -0.17006222502143 -3.97808758147309] [0.408977062214589 -8.69307581462399E-2 -3.97808758147309]]
    []
    [] [[[1 31 32 2] false [2 1] 0] [[2 32 33 3] false [2 1] 0] [[3 33 34 4] false [2 1] 0] [[4 34 35 5] false [2 1] 0] [[5 35 36 6] false [2 1] 0] [[6 36 37 7] false [2 1] 0] [[7 37 38 8] false [2 1] 0] [[8 38 39 9] false [2 1] 0] [[9 39 40 10] false [2 1] 0] [[10 40 41 11] false [2 1] 0] [[11 41 42 12] false [2 1] 0] [[12 42 43 13] false [2 1] 0] [[13 43 44 14] false [2 1] 0] [[14 44 45 15] false [2 1] 0] [[15 45 46 16] false [2 1] 0] [[16 46 47 17] false [2 1] 0] [[17 47 48 18] false [2 1] 0] [[18 48 49 19] false [2 1] 0] [[19 49 50 20] false [2 1] 0] [[20 50 51 21] false [2 1] 0] [[21 51 52 22] false [2 1] 0] [[22 52 53 23] false [2 1] 0] [[23 53 54 24] false [2 1] 0] [[24 54 55 25] false [2 1] 0] [[25 55 56 26] false [2 1] 0] [[26 56 57 27] false [2 1] 0] [[27 57 58 28] false [2 1] 0] [[28 58 59 29] false [2 1] 0] [[29 59 60 30] false [2 1] 0] [[30 60 31 1] false [2 1] 0] [[31 61 62 32] false [2 2] 0] [[32 62 63 33] false [2 2] 0] [[33 63 64 34] false [2 2] 0] [[34 64 65 35] false [2 2] 0] [[35 65 66 36] false [2 2] 0] [[36 66 67 37] false [2 2] 0] [[37 67 68 38] false [2 2] 0] [[38 68 69 39] false [2 2] 0] [[39 69 70 40] false [2 2] 0] [[40 70 71 41] false [2 2] 0] [[41 71 72 42] false [2 2] 0] [[42 72 73 43] false [2 2] 0] [[43 73 74 44] false [2 2] 0] [[44 74 75 45] false [2 2] 0] [[45 75 76 46] false [2 2] 0] [[46 76 77 47] false [2 2] 0] [[47 77 78 48] false [2 2] 0] [[48 78 79 49] false [2 2] 0] [[49 79 80 50] false [2 2] 0] [[50 80 81 51] false [2 2] 0] [[51 81 82 52] false [2 2] 0] [[52 82 83 53] false [2 2] 0] [[53 83 84 54] false [2 2] 0] [[54 84 85 55] false [2 2] 0] [[55 85 86 56] false [2 2] 0] [[56 86 87 57] false [2 2] 0] [[57 87 88 58] false [2 2] 0] [[58 88 89 59] false [2 2] 0] [[59 89 90 60] false [2 2] 0] [[60 90 61 31] false [2 2] 0] [[61 91 92 62] false [2 3] 0] [[62 92 93 63] false [2 3] 0] [[63 93 94 64] false [2 3] 0] [[64 94 95 65] false [2 3] 0] [[65 95 96 66] false [2 3] 0] [[66 96 97 67] false [2 3] 0] [[67 97 98 68] false [2 3] 0] [[68 98 99 69] false [2 3] 0] [[69 99 100 70] false [2 3] 0] [[70 100 101 71] false [2 3] 0] [[71 101 102 72] false [2 3] 0] [[72 102 103 73] false [2 3] 0] [[73 103 104 74] false [2 3] 0] [[74 104 105 75] false [2 3] 0] [[75 105 106 76] false [2 3] 0] [[76 106 107 77] false [2 3] 0] [[77 107 108 78] false [2 3] 0] [[78 108 109 79] false [2 3] 0] [[79 109 110 80] false [2 3] 0] [[80 110 111 81] false [2 3] 0] [[81 111 112 82] false [2 3] 0] [[82 112 113 83] false [2 3] 0] [[83 113 114 84] false [2 3] 0] [[84 114 115 85] false [2 3] 0] [[85 115 116 86] false [2 3] 0] [[86 116 117 87] false [2 3] 0] [[87 117 118 88] false [2 3] 0] [[88 118 119 89] false [2 3] 0] [[89 119 120 90] false [2 3] 0] [[90 120 91 61] false [2 3] 0] [[91 121 122 92] false [2 4] 0] [[92 122 123 93] false [2 4] 0] [[93 123 124 94] false [2 4] 0] [[94 124 125 95] false [2 4] 0] [[95 125 126 96] false [2 4] 0] [[96 126 127 97] false [2 4] 0] [[97 127 128 98] false [2 4] 0] [[98 128 129 99] false [2 4] 0] [[99 129 130 100] false [2 4] 0] [[100 130 131 101] false [2 4] 0] [[101 131 132 102] false [2 4] 0] [[102 132 133 103] false [2 4] 0] [[103 133 134 104] false [2 4] 0] [[104 134 135 105] false [2 4] 0] [[105 135 136 106] false [2 4] 0] [[106 136 137 107] false [2 4] 0] [[107 137 138 108] false [2 4] 0] [[108 138 139 109] false [2 4] 0] [[109 139 140 110] false [2 4] 0] [[110 140 141 111] false [2 4] 0] [[111 141 142 112] false [2 4] 0] [[112 142 143 113] false [2 4] 0] [[113 143 144 114] false [2 4] 0] [[114 144 145 115] false [2 4] 0] [[115 145 146 116] false [2 4] 0] [[116 146 147 117] false [2 4] 0] [[117 147 148 118] false [2 4] 0] [[118 148 149 119] false [2 4] 0] [[119 149 150 120] false [2 4] 0] [[120 150 121 91] false [2 4] 0] [[121 151 152 122] false [2 5] 0] [[122 152 153 123] false [2 5] 0] [[123 153 154 124] false [2 5] 0] [[124 154 155 125] false [2 5] 0] [[125 155 156 126] false [2 5] 0] [[126 156 157 127] false [2 5] 0] [[127 157 158 128] false [2 5] 0] [[128 158 159 129] false [2 5] 0] [[129 159 160 130] false [2 5] 0] [[130 160 161 131] false [2 5] 0] [[131 161 162 132] false [2 5] 0] [[132 162 163 133] false [2 5] 0] [[133 163 164 134] false [2 5] 0] [[134 164 165 135] false [2 5] 0] [[135 165 166 136] false [2 5] 0] [[136 166 167 137] false [2 5] 0] [[137 167 168 138] false [2 5] 0] [[138 168 169 139] false [2 5] 0] [[139 169 170 140] false [2 5] 0] [[140 170 171 141] false [2 5] 0] [[141 171 172 142] false [2 5] 0] [[142 172 173 143] false [2 5] 0] [[143 173 174 144] false [2 5] 0] [[144 174 175 145] false [2 5] 0] [[145 175 176 146] false [2 5] 0] [[146 176 177 147] false [2 5] 0] [[147 177 178 148] false [2 5] 0] [[148 178 179 149] false [2 5] 0] [[149 179 180 150] false [2 5] 0] [[150 180 151 121] false [2 5] 0] [[151 181 182 152] false [2 6] 0] [[152 182 183 153] false [2 6] 0] [[153 183 184 154] false [2 6] 0] [[154 184 185 155] false [2 6] 0] [[155 185 186 156] false [2 6] 0] [[156 186 187 157] false [2 6] 0] [[157 187 188 158] false [2 6] 0] [[158 188 189 159] false [2 6] 0] [[159 189 190 160] false [2 6] 0] [[160 190 191 161] false [2 6] 0] [[161 191 192 162] false [2 6] 0] [[162 192 193 163] false [2 6] 0] [[163 193 194 164] false [2 6] 0] [[164 194 195 165] false [2 6] 0] [[165 195 196 166] false [2 6] 0] [[166 196 197 167] false [2 6] 0] [[167 197 198 168] false [2 6] 0] [[168 198 199 169] false [2 6] 0] [[169 199 200 170] false [2 6] 0] [[170 200 201 171] false [2 6] 0] [[171 201 202 172] false [2 6] 0] [[172 202 203 173] false [2 6] 0] [[173 203 204 174] false [2 6] 0] [[174 204 205 175] false [2 6] 0] [[175 205 206 176] false [2 6] 0] [[176 206 207 177] false [2 6] 0] [[177 207 208 178] false [2 6] 0] [[178 208 209 179] false [2 6] 0] [[179 209 210 180] false [2 6] 0] [[180 210 181 151] false [2 6] 0] [[181 211 212 182] false [2 7] 0] [[182 212 213 183] false [2 7] 0] [[183 213 214 184] false [2 7] 0] [[184 214 215 185] false [2 7] 0] [[185 215 216 186] false [2 7] 0] [[186 216 217 187] false [2 7] 0] [[187 217 218 188] false [2 7] 0] [[188 218 219 189] false [2 7] 0] [[189 219 220 190] false [2 7] 0] [[190 220 221 191] false [2 7] 0] [[191 221 222 192] false [2 7] 0] [[192 222 223 193] false [2 7] 0] [[193 223 224 194] false [2 7] 0] [[194 224 225 195] false [2 7] 0] [[195 225 226 196] false [2 7] 0] [[196 226 227 197] false [2 7] 0] [[197 227 228 198] false [2 7] 0] [[198 228 229 199] false [2 7] 0] [[199 229 230 200] false [2 7] 0] [[200 230 231 201] false [2 7] 0] [[201 231 232 202] false [2 7] 0] [[202 232 233 203] false [2 7] 0] [[203 233 234 204] false [2 7] 0] [[204 234 235 205] false [2 7] 0] [[205 235 236 206] false [2 7] 0] [[206 236 237 207] false [2 7] 0] [[207 237 238 208] false [2 7] 0] [[208 238 239 209] false [2 7] 0] [[209 239 240 210] false [2 7] 0] [[210 240 211 181] false [2 7] 0] [[211 241 242 212] false [2 8] 0] [[212 242 243 213] false [2 8] 0] [[213 243 244 214] false [2 8] 0] [[214 244 245 215] false [2 8] 0] [[215 245 246 216] false [2 8] 0] [[216 246 247 217] false [2 8] 0] [[217 247 248 218] false [2 8] 0] [[218 248 249 219] false [2 8] 0] [[219 249 250 220] false [2 8] 0] [[220 250 251 221] false [2 8] 0] [[221 251 252 222] false [2 8] 0] [[222 252 253 223] false [2 8] 0] [[223 253 254 224] false [2 8] 0] [[224 254 255 225] false [2 8] 0] [[225 255 256 226] false [2 8] 0] [[226 256 257 227] false [2 8] 0] [[227 257 258 228] false [2 8] 0] [[228 258 259 229] false [2 8] 0] [[229 259 260 230] false [2 8] 0] [[230 260 261 231] false [2 8] 0] [[231 261 262 232] false [2 8] 0] [[232 262 263 233] false [2 8] 0] [[233 263 264 234] false [2 8] 0] [[234 264 265 235] false [2 8] 0] [[235 265 266 236] false [2 8] 0] [[236 266 267 237] false [2 8] 0] [[237 267 268 238] false [2 8] 0] [[238 268 269 239] false [2 8] 0] [[239 269 270 240] false [2 8] 0] [[240 270 241 211] false [2 8] 0] [[241 271 272 242] false [2 9] 0] [[242 272 273 243] false [2 9] 0] [[243 273 274 244] false [2 9] 0] [[244 274 275 245] false [2 9] 0] [[245 275 276 246] false [2 9] 0] [[246 276 277 247] false [2 9] 0] [[247 277 278 248] false [2 9] 0] [[248 278 279 249] false [2 9] 0] [[249 279 280 250] false [2 9] 0] [[250 280 281 251] false [2 9] 0] [[251 281 282 252] false [2 9] 0] [[252 282 283 253] false [2 9] 0] [[253 283 284 254] false [2 9] 0] [[254 284 285 255] false [2 9] 0] [[255 285 286 256] false [2 9] 0] [[256 286 287 257] false [2 9] 0] [[257 287 288 258] false [2 9] 0] [[258 288 289 259] false [2 9] 0] [[259 289 290 260] false [2 9] 0] [[260 290 291 261] false [2 9] 0] [[261 291 292 262] false [2 9] 0] [[262 292 293 263] false [2 9] 0] [[263 293 294 264] false [2 9] 0] [[264 294 295 265] false [2 9] 0] [[265 295 296 266] false [2 9] 0] [[266 296 297 267] false [2 9] 0] [[267 297 298 268] false [2 9] 0] [[268 298 299 269] false [2 9] 0] [[269 299 300 270] false [2 9] 0] [[270 300 271 241] false [2 9] 0] [[271 301 302 272] false [2 10] 0] [[272 302 303 273] false [2 10] 0] [[273 303 304 274] false [2 10] 0] [[274 304 305 275] false [2 10] 0] [[275 305 306 276] false [2 10] 0] [[276 306 307 277] false [2 10] 0] [[277 307 308 278] false [2 10] 0] [[278 308 309 279] false [2 10] 0] [[279 309 310 280] false [2 10] 0] [[280 310 311 281] false [2 10] 0] [[281 311 312 282] false [2 10] 0] [[282 312 313 283] false [2 10] 0] [[283 313 314 284] false [2 10] 0] [[284 314 315 285] false [2 10] 0] [[285 315 316 286] false [2 10] 0] [[286 316 317 287] false [2 10] 0] [[287 317 318 288] false [2 10] 0] [[288 318 319 289] false [2 10] 0] [[289 319 320 290] false [2 10] 0] [[290 320 321 291] false [2 10] 0] [[291 321 322 292] false [2 10] 0] [[292 322 323 293] false [2 10] 0] [[293 323 324 294] false [2 10] 0] [[294 324 325 295] false [2 10] 0] [[295 325 326 296] false [2 10] 0] [[296 326 327 297] false [2 10] 0] [[297 327 328 298] false [2 10] 0] [[298 328 329 299] false [2 10] 0] [[299 329 330 300] false [2 10] 0] [[300 330 301 271] false [2 10] 0] [[301 331 332 302] false [2 11] 0] [[302 332 333 303] false [2 11] 0] [[303 333 334 304] false [2 11] 0] [[304 334 335 305] false [2 11] 0] [[305 335 336 306] false [2 11] 0] [[306 336 337 307] false [2 11] 0] [[307 337 338 308] false [2 11] 0] [[308 338 339 309] false [2 11] 0] [[309 339 340 310] false [2 11] 0] [[310 340 341 311] false [2 11] 0] [[311 341 342 312] false [2 11] 0] [[312 342 343 313] false [2 11] 0] [[313 343 344 314] false [2 11] 0] [[314 344 345 315] false [2 11] 0] [[315 345 346 316] false [2 11] 0] [[316 346 347 317] false [2 11] 0] [[317 347 348 318] false [2 11] 0] [[318 348 349 319] false [2 11] 0] [[319 349 350 320] false [2 11] 0] [[320 350 351 321] false [2 11] 0] [[321 351 352 322] false [2 11] 0] [[322 352 353 323] false [2 11] 0] [[323 353 354 324] false [2 11] 0] [[324 354 355 325] false [2 11] 0] [[325 355 356 326] false [2 11] 0] [[326 356 357 327] false [2 11] 0] [[327 357 358 328] false [2 11] 0] [[328 358 359 329] false [2 11] 0] [[329 359 360 330] false [2 11] 0] [[330 360 331 301] false [2 11] 0] [[331 361 362 332] false [2 12] 0] [[332 362 363 333] false [2 12] 0] [[333 363 364 334] false [2 12] 0] [[334 364 365 335] false [2 12] 0] [[335 365 366 336] false [2 12] 0] [[336 366 367 337] false [2 12] 0] [[337 367 368 338] false [2 12] 0] [[338 368 369 339] false [2 12] 0] [[339 369 370 340] false [2 12] 0] [[340 370 371 341] false [2 12] 0] [[341 371 372 342] false [2 12] 0] [[342 372 373 343] false [2 12] 0] [[343 373 374 344] false [2 12] 0] [[344 374 375 345] false [2 12] 0] [[345 375 376 346] false [2 12] 0] [[346 376 377 347] false [2 12] 0] [[347 377 378 348] false [2 12] 0] [[348 378 379 349] false [2 12] 0] [[349 379 380 350] false [2 12] 0] [[350 380 381 351] false [2 12] 0] [[351 381 382 352] false [2 12] 0] [[352 382 383 353] false [2 12] 0] [[353 383 384 354] false [2 12] 0] [[354 384 385 355] false [2 12] 0] [[355 385 386 356] false [2 12] 0] [[356 386 387 357] false [2 12] 0] [[357 387 388 358] false [2 12] 0] [[358 388 389 359] false [2 12] 0] [[359 389 390 360] false [2 12] 0] [[360 390 361 331] false [2 12] 0] [[361 391 392 362] false [2 13] 0] [[362 392 393 363] false [2 13] 0] [[363 393 394 364] false [2 13] 0] [[364 394 395 365] false [2 13] 0] [[365 395 396 366] false [2 13] 0] [[366 396 397 367] false [2 13] 0] [[367 397 398 368] false [2 13] 0] [[368 398 399 369] false [2 13] 0] [[369 399 400 370] false [2 13] 0] [[370 400 401 371] false [2 13] 0] [[371 401 402 372] false [2 13] 0] [[372 402 403 373] false [2 13] 0] [[373 403 404 374] false [2 13] 0] [[374 404 405 375] false [2 13] 0] [[375 405 406 376] false [2 13] 0] [[376 406 407 377] false [2 13] 0] [[377 407 408 378] false [2 13] 0] [[378 408 409 379] false [2 13] 0] [[379 409 410 380] false [2 13] 0] [[380 410 411 381] false [2 13] 0] [[381 411 412 382] false [2 13] 0] [[382 412 413 383] false [2 13] 0] [[383 413 414 384] false [2 13] 0] [[384 414 415 385] false [2 13] 0] [[385 415 416 386] false [2 13] 0] [[386 416 417 387] false [2 13] 0] [[387 417 418 388] false [2 13] 0] [[388 418 419 389] false [2 13] 0] [[389 419 420 390] false [2 13] 0] [[390 420 391 361] false [2 13] 0] [[391 421 422 392] false [2 14] 0] [[392 422 423 393] false [2 14] 0] [[393 423 424 394] false [2 14] 0] [[394 424 425 395] false [2 14] 0] [[395 425 426 396] false [2 14] 0] [[396 426 427 397] false [2 14] 0] [[397 427 428 398] false [2 14] 0] [[398 428 429 399] false [2 14] 0] [[399 429 430 400] false [2 14] 0] [[400 430 431 401] false [2 14] 0] [[401 431 432 402] false [2 14] 0] [[402 432 433 403] false [2 14] 0] [[403 433 434 404] false [2 14] 0] [[404 434 435 405] false [2 14] 0] [[405 435 436 406] false [2 14] 0] [[406 436 437 407] false [2 14] 0] [[407 437 438 408] false [2 14] 0] [[408 438 439 409] false [2 14] 0] [[409 439 440 410] false [2 14] 0] [[410 440 441 411] false [2 14] 0] [[411 441 442 412] false [2 14] 0] [[412 442 443 413] false [2 14] 0] [[413 443 444 414] false [2 14] 0] [[414 444 445 415] false [2 14] 0] [[415 445 446 416] false [2 14] 0] [[416 446 447 417] false [2 14] 0] [[417 447 448 418] false [2 14] 0] [[418 448 449 419] false [2 14] 0] [[419 449 450 420] false [2 14] 0] [[420 450 421 391] false [2 14] 0] [[421 451 452 422] false [2 15] 0] [[422 452 453 423] false [2 15] 0] [[423 453 454 424] false [2 15] 0] [[424 454 455 425] false [2 15] 0] [[425 455 456 426] false [2 15] 0] [[426 456 457 427] false [2 15] 0] [[427 457 458 428] false [2 15] 0] [[428 458 459 429] false [2 15] 0] [[429 459 460 430] false [2 15] 0] [[430 460 461 431] false [2 15] 0] [[431 461 462 432] false [2 15] 0] [[432 462 463 433] false [2 15] 0] [[433 463 464 434] false [2 15] 0] [[434 464 465 435] false [2 15] 0] [[435 465 466 436] false [2 15] 0] [[436 466 467 437] false [2 15] 0] [[437 467 468 438] false [2 15] 0] [[438 468 469 439] false [2 15] 0] [[439 469 470 440] false [2 15] 0] [[440 470 471 441] false [2 15] 0] [[441 471 472 442] false [2 15] 0] [[442 472 473 443] false [2 15] 0] [[443 473 474 444] false [2 15] 0] [[444 474 475 445] false [2 15] 0] [[445 475 476 446] false [2 15] 0] [[446 476 477 447] false [2 15] 0] [[447 477 478 448] false [2 15] 0] [[448 478 479 449] false [2 15] 0] [[449 479 480 450] false [2 15] 0] [[450 480 451 421] false [2 15] 0] [[451 481 482 452] false [2 16] 0] [[452 482 483 453] false [2 16] 0] [[453 483 484 454] false [2 16] 0] [[454 484 485 455] false [2 16] 0] [[455 485 486 456] false [2 16] 0] [[456 486 487 457] false [2 16] 0] [[457 487 488 458] false [2 16] 0] [[458 488 489 459] false [2 16] 0] [[459 489 490 460] false [2 16] 0] [[460 490 491 461] false [2 16] 0] [[461 491 492 462] false [2 16] 0] [[462 492 493 463] false [2 16] 0] [[463 493 494 464] false [2 16] 0] [[464 494 495 465] false [2 16] 0] [[465 495 496 466] false [2 16] 0] [[466 496 497 467] false [2 16] 0] [[467 497 498 468] false [2 16] 0] [[468 498 499 469] false [2 16] 0] [[469 499 500 470] false [2 16] 0] [[470 500 501 471] false [2 16] 0] [[471 501 502 472] false [2 16] 0] [[472 502 503 473] false [2 16] 0] [[473 503 504 474] false [2 16] 0] [[474 504 505 475] false [2 16] 0] [[475 505 506 476] false [2 16] 0] [[476 506 507 477] false [2 16] 0] [[477 507 508 478] false [2 16] 0] [[478 508 509 479] false [2 16] 0] [[479 509 510 480] false [2 16] 0] [[480 510 481 451] false [2 16] 0] [[481 511 512 482] false [2 17] 0] [[482 512 513 483] false [2 17] 0] [[483 513 514 484] false [2 17] 0] [[484 514 515 485] false [2 17] 0] [[485 515 516 486] false [2 17] 0] [[486 516 517 487] false [2 17] 0] [[487 517 518 488] false [2 17] 0] [[488 518 519 489] false [2 17] 0] [[489 519 520 490] false [2 17] 0] [[490 520 521 491] false [2 17] 0] [[491 521 522 492] false [2 17] 0] [[492 522 523 493] false [2 17] 0] [[493 523 524 494] false [2 17] 0] [[494 524 525 495] false [2 17] 0] [[495 525 526 496] false [2 17] 0] [[496 526 527 497] false [2 17] 0] [[497 527 528 498] false [2 17] 0] [[498 528 529 499] false [2 17] 0] [[499 529 530 500] false [2 17] 0] [[500 530 531 501] false [2 17] 0] [[501 531 532 502] false [2 17] 0] [[502 532 533 503] false [2 17] 0] [[503 533 534 504] false [2 17] 0] [[504 534 535 505] false [2 17] 0] [[505 535 536 506] false [2 17] 0] [[506 536 537 507] false [2 17] 0] [[507 537 538 508] false [2 17] 0] [[508 538 539 509] false [2 17] 0] [[509 539 540 510] false [2 17] 0] [[510 540 511 481] false [2 17] 0] [[511 541 542 512] false [2 18] 0] [[512 542 543 513] false [2 18] 0] [[513 543 544 514] false [2 18] 0] [[514 544 545 515] false [2 18] 0] [[515 545 546 516] false [2 18] 0] [[516 546 547 517] false [2 18] 0] [[517 547 548 518] false [2 18] 0] [[518 548 549 519] false [2 18] 0] [[519 549 550 520] false [2 18] 0] [[520 550 551 521] false [2 18] 0] [[521 551 552 522] false [2 18] 0] [[522 552 553 523] false [2 18] 0] [[523 553 554 524] false [2 18] 0] [[524 554 555 525] false [2 18] 0] [[525 555 556 526] false [2 18] 0] [[526 556 557 527] false [2 18] 0] [[527 557 558 528] false [2 18] 0] [[528 558 559 529] false [2 18] 0] [[529 559 560 530] false [2 18] 0] [[530 560 561 531] false [2 18] 0] [[531 561 562 532] false [2 18] 0] [[532 562 563 533] false [2 18] 0] [[533 563 564 534] false [2 18] 0] [[534 564 565 535] false [2 18] 0] [[535 565 566 536] false [2 18] 0] [[536 566 567 537] false [2 18] 0] [[537 567 568 538] false [2 18] 0] [[538 568 569 539] false [2 18] 0] [[539 569 570 540] false [2 18] 0] [[540 570 541 511] false [2 18] 0] [[541 571 572 542] false [2 19] 0] [[542 572 573 543] false [2 19] 0] [[543 573 574 544] false [2 19] 0] [[544 574 575 545] false [2 19] 0] [[545 575 576 546] false [2 19] 0] [[546 576 577 547] false [2 19] 0] [[547 577 578 548] false [2 19] 0] [[548 578 579 549] false [2 19] 0] [[549 579 580 550] false [2 19] 0] [[550 580 581 551] false [2 19] 0] [[551 581 582 552] false [2 19] 0] [[552 582 583 553] false [2 19] 0] [[553 583 584 554] false [2 19] 0] [[554 584 585 555] false [2 19] 0] [[555 585 586 556] false [2 19] 0] [[556 586 587 557] false [2 19] 0] [[557 587 588 558] false [2 19] 0] [[558 588 589 559] false [2 19] 0] [[559 589 590 560] false [2 19] 0] [[560 590 591 561] false [2 19] 0] [[561 591 592 562] false [2 19] 0] [[562 592 593 563] false [2 19] 0] [[563 593 594 564] false [2 19] 0] [[564 594 595 565] false [2 19] 0] [[565 595 596 566] false [2 19] 0] [[566 596 597 567] false [2 19] 0] [[567 597 598 568] false [2 19] 0] [[568 598 599 569] false [2 19] 0] [[569 599 600 570] false [2 19] 0] [[570 600 571 541] false [2 19] 0] [[571 601 602 572] false [2 20] 0] [[572 602 603 573] false [2 20] 0] [[573 603 604 574] false [2 20] 0] [[574 604 605 575] false [2 20] 0] [[575 605 606 576] false [2 20] 0] [[576 606 607 577] false [2 20] 0] [[577 607 608 578] false [2 20] 0] [[578 608 609 579] false [2 20] 0] [[579 609 610 580] false [2 20] 0] [[580 610 611 581] false [2 20] 0] [[581 611 612 582] false [2 20] 0] [[582 612 613 583] false [2 20] 0] [[583 613 614 584] false [2 20] 0] [[584 614 615 585] false [2 20] 0] [[585 615 616 586] false [2 20] 0] [[586 616 617 587] false [2 20] 0] [[587 617 618 588] false [2 20] 0] [[588 618 619 589] false [2 20] 0] [[589 619 620 590] false [2 20] 0] [[590 620 621 591] false [2 20] 0] [[591 621 622 592] false [2 20] 0] [[592 622 623 593] false [2 20] 0] [[593 623 624 594] false [2 20] 0] [[594 624 625 595] false [2 20] 0] [[595 625 626 596] false [2 20] 0] [[596 626 627 597] false [2 20] 0] [[597 627 628 598] false [2 20] 0] [[598 628 629 599] false [2 20] 0] [[599 629 630 600] false [2 20] 0] [[600 630 601 571] false [2 20] 0] [[601 631 632 602] false [2 21] 0] [[602 632 633 603] false [2 21] 0] [[603 633 634 604] false [2 21] 0] [[604 634 635 605] false [2 21] 0] [[605 635 636 606] false [2 21] 0] [[606 636 637 607] false [2 21] 0] [[607 637 638 608] false [2 21] 0] [[608 638 639 609] false [2 21] 0] [[609 639 640 610] false [2 21] 0] [[610 640 641 611] false [2 21] 0] [[611 641 642 612] false [2 21] 0] [[612 642 643 613] false [2 21] 0] [[613 643 644 614] false [2 21] 0] [[614 644 645 615] false [2 21] 0] [[615 645 646 616] false [2 21] 0] [[616 646 647 617] false [2 21] 0] [[617 647 648 618] false [2 21] 0] [[618 648 649 619] false [2 21] 0] [[619 649 650 620] false [2 21] 0] [[620 650 651 621] false [2 21] 0] [[621 651 652 622] false [2 21] 0] [[622 652 653 623] false [2 21] 0] [[623 653 654 624] false [2 21] 0] [[624 654 655 625] false [2 21] 0] [[625 655 656 626] false [2 21] 0] [[626 656 657 627] false [2 21] 0] [[627 657 658 628] false [2 21] 0] [[628 658 659 629] false [2 21] 0] [[629 659 660 630] false [2 21] 0] [[630 660 631 601] false [2 21] 0]] [138.28.139 152.30.155 165.35.173 178.41.189 189.49.203 199.58.214 208.69.221 216.81.225 221.93.227 225.107.227 227.121.227 227.134.227 225.148.227 221.162.227 216.174.225 208.186.221 199.197.214 189.206.203 178.214.189 165.220.173 152.225.155 138.227.139]
]
]
camera: [0 0 10 0 0 400 400] ; x y z a1 a2 xsc ysc

; Split an image
fn-split-image: func [x [integer!] y [integer!] img-file [file! URL!]] [
    context [
        img: load img-file
        sz: img/size
        sz/x: sz/x / x
        sz/y: sz/y / y
        off: 0×0
        dx: sz * 1×0
        dy: sz * 0×1
        c: 0
        for i 0 (y - 1) 1 [
            for j 0 (x - 1) 1 [
                off: (j * dx) + (i * dy)
                c: c + 1
                poke objs/1/5/:c/3 1 1
                poke objs/1/5/:c/3 2 copy/part skip img off sz
            ]
        ]
    ]
]
; draw order for all faces
draw-o: []
; draw block
draw-bl: []
; Auto rotate
rot: true
; Perform a rotation on a 3D Object
fn-rot: func [obj [block!]][
    context [
        c1: cosine obj/1/4
        c2: cosine obj/1/5
        c3: cosine obj/1/6
        s1: sine obj/1/4
        s2: sine obj/1/5
        s3: sine obj/1/6
        clear obj/3
        clear obj/4
        obj/3: copy/deep obj/2
        ; calculate the perspective of the points after the roation & translation
        foreach point obj/3 [
            ; Roation about z axis
            x1: (point/1 * c1) - (point/2 * s1)
            y1: (point/1 * s1) + (point/2 * c1)
            z1: point/3
            ; Roation about y axis
            x2: (x1 * c2) + (point/3 * s2)
            y2: y1
            z2: - (x1 * s2) + (point/3 * c2)
           
            x3: x2 + obj/1/1
            y3: (y2 * c3) - (z2 * s3) + obj/1/2
            z3: (y2 * s3) + (z2 * c3) + obj/1/3
            poke point 1 (x3 + camera/1)
            poke point 2 (y3 + camera/2)
            poke point 3 (z3 + camera/3)
            x: point/1 / point/3 * camera/6
            y: point/2 / point/3 * camera/7
            append obj/4 to pair! reduce[(x + 250) (y + 250)]
        ]
        foreach f obj/5 [
            p1: f/1/1
            p2: f/1/2
            p3: f/1/3
            d1: reduce [(obj/3/:p2/1 - obj/3/:p1/1) (obj/3/:p2/2 - obj/3/:p1/2) (obj/3/:p2/3 - obj/3/:p1/3)]
            d2: reduce [(obj/3/:p3/1 - obj/3/:p1/1) (obj/3/:p3/2 - obj/3/:p1/2) (obj/3/:p3/3 - obj/3/:p1/3)]
            poke f 4 (-2 * obj/3/:p1/3 - d1/3 - d2/3)
            n1: (d1/2 * d2/3) - (d1/3 * d2/2)
            n2: - (d1/1 * d2/3) + (d1/3 * d2/1)
            n3: (d1/1 * d2/2) - (d1/2 * d2/1)
            v: 0 > ((obj/3/:p1/1 * n1) + (obj/3/:p1/2 * n2) + (obj/3/:p1/3 * n3))
            poke f 2 v
        ]
    ]
]
; Create a draw block and show the face
fn-show: func [][
    context [
    ; setup the faces to be shown
    pts: []
    clear draw-o
    foreach o objs [
        foreach f o/5 [
            if f/2 = true [
                append draw-o f/4
                switch f/3/1 [
                    1 [append/only draw-o reduce [‘image f/3/2 pick o/4 f/1/1 pick o/4 f/1/4 pick o/4 f/1/3 pick o/4 f/1/2]]
                    2 [
                        pts: copy reduce [‘fill-pen (pick o/6 f/3/2) ‘polygon]
                        foreach coord f/1 [append pts pick o/4 coord]
                        append/only draw-o pts
                    ]
                ]
            ]
        ]
    ]
    ; sort the faces
    sort/skip draw-o 2
   
    ; reset the draw-block
    clear draw-bl
    append draw-bl reduce [‘anti-alias ‘off ‘pen black]
   
    ; create the draw block
    forskip draw-o 2 [append draw-bl draw-o/2]
   
    ; show the face
    show f-box
    f-angles/text: rejoin [to string! objs/1/1/4 ” / “ to string! objs/1/1/5   ” / “ to string! objs/1/1/6]
    show f-angles
    ]
]
; Instructions
;alert “Select an Image to map onto a sphere”

; Initial Rotation
foreach o objs [fn-rot o]
fn-req-image: func []
[
; Get Picture
pic: request-file/title/path/keep “Select an Image” “OK” %.
if pic = none [alert “No image selected” quit]
fn-split-image 30 21 rejoin [pic/1 pic/2]
]
;fn-req-image

fn-split-image 30 21   http://www.evl.uic.edu/pape/data/Earth/512/BigEarth.jpg
lv-lay: layout [
    across
    backdrop 10.120.10
    banner “Map Picture ontp a 3D Sphere”
    return
    vh2 “Rotate - left, right, up, down, page-up, page-down”
    return
    vh2 “Zoom - ^”+^” ^”-^”" font-fixed
    return
    f-box: box 500×500 effect [draw draw-bl] rate 60   edge [size: 2×2 color: gray effect: ‘bevel]
    feel [
        engage: func [face action event][
            if all[action = ‘time   rot][
                objs/1/1/4: objs/1/1/4 + 3 if objs/1/1/4 > 360 [objs/1/1/4: objs/1/1/4 - 360]
                objs/1/1/5: objs/1/1/5 + 0 if objs/1/1/5 > 360 [objs/1/1/5: objs/1/1/5 - 360]
                objs/1/1/6: objs/1/1/6 + 0 if objs/1/1/6 > 360 [objs/1/1/6: objs/1/1/6 - 360]
                fn-rot objs/1
                fn-show
            ]
        ]
    ]
    return
    sensor 0×0 keycode [up down left right page-up page-down #”+” #”-”] [
        switch value [
            up [objs/1/1/4: objs/1/1/4 + 5 fn-rot objs/1 fn-show if objs/1/1/4 > 360 [objs/1/1/4: objs/1/1/4 - 360]]
            down [objs/1/1/4: objs/1/1/4 - 5 fn-rot objs/1 fn-show if objs/1/1/4 < 0 [objs/1/1/4: objs/1/1/4 + 360]]
            left [objs/1/1/5: objs/1/1/5 + 5 fn-rot objs/1 fn-show if objs/1/1/5 > 360 [objs/1/1/5: objs/1/1/5 - 360]]
            right [objs/1/1/5: objs/1/1/5 - 5 fn-rot objs/1 fn-show if objs/1/1/5 < 0 [objs/1/1/5: objs/1/1/5 + 360]]
            page-up [objs/1/1/6: objs/1/1/6 + 5 fn-rot objs/1 fn-show if objs/1/1/6 > 360 [objs/1/1/6: objs/1/1/6 - 360]]
            page-down [objs/1/1/6: objs/1/1/6 - 5 fn-rot objs/1 fn-show if objs/1/1/6 < 0 [objs/1/1/6: objs/1/1/6 + 360]]
            #”+” [if camera/6 < 2000 [camera/6: camera/6 + 10 camera/7: camera/7 + 10 fn-rot objs/1 fn-show]]
            #”-” [if camera/6 > 200 [camera/6: camera/6 - 10 camera/7: camera/7 - 10 fn-rot objs/1 fn-show]]
        ]        
    ]
    btn “New Image” [fn-req-image]
    btn “Auto-Rotate” [either rot [rot: false][rot: true]]
    f-angles: field 400
]
fn-show
view lv-lay
quit
Print This Post Print This Post
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Snake game

November 27th, 2013

Nick Antonaccio made the following snake game:

Here is the source code:

REBOL [
    File: %snake-game.r
    Date: 19-Aug-2009
    Title: "Snake Game"
    Author:   Nick Antonaccio
    Purpose: {
        A little graphic game.  
        Taken from the tutorial at http://musiclessonz.com/rebol.html
    }
]
snake: to-image layout/tight [button red 10×10]
food: to-image layout/tight [button green 10×10]
the-score: 0   direction: 0×10   newsection: false   random/seed now
rand-pair: func [s] [
    to-pair rejoin [(round/to random s 10) “x” (round/to random s 10)]
]
b: reduce [
    ‘image food ((rand-pair 190) + 50×50)
    ‘image snake ((rand-pair 190) + 50×50)
]
view center-face layout/tight gui: [
    scrn: box white 300×300 effect [draw b] rate 15 feel [
        engage: func [f a e] [
            if a = ‘key [
                if e/key = ‘up [direction: 0x-10]
                if e/key = ‘down [direction: 0×10]
                if e/key = ‘left [direction: -10×0]
                if e/key = ‘right [direction: 10×0]
            ]
            if a = ‘time [
                if any [b/6/1 < 0 b/6/2 < 0 b/6/1 > 290 b/6/2 > 290] [alert “You hit the wall!” quit ]
                if find (at b 7) b/6 [alert “You hit yourself!” quit]
                if within? b/6 b/3 10×10 [
                    append b reduce [‘image snake (last b)]
                    newsection: true
                    b/3: (rand-pair 290)
                ]
                newb: copy/part head b 5   append newb (b/6 + direction)
                for item 7 (length? head b) 1 [
                    either (type? (pick b item) = pair!) [
                        append newb pick b (item - 3)
                    ] [append newb pick b item ]
                ]
                if newsection = true [
                    clear (back tail newb)
                    append newb (last b)
                    newsection: false
                ]
                b: copy newb
                show scrn
                the-score: the-score + 1
                score/text: to-string the-score
            ]
        ]
    ]
    origin across h2 “Score:”
    score: h2 bold “000000″
    do [focus scrn]
]
Print This Post Print This Post
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Rebsite around the world

November 26th, 2013

rgchris wrote a web app that shows rebsites in the world:

http://desktop.rebol.info/

the source code is here: https://github.com/revault/desktop.rebol.info

Add your rebsite!

Print This Post Print This Post
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Ski game

November 13th, 2013

The following script is a simple game made by Nick Antonaccio, you have to move the skier with the arrow keys avoiding the trees.

Here is the source code:

REBOL [
    File: %ski-game.r
    Date: 23-07-2009
    Title: "Ski Game"
    Author:   Nick Antonaccio
    Purpose: {
        A little graphic game.  
        Taken from the tutorial at http://musiclessonz.com/rebol.html
    }
]
tree:   load to-binary decompress 64#{
eJzt18sNwjAQBFDTBSVw5EQBnLjQE1XRngmBQEj8Wa/3M4oYOZKBKHkaWwTO1/sh
jDkNx3N6HI7LcOzCfnz/9v5cMnEai7lj4mokT9C7XczUsrhvGSku6RkgDIbHAEP0
2EiIMBdMDuaOWZCSL91bQvCsSY4MHE9umXz7ydVi3xgltYvEKboexzVSlpTa614d
NonpUauIv176dX0ZTRgJlVgzNl25A3gkGwld1bkrNFqqedQfEI02AU9PjDeMpac/
ShKeTXylROqCImlXRFd9zkQoh4tp+GpqlSTnLnum4HTEzK/gjpmTpDxSASlHFqYU
EE/8nddG9n+9LIm8t9OeIEra2JZWDRSG4VEioa0UFCZFqv/aMQh2Rf790EnGgcJU
SVAer0Bhcp7/epVJvkHzBHjPfz+XSe6BwryC5gmQno3mAY3tpba2KAAA
}

skier-left: load to-binary decompress 64#{
eJyN0U8og2EcB/DvNrz+E5fJZSmRf9Ej76h3Ne1AIspyMQflpJDFU/KO1cQmSnGa
A3PYkvInB3kvuyzlgJolh+fCRUq5iBvP8+5lTvKrX33ep+/zp9/b2Tthhl6zvGt5
W3nX8TYhS1//MOGnSjNEa/AUxd0UVQ3raL9IYbBvA2OBI9Q0DqB6fAujl08Yi97D
Hr3F5EQYSss2OrrWEFo5xB+VO5Vx/skvnxmQbDCFvxcjMJ/b0s6LAZXGA3O0ZtTt
pW3WbJmDeMC8a1gE9o3bTBFI9YvGhrOKSueyEQpu9ri60vQFXFqPMx1K+sNWrdOh
73Y/uMr85fKdcIrJ0z6vxSfsYV5KCU2JEPNIlD9dFZ65AfXwD+HsKdAZiiLdqtvt
Hh65E5ZklTGmDvWLgxxKkjAivwt7XxhJEvIsrCY8ikLs0Tj3yGeCKaQtdsX9fv3G
N1jCJdyv84lHJkNriiM7Li29OIDV0jcU8kuIHaiPLEDEsG9DQYxiQTi0A8sBpEvh
OT65GmBYH9Jx5nf8TFFUFf5ZX2hFdG1uAgAA
}

skier-right: load to-binary decompress 64#{
eJxz8s1jYgCDMiDWAGIJINYCYkYGFrD4D0YGOBBAMBn4++Yz6HjVMSgY1oP5gWdu
M/gHTmCwNutlKJ26l6F03VUGp3XnGGo+/mGILVnMoFkwhaHm7GcGz4m7GbABFwST
eQWSNXMQbM+3DAwlULbmEgaWXih75QUGzvkQJstMBwbPRRA2L1D5yS8QNudioNQF
qNYPDExAZRCtDg78c6Fa7wZK3Ycq940O3L1fAcLWigpctUsZzHTSj5Jd+l7NAKS6
3HnXk6jHSiBF7sUmxi7Gl9VAZrqVOxsZuTirg8TTS0qAQs5FIPF0BhYXFkgog/zg
7gJlq5SXpaWVF4O9lZKuXl6eVl4AZLIfKS82LzYuB2nlOFxWXl5ubA6ytm1KWU65
cXExkMl09lNNR3q5eTFQPYfHE7YT6cXlJgcYGI7cPMAOMtKhgcH9wE8FBuPycgOG
BoYKtl8ODL4gjccY2HSAfr4BVMvgAwyazwwsXSA7ORgY2BQYeH+Cw+sAKPo5wEHj
kQAO/GZwIIHDgc0AaxQSBAAFOXD7bgIAAA==
}

random/seed now
the-score: 0
board: reduce [‘image 300×20 skier-right black]
for i 1 20 1 [
    pos: random 600×540
    pos: pos + 0×300
    append board reduce [‘image pos tree black]
]
view center-face layout/tight [
    scrn: box white 600×440 effect [draw board] rate 0 feel [
        engage: func [f a e] [
            if a = ‘key [
                if e/key = ‘right [
                    board/2: board/2 + 5×0
                    board/3: skier-right
                ]
                if e/key = ‘left [
                    board/2: board/2 - 5×0
                    board/3: skier-left
                ]
                show scrn
            ]
            if a = ‘time [
                new-board: copy []
                foreach item board [
                    either all [
                        ((type? item) = pair!)
                        ((length? new-board) > 4)
                    ] [append new-board (item - 0×5) ] [append new-board item ]
                    coord: first back back (tail new-board)
                    if ((type? coord) = pair!) [
                        if ((second coord) < -60) [
                            remove back tail new-board
                            remove back tail new-board
                            remove back tail new-board
                            remove back tail new-board
                        ]
                    ]
                ]
                board: copy new-board
                if (length? new-board) < 84 [
                    column: random 600
                    pos: to-pair rejoin [column “x” 440]
                    append board reduce [‘image pos tree black]
                ]
                collision-board: remove/part (copy board) 4
                foreach item collision-board [
                    if (type? item) = pair! [
                        if all [
                          ((item/1 - board/2/1) < 15)
                          ((item/1 - board/2/1) > -40)
                          ((board/2/2 - item/2) < 30)
                          ((board/2/2 - item/2) > 5)
                        ] [
                            alert “Ouch - you hit a tree!”
                            alert rejoin [“Final Score: “ the-score]
                            quit
                        ]
                    ]
                ]
                the-score: the-score + 1
                score/text: to-string the-score
                show scrn
            ]
        ]
    ]
    origin across h2 “Score:”
    score: h2 bold “000000″
    do [focus scrn]
]
Print This Post Print This Post
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Site check

November 7th, 2013

I found the following script that check for missing links in a site:

REBOL [
    Title: "Web Site Checker"
    Date: 11-June-2004   ;16-May-2001
    Version: 1.1.1
    File: %site-check.r
    Author: "Carl Sassenrath"
    Purpose: {Scan a web site looking for missing pages, remote links, email links, etc. Helps you clean up sites.}
    Email: carl@rebol.com
    library: [
        level: 'intermediate
        platform: 'all
        type: 'tool
        domain: [web file-handling markup parse]
        tested-under: none
        support: none
        license: none
        see-also: none
    ]
]
; 1.1.1 - Fixes problem when top-level relative paths are used ( /index.html /about.html etc)

;–Config:
base-url: http://www.rebol.com
threshold: 8000   ; used to filter out huge pages
exclude-urls: [; URL patterns for pages to exclude
    http://www.rebol.com/library
    http://www.rebol.com/docs/core23
    http://www.rebol.com/dictionary
    http://www.rebol.com/users.html
    http://www.rebol.com/docs/dictionary
    http://www.rebol.com/r3/docs
]
;–Lists:
base-str: form base-url
scanned-urls: []
missing-urls: []
remote-urls: []
local-urls: []
secure-urls: []
email-urls: []
ftp-urls: []
ref-urls: []   ; pairs of: url and referrer

;–Functions:
html?: func [url /local t] [
    all [
        t: find/last/tail url “.”
        t: to-string t
        any [t = “htm” t = “html”]
    ]
]
add-url: func [urlset url from /local t] [
    clear find url “#”
    if all [
        not find url “?”
        html? url
    ][
        append urlset url
        repend ref-urls [url form from] ; second is string
    ]
]
scan-page: func [url /local tag page new path] [
    print [“Scanning:” url length? local-urls length? missing-urls]
    append scanned-urls url
    foreach u exclude-urls [if find/match url u [print “(excluded)” exit]]
    path: either html? url [first split-path url][url]
    if error? try [page: load/markup url][append missing-urls url exit]
    if (length? page) > threshold [exit] ; big page, skip it.
    foreach tag page [
        if all [
            tag? tag
            tag: parse tag “=”
            tag: select tag “HREF”
        ][
            new: to-url tag
            parse/all tag [
                “#” |
                base-str   (add-url local-urls new url) |
                “/”       (add-url local-urls base-url/:new url) |   ;1.1.1
                “http:”   (append remote-urls new) |
                “https:”   (append secure-urls new) |
                “ftp:”     (append ftp-urls new) |
                “mailto:” (append email-urls new) |
                none       (add-url local-urls path/:new url)
            ]
        ]
    ]
    remote-urls: unique remote-urls
    local-urls:   unique local-urls
    secure-urls: unique secure-urls
    email-urls:   unique email-urls
    ftp-urls:     unique ftp-urls
]
;–Main code:
scan-page base-url
while [pick urls: exclude local-urls scanned-urls 1][scan-page pick urls 1 ]
out: reform [“Site Summary for” base-url “on” now newline]
sort scanned-urls
repend out “^/Scanned Pages:^/”
foreach url scanned-urls [repend out [url newline]]
sort remote-urls
repend out “^/Remote Links:^/”
foreach url remote-urls [repend out [url newline]]
sort email-urls
repend out “^/Email Links:^/”
foreach url email-urls [repend out [url newline]]
repend out “^/References:^/”
foreach [url url2] ref-urls [repend out [url2 ” -> “ url newline]]
repend out “^/Missing Pages:^/”
foreach url missing-urls [
    n: ref-urls
    repend out [“Missing URL:” url newline]
    while [n: find n url] [
        repend out [tab “Ref from:” n/2 newline]
        n: next n
    ]
]
write %site-summary.txt out
browse %site-summary.txt

I launched it and this is the result: site-summary.txt.

Print This Post Print This Post
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Simple tooltip style

October 21st, 2013

The helpful tooltip bubble is very useful to give user hints about button, or other GUI elements, function. Mr. Marco Anotiazzi wrote this style very easy to use: just use the help word in a style, followed by thetooltip string.
Here is an example:

win: layout [
area "another face" help "an area"
panel [across
button "test" help "the first button"
button "test2" help "the second button"
btn "test3" help "the third button" [probe face/feel]
button 120 "test4 without help"
]
]

view center-face win

Here is the source code:

REBOL [
    title: "Tooltip style example"
    file: %simple-tooltip-style.r
    author: "Marco Antoniazzi"
    email: [luce80 AT libero DOT it]
    date: 30-04-2011
    version: 0.9.3
    Purpose: {A quick way to add a simple tooltip to VID GUIs}
    comment: {You are strongly encouraged to post an enhanced version of this script}
    History: [
        0.0.1 [03-12-2010 "First version"]
        0.8.0 [08-01-2011 "Enhanced"]
        0.9.0 [16-01-2011 "Enhanced with function by Shadwolf, Boss, DideC, Volker and the tipped flag"]
        0.9.1 [08-02-2011 "Minor bug fixes and source retouches"]
        0.9.2 [19-02-2011 "Minor bug fix of offset/x"]
        0.9.3 [30-04-2011 "Minor source retouches"]
    ]
    Category: [util vid view]  
    license: 'BSD
]
tip: make face [
    color: yello + 30
    font: make font [size: 11]
    para: make para [wrap?: false]
    edge: make edge [size: 1×1 color: gray]
    ticks: 0
    start_tip: func [face] [
        if ticks <> 0 [exit]
        if not text: face/help [exit]
        size: 4×6 + size-text self
        rate: 0:0:0.500
        offset: - size ; hide it
        remove find get in find-window face ‘pane self
        append get in find-window face ‘pane self
        show find-window face
    ]
    open_tip: func [woffset /local wsize] [
        offset: woffset + 0×15
        wsize: get in find-window self ’size
        ; keep inside window
        if offset/y > (wsize/y - size/y) [offset/y: offset/y - size/y - 16]
        offset/x: max min wsize/x - size/x offset/x 0
        show self/parent-face
    ]
    close_tip: func [] [
        if size = 100×100 [exit] ; entering here before start_tip
        rate: none
        offset: - size
        ticks: 0
        show self/parent-face
    ]
    feel: make feel [
        engage: func [face action event][
            if action = ‘time [
                if ticks = 1 [open_tip event/offset]
                if ticks = 6 [close_tip]
                ticks: ticks + 1
            ]
        ]
    ]
    over: func [face over? offset] [either all [over? not flag-face? face tipped] [start_tip face] [deflag-face face tipped close_tip]]
    engage: func [face action event] [if not flag-face? face tipped [flag-face face tipped close_tip]]
]
flag-face?: func [
    “Checks a flag in a VID face.”
    face [object!] ‘flag
] [all [in face ‘flags face/flags find face/flags flag]] ; patched

; this function is taken from %toolt4vid.r (only a little modified)
Add-tooltip-2-style: func [{ Allow to add the   tooltip support to all widgets passed in parameter}
    style-lst [block! ] “Contains the listing of Vid widgets to patch”
    style-root “Countain the path of the root-styles to patch”
][
    foreach style style-lst [
        if find style-root style [     ; Teste si le style existe pour la compatibilité avec les versions antérieures de view
            style-root/:style/feel: make style-root/:style/feel [
                over*: :over
                over: func [face action offset][
                    tip/over face action offset
                    over* face action offset ; call original
                ]
                engage*: :engage
                engage: func [face action event][
                    engage* face action event
                    tip/engage face action event
                ]
            ]
        ]
    ]
]
; here is the list of widget affected by the tooltip ability (does it make sense to patch also text?)
vid-styles: [image btn backtile box sensor key base-text vtext text body txt banner vh1 vh2 vh3 vh4
            title h1 h2 h3 h4 h5 tt code button check radio check-line radio-line led
            arrow toggle rotary choice drop-down icon field info area slider scroller progress
            anim btn-enter btn-cancel btn-help logo-bar tog]
Add-tooltip-2-style vid-styles system/view/vid/vid-styles
Print This Post Print This Post
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...