export.pas 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Florian Klaempfl
  4. This unit implements an uniform export object
  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 export;
  19. {$i defines.inc}
  20. interface
  21. uses
  22. cutils,cclasses,
  23. systems,
  24. symtype;
  25. const
  26. { export options }
  27. eo_resident = $1;
  28. eo_index = $2;
  29. eo_name = $4;
  30. type
  31. texported_item = class(tlinkedlistitem)
  32. sym : tsym;
  33. index : longint;
  34. name : pstring;
  35. options : word;
  36. is_var : boolean;
  37. constructor create;
  38. destructor destroy;override;
  39. end;
  40. texportlib=class
  41. private
  42. notsupmsg : boolean;
  43. procedure NotSupported;
  44. public
  45. constructor Create;
  46. destructor Destroy;override;
  47. procedure preparelib(const s : string);virtual;
  48. procedure exportprocedure(hp : texported_item);virtual;
  49. procedure exportvar(hp : texported_item);virtual;
  50. procedure generatelib;virtual;
  51. end;
  52. TExportLibClass=class of TExportLib;
  53. var
  54. CExportLib : array[ttarget] of TExportLibClass;
  55. ExportLib : TExportLib;
  56. procedure RegisterExport(t:ttarget;c:TExportLibClass);
  57. procedure InitExport;
  58. procedure DoneExport;
  59. implementation
  60. uses
  61. verbose,globals;
  62. {****************************************************************************
  63. TExported_procedure
  64. ****************************************************************************}
  65. constructor texported_item.Create;
  66. begin
  67. inherited Create;
  68. sym:=nil;
  69. index:=-1;
  70. name:=nil;
  71. options:=0;
  72. is_var:=false;
  73. end;
  74. destructor texported_item.destroy;
  75. begin
  76. stringdispose(name);
  77. inherited destroy;
  78. end;
  79. {****************************************************************************
  80. TExportLib
  81. ****************************************************************************}
  82. constructor texportlib.Create;
  83. begin
  84. notsupmsg:=false;
  85. end;
  86. destructor texportlib.Destroy;
  87. begin
  88. end;
  89. procedure texportlib.NotSupported;
  90. begin
  91. { show the message only once }
  92. if not notsupmsg then
  93. begin
  94. Message(exec_e_dll_not_supported);
  95. notsupmsg:=true;
  96. end;
  97. end;
  98. procedure texportlib.preparelib(const s:string);
  99. begin
  100. NotSupported;
  101. end;
  102. procedure texportlib.exportprocedure(hp : texported_item);
  103. begin
  104. NotSupported;
  105. end;
  106. procedure texportlib.exportvar(hp : texported_item);
  107. begin
  108. NotSupported;
  109. end;
  110. procedure texportlib.generatelib;
  111. begin
  112. NotSupported;
  113. end;
  114. {*****************************************************************************
  115. Init/Done
  116. *****************************************************************************}
  117. procedure RegisterExport(t:ttarget;c:TExportLibClass);
  118. begin
  119. CExportLib[t]:=c;
  120. end;
  121. procedure InitExport;
  122. begin
  123. if assigned(CExportLib[target_info.target]) then
  124. exportlib:=CExportLib[target_info.target].Create
  125. else
  126. exportlib:=TExportLib.Create;
  127. end;
  128. procedure DoneExport;
  129. begin
  130. if assigned(Exportlib) then
  131. Exportlib.free;
  132. end;
  133. end.
  134. {
  135. $Log$
  136. Revision 1.14 2001-04-18 22:01:53 peter
  137. * registration of targets and assemblers
  138. Revision 1.13 2001/04/13 01:22:07 peter
  139. * symtable change to classes
  140. * range check generation and errors fixed, make cycle DEBUG=1 works
  141. * memory leaks fixed
  142. Revision 1.12 2001/02/26 19:44:52 peter
  143. * merged generic m68k updates from fixes branch
  144. Revision 1.11 2001/02/03 00:09:02 peter
  145. * fixed netware typo in previous commit
  146. Revision 1.10 2001/02/02 22:43:39 peter
  147. * add notarget defines
  148. Revision 1.9 2000/12/25 00:07:25 peter
  149. + new tlinkedlist class (merge of old tstringqueue,tcontainer and
  150. tlinkedlist objects)
  151. Revision 1.8 2000/11/29 00:30:30 florian
  152. * unused units removed from uses clause
  153. * some changes for widestrings
  154. Revision 1.7 2000/10/31 22:02:46 peter
  155. * symtable splitted, no real code changes
  156. Revision 1.6 2000/09/24 15:06:16 peter
  157. * use defines.inc
  158. Revision 1.5 2000/09/16 12:22:52 peter
  159. * freebsd support merged
  160. Revision 1.4 2000/09/11 17:00:22 florian
  161. + first implementation of Netware Module support, thanks to
  162. Armin Diehl ([email protected]) for providing the patches
  163. Revision 1.3 2000/08/27 16:11:50 peter
  164. * moved some util functions from globals,cobjects to cutils
  165. * splitted files into finput,fmodule
  166. Revision 1.2 2000/07/13 11:32:41 michael
  167. + removed logs
  168. }