Introduction
Introduction Statistics Contact Development Disclaimer Help
Refactor post_process()-function to take the entire property-array - libgraphem…
git clone git://git.suckless.org/libgrapheme
Log
Files
Refs
README
LICENSE
---
commit 6375ae6d522413ba1a6e3b2a62c6e5e99349aafa
parent cd3a639d18c25942d0d48c8001f18222ba5899ef
Author: Laslo Hunhold <[email protected]>
Date: Fri, 28 Oct 2022 17:08:41 +0200
Refactor post_process()-function to take the entire property-array
This does not make much of a difference, but gives enough flexibility
for a later change to incorporate the bidi-bracket-property into the
bidi-LUT.
Signed-off-by: Laslo Hunhold <[email protected]>
Diffstat:
M gen/line.c | 88 ++++++++++++++++-------------…
M gen/util.c | 13 ++++---------
M gen/util.h | 4 ++--
3 files changed, 51 insertions(+), 54 deletions(-)
---
diff --git a/gen/line.c b/gen/line.c
@@ -392,55 +392,57 @@ handle_conflict(uint_least32_t cp, uint_least8_t prop1, u…
return result;
}
-static uint_least8_t
-post_process(uint_least32_t cp, uint_least8_t prop)
+static void
+post_process(struct properties *prop)
{
- const char *target = NULL;
+ const char *target;
uint_least8_t result;
+ size_t i;
- (void)cp;
-
- /* LB1 */
- if (!strcmp(line_break_property[prop].enumname, "TMP_AI") ||
- !strcmp(line_break_property[prop].enumname, "TMP_SG") ||
- !strcmp(line_break_property[prop].enumname, "TMP_XX")) {
- /* map AI, SG and XX to AL */
- target = "AL";
- } else if (!strcmp(line_break_property[prop].enumname, "TMP_SA_WITH_MN…
- /* map SA (with General_Category Mn or Mc) to CM */
- target = "CM";
- } else if (!strcmp(line_break_property[prop].enumname, "TMP_SA_WITHOUT…
- /* map SA (without General_Category Mn or Mc) to AL */
- target = "AL";
- } else if (!strcmp(line_break_property[prop].enumname, "TMP_CJ")) {
- /* map CJ to NS */
- target = "NS";
- } else if (!strcmp(line_break_property[prop].enumname, "TMP_CN") ||
- !strcmp(line_break_property[prop].enumname, "TMP_EXTENDED_P…
- !strcmp(line_break_property[prop].enumname, "TMP_MN") ||
- !strcmp(line_break_property[prop].enumname, "TMP_MC") ||
- !strcmp(line_break_property[prop].enumname, "TMP_EAW_H") ||
- !strcmp(line_break_property[prop].enumname, "TMP_EAW_W") ||
- !strcmp(line_break_property[prop].enumname, "TMP_EAW_F")) {
- /* map all the temporary classes "residue" to AL */
- target = "AL";
- }
+ /* post-mapping according to the line breaking algorithm */
+ for (i = 0; i < UINT32_C(0x110000); i++) {
+ /* LB1 */
+ if (!strcmp(line_break_property[prop[i].property].enumname, "T…
+ !strcmp(line_break_property[prop[i].property].enumname, "T…
+ !strcmp(line_break_property[prop[i].property].enumname, "T…
+ /* map AI, SG and XX to AL */
+ target = "AL";
+ } else if (!strcmp(line_break_property[prop[i].property].enumn…
+ /* map SA (with General_Category Mn or Mc) to CM */
+ target = "CM";
+ } else if (!strcmp(line_break_property[prop[i].property].enumn…
+ /* map SA (without General_Category Mn or Mc) to AL */
+ target = "AL";
+ } else if (!strcmp(line_break_property[prop[i].property].enumn…
+ /* map CJ to NS */
+ target = "NS";
+ } else if (!strcmp(line_break_property[prop[i].property].enumn…
+ !strcmp(line_break_property[prop[i].property].enumn…
+ !strcmp(line_break_property[prop[i].property].enumn…
+ !strcmp(line_break_property[prop[i].property].enumn…
+ !strcmp(line_break_property[prop[i].property].enumn…
+ !strcmp(line_break_property[prop[i].property].enumn…
+ !strcmp(line_break_property[prop[i].property].enumn…
+ /* map all the temporary classes "residue" to AL */
+ target = "AL";
+ } else {
+ target = NULL;
+ }
- if (target) {
- for (result = 0; result < LEN(line_break_property); result++) {
- if (!strcmp(line_break_property[result].enumname,
- target)) {
- break;
+ if (target) {
+ for (result = 0; result < LEN(line_break_property); re…
+ if (!strcmp(line_break_property[result].enumna…
+ target)) {
+ break;
+ }
+ }
+ if (result == LEN(line_break_property)) {
+ fprintf(stderr, "handle_conflict: Internal err…
+ exit(1);
}
- }
- if (result == LEN(line_break_property)) {
- fprintf(stderr, "handle_conflict: Internal error.\n");
- exit(1);
- }
- return result;
- } else {
- return prop;
+ prop[i].property = result;
+ }
}
}
diff --git a/gen/util.c b/gen/util.c
@@ -495,10 +495,9 @@ properties_generate_break_property(const struct property_s…
uint_least32_t),
uint_least8_t (*handle_conflict)(
uint_least32_t, uint_least8_t,
- uint_least8_t), uint_least8_t
- (*post_process)(uint_least32_t,
- uint_least8_t), const char *prefix,
- const char *argv0)
+ uint_least8_t), void
+ (*post_process)(struct properties *),
+ const char *prefix, const char *argv0)
{
struct properties_compressed comp;
struct properties_major_minor mm;
@@ -556,11 +555,7 @@ properties_generate_break_property(const struct property_s…
/* post-processing */
if (post_process != NULL) {
- for (i = 0; i < UINT32_C(0x110000); i++) {
- payload.prop[i].property =
- post_process((uint_least32_t)i,
- (uint_least8_t)payload.prop[i].pr…
- }
+ post_process(payload.prop);
}
/* compress data */
diff --git a/gen/util.h b/gen/util.h
@@ -51,8 +51,8 @@ void properties_generate_break_property(const struct property…
uint_least8_t
(*handle_conflict)(uint_least32_t,
uint_least8_t, uint_least8_t),
- uint_least8_t (*post_process)
- (uint_least32_t, uint_least8_t),
+ void (*post_process)
+ (struct properties *),
const char *, const char *);
void break_test_list_parse(char *, struct break_test **, size_t *);
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.