(FILECREATED "16-Jul-86 20:09:18" {QV}<NOTECARDS>1.3K>FGHPATCH095.;2 4498 changes to: (VARS FGHPATCH095COMS) (FNS NC.CardTypeLoader NC.AutoLoadCardType) previous date: "16-Jul-86 19:24:06" {QV}<NOTECARDS>1.3K>FGHPATCH095.;1) (* Copyright (c) 1986 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT FGHPATCH095COMS) (RPAQQ FGHPATCH095COMS ((* * Minor fixes to autoload of cvard types.) (FNS NC.AutoLoadCardType NC.CardTypeLoader))) (* * Minor fixes to autoload of cvard types.) (DEFINEQ (NC.AutoLoadCardType (LAMBDA (TypeName FieldName FileSuggestion) (* fgh: "16-Jul-86 19:22") (* * AutoLoad card type TypeName using FileSuggestion as the first place to look. Otherwise look in the directories specified by NoteCardsDirectories. Works by starting at the give Type and moving up the inheritance heirarchy loading all types that are currently defined only by stubs until it reaches a card type for which FieldName is defined. This works because full inheritance is done whereever possible during type definition in NC.AddCardType.) (* * fgh 2/3/86 First created.) (* * fgh 7/16/86 Added ALLOW.BUTTON.EVENTS call) (ALLOW.BUTTON.EVENTS) (LET ((CardTypeRecord (NC.CardTypeRecord TypeName)) (OriginalTypeName TypeName) FieldValue) (* * If there's no stub for this card type, load the type definition file.) (if (NULL CardTypeRecord) then (NC.CardTypeLoader TypeName FileSuggestion) (* * Still no definition then we're sunk.) (if (NULL (SETQ CardTypeRecord (NC.CardTypeRecord TypeName))) then (NC.ReportError NIL (CONCAT "Cannot find definition of card type: " TypeName)))) (* * We have at least a stub for this card type. Move up the inheritance hierarchy loading the real files instead of the stubs until we have a value of the field we are looking for.) (until (EQ TypeName (QUOTE NoteCard)) do (* * If this is a stub, load the real thing. Break if it can't be found.) (if (fetch (NoteCardType StubFlg) of CardTypeRecord) then (OR (NC.CardTypeLoader TypeName FileSuggestion) (NC.ReportError NIL (CONCAT "Cannot find full definition of card type: " TypeName))) (SETQ CardTypeRecord (NC.CardTypeRecord TypeName))) (* * If the field was defined in the real thing, then return it. Else keep moving up load ing all the stubs.) (if (SETQ FieldValue (RECORDACCESS (BQUOTE (NoteCardType , FieldName)) CardTypeRecord NIL (QUOTE fetch))) then (RETURN FieldValue) else (SETQ TypeName (fetch (NoteCardType SuperType) of CardTypeRecord)) (SETQ CardTypeRecord (NC.CardTypeRecord TypeName))) finally (NC.ReportError NIL (CONCAT "Cannot find definition of card type: " OriginalTypeName " Field name needed: " FieldName)))))) (NC.CardTypeLoader (LAMBDA (TypeName FileSuggestion) (* fgh: "16-Jul-86 19:34") (* * Load card type TypeName using FileSuggestion as the first place to look. Otherwise look in the directories specified by NoteCardsDirectories.) (* * fgh 2/3/86 First written.) (* * kirk 1Jul86 Added new process.) (* * kirk 15Jul86 Removed new process and added FGH's RESETLST to close stream.) (* * fgh 7/16/86 Added PRINTOUT to inform user before find file begins.) (RESETLST (RESETSAVE NIL (if (OPENWP (WFROMDS (TTYDISPLAYSTREAM) T)) then (QUOTE (NILL)) else (BQUOTE (CLOSEW , (WFROMDS (TTYDISPLAYSTREAM)))))) (LET (FullFileName (Window (WFROMDS (TTYDISPLAYSTREAM)))) (CLEARW Window) (FLASHWINDOW Window) (PRINTOUT Window "Card type " TypeName " not loaded." T "Attempting to autoload." T) (SETQ FullFileName (NC.FindCardTypeFile TypeName FileSuggestion)) (AND FullFileName (LOAD? FullFileName NC.LOADFLG)))))) ) (PUTPROPS FGHPATCH095 COPYRIGHT ("Xerox Corporation" 1986)) (DECLARE: DONTCOPY (FILEMAP (NIL (534 4416 (NC.AutoLoadCardType 544 . 3211) (NC.CardTypeLoader 3213 . 4414))))) STOP