home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
clarion
/
brokcode.zip
/
MEMOEDIT.EXE
/
MEMO2.CLA
< prev
next >
Wrap
Text File
|
1991-12-05
|
13KB
|
343 lines
MEMBER('MEMO')
SHO_Name PROCEDURE
SCREEN SCREEN PRE(SCR),WINDOW(25,45),HUE(15,1)
ROW(6,6) PAINT(17,34),HUE(0,7)
ROW(1,1) STRING('┌─{43}┐'),HUE(15,1)
ROW(2,1) REPEAT(23);STRING('│<0{43}>│'),HUE(15,1) .
ROW(25,1) STRING('└─{43}┘'),HUE(15,1)
ROW(2,11) STRING('Select the Record to Edit')
ROW(4,5) STRING('LOCATE:'),HUE(11,1)
ROW(23,5) STRING('Ins to Add'),HUE(11,1)
COL(27) STRING('Enter to Change'),HUE(11,1)
ROW(24,5) STRING('Del to Delete'),HUE(11,1)
COL(26) STRING('Ctrl-Esc to Exit'),HUE(11,1)
LOCATOR ROW(4,12) STRING(30),HUE(11,1)
ENTRY,USE(?FIRST_FIELD)
ENTRY,USE(?PRE_POINT)
REPEAT(17),EVERY(1),INDEX(NDX)
ROW(6,7) POINT(1,32),USE(?POINT),ESC(?-1)
Name COL(8) STRING(30)
. .
NDX BYTE !REPEAT INDEX FOR POINT AREA
ROW BYTE !ACTUAL ROW OF SCROLL AREA
COL BYTE !ACTUAL COLUMN OF SCROLL AREA
COUNT BYTE(17) !NUMBER OF ITEMS TO SCROLL
ROWS BYTE(17) !NUMBER OF ROWS TO SCROLL
COLS BYTE(32) !NUMBER OF COLUMNS TO SCROLL
FOUND BYTE !RECORD FOUND FLAG
NEWPTR LONG !POINTER TO NEW RECORD
TABLE TABLE,PRE(TBL) !TABLE OF RECORD DATA
Name STRING(30)
PTR LONG ! POINTER TO FILE RECORD
.
EJECT
CODE
ACTION# = ACTION !SAVE ACTION
OPEN(SCREEN) !OPEN THE SCREEN
SETCURSOR !TURN OFF ANY CURSOR
TBL:PTR = 1 !START AT TABLE ENTRY
NDX = 1 !PUT SELECTOR BAR ON TOP ITEM
ROW = ROW(?POINT) !REMEMBER TOP ROW AND
COL = COL(?POINT) !LEFT COLUMN OF SCROLL AREA
RECORDS# = TRUE !INITIALIZE RECORDS FLAG
CACHE(FIL:BY_Name,.25) !CACHE KEY FILE
IF ACTION = 4 ! TABLE LOOKUP REQUEST
NEWPTR = POINTER(MEMOTEST) ! SET POINTER TO RECORD
IF NOT NEWPTR ! RECORD NOT PASSED TO TABLE
SET(FIL:BY_Name,FIL:BY_Name) ! POSITION TO CLOSEST RECORD
NEXT(MEMOTEST) ! READ RECORD
NEWPTR = POINTER(MEMOTEST) ! SET POINTER
.
DO FIND_RECORD ! POSITION FILE
ELSE
NDX = 1 ! PUT SELECTOR BAR ON TOP ITEM
DO FIRST_PAGE ! BUILD MEMORY TABLE OF KEYS
.
RECORDS# = TRUE ! ASSUME THERE ARE RECORDS
LOOP !LOOP UNTIL USER EXITS
ACTION = ACTION# !RESTORE ACTION
ALERT !RESET ALERTED KEYS
ALERT(REJECT_KEY) !ALERT SCREEN REJECT KEY
ALERT(ACCEPT_KEY) !ALERT SCREEN ACCEPT KEY
ACCEPT !READ A FIELD
IF KEYCODE() = REJECT_KEY THEN BREAK. !RETURN ON SCREEN REJECT KEY
IF KEYCODE() = ACCEPT_KEY | !ON SCREEN ACCEPT KEY
AND FIELD() <> ?POINT !BUT NOT ON THE POINT FIELD
UPDATE ! MOVE ALL FIELDS FROM SCREEN
SELECT(?) ! START WITH CURRENT FIELD
SELECT ! EDIT ALL FIELDS
CYCLE ! GO TO TOP OF LOOP
.
CASE FIELD() !JUMP TO FIELD EDIT ROUTINE
OF ?FIRST_FIELD !FROM THE FIRST FIELD
IF KEYCODE() = ESC_KEY | ! RETURN ON ESC KEY
OR RECORDS# = FALSE ! OR NO RECORDS
BREAK ! EXIT PROGRAM
.
OF ?PRE_POINT !PRE POINT FIELD CONDITION
IF KEYCODE() = ESC_KEY ! BACKING UP?
SELECT(?-1) ! SELECT PREVIOUS FIELD
ELSE ! GOING FORWARD
SELECT(?POINT) ! SELECT MENU FIELD
.
IF KEYCODE() = ESC_KEY ! BACKING UP?
SCR:LOCATOR = '' ! CLEAR LOCATOR
SETCURSOR ! AND TURN CURSOR OFF
ELSE ! GOING FORWARD
LEN# = 0 ! RESET TO START OF LOCATOR
SETCURSOR(ROW(SCR:LOCATOR),COL(SCR:LOCATOR)) !AND TURN CURSOR ON
.
OF ?POINT !PROCESS THE POINT FIELD
IF RECORDS(TABLE) = 0 !IF THERE ARE NO RECORDS
CLEAR(FIL:RECORD) ! CLEAR RECORD AREA
ACTION = 1 ! SET ACTION TO ADD
GET(MEMOTEST,0) ! CLEAR PENDING RECORD
UPD_MEMOTEST ! CALL FORM FOR NEW RECORD
NEWPTR = POINTER(MEMOTEST) ! SET POINTER TO NEW RECORD
DO FIRST_PAGE ! DISPLAY THE FIRST PAGE
IF RECORDS(TABLE) = 0 ! IF THERE AREN'T ANY RECORDS
RECORDS# = FALSE ! INDICATE NO RECORDS
SELECT(?PRE_POINT-1) ! SELECT THE PRIOR FIELD
.
CYCLE ! AND LOOP AGAIN
.
IF KEYCODE() > 31 | !THE DISPLAYABLE CHARACTERS
AND KEYCODE() < 255 !ARE USED TO LOCATE RECORDS
IF LEN# < SIZE(SCR:LOCATOR) ! IF THERE IS ROOM LEFT
SCR:LOCATOR = SUB(SCR:LOCATOR,1,LEN#) & CHR(KEYCODE())
LEN# += 1 ! INCREMENT THE LENGTH
.
ELSIF KEYCODE() = BS_KEY !BACKSPACE UNTYPES A CHARACTER
IF LEN# > 0 ! IF THERE ARE CHARACTERS LEFT
LEN# -= 1 ! DECREMENT THE LENGTH
SCR:LOCATOR = SUB(SCR:LOCATOR,1,LEN#) ! ERASE THE LAST CHARACTER
.
ELSE !FOR ANY OTHER CHARACTER
LEN# = 0 ! ZERO THE LENGTH
SCR:LOCATOR = '' ! ERASE THE LOCATOR FIELD
.
SETCURSOR(ROW(SCR:LOCATOR),COL(SCR:LOCATOR)+LEN#) !AND RESET THE CURSOR
FIL:Name = CLIP(SCR:LOCATOR) ! UPDATE THE KEY FIELD
IF KEYBOARD() > 31 | !THE DISPLAYABLE CHARACTERS
AND KEYBOARD() < 255 | !ARE USED TO LOCATE RECORDS
OR KEYBOARD() = BS_KEY !INCLUDE BACKSPACE
CYCLE
.
IF LEN# > 0 !ON A LOCATOR REQUEST
FIL:Name = CLIP(SCR:LOCATOR) ! UPDATE THE KEY FIELD
SET(FIL:BY_Name,FIL:BY_Name) ! POINT TO NEW RECORD
NEXT(MEMOTEST) ! READ A RECORD
IF (EOF(MEMOTEST) AND ERROR()) ! IF EOF IS REACHED
SET(FIL:BY_Name) ! SET TO FIRST RECORD
PREVIOUS(MEMOTEST) ! READ THE LAST RECORD
.
NEWPTR = POINTER(MEMOTEST) ! SET NEW RECORD POINTER
SKIP(MEMOTEST,-1) ! BACK UP TO FIRST RECORD
FREE(TABLE) ! CLEAR THE TABLE
DO NEXT_PAGE ! AND DISPLAY A NEW PAGE
.
CASE KEYCODE() !PROCESS THE KEYSTROKE
OF INS_KEY !INS KEY
CLEAR(FIL:RECORD) ! CLEAR RECORD AREA
ACTION = 1 ! SET ACTION TO ADD
GET(MEMOTEST,0) ! CLEAR PENDING RECORD
UPD_MEMOTEST ! CALL FORM FOR NEW RECORD
IF ~ACTION ! IF RECORD WAS ADDED
NEWPTR = POINTER(MEMOTEST) ! SET POINTER TO NEW RECORD
DO FIND_RECORD ! POSITION IN FILE
.
OF ENTER_KEY !ENTER KEY
OROF ACCEPT_KEY !CTRL-ENTER KEY
DO GET_RECORD ! GET THE SELECTED RECORD
IF ACTION = 4 AND KEYCODE() = ENTER_KEY! IF THIS IS A LOOKUP REQUEST
ACTION = 0 ! SET ACTION TO COMPLETE
BREAK ! AND RETURN TO CALLER
.
IF ~ERROR() ! IF RECORD IS STILL THERE
ACTION = 2 ! SET ACTION TO CHANGE
UPD_MEMOTEST ! CALL FORM TO CHANGE REC
IF ACTION THEN CYCLE. ! IF SUCCESSFUL RE-DISPLAY
.
NEWPTR = POINTER(MEMOTEST) ! SET POINTER TO NEW RECORD
DO FIND_RECORD ! POSITION IN FILE
OF DEL_KEY !DEL KEY
DO GET_RECORD ! READ THE SELECTED RECORD
IF ~ERROR() ! IF RECORD IS STILL THERE
ACTION = 3 ! SET ACTION TO DELETE
UPD_MEMOTEST ! CALL FORM TO DELETE
IF ~ACTION ! IF SUCCESSFUL
N# = NDX ! SAVE POINT INDEX
DO SAME_PAGE ! RE-DISPLAY
NDX = N# ! RESTORE POINT INDEX
. .
OF DOWN_KEY !DOWN ARROW KEY
DO SET_NEXT ! POINT TO NEXT RECORD
DO FILL_NEXT ! FILL A TABLE ENTRY
IF FOUND ! FOUND A NEW RECORD
SCROLL(ROW,COL,ROWS,COLS,ROWS(?POINT)) ! SCROLL THE SCREEN UP
GET(TABLE,RECORDS(TABLE)) ! GET RECORD FROM TABLE
DO FILL_SCREEN ! DISPLAY ON SCREEN
.
OF PGDN_KEY !PAGE DOWN KEY
DO SET_NEXT ! POINT TO NEXT RECORD
DO NEXT_PAGE ! DISPLAY THE NEXT PAGE
OF CTRL_PGDN !CTRL-PAGE DOWN KEY
DO LAST_PAGE ! DISPLAY THE LAST PAGE
NDX = RECORDS(TABLE) ! POSITION POINT BAR
OF UP_KEY !UP ARROW KEY
DO SET_PREV ! POINT TO PREVIOUS RECORD
DO FILL_PREV ! FILL A TABLE ENTRY
IF FOUND ! FOUND A NEW RECORD
SCROLL(ROW,COL,ROWS,COLS,-(ROWS(?POINT)))! SCROLL THE SCREEN DOWN
GET(TABLE,1) ! GET RECORD FROM TABLE
DO FILL_SCREEN ! DISPLAY ON SCREEN
.
OF PGUP_KEY !PAGE UP KEY
DO SET_PREV ! POINT TO PREVIOUS RECORD
DO PREV_PAGE ! DISPLAY THE PREVIOUS PAGE
OF CTRL_PGUP !CTRL-PAGE UP
DO FIRST_PAGE ! DISPLAY THE FIRST PAGE
NDX = 1 ! POSITION POINT BAR
. . .
FREE(TABLE) !FREE MEMORY TABLE
RETURN !AND RETURN TO CALLER
SAME_PAGE ROUTINE !DISPLAY THE SAME PAGE
GET(TABLE,1) ! GET THE FIRST TABLE ENTRY
DO FILL_RECORD ! FILL IN THE RECORD
SET(FIL:BY_Name,FIL:BY_Name,TBL:PTR) ! POSITION FILE
FREE(TABLE) ! EMPTY THE TABLE
DO NEXT_PAGE ! DISPLAY A FULL PAGE
FIRST_PAGE ROUTINE !DISPLAY FIRST PAGE
BLANK(ROW,COL,ROWS,COLS)
FREE(TABLE) ! EMPTY THE TABLE
CLEAR(FIL:RECORD,-1) ! CLEAR RECORD TO LOW VALUES
CLEAR(TBL:PTR) ! ZERO RECORD POINTER
SET(FIL:BY_Name) ! POINT TO FIRST RECORD
LOOP NDX = 1 TO COUNT ! FILL UP THE TABLE
DO FILL_NEXT ! FILL A TABLE ENTRY
IF NOT FOUND THEN BREAK. ! GET OUT IF NO RECORD
.
NDX = 1 ! SET TO TOP OF TABLE
DO SHOW_PAGE ! DISPLAY THE PAGE
LAST_PAGE ROUTINE !DISPLAY LAST PAGE
NDX# = NDX ! SAVE SELECTOR POSITION
BLANK(ROW,COL,ROWS,COLS) ! CLEAR SCROLLING AREA
FREE(TABLE) ! EMPTY THE TABLE
CLEAR(FIL:RECORD,1) ! CLEAR RECORD TO HIGH VALUES
CLEAR(TBL:PTR,1) ! CLEAR PTR TO HIGH VALUE
SET(FIL:BY_Name) ! POINT TO FIRST RECORD
LOOP NDX = COUNT TO 1 BY -1 ! FILL UP THE TABLE
DO FILL_PREV ! FILL A TABLE ENTRY
IF NOT FOUND THEN BREAK. ! GET OUT IF NO RECORD
. ! END OF LOOP
NDX = NDX# ! RESTORE SELECTOR POSITION
DO SHOW_PAGE ! DISPLAY THE PAGE
FIND_RECORD ROUTINE !POSITION TO SPECIFIC RECORD
SET(FIL:BY_Name,FIL:BY_Name,NEWPTR) !POSITION FILE
IF NEWPTR = 0 !NEWPTR NOT SET
NEXT(MEMOTEST) ! READ NEXT RECORD
NEWPTR = POINTER(MEMOTEST) ! SET NEWPTR
SKIP(MEMOTEST,-1) ! BACK UP TO DISPLAY RECORD
.
FREE(TABLE) ! CLEAR THE RECORD
DO NEXT_PAGE ! DISPLAY A PAGE
NEXT_PAGE ROUTINE !DISPLAY NEXT PAGE
SAVECNT# = RECORDS(TABLE) ! SAVE RECORD COUNT
LOOP COUNT TIMES ! FILL UP THE TABLE
DO FILL_NEXT ! FILL A TABLE ENTRY
IF NOT FOUND ! IF NONE ARE LEFT
IF NOT SAVECNT# ! IF REBUILDING TABLE
DO LAST_PAGE ! FILL IN RECORDS
EXIT ! EXIT OUT OF ROUTINE
.
BREAK ! EXIT LOOP
. .
DO SHOW_PAGE ! DISPLAY THE PAGE
SET_NEXT ROUTINE !POINT TO THE NEXT PAGE
GET(TABLE,RECORDS(TABLE)) ! GET THE LAST TABLE ENTRY
DO FILL_RECORD ! FILL IN THE RECORD
SET(FIL:BY_Name,FIL:BY_Name,TBL:PTR) ! POSITION FILE
NEXT(MEMOTEST) ! READ THE CURRENT RECORD
FILL_NEXT ROUTINE !FILL NEXT TABLE ENTRY
FOUND = FALSE ! ASSUME RECORD NOT FOUND
LOOP UNTIL EOF(MEMOTEST) ! LOOP UNTIL END OF FILE
NEXT(MEMOTEST) ! READ THE NEXT RECORD
FOUND = TRUE ! SET RECORD FOUND
DO FILL_TABLE ! FILL IN THE TABLE ENTRY
ADD(TABLE) ! ADD LAST TABLE ENTRY
GET(TABLE,RECORDS(TABLE)-COUNT) ! GET ANY OVERFLOW RECORD
DELETE(TABLE) ! AND DELETE IT
EXIT ! RETURN TO CALLER
.
PREV_PAGE ROUTINE !DISPLAY PREVIOUS PAGE
LOOP COUNT TIMES ! FILL UP THE TABLE
DO FILL_PREV ! FILL A TABLE ENTRY
IF NOT FOUND THEN BREAK. ! GET OUT IF NO RECORD
.
DO SHOW_PAGE ! DISPLAY THE PAGE
SET_PREV ROUTINE !POINT TO PREVIOUS PAGE
GET(TABLE,1) ! GET THE FIRST TABLE ENTRY
DO FILL_RECORD ! FILL IN THE RECORD
SET(FIL:BY_Name,FIL:BY_Name,TBL:PTR) ! POSITION FILE
PREVIOUS(MEMOTEST) ! READ THE CURRENT RECORD
FILL_PREV ROUTINE !FILL PREVIOUS TABLE ENTRY
FOUND = FALSE ! ASSUME RECORD NOT FOUND
LOOP UNTIL BOF(MEMOTEST) ! LOOP UNTIL BEGINNING OF FILE
PREVIOUS(MEMOTEST) ! READ THE PREVIOUS RECORD
FOUND = TRUE ! SET RECORD FOUND
DO FILL_TABLE ! FILL IN THE TABLE ENTRY
ADD(TABLE,1) ! ADD FIRST TABLE ENTRY
GET(TABLE,COUNT+1) ! GET ANY OVERFLOW RECORD
DELETE(TABLE) ! AND DELETE IT
EXIT ! RETURN TO CALLER
.
SHOW_PAGE ROUTINE !DISPLAY THE PAGE
NDX# = NDX ! SAVE SCREEN INDEX
LOOP NDX = 1 TO RECORDS(TABLE) ! LOOP THRU THE TABLE
GET(TABLE,NDX) ! GET A TABLE ENTRY
DO FILL_SCREEN ! AND DISPLAY IT
IF TBL:PTR = NEWPTR ! SET INDEX FOR NEW RECORD
NDX# = NDX ! POINT TO CORRECT RECORD
. .
NDX = NDX# ! RESTORE SCREEN INDEX
NEWPTR = 0 ! CLEAR NEW RECORD POINTER
CLEAR(FIL:RECORD) ! CLEAR RECORD AREA
FILL_TABLE ROUTINE !MOVE FILE TO TABLE
TBL:Name = FIL:Name
TBL:PTR = POINTER(MEMOTEST) ! SAVE RECORD POINTER
FILL_RECORD ROUTINE !MOVE TABLE TO FILE
FIL:Name = TBL:Name
FILL_SCREEN ROUTINE !MOVE TABLE TO SCREEN
SCR:Name = TBL:Name
GET_RECORD ROUTINE !GET SELECTED RECORD
GET(TABLE,NDX) ! GET TABLE ENTRY
GET(MEMOTEST,TBL:PTR) ! GET THE RECORD