(FILECREATED "28-May-86 01:15:32" {QV}<NOTECARDS>1.3K>FGHPATCH046.;2 4995   

      changes to:  (VARS FGHPATCH046COMS)
		   (FNS NC.ConvertVersion2BrowserCard)

      previous date: "28-May-86 00:51:00" {QV}<NOTECARDS>1.3K>FGHPATCH046.;1)


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

(PRETTYCOMPRINT FGHPATCH046COMS)

(RPAQQ FGHPATCH046COMS ((* * Fix to converter -- browsers in particular. From NCCONVERTVERSION2TO3)
			  (FNS NC.ConvertVersion2BrowserCard)))
(* * Fix to converter -- browsers in particular. From NCCONVERTVERSION2TO3)

(DEFINEQ

(NC.ConvertVersion2BrowserCard
  (LAMBDA (Card Version2HashArray)                           (* fgh: "28-May-86 01:14")

          (* * Fix the browser roots and graphnode IDs to be version 3 -
	  this is just modified version of the code in NCMERGEFILES that processes browser cards.)



          (* * rht 4/5/86: Now removes NODEID and DESTNODEID fields from LinkParams of TOLINKS of graphnodes.
	  This effectively converts multiple links between pairs of nodes into single links. Thus, users will have to 
	  ReconnectNodesInBrowser in order to recover the multiple links they had in 1.2.)



          (* * fgh 5/28/86 Changed the way the TONODES and FROMNODES lists are converted. Now uses an ASSOC list to map from 
	  old to new NodeIds when convreting the NODEID field. This is then used to convert each NodeID in the TO and FTOM 
	  lists. This way virtual nodes we can be sure for virtual nodes that all references are EQ not just EQUAL as 
	  required by grapher.)

                                                             (* Get various stuff off browser's prop list.)
    (LET (MappingList)
         (NC.SetBrowserLinkLabels Card (CAR (NC.GetProp Card (QUOTE BrowserLinkLabels))))
         (NC.RemProp Card (QUOTE BrowserLinkLabels))
         (NC.SetBrowserLinksLegend Card (CAR (NC.GetProp Card (QUOTE BrowserLinksLegend))))
         (NC.RemProp Card (QUOTE BrowserLinksLegend))
         (NC.SetBrowserDepth Card (NC.GetProp Card (QUOTE BrowserDepth)))
         (NC.RemProp Card (QUOTE BrowserDepth))
         (NC.SetBrowserFormat Card (CAR (NC.GetProp Card (QUOTE BrowserFormat))))
         (NC.RemProp Card (QUOTE BrowserFormat))
         (NC.SetSpecialBrowserSpecs Card (CAR (NC.GetProp Card (QUOTE SpecialBrowserSpecs))))
         (NC.RemProp Card (QUOTE SpecialBrowserSpecs))   (* Fix up browser roots)
         (NC.SetBrowserRoots Card (for BrowserRootID in (CAR (NC.GetProp Card (QUOTE
										     BrowserRoots)))
				       collect (NC.Version3CardFromVersion2ID BrowserRootID 
										Version2HashArray)))
                                                             (* Throw away old browser roots.)
         (NC.RemProp Card (QUOTE BrowserRoots))

          (* * Fix up graph nodeids and store a mapping between old and new IDs on MappingList)


         (bind OldNodeID NewNodeID for GraphNode in (fetch (GRAPH GRAPHNODES)
							     of (NC.FetchSubstance Card))
	    do (replace (GRAPHNODE NODEID) of GraphNode with (SETQ NewNodeID
								       (
								    NC.ConvertVersion2GraphNodeID
									 (SETQ OldNodeID
									   (fetch (GRAPHNODE NODEID)
									      of GraphNode))
									 Card Version2HashArray)))
		 (push MappingList (CONS OldNodeID NewNodeID)))

          (* * Fix up the TONODES and FROMNODES for each GRAPHNODE using the new IDs created above and stored in 
	  MappingList.)


         (for GraphNode in (fetch (GRAPH GRAPHNODES) of (NC.FetchSubstance Card))
	    do (replace (GRAPHNODE TONODES) of GraphNode
		    with (for NodeID in (fetch (GRAPHNODE TONODES) of GraphNode)
			      collect (COND
					  ((EQ (CAR NodeID)
						 LINKPARAMS)
					    (RPLACA (CDR NodeID)
						      (CDR (ASSOC (CADR NodeID)
								      MappingList)))
					    (AND (LISTGET NodeID (QUOTE NODEID))
						   (LISTPUT NodeID (QUOTE NODEID)
							      NIL))
					    (AND (LISTGET NodeID (QUOTE DESTNODEID))
						   (LISTPUT NodeID (QUOTE DESTNODEID)
							      NIL))
					    NodeID)
					  (T (CDR (ASSOC NodeID MappingList))))))
		 (replace (GRAPHNODE FROMNODES) of GraphNode
		    with (for NodeID in (fetch (GRAPHNODE FROMNODES) of GraphNode)
			      collect (COND
					  ((EQ (CAR NodeID)
						 LINKPARAMS)
					    (RPLACA (CDR NodeID)
						      (CDR (ASSOC (CADR NodeID)
								      MappingList))))
					  (T (CDR (ASSOC NodeID MappingList))))))))))
)
(PUTPROPS FGHPATCH046 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (578 4913 (NC.ConvertVersion2BrowserCard 588 . 4911)))))
STOP