gev.old 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316
  1. % {DSK}GEV.PSL;2 25-MAR-83 11:36:28
  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: 14-MAR-83 16:41
  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. % GSN 2-MAR-83 16:33
  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)
  418. (SETQ LASTPATH (CAR (LASTPAIR PATH)))
  419. (RETURN
  420. (LIST
  421. (LIST
  422. 'GLAMBDA
  423. (LIST (MKATOM (CONCAT "GEVNEWFNTOP:" INPUTTYPE:PNAME)))
  424. (LIST
  425. 'PROG
  426. (CONS 'GEVNEWFNVALUE
  427. (CASE OPERATION OF (COLLECT '(GEVNEWFNRESULT))
  428. ((MAXIMUM MINIMUM)
  429. '(GEVNEWFNTESTVAL GEVNEWFNINSTANCE))
  430. (TOTAL '((GEVNEWFNSUM 0)))
  431. (AVERAGE '((GEVNEWFNSUM 0.0)
  432. (GEVNEWFNCOUNT 0)))
  433. ELSE
  434. (ERROR 0 NIL)))
  435. (NCONC (LIST 'FOR
  436. 'GEVNEWFNLOOPVAR
  437. 'IN
  438. (MKATOM (CONCAT "GEVNEWFNTOP:" SET:NAME:PNAME))
  439. 'DO
  440. (LIST 'GEVNEWFNVALUE
  441. '_
  442. (REVERSIP (CONS 'GEVNEWFNLOOPVAR
  443. (MAPCAN PATH
  444. (FUNCTION
  445. (LAMBDA (X)
  446. (LIST 'OF
  447. (CAR X)
  448. 'THE))))))))
  449. (COPY (CASE OPERATION OF (COLLECT '((GEVNEWFNRESULT +_
  450. GEVNEWFNVALUE)))
  451. (MAXIMUM '((IF ~ GEVNEWFNINSTANCE
  452. OR GEVNEWFNVALUE >
  453. GEVNEWFNTESTVAL
  454. THEN (GEVNEWFNTESTVAL _
  455. GEVNEWFNVALUE)
  456. (GEVNEWFNINSTANCE _
  457. GEVNEWFNLOOPVAR))))
  458. (MINIMUM '((IF ~ GEVNEWFNINSTANCE
  459. OR GEVNEWFNVALUE <
  460. GEVNEWFNTESTVAL
  461. THEN (GEVNEWFNTESTVAL _
  462. GEVNEWFNVALUE)
  463. (GEVNEWFNINSTANCE _
  464. GEVNEWFNLOOPVAR))))
  465. (AVERAGE '((GEVNEWFNSUM _+
  466. GEVNEWFNVALUE)
  467. (GEVNEWFNCOUNT _+
  468. 1)))
  469. (TOTAL '((GEVNEWFNSUM _+
  470. GEVNEWFNVALUE))))))
  471. (LIST 'RETURN
  472. (CASE OPERATION OF (COLLECT '(DREVERSE GEVNEWFNRESULT))
  473. ((MAXIMUM MINIMUM)
  474. '(LIST GEVNEWFNTESTVAL GEVNEWFNINSTANCE))
  475. (AVERAGE '(QUOTIENT GEVNEWFNSUM (FLOAT GEVNEWFNCOUNT)))
  476. (TOTAL 'GEVNEWFNSUM)))))
  477. (CASE OPERATION OF (COLLECT (LIST 'LISTOF
  478. (CADR LASTPATH)))
  479. ((MAXIMUM MINIMUM)
  480. (LIST 'LIST
  481. (COPY LASTPATH)
  482. (LIST 'WINNER
  483. (CADR SET:TYPE))))
  484. (AVERAGE 'REAL)
  485. (TOTAL (CADR LASTPATH)))))))
  486. % edited: 8-OCT-82 10:43
  487. (DG GEVMATCH (STR VAL FLG)
  488. (RESULT (LISTOF GSEITEM))
  489. % Match a structure description, STR, and a value VAL which matches
  490. % that description, to form a structure editor tree structure.
  491. (PROG (RESULT)
  492. (GEVMATCHB STR VAL NIL FLG)
  493. (RETURN (REVERSIP RESULT))))
  494. % edited: 8-OCT-82 10:01
  495. % Make a single item which matches structure STR and value VAL.
  496. (DG GEVMATCHA (STR VAL FLG)
  497. (PROG (RES)
  498. (RES_ (GEVMATCH STR VAL FLG))
  499. (IF ~ (CDR RES)
  500. THEN
  501. (RETURN (CAR RES))
  502. ELSE
  503. (RETURN (A GSEITEM WITH VALUE = VAL TYPE = STR SUBVALUES = RES
  504. NODETYPE = 'SUBTREE)))))
  505. % edited: 7-OCT-82 16:38
  506. % Match an ATOM structure to a given value.
  507. (DG GEVMATCHATOM (STR VAL NAME)
  508. (PROG (L STRB TMP)
  509. (IF VAL IS NOT ATOMIC OR VAL IS NULL THEN (RETURN NIL))
  510. (STRB_ (CADR STR))
  511. (IF (CAR STRB)
  512. ~='PROPLIST THEN (RETURN NIL))
  513. (L_ (CDR STRB))
  514. (FOR X IN L DO (IF TMP_ (GET VAL (CAR X))
  515. THEN
  516. (GEVMATCHB X TMP NIL NIL)))))
  517. % edited: 7-OCT-82 16:57
  518. % Match an ALIST structure to a given value.
  519. (DG GEVMATCHALIST (STR VAL NAME)
  520. (PROG (L TMP)
  521. (L_ (CDR STR))
  522. (FOR X IN L DO (IF TMP_ (ASSOC (CAR X)
  523. VAL)
  524. THEN
  525. (GEVMATCHB X (CDR TMP)
  526. NIL NIL)))))
  527. % edited: 22-DEC-82 15:26
  528. % Match a structure description, STR, and a value VAL which matches
  529. % that description, to form a structure editor tree structure. If
  530. % FLG is set, the match will descend inside an atomic type name.
  531. % Results are added to the free variable RESULT.
  532. (DG GEVMATCHB (STR: (LISTOF ANYTHING)
  533. VAL NAME:ATOM FLG:BOOLEAN)
  534. (GLOBAL RESULT)(PROG (X Y STRB XSTR TOP TMP)
  535. (XSTR_ (GEVXTRTYPE STR))
  536. (IF STR IS ATOMIC THEN
  537. (IF FLG AND (STRB _ (CAR (GET STR 'GLSTRUCTURE)))
  538. THEN
  539. (RESULT +_
  540. (A GSEITEM WITH NAME = NAME VALUE = VAL
  541. SUBVALUES = (GEVMATCH STRB VAL NIL)
  542. TYPE = STR NODETYPE = 'STRUCTURE))
  543. ELSE
  544. (RESULT +_
  545. (A GSEITEM WITH NAME = NAME VALUE = VAL
  546. TYPE = STR)))
  547. (RETURN NIL)
  548. ELSE
  549. (CASE (CAR STR)
  550. OF
  551. (CONS (GEVMATCHB (CADR STR)
  552. (CAR VAL)
  553. NIL NIL)
  554. (GEVMATCHB (CADDR STR)
  555. (CDR VAL)
  556. NIL NIL))
  557. (LIST (FOR X IN (CDR STR)
  558. DO
  559. (IF VAL (GEVMATCHB X (CAR VAL)
  560. NIL NIL)
  561. (VAL_ (CDR VAL)))))
  562. (ATOM (GEVMATCHATOM STR VAL NAME))
  563. (ALIST (GEVMATCHALIST STR VAL NAME))
  564. (PROPLIST (GEVMATCHPROPLIST STR VAL NAME))
  565. (LISTOF (GEVMATCHLISTOF STR VAL NAME))
  566. (RECORD (GEVMATCHRECORD STR VAL NAME))
  567. ((OBJECT ATOMOBJECT LISTOBJECT)
  568. (GEVMATCHOBJECT STR VAL NAME))
  569. ELSE
  570. (IF NAME THEN (TMP _ (GEVMATCH STR VAL NIL))
  571. (TOP_ (CAR TMP))
  572. (RESULT +_
  573. (IF ~ (CDR TMP)
  574. AND ~TOP:NAME THEN (
  575. TOP:NAME_NAME)
  576. TOP ELSE
  577. (A GSEITEM WITH NAME = NAME
  578. VALUE = VAL SUBVALUES = TMP
  579. TYPE = XSTR NODETYPE =
  580. 'SUBTREE)))
  581. ELSEIF
  582. (STRB _ (GEVXTRTYPE (CADR STR)))
  583. IS ATOMIC THEN (GEVMATCHB STRB VAL
  584. (CAR STR)
  585. NIL)
  586. ELSEIF
  587. (TMP_ (GEVMATCH (CADR STR)
  588. VAL NIL))
  589. THEN
  590. (TOP_ (CAR TMP))
  591. (RESULT +_
  592. (IF ~ (CDR TMP)
  593. AND ~TOP:NAME THEN
  594. (TOP:NAME_ (CAR STR))
  595. TOP ELSE
  596. (A GSEITEM WITH NAME =
  597. (CAR STR)
  598. VALUE = VAL SUBVALUES = TMP
  599. TYPE = (CADR STR)
  600. NODETYPE = 'SUBTREE)))
  601. ELSE
  602. (PRINT "GEVMATCHB Failed"))))))
  603. % edited: 8-OCT-82 10:15
  604. % Match a LISTOF structure.
  605. (DG GEVMATCHLISTOF (STR VAL NAME)
  606. (GLOBAL RESULT)(RESULT+_ (A GSEITEM WITH NAME = NAME VALUE = VAL TYPE = STR)))
  607. % edited: 22-DEC-82 10:04
  608. % Match the OBJECT structures.
  609. (DG GEVMATCHOBJECT (STR VAL NAME)
  610. (GLOBAL RESULT)(PROG (OBJECTTYPE TMP)
  611. (SETQ OBJECTTYPE (CAR STR))
  612. (RESULT _+ (A GSEITEM WITH NAME = 'CLASS
  613. VALUE = (CASE OBJECTTYPE OF ((OBJECT
  614. LISTOBJECT)
  615. (TMP-_VAL))
  616. (ATOMOBJECT
  617. (GET VAL 'CLASS)))
  618. TYPE = 'GLTYPE))
  619. (FOR X IN (CDR STR)
  620. DO
  621. (CASE OBJECTTYPE OF ((OBJECT LISTOBJECT)
  622. (IF VAL (GEVMATCHB X (TMP-_VAL)
  623. NIL NIL)))
  624. (ATOMOBJECT (IF TMP_ (GET VAL (CAR X))
  625. THEN
  626. (GEVMATCHB X TMP NIL NIL)))))))
  627. % edited: 24-NOV-82 16:31
  628. % Match an PROPLIST structure to a given value.
  629. (DG GEVMATCHPROPLIST (STR VAL NAME)
  630. (PROG (L TMP)
  631. (L_ (CDR STR))
  632. (FOR X IN L DO (IF TMP_ (LISTGET VAL (CAR X))
  633. THEN
  634. (GEVMATCHB X TMP NIL NIL)))))
  635. % edited: 11-MAR-83 16:31
  636. % Match a RECORD structure.
  637. (DG GEVMATCHRECORD (STR VAL NAME)
  638. (PROG (STRNAME FIELDS N)
  639. (IF (CADR STR)
  640. IS ATOMIC THEN STRNAME_ (CADR STR)
  641. FIELDS_
  642. (CDDR STR)
  643. ELSE FIELDS_ (CDR STR))
  644. (N_0)
  645. (FOR X IN FIELDS DO (N_+1)
  646. (GEVMATCHB X (GetV VAL N)
  647. (CAR X)
  648. NIL))))
  649. % GSN 2-MAR-83 17:33
  650. % Pop up from the current item to the previous one. If FLG is set,
  651. % popping continues through extended LISTOF elements.
  652. (DG GEVPOP (FLG:BOOLEAN N:INTEGER)
  653. (PROG (TMP TOP:GSEITEM TMPITEM)
  654. (IF N<1 (RETURN NIL))
  655. LP
  656. (TMP-_GEVEDITCHAIN)
  657. (IF ~GEVEDITCHAIN THEN (RETURN (GEVQUIT)))
  658. (TOP_ (CAAAR GEVEDITCHAIN))
  659. % Test for repeated LISTOF elements.
  660. (TMPITEM_ (CAR TMP:PREVS))
  661. (IF FLG AND TMPITEM:NODETYPE='FORWARD THEN (GO LP))
  662. (IF (N_-1)
  663. >0 THEN (GO LP))
  664. (IF TOP:TYPE IS A LIST AND (CAR TOP:TYPE)
  665. ='LISTOF AND ~ (CDR TOP:VALUE)
  666. THEN
  667. (GO LP))
  668. (IF GEVEDITFLG AND ~ (MEMBER TMPITEM:SHORTVALUE '("(...)" "---"))
  669. THEN
  670. (GEVREFILLWINDOW)
  671. ELSE GEVEDITFLG_NIL (GEVFILLWINDOW))))
  672. % edited: 11-MAR-83 15:06
  673. (DG GEVPOSTEST (POS:VECTOR TPOS:VECTOR NAME:STRING ITEM:GSEITEM FLG N:INTEGER)
  674. (RESULT MOUSESTATE)
  675. % Test whether TPOS contains the mouse position POS. The result is NIL
  676. % if not found, else a list of the sub-item and a flag which is NIL
  677. % if the NAME part is identified, T if the VALUE part is identified.
  678. (IF POS:Y>=TPOS:Y AND POS:Y<=TPOS:Y+WINDOWLINEYSPACING AND POS:X>=TPOS:X AND
  679. POS:X<TPOS:X+GEVNAMECHARS*WINDOWCHARWIDTH THEN
  680. (A MOUSESTATE WITH AREA =
  681. (A REGION WITH START =
  682. (A VECTOR WITH X = TPOS:X Y = TPOS:Y - 1)
  683. SIZE = (A VECTOR WITH X = WINDOWCHARWIDTH*NAME:LENGTH Y =
  684. WINDOWLINEYSPACING))
  685. ITEM = ITEM FLAG = FLG GROUP = N)))
  686. % edited: 15-MAR-83 12:38
  687. (DG GEVPPS (ITEM:GSEITEM COL:INTEGER WINDOW:WINDOW)
  688. (GLOBAL Y:INTEGER)
  689. % Pretty-print a structure defined by ITEM in the window WINDOW,
  690. % beginning ar horizontal column COL and vertical position Y. The
  691. % positions in ITEM are modified to match the positions in the
  692. % window.
  693. (PROG (NAMEX TOP)
  694. % Make sure there is room in window.
  695. (IF Y<0 THEN (RETURN NIL))
  696. (IF GEVNUMBERCHARS>0 THEN (GEVLASTITEMNUMBER _+ 1)
  697. (SEND WINDOW PRINTAT (GEVSTRINGIFY GEVLASTITEMNUMBER)
  698. (A VECTOR WITH X = GEVNUMBERPOS Y = Y)))
  699. % Position in window for slot name.
  700. (NAMEX _ GEVNAMEPOS + COL*WINDOWCHARWIDTH)
  701. (ITEM:NAMEPOS:X_NAMEX)
  702. (ITEM:NAMEPOS:Y_Y)
  703. (IF ITEM:NODETYPE='FULLVALUE THEN
  704. (SEND WINDOW PRINTAT "(expanded)"
  705. (A VECTOR WITH X = NAMEX Y = Y))
  706. ELSEIF ITEM:NAME THEN
  707. (IF ITEM:NAME IS NUMERIC THEN
  708. (SEND WINDOW PRINTAT "#"
  709. (A VECTOR WITH X = NAMEX Y = Y))
  710. (NAMEX_+WINDOWCHARWIDTH))
  711. (SEND WINDOW PRINTAT (GEVLENGTHBOUND ITEM:NAME GEVNAMECHARS)
  712. (A VECTOR WITH X = NAMEX Y = Y)))
  713. % See if there is a value to print for this name.
  714. (IF ~ITEM:NODETYPE OR (MEMQ ITEM:NODETYPE
  715. '(FORWARD BACKUP PROP ADJ MSG ISA))
  716. THEN
  717. (ITEM:VALUEPOS:X_GEVVALUEPOS)
  718. (ITEM:VALUEPOS:Y_Y)
  719. (SEND WINDOW PRINTAT (ITEM:SHORTVALUE OR
  720. (ITEM:SHORTVALUE
  721. _
  722. (GEVSHORTVALUE ITEM:VALUE
  723. ITEM:TYPE
  724. (GEVSHORTCHARS
  725. - COL))))
  726. (A VECTOR WITH X = GEVVALUEPOS Y = Y))
  727. (IF ~ (EQ ITEM:SHORTVALUE ITEM:VALUE)
  728. THEN
  729. (SEND WINDOW PRINTAT "~"
  730. (A VECTOR WITH X = GEVTILDEPOS Y = Y)))
  731. (Y_-WINDOWLINEYSPACING)
  732. ELSEIF ITEM:NODETYPE='FULLVALUE THEN (Y_-WINDOWLINEYSPACING)
  733. (SEND WINDOW PRETTYPRINTAT ITEM:VALUE
  734. (A VECTOR WITH X = WINDOWCHARWIDTH Y = Y))
  735. (Y_WINDOW:YPOSITION - WINDOWLINEYSPACING)
  736. ELSEIF ITEM:NODETYPE='DISPLAY THEN (GEVEXPROP ITEM:VALUE ITEM:TYPE
  737. 'GEVDISPLAY
  738. 'MSG
  739. (LIST WINDOW Y))
  740. ELSE
  741. % This is a subtree
  742. (Y_-WINDOWLINEYSPACING)
  743. (FOR VSUB IN ITEM:SUBVALUES DO (GEVPPS VSUB COL+2 WINDOW)))))
  744. % GSN 25-MAR-83 10:15
  745. % Write an interactive program involving the current item.
  746. (DG GEVPROGRAM NIL
  747. (PROG (TOPITEM COMMAND SET PATH DONE NEXT TYPE NEWFN RESULT LAST ABORTFLG)
  748. (TOPITEM_GEVEDITCHAIN:TOPITEM)
  749. (IF (COMMAND_ (SEND (A MENU WITH ITEMS =
  750. '(Quit COLLECT TOTAL AVERAGE MAXIMUM MINIMUM))
  751. SELECT))
  752. ='Quit OR ~ COMMAND THEN (RETURN NIL))
  753. (IF (SET_ (GEVPROPMENU TOPITEM:TYPE 'LIST
  754. NIL))
  755. ='Quit OR SET='Pop OR ~SET THEN (RETURN NIL))
  756. (PATH_ (LIST SET (LIST TOPITEM:NAME TOPITEM:TYPE)))
  757. (NEXT_SET)
  758. (TYPE_ (CADADR SET))
  759. (WHILE ~DONE AND ~ABORTFLG DO (NEXT_ (GEVPROPMENU TYPE
  760. (COMMAND~='COLLECT
  761. AND
  762. 'NUMBER)
  763. COMMAND='COLLECT))
  764. (CASE NEXT OF ((NIL Quit)
  765. (ABORTFLG_T))
  766. (Pop (IF ~ (CDDR PATH)
  767. THEN
  768. (ABORTFLG_T)
  769. ELSE
  770. (NEXT-_PATH)
  771. (NEXT_ (CAR PATH))
  772. (TYPE_ (CADR NEXT))
  773. (IF TYPE IS A LIST THEN TYPE_ (CADR TYPE))
  774. (LAST_ (CAR NEXT))))
  775. (Done (DONE_T))
  776. ELSE
  777. (PROGN (PATH+_NEXT)
  778. (TYPE_ (CADR NEXT))
  779. (LAST_ (CAR NEXT))))
  780. (IF (MEMQ TYPE '(ATOM INTEGER STRING REAL BOOLEAN NIL))
  781. DONE_T))
  782. (IF ABORTFLG (RETURN NIL))
  783. (PATH_ (REVERSIP PATH))
  784. (NEWFN_ (GEVMAKENEWFN COMMAND TOPITEM:TYPE SET (CDDR PATH)))
  785. (GEVPUTD 'GEVNEWFN
  786. (CAR NEWFN))
  787. (RESULT_ (GEVNEWFN TOPITEM:VALUE))
  788. % Print result as well as displaying it.
  789. (PRIN1 COMMAND)
  790. (SPACES 1)
  791. (FOR X IN (CDDR PATH)
  792. DO
  793. (PRIN1 (CAR X))
  794. (SPACES 1))
  795. (PRINC "OF ")
  796. (PRIN1 (CAAR PATH))
  797. (SPACES 1)
  798. (PRIN1 (CAADR PATH))
  799. (PRINC " = ")
  800. (PRINT RESULT)
  801. (GEVEDITCHAIN:TOPFRAME:PROPS_+ (A GSEITEM WITH NAME =
  802. (CONCAT (GEVSTRINGIFY COMMAND)
  803. (CONCAT " " (GEVSTRINGIFY
  804. LAST)))
  805. TYPE = (CADR NEWFN)
  806. VALUE = RESULT NODETYPE =
  807. 'MSG))
  808. (GEVDISPLAYNEWPROP)))
  809. % GSN 21-JAN-83 10:32
  810. % Make a menu to get properties of object OBJ with filter FILTER. FLG
  811. % is T if it is okay to stop before reaching a basic type.
  812. (DG GEVPROPMENU (OBJ:GLTYPE FILTER:ATOM FLG:BOOLEAN)
  813. (PROG (PROPS SEL PNAMES MENU)
  814. (PROPS_ (GEVGETNAMES OBJ FILTER))
  815. (IF ~PROPS THEN (RETURN NIL)
  816. ELSE
  817. (PNAMES_ (MAPCAR PROPS (FUNCTION CAR)))
  818. (SEL_ (SEND (A MENU WITH ITEMS =
  819. (CONS 'Quit
  820. (CONS 'Pop
  821. (IF FLG THEN (CONS 'Done
  822. PNAMES)
  823. ELSE PNAMES))))
  824. SELECT))
  825. (RETURN (CASE SEL OF ((Quit Pop Done NIL)
  826. SEL)
  827. ELSE
  828. (ASSOC SEL PROPS))))))
  829. % GSN 4-FEB-83 17:01
  830. % Get all property names and types of properties of type PROPTYPE for
  831. % OBJ when they satisfy FILTER.
  832. (DG GEVPROPNAMES (OBJ:GLTYPE PROPTYPE:ATOM FILTER:ATOM)
  833. (PROG (RESULT TYPE)
  834. (RESULT _ (FOR P IN (CASE PROPTYPE OF (PROP OBJ:PROPS)
  835. (ADJ OBJ:ADJS)
  836. (ISA OBJ:ISAS)
  837. (MSG OBJ:MSGS))
  838. WHEN
  839. (TYPE_ (GEVPROPTYPES OBJ P:NAME 'PROP))
  840. AND
  841. (GEVFILTER TYPE FILTER)
  842. COLLECT
  843. (LIST P:NAME TYPE)))
  844. (FOR S IN OBJ:SUPERS DO (RESULT _ (NCONC RESULT (GEVPROPNAMES S PROPTYPE
  845. FILTER))))
  846. (RETURN RESULT)))
  847. % GSN 4-FEB-83 17:02
  848. % Find the type of a computed property.
  849. (DG GEVPROPTYPE (STR:ATOM PROPNAME:ATOM PROPTYPE:ATOM)
  850. (PROG (PL SUBPL PROPENT TMP)
  851. (IF STR IS NOT ATOMIC THEN (RETURN NIL)
  852. ELSEIF
  853. (PROPENT_ (GEVGETPROP STR PROPNAME PROPTYPE))
  854. AND
  855. (TMP_ (LISTGET (CDDR PROPENT)
  856. 'RESULT))
  857. THEN
  858. (RETURN TMP)
  859. ELSEIF PROPENT AND (CADR PROPENT)
  860. IS ATOMIC AND (TMP_ (GET (CADR PROPENT)
  861. 'GLRESULTTYPE))
  862. THEN
  863. (RETURN TMP)
  864. ELSEIF
  865. (AND (PL_ (GET STR 'GLPROPFNS))
  866. (SUBPL_ (ASSOC PROPTYPE PL))
  867. (PROPENT_ (ASSOC PROPNAME (CDR SUBPL)))
  868. (TMP_ (CADDR PROPENT)))
  869. THEN
  870. (RETURN TMP)
  871. ELSEIF PROPTYPE='ADJ THEN (RETURN 'BOOLEAN))))
  872. % edited: 4-NOV-82 15:39
  873. (DE GEVPROPTYPES (OBJ NAME TYPE)
  874. (OR (GEVPROPTYPE OBJ NAME TYPE)
  875. (AND (GEVCOMPPROP OBJ NAME TYPE)
  876. (GEVPROPTYPE OBJ NAME TYPE))))
  877. % GSN 2-MAR-83 17:32
  878. % Push down to look at an item referenced from the current item.
  879. (DG GEVPUSH (ITEM:GSEITEM)
  880. (PROG (NEWITEMS TOPITEM LSTITEM:GSEITEM)
  881. (IF ITEM:NODETYPE='BACKUP THEN (GEVPOP NIL 1)
  882. (RETURN NIL))
  883. (TOPITEM_GEVEDITCHAIN:TOPITEM)
  884. (IF ITEM:NODETYPE='FORWARD THEN (NEWITEMS_ (GEVPUSHLISTOF ITEM T))
  885. ELSEIF ITEM:TYPE IS ATOMIC AND ~ (GET ITEM:TYPE 'GLSTRUCTURE)
  886. THEN
  887. (CASE ITEM:TYPE OF
  888. ((ATOM NUMBER REAL INTEGER STRING ANYTHING)
  889. (IF ITEM:VALUE=ITEM:SHORTVALUE THEN (RETURN NIL)
  890. ELSE
  891. (NEWITEMS_ (LIST (A GSEITEM WITH NAME = ITEM:NAME VALUE =
  892. ITEM:VALUE SHORTVALUE =
  893. ITEM:SHORTVALUE TYPE = ITEM:TYPE
  894. NODETYPE = 'FULLVALUE)))))
  895. ELSE
  896. (RETURN NIL))
  897. ELSEIF ITEM:TYPE IS A LIST AND (CAR ITEM:TYPE)
  898. ='LISTOF THEN (NEWITEMS_ (GEVPUSHLISTOF ITEM NIL)))
  899. (GEVEDITCHAIN+_ (AN EDITFRAME WITH PREVS = (CONS ITEM
  900. GEVEDITCHAIN:TOPFRAME:PREVS)
  901. SUBITEMS = NEWITEMS))
  902. % Do another PUSH automatically for a list of only one item.
  903. (GEVREFILLWINDOW)
  904. (IF ITEM:TYPE IS A LIST AND (CAR ITEM:TYPE)
  905. ='LISTOF AND ~ (CDR ITEM:VALUE)
  906. THEN
  907. (LSTITEM_ (CAADAR GEVEDITCHAIN))
  908. (GEVPUSH (CAR LSTITEM:SUBVALUES))
  909. (RETURN NIL))))
  910. % edited: 11-MAR-83 15:08
  911. % Push into a datum of type LISTOF, expanding it into the individual
  912. % elements. If FLG is set, ITEM is a FORWARD item to be continued.
  913. (DG GEVPUSHLISTOF (ITEM:GSEITEM FLG:BOOLEAN)
  914. (PROG (ITEMTYPE TOPFRAME N:INTEGER NROOM LST VALS: (LISTOF anything) TMP)
  915. % Compute the vertical room available in the window.
  916. (IF ~ITEM:VALUE (RETURN NIL))
  917. (TOPFRAME_GEVEDITCHAIN:TOPFRAME)
  918. (NROOM _ GEVWINDOW:HEIGHT/WINDOWLINEYSPACING - 4 - (LENGTH
  919. TOPFRAME:PREVS))
  920. % If there was a previous display of this list, insert an ellipsis
  921. % header.
  922. (IF FLG THEN (LST+_ (A GSEITEM WITH SHORTVALUE = "(..." NODETYPE =
  923. 'BACKUP))
  924. (N_ITEM:NAME)
  925. (ITEMTYPE_ITEM:TYPE)
  926. (NROOM_-1)
  927. (VALS_ITEM:SUBVALUES)
  928. ELSE
  929. (N_1)
  930. (ITEMTYPE_ (CADR ITEM:TYPE))
  931. (VALS_ITEM:VALUE))
  932. % Now make entries for each value on the list.
  933. (WHILE VALS AND (NROOM>1 OR (NROOM=1 AND ~ (CDR VALS)))
  934. DO
  935. (LST+_ (A GSEITEM WITH VALUE = (TMP-_VALS)
  936. TYPE = ITEMTYPE NAME = N))
  937. (NROOM_-1)
  938. (N_+1))
  939. (IF VALS THEN (LST+_ (A GSEITEM WITH SHORTVALUE = "...)" NODETYPE =
  940. 'FORWARD
  941. TYPE = ITEMTYPE NAME = N SUBVALUES = VALS)))
  942. (RETURN (LIST (A GSEITEM WITH NAME = "expanded" TYPE = ITEMTYPE NODETYPE
  943. = 'LISTOF
  944. SUBVALUES = (REVERSIP LST))))))
  945. % edited: 14-MAR-83 16:46
  946. (DG GEVQUIT NIL
  947. (SETQ GEVACTIVEFLG NIL)(SEND GEVWINDOW CLOSE)(IF GEVMENUWINDOW THEN
  948. (SEND GEVMENUWINDOW CLOSE)))
  949. % edited: 19-OCT-82 10:23
  950. % Recompute property values for the item.
  951. (DG GEVREDOPROPS (TOP:EDITFRAME)
  952. (PROG (ITEM L)
  953. (ITEM_ (CAR TOP:PREVS))
  954. (IF ~TOP:PROPS AND (L_ (GEVEXPROP ITEM:VALUE ITEM:TYPE 'DISPLAYPROPS
  955. 'PROP
  956. NIL))
  957. ~='GEVERROR THEN (IF L IS ATOMIC THEN (GEVCOMMANDPROP ITEM
  958. 'PROP
  959. 'All)
  960. ELSEIF L IS A LIST THEN
  961. (FOR X IN L (GEVCOMMANDPROP ITEM 'PROP
  962. X)))
  963. ELSE
  964. (FOR X IN TOP:PROPS WHEN X:NODETYPE~='MSG DO
  965. (X:VALUE _ (GEVEXPROP ITEM:VALUE ITEM:TYPE X:NAME X:NODETYPE
  966. NIL))
  967. (X:SHORTVALUE _ NIL)))))
  968. % edited: 14-OCT-82 12:46
  969. % Re-expand the top item of GEVEDITCHAIN, which may have been changed
  970. % due to editing.
  971. (DG GEVREFILLWINDOW NIL
  972. (PROG (TOP TOPITEM SUBS TOPSUB)
  973. (TOP_GEVEDITCHAIN:TOPFRAME)
  974. (TOPITEM_GEVEDITCHAIN:TOPITEM)
  975. (TOPSUB_ (CAR TOP:SUBITEMS))
  976. (IF ~TOPSUB OR (TOPSUB:NODETYPE~='FULLVALUE AND TOPSUB:NODETYPE~='LISTOF)
  977. THEN
  978. (IF (GEVGETPROP TOPITEM:TYPE 'GEVDISPLAY
  979. 'MSG)
  980. THEN
  981. (TOP:SUBITEMS_ (LIST (A GSEITEM WITH VALUE = TOPITEM:VALUE TYPE
  982. = TOPITEM:TYPE NODETYPE = 'DISPLAY)))
  983. ELSE
  984. (SUBS_ (GEVMATCH TOPITEM:TYPE TOPITEM:VALUE T))
  985. (TOPSUB_ (CAR SUBS))
  986. (TOP:SUBITEMS_ (IF ~ (CDR SUBS)
  987. AND TOPSUB:NODETYPE='STRUCTURE AND
  988. TOPSUB:VALUE=TOPITEM:VALUE AND
  989. TOPSUB:TYPE=TOPITEM:TYPE THEN
  990. TOPSUB:SUBVALUES ELSE SUBS))))
  991. (GEVREDOPROPS TOP)
  992. (GEVFILLWINDOW)))
  993. % edited: 8-OCT-82 15:41
  994. (DE GEVSHORTATOMVAL (ATM NCHARS)
  995. (COND ((NUMBERP ATM)
  996. (COND ((GREATERP (FlatSize2 ATM)
  997. NCHARS)
  998. (GEVSHORTSTRINGVAL (MKSTRING ATM)
  999. NCHARS))
  1000. (T ATM)))
  1001. ((GREATERP (FlatSize2 ATM)
  1002. NCHARS)
  1003. (CONCAT (SUBSTRING ATM 1 (SUB1 NCHARS))
  1004. "-"))
  1005. (T ATM)))
  1006. % GSN 25-MAR-83 10:02
  1007. % Compute a short value for printing a CONS of two items.
  1008. (DG GEVSHORTCONSVAL (VAL STR NCHARS:INTEGER)
  1009. (PROG (NLEFT RES TMP NC)
  1010. (RES +_ "(")
  1011. (NLEFT _ NCHARS - 5)
  1012. (TMP_ (GEVSHORTVALUE (CAR VAL)
  1013. (CADR STR)
  1014. NLEFT - 3))
  1015. (NC_ (FlatSize2 TMP))
  1016. (IF NC>NLEFT - 3 THEN TMP_ "---" NC_3)
  1017. (RES+_ (GEVSTRINGIFY TMP))
  1018. (RES +_ " . ")
  1019. (NLEFT_-NC)
  1020. (TMP_ (GEVSHORTVALUE (CDR VAL)
  1021. (CADDR STR)
  1022. NLEFT))
  1023. (NC_ (FlatSize2 TMP))
  1024. (IF NC>NLEFT THEN TMP_ "---" NC_3)
  1025. (RES+_ (GEVSTRINGIFY TMP))
  1026. (RES+_ ")")
  1027. (RETURN (GEVCONCAT
  1028. (REVERSIP RES)))))
  1029. % GSN 25-MAR-83 10:03
  1030. % Compute a short value for printing a list of items.
  1031. (DG GEVSHORTLISTVAL (VAL STR NCHARS:INTEGER)
  1032. (PROG (NLEFT RES TMP QUIT NC NCI REST RSTR)
  1033. (RES +_ "(")
  1034. (REST_4)
  1035. (NLEFT _ NCHARS - 2)
  1036. (RSTR_ (CDR STR))
  1037. (WHILE VAL AND ~QUIT AND (NCI_ (IF (CDR VAL)
  1038. THEN NLEFT - REST ELSE NLEFT))
  1039. >2 DO (TMP_ (GEVSHORTVALUE (CAR VAL)
  1040. (IF (CAR STR)
  1041. ='LISTOF THEN (CADR STR)
  1042. ELSEIF
  1043. (CAR STR)
  1044. ='LIST THEN (CAR RSTR))
  1045. NCI))
  1046. (QUIT _ (MEMBER TMP '(GEVERROR "(...)" "---" "???")))
  1047. (NC_ (FlatSize2 TMP))
  1048. (IF NC>NCI AND (CDR RES)
  1049. THEN QUIT_T ELSE (IF NC>NCI THEN TMP_ "---" NC_3 QUIT_T)
  1050. (RES+_ (GEVSTRINGIFY TMP))
  1051. (NLEFT_-NC)
  1052. (VAL_ (CDR VAL))
  1053. (RSTR_ (CDR RSTR))
  1054. (IF VAL THEN (RES+_ " ")
  1055. (NLEFT_-1))))
  1056. (IF VAL THEN (RES+_ "..."))
  1057. (RES+_ ")")
  1058. (RETURN (GEVCONCAT
  1059. (REVERSIP RES)))))
  1060. % edited: 12-OCT-82 12:14
  1061. % Compute the short value of a string VAL. The result is a string
  1062. % which can be printed within NCHARS.
  1063. (DE GEVSHORTSTRINGVAL (VAL NCHARS)
  1064. (COND ((STRINGP VAL)
  1065. (GEVLENGTHBOUND VAL NCHARS))
  1066. (T "???")))
  1067. % edited: 11-MAR-83 15:34
  1068. % Compute the short value of a given value VAL whose type is STR. The
  1069. % result is an atom, string, or list structure which can be printed
  1070. % within NCHARS.
  1071. (DE GEVSHORTVALUE (VAL STR NCHARS)
  1072. (PROG (TMP)
  1073. (SETQ STR (GEVXTRTYPE STR))
  1074. (RETURN (COND ((AND (ATOM STR)
  1075. (MEMQ STR '(ATOM INTEGER REAL)))
  1076. (GEVSHORTATOMVAL VAL NCHARS))
  1077. ((EQ STR 'STRING)
  1078. (GEVSHORTSTRINGVAL VAL NCHARS))
  1079. ((AND (ATOM STR)
  1080. (NE (SETQ TMP (GEVEXPROP VAL STR 'SHORTVALUE
  1081. 'PROP
  1082. NIL))
  1083. 'GEVERROR))
  1084. (GEVLENGTHBOUND TMP NCHARS))
  1085. ((OR (ATOM VAL)
  1086. (NUMBERP VAL))
  1087. (GEVSHORTATOMVAL VAL NCHARS))
  1088. ((STRINGP VAL)
  1089. (GEVSHORTSTRINGVAL VAL NCHARS))
  1090. ((PAIRP STR)
  1091. (CASEQ (CAR STR)
  1092. ((LISTOF LIST)
  1093. (COND ((PAIRP VAL)
  1094. (GEVSHORTLISTVAL VAL STR NCHARS))
  1095. (T "???")))
  1096. (CONS (COND ((PAIRP VAL)
  1097. (GEVSHORTCONSVAL VAL STR NCHARS))
  1098. (T "???")))
  1099. (T "---")))
  1100. ((PAIRP VAL)
  1101. (GEVSHORTLISTVAL VAL '(LISTOF ANYTHING)
  1102. NCHARS))
  1103. (T "---")))))
  1104. % edited: 21-OCT-82 11:17
  1105. % Extract an atomic type name from a type spec which may be either
  1106. % <type> or (A <type>) .
  1107. (DE GEVXTRTYPE (TYPE)
  1108. (COND ((ATOM TYPE)
  1109. TYPE)
  1110. ((NOT (PAIRP TYPE))
  1111. NIL)
  1112. ((AND (MEMQ (CAR TYPE)
  1113. '(A AN a an An TRANSPARENT))
  1114. (CDR TYPE)
  1115. (ATOM (CADR TYPE)))
  1116. (CADR TYPE))
  1117. ((MEMQ (CAR TYPE)
  1118. GEVTYPENAMES)
  1119. TYPE)
  1120. ((AND (NOT (UNBOUNDP GLUSERSTRNAMES))
  1121. (ASSOC (CAR TYPE)
  1122. GLUSERSTRNAMES))
  1123. TYPE)
  1124. ((AND (ATOM (CAR TYPE))
  1125. (CDR TYPE))
  1126. (GEVXTRTYPE (CADR TYPE)))
  1127. (T (ERROR 0 (LIST 'GEVXTRTYPE
  1128. (LIST TYPE "is an illegal type specification.")))
  1129. NIL)))
  1130. (SETQ GEVTYPENAMES '(CONS LIST RECORD LISTOF ALIST ATOM OBJECT LISTOBJECT
  1131. ATOMOBJECT))