gev.sl 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316
  1. % {DSK}GEV.PSL;3 6-APR-83 16:26:08
  2. (FLUID '(GLNATOM RESULT Y))
  3. (GLOBAL '(GEVACTIVEFLG GEVEDITCHAIN GEVEDITFLG GEVLASTITEMNUMBER GEVMENUWINDOW
  4. GEVMENUWINDOWHEIGHT GEVMOUSEAREA GEVSHORTCHARS
  5. GEVWINDOW GEVWINDOWY))
  6. % GEV Structure Inspector
  7. % The following files are required: VECTOR GEVAUX WINDOW
  8. (GLISPGLOBALS
  9. (GEVACTIVEFLG BOOLEAN)
  10. (GEVEDITCHAIN EDITCHAIN)
  11. (GEVEDITFLG BOOLEAN)
  12. (GEVLASTITEMNUMBER INTEGER)
  13. (GEVMENUWINDOW WINDOW)
  14. (GEVMENUWINDOWHEIGHT INTEGER)
  15. (GEVMOUSEAREA MOUSESTATE)
  16. (GEVSHORTCHARS INTEGER)
  17. (GEVWINDOW WINDOW)
  18. (GEVWINDOWY INTEGER)
  19. )
  20. (GLISPCONSTANTS
  21. (GEVMOUSEBUTTON 4 INTEGER)
  22. (GEVNAMECHARS 11 INTEGER)
  23. (GEVVALUECHARS 27 INTEGER)
  24. (GEVNAMEPOS (GEVNUMBERPOS + (IF GEVNUMBERCHARS > 0 THEN (GEVNUMBERCHARS + 1)
  25. *WINDOWCHARWIDTH ELSE 0)) INTEGER)
  26. (GEVTILDEPOS (GEVNAMEPOS + (GEVNAMECHARS+1)
  27. *WINDOWCHARWIDTH) INTEGER)
  28. (GEVVALUEPOS (GEVTILDEPOS + 2*WINDOWCHARWIDTH) INTEGER)
  29. )
  30. (GLISPOBJECTS
  31. (EDITCHAIN (LISTOF EDITFRAME)
  32. PROP ((TOPFRAME ((CAR self)))
  33. (TOPITEM ((CAR TOPFRAME:PREVS)))))
  34. (EDITFRAME (LIST (PREVS (LISTOF GSEITEM))
  35. (SUBITEMS (LISTOF GSEITEM))
  36. (PROPS (LISTOF GSEITEM))))
  37. (GSEITEM (LIST (NAME ATOM)
  38. (VALUE ANYTHING)
  39. (TYPE ANYTHING)
  40. (SHORTVALUE ATOM)
  41. (NODETYPE ATOM)
  42. (SUBVALUES (LISTOF GSEITEM))
  43. (NAMEPOS VECTOR)
  44. (VALUEPOS VECTOR))
  45. PROP ((NAMEAREA ((VIRTUAL REGION WITH START = NAMEPOS WIDTH =
  46. WINDOWCHARWIDTH* (NCHARS NAME)
  47. HEIGHT = WINDOWLINEYSPACING)))
  48. (VALUEAREA ((VIRTUAL REGION WITH START = VALUEPOS WIDTH =
  49. WINDOWCHARWIDTH* (NCHARS NAME)
  50. HEIGHT = WINDOWLINEYSPACING)))))
  51. (MOUSESTATE (LIST (AREA REGION)
  52. (ITEM GSEITEM)
  53. (FLAG BOOLEAN)
  54. (GROUP INTEGER)))
  55. )
  56. % GSN 9-FEB-83 11:40
  57. % GLISP Edit Value function. Edit VAL according to structure
  58. % description STR.
  59. (DF GEV (ARGS)
  60. (GEVA (CAR ARGS)
  61. (EVAL (CAR ARGS))
  62. (AND (CDR ARGS)
  63. (COND ((OR (NOT (ATOM (CADR ARGS)))
  64. (NOT (UNBOUNDP (CADR ARGS))))
  65. (EVAL (CADR ARGS)))
  66. (T (CADR ARGS))))))
  67. % edited: 15-MAR-83 10:40
  68. % GLISP Edit Value function. Edit VAL according to structure
  69. % description STR.
  70. (DG GEVA (VAR VAL STR)
  71. (PROG (GLNATOM TMP HEADER)
  72. (GEVENTER)
  73. (COND ((OR (NOT (NOT (UNBOUNDP 'GEVWINDOW)))
  74. (NULL GEVWINDOW))
  75. (GEVINITEDITWINDOW)))
  76. (IF GEVMENUWINDOW THEN (SEND GEVMENUWINDOW OPEN))
  77. (SEND GEVWINDOW OPEN)
  78. (GEVACTIVEFLG_T)
  79. (GEVEDITFLG_NIL)
  80. (GLNATOM_0)
  81. (GEVSHORTCHARS_GEVVALUECHARS)
  82. (IF VAR IS A LIST AND (CAR VAR)
  83. ='QUOTE THEN VAR_ (CONCAT "'" (GEVSTRINGIFY (CADR VAR))))
  84. (IF ~STR THEN (IF VAL IS ATOMIC AND (GET VAL 'GLSTRUCTURE)
  85. THEN STR_'GLTYPE ELSEIF (GEVGLISPP)
  86. THEN STR_ (GLCLASS VAL)))
  87. (HEADER_ (A GSEITEM WITH NAME = VAR VALUE = VAL TYPE = STR))
  88. (GEVEDITCHAIN_ (LIST (LIST (LIST HEADER)
  89. NIL NIL)))
  90. (GEVREFILLWINDOW)
  91. (GEVMOUSELOOP)
  92. (GEVEXIT)))
  93. % GSN 2-MAR-83 14:06
  94. (DG GEVCOMMANDFN (COMMANDWORD:ATOM)
  95. (PROG (PL SUBPL PROPNAME VAL PROPNAMES TOPITEM)
  96. (CASE COMMANDWORD OF (EDIT (GEVEDIT))
  97. (QUIT (IF GEVMOUSEAREA THEN (SEND GEVWINDOW INVERTAREA
  98. GEVMOUSEAREA:AREA)
  99. (GEVMOUSEAREA_NIL)
  100. ELSE
  101. (GEVQUIT)))
  102. (POP (GEVPOP T 1))
  103. (PROGRAM (GEVPROGRAM))
  104. ((PROP ADJ ISA MSG)
  105. (TOPITEM_GEVEDITCHAIN:TOPITEM)
  106. (GEVCOMMANDPROP TOPITEM COMMANDWORD NIL))
  107. ELSE
  108. (ERROR 0 NIL))))
  109. % GSN 25-MAR-83 10:14
  110. (DG GEVCOMMANDPROP (ITEM:GSEITEM COMMANDWORD:ATOM PROPNAME:ATOM)
  111. (PROG (VAL PROPNAMES FLG)
  112. (IF PROPNAME THEN FLG_T)
  113. (IF ITEM:TYPE IS ATOMIC THEN (PROPNAMES_ (GEVCOMMANDPROPNAMES ITEM:TYPE
  114. COMMANDWORD
  115. GEVEDITCHAIN:TOPFRAME)))
  116. (IF ITEM:TYPE IS ATOMIC OR COMMANDWORD='PROP THEN
  117. (IF COMMANDWORD='PROP THEN (IF (CDR PROPNAMES)
  118. THEN PROPNAMES+_'All)
  119. PROPNAMES+_'self)
  120. (IF ~PROPNAMES (RETURN NIL))
  121. (IF ~PROPNAME (PROPNAME _ (SEND (A MENU WITH ITEMS = PROPNAMES)
  122. SELECT)))
  123. (IF ~PROPNAME (RETURN NIL)
  124. ELSEIF PROPNAME='self THEN (PRIN1 PROPNAME)
  125. (PRINC " = ")
  126. (PRINT ITEM:VALUE)
  127. ELSEIF COMMANDWORD='PROP AND PROPNAME='All THEN
  128. (FOR X IN (OR (CDDR PROPNAMES)
  129. (CDR PROPNAMES))
  130. DO
  131. (GEVDOPROP ITEM X COMMANDWORD FLG))
  132. ELSE
  133. (GEVDOPROP ITEM PROPNAME COMMANDWORD FLG))
  134. (IF COMMANDWORD='MSG THEN (GEVREFILLWINDOW)
  135. (GEVEDITFLG_T)))))
  136. % edited: 22-DEC-82 11:09
  137. % Get all property names of properties of type PROPTYPE for OBJ.
  138. % Properties are filtered to remove system properties and those
  139. % which are already displayed.
  140. (DG GEVCOMMANDPROPNAMES (OBJ:GLTYPE PROPTYPE:ATOM TOPFRAME:EDITFRAME)
  141. (PROG (RESULT TYPE)
  142. (RESULT _ (FOR P IN (CASE PROPTYPE OF (PROP OBJ:PROPS)
  143. (ADJ OBJ:ADJS)
  144. (ISA OBJ:ISAS)
  145. (MSG OBJ:MSGS))
  146. WHEN ~ (PROPTYPE~='MSG AND
  147. (THE PROP OF TOPFRAME WITH NAME =
  148. (CAR P)))
  149. AND ~ (PROPTYPE='PROP AND (MEMQ (CAR P)
  150. '(SHORTVALUE DISPLAYPROPS)
  151. ))
  152. AND ~ (PROPTYPE='MSG
  153. AND
  154. (CADR P)
  155. IS ATOMIC AND (~ (GETDDD (CADR P))
  156. OR
  157. (LENGTH (CADR (GETDDD (CADR P))))
  158. >1))
  159. COLLECT P:NAME))
  160. (FOR S IN OBJ:SUPERS DO (RESULT _ (NCONC RESULT (GEVCOMMANDPROPNAMES
  161. S PROPTYPE TOPFRAME))))
  162. (RETURN RESULT)))
  163. % GSN 2-MAR-83 10:42
  164. % Compile a property whose name is PROPNAME and whose property type
  165. % (ADJ, ISA, PROP, MSG) is PROPTYPE for the object type STR.
  166. (DG GEVCOMPPROP (STR:GLTYPE PROPNAME:ATOM PROPTYPE:ATOM)
  167. (PROG (PROPENT)
  168. (IF ~ (MEMQ PROPTYPE '(ADJ ISA PROP MSG))
  169. (RETURN 'GEVERROR))
  170. % If the property is implemented by a named function, return the
  171. % function name.
  172. (IF (PROPENT_ (GEVGETPROP STR PROPNAME PROPTYPE))
  173. AND
  174. (CADR PROPENT)
  175. IS ATOMIC THEN (RETURN (CADR PROPENT)))
  176. % Compile code for this property and save it. First be sure the GLISP
  177. % compiler is loaded.
  178. (RETURN (COND ((GEVGLISPP)
  179. (GLCOMPPROP STR PROPNAME PROPTYPE)
  180. OR
  181. 'GEVERROR)
  182. (T (ERROR 0 (LIST
  183. "GLISP compiler must be loaded for PROPs which"
  184. "are not specified with function name equivalents."
  185. STR PROPTYPE PROPNAME)))))))
  186. % edited: 4-NOV-82 16:08
  187. % Get a flattened list of names and types from a given structure
  188. % description.
  189. (DG GEVDATANAMES (OBJ:GLTYPE FILTER:ATOM)
  190. (PROG (RESULT)
  191. (GEVDATANAMESB OBJ:STRDES FILTER)
  192. (RETURN (REVERSIP RESULT))))
  193. % GSN 4-FEB-83 17:39
  194. % Get a flattened list of names and types from a given structure
  195. % description.
  196. (DG GEVDATANAMESB (STR:ANYTHING FILTER:ATOM)
  197. (GLOBAL RESULT)(PROG (TMP)
  198. (IF STR IS ATOMIC THEN (RETURN NIL)
  199. ELSE
  200. (CASE (CAR STR)
  201. OF
  202. (CONS (GEVDATANAMESB (CADR STR)
  203. FILTER)
  204. (GEVDATANAMESB (CADDR STR)
  205. FILTER))
  206. ((ALIST PROPLIST LIST)
  207. (FOR X IN (CDR STR)
  208. DO
  209. (GEVDATANAMESB X FILTER)))
  210. (RECORD (FOR X IN (CDDR STR)
  211. DO
  212. (GEVDATANAMESB X FILTER)))
  213. (ATOM (GEVDATANAMESB (CADR STR)
  214. FILTER)
  215. (GEVDATANAMESB (CADDR STR)
  216. FILTER))
  217. (BINDING (GEVDATANAMESB (CADR STR)
  218. FILTER))
  219. (LISTOF (RETURN NIL))
  220. ELSE
  221. (IF (GEVFILTER (CADR STR)
  222. FILTER)
  223. THEN
  224. (RESULT +_ (LIST (CAR STR)
  225. (CADR STR))))
  226. (GEVDATANAMESB (CADR STR)
  227. FILTER)))))
  228. % GSN 25-MAR-83 09:48
  229. % Display a newly added property in the window.
  230. (DG GEVDISPLAYNEWPROP NIL
  231. (PROG (Y NEWONE:GSEITEM)
  232. (Y_GEVWINDOWY)
  233. (NEWONE_ (CAR (LASTPAIR GEVEDITCHAIN:TOPFRAME:PROPS)))
  234. (GEVPPS NEWONE 0 GEVWINDOW)
  235. (GEVWINDOWY_Y)))
  236. % GSN 4-FEB-83 16:58
  237. % Add the property PROPNAME of type COMMANDWORD to the display for
  238. % ITEM.
  239. (DG GEVDOPROP (ITEM:GSEITEM PROPNAME:ATOM COMMANDWORD:ATOM FLG:BOOLEAN)
  240. (PROG (VAL)
  241. (VAL_ (GEVEXPROP ITEM:VALUE ITEM:TYPE PROPNAME COMMANDWORD NIL))
  242. (GEVEDITCHAIN:TOPFRAME:PROPS_+ (A GSEITEM WITH NAME = PROPNAME TYPE =
  243. (GEVPROPTYPE ITEM:TYPE PROPNAME
  244. COMMANDWORD)
  245. VALUE = VAL NODETYPE = COMMANDWORD))
  246. (IF ~FLG THEN (GEVDISPLAYNEWPROP))))
  247. % GSN 25-MAR-83 09:48
  248. % Edit the currently displayed item.
  249. (DG GEVEDIT NIL
  250. (PROG (CHANGEDFLG GEVTOPITEM)
  251. (GEVTOPITEM_GEVEDITCHAIN:TOPITEM)
  252. (IF GEVTOPITEM:TYPE IS ATOMIC AND (GEVEXPROP GEVTOPITEM:VALUE
  253. GEVTOPITEM:TYPE
  254. 'EDIT
  255. 'MSG
  256. NIL)
  257. ~='GEVERROR THEN CHANGEDFLG_T ELSEIF GEVTOPITEM:VALUE IS A LIST THEN
  258. (EDITV GEVTOPITEM:VALUE)
  259. (CHANGEDFLG_T)
  260. ELSE
  261. (RETURN NIL))
  262. (IF CHANGEDFLG THEN (SEND GEVWINDOW OPEN)
  263. (GEVREFILLWINDOW))
  264. (GEVEDITFLG_CHANGEDFLG)))
  265. % GSN 25-MAR-83 09:49
  266. % Execute a property whose name is PROPNAME and whose property type
  267. % (ADJ, ISA, PROP, MSG) is PROPTYPE on the object OBJ whose type is
  268. % STR.
  269. (DG GEVEXPROP (OBJ STR PROPNAME:ATOM PROPTYPE:ATOM ARGS)
  270. (PROG (FN)
  271. (IF ~ (MEMQ PROPTYPE '(ADJ ISA PROP MSG))
  272. OR
  273. (ARGS AND PROPTYPE~='MSG)
  274. (RETURN 'GEVERROR))
  275. (IF (FN_ (GEVCOMPPROP STR PROPNAME PROPTYPE))
  276. ='GEVERROR THEN (RETURN FN)
  277. ELSE
  278. (RETURN (GEVAPPLY FN (CONS OBJ ARGS))))))
  279. % edited: 15-MAR-83 12:40
  280. % Fill the GEV editor window with the item which is at the top of
  281. % GEVEDITCHAIN.
  282. (DG GEVFILLWINDOW NIL
  283. (PROG (Y TOP)
  284. (SEND GEVWINDOW CLEAR)
  285. % Compute an initial Y value for printing titles in the window.
  286. (Y_GEVWINDOW:HEIGHT - WINDOWLINEYSPACING)
  287. % Print the titles from the edit chain first.
  288. (GEVLASTITEMNUMBER _ 0)
  289. (TOP_GEVEDITCHAIN:TOPFRAME)
  290. (FOR X IN (REVERSE TOP:PREVS)
  291. DO
  292. (GEVPPS X 0 GEVWINDOW))
  293. (GEVHORIZLINE GEVWINDOW)
  294. (FOR X IN TOP:SUBITEMS DO (GEVPPS X 0 GEVWINDOW))
  295. (GEVHORIZLINE GEVWINDOW)
  296. (FOR X IN TOP:PROPS DO (GEVPPS X 0 GEVWINDOW))
  297. (GEVWINDOWY_Y)))
  298. % GSN 21-JAN-83 10:24
  299. % Filter types according to a specified FILTER.
  300. (DG GEVFILTER (TYPE FILTER)
  301. (TYPE_ (GEVXTRTYPE TYPE))(CASE FILTER OF
  302. (NUMBER ~ (MEMQ TYPE
  303. '(ATOM STRING BOOLEAN ANYTHING))
  304. AND ~ ((PAIRP TYPE)
  305. AND
  306. (CAR TYPE)
  307. ='LISTOF))
  308. (LIST (PAIRP TYPE)
  309. AND
  310. (CAR TYPE)
  311. ='LISTOF)
  312. ELSE T))
  313. % edited: 14-OCT-82 11:32
  314. (DG GEVFINDITEMPOS (POS:VECTOR ITEM:GSEITEM N:INTEGER)
  315. (RESULT MOUSESTATE)
  316. % Test whether ITEM contains the mouse position POS. The result is NIL
  317. % if not found, else a list of the sub-item and a flag which is NIL
  318. % if the NAME part is identified, T if the VALUE part is identified.
  319. (OR (GEVPOSTEST POS ITEM:NAMEPOS ITEM:NAME ITEM NIL N)
  320. (GEVPOSTEST POS ITEM:VALUEPOS ITEM:SHORTVALUE ITEM T N)
  321. ((ITEM:NODETYPE='STRUCTURE OR ITEM:NODETYPE='SUBTREE OR
  322. ITEM:NODETYPE='LISTOF)
  323. AND
  324. (GEVFINDLISTPOS POS ITEM:SUBVALUES N))))
  325. % edited: 13-OCT-82 12:03
  326. (DG GEVFINDLISTPOS (POS:VECTOR ITEMS: (LISTOF GSEITEM)
  327. N)
  328. (RESULT MOUSESTATE)
  329. % Find some ITEM corresponding to the mouse position POS.
  330. (IF ITEMS THEN (GEVFINDITEMPOS POS (CAR ITEMS)
  331. N)
  332. OR
  333. (GEVFINDLISTPOS POS (CDR ITEMS)
  334. N)))
  335. % edited: 13-OCT-82 12:06
  336. (DG GEVFINDPOS (POS:VECTOR FRAME:EDITFRAME)
  337. (RESULT MOUSESTATE)
  338. % Find the sub-item of FRAME corresponding to the mouse position POS.
  339. % The result is NIL if not found, else a list of the sub-item and a
  340. % flag which is NIL if the NAME part is identified, T if the VALUE
  341. % part is identified.
  342. (PROG (TMP N ITEMS: (LISTOF GSEITEM))
  343. (N_0)
  344. (WHILE FRAME AND ~TMP DO (N_+1)
  345. ITEMS-_FRAME
  346. (TMP_ (GEVFINDLISTPOS POS ITEMS N)))
  347. (RETURN TMP)))
  348. % edited: 22-DEC-82 14:53
  349. % Get all names of properties and stored data from a GLISP object
  350. % type.
  351. (DG GEVGETNAMES (OBJ:GLTYPE FILTER:ATOM)
  352. (PROG (DATANAMES PROPNAMES)
  353. (SETQ DATANAMES (GEVDATANAMES OBJ FILTER))
  354. (SETQ PROPNAMES (GEVPROPNAMES OBJ 'PROP
  355. FILTER))
  356. (RETURN (NCONC DATANAMES PROPNAMES))))
  357. % GSN 4-FEB-83 16:59
  358. % Retrieve a GLISP property whose name is PROPNAME and whose property
  359. % type (ADJ, ISA, PROP, MSG) is PROPTYPE for the object type STR.
  360. (DG GEVGETPROP (STR PROPNAME:ATOM PROPTYPE:ATOM)
  361. (PROG (PL SUBPL PROPENT)
  362. (IF ~ (MEMQ PROPTYPE '(ADJ ISA PROP MSG))
  363. (ERROR 0 NIL))
  364. (RETURN (AND (PL_ (GET STR 'GLSTRUCTURE))
  365. (SUBPL_ (LISTGET (CDR PL)
  366. PROPTYPE))
  367. (PROPENT_ (ASSOC PROPNAME SUBPL))))))
  368. % edited: 11-NOV-82 15:53
  369. (DE GEVGLISPP NIL
  370. (NOT (UNBOUNDP 'GLBASICTYPES)))
  371. % edited: 6-APR-83 15:54
  372. (DG GEVHORIZLINE (W:WINDOW)
  373. (GLOBAL Y:INTEGER)
  374. % Draw a horizontal line across window W at Y and decrease Y.
  375. (SEND W DRAWLINE (A VECTOR WITH X = W:LEFTMARGIN Y = Y+WINDOWLINEYSPACING / 2)
  376. (A VECTOR WITH X = W:RIGHTMARGIN Y = Y+WINDOWLINEYSPACING / 2))(
  377. Y_-WINDOWLINEYSPACING))
  378. % edited: 11-MAR-83 16:03
  379. (DE GEVINIT NIL
  380. (SETQ GLNATOM 0)(COND ((NOT (NOT (UNBOUNDP 'GLLISPDIALECT)))
  381. (SETQ GLLISPDIALECT 'INTERLISP)))(SETQ GEVWINDOW NIL))
  382. % GSN 25-MAR-83 10:14
  383. % Respond to an event which selects an item. GROUP gives the group in
  384. % which the item occurs. 1 = edit path. FLAG is T if the type of the
  385. % item is selected, NIL if the value is selected.
  386. (DG GEVITEMEVENTFN (ITEM:GSEITEM GROUP:INTEGER FLAG:BOOLEAN)
  387. (PROG (TMP TOP N)
  388. (IF FLAG THEN (IF GROUP=1 THEN (TMP_GEVEDITCHAIN:TOPFRAME:PREVS)
  389. (N_0)
  390. (WHILE TMP AND (TOP-_TMP)
  391. <>ITEM DO N_+1)
  392. (GEVPOP NIL N)
  393. ELSE
  394. (GEVPUSH ITEM))
  395. ELSE
  396. (PRIN1 ITEM:NAME)
  397. (PRINC " is ")
  398. (PRIN1 ITEM:TYPE)
  399. (TERPRI))))
  400. % GSN 2-MAR-83 16:14
  401. % Bound the length of VAL to NCHARS.
  402. (DG GEVLENGTHBOUND (VAL NCHARS)
  403. (COND ((GREATERP (FlatSize2 VAL)
  404. NCHARS)
  405. ((SUBSTRING VAL 1 (SUB1 NCHARS))
  406. + "-"))
  407. (T VAL)))
  408. % edited: 6-APR-83 16:01
  409. % Make a function to perform OPERATION on set SETNAME from INPUTTYPE
  410. % following PATH to get to the data.
  411. (DG GEVMAKENEWFN (OPERATION:ATOM INPUTTYPE:ATOM SET: (LIST (NAME ATOM)
  412. (TYPE GLTYPE))
  413. PATH:
  414. (LISTOF (LIST (NAME ATOM)
  415. (TYPE GLTYPE))))
  416. (PROG
  417. (LASTPATH VIEWSPEC)
  418. (SETQ LASTPATH (CAR (LASTPAIR PATH)))
  419. (RETURN
  420. (LIST
  421. (LIST 'GLAMBDA
  422. (LIST (MKATOM (CONCAT "GEVNEWFNTOP:" INPUTTYPE:PNAME)))
  423. (LIST 'PROG
  424. (CONS 'GEVNEWFNVALUE
  425. (CASE OPERATION OF (COLLECT '(GEVNEWFNRESULT))
  426. ((MAXIMUM MINIMUM)
  427. '(GEVNEWFNTESTVAL GEVNEWFNINSTANCE))
  428. (TOTAL '((GEVNEWFNSUM 0)))
  429. (AVERAGE '((GEVNEWFNSUM 0.0)
  430. (GEVNEWFNCOUNT 0)))
  431. ELSE
  432. (ERROR 0 NIL)))
  433. (NCONC (LIST 'FOR
  434. 'GEVNEWFNLOOPVAR
  435. 'IN
  436. (MKATOM (CONCAT "GEVNEWFNTOP:" SET:NAME:PNAME))
  437. 'DO
  438. (LIST 'GEVNEWFNVALUE
  439. '_
  440. (PROGN (VIEWSPEC _ (LIST 'GEVNEWFNLOOPVAR)
  441. )
  442. (FOR X IN PATH DO
  443. (VIEWSPEC +_ 'OF)
  444. (VIEWSPEC +_ X:NAME)
  445. (VIEWSPEC +_ 'THE))
  446. VIEWSPEC)))
  447. (COPY (CASE OPERATION OF
  448. (COLLECT '((GEVNEWFNRESULT +_
  449. GEVNEWFNVALUE)))
  450. (MAXIMUM '((IF ~ GEVNEWFNINSTANCE
  451. OR GEVNEWFNVALUE >
  452. GEVNEWFNTESTVAL
  453. THEN (GEVNEWFNTESTVAL
  454. _ GEVNEWFNVALUE)
  455. (GEVNEWFNINSTANCE
  456. _ GEVNEWFNLOOPVAR)))
  457. )
  458. (MINIMUM '((IF ~ GEVNEWFNINSTANCE
  459. OR GEVNEWFNVALUE
  460. < GEVNEWFNTESTVAL
  461. THEN (GEVNEWFNTESTVAL
  462. _ GEVNEWFNVALUE)
  463. (GEVNEWFNINSTANCE
  464. _ GEVNEWFNLOOPVAR)))
  465. )
  466. (AVERAGE '((GEVNEWFNSUM _+
  467. GEVNEWFNVALUE)
  468. (GEVNEWFNCOUNT _+
  469. 1)))
  470. (TOTAL '((GEVNEWFNSUM _+
  471. GEVNEWFNVALUE))))))
  472. (LIST 'RETURN
  473. (CASE OPERATION OF (COLLECT '(DREVERSE GEVNEWFNRESULT))
  474. ((MAXIMUM MINIMUM)
  475. '(LIST GEVNEWFNTESTVAL GEVNEWFNINSTANCE))
  476. (AVERAGE '(QUOTIENT GEVNEWFNSUM (FLOAT
  477. GEVNEWFNCOUNT)))
  478. (TOTAL 'GEVNEWFNSUM)))))
  479. (CASE OPERATION OF (COLLECT (LIST 'LISTOF
  480. (CADR LASTPATH)))
  481. ((MAXIMUM MINIMUM)
  482. (LIST 'LIST
  483. (COPY LASTPATH)
  484. (LIST 'WINNER
  485. (CADR SET:TYPE))))
  486. (AVERAGE 'REAL)
  487. (TOTAL (CADR LASTPATH)))))))
  488. % edited: 8-OCT-82 10:43
  489. (DG GEVMATCH (STR VAL FLG)
  490. (RESULT (LISTOF GSEITEM))
  491. % Match a structure description, STR, and a value VAL which matches
  492. % that description, to form a structure editor tree structure.
  493. (PROG (RESULT)
  494. (GEVMATCHB STR VAL NIL FLG)
  495. (RETURN (REVERSIP RESULT))))
  496. % edited: 8-OCT-82 10:01
  497. % Make a single item which matches structure STR and value VAL.
  498. (DG GEVMATCHA (STR VAL FLG)
  499. (PROG (RES)
  500. (RES_ (GEVMATCH STR VAL FLG))
  501. (IF ~ (CDR RES)
  502. THEN
  503. (RETURN (CAR RES))
  504. ELSE
  505. (RETURN (A GSEITEM WITH VALUE = VAL TYPE = STR SUBVALUES = RES
  506. NODETYPE = 'SUBTREE)))))
  507. % edited: 7-OCT-82 16:38
  508. % Match an ATOM structure to a given value.
  509. (DG GEVMATCHATOM (STR VAL NAME)
  510. (PROG (L STRB TMP)
  511. (IF VAL IS NOT ATOMIC OR VAL IS NULL THEN (RETURN NIL))
  512. (STRB_ (CADR STR))
  513. (IF (CAR STRB)
  514. ~='PROPLIST THEN (RETURN NIL))
  515. (L_ (CDR STRB))
  516. (FOR X IN L DO (IF TMP_ (GET VAL (CAR X))
  517. THEN
  518. (GEVMATCHB X TMP NIL NIL)))))
  519. % edited: 7-OCT-82 16:57
  520. % Match an ALIST structure to a given value.
  521. (DG GEVMATCHALIST (STR VAL NAME)
  522. (PROG (L TMP)
  523. (L_ (CDR STR))
  524. (FOR X IN L DO (IF TMP_ (ASSOC (CAR X)
  525. VAL)
  526. THEN
  527. (GEVMATCHB X (CDR TMP)
  528. NIL NIL)))))
  529. % edited: 22-DEC-82 15:26
  530. % Match a structure description, STR, and a value VAL which matches
  531. % that description, to form a structure editor tree structure. If
  532. % FLG is set, the match will descend inside an atomic type name.
  533. % Results are added to the free variable RESULT.
  534. (DG GEVMATCHB (STR: (LISTOF ANYTHING)
  535. VAL NAME:ATOM FLG:BOOLEAN)
  536. (GLOBAL RESULT)(PROG (X Y STRB XSTR TOP TMP)
  537. (XSTR_ (GEVXTRTYPE STR))
  538. (IF STR IS ATOMIC THEN
  539. (IF FLG AND (STRB _ (CAR (GET STR 'GLSTRUCTURE)))
  540. THEN
  541. (RESULT +_
  542. (A GSEITEM WITH NAME = NAME VALUE = VAL
  543. SUBVALUES = (GEVMATCH STRB VAL NIL)
  544. TYPE = STR NODETYPE = 'STRUCTURE))
  545. ELSE
  546. (RESULT +_
  547. (A GSEITEM WITH NAME = NAME VALUE = VAL
  548. TYPE = STR)))
  549. (RETURN NIL)
  550. ELSE
  551. (CASE (CAR STR)
  552. OF
  553. (CONS (GEVMATCHB (CADR STR)
  554. (CAR VAL)
  555. NIL NIL)
  556. (GEVMATCHB (CADDR STR)
  557. (CDR VAL)
  558. NIL NIL))
  559. (LIST (FOR X IN (CDR STR)
  560. DO
  561. (IF VAL (GEVMATCHB X (CAR VAL)
  562. NIL NIL)
  563. (VAL_ (CDR VAL)))))
  564. (ATOM (GEVMATCHATOM STR VAL NAME))
  565. (ALIST (GEVMATCHALIST STR VAL NAME))
  566. (PROPLIST (GEVMATCHPROPLIST STR VAL NAME))
  567. (LISTOF (GEVMATCHLISTOF STR VAL NAME))
  568. (RECORD (GEVMATCHRECORD STR VAL NAME))
  569. ((OBJECT ATOMOBJECT LISTOBJECT)
  570. (GEVMATCHOBJECT STR VAL NAME))
  571. ELSE
  572. (IF NAME THEN (TMP _ (GEVMATCH STR VAL NIL))
  573. (TOP_ (CAR TMP))
  574. (RESULT +_
  575. (IF ~ (CDR TMP)
  576. AND ~TOP:NAME THEN (
  577. TOP:NAME_NAME)
  578. TOP ELSE
  579. (A GSEITEM WITH NAME = NAME
  580. VALUE = VAL SUBVALUES = TMP
  581. TYPE = XSTR NODETYPE =
  582. 'SUBTREE)))
  583. ELSEIF
  584. (STRB _ (GEVXTRTYPE (CADR STR)))
  585. IS ATOMIC THEN (GEVMATCHB STRB VAL
  586. (CAR STR)
  587. NIL)
  588. ELSEIF
  589. (TMP_ (GEVMATCH (CADR STR)
  590. VAL NIL))
  591. THEN
  592. (TOP_ (CAR TMP))
  593. (RESULT +_
  594. (IF ~ (CDR TMP)
  595. AND ~TOP:NAME THEN
  596. (TOP:NAME_ (CAR STR))
  597. TOP ELSE
  598. (A GSEITEM WITH NAME =
  599. (CAR STR)
  600. VALUE = VAL SUBVALUES = TMP
  601. TYPE = (CADR STR)
  602. NODETYPE = 'SUBTREE)))
  603. ELSE
  604. (PRINT "GEVMATCHB Failed"))))))
  605. % edited: 8-OCT-82 10:15
  606. % Match a LISTOF structure.
  607. (DG GEVMATCHLISTOF (STR VAL NAME)
  608. (GLOBAL RESULT)(RESULT+_ (A GSEITEM WITH NAME = NAME VALUE = VAL TYPE = STR)))
  609. % edited: 22-DEC-82 10:04
  610. % Match the OBJECT structures.
  611. (DG GEVMATCHOBJECT (STR VAL NAME)
  612. (GLOBAL RESULT)(PROG (OBJECTTYPE TMP)
  613. (SETQ OBJECTTYPE (CAR STR))
  614. (RESULT _+ (A GSEITEM WITH NAME = 'CLASS
  615. VALUE = (CASE OBJECTTYPE OF ((OBJECT
  616. LISTOBJECT)
  617. (TMP-_VAL))
  618. (ATOMOBJECT
  619. (GET VAL 'CLASS)))
  620. TYPE = 'GLTYPE))
  621. (FOR X IN (CDR STR)
  622. DO
  623. (CASE OBJECTTYPE OF ((OBJECT LISTOBJECT)
  624. (IF VAL (GEVMATCHB X (TMP-_VAL)
  625. NIL NIL)))
  626. (ATOMOBJECT (IF TMP_ (GET VAL (CAR X))
  627. THEN
  628. (GEVMATCHB X TMP NIL NIL)))))))
  629. % edited: 24-NOV-82 16:31
  630. % Match an PROPLIST structure to a given value.
  631. (DG GEVMATCHPROPLIST (STR VAL NAME)
  632. (PROG (L TMP)
  633. (L_ (CDR STR))
  634. (FOR X IN L DO (IF TMP_ (LISTGET VAL (CAR X))
  635. THEN
  636. (GEVMATCHB X TMP NIL NIL)))))
  637. % edited: 11-MAR-83 16:31
  638. % Match a RECORD structure.
  639. (DG GEVMATCHRECORD (STR VAL NAME)
  640. (PROG (STRNAME FIELDS N)
  641. (IF (CADR STR)
  642. IS ATOMIC THEN STRNAME_ (CADR STR)
  643. FIELDS_
  644. (CDDR STR)
  645. ELSE FIELDS_ (CDR STR))
  646. (N_0)
  647. (FOR X IN FIELDS DO (N_+1)
  648. (GEVMATCHB X (GetV VAL N)
  649. (CAR X)
  650. NIL))))
  651. % GSN 2-MAR-83 17:33
  652. % Pop up from the current item to the previous one. If FLG is set,
  653. % popping continues through extended LISTOF elements.
  654. (DG GEVPOP (FLG:BOOLEAN N:INTEGER)
  655. (PROG (TMP TOP:GSEITEM TMPITEM)
  656. (IF N<1 (RETURN NIL))
  657. LP
  658. (TMP-_GEVEDITCHAIN)
  659. (IF ~GEVEDITCHAIN THEN (RETURN (GEVQUIT)))
  660. (TOP_ (CAAAR GEVEDITCHAIN))
  661. % Test for repeated LISTOF elements.
  662. (TMPITEM_ (CAR TMP:PREVS))
  663. (IF FLG AND TMPITEM:NODETYPE='FORWARD THEN (GO LP))
  664. (IF (N_-1)
  665. >0 THEN (GO LP))
  666. (IF TOP:TYPE IS A LIST AND (CAR TOP:TYPE)
  667. ='LISTOF AND ~ (CDR TOP:VALUE)
  668. THEN
  669. (GO LP))
  670. (IF GEVEDITFLG AND ~ (MEMBER TMPITEM:SHORTVALUE '("(...)" "---"))
  671. THEN
  672. (GEVREFILLWINDOW)
  673. ELSE GEVEDITFLG_NIL (GEVFILLWINDOW))))
  674. % edited: 11-MAR-83 15:06
  675. (DG GEVPOSTEST (POS:VECTOR TPOS:VECTOR NAME:STRING ITEM:GSEITEM FLG N:INTEGER)
  676. (RESULT MOUSESTATE)
  677. % Test whether TPOS contains the mouse position POS. The result is NIL
  678. % if not found, else a list of the sub-item and a flag which is NIL
  679. % if the NAME part is identified, T if the VALUE part is identified.
  680. (IF POS:Y>=TPOS:Y AND POS:Y<=TPOS:Y+WINDOWLINEYSPACING AND POS:X>=TPOS:X AND
  681. POS:X<TPOS:X+GEVNAMECHARS*WINDOWCHARWIDTH THEN
  682. (A MOUSESTATE WITH AREA =
  683. (A REGION WITH START =
  684. (A VECTOR WITH X = TPOS:X Y = TPOS:Y - 1)
  685. SIZE = (A VECTOR WITH X = WINDOWCHARWIDTH*NAME:LENGTH Y =
  686. WINDOWLINEYSPACING))
  687. ITEM = ITEM FLAG = FLG GROUP = N)))
  688. % edited: 15-MAR-83 12:38
  689. (DG GEVPPS (ITEM:GSEITEM COL:INTEGER WINDOW:WINDOW)
  690. (GLOBAL Y:INTEGER)
  691. % Pretty-print a structure defined by ITEM in the window WINDOW,
  692. % beginning ar horizontal column COL and vertical position Y. The
  693. % positions in ITEM are modified to match the positions in the
  694. % window.
  695. (PROG (NAMEX TOP)
  696. % Make sure there is room in window.
  697. (IF Y<0 THEN (RETURN NIL))
  698. (IF GEVNUMBERCHARS>0 THEN (GEVLASTITEMNUMBER _+ 1)
  699. (SEND WINDOW PRINTAT (GEVSTRINGIFY GEVLASTITEMNUMBER)
  700. (A VECTOR WITH X = GEVNUMBERPOS Y = Y)))
  701. % Position in window for slot name.
  702. (NAMEX _ GEVNAMEPOS + COL*WINDOWCHARWIDTH)
  703. (ITEM:NAMEPOS:X_NAMEX)
  704. (ITEM:NAMEPOS:Y_Y)
  705. (IF ITEM:NODETYPE='FULLVALUE THEN
  706. (SEND WINDOW PRINTAT "(expanded)"
  707. (A VECTOR WITH X = NAMEX Y = Y))
  708. ELSEIF ITEM:NAME THEN
  709. (IF ITEM:NAME IS NUMERIC THEN
  710. (SEND WINDOW PRINTAT "#"
  711. (A VECTOR WITH X = NAMEX Y = Y))
  712. (NAMEX_+WINDOWCHARWIDTH))
  713. (SEND WINDOW PRINTAT (GEVLENGTHBOUND ITEM:NAME GEVNAMECHARS)
  714. (A VECTOR WITH X = NAMEX Y = Y)))
  715. % See if there is a value to print for this name.
  716. (IF ~ITEM:NODETYPE OR (MEMQ ITEM:NODETYPE
  717. '(FORWARD BACKUP PROP ADJ MSG ISA))
  718. THEN
  719. (ITEM:VALUEPOS:X_GEVVALUEPOS)
  720. (ITEM:VALUEPOS:Y_Y)
  721. (SEND WINDOW PRINTAT (ITEM:SHORTVALUE OR
  722. (ITEM:SHORTVALUE
  723. _
  724. (GEVSHORTVALUE ITEM:VALUE
  725. ITEM:TYPE
  726. (GEVSHORTCHARS
  727. - COL))))
  728. (A VECTOR WITH X = GEVVALUEPOS Y = Y))
  729. (IF ~ (EQ ITEM:SHORTVALUE ITEM:VALUE)
  730. THEN
  731. (SEND WINDOW PRINTAT "~"
  732. (A VECTOR WITH X = GEVTILDEPOS Y = Y)))
  733. (Y_-WINDOWLINEYSPACING)
  734. ELSEIF ITEM:NODETYPE='FULLVALUE THEN (Y_-WINDOWLINEYSPACING)
  735. (SEND WINDOW PRETTYPRINTAT ITEM:VALUE
  736. (A VECTOR WITH X = WINDOWCHARWIDTH Y = Y))
  737. (Y_WINDOW:YPOSITION - WINDOWLINEYSPACING)
  738. ELSEIF ITEM:NODETYPE='DISPLAY THEN (GEVEXPROP ITEM:VALUE ITEM:TYPE
  739. 'GEVDISPLAY
  740. 'MSG
  741. (LIST WINDOW Y))
  742. ELSE
  743. % This is a subtree
  744. (Y_-WINDOWLINEYSPACING)
  745. (FOR VSUB IN ITEM:SUBVALUES DO (GEVPPS VSUB COL+2 WINDOW)))))
  746. % edited: 6-APR-83 16:03
  747. % Write an interactive program involving the current item.
  748. (DG GEVPROGRAM NIL
  749. (PROG (TOPITEM COMMAND SET PATH DONE NEXT TYPE NEWFN RESULT LAST ABORTFLG)
  750. (TOPITEM_GEVEDITCHAIN:TOPITEM)
  751. (IF (COMMAND_ (SEND (A MENU WITH ITEMS =
  752. '(Quit COLLECT TOTAL AVERAGE MAXIMUM MINIMUM))
  753. SELECT))
  754. ='Quit OR ~ COMMAND THEN (RETURN NIL))
  755. (IF (SET_ (GEVPROPMENU TOPITEM:TYPE 'LIST
  756. NIL))
  757. ='Quit OR SET='Pop OR ~SET THEN (RETURN NIL))
  758. (PATH_ (LIST SET (LIST TOPITEM:NAME TOPITEM:TYPE)))
  759. (NEXT_SET)
  760. (TYPE_ (CADADR SET))
  761. (WHILE ~DONE AND ~ABORTFLG DO (NEXT_ (GEVPROPMENU TYPE
  762. (COMMAND~='COLLECT
  763. AND
  764. 'NUMBER)
  765. COMMAND='COLLECT))
  766. (IF NEXT IS ATOMIC THEN
  767. (CASE NEXT OF ((NIL Quit)
  768. (ABORTFLG_T))
  769. (Pop (IF ~ (CDDR PATH)
  770. THEN
  771. (ABORTFLG_T)
  772. ELSE
  773. (NEXT-_PATH)
  774. (NEXT_ (CAR PATH))
  775. (TYPE_ (CADR NEXT))
  776. (IF TYPE IS A LIST THEN TYPE_ (CADR TYPE))
  777. (LAST_ (CAR NEXT))))
  778. (Done (DONE_T)))
  779. ELSE
  780. (PATH+_NEXT)
  781. (TYPE_ (CADR NEXT))
  782. (LAST_ (CAR NEXT)))
  783. (IF (MEMQ TYPE '(ATOM INTEGER STRING REAL BOOLEAN NIL))
  784. DONE_T))
  785. (IF ABORTFLG (RETURN NIL))
  786. (PATH_ (REVERSIP PATH))
  787. (NEWFN_ (GEVMAKENEWFN COMMAND TOPITEM:TYPE SET (CDDR PATH)))
  788. (GEVPUTD 'GEVNEWFN
  789. (CAR NEWFN))
  790. (RESULT_ (GEVNEWFN TOPITEM:VALUE))
  791. % Print result as well as displaying it.
  792. (PRIN1 COMMAND)
  793. (SPACES 1)
  794. (FOR X IN (CDDR PATH)
  795. DO
  796. (PRIN1 (CAR X))
  797. (SPACES 1))
  798. (PRINC "OF ")
  799. (PRIN1 (CAAR PATH))
  800. (SPACES 1)
  801. (PRIN1 (CAADR PATH))
  802. (PRINC " = ")
  803. (PRINT RESULT)
  804. (GEVEDITCHAIN:TOPFRAME:PROPS_+ (A GSEITEM WITH NAME =
  805. (CONCAT (GEVSTRINGIFY COMMAND)
  806. (CONCAT " " (GEVSTRINGIFY
  807. LAST)))
  808. TYPE = (CADR NEWFN)
  809. VALUE = RESULT NODETYPE =
  810. 'MSG))
  811. (GEVDISPLAYNEWPROP)))
  812. % GSN 21-JAN-83 10:32
  813. % Make a menu to get properties of object OBJ with filter FILTER. FLG
  814. % is T if it is okay to stop before reaching a basic type.
  815. (DG GEVPROPMENU (OBJ:GLTYPE FILTER:ATOM FLG:BOOLEAN)
  816. (PROG (PROPS SEL PNAMES MENU)
  817. (PROPS_ (GEVGETNAMES OBJ FILTER))
  818. (IF ~PROPS THEN (RETURN NIL)
  819. ELSE
  820. (PNAMES_ (MAPCAR PROPS (FUNCTION CAR)))
  821. (SEL_ (SEND (A MENU WITH ITEMS =
  822. (CONS 'Quit
  823. (CONS 'Pop
  824. (IF FLG THEN (CONS 'Done
  825. PNAMES)
  826. ELSE PNAMES))))
  827. SELECT))
  828. (RETURN (CASE SEL OF ((Quit Pop Done NIL)
  829. SEL)
  830. ELSE
  831. (ASSOC SEL PROPS))))))
  832. % GSN 4-FEB-83 17:01
  833. % Get all property names and types of properties of type PROPTYPE for
  834. % OBJ when they satisfy FILTER.
  835. (DG GEVPROPNAMES (OBJ:GLTYPE PROPTYPE:ATOM FILTER:ATOM)
  836. (PROG (RESULT TYPE)
  837. (RESULT _ (FOR P IN (CASE PROPTYPE OF (PROP OBJ:PROPS)
  838. (ADJ OBJ:ADJS)
  839. (ISA OBJ:ISAS)
  840. (MSG OBJ:MSGS))
  841. WHEN
  842. (TYPE_ (GEVPROPTYPES OBJ P:NAME 'PROP))
  843. AND
  844. (GEVFILTER TYPE FILTER)
  845. COLLECT
  846. (LIST P:NAME TYPE)))
  847. (FOR S IN OBJ:SUPERS DO (RESULT _ (NCONC RESULT (GEVPROPNAMES S PROPTYPE
  848. FILTER))))
  849. (RETURN RESULT)))
  850. % GSN 4-FEB-83 17:02
  851. % Find the type of a computed property.
  852. (DG GEVPROPTYPE (STR:ATOM PROPNAME:ATOM PROPTYPE:ATOM)
  853. (PROG (PL SUBPL PROPENT TMP)
  854. (IF STR IS NOT ATOMIC THEN (RETURN NIL)
  855. ELSEIF
  856. (PROPENT_ (GEVGETPROP STR PROPNAME PROPTYPE))
  857. AND
  858. (TMP_ (LISTGET (CDDR PROPENT)
  859. 'RESULT))
  860. THEN
  861. (RETURN TMP)
  862. ELSEIF PROPENT AND (CADR PROPENT)
  863. IS ATOMIC AND (TMP_ (GET (CADR PROPENT)
  864. 'GLRESULTTYPE))
  865. THEN
  866. (RETURN TMP)
  867. ELSEIF
  868. (AND (PL_ (GET STR 'GLPROPFNS))
  869. (SUBPL_ (ASSOC PROPTYPE PL))
  870. (PROPENT_ (ASSOC PROPNAME (CDR SUBPL)))
  871. (TMP_ (CADDR PROPENT)))
  872. THEN
  873. (RETURN TMP)
  874. ELSEIF PROPTYPE='ADJ THEN (RETURN 'BOOLEAN))))
  875. % edited: 4-NOV-82 15:39
  876. (DE GEVPROPTYPES (OBJ NAME TYPE)
  877. (OR (GEVPROPTYPE OBJ NAME TYPE)
  878. (AND (GEVCOMPPROP OBJ NAME TYPE)
  879. (GEVPROPTYPE OBJ NAME TYPE))))
  880. % GSN 2-MAR-83 17:32
  881. % Push down to look at an item referenced from the current item.
  882. (DG GEVPUSH (ITEM:GSEITEM)
  883. (PROG (NEWITEMS TOPITEM LSTITEM:GSEITEM)
  884. (IF ITEM:NODETYPE='BACKUP THEN (GEVPOP NIL 1)
  885. (RETURN NIL))
  886. (TOPITEM_GEVEDITCHAIN:TOPITEM)
  887. (IF ITEM:NODETYPE='FORWARD THEN (NEWITEMS_ (GEVPUSHLISTOF ITEM T))
  888. ELSEIF ITEM:TYPE IS ATOMIC AND ~ (GET ITEM:TYPE 'GLSTRUCTURE)
  889. THEN
  890. (CASE ITEM:TYPE OF
  891. ((ATOM NUMBER REAL INTEGER STRING ANYTHING)
  892. (IF ITEM:VALUE=ITEM:SHORTVALUE THEN (RETURN NIL)
  893. ELSE
  894. (NEWITEMS_ (LIST (A GSEITEM WITH NAME = ITEM:NAME VALUE =
  895. ITEM:VALUE SHORTVALUE =
  896. ITEM:SHORTVALUE TYPE = ITEM:TYPE
  897. NODETYPE = 'FULLVALUE)))))
  898. ELSE
  899. (RETURN NIL))
  900. ELSEIF ITEM:TYPE IS A LIST AND (CAR ITEM:TYPE)
  901. ='LISTOF THEN (NEWITEMS_ (GEVPUSHLISTOF ITEM NIL)))
  902. (GEVEDITCHAIN+_ (AN EDITFRAME WITH PREVS = (CONS ITEM
  903. GEVEDITCHAIN:TOPFRAME:PREVS)
  904. SUBITEMS = NEWITEMS))
  905. % Do another PUSH automatically for a list of only one item.
  906. (GEVREFILLWINDOW)
  907. (IF ITEM:TYPE IS A LIST AND (CAR ITEM:TYPE)
  908. ='LISTOF AND ~ (CDR ITEM:VALUE)
  909. THEN
  910. (LSTITEM_ (CAADAR GEVEDITCHAIN))
  911. (GEVPUSH (CAR LSTITEM:SUBVALUES))
  912. (RETURN NIL))))
  913. % edited: 6-APR-83 16:04
  914. % Push into a datum of type LISTOF, expanding it into the individual
  915. % elements. If FLG is set, ITEM is a FORWARD item to be continued.
  916. (DG GEVPUSHLISTOF (ITEM:GSEITEM FLG:BOOLEAN)
  917. (PROG (ITEMTYPE TOPFRAME N:INTEGER NROOM LST VALS: (LISTOF ANYTHING) TMP)
  918. % Compute the vertical room available in the window.
  919. (IF ~ITEM:VALUE (RETURN NIL))
  920. (TOPFRAME_GEVEDITCHAIN:TOPFRAME)
  921. (NROOM _ GEVWINDOW:HEIGHT / WINDOWLINEYSPACING - 4 - (LENGTH
  922. TOPFRAME:PREVS))
  923. % If there was a previous display of this list, insert an ellipsis
  924. % header.
  925. (IF FLG THEN (LST+_ (A GSEITEM WITH SHORTVALUE = "(..." NODETYPE =
  926. 'BACKUP))
  927. (N_ITEM:NAME)
  928. (ITEMTYPE_ITEM:TYPE)
  929. (NROOM_-1)
  930. (VALS_ITEM:SUBVALUES)
  931. ELSE
  932. (N_1)
  933. (ITEMTYPE_ (CADR ITEM:TYPE))
  934. (VALS_ITEM:VALUE))
  935. % Now make entries for each value on the list.
  936. (WHILE VALS AND (NROOM>1 OR (NROOM=1 AND ~ (CDR VALS)))
  937. DO
  938. (LST+_ (A GSEITEM WITH VALUE = (TMP-_VALS)
  939. TYPE = ITEMTYPE NAME = N))
  940. (NROOM_-1)
  941. (N_+1))
  942. (IF VALS THEN (LST+_ (A GSEITEM WITH SHORTVALUE = "...)" NODETYPE =
  943. 'FORWARD
  944. TYPE = ITEMTYPE NAME = N SUBVALUES = VALS)))
  945. (RETURN (LIST (A GSEITEM WITH NAME = "expanded" TYPE = ITEMTYPE NODETYPE
  946. = 'LISTOF
  947. SUBVALUES = (REVERSIP LST))))))
  948. % edited: 14-MAR-83 16:46
  949. (DG GEVQUIT NIL
  950. (SETQ GEVACTIVEFLG NIL)(SEND GEVWINDOW CLOSE)(IF GEVMENUWINDOW THEN
  951. (SEND GEVMENUWINDOW CLOSE)))
  952. % edited: 19-OCT-82 10:23
  953. % Recompute property values for the item.
  954. (DG GEVREDOPROPS (TOP:EDITFRAME)
  955. (PROG (ITEM L)
  956. (ITEM_ (CAR TOP:PREVS))
  957. (IF ~TOP:PROPS AND (L_ (GEVEXPROP ITEM:VALUE ITEM:TYPE 'DISPLAYPROPS
  958. 'PROP
  959. NIL))
  960. ~='GEVERROR THEN (IF L IS ATOMIC THEN (GEVCOMMANDPROP ITEM
  961. 'PROP
  962. 'All)
  963. ELSEIF L IS A LIST THEN
  964. (FOR X IN L (GEVCOMMANDPROP ITEM 'PROP
  965. X)))
  966. ELSE
  967. (FOR X IN TOP:PROPS WHEN X:NODETYPE~='MSG DO
  968. (X:VALUE _ (GEVEXPROP ITEM:VALUE ITEM:TYPE X:NAME X:NODETYPE
  969. NIL))
  970. (X:SHORTVALUE _ NIL)))))
  971. % edited: 14-OCT-82 12:46
  972. % Re-expand the top item of GEVEDITCHAIN, which may have been changed
  973. % due to editing.
  974. (DG GEVREFILLWINDOW NIL
  975. (PROG (TOP TOPITEM SUBS TOPSUB)
  976. (TOP_GEVEDITCHAIN:TOPFRAME)
  977. (TOPITEM_GEVEDITCHAIN:TOPITEM)
  978. (TOPSUB_ (CAR TOP:SUBITEMS))
  979. (IF ~TOPSUB OR (TOPSUB:NODETYPE~='FULLVALUE AND TOPSUB:NODETYPE~='LISTOF)
  980. THEN
  981. (IF (GEVGETPROP TOPITEM:TYPE 'GEVDISPLAY
  982. 'MSG)
  983. THEN
  984. (TOP:SUBITEMS_ (LIST (A GSEITEM WITH VALUE = TOPITEM:VALUE TYPE
  985. = TOPITEM:TYPE NODETYPE = 'DISPLAY)))
  986. ELSE
  987. (SUBS_ (GEVMATCH TOPITEM:TYPE TOPITEM:VALUE T))
  988. (TOPSUB_ (CAR SUBS))
  989. (TOP:SUBITEMS_ (IF ~ (CDR SUBS)
  990. AND TOPSUB:NODETYPE='STRUCTURE AND
  991. TOPSUB:VALUE=TOPITEM:VALUE AND
  992. TOPSUB:TYPE=TOPITEM:TYPE THEN
  993. TOPSUB:SUBVALUES ELSE SUBS))))
  994. (GEVREDOPROPS TOP)
  995. (GEVFILLWINDOW)))
  996. % edited: 6-APR-83 16:05
  997. (DE GEVSHORTATOMVAL (ATM NCHARS)
  998. (COND ((NUMBERP ATM)
  999. (COND ((GREATERP (FlatSize2 ATM)
  1000. NCHARS)
  1001. (GEVSHORTSTRINGVAL (GEVSTRINGIFY ATM)
  1002. NCHARS))
  1003. (T ATM)))
  1004. ((GREATERP (FlatSize2 ATM)
  1005. NCHARS)
  1006. (CONCAT (SUBSTRING ATM 1 (SUB1 NCHARS))
  1007. "-"))
  1008. (T ATM)))
  1009. % GSN 4-APR-83 16:23
  1010. % Compute a short value for printing a CONS of two items.
  1011. (DG GEVSHORTCONSVAL (VAL STR NCHARS:INTEGER)
  1012. (PROG (NLEFT RES TMP NC)
  1013. (RES +_ "(")
  1014. (NLEFT _ NCHARS - 5)
  1015. (TMP_ (GEVSHORTVALUE (CAR VAL)
  1016. (CADR STR)
  1017. NLEFT - 3))
  1018. (NC_ (FlatSize2 TMP))
  1019. (IF NC>NLEFT - 3 THEN TMP_ "---" NC_3)
  1020. (RES+_ (GEVSTRINGIFY TMP))
  1021. (RES +_ " . ")
  1022. (NLEFT_-NC)
  1023. (TMP_ (GEVSHORTVALUE (CDR VAL)
  1024. (CADDR STR)
  1025. NLEFT))
  1026. (NC_ (FlatSize2 TMP))
  1027. (IF NC>NLEFT THEN TMP_ "---" NC_3)
  1028. (RES+_ (GEVSTRINGIFY TMP))
  1029. (RES+_ ")")
  1030. (RETURN (GEVCONCAT (REVERSIP RES)))))
  1031. % GSN 4-APR-83 16:24
  1032. % Compute a short value for printing a list of items.
  1033. (DG GEVSHORTLISTVAL (VAL STR NCHARS:INTEGER)
  1034. (PROG (NLEFT RES TMP QUIT NC NCI REST RSTR)
  1035. (RES +_ "(")
  1036. (REST_4)
  1037. (NLEFT _ NCHARS - 2)
  1038. (RSTR_ (CDR STR))
  1039. (WHILE VAL AND ~QUIT AND (NCI_ (IF (CDR VAL)
  1040. THEN NLEFT - REST ELSE NLEFT))
  1041. >2 DO (TMP_ (GEVSHORTVALUE (CAR VAL)
  1042. (IF (CAR STR)
  1043. ='LISTOF THEN (CADR STR)
  1044. ELSEIF
  1045. (CAR STR)
  1046. ='LIST THEN (CAR RSTR))
  1047. NCI))
  1048. (QUIT _ (MEMBER TMP '(GEVERROR "(...)" "---" "???")))
  1049. (NC_ (FlatSize2 TMP))
  1050. (IF NC>NCI AND (CDR RES)
  1051. THEN QUIT_T ELSE (IF NC>NCI THEN TMP_ "---" NC_3 QUIT_T)
  1052. (RES+_ (GEVSTRINGIFY TMP))
  1053. (NLEFT_-NC)
  1054. (VAL_ (CDR VAL))
  1055. (RSTR_ (CDR RSTR))
  1056. (IF VAL THEN (RES+_ " ")
  1057. (NLEFT_-1))))
  1058. (IF VAL THEN (RES+_ "..."))
  1059. (RES+_ ")")
  1060. (RETURN (GEVCONCAT (REVERSIP RES)))))
  1061. % edited: 12-OCT-82 12:14
  1062. % Compute the short value of a string VAL. The result is a string
  1063. % which can be printed within NCHARS.
  1064. (DE GEVSHORTSTRINGVAL (VAL NCHARS)
  1065. (COND ((STRINGP VAL)
  1066. (GEVLENGTHBOUND VAL NCHARS))
  1067. (T "???")))
  1068. % edited: 11-MAR-83 15:34
  1069. % Compute the short value of a given value VAL whose type is STR. The
  1070. % result is an atom, string, or list structure which can be printed
  1071. % within NCHARS.
  1072. (DE GEVSHORTVALUE (VAL STR NCHARS)
  1073. (PROG (TMP)
  1074. (SETQ STR (GEVXTRTYPE STR))
  1075. (RETURN (COND ((AND (ATOM STR)
  1076. (MEMQ STR '(ATOM INTEGER REAL)))
  1077. (GEVSHORTATOMVAL VAL NCHARS))
  1078. ((EQ STR 'STRING)
  1079. (GEVSHORTSTRINGVAL VAL NCHARS))
  1080. ((AND (ATOM STR)
  1081. (NE (SETQ TMP (GEVEXPROP VAL STR 'SHORTVALUE
  1082. 'PROP
  1083. NIL))
  1084. 'GEVERROR))
  1085. (GEVLENGTHBOUND TMP NCHARS))
  1086. ((OR (ATOM VAL)
  1087. (NUMBERP VAL))
  1088. (GEVSHORTATOMVAL VAL NCHARS))
  1089. ((STRINGP VAL)
  1090. (GEVSHORTSTRINGVAL VAL NCHARS))
  1091. ((PAIRP STR)
  1092. (CASEQ (CAR STR)
  1093. ((LISTOF LIST)
  1094. (COND ((PAIRP VAL)
  1095. (GEVSHORTLISTVAL VAL STR NCHARS))
  1096. (T "???")))
  1097. (CONS (COND ((PAIRP VAL)
  1098. (GEVSHORTCONSVAL VAL STR NCHARS))
  1099. (T "???")))
  1100. (T "---")))
  1101. ((PAIRP VAL)
  1102. (GEVSHORTLISTVAL VAL '(LISTOF ANYTHING)
  1103. NCHARS))
  1104. (T "---")))))
  1105. % edited: 21-OCT-82 11:17
  1106. % Extract an atomic type name from a type spec which may be either
  1107. % <type> or (A <type>) .
  1108. (DE GEVXTRTYPE (TYPE)
  1109. (COND ((ATOM TYPE)
  1110. TYPE)
  1111. ((NOT (PAIRP TYPE))
  1112. NIL)
  1113. ((AND (MEMQ (CAR TYPE)
  1114. '(A AN a an An TRANSPARENT))
  1115. (CDR TYPE)
  1116. (ATOM (CADR TYPE)))
  1117. (CADR TYPE))
  1118. ((MEMQ (CAR TYPE)
  1119. GEVTYPENAMES)
  1120. TYPE)
  1121. ((AND (NOT (UNBOUNDP GLUSERSTRNAMES))
  1122. (ASSOC (CAR TYPE)
  1123. GLUSERSTRNAMES))
  1124. TYPE)
  1125. ((AND (ATOM (CAR TYPE))
  1126. (CDR TYPE))
  1127. (GEVXTRTYPE (CADR TYPE)))
  1128. (T (ERROR 0 (LIST 'GEVXTRTYPE
  1129. (LIST TYPE "is an illegal type specification.")))
  1130. NIL)))
  1131. (SETQ GEVTYPENAMES '(CONS LIST RECORD LISTOF ALIST ATOM OBJECT LISTOBJECT
  1132. ATOMOBJECT))