]> git.sur5r.net Git - cc65/commitdiff
Rename trampoline to wrappedcall everywhere
authorLauri Kasanen <cand@gmx.com>
Thu, 18 May 2017 13:00:04 +0000 (16:00 +0300)
committerLauri Kasanen <cand@gmx.com>
Thu, 18 May 2017 13:00:04 +0000 (16:00 +0300)
src/cc65/declare.c
src/cc65/expr.c
src/cc65/funcdesc.c
src/cc65/funcdesc.h
src/cc65/pragma.c
src/cc65/trampoline.c [deleted file]
src/cc65/trampoline.h [deleted file]
src/cc65/wrappedcall.c [new file with mode: 0644]
src/cc65/wrappedcall.h [new file with mode: 0644]

index 2ebc09b1467b8f5c6d4bc4c7687473556b07e2b0..a6b2329051b3d339412a77640bd501f1a63b7bc7 100644 (file)
@@ -58,7 +58,7 @@
 #include "scanner.h"
 #include "standard.h"
 #include "symtab.h"
-#include "trampoline.h"
+#include "wrappedcall.h"
 #include "typeconv.h"
 
 
@@ -1316,8 +1316,8 @@ static FuncDesc* ParseFuncDecl (void)
 {
     unsigned Offs;
     SymEntry* Sym;
-    SymEntry* Trampoline;
-    unsigned char TrampolineData;
+    SymEntry* WrappedCall;
+    unsigned char WrappedCallData;
 
     /* Create a new function descriptor */
     FuncDesc* F = NewFuncDesc ();
@@ -1383,11 +1383,11 @@ static FuncDesc* ParseFuncDecl (void)
     /* Leave the lexical level remembering the symbol tables */
     RememberFunctionLevel (F);
 
-    /* Did we have a trampoline for this function? */
-    GetTrampoline((void **) &Trampoline, &TrampolineData);
-    if (Trampoline) {
-        F->Trampoline = Trampoline;
-        F->TrampolineData = TrampolineData;
+    /* Did we have a WrappedCall for this function? */
+    GetWrappedCall((void **) &WrappedCall, &WrappedCallData);
+    if (WrappedCall) {
+        F->WrappedCall = WrappedCall;
+        F->WrappedCallData = WrappedCallData;
     }
 
     /* Return the function descriptor */
@@ -1471,13 +1471,13 @@ static void Declarator (const DeclSpec* Spec, Declaration* D, declmode_t Mode)
                 Qualifiers &= ~T_QUAL_FASTCALL;
             }
 
-            /* Was there a previous entry? If so, copy trampoline info from it */
+            /* Was there a previous entry? If so, copy WrappedCall info from it */
             PrevEntry = FindGlobalSym (D->Ident);
             if (PrevEntry && PrevEntry->Flags & SC_FUNC) {
                 FuncDesc* D = PrevEntry->V.F.Func;
-                if (D->Trampoline && !F->Trampoline) {
-                    F->Trampoline = D->Trampoline;
-                    F->TrampolineData = D->TrampolineData;
+                if (D->WrappedCall && !F->WrappedCall) {
+                    F->WrappedCall = D->WrappedCall;
+                    F->WrappedCallData = D->WrappedCallData;
                 }
             }
 
index fb1232fc1d31bf6a571e736850ec1f386eae5a5b..467c30da21aaf7e46dcbce02fadd50e593d01410 100644 (file)
@@ -536,8 +536,8 @@ static void FunctionCall (ExprDesc* Expr)
     /* Special handling for function pointers */
     if (IsFuncPtr) {
 
-        if (Func->Trampoline) {
-            Warning("Calling a trampolined function via a pointer, trampoline will not be used");
+        if (Func->WrappedCall) {
+            Warning("Calling a wrapped function via a pointer, wrapped-call will not be used");
         }
 
         /* If the function is not a fastcall function, load the pointer to
@@ -588,12 +588,12 @@ static void FunctionCall (ExprDesc* Expr)
     } else {
 
         /* Normal function */
-        if (Func->Trampoline) {
+        if (Func->WrappedCall) {
             char tmp[64];
             StrBuf S = AUTO_STRBUF_INITIALIZER;
 
-            /* Store the trampoline data in tmp4 */
-            sprintf(tmp, "ldy #%u", Func->TrampolineData);
+            /* Store the WrappedCall data in tmp4 */
+            sprintf(tmp, "ldy #%u", Func->WrappedCallData);
             SB_AppendStr (&S, tmp);
             g_asmcode (&S);
             SB_Clear(&S);
@@ -625,7 +625,7 @@ static void FunctionCall (ExprDesc* Expr)
 
             SB_Done (&S);
 
-            g_call (TypeOf (Expr->Type), Func->Trampoline->Name, ParamSize);
+            g_call (TypeOf (Expr->Type), Func->WrappedCall->Name, ParamSize);
         } else {
             g_call (TypeOf (Expr->Type), (const char*) Expr->Name, ParamSize);
         }
index 607094acdbf41dc634131287970a0e16a4ae5c93..273263decc34383316fafb46f48f9c3f11b51f7d 100644 (file)
@@ -60,8 +60,8 @@ FuncDesc* NewFuncDesc (void)
     F->ParamCount = 0;
     F->ParamSize  = 0;
     F->LastParam  = 0;
-    F->Trampoline = 0;
-    F->TrampolineData = 0;
+    F->WrappedCall = 0;
+    F->WrappedCallData = 0;
 
     /* Return the new struct */
     return F;
index b83cfa3623660e2014b10c93c172af71db567958..966aff5734f997fec96f996e0d63610c30eb3f27 100644 (file)
@@ -67,8 +67,8 @@ struct FuncDesc {
     unsigned            ParamCount;     /* Number of parameters              */
     unsigned            ParamSize;      /* Size of the parameters            */
     struct SymEntry*    LastParam;      /* Pointer to last parameter         */
-    struct SymEntry*    Trampoline;     /* Pointer to the trampoline         */
-    unsigned char       TrampolineData; /* The trampoline's user data        */
+    struct SymEntry*    WrappedCall;     /* Pointer to the WrappedCall         */
+    unsigned char       WrappedCallData; /* The WrappedCall's user data        */
 };
 
 
index fe7101d97c2e2e2cc2908d0d28b418f44c154cf3..98f1a20d0be51c7fc7f1a4f0295d4a587c3a624a 100644 (file)
@@ -51,7 +51,7 @@
 #include "scanstrbuf.h"
 #include "symtab.h"
 #include "pragma.h"
-#include "trampoline.h"
+#include "wrappedcall.h"
 
 
 
@@ -468,7 +468,7 @@ static void WrappedCallPragma (StrBuf* B)
             break;
 
         case PP_POP:
-            PopTrampoline();
+            PopWrappedCall();
 
             /* Done */
             goto ExitPoint;
@@ -511,7 +511,7 @@ static void WrappedCallPragma (StrBuf* B)
     /* Check if the name is valid */
     if (Entry && Entry->Flags & (SC_FUNC | SC_STORAGE)) {
 
-        PushTrampoline(Entry, Val);
+        PushWrappedCall(Entry, Val);
         Entry->Flags |= SC_REF;
 
     } else {
diff --git a/src/cc65/trampoline.c b/src/cc65/trampoline.c
deleted file mode 100644 (file)
index 1f35a0f..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/*****************************************************************************/
-/*                                                                           */
-/*                                trampoline.c                               */
-/*                                                                           */
-/*                          Trampoline management                            */
-/*                                                                           */
-/*                                                                           */
-/*                                                                           */
-/* (C) 2017, Mega Cat Studios                                                */
-/*                                                                           */
-/*                                                                           */
-/* This software is provided 'as-is', without any expressed or implied       */
-/* warranty.  In no event will the authors be held liable for any damages    */
-/* arising from the use of this software.                                    */
-/*                                                                           */
-/* Permission is granted to anyone to use this software for any purpose,     */
-/* including commercial applications, and to alter it and redistribute it    */
-/* freely, subject to the following restrictions:                            */
-/*                                                                           */
-/* 1. The origin of this software must not be misrepresented; you must not   */
-/*    claim that you wrote the original software. If you use this software   */
-/*    in a product, an acknowledgment in the product documentation would be  */
-/*    appreciated but is not required.                                       */
-/* 2. Altered source versions must be plainly marked as such, and must not   */
-/*    be misrepresented as being the original software.                      */
-/* 3. This notice may not be removed or altered from any source              */
-/*    distribution.                                                          */
-/*                                                                           */
-/*****************************************************************************/
-
-
-
-#include <stdarg.h>
-#include <string.h>
-
-/* common */
-#include "chartype.h"
-#include "check.h"
-#include "coll.h"
-#include "scanner.h"
-#include "intptrstack.h"
-#include "xmalloc.h"
-
-/* cc65 */
-#include "codeent.h"
-#include "error.h"
-#include "trampoline.h"
-
-
-
-/*****************************************************************************/
-/*                                   Data                                    */
-/*****************************************************************************/
-
-
-/* Trampolines */
-static IntPtrStack Trampolines;
-
-
-
-/*****************************************************************************/
-/*                                   Code                                    */
-/*****************************************************************************/
-
-
-
-void PushTrampoline (void *Ptr, unsigned char Val)
-/* Push the current trampoline */
-{
-    if (IPS_IsFull (&Trampolines)) {
-        Error ("Trampoline stack overflow");
-    } else {
-        IPS_Push (&Trampolines, Val, Ptr);
-    }
-}
-
-
-
-void PopTrampoline (void)
-/* Remove the current trampoline */
-{
-    if (IPS_GetCount (&Trampolines) < 1) {
-        Error ("Trampoline stack is empty");
-    } else {
-        IPS_Drop (&Trampolines);
-    }
-}
-
-
-
-void GetTrampoline (void **Ptr, unsigned char *Val)
-/* Get the current trampoline */
-{
-    if (IPS_GetCount (&Trampolines) < 1) {
-        *Ptr = NULL;
-        *Val = 0;
-    } else {
-        long Temp;
-        IPS_Get (&Trampolines, &Temp, Ptr);
-        *Val = Temp;
-    }
-}
diff --git a/src/cc65/trampoline.h b/src/cc65/trampoline.h
deleted file mode 100644 (file)
index f110bd4..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*****************************************************************************/
-/*                                                                           */
-/*                                trampoline.h                               */
-/*                                                                           */
-/*                            Trampoline management                          */
-/*                                                                           */
-/*                                                                           */
-/*                                                                           */
-/* (C) 2017, Mega Cat Studios                                                */
-/*                                                                           */
-/*                                                                           */
-/* This software is provided 'as-is', without any expressed or implied       */
-/* warranty.  In no event will the authors be held liable for any damages    */
-/* arising from the use of this software.                                    */
-/*                                                                           */
-/* Permission is granted to anyone to use this software for any purpose,     */
-/* including commercial applications, and to alter it and redistribute it    */
-/* freely, subject to the following restrictions:                            */
-/*                                                                           */
-/* 1. The origin of this software must not be misrepresented; you must not   */
-/*    claim that you wrote the original software. If you use this software   */
-/*    in a product, an acknowledgment in the product documentation would be  */
-/*    appreciated but is not required.                                       */
-/* 2. Altered source versions must be plainly marked as such, and must not   */
-/*    be misrepresented as being the original software.                      */
-/* 3. This notice may not be removed or altered from any source              */
-/*    distribution.                                                          */
-/*                                                                           */
-/*****************************************************************************/
-
-
-
-#ifndef TRAMPOLINE_H
-#define TRAMPOLINE_H
-
-
-
-#include <stdio.h>
-
-/* common */
-#include "attrib.h"
-
-/* cc65 */
-#include "opcodes.h"
-
-
-/*****************************************************************************/
-/*                                   Code                                    */
-/*****************************************************************************/
-
-
-
-void PushTrampoline (void *Ptr, unsigned char Val);
-/* Push the current trampoline */
-
-void PopTrampoline (void);
-/* Pop the current trampoline */
-
-void GetTrampoline (void **Ptr, unsigned char *Val);
-/* Get the current trampoline, if any */
-
-
-/* End of trampoline.h */
-
-#endif
diff --git a/src/cc65/wrappedcall.c b/src/cc65/wrappedcall.c
new file mode 100644 (file)
index 0000000..2d11245
--- /dev/null
@@ -0,0 +1,102 @@
+/*****************************************************************************/
+/*                                                                           */
+/*                                wrappedcall.c                              */
+/*                                                                           */
+/*                          WrappedCall management                           */
+/*                                                                           */
+/*                                                                           */
+/*                                                                           */
+/* (C) 2017, Mega Cat Studios                                                */
+/*                                                                           */
+/*                                                                           */
+/* This software is provided 'as-is', without any expressed or implied       */
+/* warranty.  In no event will the authors be held liable for any damages    */
+/* arising from the use of this software.                                    */
+/*                                                                           */
+/* Permission is granted to anyone to use this software for any purpose,     */
+/* including commercial applications, and to alter it and redistribute it    */
+/* freely, subject to the following restrictions:                            */
+/*                                                                           */
+/* 1. The origin of this software must not be misrepresented; you must not   */
+/*    claim that you wrote the original software. If you use this software   */
+/*    in a product, an acknowledgment in the product documentation would be  */
+/*    appreciated but is not required.                                       */
+/* 2. Altered source versions must be plainly marked as such, and must not   */
+/*    be misrepresented as being the original software.                      */
+/* 3. This notice may not be removed or altered from any source              */
+/*    distribution.                                                          */
+/*                                                                           */
+/*****************************************************************************/
+
+
+
+#include <stdarg.h>
+#include <string.h>
+
+/* common */
+#include "chartype.h"
+#include "check.h"
+#include "coll.h"
+#include "scanner.h"
+#include "intptrstack.h"
+#include "xmalloc.h"
+
+/* cc65 */
+#include "codeent.h"
+#include "error.h"
+#include "wrappedcall.h"
+
+
+
+/*****************************************************************************/
+/*                                   Data                                    */
+/*****************************************************************************/
+
+
+/* WrappedCalls */
+static IntPtrStack WrappedCalls;
+
+
+
+/*****************************************************************************/
+/*                                   Code                                    */
+/*****************************************************************************/
+
+
+
+void PushWrappedCall (void *Ptr, unsigned char Val)
+/* Push the current WrappedCall */
+{
+    if (IPS_IsFull (&WrappedCalls)) {
+        Error ("WrappedCall stack overflow");
+    } else {
+        IPS_Push (&WrappedCalls, Val, Ptr);
+    }
+}
+
+
+
+void PopWrappedCall (void)
+/* Remove the current WrappedCall */
+{
+    if (IPS_GetCount (&WrappedCalls) < 1) {
+        Error ("WrappedCall stack is empty");
+    } else {
+        IPS_Drop (&WrappedCalls);
+    }
+}
+
+
+
+void GetWrappedCall (void **Ptr, unsigned char *Val)
+/* Get the current WrappedCall */
+{
+    if (IPS_GetCount (&WrappedCalls) < 1) {
+        *Ptr = NULL;
+        *Val = 0;
+    } else {
+        long Temp;
+        IPS_Get (&WrappedCalls, &Temp, Ptr);
+        *Val = Temp;
+    }
+}
diff --git a/src/cc65/wrappedcall.h b/src/cc65/wrappedcall.h
new file mode 100644 (file)
index 0000000..3517c24
--- /dev/null
@@ -0,0 +1,65 @@
+/*****************************************************************************/
+/*                                                                           */
+/*                                wrappedcall.h                              */
+/*                                                                           */
+/*                            Wrapped-call management                        */
+/*                                                                           */
+/*                                                                           */
+/*                                                                           */
+/* (C) 2017, Mega Cat Studios                                                */
+/*                                                                           */
+/*                                                                           */
+/* This software is provided 'as-is', without any expressed or implied       */
+/* warranty.  In no event will the authors be held liable for any damages    */
+/* arising from the use of this software.                                    */
+/*                                                                           */
+/* Permission is granted to anyone to use this software for any purpose,     */
+/* including commercial applications, and to alter it and redistribute it    */
+/* freely, subject to the following restrictions:                            */
+/*                                                                           */
+/* 1. The origin of this software must not be misrepresented; you must not   */
+/*    claim that you wrote the original software. If you use this software   */
+/*    in a product, an acknowledgment in the product documentation would be  */
+/*    appreciated but is not required.                                       */
+/* 2. Altered source versions must be plainly marked as such, and must not   */
+/*    be misrepresented as being the original software.                      */
+/* 3. This notice may not be removed or altered from any source              */
+/*    distribution.                                                          */
+/*                                                                           */
+/*****************************************************************************/
+
+
+
+#ifndef WRAPPEDCALL_H
+#define WRAPPEDCALL_H
+
+
+
+#include <stdio.h>
+
+/* common */
+#include "attrib.h"
+
+/* cc65 */
+#include "opcodes.h"
+
+
+/*****************************************************************************/
+/*                                   Code                                    */
+/*****************************************************************************/
+
+
+
+void PushWrappedCall (void *Ptr, unsigned char Val);
+/* Push the current WrappedCall */
+
+void PopWrappedCall (void);
+/* Pop the current WrappedCall */
+
+void GetWrappedCall (void **Ptr, unsigned char *Val);
+/* Get the current WrappedCall, if any */
+
+
+/* End of wrappedcall.h */
+
+#endif