MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / CvtArgToInt

Function CvtArgToInt

src/gpre/languages/fbrmclib.cpp:354–386  ·  view source on GitHub ↗

Convert a cobol argument to a C integer. Make allowances for different data types, since constants get passed as DISPLAY (NSU or NTS) and fields should be BINARY (NBS or NBU)

Source from the content-addressed store, hash-verified

352// data types, since constants get passed as DISPLAY (NSU or NTS) and fields
353// should be BINARY (NBS or NBU)
354static ISC_UINT64 CvtArgToInt(const argument_entry *arg)
355{
356 ISC_UINT64 temp;
357 char *stemp;
358 char sign;
359
360 switch (arg->a_type)
361 {
362 case 1: // NSU
363 temp = (ISC_UINT64)atoi64((char *)CobolToString(arg));
364 break;
365 case 2: // NTS
366 stemp = (char *)CobolToString(arg);
367 sign = *(stemp + strlen(stemp) - 1);
368 *(stemp + strlen(stemp) - 1) = '\0';
369 if (sign == '-')
370 temp = (ISC_UINT64)((ISC_INT64)atoi64(stemp) * -1);
371 else
372 temp = atoi64(stemp);
373 break;
374 case 11: // NBS
375 case 12: // NBU
376 temp = CvtCobolToInt(arg->a_address,
377 (ISC_USHORT)arg->a_length,
378 arg->a_type);
379 break;
380 default:
381 temp = 0;
382 break;
383 }
384
385 return (temp);
386}
387
388// Return a Cobol BINARY(n) (big-endian) argument as a C integer
389static ISC_ULONG* CobolToInt(const argument_entry *arg)

Callers 3

CobolToIntFunction · 0.85
CobolToShortFunction · 0.85
RM_ENTRYFunction · 0.85

Calls 3

atoi64Function · 0.85
CobolToStringFunction · 0.85
CvtCobolToIntFunction · 0.85

Tested by

no test coverage detected