convtree.pas 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. {
  2. $Id$
  3. Copyright (c) 1999 by Florian Klaempfl
  4. Converts the old tree nodes into the new OOP nodest
  5. This unit is necessary to interface the new code generator
  6. with the old parser
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU General Public License for more details.
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. ****************************************************************************
  19. }
  20. unit convtree;
  21. interface
  22. uses
  23. tree;
  24. function convtree2node(p : ptree) : pnode;
  25. implementation
  26. uses
  27. verbose,nstatmnt,nmem;
  28. function convtree2node(p : ptree) : pnode;
  29. var
  30. node : pnode;
  31. begin
  32. if assigned(p) then
  33. begin
  34. case p^.treetype of
  35. blockn:
  36. node:=new(pblocknode,init(convtree2node(p^.left)));
  37. else internalerror(13751);
  38. end;
  39. disposetree(p);
  40. convtree2node:=node;
  41. end
  42. else
  43. convtree2node:=nil;
  44. end;
  45. end.
  46. {
  47. $Log$
  48. Revision 1.4 1999-01-24 22:32:35 florian
  49. * well, more changes, especially parts of secondload ported
  50. Revision 1.3 1999/01/23 23:29:47 florian
  51. * first running version of the new code generator
  52. * when compiling exceptions under Linux fixed
  53. Revision 1.2 1999/01/19 10:19:04 florian
  54. * bug with mul. of dwords fixed, reported by Alexander Stohr
  55. * some changes to compile with TP
  56. + small enhancements for the new code generator
  57. Revision 1.1 1999/01/13 22:52:37 florian
  58. + YES, finally the new code generator is compilable, but it doesn't run yet :(
  59. }