home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume2 / pstrings / part01 / assignS.p next >
Encoding:
Text File  |  1991-08-07  |  367 b   |  21 lines

  1.  
  2.  
  3.  
  4.  
  5. # include "strings.h"
  6.  
  7. procedure assignS{(var lhs: String; rhs: String)};
  8. {
  9. * lhs := rhs
  10. }
  11. begin
  12.      if lhs <> rhs then begin { -- Care with case, e.g., assignS(x,x) }
  13.          disposeS(lhs);
  14.          if rhs = nil then { -- Empty string } lhs := nil
  15.          else begin
  16.         lhs := rhs;    { -- Ref. copy }
  17.         with rhs^ do REFS := REFS+1
  18.          end
  19.      end
  20. end{ -- assignS};
  21.