In perl.git, the branch steffen/asciiTableLookup has been created
<http://perl5.git.perl.org/perl.git/commitdiff/7c9d04c9706da54e59811837e17d7e091531bd5d?hp=0000000000000000000000000000000000000000>
at 7c9d04c9706da54e59811837e17d7e091531bd5d (commit)
- Log -----------------------------------------------------------------
commit 7c9d04c9706da54e59811837e17d7e091531bd5d
Author: Karl Williamson <[email protected]>
Date: Thu Sep 23 23:14:58 2010 -0600
handy.h: Add isFOO_L1() macros, using table lookup
This patch adds *_L1() macros for character class lookup, using table
lookup for O(1) performance. These force a Latin-1 interpretation on
ASCII platforms.
There were a couple existing macros that had the suffix U for Unicode
semantics. I thought that those names might be confusing, so settled on
L1 as the least bad name. The older names are kept as synonyms for
backward compatibility. The problem with those names is that these are
actually macros, not functions, and hence can be called with any int,
including any Unicode code point. The U suffix might be mistaken for
indicating they are more general purpose, whereas they are really only
valid for the latin1 subset of Unicode (including the EBCDIC isomorphs).
When called with something outside the latin1 range, they will return
false.
This patch necessitated rearranging a few things in the file. I added
documentation for several more macros, and intend to document the rest.
M handy.h
commit 6c0602bf899166d99701493fc48e6f1c522e55d8
Author: Karl Williamson <[email protected]>
Date: Thu Sep 23 21:26:47 2010 -0600
handy.h: Make isWORDCHAR() primary documentation
This macro is clearer as to intent over isALNUM, and isn't confusable
with isALNUMC. So document it primarily.
M handy.h
commit edeacb73d2fddfee90ae551cc0c29dff782c5096
Author: Karl Williamson <[email protected]>
Date: Thu Sep 23 21:21:20 2010 -0600
handy.h: Slightly change the pod
M handy.h
commit 6581c1e4fd8453679613ddf03e34625f345d6bc1
Author: Karl Williamson <[email protected]>
Date: Thu Sep 23 21:12:51 2010 -0600
handy.h: alphabetize pod entries
There are a number of macros missing from the documentation. This helps
me figure out which ones.
M handy.h
commit 9b3759e49d6e888641242f3409c45559b389ed07
Author: Karl Williamson <[email protected]>
Date: Thu Sep 23 21:04:58 2010 -0600
handy.h: Change isFOO_A() to be O(1) performance
This patch changes the macros whose names end in _A to use table lookup
except for the one (isASCII) which always has only one comparison.
The table is in perl.h. Some code does not #include perl.h. For those,
the previous definitions are retained.
The advantage of this is speed. It replaces some fairly complicated
expressions with an O(1) look-up and a mask.
It uses the FITS_IN_8_BITS() macro to guarantee that the table bounds
are not exceeded. For legal inputs that are byte size, the optimizer
should get rid of this macro leaving only the lookup and mask.
M handy.h
commit fe37d4f5779ef4e3e1103c9527dea82d22cba96d
Author: Karl Williamson <[email protected]>
Date: Thu Sep 23 20:47:03 2010 -0600
Subject: Add 256 word bit table of character classes
This patch adds a table for looking up character classes. It is 256
words long, in perl.h, with each word corresponding to the ordinal of a
Latin1 character, and each word contains a bit map of all the properties
that character matches. Each property has a bit or two. Ones named
_CC_property_A are true only if the character is also in the ASCII
character set. Ones named CC_property_L1 do not have this restriction.
(L1 stands for Latin1.)
Also added is a script that generates the table. It is not anticipated
that this will need to be used often.
M MANIFEST
A Porting/mk_PL_charclass.pl
M perl.h
commit e3718c9547edbf16d50404b0fafdbab41c444806
Author: Karl Williamson <[email protected]>
Date: Thu Sep 23 20:42:40 2010 -0600
handy.h: EBCDIC should use native isalpha()
M handy.h
commit 976cd8ab7e8a37112bbfa51e9007559dd5233bda
Author: Karl Williamson <[email protected]>
Date: Thu Sep 23 20:27:32 2010 -0600
handy.h: Add isFOO_A() macros for ASCII range matches
These macros return true only if the parameter is an ASCII character.
M handy.h
commit 061740369fdd214d48fa0104af9b1f523701f0a9
Author: Karl Williamson <[email protected]>
Date: Thu Sep 23 15:40:21 2010 -0600
handy.h: should use EBCDIC libc isdigit()
as is better optimized and suitable for the purpose.
M handy.h
commit 588858679a46f844baea41e6501109c6fe8a3552
Author: Karl Williamson <[email protected]>
Date: Thu Sep 23 15:08:06 2010 -0600
handy.h: move macro in file
M handy.h
commit 7e4cd9c9996085f61476354a3618d1dab8f6b8b7
Author: Karl Williamson <[email protected]>
Date: Thu Sep 23 14:40:42 2010 -0600
Subject: handy.h: Add isWORDCHAR() for clarity
The name isALNUM() is problematic, as it is very close to isALNUMC(),
and doesn't mean exactly what most people might think. I presume the C
in isALNUMC stands for C language or libc, but am not sure. Others
don't know either. But in any event, isALNUM is different from the C
isalnum(), in that it matches the Perl concept of \w, which differs from
the C definition in exactly one place. Perl includes the underscore
character, '_'.
So, I'm adding a isWORDCHAR() macro for future code to use to be more
clear. I thought also about isWORD(), but I think confusion can arise
from thinking that means a whole word. isWORDCHAR_L1() matches in the
Latin1 range, to be equivalent to isALNUMU(). The motivation for using
L1 instead of U will be explained in a commit message for the other L1
macros that are to be added.
M handy.h
commit 2e57562f77cd7fd0bcbb835f568942dd252ab619
Author: Karl Williamson <[email protected]>
Date: Thu Sep 23 14:30:54 2010 -0600
Add a comment; clarify another
M handy.h
commit 9ce576b87af88bec9f619a187b370bc24656a723
Author: Karl Williamson <[email protected]>
Date: Thu Sep 23 14:27:57 2010 -0600
Indent a comment better
M handy.h
commit 437feba792febb69dfb9152f7e405a541d53d985
Author: Karl Williamson <[email protected]>
Date: Thu Sep 23 14:26:51 2010 -0600
Subject: handy.h: Reorder #defines alphabetically
The only change here is that I sorted these #defines within their
groups, to make it much easier to follow what's going on.
M handy.h
commit 7368d01bec745d0dc946ef6cf4a077ebe2e73951
Author: Karl Williamson <[email protected]>
Date: Thu Sep 23 14:14:09 2010 -0600
handy.h: isSPACE() is wrong for EBCDIC
It didn't include the Latin1 space components.
M handy.h
commit df42c79ee62c69f654b10e69df09fac71a1cb9dd
Author: Karl Williamson <[email protected]>
Date: Thu Sep 23 13:57:51 2010 -0600
handy.h: EBCDIC isBLANK() is wrong
It doesn't include NBSP
M handy.h
commit 3694a36d65c7af41f986fe9468732791e11733cb
Author: Karl Williamson <[email protected]>
Date: Thu Sep 23 13:45:58 2010 -0600
handy.h: isPSXSPC() is wrong for EBCDIC
The macro was using the ASCII definition, which doesn't include NEL nor
NBSP. But, libc contains the correct definition, which is usable on
EBCDIC since we don't worry about locales there.
M handy.h
commit dba5873c02f87f411e9657ef261880b82e31a4d2
Author: Karl Williamson <[email protected]>
Date: Thu Sep 23 13:41:52 2010 -0600
Subject: handy.h: Move defn's outside #ifndef EBCDIC
Commit 4125141464884619e852c7b0986a51eba8fe1636 improperly got rid of
EBCDIC handling, as it combined the ASCII and EBCDIC versions, but left
the result in the ASCII-only branch. Just move to the common code.
M handy.h
-----------------------------------------------------------------------
--
Perl5 Master Repository