File:  [LON-CAPA] / doc / rat / Attic / rat.txt
Revision 1.2: download - view: text, annotated - select for diffs
Fri Mar 8 14:33:40 2002 UTC (22 years, 2 months ago) by matthew
Branches: MAIN
CVS tags: version_0_6_2, version_0_6, version_0_5_1, version_0_5, version_0_4, stable_2002_july, stable_2002_april, STABLE, HEAD
Formatting changes to make it printable.

Scott Harrison's RAT Notes
(written in RAN format.. "ridiculous ascii notation")
09/27/1999

Start

Who is using RAT?
    Instructor/Student/Guest
    Domain

file names
 [domain]_[user]_[resource].rat

to do:
* implement fancy resource rat widget

* implement fancy resource linking information interface
  widget

* implement resources on rat


Program documentation
GLOBAL VARIABLES

row          array   maps row id to display  (example, d=row[i] where 'd' is display and 'i' is id)
             used by insertrow, findrow, horizontal, joinres, draw, main

maxrow       scalar  number of elements-2 in row array    (the last element number in the array, -1 for empty array)
             used by insertrow, findrow, horizontal, joinres, draw

col          array   maps col id to display  (example, d=row[i] where 'd' is display and 'i' is id)
             used by insertrow, insertcol, findcol, maprow, comingthru, horizontal, joinres, drawrow, draw, main

maxcol       scalar  number of elements-2 in col array    (the last element number in the array, -1 for empty array)
             used by insertcol, findcol, maprow, comingthru, insertport, drawrow, draw

colmap       array   in order of display ids which object is in which column
             used by maprow, comingthru, insertport, horizontal, drawrow, draw, 

colmap2	    array	temporary
	    used by	drawrow
colmap3	    array	temporary
	    used by	drawrow
colmap4	    array	temporary
	    used by	drawrow
colmap5	    array	temporary
	    used by	drawrow

obj	    array	appended array with drawing objects (which are blocks, verticals, horizontals, and conditions), never emptied
	    used by	insertrow, maprow, insertport, addobj, horizontal, joinres, drawrow, draw, main

maxobj	    scalar	number of values in obj array-2 (last element, -1 for empty)
	    used by	NOTHING

rowcont	    array	object ids in a row
	    used by	insertrow, maprow, addobj, drawrow, draw, main

rowtype	    array	row ids to type
	    used by	insertrow, drawrow, main

coltype	    array	col ids to type
	    used by	insertcol, insertport, drawrow, main

rrow	    array	display to id (reverse hash of row)
	    used by	draw

rcol	    array	display to id (reverse hash of row)
	    used by	drawrow, draw

cw	    array	column width (temporary)
	    used by	drawcell, draw

rh	    array	row height (temporary)
	    used by	drawrow, draw, 

data1,data2,data3,data4	array	 used to buffer memory so that javascript does not CRASH!
			used by  drawrow, insertrow, insertport

functions

main - invokes RAT
  \
   \
    initializes rows, with resources labelled 5, 4, 3, and 7
    insert thirteen columns from the left side
    perform 3 testing swaps 
    initialize maxrow
    define starting objects (blocks: 3,4,5,7)
    create 12 joinings between these resources! (joinres ... see below)
    draw in debugging editting mode!
     \                                                                                 b&rowID&colID:inObj:outObj:outCond&...
      \                                                                                h&rowID&incolID:outcolID&inObj:outObj&inupdown:outupdown
       \                                                                               v&colID&inObj:outObj&updown
        \                                                       simple javascript    /
         \                                                     /                    /
      open, configure, and clear a debugging javascript window/                    /
                       |                                                          |
      go through all objects and display object information -----------------------
      write out the value of col array ------- counting col ids from 0 to maxcol, print out a comma separated list of display locations
      write out the value of row array ------- counting row ids from 0 to maxrow, print out a comma separated list of display locations
      find all the display rows (findrow) from 0 to last row, 
                       |                   findrow: does this my running through all rows and waiting till the value of an array
                       |                   index matches the row to display, returns row id
        map this row (maprow), and output the results (colmap and rowcont) onto
                       |________________
                       |                \
                       |                 -- a debugging window with column id, colmap, and rowcont
                       |                    where colmap specifies where objects occur within a row based on "display column" location
                       |                    where rowcont is the objects within a row and
	    	       |  
                       |
                       |
               initialize display-to-id array rrow (so that rrow[display] equals original row id)
               initialize display-to-id array rcol (so that rcol[display] equals original col id)
               initialize row height and column width values where rh[1] is short row, 
                                  rh[2] is tall row, cw[1] is skinny column, cw[2] is fat column
               set javascript RAT display window options (javascript stuff...)
               output HTML beginning to RAT display window
               run through the rows to display, convert from display row # to row id (rrow) and draw in edit mode (drawrow)
                                                                                                                      |
               drawrow:   drawrow begins by clearing out and initializing
                          these temporary arrays
                              colmap,colmap2,colmap3,colmap4,colmap5
                          output HTML beginning to row set to rowtype height (from row id)
                          if there are contents in the row (rowcont[jid] display them (else just end HTML row)
                              run through all the objects in row
                              if object is a 'b'lock object
                                  do a lot of amazing things to position resource within block
                                  and draw arrows connecting into block in another amazing feat of code
                                  if object is a 'h'orizontal object
                                    grab input column id and output column id
                                    and depending whether input is less than output in display position
                                      draw left-right arrow line or right-left arrow line
                                      and set leftmost position and rightmost position
                                    look at inupdown and outupdown
                                    if inupdown (means what ??) then
                                      draw top-to-right line, set colmap2 and colmap3
                                    else draw right-to-down line
                                    if outupdown (means what ??) then
                                      draw top-to-left line, set colmap2 and colmap3
                                    else draw left-to-down line
                                  if object is a 'v'ertical object
                                    set left to display column and USE THIS as the position
                                    if there is another element found in the colmap
                                      it must be horizontal so draw top-down-right-left intersection ('tdrl')
                                    else draw top-to-down or down-to-top depending on 
                                            'v'ertical object specification
                                    set colmap2[left] and colmap3[left] to a plain vertical line
                                  run through columns and draw cells
                   drawcell draws in edit mode html stuff  ---- rtype is set to type of row, the cell is drawn with drawcell
                                                                then using colmap2 and colmap3 draw two more up-down elements
                                                                in rows below if rowtype is 2

***************
joinres from A to B

calculate where in the middle of first object is a good place to insert outcoming path
calculate where in the middle of second object is a good place to insert incoming path
insert the ports based on the objects, the distance from middle of one object to other object, and direction
if A is below B, then loop around..set updown!
else set updown the other way
if inrow equals outrow
  just draw connecting horizontal element
if updown one way then go from row to row finding good columns to go through (comingthru)
     if there is NO GOOD COLUMN THEN INSERT A ROW! (insertrow)
if updown the other way then go from row to row finding good columns to go through (comingthru)
     if there is NO GOOD COLUMN THEN INSERT A ROW! (insertrow)

***************
comingthru
see where you can bulldoze..more to write here

***************
insertrow
make sure you can bulldoze..more to write here


Help Documentation
on RAT

Developer Documentation
on RAT




FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>