.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Bot Coding (http://forums.bots-united.com/forumdisplay.php?f=24)
-   -   Question about far pointers (http://forums.bots-united.com/showthread.php?t=1986)

Bert 16-06-2004 15:23

Question about far pointers
 
I've been using the (excellent) bot templates to write bots, but those templates lack a bit of structure. I really can't stand that procedural code (no offense) as I came from Java.
So I decided to start from scratch and only keep the stuff I really need.
I stumbled upon this code in bot.h

Code:

#ifndef __linux__

typedef int (FAR *GETENTITYAPI)(DLL_FUNCTIONS *, int);
typedef int (FAR *GETNEWDLLFUNCTIONS)(NEW_DLL_FUNCTIONS *, int *);
typedef void (DLLEXPORT *GIVEFNPTRSTODLL)(enginefuncs_t *, globalvars_t *);
typedef int (DLLEXPORT *SERVER_GETBLENDINGINTERFACE) (int, struct sv_blending_interface_s **, struct engine_studio_api_s *, float (*)[3][4], float (*)[MAXSTUDIOBONES][3][4]);
typedef void (FAR *LINK_ENTITY_FUNC)(entvars_t *);

#else

#include <dlfcn.h>
#define GetProcAddress dlsym
typedef int BOOL;
typedef int (*GETENTITYAPI)(DLL_FUNCTIONS *, int);
typedef int (*GETNEWDLLFUNCTIONS)(NEW_DLL_FUNCTIONS *, int *);
typedef void (*GIVEFNPTRSTODLL)(enginefuncs_t *, globalvars_t *);
typedef int (*SERVER_GETBLENDINGINTERFACE) (int, struct sv_blending_interface_s **, struct engine_studio_api_s *, float (*)[3][4], float (*)[MAXSTUDIOBONES][3][4]);
typedef void (*LINK_ENTITY_FUNC)(entvars_t *);
#endif

I had no idea what that "FAR" keyword is, so after a bit of digging on the net I managed to piece together what it's supposed to be:
"The far qualifier when used in 16 bit compilers results in a 32 bit pointer."
So I assume I can safely remove that keyword, or does FAR have another more obscure significance aswell?
I'm not concerned with portability as I have no experience with other OSes besides Windows.
[MODS: I hope this is the right forum for this thread]

Pierre-Marie Baty 16-06-2004 19:56

Re: Question about far pointers
 
Yes, I think you can remove "FAR" from the code. Botman could probably tell us more about this since it's his code (or does this part come straight from the HL SDK ? can't remember).

@$3.1415rin 16-06-2004 20:24

Re: Question about far pointers
 
in good ol times there was a different between near and far pointer, but on current pc systems there isnt ( well, internally, it still is ... ). near pointer were just in a segment, thus saving mem bandwidth and delays in the mem unit. today most stuff is plain 32 bit pointers, no more real use to use near etc.

maybe that's still a quake1 relict ... but lets wait for botman :)

botman 17-06-2004 00:07

Re: Question about far pointers
 
The 'FAR' in the above definitions satisfy the "CALLBACK" type on the GetProcAddress() function.

http://msdn.microsoft.com/library/de...rocaddress.asp

You can try to remove it and see if it compiles (but I'd be willing to bet that the C++ complier complains about a type conversion error).

botman

Bert 17-06-2004 09:16

Re: Question about far pointers
 
It compiles fine without the keyword, so I'll just leave it out. Thanks for the replies.


All times are GMT +2. The time now is 02:18.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.