FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Architecture & Design
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
March 12, 2002
When a Language Becomes a Platform

REBOL IOS Express

(Page 1 of 3)
Kurt Cagle
Develop multiplatform distributed desktops with device-independent REBOL.
===A sample REBOL application.

REBOL [ Title: "A Sample Document" Author: "Kurt Cagle" Date: 12-Jan-2002 Version: 1.1.2 ]

flash "Fetching image..." read-thru/to http://www.rebol.com/view/demos/palms.jpg %palms.jpg unview

content: {A Sample Document

===My Introduction

The ability to create rich wizards via easy to use text is perhaps one of the real advantages that REBOL offers. This, for instance, is a modified script from the initial documentation, where such elements as headers are indicated by elements such as the characters ===. These are automatically parsed out by the REBOL engine into control headers.

---Inline Code

You can also introduce inline code into REBOL scripts. For instance, the following line will create a pop-up text message:

view layout [ text "This is a sample app!" button blue "With a Button" ]

===A Second Section

Much more information can be contained within one of these documents.

}

code: text: layo: xview: none

sections: []

layouts: []

space: charset " ^-" chars: complement charset " ^-^/"

rules: [title some parts]

title: [text-line (title-line: text)]

parts: [ newline | "===" section | "---" subsect | "!" note | example | paragraph ]

text-line: [copy text to newline newline] indented: [some space thru newline] paragraph: [copy para some [chars thru newline] (emit txt para)] note: [copy para some [chars thru newline] (emit-note para)] example: [ copy code some [indented | some newline indented] (emit-code code) ] section: [ text-line ( append sections text append/only layouts layo: copy page-template emit h1 text ) newline ] subsect: [text-line (emit h2 text)]

emit: func ['style data] [repend layo [style data]]

emit-code: func [code] [ remove back tail code repend layo ['code 460x-1 trim/auto code 'show-example] ]

emit-note: func [code] [ remove back tail code repend layo ['tnt 460x-1 code] ]

show-example: [ if xview [xy: xview/offset unview/only xview] xcode: load/all face/text if not block? xcode [xcode: reduce [xcode]] ;!!! fix load/all if here: select xcode 'layout [xcode: here] xview: view/new/offset layout xcode xy ]

page-template: [ size 500x480 origin 8x8 backdrop white style code tt black silver bold as-is para [origin: margin: 12x8] font [colors: [0.0.0 0.80.0]] style tnt txt maroon bold ]

parse/all detab content rules

show-page: func [i /local blk][ i: max 1 min length? sections i append clear tl/picked pick sections i show tl if blk: pick layouts this-page: i [f-box/pane: layout/offset blk 0x0 show f-box] ]

main: layout [ across h2 title-line return space 0 tl: text-list 160x480 bold black white data sections [ show-page index? find sections value ] h: at f-box: info 500x480 at h + 456x-24 across space 4 arrow left keycode [up left] [show-page this-page - 1] arrow right keycode [down right] [show-page this-page + 1] pad -120 txt form system/script/header/date/date ] show-page 1 xy: main/offset + 480x100 view main

1 | 2 | 3 Next Page
TOP 5 ARTICLES
No Top Articles.
DR. DOBB'S CAREER CENTER
Looking for a new job? open | close
Search jobs on Dr. Dobb's TechCareers
Function:

Keyword(s):

State:  
  • Post Your Resume
  • Employers Area
  • News & Features
  • Blogs & Forums
  • Career Resources

    Browse By:
    Location | Employer | City
  • Most Recent Posts:



    MICROSITES
    FEATURED TOPIC

    ADDITIONAL TOPICS

    INFO-LINK



     




    Techweb
    Informationweek Business Technology Network
    InformationweekInformationweek 500Informationweek 500 ConferenceInformationweek AnalyticsInformationweek Events
    Informationweek MagazineGlobal CIOIWK Government ITbMightyByte and SwitchDark Reading
    Digital LibraryIntelligent EnterpriseInternet EvolutionNetwork ComputingPlug Into The CloudDr. DobbsContentinople
    space
    TechWeb Events Network
    InteropVoiceConWeb 2.0 ExpoWeb 2.0 SummitEnterprise 2.0Mobile Business ExpoNoJitter
    Black HatGTECEnergy CampCloud ConnectGov 2.0 ExpoGov 2.0 Summit
    space
    Light Reading Communications Network
    Light ReadingLight Reading AsiaUnstrungCable Digital NewsInternet EvolutionPyramid Research
    Heavy ReadingLight Reading LiveLight Reading InsiderEthrnet ExpoTelco TVTower Technology Summit
    space
    Financial Technology Network
    Advanced TradingBank Systems and TechnologyInsurance and TechnologyWall Street and TechnologyAccelerating WallstreetBST SummitBuyside Trading SummitIT Summit
    space
    Microsoft Technology Network
    MSDNTechNetTotal IT ProTotal Dev ProNET Total Dev Pro CommunitySQL Total Dev Pro Community
    space