0

I'm trying to rewrite the following UDF function from Delphi to C but I don't know which parameter type should I use instead of PISC_QUAD and how to extract the month number from the param value.

function GetMonthShortName(ib_date: PISC_QUAD): PAnsiChar; cdecl; export;
var
  tm_date: tm;
begin
  isc_decode_date(ib_date, @tm_date);
  case tm_date.tm_mon of
     0: result := PAnsiChar('Jan');
     1: result := PAnsiChar('Feb');
     2: result := PAnsiChar('Mar');
     3: result := PAnsiChar('Apr');
     4: result := PAnsiChar('May');
     5: result := PAnsiChar('June');
     6: result := PAnsiChar('July');
     7: result := PAnsiChar('Aug');
     8: result := PAnsiChar('Sept');
     9: result := PAnsiChar('Oct');
    10: result := PAnsiChar('Nov');
    11: result := PAnsiChar('Dec');
    else result:=nil;
  end;
end;
Fabrizio
  • 7,603
  • 6
  • 44
  • 104

1 Answers1

1

PISC_QUAD is ^ISC_QUAD. That is, pointer to ISC_QUAD.

In C that would be ISC_QUAD*.

Extract the month number in the exact same way. Call isc_decode_date passing the ISC_QUAD* as input and then read the tm_mon field of the output struct.

int getMonth(ISC_QUAD *ib_date)
{
    struct tm tm_date;
    isc_decode_date(ibdate, &tm_date);
    return tm_date.tm_mon;
}
David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490