(FILECREATED " 9-Nov-84 17:00:49" {PHYLUM}<PSA>NOTECARDS>RELEASE1.1>NCTYPESMECH.;6 15840  

      changes to:  (FNS NC.MakeCardTypesList)

      previous date: " 6-Nov-84 19:29:53" {PHYLUM}<PSA>NOTECARDS>RELEASE1.1>NCTYPESMECH.;5)


(* Copyright (c) 1984 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT NCTYPESMECHCOMS)

(RPAQQ NCTYPESMECHCOMS ((* * Internal variables)
	(GLOBALVARS NC.CardTypes NC.SubstanceTypes)
	(* * Note Cards Type Mechanism)
	(RECORDS NoteCardType SubstanceType)
	(MACROS NC.Inherit)
	(FNS NC.SubstanceCopyFn NC.MakeSubstanceTypesList NC.MakeCardTypesList NC.MarkCardDirtyFn 
	     NC.AddSubstanceType NC.AddCardType NC.ListOfCardTypes NC.CollectReferencesFn 
	     NC.DelReferencesFn NC.EditFn NC.GetSubstanceFn NC.MakeCardFn NC.PutSubstanceFn 
	     NC.QuitCardFn NC.UpdateLinkIconsFn NC.SubstanceDirtyPFn NC.SubstanceMarkDirtyFn)
	(P (NC.MakeSubstanceTypesList)
	   (NC.MakeCardTypesList))))
(* * Internal variables)

(DECLARE: DOEVAL@COMPILE DONTCOPY

(GLOBALVARS NC.CardTypes NC.SubstanceTypes)
)
(* * Note Cards Type Mechanism)

[DECLARE: EVAL@COMPILE 

(RECORD NoteCardType (TypeName SuperType SubstanceType MakeCardFn EditCardFn QuitCardFn GetCardFn 
			       PutCardFn CopyCardFn MarkCardDirtyFn CardDirtyPFn CollectLinksInCardFn 
			       DeleteLinksInCardFn UpdateLinkIconsInCardFn LinkDisplayMode))

(RECORD SubstanceType (SubstanceName CreateSubstanceFn EditSubstanceFn QuitSubstanceFn GetSubstanceFn 
				     PutSubstanceFn CopySubstanceFn MarkSubstanceDirtyFn 
				     SubstanceDirtyPFn CollectLinksInSubstanceFn 
				     DeleteLinksInSubstanceFn UpdateLinkIconsInSubstanceFn))
]
(DECLARE: EVAL@COMPILE 

(PUTPROPS NC.Inherit MACRO ((NC.Fn CardFn SubstanceFn CardTypeVariableName)
	   (PROG (SaveCardType (AtomCardType (COND
					       ((NLISTP CardTypeVariableName)
						 CardTypeVariableName)
					       (T (CAR CardTypeVariableName)))))
	         (RETURN (OR (for CardType in NC.CardTypes when (EQ AtomCardType (fetch (NoteCardType
											  TypeName)
										    of CardType))
				do (SETQ SaveCardType CardType)
				   (RETURN (OR (fetch (NoteCardType CardFn) of CardType)
					       (AND (fetch (NoteCardType SuperType) of CardType)
						    (NC.Fn (LIST (fetch (NoteCardType SuperType)
								    of CardType))))))
				finally (NC.ReportError (MKSTRING (QUOTE NC.Fn))
							(CONCAT "Unknown note card type:  " 
								NoteCardType ".")))
			     (AND (NLISTP CardTypeVariableName)
				  (fetch (SubstanceType SubstanceFn)
				     of (for SubstanceType in NC.SubstanceTypes
					   when (EQ (fetch (NoteCardType SubstanceType) of 
										     SaveCardType)
						    (fetch (SubstanceType SubstanceName)
						       of SubstanceType))
					   do (RETURN SubstanceType)))))))))
)
(DEFINEQ

(NC.SubstanceCopyFn
  (LAMBDA (NoteCardType)                                     (* fgh: "19-Oct-84 11:57")

          (* * Return the function that does a byte-wise copy of NoteCardType substance from one stream to another.)


    (NC.Inherit NC.SubstanceCopyFn CopyCardFn CopySubstanceFn NoteCardType)))

(NC.MakeSubstanceTypesList
  (LAMBDA NIL                                                (* fgh: " 6-Nov-84 18:20")

          (* * Make the initial list of substance types.)


    (SETQ NC.SubstanceTypes NIL)
    (NC.AddSubstanceType (QUOTE TEXT)
			 (FUNCTION OPENTEXTSTREAM)
			 (FUNCTION NC.BringUpTEditCard)
			 (FUNCTION NC.TEditCloseFn)
			 (FUNCTION NC.GetTextSubstance)
			 (FUNCTION NC.PutTextSubstance)
			 (FUNCTION NC.TextCopySubstance)
			 (FUNCTION NC.MarkTextDirty)
			 (FUNCTION NC.TextDirtyP)
			 (FUNCTION NC.CollectReferencesInText)
			 (FUNCTION NC.DelReferencesToCardFromText)
			 (FUNCTION NC.UpdateLinkImagesInText))
    (NC.AddSubstanceType (QUOTE GRAPH)
			 (FUNCTION (LAMBDA NIL
			     (create GRAPH)))
			 (FUNCTION NC.BringUpGraphCard)
			 (FUNCTION NC.GraphCardCloseFn)
			 (FUNCTION NC.GetGraphSubstance)
			 (FUNCTION NC.PutGraphSubstance)
			 (FUNCTION NC.GraphCopySubstance)
			 (FUNCTION NC.MarkGraphDirty)
			 (FUNCTION NC.GraphDirtyP)
			 (FUNCTION NC.CollectReferencesInGraph)
			 (FUNCTION NC.DelReferencesToCardFromGraph)
			 (FUNCTION NC.UpdateLinkImagesInGraph))
    (NC.AddSubstanceType (QUOTE SKETCH)
			 (FUNCTION (LAMBDA NIL
			     (create SKETCH)))
			 (FUNCTION NC.BringUpSketchCard)
			 (FUNCTION NC.SketchCardCloseFn)
			 (FUNCTION (LAMBDA (Stream ID Region)
			     (PROG ((Value (NC.GetSketchSubstance Stream)))
			           (NC.SetScale ID (CADR Value))
			           (NC.SetRegionViewed ID (CADDR Value))
			           (RETURN (CAR Value)))))
			 (FUNCTION NC.PutSketchSubstance)
			 (FUNCTION NC.SketchCopySubstance)
			 (FUNCTION NC.MarkSketchDirty)
			 (FUNCTION NC.SketchDirtyP)
			 (FUNCTION NC.CollectReferencesInSketch)
			 (FUNCTION NC.DelReferencesToCardFromSketch)
			 (FUNCTION NC.UpdateLinkImagesInSketch))))

(NC.MakeCardTypesList
  (LAMBDA NIL                                                (* rht: " 9-Nov-84 10:40")

          (* * Make initial set of card types.)


    (SETQ NC.CardTypes (LIST (create NoteCardType
				     TypeName ←(QUOTE NoteCard)
				     SuperType ← NIL
				     SubstanceType ← NIL
				     MakeCardFn ← NIL
				     EditCardFn ← NIL
				     QuitCardFn ← NIL
				     GetCardFn ← NIL
				     PutCardFn ← NIL
				     CopyCardFn ← NIL
				     MarkCardDirtyFn ← NIL
				     CardDirtyPFn ← NIL
				     CollectLinksInCardFn ← NIL
				     DeleteLinksInCardFn ← NIL
				     UpdateLinkIconsInCardFn ← NIL
				     LinkDisplayMode ←(QUOTE Icon))))
    (NC.AddCardType (QUOTE Text)
		    (QUOTE NoteCard)
		    (QUOTE TEXT)
		    (FUNCTION NC.MakeTEditCard)
		    NIL
		    (FUNCTION NC.TEditCloseFn)
		    NIL NIL NIL NIL NIL NIL NIL NIL (QUOTE Icon))
    (NC.AddCardType (QUOTE Graph)
		    (QUOTE NoteCard)
		    (QUOTE GRAPH)
		    (FUNCTION NC.MakeGraphCard)
		    NIL
		    (FUNCTION NC.GraphCardCloseFn)
		    NIL NIL NIL NIL NIL NIL NIL NIL (QUOTE Title))
    (NC.AddCardType (QUOTE Sketch)
		    (QUOTE NoteCard)
		    (QUOTE SKETCH)
		    (FUNCTION NC.MakeSketchCard)
		    NIL
		    (FUNCTION NC.SketchCardCloseFn)
		    NIL NIL NIL NIL NIL NIL NIL NIL (QUOTE Icon))
    (NC.AddCardType (QUOTE FileBox)
		    (QUOTE Text)
		    (QUOTE TEXT)
		    (FUNCTION NC.MakeContentsCard)
		    NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL (QUOTE Title))
    (NC.AddCardType (QUOTE Browser)
		    (QUOTE Graph)
		    (QUOTE GRAPH)
		    (FUNCTION NC.MakeBrowserCard)
		    (FUNCTION NC.BringUpBrowserCard)
		    NIL NIL NIL NIL NIL NIL NIL NIL NIL (QUOTE Title))
    (NC.AddCardType (QUOTE Search)
		    (QUOTE Text)
		    (QUOTE TEXT)
		    (FUNCTION NC.MakeSearchCard)
		    NIL NIL NIL NIL NIL NIL NIL NIL (QUOTE Title))
    (NC.AddCardType (QUOTE LinkIndex)
		    (QUOTE Text)
		    (QUOTE TEXT)
		    (FUNCTION NC.MakeLinkIndex)
		    NIL NIL NIL NIL NIL NIL NIL NIL (QUOTE Title))
    (NC.AddCardType (QUOTE Document)
		    (QUOTE Text)
		    (QUOTE TEXT)
		    (FUNCTION NC.MakeDocument)
		    NIL NIL NIL NIL NIL NIL NIL NIL (QUOTE Icon))
    (SETQ NC.NoteCardTypeMenu)))

(NC.MarkCardDirtyFn
  (LAMBDA (NoteCardType)                                     (* fgh: "22-Oct-84 12:41")

          (* * Return the fuinction that marks a card of type NoteCardType dirty.)


    (NC.Inherit NC.MarkCardDirtyFn MarkCardDirtyFn MarkSubstanceDirtyFn NoteCardType)))

(NC.AddSubstanceType
  (LAMBDA (SubstanceName CreateSubstanceFn EditSubstanceFn QuitSubstanceFn GetSubstanceFn 
			 PutSubstanceFn CopySubstanceFn MarkSubstanceDirtyFn SubstanceDirtyPFn 
			 CollectLinksInSubstanceFn DeleteLinksInSubstanceFn 
			 UpdateLinkIconsInSubstanceFn)       (* fgh: "28-Oct-84 23:55")

          (* * Add a substance ttype to the lists of substance types.)


    (PROG (NewType)
          (COND
	    ((NULL SubstanceName)
	      (NC.ReportError "NC.AddSubstanceType" "Illegal substance type name: NIL")))

          (* * Remove old instance of SubstanceType)


          (FOR SubstanceType in NC.SubstanceTypes when (EQ (fetch (SubstanceType SubstanceName)
							      of SubstanceType)
							   SubstanceName)
	     do (SETQ NC.SubstanceTypes (REMOVE SubstanceType NC.SubstanceTypes)))

          (* * Add new SubstanceType to NC.SubstanceTypes list)


          (SETQ NC.SubstanceTypes
	    (CONS (SETQ NewType
		    (create SubstanceType
			    SubstanceName ← SubstanceName
			    CreateSubstanceFn ← CreateSubstanceFn
			    EditSubstanceFn ← EditSubstanceFn
			    QuitSubstanceFn ← QuitSubstanceFn
			    GetSubstanceFn ← GetSubstanceFn
			    PutSubstanceFn ← PutSubstanceFn
			    CopySubstanceFn ← CopySubstanceFn
			    MarkSubstanceDirtyFn ← MarkSubstanceDirtyFn
			    SubstanceDirtyPFn ← SubstanceDirtyPFn
			    CollectLinksInSubstanceFn ← CollectLinksInSubstanceFn
			    DeleteLinksInSubstanceFn ← DeleteLinksInSubstanceFn
			    UpdateLinkIconsInSubstanceFn ← UpdateLinkIconsInSubstanceFn))
		  NC.SubstanceTypes))
          (RETURN NewType))))

(NC.AddCardType
  (LAMBDA (TypeName SuperType SubstanceType MakeCardFn EditCardFn QuitCardFn GetCardFn PutCardFn 
		    CopyCardFn MarkCardDirtyFn CardDirtyPFn CollectLinksInCardFn DeleteLinksInCardFn 
		    UpdateLinkIconsInCardFn LinkDisplayMode)
                                                             (* fgh: "28-Oct-84 23:54")

          (* * Create a new note acrd type and link it into the card type heirarchy.)


    (PROG (NewType)
          (COND
	    ((NULL TypeName)
	      (NC.ReportError "NC.AddCardType" "Illegal type name: NIL"))
	    ((for Type in NC.CardTypes never (EQ (fetch (NoteCardType TypeName) of Type)
						 SuperType))
	      (NC.ReportError "NC.AddCardType" (CONCAT "Unknown type in super type field:  " 
						       SuperType)))
	    ((for Substance in NC.SubstanceTypes never (EQ SubstanceType (fetch (SubstanceType 
										    SubstanceName)
									    of Substance)))
	      (NC.ReportError "NC.AddCardType" (CONCAT "Unknown substance type field:  " 
						       SubstanceType))))

          (* * Remove old instance of this NoteCardType)


          (for CardType in NC.CardTypes when (EQ (fetch (NoteCardType TypeName) of CardType)
						 TypeName)
	     do (SETQ NC.CardTypes (REMOVE CardType NC.CardTypes)))

          (* * Create new NoteCardType)


          (SETQ NC.CardTypes
	    (NCONC1 NC.CardTypes
		    (SETQ NewType
		      (create NoteCardType
			      TypeName ← TypeName
			      SuperType ← SuperType
			      SubstanceType ← SubstanceType
			      MakeCardFn ← MakeCardFn
			      EditCardFn ← EditCardFn
			      QuitCardFn ← QuitCardFn
			      GetCardFn ← GetCardFn
			      PutCardFn ← PutCardFn
			      CopyCardFn ← CopyCardFn
			      MarkCardDirtyFn ← MarkCardDirtyFn
			      CardDirtyPFn ← CardDirtyPFn
			      CollectLinksInCardFn ← CollectLinksInCardFn
			      DeleteLinksInCardFn ← DeleteLinksInCardFn
			      UpdateLinkIconsInCardFn ← UpdateLinkIconsInCardFn
			      LinkDisplayMode ← LinkDisplayMode))))
          (SETQ NC.NoteCardTypeMenu)
          (RETURN NewType))))

(NC.ListOfCardTypes
  (LAMBDA NIL                                                (* fgh: "23-Oct-84 15:41")

          (* * Return a list of the note card types)



          (* * Special processing for older types to make them not all caps.)


    (bind TypeName for CardType in NC.CardTypes when (AND CardType (NEQ (SETQ TypeName
									  (fetch (NoteCardType 
											 TypeName)
									     of CardType))
									(QUOTE NoteCard)))
       collect TypeName)))

(NC.CollectReferencesFn
  (LAMBDA (NoteCardType)                                     (* fgh: "19-Oct-84 12:02")

          (* * Return the function that will collect the links in a substance of NoteCardType)


    (NC.Inherit NC.CollectReferencesFn CollectLinksInCardFn CollectLinksInSubstanceFn NoteCardType)))

(NC.DelReferencesFn
  (LAMBDA (NoteCardType)                                     (* fgh: "19-Oct-84 12:03")

          (* * Return the function that deletes references to a card from another card of a given type.)


    (NC.Inherit NC.DelReferencesFn DeleteLinksInCardFn DeleteLinksInSubstanceFn NoteCardType)))

(NC.EditFn
  (LAMBDA (NoteCardType)                                     (* fgh: "18-Oct-84 23:03")

          (* * Return the function to call the editor on substances of type NoteCardtype)


    (NC.Inherit NC.EditFn EditCardFn EditSubstanceFn NoteCardType)))

(NC.GetSubstanceFn
  (LAMBDA (NoteCardType)                                     (* fgh: "18-Oct-84 23:11")

          (* * Return the funcion for getting the substance of NoteCardType from a databasestream)


    (NC.Inherit NC.GetSubstanceFn GetCardFn GetSubstanceFn NoteCardType)))

(NC.MakeCardFn
  (LAMBDA (NoteCardType)                                     (* fgh: "19-Oct-84 11:48")

          (* * Return the function that will make a the type specific part of cards of NoteCardType.)


    (NC.Inherit NC.MakeCardFn MakeCardFn CreateSubstanceFn NoteCardType)))

(NC.PutSubstanceFn
  (LAMBDA (NoteCardType)                                     (* fgh: "19-Oct-84 16:20")

          (* * Return the Put Substance Fn for NoteCardType)


    (NC.Inherit NC.PutSubstanceFn PutCardFn PutSubstanceFn NoteCardType)))

(NC.QuitCardFn
  (LAMBDA (NoteCardType)                                     (* fgh: "22-Oct-84 12:31")

          (* * Return the function that foreces a note card of NoteCardType to quit or stop)


    (NC.Inherit NC.QuitCardFn QuitCardFn QuitSubstanceFn NoteCardType)))

(NC.UpdateLinkIconsFn
  (LAMBDA (NoteCardType)                                     (* fgh: "24-Oct-84 18:36")

          (* * Return the function for updating the link icons in a card of NoteCardType)


    (NC.Inherit NC.UpdateLinkIconsFn UpdateLinkIconsInCardFn UpdateLinkIconsInSubstanceFn 
		NoteCardType)))

(NC.SubstanceDirtyPFn
  (LAMBDA (NoteCardType)                                     (* fgh: "19-Oct-84 11:58")

          (* * Return the function that determines DirtyP for the substance of NoteCardType)


    (NC.Inherit NC.SubstanceDirtyPFn CardDirtyPFn SubstanceDirtyPFn NoteCardType)))

(NC.SubstanceMarkDirtyFn
  (LAMBDA (NoteCardType)                                     (* fgh: "12-Oct-84 23:12")

          (* * Return the function that marks a or unamrks card of NoteCardType dirty)


    (COND
      ((NC.TeditBasedP NoteCardType)
	(FUNCTION NC.MarkTextDirty))
      ((NC.SketchBasedP NoteCardType)
	(FUNCTION NC.MarkSketchDirty))
      ((NC.GrapherBasedP NoteCardType)
	(FUNCTION NC.MarkGraphDirty))
      (T (NC.ReportError "NC.SubstanceMarkDirtyFn" (CONCAT NoteCardType ":  Unknown note card type."))
	 ))))
)
(NC.MakeSubstanceTypesList)
(NC.MakeCardTypesList)
(PUTPROPS NCTYPESMECH COPYRIGHT ("Xerox Corporation" 1984))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (2963 15707 (NC.SubstanceCopyFn 2973 . 3290) (NC.MakeSubstanceTypesList 3292 . 5280) (
NC.MakeCardTypesList 5282 . 7717) (NC.MarkCardDirtyFn 7719 . 8012) (NC.AddSubstanceType 8014 . 9695) (
NC.AddCardType 9697 . 11910) (NC.ListOfCardTypes 11912 . 12441) (NC.CollectReferencesFn 12443 . 12766)
 (NC.DelReferencesFn 12768 . 13091) (NC.EditFn 13093 . 13365) (NC.GetSubstanceFn 13367 . 13662) (
NC.MakeCardFn 13664 . 13958) (NC.PutSubstanceFn 13960 . 14217) (NC.QuitCardFn 14219 . 14502) (
NC.UpdateLinkIconsFn 14504 . 14827) (NC.SubstanceDirtyPFn 14829 . 15130) (NC.SubstanceMarkDirtyFn 
15132 . 15705)))))
STOP