home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1997 January
/
Chip_1997-01_cd.bin
/
ms95
/
disk21
/
dir03
/
f008890.re_
/
f008890.re
Wrap
Text File
|
1996-04-02
|
11KB
|
311 lines
; MSMM.UCM -- Build Microstation Matrix Menu.
; -- Places IGDS format Matrix Menu range blocks
; and command string entries needed for the cell
; to be built.
key 'NoEcho'
set r2=outflg ; save outflg
set outflg=outflg!@2000 ; disable command parser
; mod by e. sutton 06/01/89
cmd nulcmd
msg 'st* Define MicroStation Matrix Menu *'
; * Save Active parameters and set some of our own *
set A0 = ACTANG ; Save active angle
set R1 = ACTLEV ; Save active level
set R4 = CAFONT ; Save active font
set R9 = IDSYMB ; Save weight and color
set R10 = TXJUST ; Save text justification
set R11 = TNJUST ; Save node justification
key 'Active TXJ LC' ; Set text justification
key 'Active TNJ LB' ; using uStn syntax.
key 'wt=0' ; Set weight, color
key 'co=3' ; and level using
key 'lv=63' ; IGDS syntax.
; Set angle and font
set ACTANG = 0 ; using ucm syntax for
set CAFONT = 1 ; tcb entries.
set I0 = NODSPA ; Save line spacing
set I9 = CHHGT ; Save text height
set I10 = CHWID ; Save text width
set NODSPA = 500 ; Set LS, TH & TW
set CHHGT = 1000 ; using ucm syntax for
set CHWID = 1000 ; tcb entries.
go ERRTN
IVRC: msg 'st* Invalid Row,Column Specification *' ; Invalid input.
ERRTN:
msg 'cfEnter No. of Rows,Cols'
msg 'prReset to Exit'
GETRC: get K,CKINP, R,EXITUC ; Get rows & columns.
go GETRC
CKINP: msg 'st'
set msg = ' ' ; Clear msg register.
set r7 = 1 ; Initialize counters
set r8 = 1
FNDROW: tst key(R7) eq ',',SAVROW ; Find no. of rows
set msg = msg + key(R7) ; and move digit into
set R7 = R7 + 1 ; the msg register.
set R8 = R8 + 1 ; Exit to find col's
set NUM = NUM - 1 ; when a "," is found.
tst NUM eq 0,IVRC
go FNDROW
SAVROW: tst R8 eq 1,IVRC ; (r8=1) ? iv entry
set R5 = msg ; Save no. of rows in R5
set msg = ' ' ; Clear msg register.
set R8 = 1 ; Reset counter.
set R7 = R7 + 1 ; Skip the comma.
set NUM = NUM - 1
FNDCOL: tst num eq 0,SAVCOL ; (len=0) ? exit loop
set msg = msg + key(R7) ; Find no. of col's
set R7 = R7 + 1 ; and move digit into
set R8 = R8 + 1 ; the msg register.
set NUM = NUM - 1
go FNDCOL
SAVCOL: tst R8 EQ 1,IVRC ; (r8=1) ? iv entry
set R6 = msg ; Save col's in r6.
tst R5 le 0,IVRC ; Brute force check
tst R6 le 0,IVRC ; for positive entries.
GETMNU: msg 'cfEnter Menu Lower Left Corner' ; Get lower left
msg 'prReset to re-enter Rows & Columns'
GETLL: get P,SAVLL, K,CKINP, R,ERRTN
go GETLL
msg 'st'
go ERRTN
SAVLL: set I5 = XUR ; Save lower left
set I6 = YUR ; in (i5,i6).
msg 'cfEnter Menu Upper Right Corner' ; Get upper right
msg 'prReset to Redefine Lower Left Corner'
GETUR: get P,CKAREA, R,GETMNU
go GETUR
CKAREA: set I7 = XUR ; Save upper right
set I8 = YUR ; in (i7,i8)
set A0 = YUR - I6 ; Delta Y / no. of rows
set I11 = A0 / R5 ; is the hgth of a row.
tst I11 lt 1000,IVAREA ; (row < 1000 uor) ? iv.
set A0 = XUR - I5 ; Delta X / no. of cols
set I12 = A0 / R6 ; is the width of a col.
tst I12 ge 1000,RTPRMT ; (col < 1000 uor) ? iv.
; i11 = hgth of row
IVAREA: msg 'st* Illegal Menu Area *' ; i12 = wdth of col
go GETMNU
RTPRMT: msg 'cfEnter Receiving Task Name' ; Usually FB
msg 'prReset to Redefine Menu Area'
GETRT: get K,CKRT, R,GETMNU
go GETRT
CKRT: set ucasc = key ; Upcase input string
set N1 = 0
set R12 = 1
RTLOOP: tst R12 gt k0,RTDONE
tst ucbyt(R12) lt 97,RTPASS
tst ucbyt(R12) gt 122,RTPASS
set ucbyt(R12) = ucbyt(R12) & 223
RTPASS: set C1 = C1 + ucasc(R12)
set R12 = R12 + 1
go RTLOOP
RTDONE: set key = C1 ; Restore upcase in key.
tst key eq ' ',TOPBLK ; Branch on Name.
set key = key + '@012MM@012' ; Else append MM and
set key = key + R5 ; row,col.
set key = key + ','
set key = key + R6
cmd PText ; Optionally place the
key ; FB/MM/row/col node.
msg 'cfEnter Text Node Origin'
msg 'prReset to Skip Node Placement'
PLCNDE: get P,NDEPNT, R,TOPBLK
go PLCNDE
NDEPNT: pnt
tst RELERR ne 0,PLCNDE
TOPBLK: key 'NoEcho'
cmd nulcmd
key 'Set Dynamic Off' ; Turn dynamics off
key 'selv all' ; in all views.
cmd nulcmd
msg 'cfEnter Action Type (P,U,C,S,D,K,T,M,E,R)'
msg 'prReset to Exit'
GETTYP: get K,TSTUC, R,EXITUC ; Get a valid command type
go GETTYP
TSTUC: msg 'st'
set ucasc = key ; Put input into tcb usasc
tst ucbyt(1) lt 97, noup ; (97 <= a <= 122) ? upcase(a)
tst ucbyt(1) gt 122, noup
set ucbyt(1) = ucbyt(1) & 223
NOUP: set C0 = ucasc(1) + ',' ; Save Command prefix in C0
set C2 = C0 ; Copy to C2 for loop compares
; * Parse command type *
;Z: tst C0 ne 'Z,',MESG ; User defined
; set C3 = 'cfEnter Action String'
; set C2 = ''
; go IDBLK
MESG: tst C0 ne 'M,',APPL ; Get Message
set C3 = 'cfEnter Message'
go IDBLK
APPL: tst C0 ne 'A,',PRIM ; Get application
set C3 = 'cfEnter Application Number'
go IDBLK
PRIM: tst C0 ne 'P,',TSTUCM ; Primitive
set C3 = 'cfEnter Command Name'
go IDBLK
TSTUCM: tst C0 ne 'U,',RACELL ; User Command
set C3 = 'cfEnter User Command Index Number'
go IDBLK
RACELL: tst C0 ne 'R,',CKCELL ; Place Cell
set C3 = 'cfEnter Cell Name'
go IDBLK
CKCELL: tst C0 ne 'C,',CKSYMB ; Place Cell
set C3 = 'cfEnter Cell Name'
go IDBLK
CKSYMB: tst C0 ne 'S,',TSTTUT ; Place Symbol
set C3 = 'cfEnter Symbol Character'
go IDBLK
TSTTUT: tst C0 ne 'D,',TSTSTR ; Activate a Tutorial
set C3 = 'cfEnter Tutorial Name'
;set C2 = 'T,AT='
go IDBLK
TSTSTR: tst C0 eq 'K,',STRMSG ; Text Entry
tst C0 eq 'E,',STRMSG ; Text Entry
tst C0 ne 'T,',GOIVCM
STRMSG: set C3 = 'cfEnter Action String'
go IDBLK
; Invalid command type
GOIVCM: set n0 = n0 - 1 ; Strip "," from end of C0
set msg = 'st* Invalid Action Type <' + C0
set msg = msg + '> *'
msg msg
go GETTYP
IDBLK: cmd nulcmd
msg 'cfIdentify Command Block'
msg 'prEnter Action Type (P,U,C,S,D,K,T,M,E,R)'
GETBLK: get P,CKRNGE, K,TSTUC, R,TOPBLK ; Get block to process.
go GETBLK
CKRNGE: msg 'pr'
msg 'st' ; Check to see if point
tst XUR lt I5,IVPNT ; is above and to the
tst YUR ge I6,CKAGN ; right of our lower left
IVPNT: msg 'st* Outside Menu Area *'
go IDBLK
CKAGN: set I4 = I6
set R7 = R5 + 1 ; Put low y in i4 and
YLOOP: set R7 = R7 - 1 ; no. of rows in r7.
set I4 = I4 + I11 ; Add hgth of row (r11)
tst I4 le YUR,YLOOP ; until in the right blk
tst R7 le 0,IVPNT ; and subtr the hgth to
set I2 = I4 - I11 ; get the lower y value.
set I3 = I5
set R8 = 0 ; Put low x in i3 and
XLOOP: set R8 = R8 + 1 ; set r8 (n_rows) to 0.
set I3 = I3 + I12 ; Add width of row (r12)
tst I3 le XUR,XLOOP ; until in the right blk
tst R8 gt R6,IVPNT ; and subtr the width to
set I1 = I3 - I12 ; get the lower x value.
cmd pptlst ; Identify the found
pnt I1,I2 ; command block by
pnt I1,I4 ; placing a temporary
pnt I3,I4 ; line string around it.
pnt I3,I2
pnt I1,I2
set C4 = R7 + ',' ; concat "row,col,"
set C4 = C4 + R8 ; into c4
set C4 = C4 + ','
msg c3 ; Send approporiammte msg for
GETSTR: get K,B4LOOP, R,IDBLK ; command string input
go GETSTR
B4LOOP:
tst C0 eq 'Z,',GOTU ; If User Defined String
set ucasc = key ; Upcase input string
set N5 = 0
set R7 = 1
LOOP: tst R7 gt K0,CKNDXD
tst ucbyt(R7) lt 97,PASS
tst ucbyt(R7) gt 122,PASS
set ucbyt(R7) = ucbyt(R7) & 223
PASS: set C5 = C5 + ucasc(R7) ; save string in c5
set R7 = R7 + 1
go LOOP
GOTU: set C5=key
CKNDXD: tst C0 ne 'U,',NOTUCM ; If User Command
tst N5 lt 4,TSTNDX ;
NOTNDX: set C4 = C4 + 'T,UC=' ;
go PLCTXT ;
TSTNDX: set ucasc = C5 ; Ck c5 for proper form
set R12 = 1 ; to be used as an
NDLOOP: tst R12 gt N5,NDXDNE ; entry in the uc index.
tst ucbyt(R12) lt 48,NOTNDX ; If indexed uc then set
tst ucbyt(R12) gt 57,NOTNDX ; the cmd string to "U,"
set R12 = R12 + 1 ; else leave as terminated
go NDLOOP ; "UC=" cmd string.
NDXDNE: set C4 = C4 + 'U,' ;
go PLCTXT ;
NOTUCM: set C4 = C4 + C2 ; Concat command type to c4.
PLCTXT: set msg = C4 + C5 ; Concat cmd entry & type to msg
set CUREBL = DFSECT ; Save pointers.
set CUREBY = DFBYTE
set A8 = I4 + I2 ; Save the mid-y coordinate
set I13 = A8 / 2 ; of the block in I13
key 'Place Text Fitted' ; and place the text
key msg
pnt I1,I13
pnt I3,I13
tst RELERR ne 0,EXITUC
key 'NoEcho'
cmd nulcmd
set RANGEE(1) = I1 ; Adjust the range to
set RANGEE(2) = I2 ; match that of the box
set RANGEE(4) = I3
set RANGEE(5) = I4
wrt CUREBL,CUREBY ; Rewrite the element
go IDBLK ; Get additional blocks
; of this type
; * Cleanup and exit *
EXITUC: ; Restore saved parameters
set outflg = r2 ; restore outflg
set ACTANG = A0 ; Restore active angle
set NODSPA = I0 ; Restore line spacing
set CHHGT = I9 ; Restore text height
set CHWID = I10 ; Restore text width
set ACTLEV = R1 ; Restore active level
set CAFONT = R4 ; Restore active font
set IDSYMB = R9 ; Restore weight and color
set TXJUST = R10 ; Restore text justification
set TNJUST = R11 ; Restore node justification
key 'Set Dynamic On' ; Turn dynamics on
key 'selv all' ; in all views.
cmd nulcmd ; Clear any active command
key 'echo' ; as well as all prompt
msg 'cf' ; fields in order to
msg 'ms' ; leave the user command
msg 'pr' ; in a known state and
msg 'er' ; an orderly fashion.
msg 'st* MicroStation Matrix Menu UC Exited *'
End