REBOL.org
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Library member page for sunanda


Sunanda

Welcome!

Welcome to my personal page
My scripts are here: Scripts owned by sunanda
My favourites are here: Favorites for sunanda

Profile BIO

Discovered REBOL after 30 years of programming other languages.

Even more about me

Early language experience

I wrote my first computer program back in 1972.

It was run in batch on the city council's ICL 1900 computer, we got two turn-arounds a week, if I remember rightly. (A year or so later, the council donated an obsolete Elliot 803 computer to the college, so we got to run the assembler on that, using 5-track paper tape readers).

That first program was in a language so obscure and forgotten that I think this page has the only example of it on the whole wide web.

The language was City and Guilds Mnemonic Code for Computer Instruction (C&G are a UK vocational training institute). It was a sort of p-code assembler for a machine with just 1000 locations of memory.

Locations 0 - 9 doubled as index registers for address offsets. Location 1 was also the accumulator. Each location could hold one of: an instruction, a floating point number, or a single character.

This code (from memory, so it may be completely wrong) reads a string of characters into locations 900 and upwards. This was the only way to get strings if you wanted to print them later -- you have to first read them in as data from the system input.

    start 100       Start assembling code at location 100
    rnt   899        Read a Number from the input paper Tape into location 899
                            This will tell us how may characters follow on
    lda   899        Load it into the accumulator
    rct   899,1      Read a Character into 899 + value in accumulator
    subn  1          Reduce count by 1
    jnz   102        Loop if count is non-zero
 

Assembler

I spent something like 20 years off-and-on writing IBM mainframe assembler.

A bit of example code. This implements the Shift-AND search algorithm (also called Shift-OR , as designed by Udi Manber and Sun Wu, researchers at the Uni of Arizona, and Bell Laboratories. (References: Communications of the ACM, October, 1992). A totally non-intuitive way of searching a string for a match. This implementation was several times faster than any other method we ever came across.

One neat thing about Shift-AND is that the search loop (the code below) does not need to change for a case sensitive (or not) search. And it can handle single-character wild cards or alternatives. All you need to do is make a tweak to the CVT (characteristic vector table) in the pre-search set-up (which is not shown).

Shift-AND main search loop:

          l     r8,wkacsbe              A(start of scan buffer)
          l     r5,wkalsbe              A(last scan buffer entry)
          la    r4,1                    Initialise bump amount for bxle

          l     r10,wkhighbit           Set r10 to top bit on
          la    r6,sbcvt                A(start of CVT)
          lh    r2,sblstrlen            offset length
          bctr  r2,0                    .
          l     r9,sbsmask              Set up S mask

          xr    r11,r11                 Clear R mask
          xr    r1,r1                   Clear work register
          la    r13,gb400               for that extra speed saving
  gb150   equ   *
          srl   r11,1                   R = R shifted right with top
          or    r11,r10                     bit set
          ic    r1,0(r8)                Calculate CVT offset
          sll   r1,2                    .
          n     r11,0(r1,r6)            R = R &  CVT offset

          lr    r1,r11                  Temp = R
          nr    r1,r9                   Temp = R & S
          bnzr  r13                     Temp not zero: got a match
  gb300   equ   *
          bxle  R8,R4,gb150             Bump and loop
          b     gbexit4                 ===> No more matches
 

REBOL

I'm one of the Library Team of volunteers (referred to in places as "The Library People" as if we were a strange tribe). I've done most of the CGI programming on the site.

REBOL.org is a fully REBOL site -- no third-part software other than Apache for a web server. Most of the data is held in REBOL Object!s. Here is an example:

The LMP-record is a template for the record that holds a Library member's page -- so what you are seeing right now

  lmp-record: make object!
   [
    user-name: "
    public?: true      ;; True: the page is publicly viewable, and will be
                       ;;       in the indexes
                       ;; False: it isn't. The user can still change and
                       ;;       edit the page. But they (and the Librarians)
                       ;;       are the only ones who can see it.
                       ;; The Librarians will set this if they see a
                       ;; page that has stuff deemed unacceptable.

    publish?: true     ;; Similar to the public? flag, but settable by the
                       ;; user themself when they publish/unpublish:
                       ;; True:  Yes please, publish this (we will, provided
                       ;;        public? is true)
                       ;; False: No, I don't want my page published right now,
                       ;;        thanks.

    last-updater: none        ;; who last updated it (could be the user, or a Librarian)
    last-update-date: none    ;; and when
    total-views: copy [0 0]   ;; since 27-aug-2004 [anonymous other-members]

    data-format: "Plain text" ;; format: ascii, mdp, etexts etc
    raw-data: compress "      ;; page text as typed by user
    html-data: compress "     ;; page text as transformed to HTML by appropriate THP handler
                              ;; but with ##pseudo-variables still embedded as they are "live"
   ]