From: Ben Harris Date: Wed, 15 Jan 2025 11:18:02 +0000 (+0000) Subject: Remove the global "variable" (macro) from 'cvXX'/'ssXX' generation X-Git-Tag: bedstead-3.251~33 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~bjharris/git?a=commitdiff_plain;h=e1e56eab43aac51c838cfc8005bdd8460b51fc69;p=bedstead.git Remove the global "variable" (macro) from 'cvXX'/'ssXX' generation I realised that VAR2 can be a parameter to the various CVXX macros instead. This makes the existing code a little more complicated, but will make the code for the three-way choice of capital D less confusing. The macro names are getting worse, and will definitely need to be rationalised at some point, bit the structure is getting better. --- diff --git a/bedstead.c b/bedstead.c index 227522c..35694c3 100644 --- a/bedstead.c +++ b/bedstead.c @@ -2730,19 +2730,19 @@ static struct alt_sub_override { * are then used to create 'cvXX' features and grouped into 'ssXX' * features. */ -#define CV12 VAR2("comma", ".left") -#define CV14 VAR2("period", ".large") -#define CV26 VAR2("colon", ".leftsmall") -#define CV27 VAR2("semicolon", ".left") -#define CV31 VAR2("question", ".open") VAR2("questiondown", ".open") \ +#define CV12(VAR2) VAR2("comma", ".left") +#define CV14(VAR2) VAR2("period", ".large") +#define CV26(VAR2) VAR2("colon", ".leftsmall") +#define CV27(VAR2) VAR2("semicolon", ".left") +#define CV31(VAR2) VAR2("question", ".open") VAR2("questiondown", ".open") \ VAR2("uni2E2E", ".open") -#define CV42 VAR2("J", ".narrow") -#define CV44 VAR2("L", ".narrow") -#define CV61 VAR2("ugrave",".roundjoined") -#define CV74 VAR2("j", ".serif") -#define CV79 VAR2("ocircumflex", ".large") -#define CV84 VAR2("t", ".small") -#define CV96 VAR2("ccedilla", ".angular") +#define CV42(VAR2) VAR2("J", ".narrow") +#define CV44(VAR2) VAR2("L", ".narrow") +#define CV61(VAR2) VAR2("ugrave",".roundjoined") +#define CV74(VAR2) VAR2("j", ".serif") +#define CV79(VAR2) VAR2("ocircumflex", ".large") +#define CV84(VAR2) VAR2("t", ".small") +#define CV96(VAR2) VAR2("ccedilla", ".angular") static struct gsub_feature { char const *tag; @@ -2764,15 +2764,18 @@ static struct gsub_feature { #define SUB(in, out) "\n" #define SUFFIXSUB(base, suffix) SUB(base, base suffix) #define SINGLESUB(x) "\n" x "\n" -#define VAR2 SUFFIXSUB { "ss01", SCRIPT_ALL, .name = "SAA5051", - .xml = SINGLESUB(CV12 CV14 CV26 CV27 CV31 - SUFFIXSUB("D", ".serif") CV42 CV44 CV74 CV84) }, + .xml = SINGLESUB(CV12(SUFFIXSUB) CV14(SUFFIXSUB) CV26(SUFFIXSUB) + CV27(SUFFIXSUB) CV31(SUFFIXSUB) + SUFFIXSUB("D", ".serif") CV42(SUFFIXSUB) + CV44(SUFFIXSUB) CV74(SUFFIXSUB) CV84(SUFFIXSUB)) }, { "ss02", SCRIPT_ALL, .name = "SAA5052", - .xml = SINGLESUB(CV12 CV14 CV26 CV27 CV31 - SUFFIXSUB("D", ".narrow") CV42 CV44 CV74 CV84) }, + .xml = SINGLESUB(CV12(SUFFIXSUB) CV14(SUFFIXSUB) CV26(SUFFIXSUB) + CV27(SUFFIXSUB) CV31(SUFFIXSUB) + SUFFIXSUB("D", ".narrow") CV42(SUFFIXSUB) + CV44(SUFFIXSUB) CV74(SUFFIXSUB) CV84(SUFFIXSUB)) }, { "ss04", SCRIPT_ALL, .name = "SAA5054", - .xml = SINGLESUB(CV61 CV79 CV96) }, + .xml = SINGLESUB(CV61(SUFFIXSUB) CV79(SUFFIXSUB) CV96(SUFFIXSUB)) }, #define ALT1(g) "" #define ALT2(a, b) ALT1(a) ALT1(b) #define ALT3(a, b, c) ALT1(a) ALT2(b, c) @@ -2782,39 +2785,37 @@ static struct gsub_feature { #define CROSSALT3(a, b, c) ALTSET(a, ALT3(a, b, c)) ALTSET(b, ALT3(a, b, c)) \ ALTSET(c, ALT3(a, b, c)) #define CV2(base, a) CROSSALT2(base, base a) -#undef VAR2 -#define VAR2 CV2 #define CV3(base, a, b) CROSSALT3(base, base a, base b) /* * Where possible, Character Variant features have numbers * that are 32 less than the ASCII code of the base character. */ { "cv12", SCRIPT_ALL, .name = "comma variants", - .xml = ALTSUB(CV12) }, + .xml = ALTSUB(CV12(CV2)) }, { "cv14", SCRIPT_ALL, .name = "full-stop variants", - .xml = ALTSUB(CV14) }, + .xml = ALTSUB(CV14(CV2)) }, { "cv26", SCRIPT_ALL, .name = "colon variants", - .xml = ALTSUB(CV26) }, + .xml = ALTSUB(CV26(CV2)) }, { "cv27", SCRIPT_ALL, .name = "semicolon variants", - .xml = ALTSUB(CV27) }, + .xml = ALTSUB(CV27(CV2)) }, { "cv31", SCRIPT_ALL, .name = "question-mark variants", - .xml = ALTSUB(CV31) }, + .xml = ALTSUB(CV31(CV2)) }, { "cv38", SCRIPT_ALL, .name = "capital-D variants", .xml = ALTSUB(CV3("D", ".serif", ".narrow")) }, { "cv42", SCRIPT_ALL, .name = "capital-J variants", - .xml = ALTSUB(CV42) }, + .xml = ALTSUB(CV42(CV2)) }, { "cv44", SCRIPT_ALL, .name = "capital-L variants", - .xml = ALTSUB(CV44) }, + .xml = ALTSUB(CV44(CV2)) }, { "cv61", SCRIPT_ALL, .name = "small-u-grave variants", - .xml = ALTSUB(CV61) }, + .xml = ALTSUB(CV61(CV2)) }, { "cv74", SCRIPT_ALL, .name = "small-j variants", - .xml = ALTSUB(CV74) }, + .xml = ALTSUB(CV74(CV2)) }, { "cv79", SCRIPT_ALL, .name = "small-o variants", - .xml = ALTSUB(CV79) }, + .xml = ALTSUB(CV79(CV2)) }, { "cv84", SCRIPT_ALL, .name = "small-t variants", - .xml = ALTSUB(CV84) }, + .xml = ALTSUB(CV84(CV2)) }, { "cv96", SCRIPT_ALL, .name = "cedilla variants", - .xml = ALTSUB(CV96) }, + .xml = ALTSUB(CV96(CV2)) }, { "ss14", SCRIPT_ALL, ".sep4", .name = "4-cell separated graphics" }, { "ss16", SCRIPT_ALL, ".sep6", .name = "6-cell separated graphics" }, };