| 3538 | #ifdef ASTYLE_LIB |
| 3539 | |
| 3540 | extern "C" EXPORT utf16_t* STDCALL AStyleMainUtf16(const utf16_t* pSourceIn, // the source to be formatted |
| 3541 | const utf16_t* pOptions, // AStyle options |
| 3542 | fpError fpErrorHandler, // error handler function |
| 3543 | fpAlloc fpMemoryAlloc) // memory allocation function |
| 3544 | { |
| 3545 | if (fpErrorHandler == NULL) // cannot display a message if no error handler |
| 3546 | return NULL; |
| 3547 | |
| 3548 | if (pSourceIn == NULL) |
| 3549 | { |
| 3550 | fpErrorHandler(101, "No pointer to source input."); |
| 3551 | return NULL; |
| 3552 | } |
| 3553 | if (pOptions == NULL) |
| 3554 | { |
| 3555 | fpErrorHandler(102, "No pointer to AStyle options."); |
| 3556 | return NULL; |
| 3557 | } |
| 3558 | if (fpMemoryAlloc == NULL) |
| 3559 | { |
| 3560 | fpErrorHandler(103, "No pointer to memory allocation function."); |
| 3561 | return NULL; |
| 3562 | } |
| 3563 | #ifndef _WIN32 |
| 3564 | // check size of utf16_t on Linux |
| 3565 | int sizeCheck = 2; |
| 3566 | if (sizeof(utf16_t) != sizeCheck) |
| 3567 | { |
| 3568 | fpErrorHandler(104, "Unsigned short is not the correct size."); |
| 3569 | return NULL; |
| 3570 | } |
| 3571 | #endif |
| 3572 | |
| 3573 | ASLibrary library; |
| 3574 | utf16_t* utf16Out = library.formatUtf16(pSourceIn, pOptions, fpErrorHandler, fpMemoryAlloc); |
| 3575 | return utf16Out; |
| 3576 | } |
| 3577 | |
| 3578 | //---------------------------------------------------------------------------- |
| 3579 | // ASTYLE_LIB functions for calling AStyleMain |
nothing calls this directly
no test coverage detected