summaryrefslogtreecommitdiff
path: root/handy.h
Commit message (Collapse)AuthorAgeFilesLines
* handy.h: 'porcelain" => "base"Karl Williamson2022-07-181-62/+62
| | | | | | | | | | | | | | | I intended to convery in the names of these macros that they exist to present a uniform api to the layers above, minimally processing the layer below to achieve that. So for example, is_porcelain_BLANK hides the fact that isblank() doesn't exist on all platforms, or is_porcelain_DIGIT matches the same set of 0..9 on all platforms, fixing the non-standard definition Windows has. I thought this is what git had meant when it used 'porcelain', but Tony Cook informed me that it actually means something else. So to avoid confusing people who might be aware of the real git meaning, this commit changes 'porcelain' to 'base', which, while not entirely satisfactory, is the best short name I have been able to think of.
* Add LINE_Tf format for line_t variablesKarl Williamson2022-07-181-0/+1
| | | | This is so you can print them without having to know their length.
* Fix breakage in e91f88ad549Karl Williamson2022-07-021-1/+0
| | | | Two files were included in that commit that shouldn't have been
* mktables: Don't generate pod for Name.pmKarl Williamson2022-07-021-0/+1
| | | | | | | This is a relic from long ago. mktables creates lib/unicore/Name.pm. And in that file which is for internal core use only, it was creating the beginnings of some pod, but quite incomplete; this was confusing buildtoc, which perhaps could be hardened against such inputs.
* handy.h: Comment MUTABLE_PTRKarl Williamson2022-06-221-1/+3
| | | | Tony Cook and Leon Timmermans explained this to me.
* Follow on to 6d21409fd4b749511b9ec73e2dbaaff513f6eae8Karl Williamson2022-06-181-101/+102
| | | | | This was meant to be a part of the previous commit, but somehow got omitted.
* perlapi: Split two groups of entriesKarl Williamson2022-06-181-17/+24
| | | | | The sorting order of perlapi is supposed to be dictionary order. These synonyms were grouped with other names in a non-ordered way.
* handy.h: White space onlyKarl Williamson2022-06-161-3/+3
| | | | These shouldn't be indented
* allow building with -DPERL_MEM_LOG on Win32Tony Cook2022-06-161-4/+0
| | | | | | | | This appears to have been broken for a while, and became more broken with 75acd14e, which made newSV_type() inline. This will also prevent warnings about calls to undeclared functions on systems that don't need symbols to be exported.
* handy.h: Add layer for char classification/case changeKarl Williamson2022-06-121-40/+100
| | | | | This layer currently expands to just the layer below it, but that will be changed in a future commit.
* handy.h: Add isCASED_LCKarl Williamson2022-06-121-0/+5
| | | | As a convenience to other code.
* handy.h: Add wrapper layer macros for isalnum() etcKarl Williamson2022-06-121-58/+76
| | | | | | | | | | | | | | | | | | This adds a new set of macros, forming a lower layer to what is currently there, to wrap the character classification libc functions, isdigit() etc, and case changing ones, tolower(), toupper(). On most platforms these expand simply to the libc function call. But on Windows, they expand to something more complex, to bring the Windows calls into POSIX compliance. Similarly, but not as extensive, IBM products have some non-compliant behavior, and one macro is made more comples to fix that. Previously compliance was achieved at a higher level, with the result that lower level calls were broken. This resulted in parts of the test suite being skipped on Windows and IBM, which remain for now. The current level is rewritten to use the new lower layer, with the result that it is simpler, as the complexity is now done further down.
* handy.h: Collapse some macrosKarl Williamson2022-06-121-11/+6
| | | | These 3 sets of macros can be collapsed trivially into 3 macros.
* handy.h: Move some macro defns aroundKarl Williamson2022-06-121-45/+45
| | | | | | | This is to make the difference listing in future commits smaller. This change includes some comment changes, and some extra parens around some subexpressions
* handy.h: Collapse two sets of macrosKarl Williamson2022-06-121-29/+15
| | | | | | By redefining a wrapper macro used in one set based on compile-time info; the other set can be defined in terms of it, and the separate entries removed.
* No locales => don't use isspace(), toLower() etc.Karl Williamson2022-06-121-16/+16
| | | | | | | | | This commit changes what happens on platforms without locale handling to use our precomputed definitions of what the various character class definitions and case changing operations are. Previously, it just called the libc locale-dependent functions and made sure the result was ASCII. I think this is a holdover from before we had the precomputed definitions
* handy.h: #define one macro in terms of anotherKarl Williamson2022-06-121-1/+1
| | | | | | These two macros are equivalent as folding and lowercasing are the same for this input domain. Better to say so rather than to replicate the definitions.
* handy.h: Rmv unnecessary parameter to internal macrosKarl Williamson2022-06-121-9/+9
| | | | | The cast is required to be U8 by the POSIX standard. There is no need to have this added generality.
* handy.h: Refactor some internal macrosKarl Williamson2022-06-121-15/+12
| | | | This changes the parameters etc, in preparation for further changes
* handy.h: Rmv internal macroKarl Williamson2022-06-121-5/+2
| | | | | | LC_CAST_ was my attempt at generality, but I didn't realize that the POSIX standard specifies the type that this was meant to generalize, so there isn't any need for it.
* Change handy.h macro names to be C standard conformantKarl Williamson2022-06-121-160/+159
| | | | | | | C reserves symbols beginning with underscores for its own use. This commit moves the underscore so it is trailing, which is legal. The symbols changed here are many of the ones in handy.h that have significant uses outside it.
* handy.h: Don't use char class if no LC_CTYPEKarl Williamson2022-06-121-1/+1
| | | | | | It is possible to compile perl to not pay attention to LC_CTYPE. This was testing for no locales at all; whereas the stricter requirement should be used.
* handy.h: White-space, comment onlyKarl Williamson2022-06-121-82/+92
|
* handy.h: Add some branch predictionsKarl Williamson2022-06-121-6/+6
|
* handy.h: Refactor some #ifdef's for commonalityKarl Williamson2022-06-121-34/+30
| | | | | | | | | This changes these compilation conditionals so that things in common between Windows and other platforms are only defined once. It changes the isIDFIRST_LC and isWORDCHAR_LC definitions for non-Windows to match that platform superficially, though expanding to what it previously did to.
* handy.h: Remove the only 2 calls to internal macroKarl Williamson2022-06-121-9/+2
| | | | | Replace isIDFIRST_LC and isWORD_CHAR_LC isIDFIRST_LC with slightly faster implementations.
* Change handy.h macro names to be C standard conformantKarl Williamson2022-06-121-176/+176
| | | | | | | C reserves symbols beginning with underscores for its own use. This commit moves the underscore so it is trailing, which is legal. The symbols changed here are most of the ones in handy.h that have few uses outside it.
* handy.h: WIDEST_UTYPE is just PERL_UINTMAX_TKarl Williamson2022-06-081-5/+1
| | | | No need to re-derive it
* Make STRLENs() available to coreKarl Williamson2022-05-311-0/+6
| | | | | This may cause problems when not used correctly; so continue to restrict it.
* handy.h: ASSERT_NOT_PTR doesn't work for void*Karl Williamson2022-05-311-1/+4
| | | | Add comment to that
* perlapi: Consolidate hv_store(s?), into 1 entry,improveKarl Williamson2022-05-301-6/+0
| | | | | The text has been expanded to discuss what happens if the any of the pointer parameters are NULL.
* handy.h: White-space onlyKarl Williamson2022-05-291-7/+7
| | | | Indent preprocessor directives to clarify that they are in #ifdef
* perlapi: safemalloc doesn't take a pointerTomasz Konojacki2022-05-191-1/+1
|
* perlapi: document safe(?:c|re|m)allocTomasz Konojacki2022-05-171-0/+6
| | | | They're widely used on CPAN, especially safemalloc.
* perlapi: Consolidate sv_setpv entriesKarl Williamson2022-05-081-8/+0
| | | | | | Making these a single entry makes perlapi more concise with less repetition, and clarifies the similarities and distinctions between the variant forms.
* perlapi: Consolidate (Copy|Move|Zero)D?Karl Williamson2022-05-031-11/+9
| | | | | This commit consolidates the D form of each function in perlapi with the plain form.
* handy.h: space isn't graphKarl Williamson2022-04-191-1/+6
|
* Add ASSERT_IS_PTR macroKarl Williamson2022-03-031-0/+4
| | | | To make sure at compile time that its argument is a ptr
* Add 'ASSERT_IS_LITERAL' macroKarl Williamson2022-03-031-10/+12
| | | | | This is intended to make it obvious what this relatively obscure C construct is doing.
* Print a deprecation warning if downgrading to a use VERSION below v5.11Paul "LeoNerd" Evans2022-02-131-2/+2
|
* Simplify cBOOL defnKarl Williamson2022-02-061-6/+6
| | | | | | | | | | | | | | | This existed because there wasn't a compiler bool necessarily, and made complicated to workaround a bug in an AIX compiler as of 2010-ish. Now that C99 is required, there always is a bool type; we don't know if the bug existed in a C99 mode for the broken compiler, and sufficient time has passed that it should have been fixed nonetheless. This was tested on IBM XL C/C++ for AIX, V12.1 (5765-J02, 5725-C72) Version: 12.01.0000.0012 which dates to about 2012.
* Remove HAS_BOOLKarl Williamson2022-02-061-2/+0
| | | | | | This is no longer used in core. It occurs twice in metacpan, both to define it so as to fool core into thinking it is there; hence it isn't actually used at all in cpan.
* Remove PERL_BOOL_AS_CHAR uses; always define HAS_BOOLKarl Williamson2022-02-061-27/+2
| | | | | | | | | | Now that C99 is required, bool is always defined, so HAS_BOOL should also always be defined. PERL_BOOL_AS_CHAR was used to workaround problems when no bool type existed, so it is obsolete, and in fact perl won't compile if PERL_BOOL_AS_CHAR is #defined. So remove it completely from being looked at.
* Evaluate arg to FITS_IN_8_BITS just onceKarl Williamson2021-09-071-4/+4
| | | | | | | | | | | | | | | This had been changed by 9555181b32f9b30122a8ea4e779c2c9916cec9f8 to evaluating multiple times. (sizeof() also is called with the parameter, but that doesn't actually evaluate the parameter.) The previous version of this commit used a comparison with 0xFF, but gcc is smart enough to realise that `comparison is always true due to limited range of data type`, but not smart enough to realise that the sizeof makes that code unreachable. Hence with -Wtype-limits we get thousands of warnings. Using >> defeats the warnings.
* handy.h: Skip non-ptr assertion on old gcc'sKarl Williamson2021-08-251-4/+11
| | | | See https://github.com/Perl/perl5/issues/18655, which this fixes.
* Make paradigm into a macroKarl Williamson2021-08-251-7/+9
| | | | | | | | | | | | | | | | | | | | These macros use (x) | 0 to get a compiler error if x is a pointer rather than a value. This was instituted because there was confusion in them as to what they were called with. But the purpose of the paradigm wasn't obvious to even some experts; it was documented in every file in which it was used, but not at every occurrence. And, not every compiler can cope with them, it turns out. Making the paradigm into a macro, which this commit does, makes the uses self-documenting, albeit at the expense of cluttering up the macro definition somewhat; and allows the mechanism to be turned off if necessary for some compilers. Since it will be enabled for the majority of compilers, the potential bugs will be caught anyway.
* handy.h: Fix internal macroKarl Williamson2021-08-071-1/+1
| | | | | | | | | | I found this reading code. The macro is supposed to check for something not being in the ASCII range, but instead checked that the input is invariant under UTF-8. These concepts evaluate to the same thing on ASCII platforms, but differently on EBCDIC ones. The calls to this macro are such that there isn't a bug that surfaces here, but the code generated is slightly different, and it should be fixed to prevent any future issues.
* Remove EBCDIC-only codeKarl Williamson2021-08-071-4/+1
| | | | The previous commit stopped using this code, so can just get rid of it.
* handy.h: Refactor FITS_IN_8_BITS()Karl Williamson2021-07-301-3/+3
| | | | | By using a cast to U8, the '&' operation can be elminated, and the macro easier to read.
* perlapi: Consolidate and revise pod for toCASE_CHANGEfoo()Karl Williamson2021-07-171-111/+151
| | | | | | This finishes the work started by 3cb048e540f681a46e641b466030b55feaf5d337 for toLOWERfoo, using the same paradigm, for the rest of the case changing macros and functions.