Rename pragma trampoline to wrapped-call, value to identifier
This commit is contained in:
@@ -1209,31 +1209,6 @@ parameter with the <tt/#pragma/.
|
|||||||
The <tt/#pragma/ understands the push and pop parameters as explained above.
|
The <tt/#pragma/ understands the push and pop parameters as explained above.
|
||||||
|
|
||||||
|
|
||||||
<sect1><tt>#pragma trampoline (<push&rt;, <name>, <value>)</tt><label id="pragma-trampoline"><p>
|
|
||||||
|
|
||||||
This pragma sets a trampoline for functions. The name is either
|
|
||||||
a function returning void and taking no parameters, or the address
|
|
||||||
of an array in memory (for a RAM trampoline). The value is an
|
|
||||||
8-bit number that's set to tmp4.
|
|
||||||
|
|
||||||
The address of the function is passed in ptr4.
|
|
||||||
|
|
||||||
This is useful for example with banked memory, to automatically
|
|
||||||
switch banks to where this function resides, and then restore
|
|
||||||
the bank when it returns.
|
|
||||||
|
|
||||||
The <tt/#pragma/ requires the push and pop parameters as explained above.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
<tscreen><verb>
|
|
||||||
void mytrampoline(void);
|
|
||||||
|
|
||||||
#pragma trampoline (push, mytrampoline, 0)
|
|
||||||
void somefunc(void);
|
|
||||||
#pragma trampoline (pop)
|
|
||||||
</verb></tscreen>
|
|
||||||
|
|
||||||
|
|
||||||
<sect1><tt>#pragma warn (name, [push,] on|off)</tt><label id="pragma-warn"><p>
|
<sect1><tt>#pragma warn (name, [push,] on|off)</tt><label id="pragma-warn"><p>
|
||||||
|
|
||||||
Switch compiler warnings on or off. "name" is the name of a warning (see the
|
Switch compiler warnings on or off. "name" is the name of a warning (see the
|
||||||
@@ -1254,6 +1229,31 @@ parameter with the <tt/#pragma/.
|
|||||||
</verb></tscreen>
|
</verb></tscreen>
|
||||||
|
|
||||||
|
|
||||||
|
<sect1><tt>#pragma wrapped-call (<push&rt;, <name>, <identifier>)</tt><label id="pragma-trampoline"><p>
|
||||||
|
|
||||||
|
This pragma sets a wrapper for functions, often used for trampolines.
|
||||||
|
The name is either a function returning void and taking no parameters,
|
||||||
|
or the address of an array in memory (for a RAM trampoline). The identifier
|
||||||
|
is an 8-bit number that's set to tmp4.
|
||||||
|
|
||||||
|
The address of the function is passed in ptr4.
|
||||||
|
|
||||||
|
This is useful for example with banked memory, to automatically
|
||||||
|
switch banks to where this function resides, and then restore
|
||||||
|
the bank when it returns.
|
||||||
|
|
||||||
|
The <tt/#pragma/ requires the push and pop parameters as explained above.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
<tscreen><verb>
|
||||||
|
void mytrampoline(void);
|
||||||
|
|
||||||
|
#pragma wrapped-call (push, mytrampoline, 0)
|
||||||
|
void somefunc(void);
|
||||||
|
#pragma wrapped-call (pop)
|
||||||
|
</verb></tscreen>
|
||||||
|
|
||||||
|
|
||||||
<sect1><tt>#pragma writable-strings ([push,] on|off)</tt><label id="pragma-writable-strings"><p>
|
<sect1><tt>#pragma writable-strings ([push,] on|off)</tt><label id="pragma-writable-strings"><p>
|
||||||
|
|
||||||
Changes the storage location of string literals. For historical reasons,
|
Changes the storage location of string literals. For historical reasons,
|
||||||
|
|||||||
@@ -88,8 +88,8 @@ typedef enum {
|
|||||||
PRAGMA_SIGNEDCHARS, /* obsolete */
|
PRAGMA_SIGNEDCHARS, /* obsolete */
|
||||||
PRAGMA_STATIC_LOCALS,
|
PRAGMA_STATIC_LOCALS,
|
||||||
PRAGMA_STATICLOCALS, /* obsolete */
|
PRAGMA_STATICLOCALS, /* obsolete */
|
||||||
PRAGMA_TRAMPOLINE,
|
|
||||||
PRAGMA_WARN,
|
PRAGMA_WARN,
|
||||||
|
PRAGMA_WRAPPED_CALL,
|
||||||
PRAGMA_WRITABLE_STRINGS,
|
PRAGMA_WRITABLE_STRINGS,
|
||||||
PRAGMA_ZPSYM,
|
PRAGMA_ZPSYM,
|
||||||
PRAGMA_COUNT
|
PRAGMA_COUNT
|
||||||
@@ -124,8 +124,8 @@ static const struct Pragma {
|
|||||||
{ "signedchars", PRAGMA_SIGNEDCHARS }, /* obsolete */
|
{ "signedchars", PRAGMA_SIGNEDCHARS }, /* obsolete */
|
||||||
{ "static-locals", PRAGMA_STATIC_LOCALS },
|
{ "static-locals", PRAGMA_STATIC_LOCALS },
|
||||||
{ "staticlocals", PRAGMA_STATICLOCALS }, /* obsolete */
|
{ "staticlocals", PRAGMA_STATICLOCALS }, /* obsolete */
|
||||||
{ "trampoline", PRAGMA_TRAMPOLINE },
|
|
||||||
{ "warn", PRAGMA_WARN },
|
{ "warn", PRAGMA_WARN },
|
||||||
|
{ "wrapped-call", PRAGMA_WRAPPED_CALL },
|
||||||
{ "writable-strings", PRAGMA_WRITABLE_STRINGS },
|
{ "writable-strings", PRAGMA_WRITABLE_STRINGS },
|
||||||
{ "zpsym", PRAGMA_ZPSYM },
|
{ "zpsym", PRAGMA_ZPSYM },
|
||||||
};
|
};
|
||||||
@@ -449,8 +449,8 @@ ExitPoint:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void TrampolinePragma (StrBuf* B)
|
static void WrappedCallPragma (StrBuf* B)
|
||||||
/* Handle the trampoline pragma */
|
/* Handle the wrapped-call pragma */
|
||||||
{
|
{
|
||||||
StrBuf S = AUTO_STRBUF_INITIALIZER;
|
StrBuf S = AUTO_STRBUF_INITIALIZER;
|
||||||
const char *Name;
|
const char *Name;
|
||||||
@@ -490,17 +490,17 @@ static void TrampolinePragma (StrBuf* B)
|
|||||||
/* Skip the following comma */
|
/* Skip the following comma */
|
||||||
if (!GetComma (B)) {
|
if (!GetComma (B)) {
|
||||||
/* Error already flagged by GetComma */
|
/* Error already flagged by GetComma */
|
||||||
Error ("Value required for trampoline data");
|
Error ("Value required for wrapped-call identifier");
|
||||||
goto ExitPoint;
|
goto ExitPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GetNumber (B, &Val)) {
|
if (!GetNumber (B, &Val)) {
|
||||||
Error ("Value required for trampoline data");
|
Error ("Value required for wrapped-call identifier");
|
||||||
goto ExitPoint;
|
goto ExitPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Val < 0 || Val > 255) {
|
if (Val < 0 || Val > 255) {
|
||||||
Error ("Value must be between 0-255");
|
Error ("Identifier must be between 0-255");
|
||||||
goto ExitPoint;
|
goto ExitPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -517,7 +517,7 @@ static void TrampolinePragma (StrBuf* B)
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* Segment name is invalid */
|
/* Segment name is invalid */
|
||||||
Error ("Trampoline does not exist or is not a function or array");
|
Error ("Wrapped-call target does not exist or is not a function or array");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -872,8 +872,8 @@ static void ParsePragma (void)
|
|||||||
FlagPragma (&B, &StaticLocals);
|
FlagPragma (&B, &StaticLocals);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PRAGMA_TRAMPOLINE:
|
case PRAGMA_WRAPPED_CALL:
|
||||||
TrampolinePragma(&B);
|
WrappedCallPragma(&B);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PRAGMA_WARN:
|
case PRAGMA_WARN:
|
||||||
|
|||||||
@@ -23,21 +23,21 @@ void func3() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned char array[30];
|
unsigned char array[30];
|
||||||
#pragma trampoline(push, array, 0)
|
#pragma wrapped-call(push, array, 0)
|
||||||
#pragma trampoline(pop)
|
#pragma wrapped-call(pop)
|
||||||
|
|
||||||
#pragma trampoline(push, trampoline_inc, 0)
|
#pragma wrapped-call(push, trampoline_inc, 0)
|
||||||
|
|
||||||
void func2() {
|
void func2() {
|
||||||
func3();
|
func3();
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma trampoline(push, trampoline_set, 4)
|
#pragma wrapped-call(push, trampoline_set, 4)
|
||||||
|
|
||||||
void func1(void);
|
void func1(void);
|
||||||
|
|
||||||
#pragma trampoline(pop)
|
#pragma wrapped-call(pop)
|
||||||
#pragma trampoline(pop)
|
#pragma wrapped-call(pop)
|
||||||
|
|
||||||
void func1() {
|
void func1() {
|
||||||
func2();
|
func2();
|
||||||
|
|||||||
Reference in New Issue
Block a user