pexports.pas 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. {
  2. $Id$
  3. Copyright (c) 1998 by Florian Klaempfl
  4. This unit handles the exports parsing
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit pexports;
  19. interface
  20. { reads an exports statement in a library }
  21. procedure read_exports;
  22. implementation
  23. uses
  24. cobjects,globals,scanner,symtable,pbase,verbose,export;
  25. const
  26. { export options }
  27. eo_resident = $1;
  28. procedure read_exports;
  29. var
  30. hp : pexported_procedure;
  31. code : word;
  32. begin
  33. consume(_EXPORTS);
  34. while true do
  35. begin
  36. hp:=new(pexported_procedure,init);
  37. if token=ID then
  38. begin
  39. getsym(pattern,true);
  40. if srsym^.typ=unitsym then
  41. begin
  42. consume(ID);
  43. consume(POINT);
  44. getsymonlyin(punitsym(srsym)^.unitsymtable,pattern);
  45. end;
  46. consume(ID);
  47. if assigned(srsym) then
  48. begin
  49. hp^.sym:=srsym;
  50. if (srsym^.typ<>procsym) or
  51. ((pprocdef(pprocsym(srsym)^.definition)^.options and poexports)=0) then
  52. Message(parser_e_illegal_symbol_exported);
  53. if (idtoken=_INDEX) then
  54. begin
  55. consume(_INDEX);
  56. val(pattern,hp^.index,code);
  57. consume(INTCONST);
  58. end;
  59. if (idtoken=_NAME) then
  60. begin
  61. consume(_NAME);
  62. hp^.name:=stringdup(pattern);
  63. consume(ID);
  64. end;
  65. if (idtoken=_RESIDENT) then
  66. begin
  67. consume(_RESIDENT);
  68. hp^.options:=hp^.options or eo_resident;
  69. end;
  70. end;
  71. exportlib^.exportprocedure(hp);
  72. end
  73. else
  74. consume(ID);
  75. if token=COMMA then
  76. consume(COMMA)
  77. else
  78. break;
  79. end;
  80. consume(SEMICOLON);
  81. end;
  82. end.
  83. {
  84. $Log$
  85. Revision 1.3 1998-10-29 11:35:51 florian
  86. * some dll support for win32
  87. * fixed assembler writing for PalmOS
  88. Revision 1.2 1998/09/26 17:45:35 peter
  89. + idtoken and only one token table
  90. }