Mail Archives: djgpp/1997/01/19/23:39:21
According to Brin:
> I am trying to use the farptr.h library and the go32.h libaray. [...]
> To use them I need _dos_ds, which is defined in the C library go32.h
> but is not a function or a procedure, but is: #define. I tried
> incluing go32.h but got errors (due to it being a C file I think).
Yes. GNU Pascal does not parse C source. ;-)
> How can I import _dos_ds?
Only by re-writing the functionality of the macro (#define), i.e.
translating it to Pascal. In this case it is access to a component
of a struct (a record in Pascal):
Type
ByteInt = __byte__ Integer; (* 8 bit signed Integer *)
Byte = __unsigned__ ByteInt; (* 8 bit unsigned Integer *)
ShortInt = __short__ Integer; (* 16 bit signed Integer *)
ShortWord = __unsigned__ ShortInt; (* 16 bit unsigned Integer *)
(* Integer = __long__ Integer *) (* 32 bit signed Integer *)
Word = __unsigned__ Integer; (* 32 bit unsigned Integer *)
Go32InfoBlockRecord = record
size_of_this_structure_in_bytes,
linear_address_of_primary_screen,
linear_address_of_secondary_screen,
linear_address_of_transfer_buffer,
size_of_transfer_buffer, (* >= 4k *)
pid: Word;
master_interrupt_controller_base,
slave_interrupt_controller_base: Byte;
selector_for_linear_memory: ShortWord;
linear_address_of_stub_info_structure,
linear_address_of_original_psp: Word;
run_mode,
run_mode_info: ShortWord;
end (* Go32InfoBlockRecord *);
Var
Go32InfoBlock: asmname '_go32_info_block' Go32InfoBlockRecord;
Then by typing
Go32InfoBlock.selector_for_linear_memory
you get the functionality of _dos_ds. Now, of course, you can define
it as a macro
(*$define _dos_ds Go32InfoBlock.selector_for_linear_memory *)
but then the definition is case sensitive.
Or: Write a C function which uses the macro, then use that function
from Pascal. But that's less effective.
Hope this helps,
Peter
e-mail: peter DOT gerwinski AT uni-essen DOT de
home address: D\"usseldorfer Str. 35, 45145 Essen, Germany
WWW: http://agnes.dida.physik.uni-essen.de/~peter/
- Raw text -