From cbf816fc5d64677c1839d94f854c1b4abfbba85a Mon Sep 17 00:00:00 2001 From: Matt Heffron Date: Wed, 1 Oct 2025 22:23:02 -0700 Subject: [PATCH] Add error check for creating a MENU with empty ITEMS. There might be cases where a MENU is constructed incrementally, starting with an empty ITEMS list. This change will break that situation! (My first thought was to default the ITEMS to (LIST "*** Empty MENU!! ***"). That felt like a hack solution.) --- sources/MENU | 57 +++++++++++++++++++++++++--------------------- sources/MENU.LCOM | Bin 27793 -> 27812 bytes 2 files changed, 31 insertions(+), 26 deletions(-) diff --git a/sources/MENU b/sources/MENU index e6706c076..0e0ca1aba 100644 --- a/sources/MENU +++ b/sources/MENU @@ -1,13 +1,12 @@ (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10) -(FILECREATED "14-Jul-2025 22:35:12" {DSK}kaplan>Local>medley3.5>working-medley>sources>MENU.;3 101431 +(FILECREATED " 1-Oct-2025 22:02:40" {DSK}matt>Interlisp>medley>sources>MENU.;7 101963 - :EDIT-BY rmk + :EDIT-BY "mth" - :CHANGES-TO (FNS MENUTITLEFONT UPDATE/MENU/IMAGE) + :CHANGES-TO (RECORDS MENU) - :PREVIOUS-DATE "16-Jul-99 15:51:36" -{DSK}kaplan>Local>medley3.5>working-medley>sources>MENU.;1) + :PREVIOUS-DATE "14-Jul-2025 22:35:12" {DSK}matt>Interlisp>medley>sources>MENU.;1) (PRETTYCOMPRINT MENUCOMS) @@ -1664,7 +1663,13 @@ MENUGRID _ (create REGION LEFT _ 0 BOTTOM _ 0) - WHENHELDFN _ 'DEFAULTMENUHELDFN WHENUNHELDFN _ 'CLRPROMPT + WHENHELDFN _ 'DEFAULTMENUHELDFN WHENUNHELDFN _ 'CLRPROMPT (CREATE (COND + ((ZEROP (LENGTH ITEMS) + ) + (ERROR 'MENU + "ITEMS list is empty" + )) + (T DATUM))) [ACCESSFNS ((ITEMWIDTH (fetch (REGION WIDTH) of (fetch (MENU MENUGRID) of DATUM)) (replace (REGION WIDTH) of (fetch (MENU MENUGRID) of DATUM) with NEWVALUE @@ -1710,24 +1715,24 @@ (MENU 42 POINTER)) '44) (DECLARE%: DONTCOPY - (FILEMAP (NIL (2583 86884 (MAXMENUITEMHEIGHT 2593 . 3530) (MAXMENUITEMWIDTH 3532 . 5231) (MENU 5233 . -8130) (MENUTITLEFONT 8132 . 9572) (ADDMENU 9574 . 15012) (DELETEMENU 15014 . 16495) (MENUREGION 16497 - . 17357) (BLTMENUIMAGE 17359 . 19387) (ERASEMENUIMAGE 19389 . 20311) (DEFAULTMENUHELDFN 20313 . 20603 -) (DEFAULTWHENSELECTEDFN 20605 . 21016) (BACKGROUNDWHENSELECTEDFN 21018 . 21453) (GETMENUITEM 21455 . -22044) (MENUBUTTONFN 22046 . 22677) (MENU.HANDLER 22679 . 40781) (DOSELECTEDITEM 40783 . 41208) ( -SHOWSHADEDITEMS 41210 . 42627) (\AddShade 42629 . 43821) (\DelShade 43823 . 44094) (\FDECODE/BUTTON -44096 . 44483) (MENUITEMREGION 44485 . 47220) (\MENUITEMLABEL 47222 . 47568) (\MENUSUBITEMS 47570 . -47808) (CHECK/MENU/IMAGE 47810 . 49816) (PPROMPT2 49818 . 50207) (UPDATE/MENU/IMAGE 50209 . 65643) ( -\MAKE.ITEMS.VERT.ORDER 65645 . 67172) (\SHOWMENULABEL 67174 . 71101) (\POSITION.MENU.IMAGE 71103 . -73958) (\SMASHMENUIMAGEONRESET 73960 . 74308) (CLOSE.PROCESS.MENU 74310 . 74492) (DEFAULTSUBITEMFN -74494 . 75214) (GETMENUPROP 75216 . 75408) (PUTMENUPROP 75410 . 75783) (WAKE.MY.PROCESS 75785 . 75968) - (\INVERTITEM 75970 . 76426) (\MENU.ITEM.SELECT 76428 . 77991) (\MENU.ITEM.DESELECT 77993 . 78695) ( -\ItemNumber 78697 . 79264) (\BOXITEM 79266 . 80813) (NESTED.SUBMENU 80815 . 83533) (NESTED.SUBMENU.POS - 83535 . 86506) (WFROMMENU 86508 . 86882)) (88093 88513 (MENUREPAINTFN 88103 . 88511)) (88548 91597 ( -MAXSTRINGWIDTH 88558 . 88801) (CENTEREDPRIN1 88803 . 89240) (CENTERPRINTINREGION 89242 . 89771) ( -CENTERPRINTINAREA 89773 . 91230) (STRICTLY/BETWEEN 91232 . 91595)) (91631 97573 (UNREADITEM 91641 . -91963) (TYPEINMENU 91965 . 92166) (SHADEITEM 92168 . 93912) (RESHADEITEM 93914 . 95007) ( -MOST/VISIBLE/OPERATION 95009 . 95280) (%#BITSON 95282 . 96000) (BUTTONPANEL 96002 . 96794) ( -BUTTONPANEL/SELECTION/FN 96796 . 97348) (GETSELECTEDITEMS 97350 . 97571)) (97889 98430 (MENUDESELECT -97899 . 98116) (MENUSELECT 98118 . 98428))))) + (FILEMAP (NIL (2529 86830 (MAXMENUITEMHEIGHT 2539 . 3476) (MAXMENUITEMWIDTH 3478 . 5177) (MENU 5179 . +8076) (MENUTITLEFONT 8078 . 9518) (ADDMENU 9520 . 14958) (DELETEMENU 14960 . 16441) (MENUREGION 16443 + . 17303) (BLTMENUIMAGE 17305 . 19333) (ERASEMENUIMAGE 19335 . 20257) (DEFAULTMENUHELDFN 20259 . 20549 +) (DEFAULTWHENSELECTEDFN 20551 . 20962) (BACKGROUNDWHENSELECTEDFN 20964 . 21399) (GETMENUITEM 21401 . +21990) (MENUBUTTONFN 21992 . 22623) (MENU.HANDLER 22625 . 40727) (DOSELECTEDITEM 40729 . 41154) ( +SHOWSHADEDITEMS 41156 . 42573) (\AddShade 42575 . 43767) (\DelShade 43769 . 44040) (\FDECODE/BUTTON +44042 . 44429) (MENUITEMREGION 44431 . 47166) (\MENUITEMLABEL 47168 . 47514) (\MENUSUBITEMS 47516 . +47754) (CHECK/MENU/IMAGE 47756 . 49762) (PPROMPT2 49764 . 50153) (UPDATE/MENU/IMAGE 50155 . 65589) ( +\MAKE.ITEMS.VERT.ORDER 65591 . 67118) (\SHOWMENULABEL 67120 . 71047) (\POSITION.MENU.IMAGE 71049 . +73904) (\SMASHMENUIMAGEONRESET 73906 . 74254) (CLOSE.PROCESS.MENU 74256 . 74438) (DEFAULTSUBITEMFN +74440 . 75160) (GETMENUPROP 75162 . 75354) (PUTMENUPROP 75356 . 75729) (WAKE.MY.PROCESS 75731 . 75914) + (\INVERTITEM 75916 . 76372) (\MENU.ITEM.SELECT 76374 . 77937) (\MENU.ITEM.DESELECT 77939 . 78641) ( +\ItemNumber 78643 . 79210) (\BOXITEM 79212 . 80759) (NESTED.SUBMENU 80761 . 83479) (NESTED.SUBMENU.POS + 83481 . 86452) (WFROMMENU 86454 . 86828)) (88039 88459 (MENUREPAINTFN 88049 . 88457)) (88494 91543 ( +MAXSTRINGWIDTH 88504 . 88747) (CENTEREDPRIN1 88749 . 89186) (CENTERPRINTINREGION 89188 . 89717) ( +CENTERPRINTINAREA 89719 . 91176) (STRICTLY/BETWEEN 91178 . 91541)) (91577 97519 (UNREADITEM 91587 . +91909) (TYPEINMENU 91911 . 92112) (SHADEITEM 92114 . 93858) (RESHADEITEM 93860 . 94953) ( +MOST/VISIBLE/OPERATION 94955 . 95226) (%#BITSON 95228 . 95946) (BUTTONPANEL 95948 . 96740) ( +BUTTONPANEL/SELECTION/FN 96742 . 97294) (GETSELECTEDITEMS 97296 . 97517)) (97835 98376 (MENUDESELECT +97845 . 98062) (MENUSELECT 98064 . 98374))))) STOP diff --git a/sources/MENU.LCOM b/sources/MENU.LCOM index 4f37be6b595b3405e406d8996704c4b177b53a18..775399338c5747d1ab3fc5dbbd38e286fdfb054d 100644 GIT binary patch delta 1533 zcmaJ>OOM-B6eby_5?Mhjp0hc!MCGVWlMQ8Y<>lXxbvgY8VFfI18rGmgk(n7E4y zp{$TV>Vnq%0>pw9Ogj==#EP+6 zn*k}<{jeYkq5`5=62y{BIN-VdWOOtb`Ufx>0|%cN?)Il|1(T6q9_@!=*&K)d@o+Fb zDv$hwp?{}5o!ma|`_popS>56dEe|>Fd}V@_X-QH!_~6)ImhK1pv+q zhcLiy^=_*L=d+8&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