×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Patrik,
I would stay away from using any C++ functions in ordinary C because C++ has a rather more complex and different runtime environment.
So, when you say "isblank" you mean "whitespace" as far as the compiler is concerned when tokenizing the input -- in other words, the characters to be treated as "white space" (or blanks or spaces), yes?
This is fairly easy to do.
A simple "translate table" type of char array, e.g.:
char whitespace[255];
Initialize by: for (i=0; i < 255; i++) whitespace[i] = i;
Then carefully set each position you want translated to a "space" to x'40', for example, assuming #defines are set up for CR, LF, TAB, etc.:
whitespace[TAB] = 64; /* ebcdic x'40' = space */ etc.
Of course, it needs to be different for ASCII vs. EBCDIC.
Then, you just do a simple array access to translate to see if a character is really "whitespace."
An even simpler alternative is to test if the character's value is < 64, e.g. less than a space. If so, it is a "special" character that should likely be treated as white space.
Mark
The subscript is a UCHAR unsigned char - see porting.h) the ordinal value of the character in question, and the value of the array at that position returns a ' ' (x'40' in EBCDIC) for all those positions
On Sunday, January 19, 2025 at 08:02:19 AM EST, Patrik Schindler <poc@xxxxxxxxxx> wrote:
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
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.