(FILECREATED "17-Jul-86 15:14:13" {ERIS}<TAMARIN>UCODE>PARSECHIP.;2 5201   

      changes to:  (FNS ParseCell ParseChipFile ParseItem ParseList ParseProperty ParseString 
			ParseCifFile)
		   (VARS PARSECHIPCOMS)

      previous date: "16-Jul-86 08:54:43" {ERIS}<TAMARIN>UCODE>PARSECHIP.;1)


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

(PRETTYCOMPRINT PARSECHIPCOMS)

(RPAQQ PARSECHIPCOMS ((FNS ParseCell ParseChipFile ParseCifFile ParseItem ParseList ParseProperty 
			     ParseString ParseAtom GetChipWrd)))
(DEFINEQ

(ParseCell
  [LAMBDA (nn)                                               (* agb: "17-Jul-86 11:02")
    (PROG (cellNbrx name xbound ybound items)
	    (SETQ cellNbrx (GetChipWrd))
	    (if (NEQ nn cellNbrx)
		then (HELP))
	    (SETQ name (ParseString))
	    (SETQ xbound (GetChipWrd))
	    (SETQ ybound (GetChipWrd))
	    (GetChipWrd)
	    (SETQ items (ParseList))
	    (RETURN (LIST name cellNbrx xbound ybound])

(ParseChipFile
  [LAMBDA (lst)                                              (* agb: "16-Jul-86 20:29")
    (PROG (CellCnt reslst)
	    (SETQ wrdCnt 0)
	    (SETQ ChipWrdLst (OR lst foo))
	    (if [NOT (AND (EQ (GetChipWrd)
				      123751Q)
				(EQ 10Q (GetChipWrd]
		then (HELP "Not a chip file"))
	    (SETQ CellCnt (GetChipWrd))
	    (SETQ reslst (for i from 1 to CellCnt collect (ParseCell i)))
	    (GetChipWrd)
	    (GetChipWrd)
	    (SETQ TopCntLoc wrdCnt)
	    (ParseList)
	    (RETURN reslst])

(ParseCifFile
  [LAMBDA (lst)                                              (* agb: "16-Jul-86 08:54")
    (PROG (CellCnt)
	    (IF [NOT (AND (EQ (GetChipWrd)
				      42985)
				(EQ 7 (GetChipWrd]
		THEN (HELP "Not a chip file"))
	    (SETQ CellCnt (GetChipWrd))
	    (FOR i from 1 to CellCnt COLLECT (ParseCell i))
	    (SETQ TopCntLoc wrd)
	    (ParseList])

(ParseItem
  [LAMBDA NIL                                                (* agb: "16-Jul-86 15:16")
    (PROG (xpos ypos orient obType propList)
	    (SETQ xpos (GetChipWrd))
	    (SETQ ypos (GetChipWrd))
	    (SETQ orient (GetChipWrd))
	    (SETQ obType (GetChipWrd))
	    (SELECTQ obType
		       (1 (SETQ cellNbr (GetChipWrd)))
		       (2 (GetChipWrd)
			  (GetChipWrd)
			  (SETQ k (GetChipWrd))
			  (if (NEQ 0 (LOGAND k 20000Q))
			      then (GetChipWrd))
			  (if (NEQ 0 (LOGAND k 100000Q))
			      then (GetChipWrd)))
		       (3 (SETQ cont (GetChipWrd))
			  (GetChipWrd)
			  (GetChipWrd)
			  (if (EQ 4 cont)
			      then (GetChipWrd)
				     (GetChipWrd)))
		       (4 (GetChipWrd)
			  (GetChipWrd)
			  (GetChipWrd))
		       (5 (GetChipWrd)
			  (GetChipWrd)
			  (GetChipWrd))
		       (7 (GetChipWrd)
			  (GetChipWrd)
			  (GetChipWrd)
			  (GetChipWrd)
			  (GetChipWrd)
			  (GetChipWrd)
			  (GetChipWrd))
		       (HELP))
	    (SETQ propCnt (GetChipWrd))
	    (for i from 1 to propCnt do (ParseProperty])

(ParseList
  [LAMBDA NIL                                                (* agb: "16-Jul-86 08:51")
    (PROG (cnt)
	    (SETQ cnt (GetChipWrd))
	    (for i from 1 to cnt collect (ParseItem])

(ParseProperty
  [LAMBDA NIL                                                (* agb: "16-Jul-86 20:48")
    (PROG (type prop attr val)
	    (SETQ type (GetChipWrd))
	    (SELECTQ type
		       (1 (SETQ prop (ParseString)))
		       (2 (SETQ attr (ParseAtom))
			  (SETQ val (ParseAtom)))
		       (HELP))
	    (RETURN prop])

(ParseString
  [LAMBDA NIL                                                (* agb: "16-Jul-86 15:24")
    (PROG (wrd len res)
	    (SETQ wrd (GetChipWrd))
	    (SETQ len (LRSH wrd 10Q))
	    [for i from 1 to len
	       do (if (EVENP i)
			then (SETQ wrd (GetChipWrd)))
		    (if (EVENP i)
			then [SETQ res (NCONC1 res (CHARACTER (LRSH wrd 10Q]
		      else (if (NEQ 0 (LOGAND 377Q wrd))
				 then (SETQ res (NCONC1 res (CHARACTER (LOGAND 377Q wrd]
	    (RETURN (PACK res])

(ParseAtom
  [LAMBDA NIL                                                (* agb: "16-Jul-86 21:04")
    (PROG (index)
	    (SETQ index (GetChipWrd))
	    (if (ILESSP index 32768)
		then (RETURN (ParseString))
	      else (RETURN NIL])

(GetChipWrd
  [LAMBDA NIL                                                (* agb: "16-Jul-86 14:05")
    (SETQ cres (CAR ChipWrdLst))
    (SETQ wrdCnt (ADD1 wrdCnt))
    (SETQ ChipWrdLst (CDR ChipWrdLst))
    cres])
)
(PUTPROPS PARSECHIP COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (547 5121 (ParseCell 557 . 1049) (ParseChipFile 1051 . 1666) (ParseCifFile 1668 . 2100) 
(ParseItem 2102 . 3364) (ParseList 3366 . 3596) (ParseProperty 3598 . 3977) (ParseString 3979 . 4588) 
(ParseAtom 4590 . 4871) (GetChipWrd 4873 . 5119)))))
STOP