1
0
mirror of https://github.com/cc65/cc65.git synced 2026-03-10 17:21:49 +00:00

use explicit markers (comments) for the bsearch table checking, simplifies the scripts and makes them more robust too :)

This commit is contained in:
mrdudz
2025-06-09 21:48:20 +02:00
parent 717e32ba6a
commit aaa1058d32
22 changed files with 165 additions and 124 deletions

View File

@@ -35,8 +35,9 @@ spaces: spaces.sh
noexec: noexec.sh
@./noexec.sh
sorted: sorted.sh sorted_codeopt.sh
sorted: sorted.sh sorted_codeopt.sh sorted_opcodes.sh
@./sorted.sh
@./sorted_codeopt.sh
@./sorted_opcodes.sh
endif

View File

@@ -2,116 +2,39 @@
OLDCWD=`pwd`
SCRIPT_PATH=`dirname $0`
CHECK_DIR=../../src
SORT_OPT=-u
function checkarray_quoted_name
{
CHECK_FILE="$1"
START="\\/\\* BEGIN SORTED.SH \\*\\/"
END="\\/\\* END SORTED.SH \\*\\/"
awk '/'"$2"'/{flag=1;next}/};/{flag=0}flag' "$CHECK_FILE" | \
sed -e 's:.*\"\(.*\)\".*:\1:g' | \
sed '/^\s*$/d' > .a.tmp
awk '/'"$START"'/{flag=1; count++; next} /'"$END"'/{flag=0;} flag {print count,"##",$0}' "$CHECK_FILE" | \
sed -e 's:\(.*\) ##.*\"\(.*\)\".*:\1##\2:g' > .a.tmp
if [[ -z $(grep '[^[:space:]]' .a.tmp) ]] ; then
echo "error: "$2" table is empty"
echo "error: "$1" table is empty"
rm -rf .a.tmp
exit -1
fi
LC_COLLATE=C sort $SORT_OPT .a.tmp > .b.tmp
if cmp --silent -- .a.tmp .b.tmp; then
echo ""$2" definitions OK"
echo ""$1" tables OK"
else
echo "error: "$2" definitions are not sorted."
echo "error: "$1" tables are not sorted."
diff -y .a.tmp .b.tmp
rm -rf .a.tmp .b.tmp
exit -1
fi
rm -rf .a.tmp .b.tmp
}
function checkinstr_quoted_name
{
CHECK_FILE="$1"
awk '/'"$2"'/{flag=1;next}/};/{flag=0}flag' "$CHECK_FILE" | \
sed -e 's:^ *{$::g' | \
sed -e 's:^ *}$::g' | \
sed -e 's:.*\"\(.*\)\".*:\1:g' | \
sed '/^\s*$/d' > .a.tmp
if [[ -z $(grep '[^[:space:]]' .a.tmp) ]] ; then
echo "error: "$2" table is empty"
exit -1
fi
LC_COLLATE=C sort $SORT_OPT .a.tmp > .b.tmp
if cmp --silent -- .a.tmp .b.tmp; then
echo ""$2" definitions OK"
else
echo "error: "$2" definitions are not sorted."
diff -y .a.tmp .b.tmp
exit -1
fi
rm -rf .a.tmp .b.tmp
}
function checkopcodes_quoted_name
{
CHECK_FILE="$1"
awk '/'"$2"'/{flag=1;next}/};/{flag=0}flag' "$CHECK_FILE" | \
grep "^ *\".*\"," | \
sed '/^\s*$/d' > .a.tmp
if [[ -z $(grep '[^[:space:]]' .a.tmp) ]] ; then
echo "error: "$2" table is empty"
exit -1
fi
LC_COLLATE=C sort $SORT_OPT .a.tmp > .b.tmp
if cmp --silent -- .a.tmp .b.tmp; then
echo ""$2" definitions OK"
else
echo "error: "$2" definitions are not sorted."
diff -y .a.tmp .b.tmp
exit -1
fi
rm -rf .a.tmp .b.tmp
}
checkinstr_quoted_name ../../src/ca65/instr.c "sizeof \(InsTab6502\.Ins\) \/ sizeof \(InsTab6502\.Ins\[0\]\),"
checkinstr_quoted_name ../../src/ca65/instr.c "sizeof \(InsTab6502X\.Ins\) \/ sizeof \(InsTab6502X\.Ins\[0\]\),"
checkinstr_quoted_name ../../src/ca65/instr.c "sizeof \(InsTab6502DTV\.Ins\) \/ sizeof \(InsTab6502DTV\.Ins\[0\]\),"
checkinstr_quoted_name ../../src/ca65/instr.c "sizeof \(InsTab65C02\.Ins\) \/ sizeof \(InsTab65C02\.Ins\[0\]\),"
checkinstr_quoted_name ../../src/ca65/instr.c "sizeof \(InsTab4510\.Ins\) \/ sizeof \(InsTab4510\.Ins\[0\]\),"
checkinstr_quoted_name ../../src/ca65/instr.c "sizeof \(InsTab65816\.Ins\) \/ sizeof \(InsTab65816\.Ins\[0\]\),"
checkinstr_quoted_name ../../src/ca65/instr.c "sizeof \(InsTabSweet16\.Ins\) \/ sizeof \(InsTabSweet16\.Ins\[0\]\),"
checkinstr_quoted_name ../../src/ca65/instr.c "sizeof \(InsTabHuC6280\.Ins\) \/ sizeof \(InsTabHuC6280\.Ins\[0\]\),"
checkarray_quoted_name ../../src/ca65/scanner.c "} DotKeywords \[\] = {"
checkarray_quoted_name ../../src/cc65/codeinfo.c "static const FuncInfo FuncInfoTable\[\]"
checkarray_quoted_name ../../src/cc65/codeinfo.c "static const ZPInfo ZPInfoTable\[\]"
checkarray_quoted_name ../../src/cc65/codeoptutil.c "static const char\* const Tab\[\]"
checkarray_quoted_name ../../src/cc65/coptstop.c "static const OptFuncDesc FuncTable\[\]"
checkarray_quoted_name ../../src/cc65/coptstop.c "static const OptFuncDesc FuncRegATable\[\]"
checkopcodes_quoted_name ../../src/cc65/opcodes.c "const OPCDesc OPCTable\[OP65_COUNT\] = {"
checkarray_quoted_name ../../src/cc65/pragma.c "} Pragmas\[\] = {"
checkarray_quoted_name ../../src/cc65/preproc.c "} PPDTypes\[\] = {"
checkarray_quoted_name ../../src/cc65/scanner.c "} Keywords \[\] = {"
checkarray_quoted_name ../../src/cc65/stdfunc.c "} StdFuncs\[\] = {"
checkarray_quoted_name ../../src/common/filetype.c "static const FileId TypeTable\[\]"
checkarray_quoted_name ../../src/common/target.c "static const TargetEntry TargetMap\[\]"
checkarray_quoted_name ../../src/dbginfo/dbginfo.c "} KeywordTable\[\] = {"
checkarray_quoted_name ../../src/sp65/convert.c "static const ConverterMapEntry ConverterMap\[\]"
checkarray_quoted_name ../../src/sp65/input.c "static const FileId FormatTable\[\]"
checkarray_quoted_name ../../src/sp65/output.c "static const FileId FormatTable\[\]"
checkarray_quoted_name ../../src/sp65/palconv.c "static const PaletteMapEntry PaletteMap\[\]"
for N in `grep -rl "BEGIN SORTED.SH" "$CHECK_DIR"`; do
checkarray_quoted_name $N
done

View File

@@ -1,42 +1,61 @@
#! /bin/bash
OLDCWD=`pwd`
SCRIPT_PATH=`dirname $0`
CHECK_FILE=../../src/cc65/codeopt.c
CHECK_DIR=../../src
SORT_OPT=-u
grep "^static OptFunc " $CHECK_FILE | \
sed -e 's:.*"\(.*\)",.*:\1:g' > .a.tmp
function checkarray
{
CHECK_FILE="$1"
START="\\/\\* BEGIN DECL SORTED_CODEOPT.SH \\*\\/"
END="\\/\\* END DECL SORTED_CODEOPT.SH \\*\\/"
if [[ -z $(grep '[^[:space:]]' .a.tmp) ]] ; then
echo "error: OptFunc table is empty"
exit -1
fi
awk '/'"$START"'/{flag=1; count++; next} /'"$END"'/{flag=0;} flag {print count,"##",$0}' "$CHECK_FILE" | \
sed -e 's:\(.*##\).*"\(.*\)",.*:\1\2:g' > .a.tmp
LC_COLLATE=C sort $SORT_OPT .a.tmp > .b.tmp
if [[ -z $(grep '[^[:space:]]' .a.tmp) ]] ; then
echo "error: "$1" table is empty"
rm -rf .a.tmp
exit -1
fi
if cmp --silent -- .a.tmp .b.tmp; then
echo "static OptFunc definitions OK"
else
echo "error: static OptFunc definitions are not sorted."
diff -y .a.tmp .b.tmp
exit -1
fi
LC_COLLATE=C sort $SORT_OPT .a.tmp > .b.tmp
awk '/static OptFunc\* OptFuncs\[\] = {/{flag=1;next}/}/{flag=0}flag' $CHECK_FILE | \
sed -e 's:.*&D\(.*\),:\1:g' > .a.tmp
if cmp --silent -- .a.tmp .b.tmp; then
echo ""$1" decls OK"
else
echo "error: "$1" decls are not sorted."
diff -y .a.tmp .b.tmp
rm -rf .a.tmp .b.tmp
exit -1
fi
if [[ -z $(grep '[^[:space:]]' .a.tmp) ]] ; then
echo "error: OptFuncs table is empty"
exit -1
fi
START="\\/\\* BEGIN SORTED_CODEOPT.SH \\*\\/"
END="\\/\\* END SORTED_CODEOPT.SH \\*\\/"
awk '/'"$START"'/{flag=1; count++; next} /'"$END"'/{flag=0;} flag {print count,"##",$0}' "$CHECK_FILE" | \
sed -e 's:\(.*##\).*&D\(.*\),.*:\1\2:g' > .a.tmp
if cmp --silent -- .a.tmp .b.tmp; then
echo "static OptFuncs* OptFuncs[] definitions OK"
else
echo "error: static OptFuncs* OptFuncs[] definitions are not sorted."
diff -y .a.tmp .b.tmp
exit -1
fi
if [[ -z $(grep '[^[:space:]]' .a.tmp) ]] ; then
echo "error: "$1" table is empty"
rm -rf .a.tmp
exit -1
fi
rm -rf .a.tmp .b.tmp
if cmp --silent -- .a.tmp .b.tmp; then
echo ""$1" tables OK"
else
echo "error: "$1" tables are not sorted."
diff -y .a.tmp .b.tmp
rm -rf .a.tmp .b.tmp
exit -1
fi
rm -rf .a.tmp .b.tmp
}
for N in `grep -rl "BEGIN DECL SORTED_CODEOPT.SH" "$CHECK_DIR"`; do
checkarray $N
done

42
.github/checks/sorted_opcodes.sh vendored Executable file
View File

@@ -0,0 +1,42 @@
#! /bin/bash
OLDCWD=`pwd`
SCRIPT_PATH=`dirname $0`
CHECK_DIR=../../src
SORT_OPT=-u
function checkarray_quoted_name
{
CHECK_FILE="$1"
START="\\/\\* BEGIN SORTED_OPCODES.SH \\*\\/"
END="\\/\\* END SORTED_OPCODES.SH \\*\\/"
awk '/'"$START"'/{flag=1; count++; next} /'"$END"'/{flag=0;} flag {print count,"##",$0}' "$CHECK_FILE" | \
sed 's:/\*.*::g' | \
grep '".*",' | \
sed -e 's:\(.*\) ##.*\"\(.*\)\".*:\1##\2:g' > .a.tmp
if [[ -z $(grep '[^[:space:]]' .a.tmp) ]] ; then
echo "error: "$1" table is empty"
rm -rf .a.tmp
exit -1
fi
LC_COLLATE=C sort $SORT_OPT .a.tmp > .b.tmp
if cmp --silent -- .a.tmp .b.tmp; then
echo ""$1" tables OK"
else
echo "error: "$1" tables are not sorted."
diff -y .a.tmp .b.tmp
rm -rf .a.tmp .b.tmp
exit -1
fi
rm -rf .a.tmp .b.tmp
}
for N in `grep -rl "BEGIN SORTED_OPCODES.SH" "$CHECK_DIR"`; do
checkarray_quoted_name $N
done

View File

@@ -172,6 +172,7 @@ static const struct {
/* CAUTION: table must be sorted for bsearch */
sizeof (InsTab6502.Ins) / sizeof (InsTab6502.Ins[0]),
{
/* BEGIN SORTED.SH */
{ "ADC", 0x080A26C, 0x60, 0, PutAll },
{ "AND", 0x080A26C, 0x20, 0, PutAll },
{ "ASL", 0x000006e, 0x02, 1, PutAll },
@@ -228,6 +229,7 @@ static const struct {
{ "TXA", 0x0000001, 0x8a, 0, PutAll },
{ "TXS", 0x0000001, 0x9a, 0, PutAll },
{ "TYA", 0x0000001, 0x98, 0, PutAll }
/* END SORTED.SH */
}
};
@@ -239,6 +241,7 @@ static const struct {
/* CAUTION: table must be sorted for bsearch */
sizeof (InsTab6502X.Ins) / sizeof (InsTab6502X.Ins[0]),
{
/* BEGIN SORTED.SH */
{ "ADC", 0x080A26C, 0x60, 0, PutAll },
{ "ALR", 0x0800000, 0x4B, 0, PutAll }, /* X */
{ "ANC", 0x0800000, 0x0B, 0, PutAll }, /* X */
@@ -314,6 +317,7 @@ static const struct {
{ "TXA", 0x0000001, 0x8a, 0, PutAll },
{ "TXS", 0x0000001, 0x9a, 0, PutAll },
{ "TYA", 0x0000001, 0x98, 0, PutAll }
/* END SORTED.SH */
}
};
@@ -329,6 +333,7 @@ static const struct {
/* CAUTION: table must be sorted for bsearch */
sizeof (InsTab6502DTV.Ins) / sizeof (InsTab6502DTV.Ins[0]),
{
/* BEGIN SORTED.SH */
{ "ADC", 0x080A26C, 0x60, 0, PutAll },
{ "ALR", 0x0800000, 0x4B, 0, PutAll }, /* X */
{ "ANC", 0x0800000, 0x0B, 0, PutAll }, /* X */
@@ -400,6 +405,7 @@ static const struct {
{ "TXA", 0x0000001, 0x8a, 0, PutAll },
{ "TXS", 0x0000001, 0x9a, 0, PutAll },
{ "TYA", 0x0000001, 0x98, 0, PutAll }
/* END SORTED.SH */
}
};
@@ -411,6 +417,7 @@ static const struct {
/* CAUTION: table must be sorted for bsearch */
sizeof (InsTab65SC02.Ins) / sizeof (InsTab65SC02.Ins[0]),
{
/* BEGIN SORTED.SH */
{ "ADC", 0x080A66C, 0x60, 0, PutAll },
{ "AND", 0x080A66C, 0x20, 0, PutAll },
{ "ASL", 0x000006e, 0x02, 1, PutAll },
@@ -477,6 +484,7 @@ static const struct {
{ "TXA", 0x0000001, 0x8a, 0, PutAll },
{ "TXS", 0x0000001, 0x9a, 0, PutAll },
{ "TYA", 0x0000001, 0x98, 0, PutAll }
/* END SORTED.SH */
}
};
@@ -488,6 +496,7 @@ static const struct {
/* CAUTION: table must be sorted for bsearch */
sizeof (InsTab65C02.Ins) / sizeof (InsTab65C02.Ins[0]),
{
/* BEGIN SORTED.SH */
{ "ADC", 0x080A66C, 0x60, 0, PutAll },
{ "AND", 0x080A66C, 0x20, 0, PutAll },
{ "ASL", 0x000006e, 0x02, 1, PutAll },
@@ -588,6 +597,7 @@ static const struct {
{ "TXS", 0x0000001, 0x9a, 0, PutAll },
{ "TYA", 0x0000001, 0x98, 0, PutAll },
{ "WAI", 0x0000001, 0xcb, 0, PutAll }
/* END SORTED.SH */
}
};
@@ -599,6 +609,7 @@ static const struct {
/* CAUTION: table must be sorted for bsearch */
sizeof (InsTab4510.Ins) / sizeof (InsTab4510.Ins[0]),
{
/* BEGIN SORTED.SH */
{ "ADC", 0x080A66C, 0x60, 0, PutAll },
{ "AND", 0x080A66C, 0x20, 0, PutAll },
{ "ASL", 0x000006e, 0x02, 1, PutAll },
@@ -732,6 +743,7 @@ static const struct {
{ "TYA", 0x0000001, 0x98, 0, PutAll },
{ "TYS", 0x0000001, 0x2b, 0, PutAll },
{ "TZA", 0x0000001, 0x6b, 0, PutAll },
/* END SORTED.SH */
}
};
@@ -743,6 +755,7 @@ static const struct {
/* CAUTION: table must be sorted for bsearch */
sizeof (InsTab65816.Ins) / sizeof (InsTab65816.Ins[0]),
{
/* BEGIN SORTED.SH */
{ "ADC", 0x0b8f6fc, 0x60, 0, PutAll },
{ "AND", 0x0b8f6fc, 0x20, 0, PutAll },
{ "ASL", 0x000006e, 0x02, 1, PutAll },
@@ -843,6 +856,7 @@ static const struct {
{ "WDM", 0x0800004, 0x42, 6, PutAll },
{ "XBA", 0x0000001, 0xeb, 0, PutAll },
{ "XCE", 0x0000001, 0xfb, 0, PutAll }
/* END SORTED.SH */
}
};
@@ -854,6 +868,7 @@ static const struct {
/* CAUTION: table must be sorted for bsearch */
sizeof (InsTabSweet16.Ins) / sizeof (InsTabSweet16.Ins[0]),
{
/* BEGIN SORTED.SH */
{ "ADD", AMSW16_REG, 0xA0, 0, PutSweet16 },
{ "BC", AMSW16_BRA, 0x03, 0, PutSweet16Branch },
{ "BK", AMSW16_IMP, 0x0A, 0, PutSweet16 },
@@ -880,6 +895,7 @@ static const struct {
{ "STD", AMSW16_IND, 0x70, 0, PutSweet16 },
{ "STP", AMSW16_IND, 0x90, 0, PutSweet16 },
{ "SUB", AMSW16_REG, 0xB0, 0, PutSweet16 },
/* END SORTED.SH */
}
};
@@ -891,6 +907,7 @@ static const struct {
/* CAUTION: table must be sorted for bsearch */
sizeof (InsTabHuC6280.Ins) / sizeof (InsTabHuC6280.Ins[0]),
{
/* BEGIN SORTED.SH */
{ "ADC", 0x080A66C, 0x60, 0, PutAll },
{ "AND", 0x080A66C, 0x20, 0, PutAll },
{ "ASL", 0x000006e, 0x02, 1, PutAll },
@@ -1026,6 +1043,7 @@ static const struct {
{ "TXA", 0x0000001, 0x8a, 0, PutAll },
{ "TXS", 0x0000001, 0x9a, 0, PutAll },
{ "TYA", 0x0000001, 0x98, 0, PutAll }
/* END SORTED.SH */
}
};

View File

@@ -136,6 +136,7 @@ struct DotKeyword {
const char* Key; /* MUST be first field */
token_t Tok;
} DotKeywords [] = {
/* BEGIN SORTED.SH */
{ ".A16", TOK_A16 },
{ ".A8", TOK_A8 },
{ ".ADDR", TOK_ADDR },
@@ -307,6 +308,7 @@ struct DotKeyword {
{ ".XMATCH", TOK_XMATCH },
{ ".XOR", TOK_BOOLXOR },
{ ".ZEROPAGE", TOK_ZEROPAGE },
/* END SORTED.SH */
};

View File

@@ -92,6 +92,7 @@ struct FuncInfo {
*/
/* CAUTION: table must be sorted for bsearch */
static const FuncInfo FuncInfoTable[] = {
/* BEGIN SORTED.SH */
{ "addeq0sp", SLV_TOP | REG_AX, PSTATE_ALL | REG_AXY },
{ "addeqysp", SLV_IND | REG_AXY, PSTATE_ALL | REG_AXY },
{ "addysp", REG_SP | REG_Y, PSTATE_ALL | REG_SP },
@@ -377,12 +378,14 @@ static const FuncInfo FuncInfoTable[] = {
{ "tosxoreax", SLV_TOP | REG_EAX, PSTATE_ALL | REG_SP | REG_EAXY | REG_TMP1 },
{ "tsteax", REG_EAX, PSTATE_ALL | REG_Y },
{ "utsteax", REG_EAX, PSTATE_ALL | REG_Y },
/* END SORTED.SH */
};
#define FuncInfoCount (sizeof(FuncInfoTable) / sizeof(FuncInfoTable[0]))
/* Table with names of zero page locations used by the compiler */
/* CAUTION: table must be sorted for bsearch */
static const ZPInfo ZPInfoTable[] = {
/* BEGIN SORTED.SH */
{ 0, "ptr1", 2, REG_PTR1_LO, REG_PTR1 },
{ 0, "ptr1+1", 1, REG_PTR1_HI, REG_PTR1 },
{ 0, "ptr2", 2, REG_PTR2_LO, REG_PTR2 },
@@ -400,6 +403,7 @@ static const ZPInfo ZPInfoTable[] = {
{ 0, "tmp2", 1, REG_NONE, REG_NONE },
{ 0, "tmp3", 1, REG_NONE, REG_NONE },
{ 0, "tmp4", 1, REG_NONE, REG_NONE },
/* END SORTED.SH */
};
#define ZPInfoCount (sizeof(ZPInfoTable) / sizeof(ZPInfoTable[0]))

View File

@@ -103,6 +103,7 @@ struct OptFunc {
/* A list of all the function descriptions */
/* CAUTION: should be sorted by "name" */
/* BEGIN DECL SORTED_CODEOPT.SH */
static OptFunc DOpt65C02BitOps = { Opt65C02BitOps, "Opt65C02BitOps", 66, 0, 0, 0, 0, 0 };
static OptFunc DOpt65C02Ind = { Opt65C02Ind, "Opt65C02Ind", 100, 0, 0, 0, 0, 0 };
static OptFunc DOpt65C02Stores = { Opt65C02Stores, "Opt65C02Stores", 100, 0, 0, 0, 0, 0 };
@@ -215,11 +216,13 @@ static OptFunc DOptTransfers3 = { OptTransfers3, "OptTransfers3", 65, 0,
static OptFunc DOptTransfers4 = { OptTransfers4, "OptTransfers4", 65, 0, 0, 0, 0, 0 };
static OptFunc DOptUnusedLoads = { OptUnusedLoads, "OptUnusedLoads", 0, 0, 0, 0, 0, 0 };
static OptFunc DOptUnusedStores = { OptUnusedStores, "OptUnusedStores", 0, 0, 0, 0, 0, 0 };
/* END DECL SORTED_CODEOPT.SH */
/* Table containing all the steps in alphabetical order */
/* CAUTION: table must be sorted for bsearch */
static OptFunc* OptFuncs[] = {
/* BEGIN SORTED_CODEOPT.SH */
&DOpt65C02BitOps,
&DOpt65C02Ind,
&DOpt65C02Stores,
@@ -332,6 +335,7 @@ static OptFunc* OptFuncs[] = {
&DOptTransfers4,
&DOptUnusedLoads,
&DOptUnusedStores,
/* END SORTED_CODEOPT.SH */
};
#define OPTFUNC_COUNT (sizeof(OptFuncs) / sizeof(OptFuncs[0]))

View File

@@ -1227,7 +1227,9 @@ static int CmpHarmless (const void* Key, const void* Entry)
/* CAUTION: table must be sorted for bsearch */
static const char* const Tab[] = {
/* BEGIN SORTED.SH */
"_abs",
/* END SORTED.SH */
};
int HarmlessCall (const CodeEntry* E, int PushedBytes)

View File

@@ -1466,6 +1466,7 @@ static unsigned Opt_a_tosxor (StackOpData* D)
/* CAUTION: table must be sorted for bsearch */
static const OptFuncDesc FuncTable[] = {
/* BEGIN SORTED.SH */
{ "___bzero", Opt___bzero, REG_NONE, OP_X_ZERO | OP_A_KNOWN },
{ "staspidx", Opt_staspidx, REG_NONE, OP_NONE },
{ "staxspidx", Opt_staxspidx, REG_AX, OP_NONE },
@@ -1486,10 +1487,12 @@ static const OptFuncDesc FuncTable[] = {
{ "tosuleax", Opt_tosuleax, REG_NONE, OP_RHS_REMOVE_DIRECT | OP_RHS_LOAD_DIRECT },
{ "tosultax", Opt_tosultax, REG_NONE, OP_RHS_REMOVE_DIRECT | OP_RHS_LOAD_DIRECT },
{ "tosxorax", Opt_tosxorax, REG_NONE, OP_NONE },
/* END SORTED.SH */
};
/* CAUTION: table must be sorted for bsearch */
static const OptFuncDesc FuncRegATable[] = {
/* BEGIN SORTED.SH */
{ "tosandax", Opt_a_tosand, REG_NONE, OP_RHS_REMOVE_DIRECT | OP_RHS_LOAD_DIRECT },
{ "toseqax", Opt_a_toseq, REG_NONE, OP_NONE },
{ "tosgeax", Opt_a_tosuge, REG_NONE, OP_NONE },
@@ -1505,6 +1508,7 @@ static const OptFuncDesc FuncRegATable[] = {
{ "tosuleax", Opt_a_tosule, REG_NONE, OP_NONE },
{ "tosultax", Opt_a_tosult, REG_NONE, OP_NONE },
{ "tosxorax", Opt_a_tosxor, REG_NONE, OP_RHS_REMOVE_DIRECT | OP_RHS_LOAD_DIRECT },
/* END SORTED.SH */
};
#define FUNC_COUNT(Table) (sizeof(Table) / sizeof(Table[0]))

View File

@@ -59,6 +59,8 @@
const OPCDesc OPCTable[OP65_COUNT] = {
/* 65XX opcodes */
/* BEGIN SORTED_OPCODES.SH */
{ OP65_ADC, /* opcode */
"adc", /* mnemonic */
0, /* size */
@@ -587,6 +589,7 @@ const OPCDesc OPCTable[OP65_COUNT] = {
REG_Y, /* use */
REG_A | PSTATE_ZN /* chg */
},
/* END SORTED_OPCODES.SH */
};

View File

@@ -94,6 +94,7 @@ static const struct Pragma {
const char* Key; /* Keyword */
pragma_t Tok; /* Token */
} Pragmas[] = {
/* BEGIN SORTED.SH */
{ "align", PRAGMA_ALIGN },
{ "allow-eager-inline", PRAGMA_ALLOW_EAGER_INLINE },
{ "allow_eager_inline", PRAGMA_ALLOW_EAGER_INLINE },
@@ -128,6 +129,7 @@ static const struct Pragma {
{ "writable-strings", PRAGMA_WRITABLE_STRINGS },
{ "writable_strings", PRAGMA_WRITABLE_STRINGS },
{ "zpsym", PRAGMA_ZPSYM },
/* END SORTED.SH */
};
#define PRAGMA_COUNT (sizeof (Pragmas) / sizeof (Pragmas[0]))

View File

@@ -221,6 +221,7 @@ static const struct PPDType {
const char* Tok; /* Token */
ppdirective_t Type; /* Type */
} PPDTypes[] = {
/* BEGIN SORTED.SH */
{ "define", PPD_DEFINE },
{ "elif", PPD_ELIF },
{ "else", PPD_ELSE },
@@ -234,6 +235,7 @@ static const struct PPDType {
{ "pragma", PPD_PRAGMA },
{ "undef", PPD_UNDEF },
{ "warning", PPD_WARNING },
/* END SORTED.SH */
};
/* Number of preprocessor directive types */

View File

@@ -93,6 +93,7 @@ static const struct Keyword {
unsigned char Tok; /* The token */
unsigned char Std; /* Token supported in which standards? */
} Keywords [] = {
/* BEGIN SORTED.SH */
{ "_Pragma", TOK_PRAGMA, TT_C89 | TT_C99 | TT_CC65 }, /* !! */
{ "_Static_assert", TOK_STATIC_ASSERT, TT_CC65 }, /* C11 */
{ "__AX__", TOK_AX, TT_C89 | TT_C99 | TT_CC65 },
@@ -146,6 +147,7 @@ static const struct Keyword {
{ "void", TOK_VOID, TT_C89 | TT_C99 | TT_CC65 },
{ "volatile", TOK_VOLATILE, TT_C89 | TT_C99 | TT_CC65 },
{ "while", TOK_WHILE, TT_C89 | TT_C99 | TT_CC65 },
/* END SORTED.SH */
};
#define KEY_COUNT (sizeof (Keywords) / sizeof (Keywords [0]))

View File

@@ -85,11 +85,13 @@ static struct StdFuncDesc {
const char* Name;
void (*Handler) (FuncDesc*, ExprDesc*);
} StdFuncs[] = {
/* BEGIN SORTED.SH */
{ "memcpy", StdFunc_memcpy },
{ "memset", StdFunc_memset },
{ "strcmp", StdFunc_strcmp },
{ "strcpy", StdFunc_strcpy },
{ "strlen", StdFunc_strlen },
/* END SORTED.SH */
};
#define FUNC_COUNT (sizeof (StdFuncs) / sizeof (StdFuncs[0]))

View File

@@ -51,6 +51,7 @@
/* CAUTION: table must be sorted for bsearch */
static const FileId TypeTable[] = {
/* Upper case stuff for obsolete operating systems */
/* BEGIN SORTED.SH */
{ "A", FILETYPE_LIB },
{ "A65", FILETYPE_ASM },
{ "ASM", FILETYPE_ASM },
@@ -66,7 +67,6 @@ static const FileId TypeTable[] = {
{ "S", FILETYPE_ASM },
{ "SER", FILETYPE_O65 },
{ "TGI", FILETYPE_O65 },
{ "a", FILETYPE_LIB },
{ "a65", FILETYPE_ASM },
{ "asm", FILETYPE_ASM },
@@ -82,6 +82,7 @@ static const FileId TypeTable[] = {
{ "s", FILETYPE_ASM },
{ "ser", FILETYPE_O65 },
{ "tgi", FILETYPE_O65 },
/* END SORTED.SH */
};
#define FILETYPE_COUNT (sizeof (TypeTable) / sizeof (TypeTable[0]))

View File

@@ -143,6 +143,7 @@ struct TargetEntry {
** CAUTION: must be alphabetically for bsearch().
*/
static const TargetEntry TargetMap[] = {
/* BEGIN SORTED.SH */
{ "apple2", TGT_APPLE2 },
{ "apple2enh", TGT_APPLE2ENH },
{ "atari", TGT_ATARI },
@@ -181,6 +182,7 @@ static const TargetEntry TargetMap[] = {
{ "sym1", TGT_SYM1 },
{ "telestrat", TGT_TELESTRAT },
{ "vic20", TGT_VIC20 },
/* END SORTED.SH */
};
#define MAP_ENTRY_COUNT (sizeof (TargetMap) / sizeof (TargetMap[0]))

View File

@@ -2531,6 +2531,7 @@ static void NextToken (InputData* D)
const char Keyword[12];
Token Tok;
} KeywordTable[] = {
/* BEGIN SORTED.SH */
{ "abs", TOK_ABSOLUTE },
{ "addrsize", TOK_ADDRSIZE },
{ "auto", TOK_AUTO },
@@ -2579,6 +2580,7 @@ static void NextToken (InputData* D)
{ "var", TOK_VAR },
{ "version", TOK_VERSION },
{ "zp", TOK_ZEROPAGE },
/* END SORTED.SH */
};

View File

@@ -64,12 +64,14 @@ struct ConverterMapEntry {
/* Converter table */
/* CAUTION: table must be alphabetically sorted for bsearch */
static const ConverterMapEntry ConverterMap[] = {
/* BEGIN SORTED.SH */
{ "geos-bitmap", GenGeosBitmap },
{ "geos-icon", GenGeosIcon },
{ "koala", GenKoala },
{ "lynx-sprite", GenLynxSprite },
{ "raw", GenRaw },
{ "vic2-sprite", GenVic2Sprite },
/* END SORTED.SH */
};

View File

@@ -73,9 +73,10 @@ static InputFormatDesc InputFormatTable[ifCount] = {
/* CAUTION: table must be alphabetically sorted for bsearch */
static const FileId FormatTable[] = {
/* Upper case stuff for obsolete operating systems */
/* BEGIN SORTED.SH */
{ "PCX", ifPCX },
{ "pcx", ifPCX },
/* END SORTED.SH */
};

View File

@@ -82,19 +82,20 @@ static OutputFormatDesc OutputFormatTable[ofCount] = {
/* CAUTION: table must be alphabetically sorted for bsearch */
static const FileId FormatTable[] = {
/* Upper case stuff for obsolete operating systems */
/* BEGIN SORTED.SH */
{ "A", ofAsm },
{ "ASM", ofAsm },
{ "BIN", ofBin },
{ "C", ofC },
{ "INC", ofAsm },
{ "S", ofAsm },
{ "a", ofAsm },
{ "asm", ofAsm },
{ "bin", ofBin },
{ "c", ofC },
{ "inc", ofAsm },
{ "s", ofAsm },
/* END SORTED.SH */
};

View File

@@ -59,7 +59,9 @@ struct PaletteMapEntry {
/* Converter table */
/* CAUTION: table must be alphabetically sorted for bsearch */
static const PaletteMapEntry PaletteMap[] = {
/* BEGIN SORTED.SH */
{ "lynx-palette", GenLynxPalette },
/* END SORTED.SH */
};