(DEFINE-FILE-INFO PACKAGE "IL" READTABLE "INTERLISP" BASE 10)
(FILECREATED "13-Oct-88 19:42:24" {QV}<NOTECARDS>1.3MNEXT>NCLISTCARD.;1 6281   

      previous date%: "19-Jan-88 17:01:26" {QV}<NOTECARDS>1.3LNEXT>NCLISTCARD.;3)


(* "
Copyright (c) 1985, 1986, 1987, 1988 by Xerox Corporation.  All rights reserved.
")

(PRETTYCOMPRINT NCLISTCARDCOMS)

(RPAQQ NCLISTCARDCOMS (

(* ;;; "The list card -- just a Lisp list stored on the file!")

                           (FNS NCAddStub.ListCard)
                           (FNS NC.AddListCard NC.ListCardCopyFn NC.ListCardCreateFn 
                                NC.ListCardEditFn NC.ListCardGetFn NC.ListCardPutFn 
                                NC.EvaluateListCardSubstance)
                           (DECLARE%: DONTEVAL@LOAD (P (NC.AddListCard)))
                           (PROP (FILETYPE MAKEFILE-ENVIRONMENT)
                                 NCLISTCARD)))



(* ;;; "The list card -- just a Lisp list stored on the file!")

(DEFINEQ

(NCAddStub.ListCard
  (LAMBDA NIL                                                (* kirk%: "19-Jun-86 20:52")
          
          (* * kirk 18Jun86 Add the text card stub)

    (NC.AddCardTypeStub 'List 'NoteCard 'NCLISTCARD)))
)
(DEFINEQ

(NC.AddListCard
  (LAMBDA NIL                                                (* ; "Edited  3-Dec-87 19:02 by rht:")
          
          (* * rht 7/14/86%: No longer has a QuitFn.)

    (NC.AddCardType 'List 'NoteCard `((MakeFn ,(FUNCTION NC.ListCardCreateFn))
                                      (EditFn ,(FUNCTION NC.ListCardEditFn))
                                      (GetFn ,(FUNCTION NC.ListCardGetFn))
                                      (PutFn ,(FUNCTION NC.ListCardPutFn))
                                      (CopyFn ,(FUNCTION NC.ListCardCopyFn))
                                      (MarkDirtyFn ,(FUNCTION NILL))
                                      (DirtyPFn ,(FUNCTION NILL))
                                      (QuitFn ,(FUNCTION NILL))) '((LinkAnchorModesSupported NIL)))))

(NC.ListCardCopyFn
  (LAMBDA (Card FromStream ToStream Length)                  (* fgh%: "21-Nov-85 21:11")
          
          (* * Copy a list substance from FromStream to ToStream.)
          
          (* * Copy the bytes,)
          
          (* * fgh |11/20/85| NoteCards now handles the start and end ptrs --
          passing the from ptrs as args and properly setting the to ptrs.)
          
          (* * fgh |11/21/85| Now passes length instead of start and end ptrs.)

    (LET* ((FromStartPtr (GETFILEPTR FromStream))
           (FromEndPtr (PLUS Length FromStartPtr)))
          (COPYBYTES FromStream ToStream FromStartPtr FromEndPtr))
    T))

(NC.ListCardCreateFn
  (LAMBDA (Card Title NoDisplayFlg InitialSetting)           (* fgh%: "17-Nov-85 15:59")
          
          (* * Make a list substance.)

    (NC.SetSubstance Card InitialSetting)
    Card))

(NC.ListCardEditFn
  (LAMBDA NIL                                                (* fgh%: "14-Nov-85 00:51")
    (NC.ReportError NIL "Cannot edit a list substance")))

(NC.ListCardGetFn
  (LAMBDA (Card Length Stream)                               (* rht%: " 1-Nov-86 15:57")
          
          (* * Get the list substance from the disk)
          
          (* * fgh |11/20/85| NoteCards now passes start and end ptrs down.)
          
          (* * fgh |11/21/85| Now passes length instead of start and end ptrs.)
          
          (* * rht 1/23/86%: Now takes Stream as arg instead of computing from Card.)
          
          (* * rht 11/1/86%: Now uses our readtable when reading.)

    (DECLARE (GLOBALVARS NC.OrigReadTable))
    (READ Stream NC.OrigReadTable)))

(NC.ListCardPutFn
  (LAMBDA (Card Stream)                                      (* rht%: " 1-Nov-86 15:57")
                                                             (* Put list substance)
          
          (* * fgh |11/20/85| NoteCards now takes care of setting the start and end 
          pointers for the substance.)
          
          (* * rht 1/23/86%: Now takes Stream as arg instead of computing from Card.)
          
          (* * fgh |2/6/86| Now returns version number.)
          
          (* * rht 11/1/86%: Now uses our readtable when printing.)

    (DECLARE (GLOBALVARS NC.OrigReadTable))
    (PRINT (NC.FetchSubstance Card)
           Stream NC.OrigReadTable)
    0))

(NC.EvaluateListCardSubstance
  [LAMBDA (CardOrList Message InterestedWindow ExitOnDontFlg)(* pmi%: "10-Dec-87 14:10")
          
          (* * Evaluate the contents of a list card.)
          
          (* * rht 4/2/87%: Added InterestedWindow arg.)
          
          (* * rht 4/19/87%: Now clears InterestedWindow before printing.)
          
          (* * dsj 11/5/87%: Changed Card arg to CardOrList to allow lists to be passed 
          in for the case where this fn is called after the notefile has been closed and 
          the card is no longer accessible. Now exits if any exprs return DON'T if 
          ExitOnDontFlg is non-NIL.)
          
          (* * pmi 12/10/87%: added dsj's changes;
          see above comments.)

    (LET (CardEvents)
         (SETQ CardEvents (if (LISTP CardOrList)
                              then CardOrList
                            else (NCP.CardSubstance CardOrList)))
         [OR InterestedWindow (AND (NOT (LISTP CardOrList))
                                   (SETQ InterestedWindow (NC.CoerceToInterestedWindow CardOrList]
         (if Message
             then (NC.PrintMsg InterestedWindow T Message))
         (if ExitOnDontFlg
             then [CAR (ERSETQ (if (for Item in CardEvents thereis (EQ (CAR (ERRORSET Item))
                                                                       'DON'T))
                                   then 'DON'T]
           else (ERSETQ (for Item in CardEvents do (ERRORSET Item])
)
(DECLARE%: DONTEVAL@LOAD 

(NC.AddListCard)
)

(PUTPROPS NCLISTCARD FILETYPE :TCOMPL)

(PUTPROPS NCLISTCARD MAKEFILE-ENVIRONMENT (:PACKAGE "IL" :READTABLE "INTERLISP" :BASE 10))
(PUTPROPS NCLISTCARD COPYRIGHT ("Xerox Corporation" 1985 1986 1987 1988))
(DECLARE%: DONTCOPY
  (FILEMAP (NIL (996 1240 (NCAddStub.ListCard 1006 . 1238)) (1241 5986 (NC.AddListCard 1251 . 2056) (
NC.ListCardCopyFn 2058 . 2723) (NC.ListCardCreateFn 2725 . 2942) (NC.ListCardEditFn 2944 . 3113) (
NC.ListCardGetFn 3115 . 3729) (NC.ListCardPutFn 3731 . 4433) (NC.EvaluateListCardSubstance 4435 . 5984
)))))
STOP