[fpc-pascal] C header to Pascal , what is the type of ENUM?
Dennis
dec12 at avidsoft.com.hk
Fri Feb 23 16:06:47 CET 2018
In C
ENUM_BEGIN( RetCode )
/* 0 */ ENUM_DEFINE( TA_SUCCESS, Success ), /* No error */
/* 1 */ ENUM_DEFINE( TA_LIB_NOT_INITIALIZE, LibNotInitialize
), /* TA_Initialize was not sucessfully called */
/* 2 */ ENUM_DEFINE( TA_BAD_PARAM, BadParam ), /* A parameter
is out of range */
/* 3 */ ENUM_DEFINE( TA_ALLOC_ERR, AllocErr ), /* Possibly
out-of-memory */
/* 4 */ ENUM_DEFINE( TA_GROUP_NOT_FOUND, GroupNotFound ),
/* 5 */ ENUM_DEFINE( TA_FUNC_NOT_FOUND, FuncNotFound ),
/* 6 */ ENUM_DEFINE( TA_INVALID_HANDLE, InvalidHandle ),
/* 7 */ ENUM_DEFINE( TA_INVALID_PARAM_HOLDER,
InvalidParamHolder ),
/* 8 */ ENUM_DEFINE( TA_INVALID_PARAM_HOLDER_TYPE,
InvalidParamHolderType ),
/* 9 */ ENUM_DEFINE( TA_INVALID_PARAM_FUNCTION,
InvalidParamFunction ),
/* 10 */ ENUM_DEFINE( TA_INPUT_NOT_ALL_INITIALIZE,
InputNotAllInitialize ),
/* 11 */ ENUM_DEFINE( TA_OUTPUT_NOT_ALL_INITIALIZE,
OutputNotAllInitialize ),
/* 12 */ ENUM_DEFINE( TA_OUT_OF_RANGE_START_INDEX,
OutOfRangeStartIndex ),
/* 13 */ ENUM_DEFINE( TA_OUT_OF_RANGE_END_INDEX,
OutOfRangeEndIndex ),
/* 14 */ ENUM_DEFINE( TA_INVALID_LIST_TYPE, InvalidListType ),
/* 15 */ ENUM_DEFINE( TA_BAD_OBJECT, BadObject ),
/* 16 */ ENUM_DEFINE( TA_NOT_SUPPORTED, NotSupported ),
/* 5000 */ ENUM_DEFINE( TA_INTERNAL_ERROR, InternalError ) = 5000,
/* 0xFFFF */ ENUM_DEFINE( TA_UNKNOWN_ERR, UnknownErr ) = 0xFFFF
ENUM_END( RetCode )
The function in C is
TA_RetCode TA_EMA( int startIdx,
int endIdx,
const double inReal[],
int optInTimePeriod, /* From 2 to 100000 */
int *outBegIdx,
int *outNBElement,
double outReal[] );
my question is, what should the type of TA_RetCode be in Pascal? Word (2
byte) or LongWord (4 bytes)?
In short, is this pascal translation correct?
function TA_EMA(startIdx, endIdx : integer;
const inReal : PDouble;
optInTimePeriod : integer;
var utBegIdx,
outNBElement : integer;
outReal : PDouble ) : Word;stdcall; external
'ta_func.dll';
Note: the dll is 64-bit windows but I am not sure whether int should
translate to Integer or Int64 in Pascal.
Dennis
More information about the fpc-pascal
mailing list