[V4R5] enabling isblank() for plain C

Patrik Schindler <[email protected]> Sun, 19 Jan 2025 14:02:02 +0100
Newsgroups gmane.comp.lang.as400.c
Message-ID <[email protected]>
Hello,

documentation for V4R5 says, certain ctype.h functions such as isblank are available in C++ only.

I dimly remember having read that I can set a #define to enable the availability of isblank() for plain C. I was too dumb to immediately apply this or write down a note. Now I wonder what this #define might be.

ChatGPT was suggesting to define _ISOC99_SOURCE in the first try, and _ANSI_C_SOURCE in the second. I have found references to __cplusplus by "plain Google". Each must be set before including ctype.h. The compiler still complains about a missing prototype.

Looking at QCLE/H.CTYPE, islblank is surrounded by the need to define __EXTENDED__ and __cplusplus. Defining both makes the compiler choke:

CZM0280 The predefined macro __EXTENDED__ cannot be redefined.

CZM0441 #pragma info is unrecognized and is ignored.


In addition, the header states

#pragma map (isblank, "__isblank")

Not sure what this is about.


Manually setting a prototype also doesn't work. There is no more error from the compiler, but the output states Program x in library y was not created. I assume a linkage error.


How can I enable the use of isblank() from the system libraries in plain C? Thanks!

Currently, I'm "manually" testing the character for being a blank, a tab, or a 0x0. Plan B would be to extract the actual code from the GNU Libc and use that one.

:wq! PoC

-- 
This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/c400-l
or email: [email protected]
Before posting, please take a moment to review the archives
at https://archive.midrange.com/c400-l.