
PROCEDURE Enter(dict: DICT;
  Key: ARRAY OF CHAR;  KeyAttributes: KeyAttr;
  thing: WORD);
<# Entry point to PROCEDURE Dict_Enter
<# Parameters: dict: 4(AP)/[R6]  Key: 8(AP)  KeyAttributes: 16(AP)
<#            thing: 20(AP)  
<# Locals:     entry: -4(FP)  wasSilent: -8(FP)/[R4]
<#            CopyOfKey: -12(FP)/[R5]  DisposeProc: -16(FP)/[R7]  
VAR entry: pEntry;
  wasSilent: BOOLEAN;
  CopyOfKey :STRING;
  DisposeProc: WORDPROC;
<	.globl Dict_Enter
<Dict_Enter:
<L1317:	.word 1008	# 1595: F0 03 
<	subl2 $16,sp	# 1597: C2 10 5E 
<	addl3 12(ap),$1,r0	# 1600: C1 AC 0C 01 50 
<	subl2 r0,sp	# 1605: C2 50 5E 
<	movc3 r0,*8(ap),(sp)	# 1608: 28 50 BC 08 6E 
<	movl sp,8(ap)	# 1613: D0 5E AC 08 
BEGIN
  WITH dict^ DO
<	movl 4(ap),r6	# 1617: D0 AC 04 56 
    wasSilent := Silent;  Silent := TRUE;
<	movl r6,r9	# 1621: D0 56 59 
<	movl (r9),r4	# 1624: D0 69 54 
<	movl $1,(r9)	# 1627: D0 01 69 
    CopyOfKey := nString.CopyCS(Key);
<	pushl 12(ap)	# 1630: DD AC 0C 
<	pushl 8(ap)	# 1633: DD AC 08 
<	calls $2,*$nString_CopyCS	# 1636: FB 02 9F 00 00 00 00 
<	movl r0,r5	# 1643: D0 50 55 
    entry := Locate(dict, CopyOfKey, KeyAttr{ExactLength (*,ExactCase*)},
      FALSE);
<	clrl -(sp)	# 1646: D4 7E 
<	pushl $1	# 1648: DD 01 
<	pushl r5	# 1650: DD 55 
<	pushl r6	# 1652: DD 56 
<	calls $4,*$Dict_Locate	# 1654: FB 04 9F 99 02 00 00 
<	movl r0,-4(fp)	# 1661: D0 50 AD FC 
    Silent := wasSilent;  ErrorCode := NoError;
<	movl r4,(r9)	# 1665: D0 54 69 
<	clrl 4(r9)	# 1668: D4 A9 04 
    IF entry <> NIL THEN
<	cmpl $-2147483648,-4(fp)	# 1671: D1 8F 00 00 00 80 AD FC 
<	beql L1522	# 1679: 13 77 
      DisposeProc := WORDPROC(dict^.Dispose);
<	movl 16(r6),r7	# 1681: D0 A6 10 57 
(* $IF DEBUG *)
      FormatIO.WriteF2(SysErr,"String.Dispose = %I; Dict^.Dispose = %I*N",
        INTEGER(nString.Dispose),INTEGER(DisposeProc));
<	pushl r7	# 1685: DD 57 
<	pushal *$nString_Dispose	# 1687: DF 9F 00 00 00 00 
<	pushl $40	# 1693: DD 28 
<	pushal *$L1+94	# 1695: DF 9F 5E 00 00 00 
<	pushl *$SysStreams__d+16	# 1701: DD 9F 10 00 00 00 
<	calls $5,*$FormatIO_WriteF2	# 1707: FB 05 9F 00 00 00 00 

(************** THIS MESSAGE SHOWS THEY HAVE SAME VALUE!!!! *************)

      IF INTEGER(DisposeProc) = INTEGER(nString.Dispose) THEN
<	cmpl *$nString_Dispose,r7	# 1714: D1 9F 00 00 00 00 57 
<            ^ IS THIS CORRECT????
<	bneq L1550	# 1721: 12 69 

(**************     THIS SECTION IS %%%NOT%%% EXECUTED     **************)
(**************     Implying that the comparison failed    **************)

      FormatIO.WriteF2(SysErr,"Replacing '%S' by '%S' ",
        FormatIO.S(STRING(entry^.item)),
        FormatIO.S(STRING(thing)));
<	pushl 20(ap)	# 1723: DD AC 14 
<	calls $1,*$FormatIO_S	# 1726: FB 01 9F 00 00 00 00 
<	pushl r0	# 1733: DD 50 
<	movl -4(fp),r0	# 1735: D0 AD FC 50 
<	pushl 20(r0)	# 1739: DD A0 14 
<	calls $1,*$FormatIO_S	# 1742: FB 01 9F 00 00 00 00 
<	pushl r0	# 1749: DD 50 
<	pushl $22	# 1751: DD 16 
<	pushal *$L1+136	# 1753: DF 9F 88 00 00 00 
<	pushl *$SysStreams__d+16	# 1759: DD 9F 10 00 00 00 
<	calls $5,*$FormatIO_WriteF2	# 1765: FB 05 9F 00 00 00 00 
      FormatIO.WriteF2(SysErr,"under key %S in %S*N",
        FormatIO.S(entry^.name),
        FormatIO.S(dict^.Name));
<	pushl 8(r6)	# 1772: DD A6 08 
<	calls $1,*$FormatIO_S	# 1775: FB 01 9F 00 00 00 00 
<	pushl r0	# 1782: DD 50 
<	movl -4(fp),r0	# 1784: D0 AD FC 50 
<	pushl 4(r0)	# 1788: DD A0 04 
<	calls $1,*$FormatIO_S	# 1791: FB 01 9F 00 00 00 00 
<	brb L1525	# 1798: 11 03 
<L1522:	brw L1613	# 1800: 31 58 00 
<L1525:	pushl r0	# 1803: DD 50 
<	pushl $19	# 1805: DD 13 
<	pushal *$L1+160	# 1807: DF 9F A0 00 00 00 
<	pushl *$SysStreams__d+16	# 1813: DD 9F 10 00 00 00 
<	calls $5,*$FormatIO_WriteF2	# 1819: FB 05 9F 00 00 00 00 
      ELSE
<	brb L1587	# 1826: 11 25
        FormatIO.WriteF1(SysErr,"Replacing under key %S*N",
          FormatIO.S(entry^.name));
<L1550:	movl -4(fp),r0	# 1828: D0 AD FC 50 
<	pushl 4(r0)	# 1832: DD A0 04 
<	calls $1,*$FormatIO_S	# 1835: FB 01 9F 00 00 00 00 
<	pushl r0	# 1842: DD 50 
<	pushl $23	# 1844: DD 17 
<	pushal *$L1+181	# 1846: DF 9F B5 00 00 00 
<	pushl *$SysStreams__d+16	# 1852: DD 9F 10 00 00 00 
<	calls $4,*$FormatIO_WriteF1	# 1858: FB 04 9F 00 00 00 00 
      END;
(* $ENDIF DEBUG *)
      DisposeProc(entry^.item);
<L1587:	movl -4(fp),r0	# 1865: D0 AD FC 50 
<	pushal 20(r0)	# 1869: DF A0 14 
<	calls $1,(r7)	# 1872: FB 01 67 
      nString.Dispose (entry^.name)
<	movl -4(fp),r0	# 1875: D0 AD FC 50 
<	pushal 4(r0)	# 1879: DF A0 04 
<	calls $1,*$nString_Dispose	# 1882: FB 01 9F 00 00 00 00 
    ELSE
<	brb L1640	# 1889: 11 1B
      WITH Implementation^ DO
<L1613:	movl 20(r9),r8	# 1891: D0 A9 14 58
        NEW (entry);  entry^.next := Entries;  Entries := entry;  INC (size);
<	pushl $24	# 1895: DD 18 
<	pushal -4(fp)	# 1897: DF AD FC 
<	calls $2,*$Storage_ALLOCATE	# 1900: FB 02 9F 00 00 00 00 
<	movl (r8),*-4(fp)	# 1907: D0 68 BD FC 
<	movl -4(fp),(r8)	# 1911: D0 AD FC 68 
<	incl 8(r8)	# 1915: D6 A8 08 
      END
    END;
    WITH entry^ DO
<L1640:	movl -4(fp),r8	# 1918: D0 AD FC 58 
      name  := CopyOfKey;
<	movl r5,4(r8)	# 1922: D0 55 A8 04 
      Attr  := KeyAttributes;
<	movl 16(ap),8(r8)	# 1926: D0 AC 10 A8 08 
      IF ExactLength IN KeyAttributes THEN MatchLen:=-2 ELSE MatchLen:=-1 END;
<	bitl $1,16(ap)	# 1931: D3 01 AC 10 
<	beql L1666	# 1935: 13 07 
<	cvtbl $-2,12(r8)	# 1937: 98 8F FE A8 0C 
<	brb L1671	# 1942: 11 05 
<L1666:	cvtbl $-1,12(r8)	# 1944: 98 8F FF A8 0C 
      item  := thing;
<L1671:	movl 20(ap),20(r8)	# 1949: D0 AC 14 A8 14 
      order := Implementation^.nextEntryNo;
<	movl 20(r9),r0	# 1954: D0 A9 14 50 
<	movl 4(r0),16(r8)	# 1958: D0 A0 04 A8 10 
    END;
    WITH Implementation^ DO modified := TRUE;  INC (nextEntryNo) END;
<	movl 20(r9),r8	# 1963: D0 A9 14 58 
<	movl $1,12(r8)	# 1967: D0 01 A8 0C 
<	incl 4(r8)	# 1971: D6 A8 04 
  END;
END Enter;
<	ret	# 1974: 04 
