fix bsearch tables that must be sorted, add comment to all tables that must be sorted
This commit is contained in:
@@ -169,6 +169,7 @@ static const struct {
|
|||||||
unsigned Count;
|
unsigned Count;
|
||||||
InsDesc Ins[56];
|
InsDesc Ins[56];
|
||||||
} InsTab6502 = {
|
} InsTab6502 = {
|
||||||
|
/* CAUTION: table must be sorted for bsearch */
|
||||||
sizeof (InsTab6502.Ins) / sizeof (InsTab6502.Ins[0]),
|
sizeof (InsTab6502.Ins) / sizeof (InsTab6502.Ins[0]),
|
||||||
{
|
{
|
||||||
{ "ADC", 0x080A26C, 0x60, 0, PutAll },
|
{ "ADC", 0x080A26C, 0x60, 0, PutAll },
|
||||||
@@ -235,6 +236,7 @@ static const struct {
|
|||||||
unsigned Count;
|
unsigned Count;
|
||||||
InsDesc Ins[75];
|
InsDesc Ins[75];
|
||||||
} InsTab6502X = {
|
} InsTab6502X = {
|
||||||
|
/* CAUTION: table must be sorted for bsearch */
|
||||||
sizeof (InsTab6502X.Ins) / sizeof (InsTab6502X.Ins[0]),
|
sizeof (InsTab6502X.Ins) / sizeof (InsTab6502X.Ins[0]),
|
||||||
{
|
{
|
||||||
{ "ADC", 0x080A26C, 0x60, 0, PutAll },
|
{ "ADC", 0x080A26C, 0x60, 0, PutAll },
|
||||||
@@ -324,6 +326,7 @@ static const struct {
|
|||||||
unsigned Count;
|
unsigned Count;
|
||||||
InsDesc Ins[71];
|
InsDesc Ins[71];
|
||||||
} InsTab6502DTV = {
|
} InsTab6502DTV = {
|
||||||
|
/* CAUTION: table must be sorted for bsearch */
|
||||||
sizeof (InsTab6502DTV.Ins) / sizeof (InsTab6502DTV.Ins[0]),
|
sizeof (InsTab6502DTV.Ins) / sizeof (InsTab6502DTV.Ins[0]),
|
||||||
{
|
{
|
||||||
{ "ADC", 0x080A26C, 0x60, 0, PutAll },
|
{ "ADC", 0x080A26C, 0x60, 0, PutAll },
|
||||||
@@ -405,6 +408,7 @@ static const struct {
|
|||||||
unsigned Count;
|
unsigned Count;
|
||||||
InsDesc Ins[66];
|
InsDesc Ins[66];
|
||||||
} InsTab65SC02 = {
|
} InsTab65SC02 = {
|
||||||
|
/* CAUTION: table must be sorted for bsearch */
|
||||||
sizeof (InsTab65SC02.Ins) / sizeof (InsTab65SC02.Ins[0]),
|
sizeof (InsTab65SC02.Ins) / sizeof (InsTab65SC02.Ins[0]),
|
||||||
{
|
{
|
||||||
{ "ADC", 0x080A66C, 0x60, 0, PutAll },
|
{ "ADC", 0x080A66C, 0x60, 0, PutAll },
|
||||||
@@ -481,6 +485,7 @@ static const struct {
|
|||||||
unsigned Count;
|
unsigned Count;
|
||||||
InsDesc Ins[100];
|
InsDesc Ins[100];
|
||||||
} InsTab65C02 = {
|
} InsTab65C02 = {
|
||||||
|
/* CAUTION: table must be sorted for bsearch */
|
||||||
sizeof (InsTab65C02.Ins) / sizeof (InsTab65C02.Ins[0]),
|
sizeof (InsTab65C02.Ins) / sizeof (InsTab65C02.Ins[0]),
|
||||||
{
|
{
|
||||||
{ "ADC", 0x080A66C, 0x60, 0, PutAll },
|
{ "ADC", 0x080A66C, 0x60, 0, PutAll },
|
||||||
@@ -591,6 +596,7 @@ static const struct {
|
|||||||
unsigned Count;
|
unsigned Count;
|
||||||
InsDesc Ins[133];
|
InsDesc Ins[133];
|
||||||
} InsTab4510 = {
|
} InsTab4510 = {
|
||||||
|
/* CAUTION: table must be sorted for bsearch */
|
||||||
sizeof (InsTab4510.Ins) / sizeof (InsTab4510.Ins[0]),
|
sizeof (InsTab4510.Ins) / sizeof (InsTab4510.Ins[0]),
|
||||||
{
|
{
|
||||||
{ "ADC", 0x080A66C, 0x60, 0, PutAll },
|
{ "ADC", 0x080A66C, 0x60, 0, PutAll },
|
||||||
@@ -734,6 +740,7 @@ static const struct {
|
|||||||
unsigned Count;
|
unsigned Count;
|
||||||
InsDesc Ins[100];
|
InsDesc Ins[100];
|
||||||
} InsTab65816 = {
|
} InsTab65816 = {
|
||||||
|
/* CAUTION: table must be sorted for bsearch */
|
||||||
sizeof (InsTab65816.Ins) / sizeof (InsTab65816.Ins[0]),
|
sizeof (InsTab65816.Ins) / sizeof (InsTab65816.Ins[0]),
|
||||||
{
|
{
|
||||||
{ "ADC", 0x0b8f6fc, 0x60, 0, PutAll },
|
{ "ADC", 0x0b8f6fc, 0x60, 0, PutAll },
|
||||||
@@ -844,6 +851,7 @@ static const struct {
|
|||||||
unsigned Count;
|
unsigned Count;
|
||||||
InsDesc Ins[26];
|
InsDesc Ins[26];
|
||||||
} InsTabSweet16 = {
|
} InsTabSweet16 = {
|
||||||
|
/* CAUTION: table must be sorted for bsearch */
|
||||||
sizeof (InsTabSweet16.Ins) / sizeof (InsTabSweet16.Ins[0]),
|
sizeof (InsTabSweet16.Ins) / sizeof (InsTabSweet16.Ins[0]),
|
||||||
{
|
{
|
||||||
{ "ADD", AMSW16_REG, 0xA0, 0, PutSweet16 },
|
{ "ADD", AMSW16_REG, 0xA0, 0, PutSweet16 },
|
||||||
@@ -880,6 +888,7 @@ static const struct {
|
|||||||
unsigned Count;
|
unsigned Count;
|
||||||
InsDesc Ins[135];
|
InsDesc Ins[135];
|
||||||
} InsTabHuC6280 = {
|
} InsTabHuC6280 = {
|
||||||
|
/* CAUTION: table must be sorted for bsearch */
|
||||||
sizeof (InsTabHuC6280.Ins) / sizeof (InsTabHuC6280.Ins[0]),
|
sizeof (InsTabHuC6280.Ins) / sizeof (InsTabHuC6280.Ins[0]),
|
||||||
{
|
{
|
||||||
{ "ADC", 0x080A66C, 0x60, 0, PutAll },
|
{ "ADC", 0x080A66C, 0x60, 0, PutAll },
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ static int C = 0; /* Current input character */
|
|||||||
int ForcedEnd = 0;
|
int ForcedEnd = 0;
|
||||||
|
|
||||||
/* List of dot keywords with the corresponding tokens */
|
/* List of dot keywords with the corresponding tokens */
|
||||||
|
/* CAUTION: table must be sorted for bsearch */
|
||||||
struct DotKeyword {
|
struct DotKeyword {
|
||||||
const char* Key; /* MUST be first field */
|
const char* Key; /* MUST be first field */
|
||||||
token_t Tok;
|
token_t Tok;
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ struct FuncInfo {
|
|||||||
** routines are marked to use only the A register. The remainder is ignored
|
** routines are marked to use only the A register. The remainder is ignored
|
||||||
** anyway.
|
** anyway.
|
||||||
*/
|
*/
|
||||||
|
/* CAUTION: table must be sorted for bsearch */
|
||||||
static const FuncInfo FuncInfoTable[] = {
|
static const FuncInfo FuncInfoTable[] = {
|
||||||
{ "addeq0sp", SLV_TOP | REG_AX, PSTATE_ALL | REG_AXY },
|
{ "addeq0sp", SLV_TOP | REG_AX, PSTATE_ALL | REG_AXY },
|
||||||
{ "addeqysp", SLV_IND | REG_AXY, PSTATE_ALL | REG_AXY },
|
{ "addeqysp", SLV_IND | REG_AXY, PSTATE_ALL | REG_AXY },
|
||||||
@@ -190,12 +191,12 @@ static const FuncInfo FuncInfoTable[] = {
|
|||||||
{ "ldeaxysp", SLV_IND | REG_Y, PSTATE_ALL | REG_EAXY },
|
{ "ldeaxysp", SLV_IND | REG_Y, PSTATE_ALL | REG_EAXY },
|
||||||
{ "leaa0sp", REG_SP | REG_A, PSTATE_ALL | REG_AX },
|
{ "leaa0sp", REG_SP | REG_A, PSTATE_ALL | REG_AX },
|
||||||
{ "leaaxsp", REG_SP | REG_AX, PSTATE_ALL | REG_AX },
|
{ "leaaxsp", REG_SP | REG_AX, PSTATE_ALL | REG_AX },
|
||||||
{ "leave00", REG_SP, PSTATE_ALL | REG_SP | REG_AXY },
|
|
||||||
{ "leave0", REG_SP, PSTATE_ALL | REG_SP | REG_XY },
|
|
||||||
{ "leave", REG_SP, PSTATE_ALL | REG_SP | REG_Y },
|
{ "leave", REG_SP, PSTATE_ALL | REG_SP | REG_Y },
|
||||||
{ "leavey00", REG_SP, PSTATE_ALL | REG_SP | REG_AXY },
|
{ "leave0", REG_SP, PSTATE_ALL | REG_SP | REG_XY },
|
||||||
{ "leavey0", REG_SP, PSTATE_ALL | REG_SP | REG_XY },
|
{ "leave00", REG_SP, PSTATE_ALL | REG_SP | REG_AXY },
|
||||||
{ "leavey", REG_SP | REG_Y, PSTATE_ALL | REG_SP | REG_Y },
|
{ "leavey", REG_SP | REG_Y, PSTATE_ALL | REG_SP | REG_Y },
|
||||||
|
{ "leavey0", REG_SP, PSTATE_ALL | REG_SP | REG_XY },
|
||||||
|
{ "leavey00", REG_SP, PSTATE_ALL | REG_SP | REG_AXY },
|
||||||
{ "lsubeq", REG_EAXY | REG_PTR1_LO, PSTATE_ALL | REG_EAXY | REG_PTR1_HI },
|
{ "lsubeq", REG_EAXY | REG_PTR1_LO, PSTATE_ALL | REG_EAXY | REG_PTR1_HI },
|
||||||
{ "lsubeq0sp", SLV_TOP | REG_EAX, PSTATE_ALL | REG_EAXY },
|
{ "lsubeq0sp", SLV_TOP | REG_EAX, PSTATE_ALL | REG_EAXY },
|
||||||
{ "lsubeq1", REG_Y | REG_PTR1_LO, PSTATE_ALL | REG_EAXY | REG_PTR1_HI },
|
{ "lsubeq1", REG_Y | REG_PTR1_LO, PSTATE_ALL | REG_EAXY | REG_PTR1_HI },
|
||||||
@@ -380,6 +381,7 @@ static const FuncInfo FuncInfoTable[] = {
|
|||||||
#define FuncInfoCount (sizeof(FuncInfoTable) / sizeof(FuncInfoTable[0]))
|
#define FuncInfoCount (sizeof(FuncInfoTable) / sizeof(FuncInfoTable[0]))
|
||||||
|
|
||||||
/* Table with names of zero page locations used by the compiler */
|
/* Table with names of zero page locations used by the compiler */
|
||||||
|
/* CAUTION: table must be sorted for bsearch */
|
||||||
static const ZPInfo ZPInfoTable[] = {
|
static const ZPInfo ZPInfoTable[] = {
|
||||||
{ 0, "ptr1", 2, REG_PTR1_LO, REG_PTR1 },
|
{ 0, "ptr1", 2, REG_PTR1_LO, REG_PTR1 },
|
||||||
{ 0, "ptr1+1", 1, REG_PTR1_HI, REG_PTR1 },
|
{ 0, "ptr1+1", 1, REG_PTR1_HI, REG_PTR1 },
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ struct OptFunc {
|
|||||||
|
|
||||||
|
|
||||||
/* A list of all the function descriptions */
|
/* A list of all the function descriptions */
|
||||||
|
/* CAUTION: should be sorted by "name" */
|
||||||
static OptFunc DOpt65C02BitOps = { Opt65C02BitOps, "Opt65C02BitOps", 66, 0, 0, 0, 0, 0 };
|
static OptFunc DOpt65C02BitOps = { Opt65C02BitOps, "Opt65C02BitOps", 66, 0, 0, 0, 0, 0 };
|
||||||
static OptFunc DOpt65C02Ind = { Opt65C02Ind, "Opt65C02Ind", 100, 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 };
|
static OptFunc DOpt65C02Stores = { Opt65C02Stores, "Opt65C02Stores", 100, 0, 0, 0, 0, 0 };
|
||||||
@@ -152,18 +153,13 @@ static OptFunc DOptJumpTarget3 = { OptJumpTarget3, "OptJumpTarget3", 100, 0,
|
|||||||
static OptFunc DOptLoad1 = { OptLoad1, "OptLoad1", 100, 0, 0, 0, 0, 0 };
|
static OptFunc DOptLoad1 = { OptLoad1, "OptLoad1", 100, 0, 0, 0, 0, 0 };
|
||||||
static OptFunc DOptLoad2 = { OptLoad2, "OptLoad2", 200, 0, 0, 0, 0, 0 };
|
static OptFunc DOptLoad2 = { OptLoad2, "OptLoad2", 200, 0, 0, 0, 0, 0 };
|
||||||
static OptFunc DOptLoad3 = { OptLoad3, "OptLoad3", 0, 0, 0, 0, 0, 0 };
|
static OptFunc DOptLoad3 = { OptLoad3, "OptLoad3", 0, 0, 0, 0, 0, 0 };
|
||||||
|
static OptFunc DOptLoadStoreLoad= { OptLoadStoreLoad,"OptLoadStoreLoad", 0, 0, 0, 0, 0, 0 };
|
||||||
static OptFunc DOptLongAssign = { OptLongAssign, "OptLongAssign", 100, 0, 0, 0, 0, 0 };
|
static OptFunc DOptLongAssign = { OptLongAssign, "OptLongAssign", 100, 0, 0, 0, 0, 0 };
|
||||||
static OptFunc DOptLongCopy = { OptLongCopy, "OptLongCopy", 100, 0, 0, 0, 0, 0 };
|
static OptFunc DOptLongCopy = { OptLongCopy, "OptLongCopy", 100, 0, 0, 0, 0, 0 };
|
||||||
static OptFunc DOptNegAX1 = { OptNegAX1, "OptNegAX1", 165, 0, 0, 0, 0, 0 };
|
static OptFunc DOptNegAX1 = { OptNegAX1, "OptNegAX1", 165, 0, 0, 0, 0, 0 };
|
||||||
static OptFunc DOptNegAX2 = { OptNegAX2, "OptNegAX2", 200, 0, 0, 0, 0, 0 };
|
static OptFunc DOptNegAX2 = { OptNegAX2, "OptNegAX2", 200, 0, 0, 0, 0, 0 };
|
||||||
static OptFunc DOptPrecalc = { OptPrecalc, "OptPrecalc", 100, 0, 0, 0, 0, 0 };
|
static OptFunc DOptPrecalc = { OptPrecalc, "OptPrecalc", 100, 0, 0, 0, 0, 0 };
|
||||||
static OptFunc DOptPtrLoad1 = { OptPtrLoad1, "OptPtrLoad1", 100, 0, 0, 0, 0, 0 };
|
static OptFunc DOptPtrLoad1 = { OptPtrLoad1, "OptPtrLoad1", 100, 0, 0, 0, 0, 0 };
|
||||||
static OptFunc DOptPtrLoad2 = { OptPtrLoad2, "OptPtrLoad2", 100, 0, 0, 0, 0, 0 };
|
|
||||||
static OptFunc DOptPtrLoad3 = { OptPtrLoad3, "OptPtrLoad3", 100, 0, 0, 0, 0, 0 };
|
|
||||||
static OptFunc DOptPtrLoad4 = { OptPtrLoad4, "OptPtrLoad4", 100, 0, 0, 0, 0, 0 };
|
|
||||||
static OptFunc DOptPtrLoad5 = { OptPtrLoad5, "OptPtrLoad5", 50, 0, 0, 0, 0, 0 };
|
|
||||||
static OptFunc DOptPtrLoad6 = { OptPtrLoad6, "OptPtrLoad6", 60, 0, 0, 0, 0, 0 };
|
|
||||||
static OptFunc DOptPtrLoad7 = { OptPtrLoad7, "OptPtrLoad7", 140, 0, 0, 0, 0, 0 };
|
|
||||||
static OptFunc DOptPtrLoad11 = { OptPtrLoad11, "OptPtrLoad11", 92, 0, 0, 0, 0, 0 };
|
static OptFunc DOptPtrLoad11 = { OptPtrLoad11, "OptPtrLoad11", 92, 0, 0, 0, 0, 0 };
|
||||||
static OptFunc DOptPtrLoad12 = { OptPtrLoad12, "OptPtrLoad12", 50, 0, 0, 0, 0, 0 };
|
static OptFunc DOptPtrLoad12 = { OptPtrLoad12, "OptPtrLoad12", 50, 0, 0, 0, 0, 0 };
|
||||||
static OptFunc DOptPtrLoad13 = { OptPtrLoad13, "OptPtrLoad13", 65, 0, 0, 0, 0, 0 };
|
static OptFunc DOptPtrLoad13 = { OptPtrLoad13, "OptPtrLoad13", 65, 0, 0, 0, 0, 0 };
|
||||||
@@ -173,6 +169,12 @@ static OptFunc DOptPtrLoad16 = { OptPtrLoad16, "OptPtrLoad16", 100, 0,
|
|||||||
static OptFunc DOptPtrLoad17 = { OptPtrLoad17, "OptPtrLoad17", 190, 0, 0, 0, 0, 0 };
|
static OptFunc DOptPtrLoad17 = { OptPtrLoad17, "OptPtrLoad17", 190, 0, 0, 0, 0, 0 };
|
||||||
static OptFunc DOptPtrLoad18 = { OptPtrLoad18, "OptPtrLoad18", 100, 0, 0, 0, 0, 0 };
|
static OptFunc DOptPtrLoad18 = { OptPtrLoad18, "OptPtrLoad18", 100, 0, 0, 0, 0, 0 };
|
||||||
static OptFunc DOptPtrLoad19 = { OptPtrLoad19, "OptPtrLoad19", 65, 0, 0, 0, 0, 0 };
|
static OptFunc DOptPtrLoad19 = { OptPtrLoad19, "OptPtrLoad19", 65, 0, 0, 0, 0, 0 };
|
||||||
|
static OptFunc DOptPtrLoad2 = { OptPtrLoad2, "OptPtrLoad2", 100, 0, 0, 0, 0, 0 };
|
||||||
|
static OptFunc DOptPtrLoad3 = { OptPtrLoad3, "OptPtrLoad3", 100, 0, 0, 0, 0, 0 };
|
||||||
|
static OptFunc DOptPtrLoad4 = { OptPtrLoad4, "OptPtrLoad4", 100, 0, 0, 0, 0, 0 };
|
||||||
|
static OptFunc DOptPtrLoad5 = { OptPtrLoad5, "OptPtrLoad5", 50, 0, 0, 0, 0, 0 };
|
||||||
|
static OptFunc DOptPtrLoad6 = { OptPtrLoad6, "OptPtrLoad6", 60, 0, 0, 0, 0, 0 };
|
||||||
|
static OptFunc DOptPtrLoad7 = { OptPtrLoad7, "OptPtrLoad7", 140, 0, 0, 0, 0, 0 };
|
||||||
static OptFunc DOptPtrStore1 = { OptPtrStore1, "OptPtrStore1", 65, 0, 0, 0, 0, 0 };
|
static OptFunc DOptPtrStore1 = { OptPtrStore1, "OptPtrStore1", 65, 0, 0, 0, 0, 0 };
|
||||||
static OptFunc DOptPtrStore2 = { OptPtrStore2, "OptPtrStore2", 65, 0, 0, 0, 0, 0 };
|
static OptFunc DOptPtrStore2 = { OptPtrStore2, "OptPtrStore2", 65, 0, 0, 0, 0, 0 };
|
||||||
static OptFunc DOptPtrStore3 = { OptPtrStore3, "OptPtrStore3", 100, 0, 0, 0, 0, 0 };
|
static OptFunc DOptPtrStore3 = { OptPtrStore3, "OptPtrStore3", 100, 0, 0, 0, 0, 0 };
|
||||||
@@ -202,7 +204,6 @@ static OptFunc DOptStore3 = { OptStore3, "OptStore3", 120, 0,
|
|||||||
static OptFunc DOptStore4 = { OptStore4, "OptStore4", 50, 0, 0, 0, 0, 0 };
|
static OptFunc DOptStore4 = { OptStore4, "OptStore4", 50, 0, 0, 0, 0, 0 };
|
||||||
static OptFunc DOptStore5 = { OptStore5, "OptStore5", 100, 0, 0, 0, 0, 0 };
|
static OptFunc DOptStore5 = { OptStore5, "OptStore5", 100, 0, 0, 0, 0, 0 };
|
||||||
static OptFunc DOptStoreLoad = { OptStoreLoad, "OptStoreLoad", 0, 0, 0, 0, 0, 0 };
|
static OptFunc DOptStoreLoad = { OptStoreLoad, "OptStoreLoad", 0, 0, 0, 0, 0, 0 };
|
||||||
static OptFunc DOptLoadStoreLoad= { OptLoadStoreLoad,"OptLoadStoreLoad", 0, 0, 0, 0, 0, 0 };
|
|
||||||
static OptFunc DOptSub1 = { OptSub1, "OptSub1", 100, 0, 0, 0, 0, 0 };
|
static OptFunc DOptSub1 = { OptSub1, "OptSub1", 100, 0, 0, 0, 0, 0 };
|
||||||
static OptFunc DOptSub2 = { OptSub2, "OptSub2", 100, 0, 0, 0, 0, 0 };
|
static OptFunc DOptSub2 = { OptSub2, "OptSub2", 100, 0, 0, 0, 0, 0 };
|
||||||
static OptFunc DOptSub3 = { OptSub3, "OptSub3", 100, 0, 0, 0, 0, 0 };
|
static OptFunc DOptSub3 = { OptSub3, "OptSub3", 100, 0, 0, 0, 0, 0 };
|
||||||
@@ -217,6 +218,7 @@ static OptFunc DOptUnusedStores = { OptUnusedStores, "OptUnusedStores", 0, 0,
|
|||||||
|
|
||||||
|
|
||||||
/* Table containing all the steps in alphabetical order */
|
/* Table containing all the steps in alphabetical order */
|
||||||
|
/* CAUTION: table must be sorted for bsearch */
|
||||||
static OptFunc* OptFuncs[] = {
|
static OptFunc* OptFuncs[] = {
|
||||||
&DOpt65C02BitOps,
|
&DOpt65C02BitOps,
|
||||||
&DOpt65C02Ind,
|
&DOpt65C02Ind,
|
||||||
@@ -268,6 +270,7 @@ static OptFunc* OptFuncs[] = {
|
|||||||
&DOptLoad1,
|
&DOptLoad1,
|
||||||
&DOptLoad2,
|
&DOptLoad2,
|
||||||
&DOptLoad3,
|
&DOptLoad3,
|
||||||
|
&DOptLoadStoreLoad,
|
||||||
&DOptLongAssign,
|
&DOptLongAssign,
|
||||||
&DOptLongCopy,
|
&DOptLongCopy,
|
||||||
&DOptNegAX1,
|
&DOptNegAX1,
|
||||||
@@ -318,7 +321,6 @@ static OptFunc* OptFuncs[] = {
|
|||||||
&DOptStore4,
|
&DOptStore4,
|
||||||
&DOptStore5,
|
&DOptStore5,
|
||||||
&DOptStoreLoad,
|
&DOptStoreLoad,
|
||||||
&DOptLoadStoreLoad,
|
|
||||||
&DOptSub1,
|
&DOptSub1,
|
||||||
&DOptSub2,
|
&DOptSub2,
|
||||||
&DOptSub3,
|
&DOptSub3,
|
||||||
|
|||||||
@@ -1225,6 +1225,10 @@ static int CmpHarmless (const void* Key, const void* Entry)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* CAUTION: table must be sorted for bsearch */
|
||||||
|
static const char* const Tab[] = {
|
||||||
|
"_abs",
|
||||||
|
};
|
||||||
|
|
||||||
int HarmlessCall (const CodeEntry* E, int PushedBytes)
|
int HarmlessCall (const CodeEntry* E, int PushedBytes)
|
||||||
/* Check if this is a call to a harmless subroutine that will not interrupt
|
/* Check if this is a call to a harmless subroutine that will not interrupt
|
||||||
@@ -1252,10 +1256,6 @@ int HarmlessCall (const CodeEntry* E, int PushedBytes)
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
static const char* const Tab[] = {
|
|
||||||
"_abs",
|
|
||||||
};
|
|
||||||
|
|
||||||
void* R = bsearch (E->Arg,
|
void* R = bsearch (E->Arg,
|
||||||
Tab,
|
Tab,
|
||||||
sizeof (Tab) / sizeof (Tab[0]),
|
sizeof (Tab) / sizeof (Tab[0]),
|
||||||
|
|||||||
@@ -1464,6 +1464,7 @@ static unsigned Opt_a_tosxor (StackOpData* D)
|
|||||||
|
|
||||||
/* The first column of these two tables must be sorted in lexical order */
|
/* The first column of these two tables must be sorted in lexical order */
|
||||||
|
|
||||||
|
/* CAUTION: table must be sorted for bsearch */
|
||||||
static const OptFuncDesc FuncTable[] = {
|
static const OptFuncDesc FuncTable[] = {
|
||||||
{ "___bzero", Opt___bzero, REG_NONE, OP_X_ZERO | OP_A_KNOWN },
|
{ "___bzero", Opt___bzero, REG_NONE, OP_X_ZERO | OP_A_KNOWN },
|
||||||
{ "staspidx", Opt_staspidx, REG_NONE, OP_NONE },
|
{ "staspidx", Opt_staspidx, REG_NONE, OP_NONE },
|
||||||
@@ -1487,6 +1488,7 @@ static const OptFuncDesc FuncTable[] = {
|
|||||||
{ "tosxorax", Opt_tosxorax, REG_NONE, OP_NONE },
|
{ "tosxorax", Opt_tosxorax, REG_NONE, OP_NONE },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* CAUTION: table must be sorted for bsearch */
|
||||||
static const OptFuncDesc FuncRegATable[] = {
|
static const OptFuncDesc FuncRegATable[] = {
|
||||||
{ "tosandax", Opt_a_tosand, REG_NONE, OP_RHS_REMOVE_DIRECT | OP_RHS_LOAD_DIRECT },
|
{ "tosandax", Opt_a_tosand, REG_NONE, OP_RHS_REMOVE_DIRECT | OP_RHS_LOAD_DIRECT },
|
||||||
{ "toseqax", Opt_a_toseq, REG_NONE, OP_NONE },
|
{ "toseqax", Opt_a_toseq, REG_NONE, OP_NONE },
|
||||||
|
|||||||
@@ -55,6 +55,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Opcode description table */
|
/* Opcode description table */
|
||||||
|
/* CAUTION: table must be sorted by mnemonic for bsearch */
|
||||||
const OPCDesc OPCTable[OP65_COUNT] = {
|
const OPCDesc OPCTable[OP65_COUNT] = {
|
||||||
|
|
||||||
/* 65XX opcodes */
|
/* 65XX opcodes */
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ typedef enum {
|
|||||||
} pragma_t;
|
} pragma_t;
|
||||||
|
|
||||||
/* Pragma table */
|
/* Pragma table */
|
||||||
|
/* CAUTION: table must be sorted for bsearch */
|
||||||
static const struct Pragma {
|
static const struct Pragma {
|
||||||
const char* Key; /* Keyword */
|
const char* Key; /* Keyword */
|
||||||
pragma_t Tok; /* Token */
|
pragma_t Tok; /* Token */
|
||||||
|
|||||||
@@ -216,6 +216,7 @@ typedef enum {
|
|||||||
|
|
||||||
|
|
||||||
/* Preprocessor directive tokens mapping table */
|
/* Preprocessor directive tokens mapping table */
|
||||||
|
/* CAUTION: table must be sorted for bsearch */
|
||||||
static const struct PPDType {
|
static const struct PPDType {
|
||||||
const char* Tok; /* Token */
|
const char* Tok; /* Token */
|
||||||
ppdirective_t Type; /* Type */
|
ppdirective_t Type; /* Type */
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Token table */
|
/* Token table */
|
||||||
|
/* CAUTION: table must be sorted for bsearch */
|
||||||
static const struct Keyword {
|
static const struct Keyword {
|
||||||
char* Key; /* Keyword name */
|
char* Key; /* Keyword name */
|
||||||
unsigned char Tok; /* The token */
|
unsigned char Tok; /* The token */
|
||||||
|
|||||||
@@ -78,8 +78,8 @@ static void StdFunc_strlen (FuncDesc*, ExprDesc*);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Table with all known functions and their handlers. Must be sorted
|
/* Table with all known functions and their handlers.
|
||||||
** alphabetically!
|
** CAUTION: table must be alphabetically sorted for bsearch
|
||||||
*/
|
*/
|
||||||
static struct StdFuncDesc {
|
static struct StdFuncDesc {
|
||||||
const char* Name;
|
const char* Name;
|
||||||
@@ -90,7 +90,6 @@ static struct StdFuncDesc {
|
|||||||
{ "strcmp", StdFunc_strcmp },
|
{ "strcmp", StdFunc_strcmp },
|
||||||
{ "strcpy", StdFunc_strcpy },
|
{ "strcpy", StdFunc_strcpy },
|
||||||
{ "strlen", StdFunc_strlen },
|
{ "strlen", StdFunc_strlen },
|
||||||
|
|
||||||
};
|
};
|
||||||
#define FUNC_COUNT (sizeof (StdFuncs) / sizeof (StdFuncs[0]))
|
#define FUNC_COUNT (sizeof (StdFuncs) / sizeof (StdFuncs[0]))
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* CAUTION: table must be sorted for bsearch */
|
||||||
static const FileId TypeTable[] = {
|
static const FileId TypeTable[] = {
|
||||||
/* Upper case stuff for obsolete operating systems */
|
/* Upper case stuff for obsolete operating systems */
|
||||||
{ "A", FILETYPE_LIB },
|
{ "A", FILETYPE_LIB },
|
||||||
|
|||||||
@@ -138,8 +138,9 @@ struct TargetEntry {
|
|||||||
target_t Id; /* Target ID */
|
target_t Id; /* Target ID */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Table that maps target names to IDs. Sorted alphabetically for bsearch().
|
/* Table that maps target names to IDs.
|
||||||
** Allows multiple entries for one target ID (target name aliases).
|
** Allows multiple entries for one target ID (target name aliases).
|
||||||
|
** CAUTION: must be alphabetically for bsearch().
|
||||||
*/
|
*/
|
||||||
static const TargetEntry TargetMap[] = {
|
static const TargetEntry TargetMap[] = {
|
||||||
{ "apple2", TGT_APPLE2 },
|
{ "apple2", TGT_APPLE2 },
|
||||||
|
|||||||
@@ -2523,6 +2523,7 @@ static void NextChar (InputData* D)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* CAUTION: table must be sorted for bsearch */
|
||||||
static void NextToken (InputData* D)
|
static void NextToken (InputData* D)
|
||||||
/* Read the next token from the input stream */
|
/* Read the next token from the input stream */
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -61,7 +61,8 @@ struct ConverterMapEntry {
|
|||||||
StrBuf* (*ConvertFunc) (const Bitmap*, const Collection*);
|
StrBuf* (*ConvertFunc) (const Bitmap*, const Collection*);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Converter table, alphabetically sorted */
|
/* Converter table */
|
||||||
|
/* CAUTION: table must be alphabetically sorted for bsearch */
|
||||||
static const ConverterMapEntry ConverterMap[] = {
|
static const ConverterMapEntry ConverterMap[] = {
|
||||||
{ "geos-bitmap", GenGeosBitmap },
|
{ "geos-bitmap", GenGeosBitmap },
|
||||||
{ "geos-icon", GenGeosIcon },
|
{ "geos-icon", GenGeosIcon },
|
||||||
|
|||||||
@@ -69,7 +69,8 @@ static InputFormatDesc InputFormatTable[ifCount] = {
|
|||||||
{ ReadPCXFile },
|
{ ReadPCXFile },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Table that maps extensions to input formats. Must be sorted alphabetically */
|
/* Table that maps extensions to input formats. */
|
||||||
|
/* CAUTION: table must be alphabetically sorted for bsearch */
|
||||||
static const FileId FormatTable[] = {
|
static const FileId FormatTable[] = {
|
||||||
/* Upper case stuff for obsolete operating systems */
|
/* Upper case stuff for obsolete operating systems */
|
||||||
{ "PCX", ifPCX },
|
{ "PCX", ifPCX },
|
||||||
|
|||||||
@@ -78,7 +78,8 @@ static OutputFormatDesc OutputFormatTable[ofCount] = {
|
|||||||
{ WriteCFile },
|
{ WriteCFile },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Table that maps extensions to Output formats. Must be sorted alphabetically */
|
/* Table that maps extensions to Output formats. */
|
||||||
|
/* CAUTION: table must be alphabetically sorted for bsearch */
|
||||||
static const FileId FormatTable[] = {
|
static const FileId FormatTable[] = {
|
||||||
/* Upper case stuff for obsolete operating systems */
|
/* Upper case stuff for obsolete operating systems */
|
||||||
{ "A", ofAsm },
|
{ "A", ofAsm },
|
||||||
|
|||||||
@@ -56,7 +56,8 @@ struct PaletteMapEntry {
|
|||||||
StrBuf* (*PaletteFunc) (const Bitmap*, const Collection*);
|
StrBuf* (*PaletteFunc) (const Bitmap*, const Collection*);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Converter table, alphabetically sorted */
|
/* Converter table */
|
||||||
|
/* CAUTION: table must be alphabetically sorted for bsearch */
|
||||||
static const PaletteMapEntry PaletteMap[] = {
|
static const PaletteMapEntry PaletteMap[] = {
|
||||||
{ "lynx-palette", GenLynxPalette },
|
{ "lynx-palette", GenLynxPalette },
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user