mchartable_map(3m17n)
β¨ NAME β¨
mchartable_map β it's giving "map a function over a chartable" energy, bestie π
(the original page left the one-liner blank, so we're keeping it iconic and mysterious, fr fr)
πΈ SYNOPSIS πΈ
int mchartable_map (MCharTable * table, void * ignore, void(*)(int, int,
void *, void *) func, void * func_arg)
π¦ DESCRIPTION π¦
okay so. mchartable_map() calls the function func for characters in the chartable table. That's the whole vibe. π
Here's the lil catch tho: if a character in table has the value ignore, then no function call happens for it. None. Skipped. Not invited to the party. π
And the way it checks whether a character's value is ignore? It literally just uses the operator ==. That's it. So be careful when you use string literals or pointers β because == on those does not compare what you think it compares, and that's a you problem, not a mchartable_map() problem. π
Now the glow-up part β¨: instead of calling func once per character (so extra, so many function calls), mchartable_map() tries to optimize the number of function calls. How? It makes a single function call for a whole chunk of characters whenever those consecutive characters all have the same value. Efficiency queen. π
No matter how long that character chunk is β tiny baby chunk, absolutely massive chunk, doesn't matter β func is always called with four arguments:
fromtovalarg
from and to (both inclusive, bestie, don't forget) define the range of characters that have the value val. And arg is the exact same thing as func_arg. Periodt. π
β RETURN VALUE β
This function always returns 0. Always. Every single time. No drama, no surprises, just a solid zero. π«Ά
π COPYRIGHT π
Copyright (C) 2001 Information-technology Promotion Agency (IPA)
Copyright (C) 2001-2011 National Institute of Advanced Industrial Science and Technology (AIST)
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License <http://www.gnu.org/licenses/fdl.html>.
aaaand that's the whole page, bestie π it's from Version 1.8.4, dated Mon Sep 25 2023, and it lives in The m17n Library manual β mchartable_map(3m17n), no cap. go forth and map those characters ππ
π¦ where this page comes from
- debian trixie: m17n-docs 1.8.4-1
- ubuntu noble: m17n-docs 1.8.4-1
- ubuntu questing: m17n-docs 1.8.4-1
- ubuntu resolute: m17n-docs 1.8.4-1build1
- ubuntu stonking: m17n-docs 1.8.4-1build1
- Copyright (C) 2001 Information-technology Promotion Agency (IPA)
- Copyright (C) 2001-2011 National Institute of Advanced Industrial Science and Technology (AIST)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms