system.pp 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2000 by the Free Pascal development team.
  5. This is a prototype file to show all function that need to be implemented
  6. for a new operating system (provided the processor specific
  7. function are already implemented !)
  8. See the file COPYING.FPC, included in this distribution,
  9. for details about the copyright.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. **********************************************************************}
  14. { no stack check in system }
  15. {$S-}
  16. unit system;
  17. interface
  18. { include system-independent routine headers }
  19. {$I systemh.inc}
  20. { include heap support headers }
  21. {$I heaph.inc}
  22. implementation
  23. { include system independent routines }
  24. {$I system.inc}
  25. procedure setup_arguments;
  26. begin
  27. end;
  28. procedure setup_environment;
  29. begin
  30. end;
  31. {*****************************************************************************
  32. System Dependent Exit code
  33. *****************************************************************************}
  34. Procedure system_exit;
  35. begin
  36. end;
  37. {*****************************************************************************
  38. Stack check code
  39. *****************************************************************************}
  40. procedure int_stackcheck(stack_size:longint);[public,alias:'FPC_STACKCHECK'];
  41. {
  42. called when trying to get local stack if the compiler directive $S
  43. is set this function must preserve esi !!!! because esi is set by
  44. the calling proc for methods it must preserve all registers !!
  45. With a 2048 byte safe area used to write to StdIo without crossing
  46. the stack boundary
  47. }
  48. begin
  49. end;
  50. {*****************************************************************************
  51. ParamStr/Randomize
  52. *****************************************************************************}
  53. { number of args }
  54. function paramcount : longint;
  55. begin
  56. {paramcount := argc - 1;}
  57. paramcount:=0;
  58. end;
  59. { argument number l }
  60. function paramstr(l : longint) : string;
  61. begin
  62. {if (l>=0) and (l+1<=argc) then
  63. paramstr:=strpas(argv[l])
  64. else}
  65. paramstr:='';
  66. end;
  67. { set randseed to a new pseudo random value }
  68. procedure randomize;
  69. begin
  70. {regs.realeax:=$2c00;
  71. sysrealintr($21,regs);
  72. hl:=regs.realedx and $ffff;
  73. randseed:=hl*$10000+ (regs.realecx and $ffff);}
  74. randseed:=0;
  75. end;
  76. {*****************************************************************************
  77. Heap Management
  78. *****************************************************************************}
  79. { first address of heap }
  80. function getheapstart:pointer;{assembler;
  81. asm
  82. leal HEAP,%eax
  83. end ['EAX'];}
  84. begin
  85. getheapstart:=0;
  86. end;
  87. { current length of heap }
  88. function getheapsize:longint;{assembler;
  89. asm
  90. movl HEAPSIZE,%eax
  91. end ['EAX'];}
  92. begin
  93. getheapsize:=0;
  94. end;
  95. { function to allocate size bytes more for the program }
  96. { must return the first address of new data space or -1 if fail }
  97. function Sbrk(size : longint):longint;{assembler;
  98. asm
  99. movl size,%eax
  100. pushl %eax
  101. call ___sbrk
  102. addl $4,%esp
  103. end;}
  104. begin
  105. Sbrk:=-1;
  106. end;
  107. { include standard heap management }
  108. {$I heap.inc}
  109. {****************************************************************************
  110. Low level File Routines
  111. All these functions can set InOutRes on errors
  112. ****************************************************************************}
  113. { close a file from the handle value }
  114. procedure do_close(handle : longint);
  115. begin
  116. InOutRes:=1;
  117. end;
  118. procedure do_erase(p : pchar);
  119. begin
  120. InOutRes:=1;
  121. end;
  122. procedure do_rename(p1,p2 : pchar);
  123. begin
  124. InOutRes:=1;
  125. end;
  126. function do_write(h,addr,len : longint) : longint;
  127. begin
  128. InOutRes:=1;
  129. end;
  130. function do_read(h,addr,len : longint) : longint;
  131. begin
  132. InOutRes:=1;
  133. end;
  134. function do_filepos(handle : longint) : longint;
  135. begin
  136. InOutRes:=1;
  137. end;
  138. procedure do_seek(handle,pos : longint);
  139. begin
  140. InOutRes:=1;
  141. end;
  142. function do_seekend(handle:longint):longint;
  143. begin
  144. InOutRes:=1;
  145. end;
  146. function do_filesize(handle : longint) : longint;
  147. begin
  148. InOutRes:=1;
  149. end;
  150. { truncate at a given position }
  151. procedure do_truncate (handle,pos:longint);
  152. begin
  153. InOutRes:=1;
  154. end;
  155. procedure do_open(var f;p:pchar;flags:longint);
  156. {
  157. filerec and textrec have both handle and mode as the first items so
  158. they could use the same routine for opening/creating.
  159. when (flags and $10) the file will be append
  160. when (flags and $100) the file will be truncate/rewritten
  161. when (flags and $1000) there is no check for close (needed for textfiles)
  162. }
  163. begin
  164. InOutRes:=1;
  165. end;
  166. function do_isdevice(handle:longint):boolean;
  167. begin
  168. do_isdevice:=false;
  169. end;
  170. {*****************************************************************************
  171. UnTyped File Handling
  172. *****************************************************************************}
  173. {$i file.inc}
  174. {*****************************************************************************
  175. Typed File Handling
  176. *****************************************************************************}
  177. {$i typefile.inc}
  178. {*****************************************************************************
  179. Text File Handling
  180. *****************************************************************************}
  181. { should we consider #26 as the end of a file ? }
  182. {?? $DEFINE EOF_CTRLZ}
  183. {$i text.inc}
  184. {*****************************************************************************
  185. Directory Handling
  186. *****************************************************************************}
  187. procedure mkdir(const s : string);[IOCheck];
  188. begin
  189. InOutRes:=1;
  190. end;
  191. procedure rmdir(const s : string);[IOCheck];
  192. begin
  193. InOutRes:=1;
  194. end;
  195. procedure chdir(const s : string);[IOCheck];
  196. begin
  197. InOutRes:=1;
  198. end;
  199. procedure getdir(drivenr : byte;var dir : shortstring);
  200. begin
  201. InOutRes:=1;
  202. end;
  203. {*****************************************************************************
  204. SystemUnit Initialization
  205. *****************************************************************************}
  206. Begin
  207. { Setup heap }
  208. InitHeap;
  209. { Setup stdin, stdout and stderr }
  210. OpenStdIO(Input,fmInput,StdInputHandle);
  211. OpenStdIO(Output,fmOutput,StdOutputHandle);
  212. OpenStdIO(StdOut,fmOutput,StdOutputHandle);
  213. OpenStdIO(StdErr,fmOutput,StdErrorHandle);
  214. { Setup environment and arguments }
  215. Setup_Environment;
  216. Setup_Arguments;
  217. { Reset IO Error }
  218. InOutRes:=0;
  219. End.
  220. {
  221. $Log$
  222. Revision 1.2 2000-07-13 11:33:56 michael
  223. + removed logs
  224. }