Removed the inline.h module and removed the use of macros instead of "static
inline".
This commit is contained in:
@@ -41,7 +41,6 @@
|
||||
/* common */
|
||||
#include "coll.h"
|
||||
#include "fragdefs.h"
|
||||
#include "inline.h"
|
||||
|
||||
/* ca65 */
|
||||
#include "fragment.h"
|
||||
@@ -99,35 +98,23 @@ Fragment* GenFragment (unsigned char Type, unsigned short Len);
|
||||
void UseSeg (const SegDef* D);
|
||||
/* Use the given segment */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE const SegDef* GetCurrentSegDef (void)
|
||||
static inline const SegDef* GetCurrentSegDef (void)
|
||||
/* Get a pointer to the segment defininition of the current segment */
|
||||
{
|
||||
return ActiveSeg->Def;
|
||||
}
|
||||
#else
|
||||
# define GetCurrentSegDef() (ActiveSeg->Def)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned GetCurrentSegNum (void)
|
||||
static inline unsigned GetCurrentSegNum (void)
|
||||
/* Get the number of the current segment */
|
||||
{
|
||||
return ActiveSeg->Num;
|
||||
}
|
||||
#else
|
||||
# define GetCurrentSegNum() (ActiveSeg->Num)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned char GetCurrentSegAddrSize (void)
|
||||
static inline unsigned char GetCurrentSegAddrSize (void)
|
||||
/* Get the address size of the current segment */
|
||||
{
|
||||
return ActiveSeg->Def->AddrSize;
|
||||
}
|
||||
#else
|
||||
# define GetCurrentSegAddrSize() (ActiveSeg->Def->AddrSize)
|
||||
#endif
|
||||
|
||||
void SegAlign (unsigned long Alignment, int FillVal);
|
||||
/* Align the PC segment to Alignment. If FillVal is -1, emit fill fragments
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
#include "coll.h"
|
||||
#include "gentype.h"
|
||||
#include "hashtab.h"
|
||||
#include "inline.h"
|
||||
#include "strbuf.h"
|
||||
|
||||
|
||||
@@ -75,15 +74,11 @@ struct Span{
|
||||
|
||||
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned long GetSpanSize (const Span* R)
|
||||
static inline unsigned long GetSpanSize (const Span* R)
|
||||
/* Return the span size in bytes */
|
||||
{
|
||||
return (R->End - R->Start);
|
||||
}
|
||||
#else
|
||||
# define GetSpanSize(R) ((R)->End - (R)->Start)
|
||||
#endif
|
||||
|
||||
void SetSpanType (Span* S, const StrBuf* Type);
|
||||
/* Set the generic type of the span to Type */
|
||||
|
||||
@@ -63,45 +63,29 @@ extern StringPool* StrPool;
|
||||
|
||||
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned GetStrBufId (const StrBuf* S)
|
||||
static inline unsigned GetStrBufId (const StrBuf* S)
|
||||
/* Return the id of the given string buffer */
|
||||
{
|
||||
return SP_Add (StrPool, S);
|
||||
}
|
||||
#else
|
||||
# define GetStrBufId(S) SP_Add (StrPool, (S))
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned GetStringId (const char* S)
|
||||
static inline unsigned GetStringId (const char* S)
|
||||
/* Return the id of the given string */
|
||||
{
|
||||
return SP_AddStr (StrPool, S);
|
||||
}
|
||||
#else
|
||||
# define GetStringId(S) SP_AddStr (StrPool, (S))
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE const StrBuf* GetStrBuf (unsigned Index)
|
||||
static inline const StrBuf* GetStrBuf (unsigned Index)
|
||||
/* Convert a string index into a string */
|
||||
{
|
||||
return SP_Get (StrPool, Index);
|
||||
}
|
||||
#else
|
||||
# define GetStrBuf(Index) SP_Get (StrPool, (Index))
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE const char* GetString (unsigned Index)
|
||||
static inline const char* GetString (unsigned Index)
|
||||
/* Convert a string index into a string */
|
||||
{
|
||||
return SB_GetConstBuf (SP_Get (StrPool, Index));
|
||||
}
|
||||
#else
|
||||
# define GetString(Index) SB_GetConstBuf (SP_Get (StrPool, (Index)))
|
||||
#endif
|
||||
|
||||
void WriteStrPool (void);
|
||||
/* Write the string pool to the object file */
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
#include "cddefs.h"
|
||||
#include "coll.h"
|
||||
#include "filepos.h"
|
||||
#include "inline.h"
|
||||
#include "strbuf.h"
|
||||
|
||||
/* ca65 */
|
||||
@@ -137,25 +136,17 @@ int SymSearchTree (SymEntry* T, const StrBuf* Name, SymEntry** E);
|
||||
** inserted on the right side.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void SymAddExprRef (SymEntry* Sym, struct ExprNode* Expr)
|
||||
static inline void SymAddExprRef (SymEntry* Sym, struct ExprNode* Expr)
|
||||
/* Add an expression reference to this symbol */
|
||||
{
|
||||
CollAppend (&Sym->ExprRefs, Expr);
|
||||
}
|
||||
#else
|
||||
#define SymAddExprRef(Sym,Expr) CollAppend (&(Sym)->ExprRefs, Expr)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void SymDelExprRef (SymEntry* Sym, struct ExprNode* Expr)
|
||||
static inline void SymDelExprRef (SymEntry* Sym, struct ExprNode* Expr)
|
||||
/* Delete an expression reference to this symbol */
|
||||
{
|
||||
CollDeleteItem (&Sym->ExprRefs, Expr);
|
||||
}
|
||||
#else
|
||||
#define SymDelExprRef(Sym,Expr) CollDeleteItem (&(Sym)->ExprRefs, Expr)
|
||||
#endif
|
||||
|
||||
void SymTransferExprRefs (SymEntry* From, SymEntry* To);
|
||||
/* Transfer all expression references from one symbol to another. */
|
||||
@@ -199,107 +190,71 @@ void SymImportFromGlobal (SymEntry* S);
|
||||
** into an import.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int SymIsDef (const SymEntry* S)
|
||||
static inline int SymIsDef (const SymEntry* S)
|
||||
/* Return true if the given symbol is already defined */
|
||||
{
|
||||
return (S->Flags & SF_DEFINED) != 0;
|
||||
}
|
||||
#else
|
||||
# define SymIsDef(S) (((S)->Flags & SF_DEFINED) != 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int SymIsRef (const SymEntry* S)
|
||||
static inline int SymIsRef (const SymEntry* S)
|
||||
/* Return true if the given symbol has been referenced */
|
||||
{
|
||||
return (S->Flags & SF_REFERENCED) != 0;
|
||||
}
|
||||
#else
|
||||
# define SymIsRef(S) (((S)->Flags & SF_REFERENCED) != 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int SymIsImport (const SymEntry* S)
|
||||
static inline int SymIsImport (const SymEntry* S)
|
||||
/* Return true if the given symbol is marked as import */
|
||||
{
|
||||
/* Check the import flag */
|
||||
return (S->Flags & SF_IMPORT) != 0;
|
||||
}
|
||||
#else
|
||||
# define SymIsImport(S) (((S)->Flags & SF_IMPORT) != 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int SymIsExport (const SymEntry* S)
|
||||
static inline int SymIsExport (const SymEntry* S)
|
||||
/* Return true if the given symbol is marked as export */
|
||||
{
|
||||
/* Check the export flag */
|
||||
return (S->Flags & SF_EXPORT) != 0;
|
||||
}
|
||||
#else
|
||||
# define SymIsExport(S) (((S)->Flags & SF_EXPORT) != 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int SymIsVar (const SymEntry* S)
|
||||
static inline int SymIsVar (const SymEntry* S)
|
||||
/* Return true if the given symbol is marked as variable */
|
||||
{
|
||||
/* Check the variable flag */
|
||||
return (S->Flags & SF_VAR) != 0;
|
||||
}
|
||||
#else
|
||||
# define SymIsVar(S) (((S)->Flags & SF_VAR) != 0)
|
||||
#endif
|
||||
|
||||
int SymIsConst (const SymEntry* Sym, long* Val);
|
||||
/* Return true if the given symbol has a constant value. If Val is not NULL
|
||||
** and the symbol has a constant value, store it's value there.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int SymHasExpr (const SymEntry* S)
|
||||
static inline int SymHasExpr (const SymEntry* S)
|
||||
/* Return true if the given symbol has an associated expression */
|
||||
{
|
||||
/* Check the expression */
|
||||
return ((S->Flags & (SF_DEFINED|SF_IMPORT)) == SF_DEFINED);
|
||||
}
|
||||
#else
|
||||
# define SymHasExpr(S) (((S)->Flags & (SF_DEFINED|SF_IMPORT)) == SF_DEFINED)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void SymMarkUser (SymEntry* S)
|
||||
static inline void SymMarkUser (SymEntry* S)
|
||||
/* Set a user mark on the specified symbol */
|
||||
{
|
||||
/* Set the bit */
|
||||
S->Flags |= SF_USER;
|
||||
}
|
||||
#else
|
||||
# define SymMarkUser(S) ((S)->Flags |= SF_USER)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void SymUnmarkUser (SymEntry* S)
|
||||
static inline void SymUnmarkUser (SymEntry* S)
|
||||
/* Remove a user mark from the specified symbol */
|
||||
{
|
||||
/* Reset the bit */
|
||||
S->Flags &= ~SF_USER;
|
||||
}
|
||||
#else
|
||||
# define SymUnmarkUser(S) ((S)->Flags &= ~SF_USER)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int SymHasUserMark (SymEntry* S)
|
||||
static inline int SymHasUserMark (SymEntry* S)
|
||||
/* Return the state of the user mark for the specified symbol */
|
||||
{
|
||||
/* Check the bit */
|
||||
return (S->Flags & SF_USER) != 0;
|
||||
}
|
||||
#else
|
||||
# define SymHasUserMark(S) (((S)->Flags & SF_USER) != 0)
|
||||
#endif
|
||||
|
||||
struct SymTable* GetSymParentScope (SymEntry* S);
|
||||
/* Get the parent scope of the symbol (not the one it is defined in). Return
|
||||
@@ -314,27 +269,19 @@ const struct ExprNode* SymResolve (const SymEntry* Sym);
|
||||
** NULL. Do not call in other contexts!
|
||||
*/
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE const StrBuf* GetSymName (const SymEntry* S)
|
||||
static inline const StrBuf* GetSymName (const SymEntry* S)
|
||||
/* Return the name of the symbol */
|
||||
{
|
||||
return GetStrBuf (S->Name);
|
||||
}
|
||||
#else
|
||||
# define GetSymName(S) GetStrBuf ((S)->Name)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned char GetSymAddrSize (const SymEntry* S)
|
||||
static inline unsigned char GetSymAddrSize (const SymEntry* S)
|
||||
/* Return the address size of the symbol. Beware: This function will just
|
||||
** return the AddrSize member, it will not look at the expression!
|
||||
*/
|
||||
{
|
||||
return S->AddrSize;
|
||||
}
|
||||
#else
|
||||
# define GetSymAddrSize(S) ((S)->AddrSize)
|
||||
#endif
|
||||
|
||||
long GetSymVal (SymEntry* Sym);
|
||||
/* Return the value of a symbol assuming it's constant. FAIL will be called
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
|
||||
/* common */
|
||||
#include "exprdefs.h"
|
||||
#include "inline.h"
|
||||
|
||||
/* ca65 */
|
||||
#include "symentry.h"
|
||||
@@ -135,25 +134,17 @@ SymEntry* SymFindAny (SymTable* Scope, const StrBuf* Name);
|
||||
** scope.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned char GetSymTabType (const SymTable* S)
|
||||
static inline unsigned char GetSymTabType (const SymTable* S)
|
||||
/* Return the type of the given symbol table */
|
||||
{
|
||||
return S->Type;
|
||||
}
|
||||
#else
|
||||
# define GetSymTabType(S) ((S)->Type)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int SymTabIsClosed (const SymTable* S)
|
||||
static inline int SymTabIsClosed (const SymTable* S)
|
||||
/* Return true if the symbol table has been closed */
|
||||
{
|
||||
return (S->Flags & ST_CLOSED) != 0;
|
||||
}
|
||||
#else
|
||||
# define SymTabIsClosed(S) (((S)->Flags & ST_CLOSED) != 0)
|
||||
#endif
|
||||
|
||||
void SymCheck (void);
|
||||
/* Run through all symbols and check for anomalies and errors */
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
|
||||
/* common */
|
||||
#include "filepos.h"
|
||||
#include "inline.h"
|
||||
#include "strbuf.h"
|
||||
|
||||
|
||||
@@ -324,15 +323,11 @@ int TokHasSVal (token_t Tok);
|
||||
int TokHasIVal (token_t Tok);
|
||||
/* Return true if the given token has an attached IVal */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int TokIsSep (enum token_t T)
|
||||
static inline int TokIsSep (enum token_t T)
|
||||
/* Return true if this is a separator token */
|
||||
{
|
||||
return (T == TOK_SEP || T == TOK_EOF);
|
||||
}
|
||||
#else
|
||||
# define TokIsSep(T) ((T) == TOK_SEP || (T) == TOK_EOF)
|
||||
#endif
|
||||
|
||||
void CopyToken (Token* Dst, const Token* Src);
|
||||
/* Copy a token. The current value of Dst.SVal is free'd, so Dst must be
|
||||
|
||||
@@ -70,45 +70,29 @@ CaseNode* NewCaseNode (unsigned char Value);
|
||||
void FreeCaseNode (CaseNode* N);
|
||||
/* Delete a case node plus all sub nodes */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE CaseNode* CN_GetSubNode (CaseNode* N, unsigned Index)
|
||||
static inline CaseNode* CN_GetSubNode (CaseNode* N, unsigned Index)
|
||||
/* Get a sub node of the given node */
|
||||
{
|
||||
return CollAt (N->Nodes, Index);
|
||||
}
|
||||
#else
|
||||
# define CN_GetSubNode(N, Index) CollAt (&(N)->Nodes, Index)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned char CN_GetValue (const CaseNode* N)
|
||||
static inline unsigned char CN_GetValue (const CaseNode* N)
|
||||
/* Return the value for a case node */
|
||||
{
|
||||
return N->Value;
|
||||
}
|
||||
#else
|
||||
# define CN_GetValue(N) ((N)->Value)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned CN_GetLabel (const CaseNode* N)
|
||||
static inline unsigned CN_GetLabel (const CaseNode* N)
|
||||
/* Return the label for a case node */
|
||||
{
|
||||
return N->Label;
|
||||
}
|
||||
#else
|
||||
# define CN_GetLabel(N) ((N)->Label)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int CN_IsLeafNode (const CaseNode* N)
|
||||
static inline int CN_IsLeafNode (const CaseNode* N)
|
||||
/* Return true if this is a leaf node */
|
||||
{
|
||||
return (N->Nodes == 0);
|
||||
}
|
||||
#else
|
||||
# define CN_IsLeafNode(N) ((N)->Nodes == 0)
|
||||
#endif
|
||||
|
||||
void FreeCaseNodeColl (Collection* Nodes);
|
||||
/* Free a collection of case nodes */
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
|
||||
/* common */
|
||||
#include "coll.h"
|
||||
#include "inline.h"
|
||||
|
||||
/* cc65 */
|
||||
#include "codelab.h"
|
||||
@@ -150,88 +149,56 @@ void CE_ClearJumpTo (CodeEntry* E);
|
||||
** so use it with care.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int CE_HasLabel (const CodeEntry* E)
|
||||
static inline int CE_HasLabel (const CodeEntry* E)
|
||||
/* Check if the given code entry has labels attached */
|
||||
{
|
||||
return (CollCount (&E->Labels) > 0);
|
||||
}
|
||||
#else
|
||||
# define CE_HasLabel(E) (CollCount (&(E)->Labels) > 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned CE_GetLabelCount (const CodeEntry* E)
|
||||
static inline unsigned CE_GetLabelCount (const CodeEntry* E)
|
||||
/* Get the number of labels attached to this entry */
|
||||
{
|
||||
return CollCount (&E->Labels);
|
||||
}
|
||||
#else
|
||||
# define CE_GetLabelCount(E) CollCount (&(E)->Labels)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE CodeLabel* CE_GetLabel (CodeEntry* E, unsigned Index)
|
||||
static inline CodeLabel* CE_GetLabel (CodeEntry* E, unsigned Index)
|
||||
/* Get a label from this code entry */
|
||||
{
|
||||
return CollAt (&E->Labels, Index);
|
||||
}
|
||||
#else
|
||||
# define CE_GetLabel(E, Index) CollAt (&(E)->Labels, (Index))
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void CE_ReplaceLabel (CodeEntry* E, CodeLabel* L, unsigned Index)
|
||||
static inline void CE_ReplaceLabel (CodeEntry* E, CodeLabel* L, unsigned Index)
|
||||
/* Replace the code label at the specified index with L */
|
||||
{
|
||||
CollReplace (&E->Labels, L, Index);
|
||||
}
|
||||
#else
|
||||
# define CE_ReplaceLabel(E, L, Index) CollReplace (&(E)->Labels, (L), (Index))
|
||||
#endif
|
||||
|
||||
void CE_MoveLabel (CodeLabel* L, CodeEntry* E);
|
||||
/* Move the code label L from it's former owner to the code entry E. */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int CE_HasMark (const CodeEntry* E)
|
||||
static inline int CE_HasMark (const CodeEntry* E)
|
||||
/* Return true if the given code entry has the CEF_USERMARK flag set */
|
||||
{
|
||||
return (E->Flags & CEF_USERMARK) != 0;
|
||||
}
|
||||
#else
|
||||
# define CE_HasMark(E) (((E)->Flags & CEF_USERMARK) != 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void CE_SetMark (CodeEntry* E)
|
||||
static inline void CE_SetMark (CodeEntry* E)
|
||||
/* Set the CEF_USERMARK flag for the given entry */
|
||||
{
|
||||
E->Flags |= CEF_USERMARK;
|
||||
}
|
||||
#else
|
||||
# define CE_SetMark(E) ((E)->Flags |= CEF_USERMARK)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void CE_ResetMark (CodeEntry* E)
|
||||
static inline void CE_ResetMark (CodeEntry* E)
|
||||
/* Reset the CEF_USERMARK flag for the given entry */
|
||||
{
|
||||
E->Flags &= ~CEF_USERMARK;
|
||||
}
|
||||
#else
|
||||
# define CE_ResetMark(E) ((E)->Flags &= ~CEF_USERMARK)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int CE_HasNumArg (const CodeEntry* E)
|
||||
static inline int CE_HasNumArg (const CodeEntry* E)
|
||||
/* Return true if the instruction has a numeric argument */
|
||||
{
|
||||
return (E->Flags & CEF_NUMARG) != 0;
|
||||
}
|
||||
#else
|
||||
# define CE_HasNumArg(E) (((E)->Flags & CEF_NUMARG) != 0)
|
||||
#endif
|
||||
|
||||
void CE_SetArg (CodeEntry* E, const char* Arg);
|
||||
/* Replace the argument by the new one. */
|
||||
@@ -271,15 +238,11 @@ int CE_IsKnownImm (const CodeEntry* E, unsigned long Num);
|
||||
** equal to Num.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int CE_IsCallTo (const CodeEntry* E, const char* Name)
|
||||
static inline int CE_IsCallTo (const CodeEntry* E, const char* Name)
|
||||
/* Check if this is a call to the given function */
|
||||
{
|
||||
return (E->OPC == OP65_JSR && strcmp (E->Arg, Name) == 0);
|
||||
}
|
||||
#else
|
||||
# define CE_IsCallTo(E, Name) ((E)->OPC == OP65_JSR && strcmp ((E)->Arg, (Name)) == 0)
|
||||
#endif
|
||||
|
||||
int CE_UseLoadFlags (CodeEntry* E);
|
||||
/* Return true if the instruction uses any flags that are set by a load of
|
||||
|
||||
@@ -83,25 +83,17 @@ CodeLabel* NewCodeLabel (const char* Name, unsigned Hash);
|
||||
void FreeCodeLabel (CodeLabel* L);
|
||||
/* Free the given code label */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned CL_GetRefCount (const CodeLabel* L)
|
||||
static inline unsigned CL_GetRefCount (const CodeLabel* L)
|
||||
/* Get the number of references for this label */
|
||||
{
|
||||
return CollCount (&L->JumpFrom);
|
||||
}
|
||||
#else
|
||||
# define CL_GetRefCount(L) CollCount (&(L)->JumpFrom)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE struct CodeEntry* CL_GetRef (CodeLabel* L, unsigned Index)
|
||||
static inline struct CodeEntry* CL_GetRef (CodeLabel* L, unsigned Index)
|
||||
/* Get a code entry referencing this label */
|
||||
{
|
||||
return CollAt (&L->JumpFrom, Index);
|
||||
}
|
||||
#else
|
||||
# define CL_GetRef(L, Index) CollAt (&(L)->JumpFrom, (Index))
|
||||
#endif
|
||||
|
||||
void CL_AddRef (CodeLabel* L, struct CodeEntry* E);
|
||||
/* Let the CodeEntry E reference the label L */
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
/* common */
|
||||
#include "attrib.h"
|
||||
#include "coll.h"
|
||||
#include "inline.h"
|
||||
|
||||
/* cc65 */
|
||||
#include "codelab.h"
|
||||
@@ -106,15 +105,11 @@ void CS_AddVLine (CodeSeg* S, LineInfo* LI, const char* Format, va_list ap) attr
|
||||
void CS_AddLine (CodeSeg* S, LineInfo* LI, const char* Format, ...) attribute ((format(printf,3,4)));
|
||||
/* Add a line to the given code segment */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned CS_GetEntryCount (const CodeSeg* S)
|
||||
static inline unsigned CS_GetEntryCount (const CodeSeg* S)
|
||||
/* Return the number of entries for the given code segment */
|
||||
{
|
||||
return CollCount (&S->Entries);
|
||||
}
|
||||
#else
|
||||
# define CS_GetEntryCount(S) CollCount (&(S)->Entries)
|
||||
#endif
|
||||
|
||||
void CS_InsertEntry (CodeSeg* S, struct CodeEntry* E, unsigned Index);
|
||||
/* Insert the code entry at the index given. Following code entries will be
|
||||
@@ -145,27 +140,19 @@ void CS_MoveEntries (CodeSeg* S, unsigned Start, unsigned Count, unsigned NewPos
|
||||
** current code end)
|
||||
*/
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void CS_MoveEntry (CodeSeg* S, unsigned OldPos, unsigned NewPos)
|
||||
static inline void CS_MoveEntry (CodeSeg* S, unsigned OldPos, unsigned NewPos)
|
||||
/* Move an entry from one position to another. OldPos is the current position
|
||||
** of the entry, NewPos is the new position of the entry.
|
||||
*/
|
||||
{
|
||||
CollMove (&S->Entries, OldPos, NewPos);
|
||||
}
|
||||
#else
|
||||
# define CS_MoveEntry(S, OldPos, NewPos) CollMove (&(S)->Entries, OldPos, NewPos)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE struct CodeEntry* CS_GetEntry (CodeSeg* S, unsigned Index)
|
||||
static inline struct CodeEntry* CS_GetEntry (CodeSeg* S, unsigned Index)
|
||||
/* Get an entry from the given code segment */
|
||||
{
|
||||
return CollAt (&S->Entries, Index);
|
||||
}
|
||||
#else
|
||||
# define CS_GetEntry(S, Index) ((struct CodeEntry*) CollAt(&(S)->Entries, (Index)))
|
||||
#endif
|
||||
|
||||
struct CodeEntry* CS_GetPrevEntry (CodeSeg* S, unsigned Index);
|
||||
/* Get the code entry preceeding the one with the index Index. If there is no
|
||||
@@ -192,17 +179,13 @@ int CS_RangeHasLabel (CodeSeg* S, unsigned Start, unsigned Count);
|
||||
** possible span instead.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int CS_HavePendingLabel (const CodeSeg* S)
|
||||
static inline int CS_HavePendingLabel (const CodeSeg* S)
|
||||
/* Return true if there are open labels that will get attached to the next
|
||||
** instruction that is added.
|
||||
*/
|
||||
{
|
||||
return (CollCount (&S->Labels) > 0);
|
||||
}
|
||||
#else
|
||||
# define CS_HavePendingLabel(S) (CollCount (&(S)->Labels) > 0)
|
||||
#endif
|
||||
|
||||
CodeLabel* CS_AddLabel (CodeSeg* S, const char* Name);
|
||||
/* Add a code label for the next instruction to follow */
|
||||
@@ -253,18 +236,13 @@ void CS_DelCodeAfter (CodeSeg* S, unsigned Last);
|
||||
void CS_ResetMarks (CodeSeg* S, unsigned First, unsigned Last);
|
||||
/* Remove all user marks from the entries in the given range */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void CS_ResetAllMarks (CodeSeg* S)
|
||||
static inline void CS_ResetAllMarks (CodeSeg* S)
|
||||
/* Remove all user marks from the code segment */
|
||||
{
|
||||
if (CS_GetEntryCount (S) > 0) {
|
||||
CS_ResetMarks (S, 0, CS_GetEntryCount (S));
|
||||
}
|
||||
}
|
||||
#else
|
||||
# define CS_ResetAllMarks(S) \
|
||||
((CS_GetEntryCount (S) > 0)? CS_ResetMarks (S, 0, CS_GetEntryCount (S)) : (void) 0)
|
||||
#endif
|
||||
|
||||
int CS_IsBasicBlock (CodeSeg* S, unsigned First, unsigned Last);
|
||||
/* Check if the given code segment range is a basic block. That is, check if
|
||||
|
||||
@@ -878,16 +878,6 @@ int IsTypeFragBitField (const Type* T)
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_INLINE)
|
||||
int IsTypeFuncLike (const Type* T)
|
||||
/* Return true if this is a function or a function pointer */
|
||||
{
|
||||
return IsTypeFunc (T) || IsTypeFuncPtr (T);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
int IsObjectType (const Type* T)
|
||||
/* Return true if this is a fully described object type */
|
||||
{
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
|
||||
/* common */
|
||||
#include "attrib.h"
|
||||
#include "inline.h"
|
||||
#include "mmodel.h"
|
||||
|
||||
/* cc65 */
|
||||
@@ -258,15 +257,11 @@ Type* TypeAlloc (unsigned Len);
|
||||
void TypeFree (Type* T);
|
||||
/* Free a type string */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void CopyTypeAttr (const Type* Src, Type* Dest)
|
||||
static inline void CopyTypeAttr (const Type* Src, Type* Dest)
|
||||
/* Copy attribute data from Src to Dest */
|
||||
{
|
||||
Dest->A = Src->A;
|
||||
}
|
||||
#else
|
||||
# define CopyTypeAttr(Src, Dest) ((Dest)->A = (Src)->A)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -316,104 +311,68 @@ unsigned CheckedPSizeOf (const Type* T);
|
||||
** the rest of the compiler doesn't have to work with invalid sizes).
|
||||
*/
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE TypeCode GetQualifier (const Type* T)
|
||||
static inline TypeCode GetQualifier (const Type* T)
|
||||
/* Get the qualifier from the given type. This doesn't have a "raw" version
|
||||
** since an underlying type can never be qualified.
|
||||
*/
|
||||
{
|
||||
return (T->C & T_MASK_QUAL);
|
||||
}
|
||||
#else
|
||||
# define GetQualifier(T) ((T)->C & T_MASK_QUAL)
|
||||
#endif
|
||||
|
||||
TypeCode GetUnderlyingTypeCode (const Type* Type);
|
||||
/* Get the type code of the unqualified underlying type of Type.
|
||||
** Return GetUnqualRawTypeCode (Type) if Type is not scalar.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE TypeCode GetUnqualRawTypeCode (const Type* T)
|
||||
static inline TypeCode GetUnqualRawTypeCode (const Type* T)
|
||||
/* Return the unqualified raw type code */
|
||||
{
|
||||
return (T->C & ~T_MASK_QUAL);
|
||||
}
|
||||
#else
|
||||
# define GetUnqualRawTypeCode(T) ((T)->C & ~T_MASK_QUAL)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE TypeCode GetTypeClass (const Type* T)
|
||||
static inline TypeCode GetTypeClass (const Type* T)
|
||||
/* Get the class of a type. This doesn't have a "raw" version since an
|
||||
** underlying type can never be in a different class.
|
||||
*/
|
||||
{
|
||||
return (T->C & T_MASK_CLASS);
|
||||
}
|
||||
#else
|
||||
# define GetTypeClass(T) ((T)->C & T_MASK_CLASS)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE TypeCode GetTypeRank (const Type* T)
|
||||
static inline TypeCode GetTypeRank (const Type* T)
|
||||
/* Get the type rank of a type */
|
||||
{
|
||||
return (GetUnderlyingTypeCode (T) & T_MASK_RANK);
|
||||
}
|
||||
#else
|
||||
# define GetTypeRank(T) (GetUnderlyingTypeCode (T) & T_MASK_RANK)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE TypeCode GetSignedness (const Type* T)
|
||||
static inline TypeCode GetSignedness (const Type* T)
|
||||
/* Get the signedness of a type */
|
||||
{
|
||||
return (GetUnderlyingTypeCode (T) & T_MASK_SIGN);
|
||||
}
|
||||
#else
|
||||
# define GetSignedness(T) (GetUnderlyingTypeCode (T) & T_MASK_SIGN)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE TypeCode GetSizeModifier (const Type* T)
|
||||
static inline TypeCode GetSizeModifier (const Type* T)
|
||||
/* Get the size modifier of a type */
|
||||
{
|
||||
return (GetUnderlyingTypeCode (T) & T_MASK_SIZE);
|
||||
}
|
||||
#else
|
||||
# define GetSizeModifier(T) (GetUnderlyingTypeCode (T) & T_MASK_SIZE)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE TypeCode GetRawTypeRank (const Type* T)
|
||||
static inline TypeCode GetRawTypeRank (const Type* T)
|
||||
/* Get the raw type rank of a type */
|
||||
{
|
||||
return (T->C & T_MASK_RANK);
|
||||
}
|
||||
#else
|
||||
# define GetRawTypeRank(T) ((T)->C & T_MASK_RANK)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE TypeCode GetRawSignedness (const Type* T)
|
||||
static inline TypeCode GetRawSignedness (const Type* T)
|
||||
/* Get the raw signedness of a type */
|
||||
{
|
||||
return (T->C & T_MASK_SIGN);
|
||||
}
|
||||
#else
|
||||
# define GetRawSignedness(T) ((T)->C & T_MASK_SIGN)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE TypeCode GetRawSizeModifier (const Type* T)
|
||||
static inline TypeCode GetRawSizeModifier (const Type* T)
|
||||
/* Get the raw size modifier of a type */
|
||||
{
|
||||
return (T->C & T_MASK_SIZE);
|
||||
}
|
||||
#else
|
||||
# define GetRawSizeModifier(T) ((T)->C & T_MASK_SIZE)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -498,263 +457,162 @@ const Type* GetBitFieldChunkType (const Type* Type);
|
||||
|
||||
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsRankChar (const Type* T)
|
||||
static inline int IsRankChar (const Type* T)
|
||||
/* Return true if this is a character type */
|
||||
{
|
||||
return (GetTypeRank (T) == T_RANK_CHAR);
|
||||
}
|
||||
#else
|
||||
# define IsRankChar(T) (GetTypeRank (T) == T_RANK_CHAR)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsRankShort (const Type* T)
|
||||
static inline int IsRankShort (const Type* T)
|
||||
/* Return true if this is a short type (signed or unsigned) */
|
||||
{
|
||||
return (GetTypeRank (T) == T_RANK_SHORT);
|
||||
}
|
||||
#else
|
||||
# define IsRankShort(T) (GetTypeRank (T) == T_RANK_SHORT)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsRankInt (const Type* T)
|
||||
static inline int IsRankInt (const Type* T)
|
||||
/* Return true if this is an int type (signed or unsigned) */
|
||||
{
|
||||
return (GetTypeRank (T) == T_RANK_INT);
|
||||
}
|
||||
#else
|
||||
# define IsRankInt(T) (GetTypeRank (T) == T_RANK_INT)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsRankLong (const Type* T)
|
||||
static inline int IsRankLong (const Type* T)
|
||||
/* Return true if this is a long int type (signed or unsigned) */
|
||||
{
|
||||
return (GetTypeRank (T) == T_RANK_LONG);
|
||||
}
|
||||
#else
|
||||
# define IsRankLong(T) (GetTypeRank (T) == T_RANK_LONG)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsDeclTypeChar (const Type* T)
|
||||
static inline int IsDeclTypeChar (const Type* T)
|
||||
/* Return true if this is declared as a char type (without signed/unsigned).
|
||||
** This function is to exclude enums whose underlying type is char.
|
||||
*/
|
||||
{
|
||||
return (GetUnqualRawTypeCode (T) == T_CHAR);
|
||||
}
|
||||
#else
|
||||
# define IsDeclTypeChar(T) (GetUnqualRawTypeCode (T) == T_CHAR)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsDeclRankChar (const Type* T)
|
||||
static inline int IsDeclRankChar (const Type* T)
|
||||
/* Return true if this is declared as a character type (including signed/unsigned).
|
||||
** This function is to exclude enums whose underlying types are character types.
|
||||
*/
|
||||
{
|
||||
return (GetRawTypeRank (T) == T_RANK_CHAR);
|
||||
}
|
||||
#else
|
||||
# define IsDeclRankChar(T) (GetRawTypeRank (T) == T_RANK_CHAR)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsTypeFloat (const Type* T)
|
||||
static inline int IsTypeFloat (const Type* T)
|
||||
/* Return true if this is a float type */
|
||||
{
|
||||
return (GetRawTypeRank (T) == T_RANK_FLOAT);
|
||||
}
|
||||
#else
|
||||
# define IsTypeFloat(T) (GetRawTypeRank (T) == T_RANK_FLOAT)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsTypeDouble (const Type* T)
|
||||
static inline int IsTypeDouble (const Type* T)
|
||||
/* Return true if this is a double type */
|
||||
{
|
||||
return (GetRawTypeRank (T) == T_RANK_DOUBLE);
|
||||
}
|
||||
#else
|
||||
# define IsTypeDouble(T) (GetRawTypeRank (T) == T_RANK_DOUBLE)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsTypePtr (const Type* T)
|
||||
static inline int IsTypePtr (const Type* T)
|
||||
/* Return true if this is a pointer type */
|
||||
{
|
||||
return (GetRawTypeRank (T) == T_RANK_PTR);
|
||||
}
|
||||
#else
|
||||
# define IsTypePtr(T) (GetRawTypeRank (T) == T_RANK_PTR)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsTypeEnum (const Type* T)
|
||||
static inline int IsTypeEnum (const Type* T)
|
||||
/* Return true if this is an enum type */
|
||||
{
|
||||
return (GetRawTypeRank (T) == T_RANK_ENUM);
|
||||
}
|
||||
#else
|
||||
# define IsTypeEnum(T) (GetRawTypeRank (T) == T_RANK_ENUM)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsTypeSignedBitField (const Type* T)
|
||||
static inline int IsTypeSignedBitField (const Type* T)
|
||||
/* Return true if this is a signed bit-field */
|
||||
{
|
||||
return (GetUnqualRawTypeCode (T) == T_SBITFIELD);
|
||||
}
|
||||
#else
|
||||
# define IsTypeSignedBitField(T) (GetUnqualRawTypeCode (T) == T_SBITFIELD)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsTypeUnsignedBitField (const Type* T)
|
||||
static inline int IsTypeUnsignedBitField (const Type* T)
|
||||
/* Return true if this is an unsigned bit-field */
|
||||
{
|
||||
return (GetUnqualRawTypeCode (T) == T_UBITFIELD);
|
||||
}
|
||||
#else
|
||||
# define IsTypeUnsignedBitField(T) (GetUnqualRawTypeCode (T) == T_UBITFIELD)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsTypeBitField (const Type* T)
|
||||
static inline int IsTypeBitField (const Type* T)
|
||||
/* Return true if this is a bit-field (either signed or unsigned) */
|
||||
{
|
||||
return IsTypeSignedBitField (T) || IsTypeUnsignedBitField (T);
|
||||
}
|
||||
#else
|
||||
# define IsTypeBitField(T) (IsTypeSignedBitField (T) || IsTypeUnsignedBitField (T))
|
||||
#endif
|
||||
|
||||
int IsTypeFragBitField (const Type* T);
|
||||
/* Return true if this is a bit-field that shares byte space with other fields */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsTypeStruct (const Type* T)
|
||||
static inline int IsTypeStruct (const Type* T)
|
||||
/* Return true if this is a struct type */
|
||||
{
|
||||
return (GetRawTypeRank (T) == T_RANK_STRUCT);
|
||||
}
|
||||
#else
|
||||
# define IsTypeStruct(T) (GetRawTypeRank (T) == T_RANK_STRUCT)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsTypeUnion (const Type* T)
|
||||
static inline int IsTypeUnion (const Type* T)
|
||||
/* Return true if this is a union type */
|
||||
{
|
||||
return (GetRawTypeRank (T) == T_RANK_UNION);
|
||||
}
|
||||
#else
|
||||
# define IsTypeUnion(T) (GetRawTypeRank (T) == T_RANK_UNION)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsTypeArray (const Type* T)
|
||||
static inline int IsTypeArray (const Type* T)
|
||||
/* Return true if this is an array type */
|
||||
{
|
||||
return (GetRawTypeRank (T) == T_RANK_ARRAY);
|
||||
}
|
||||
#else
|
||||
# define IsTypeArray(T) (GetRawTypeRank (T) == T_RANK_ARRAY)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsTypeVoid (const Type* T)
|
||||
static inline int IsTypeVoid (const Type* T)
|
||||
/* Return true if this is a void type */
|
||||
{
|
||||
return (GetRawTypeRank (T) == T_RANK_VOID);
|
||||
}
|
||||
#else
|
||||
# define IsTypeVoid(T) (GetRawTypeRank (T) == T_RANK_VOID)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsTypeFunc (const Type* T)
|
||||
static inline int IsTypeFunc (const Type* T)
|
||||
/* Return true if this is a function type */
|
||||
{
|
||||
return (GetRawTypeRank (T) == T_RANK_FUNC);
|
||||
}
|
||||
#else
|
||||
# define IsTypeFunc(T) (GetRawTypeRank (T) == T_RANK_FUNC)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsTypeFuncPtr (const Type* T)
|
||||
static inline int IsTypeFuncPtr (const Type* T)
|
||||
/* Return true if this is a function pointer type */
|
||||
{
|
||||
return (IsTypePtr (T) && IsTypeFunc (T+1));
|
||||
}
|
||||
#else
|
||||
# define IsTypeFuncPtr(T) (IsTypePtr (T) && IsTypeFunc (T+1))
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsTypeFuncLike (const Type* T)
|
||||
static inline int IsTypeFuncLike (const Type* T)
|
||||
/* Return true if this is a function or a function pointer */
|
||||
{
|
||||
return IsTypeFunc (T) || IsTypeFuncPtr (T);
|
||||
}
|
||||
#else
|
||||
int IsTypeFuncLike (const Type* T);
|
||||
/* Return true if this is a function or a function pointer */
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsClassInt (const Type* T)
|
||||
static inline int IsClassInt (const Type* T)
|
||||
/* Return true if this is an integer type */
|
||||
{
|
||||
return (GetTypeClass (T) == T_CLASS_INT);
|
||||
}
|
||||
#else
|
||||
# define IsClassInt(T) (GetTypeClass (T) == T_CLASS_INT)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsClassFloat (const Type* T)
|
||||
static inline int IsClassFloat (const Type* T)
|
||||
/* Return true if this is a floating type */
|
||||
{
|
||||
return (GetTypeClass (T) == T_CLASS_FLOAT);
|
||||
}
|
||||
#else
|
||||
# define IsClassFloat(T) (GetTypeClass (T) == T_CLASS_FLOAT)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsClassPtr (const Type* T)
|
||||
static inline int IsClassPtr (const Type* T)
|
||||
/* Return true if this is a pointer or array type */
|
||||
{
|
||||
return (GetTypeClass (T) == T_CLASS_PTR);
|
||||
}
|
||||
#else
|
||||
# define IsClassPtr(T) (GetTypeClass (T) == T_CLASS_PTR)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsClassStruct (const Type* T)
|
||||
static inline int IsClassStruct (const Type* T)
|
||||
/* Return true if this is a struct or union type */
|
||||
{
|
||||
return (GetTypeClass (T) == T_CLASS_STRUCT);
|
||||
}
|
||||
#else
|
||||
# define IsClassStruct(T) (GetTypeClass (T) == T_CLASS_STRUCT)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsClassFunc (const Type* T)
|
||||
static inline int IsClassFunc (const Type* T)
|
||||
/* Return true if this is a function type */
|
||||
{
|
||||
return (GetTypeClass (T) == T_CLASS_FUNC);
|
||||
}
|
||||
#else
|
||||
# define IsClassFunc(T) (GetTypeClass (T) == T_CLASS_FUNC)
|
||||
#endif
|
||||
|
||||
int IsObjectType (const Type* T);
|
||||
/* Return true if this is a fully described object type */
|
||||
@@ -813,45 +671,29 @@ int HasUnknownSize (const Type* T);
|
||||
int TypeHasAttrData (const Type* T);
|
||||
/* Return true if the given type has attribute data */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsRawSignUnsigned (const Type* T)
|
||||
static inline int IsRawSignUnsigned (const Type* T)
|
||||
/* Return true if this is an unsigned raw type */
|
||||
{
|
||||
return (GetRawSignedness (T) == T_SIGN_UNSIGNED);
|
||||
}
|
||||
#else
|
||||
# define IsRawSignUnsigned(T) (GetRawSignedness (T) == T_SIGN_UNSIGNED)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsSignUnsigned (const Type* T)
|
||||
static inline int IsSignUnsigned (const Type* T)
|
||||
/* Return true if this is an unsigned type */
|
||||
{
|
||||
return (GetSignedness (T) == T_SIGN_UNSIGNED);
|
||||
}
|
||||
#else
|
||||
# define IsSignUnsigned(T) (GetSignedness (T) == T_SIGN_UNSIGNED)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsRawSignSigned (const Type* T)
|
||||
static inline int IsRawSignSigned (const Type* T)
|
||||
/* Return true if this is a signed raw type */
|
||||
{
|
||||
return (GetRawSignedness (T) == T_SIGN_SIGNED);
|
||||
}
|
||||
#else
|
||||
# define IsRawSignSigned(T) (GetRawSignedness (T) == T_SIGN_SIGNED)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsSignSigned (const Type* T)
|
||||
static inline int IsSignSigned (const Type* T)
|
||||
/* Return true if this is a signed type */
|
||||
{
|
||||
return (GetSignedness (T) == T_SIGN_SIGNED);
|
||||
}
|
||||
#else
|
||||
# define IsSignSigned(T) (GetSignedness (T) == T_SIGN_SIGNED)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -861,108 +703,68 @@ INLINE int IsSignSigned (const Type* T)
|
||||
|
||||
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsQualConst (const Type* T)
|
||||
static inline int IsQualConst (const Type* T)
|
||||
/* Return true if the given type has a const memory image */
|
||||
{
|
||||
return (T->C & T_QUAL_CONST) != 0;
|
||||
}
|
||||
#else
|
||||
# define IsQualConst(T) (((T)->C & T_QUAL_CONST) != 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsQualVolatile (const Type* T)
|
||||
static inline int IsQualVolatile (const Type* T)
|
||||
/* Return true if the given type has a volatile type qualifier */
|
||||
{
|
||||
return (T->C & T_QUAL_VOLATILE) != 0;
|
||||
}
|
||||
#else
|
||||
# define IsQualVolatile(T) (((T)->C & T_QUAL_VOLATILE) != 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsQualRestrict (const Type* T)
|
||||
static inline int IsQualRestrict (const Type* T)
|
||||
/* Return true if the given type has a restrict qualifier */
|
||||
{
|
||||
return (T->C & T_QUAL_RESTRICT) != 0;
|
||||
}
|
||||
#else
|
||||
# define IsQualRestrict(T) (((T)->C & T_QUAL_RESTRICT) != 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsQualNear (const Type* T)
|
||||
static inline int IsQualNear (const Type* T)
|
||||
/* Return true if the given type has a near qualifier */
|
||||
{
|
||||
return (T->C & T_QUAL_NEAR) != 0;
|
||||
}
|
||||
#else
|
||||
# define IsQualNear(T) (((T)->C & T_QUAL_NEAR) != 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsQualFar (const Type* T)
|
||||
static inline int IsQualFar (const Type* T)
|
||||
/* Return true if the given type has a far qualifier */
|
||||
{
|
||||
return (T->C & T_QUAL_FAR) != 0;
|
||||
}
|
||||
#else
|
||||
# define IsQualFar(T) (((T)->C & T_QUAL_FAR) != 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsQualFastcall (const Type* T)
|
||||
static inline int IsQualFastcall (const Type* T)
|
||||
/* Return true if the given type has a fastcall qualifier */
|
||||
{
|
||||
return (T->C & T_QUAL_FASTCALL) != 0;
|
||||
}
|
||||
#else
|
||||
# define IsQualFastcall(T) (((T)->C & T_QUAL_FASTCALL) != 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsQualCDecl (const Type* T)
|
||||
static inline int IsQualCDecl (const Type* T)
|
||||
/* Return true if the given type has a cdecl qualifier */
|
||||
{
|
||||
return (T->C & T_QUAL_CDECL) != 0;
|
||||
}
|
||||
#else
|
||||
# define IsQualCDecl(T) (((T)->C & T_QUAL_CDECL) != 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsQualCConv (const Type* T)
|
||||
static inline int IsQualCConv (const Type* T)
|
||||
/* Return true if the given type has a calling convention qualifier */
|
||||
{
|
||||
return (T->C & T_QUAL_CCONV) != 0;
|
||||
}
|
||||
#else
|
||||
# define IsQualCConv(T) (((T)->C & T_QUAL_CCONV) != 0)
|
||||
#endif
|
||||
|
||||
TypeCode AddrSizeQualifier (unsigned AddrSize);
|
||||
/* Return T_QUAL_NEAR or T_QUAL_FAR depending on the address size */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE TypeCode CodeAddrSizeQualifier (void)
|
||||
static inline TypeCode CodeAddrSizeQualifier (void)
|
||||
/* Return T_QUAL_NEAR or T_QUAL_FAR depending on the code address size */
|
||||
{
|
||||
return AddrSizeQualifier (CodeAddrSize);
|
||||
}
|
||||
#else
|
||||
# define CodeAddrSizeQualifier() (AddrSizeQualifier (CodeAddrSize))
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE TypeCode DataAddrSizeQualifier (void)
|
||||
static inline TypeCode DataAddrSizeQualifier (void)
|
||||
/* Return T_QUAL_NEAR or T_QUAL_FAR depending on the data address size */
|
||||
{
|
||||
return AddrSizeQualifier (DataAddrSize);
|
||||
}
|
||||
#else
|
||||
# define DataAddrSizeQualifier() (AddrSizeQualifier (DataAddrSize))
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -155,18 +155,6 @@ int ED_GetStackOffs (const ExprDesc* Expr, int Offs)
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_INLINE)
|
||||
int ED_IsLocQuasiConst (const ExprDesc* Expr)
|
||||
/* Return true if the expression is a constant location of some sort or on the
|
||||
** stack.
|
||||
*/
|
||||
{
|
||||
return ED_IsLocConst (Expr) || ED_IsLocStack (Expr);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
int ED_IsLocZP (const ExprDesc* Expr)
|
||||
/* Return true if the expression is in a location on a zeropage */
|
||||
{
|
||||
@@ -178,27 +166,6 @@ int ED_IsLocZP (const ExprDesc* Expr)
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_INLINE)
|
||||
int ED_IsLocPrimaryOrExpr (const ExprDesc* Expr)
|
||||
/* Return true if the expression is E_LOC_PRIMARY or E_LOC_EXPR */
|
||||
{
|
||||
return ED_IsLocPrimary (Expr) || ED_IsLocExpr (Expr);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_INLINE)
|
||||
int ED_IsIndExpr (const ExprDesc* Expr)
|
||||
/* Check if the expression is a reference to its value */
|
||||
{
|
||||
return (Expr->Flags & E_ADDRESS_OF) == 0 &&
|
||||
!ED_IsLocNone (Expr) && !ED_IsLocPrimary (Expr);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
int ED_YetToLoad (const ExprDesc* Expr)
|
||||
/* Check if the expression needs to be loaded somehow. */
|
||||
{
|
||||
@@ -209,29 +176,6 @@ int ED_YetToLoad (const ExprDesc* Expr)
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_INLINE)
|
||||
int ED_IsAbs (const ExprDesc* Expr)
|
||||
/* Return true if the expression denotes a numeric value or address. */
|
||||
{
|
||||
return (Expr->Flags & (E_MASK_LOC)) == (E_LOC_NONE) ||
|
||||
(Expr->Flags & (E_MASK_LOC|E_ADDRESS_OF)) == (E_LOC_ABS|E_ADDRESS_OF);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_INLINE)
|
||||
int ED_IsConstAbs (const ExprDesc* Expr)
|
||||
/* Return true if the expression denotes a constant absolute value. This can be
|
||||
** a numeric constant, cast to any type.
|
||||
*/
|
||||
{
|
||||
return ED_IsRVal (Expr) && ED_IsAbs (Expr);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
int ED_IsConstAbsInt (const ExprDesc* Expr)
|
||||
/* Return true if the expression is a constant (numeric) integer. */
|
||||
{
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
|
||||
/* common */
|
||||
#include "fp.h"
|
||||
#include "inline.h"
|
||||
|
||||
/* cc65 */
|
||||
#include "asmcode.h"
|
||||
@@ -235,25 +234,17 @@ ExprDesc* ED_Init (ExprDesc* Expr);
|
||||
|
||||
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ED_GetLoc (const ExprDesc* Expr)
|
||||
static inline int ED_GetLoc (const ExprDesc* Expr)
|
||||
/* Return the location flags from the expression */
|
||||
{
|
||||
return (Expr->Flags & E_MASK_LOC);
|
||||
}
|
||||
#else
|
||||
# define ED_GetLoc(Expr) ((Expr)->Flags & E_MASK_LOC)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ED_GetNeeds (const ExprDesc* Expr)
|
||||
static inline int ED_GetNeeds (const ExprDesc* Expr)
|
||||
/* Get flags about what the expression needs. */
|
||||
{
|
||||
return (Expr->Flags & E_MASK_NEED);
|
||||
}
|
||||
#else
|
||||
# define ED_GetNeeds(Expr) ((Expr)->Flags & E_MASK_NEED)
|
||||
#endif
|
||||
|
||||
const char* ED_GetLabelName (const ExprDesc* Expr, long Offs);
|
||||
/* Return the assembler label name of the given expression. Beware: This
|
||||
@@ -274,269 +265,164 @@ int ED_GetStackOffs (const ExprDesc* Expr, int Offs);
|
||||
|
||||
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ED_IsLocNone (const ExprDesc* Expr)
|
||||
static inline int ED_IsLocNone (const ExprDesc* Expr)
|
||||
/* Return true if the expression is an absolute value */
|
||||
{
|
||||
return (Expr->Flags & E_MASK_LOC) == E_LOC_NONE;
|
||||
}
|
||||
#else
|
||||
# define ED_IsLocNone(Expr) (((Expr)->Flags & E_MASK_LOC) == E_LOC_NONE)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ED_IsLocAbs (const ExprDesc* Expr)
|
||||
static inline int ED_IsLocAbs (const ExprDesc* Expr)
|
||||
/* Return true if the expression is referenced with an absolute address */
|
||||
{
|
||||
return (Expr->Flags & E_MASK_LOC) == E_LOC_ABS;
|
||||
}
|
||||
#else
|
||||
# define ED_IsLocAbs(Expr) (((Expr)->Flags & E_MASK_LOC) == E_LOC_ABS)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ED_IsLocRegister (const ExprDesc* Expr)
|
||||
static inline int ED_IsLocRegister (const ExprDesc* Expr)
|
||||
/* Return true if the expression is located in a register */
|
||||
{
|
||||
return (Expr->Flags & E_MASK_LOC) == E_LOC_REGISTER;
|
||||
}
|
||||
#else
|
||||
# define ED_IsLocRegister(Expr) (((Expr)->Flags & E_MASK_LOC) == E_LOC_REGISTER)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ED_IsLocStack (const ExprDesc* Expr)
|
||||
static inline int ED_IsLocStack (const ExprDesc* Expr)
|
||||
/* Return true if the expression is located on the stack */
|
||||
{
|
||||
return (Expr->Flags & E_MASK_LOC) == E_LOC_STACK;
|
||||
}
|
||||
#else
|
||||
# define ED_IsLocStack(Expr) (((Expr)->Flags & E_MASK_LOC) == E_LOC_STACK)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ED_IsLocPrimary (const ExprDesc* Expr)
|
||||
static inline int ED_IsLocPrimary (const ExprDesc* Expr)
|
||||
/* Return true if the expression is an expression in the primary */
|
||||
{
|
||||
return (Expr->Flags & E_MASK_LOC) == E_LOC_PRIMARY;
|
||||
}
|
||||
#else
|
||||
# define ED_IsLocPrimary(Expr) (((Expr)->Flags & E_MASK_LOC) == E_LOC_PRIMARY)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ED_IsLocExpr (const ExprDesc* Expr)
|
||||
static inline int ED_IsLocExpr (const ExprDesc* Expr)
|
||||
/* Return true if the expression is an expression referenced in the primary */
|
||||
{
|
||||
return (Expr->Flags & E_MASK_LOC) == E_LOC_EXPR;
|
||||
}
|
||||
#else
|
||||
# define ED_IsLocExpr(Expr) (((Expr)->Flags & E_MASK_LOC) == E_LOC_EXPR)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ED_IsLocLiteral (const ExprDesc* Expr)
|
||||
static inline int ED_IsLocLiteral (const ExprDesc* Expr)
|
||||
/* Return true if the expression is a string from the literal pool */
|
||||
{
|
||||
return (Expr->Flags & E_MASK_LOC) == E_LOC_LITERAL;
|
||||
}
|
||||
#else
|
||||
# define ED_IsLocLiteral(Expr) (((Expr)->Flags & E_MASK_LOC) == E_LOC_LITERAL)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ED_IsLocConst (const ExprDesc* Expr)
|
||||
static inline int ED_IsLocConst (const ExprDesc* Expr)
|
||||
/* Return true if the expression is a constant location of some sort */
|
||||
{
|
||||
return ((Expr)->Flags & E_MASK_LOC & ~E_LOC_CONST) == 0;
|
||||
}
|
||||
#else
|
||||
# define ED_IsLocConst(Expr) (((Expr)->Flags & E_MASK_LOC & ~E_LOC_CONST) == 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ED_IsLocQuasiConst (const ExprDesc* Expr)
|
||||
static inline int ED_IsLocQuasiConst (const ExprDesc* Expr)
|
||||
/* Return true if the expression is a constant location of some sort or on the
|
||||
** stack.
|
||||
*/
|
||||
{
|
||||
return ED_IsLocConst (Expr) || ED_IsLocStack (Expr);
|
||||
}
|
||||
#else
|
||||
int ED_IsLocQuasiConst (const ExprDesc* Expr);
|
||||
/* Return true if the expression denotes a constant address of some sort. This
|
||||
** can be the address of a global variable (maybe with offset) or similar.
|
||||
*/
|
||||
#endif
|
||||
|
||||
int ED_IsLocZP (const ExprDesc* Expr);
|
||||
/* Return true if the expression is in a location on a zeropage */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ED_IsLocPrimaryOrExpr (const ExprDesc* Expr)
|
||||
static inline int ED_IsLocPrimaryOrExpr (const ExprDesc* Expr)
|
||||
/* Return true if the expression is E_LOC_PRIMARY or E_LOC_EXPR */
|
||||
{
|
||||
return ED_IsLocPrimary (Expr) || ED_IsLocExpr (Expr);
|
||||
}
|
||||
#else
|
||||
int ED_IsLocPrimaryOrExpr (const ExprDesc* Expr);
|
||||
/* Return true if the expression is E_LOC_PRIMARY or E_LOC_EXPR */
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ED_NeedsPrimary (const ExprDesc* Expr)
|
||||
static inline int ED_NeedsPrimary (const ExprDesc* Expr)
|
||||
/* Check if the expression needs to be in Primary. */
|
||||
{
|
||||
return (Expr->Flags & E_MASK_NEED) == E_NEED_EAX;
|
||||
}
|
||||
#else
|
||||
# define ED_NeedsPrimary(Expr) (((Expr)->Flags & E_MASK_NEED) == E_NEED_EAX)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ED_NeedsTest (const ExprDesc* Expr)
|
||||
static inline int ED_NeedsTest (const ExprDesc* Expr)
|
||||
/* Check if the expression needs a test. */
|
||||
{
|
||||
return (Expr->Flags & E_NEED_TEST) != 0;
|
||||
}
|
||||
#else
|
||||
# define ED_NeedsTest(Expr) (((Expr)->Flags & E_NEED_TEST) != 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ED_IsTested (const ExprDesc* Expr)
|
||||
static inline int ED_IsTested (const ExprDesc* Expr)
|
||||
/* Check if the expression has set the condition codes. */
|
||||
{
|
||||
return (Expr->Flags & E_CC_SET) != 0;
|
||||
}
|
||||
#else
|
||||
# define ED_IsTested(Expr) (((Expr)->Flags & E_CC_SET) != 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ED_YetToTest (const ExprDesc* Expr)
|
||||
static inline int ED_YetToTest (const ExprDesc* Expr)
|
||||
/* Check if the expression needs to be tested but not yet. */
|
||||
{
|
||||
return ((Expr)->Flags & (E_NEED_TEST | E_CC_SET)) == E_NEED_TEST;
|
||||
}
|
||||
#else
|
||||
# define ED_YetToTest(Expr) (((Expr)->Flags & (E_NEED_TEST | E_CC_SET)) == E_NEED_TEST)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ED_IsLoaded (const ExprDesc* Expr)
|
||||
static inline int ED_IsLoaded (const ExprDesc* Expr)
|
||||
/* Check if the expression is loaded.
|
||||
** NOTE: This is currently unused and not working due to code complexity.
|
||||
*/
|
||||
{
|
||||
return (Expr->Flags & E_LOADED) != 0;
|
||||
}
|
||||
#else
|
||||
# define ED_IsLoaded(Expr) (((Expr)->Flags & E_LOADED) != 0)
|
||||
#endif
|
||||
|
||||
int ED_YetToLoad (const ExprDesc* Expr);
|
||||
/* Check if the expression is yet to be loaded somehow. */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ED_NeedsConst (const ExprDesc* Expr)
|
||||
static inline int ED_NeedsConst (const ExprDesc* Expr)
|
||||
/* Check if the expression need be immutable */
|
||||
{
|
||||
return (Expr->Flags & E_EVAL_IMMUTABLE_RESULT) == E_EVAL_IMMUTABLE_RESULT;
|
||||
}
|
||||
#else
|
||||
# define ED_NeedsConst(Expr) (((Expr)->Flags & E_EVAL_IMMUTABLE_RESULT) == E_EVAL_IMMUTABLE_RESULT)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ED_IsUneval (const ExprDesc* Expr)
|
||||
static inline int ED_IsUneval (const ExprDesc* Expr)
|
||||
/* Check if the expression is not to be evaluated */
|
||||
{
|
||||
return (Expr->Flags & E_EVAL_UNEVAL) == E_EVAL_UNEVAL;
|
||||
}
|
||||
#else
|
||||
# define ED_IsUneval(Expr) (((Expr)->Flags & E_EVAL_UNEVAL) == E_EVAL_UNEVAL)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ED_MayHaveNoEffect (const ExprDesc* Expr)
|
||||
static inline int ED_MayHaveNoEffect (const ExprDesc* Expr)
|
||||
/* Check if the expression may be present without effects */
|
||||
{
|
||||
return (Expr->Flags & E_EVAL_MAYBE_UNUSED) == E_EVAL_MAYBE_UNUSED;
|
||||
}
|
||||
#else
|
||||
# define ED_MayHaveNoEffect(Expr) (((Expr)->Flags & E_EVAL_MAYBE_UNUSED) == E_EVAL_MAYBE_UNUSED)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ED_IsAddrExpr (const ExprDesc* Expr)
|
||||
static inline int ED_IsAddrExpr (const ExprDesc* Expr)
|
||||
/* Check if the expression is taken address of instead of its value.
|
||||
*/
|
||||
{
|
||||
return (Expr->Flags & E_ADDRESS_OF) != 0;
|
||||
}
|
||||
#else
|
||||
# define ED_IsAddrExpr(Expr) (((Expr)->Flags & E_ADDRESS_OF) != 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ED_IsIndExpr (const ExprDesc* Expr)
|
||||
static inline int ED_IsIndExpr (const ExprDesc* Expr)
|
||||
/* Check if the expression is a reference to its value */
|
||||
{
|
||||
return (Expr->Flags & E_ADDRESS_OF) == 0 &&
|
||||
!ED_IsLocNone (Expr) && !ED_IsLocPrimary (Expr);
|
||||
}
|
||||
#else
|
||||
int ED_IsIndExpr (const ExprDesc* Expr);
|
||||
/* Check if the expression is a reference to its value */
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ED_IsLVal (const ExprDesc* Expr)
|
||||
static inline int ED_IsLVal (const ExprDesc* Expr)
|
||||
/* Return true if the expression is a reference */
|
||||
{
|
||||
return ((Expr)->Flags & E_MASK_RTYPE) == E_RTYPE_LVAL;
|
||||
}
|
||||
#else
|
||||
# define ED_IsLVal(Expr) (((Expr)->Flags & E_MASK_RTYPE) == E_RTYPE_LVAL)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ED_IsRVal (const ExprDesc* Expr)
|
||||
static inline int ED_IsRVal (const ExprDesc* Expr)
|
||||
/* Return true if the expression is an rvalue */
|
||||
{
|
||||
return ((Expr)->Flags & E_MASK_RTYPE) == E_RTYPE_RVAL;
|
||||
}
|
||||
#else
|
||||
# define ED_IsRVal(Expr) (((Expr)->Flags & E_MASK_RTYPE) == E_RTYPE_RVAL)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ED_IsAbs (const ExprDesc* Expr)
|
||||
static inline int ED_IsAbs (const ExprDesc* Expr)
|
||||
/* Return true if the expression denotes a numeric value or address. */
|
||||
{
|
||||
return (Expr->Flags & (E_MASK_LOC)) == (E_LOC_NONE) ||
|
||||
(Expr->Flags & (E_MASK_LOC|E_ADDRESS_OF)) == (E_LOC_ABS|E_ADDRESS_OF);
|
||||
}
|
||||
#else
|
||||
int ED_IsAbs (const ExprDesc* Expr);
|
||||
/* Return true if the expression denotes a numeric value or address. */
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ED_IsConstAbs (const ExprDesc* Expr)
|
||||
static inline int ED_IsConstAbs (const ExprDesc* Expr)
|
||||
/* Return true if the expression denotes a constant absolute value. This can be
|
||||
** a numeric constant, cast to any type.
|
||||
*/
|
||||
{
|
||||
return ED_IsRVal (Expr) && ED_IsAbs (Expr);
|
||||
}
|
||||
#else
|
||||
int ED_IsConstAbs (const ExprDesc* Expr);
|
||||
/* Return true if the expression denotes a constant absolute value. This can be
|
||||
** a numeric constant, cast to any type.
|
||||
*/
|
||||
#endif
|
||||
|
||||
int ED_IsConstAbsInt (const ExprDesc* Expr);
|
||||
/* Return true if the expression is a constant (numeric) integer. */
|
||||
@@ -623,8 +509,7 @@ ExprDesc* ED_MakeConstBool (ExprDesc* Expr, long Value);
|
||||
ExprDesc* ED_FinalizeRValLoad (ExprDesc* Expr);
|
||||
/* Finalize the result of LoadExpr to be an rvalue in the primary register */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void ED_MarkExprAsLVal (ExprDesc* Expr)
|
||||
static inline void ED_MarkExprAsLVal (ExprDesc* Expr)
|
||||
/* Mark the expression as an lvalue.
|
||||
** HINT: Consider using ED_IndExpr instead of this, unless you know what
|
||||
** consequence there will be, as there are both a big part in the code
|
||||
@@ -633,12 +518,8 @@ INLINE void ED_MarkExprAsLVal (ExprDesc* Expr)
|
||||
{
|
||||
Expr->Flags |= E_RTYPE_LVAL;
|
||||
}
|
||||
#else
|
||||
# define ED_MarkExprAsLVal(Expr) do { (Expr)->Flags |= E_RTYPE_LVAL; } while (0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void ED_MarkExprAsRVal (ExprDesc* Expr)
|
||||
static inline void ED_MarkExprAsRVal (ExprDesc* Expr)
|
||||
/* Mark the expression as an rvalue.
|
||||
** HINT: Consider using ED_AddrExpr instead of this, unless you know what
|
||||
** consequence there will be, as there are both a big part in the code
|
||||
@@ -647,9 +528,6 @@ INLINE void ED_MarkExprAsRVal (ExprDesc* Expr)
|
||||
{
|
||||
Expr->Flags &= ~E_RTYPE_LVAL;
|
||||
}
|
||||
#else
|
||||
# define ED_MarkExprAsRVal(Expr) do { (Expr)->Flags &= ~E_RTYPE_LVAL; } while (0)
|
||||
#endif
|
||||
|
||||
void ED_AddrExpr (ExprDesc* Expr);
|
||||
/* Take address of Expr */
|
||||
@@ -657,59 +535,38 @@ void ED_AddrExpr (ExprDesc* Expr);
|
||||
void ED_IndExpr (ExprDesc* Expr);
|
||||
/* Dereference Expr */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void ED_RequireTest (ExprDesc* Expr)
|
||||
static inline void ED_RequireTest (ExprDesc* Expr)
|
||||
/* Mark the expression for a test. */
|
||||
{
|
||||
Expr->Flags |= E_NEED_TEST;
|
||||
}
|
||||
#else
|
||||
# define ED_RequireTest(Expr) do { (Expr)->Flags |= E_NEED_TEST; } while (0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void ED_RequireNoTest (ExprDesc* Expr)
|
||||
static inline void ED_RequireNoTest (ExprDesc* Expr)
|
||||
/* Mark the expression not for a test. */
|
||||
{
|
||||
Expr->Flags &= ~E_NEED_TEST;
|
||||
}
|
||||
#else
|
||||
# define ED_RequireNoTest(Expr) do { (Expr)->Flags &= ~E_NEED_TEST; } while (0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void ED_TestDone (ExprDesc* Expr)
|
||||
static inline void ED_TestDone (ExprDesc* Expr)
|
||||
/* Mark the expression as tested and condition codes set. */
|
||||
{
|
||||
Expr->Flags |= E_CC_SET;
|
||||
}
|
||||
#else
|
||||
# define ED_TestDone(Expr) \
|
||||
do { (Expr)->Flags |= E_CC_SET; } while (0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void ED_MarkAsUntested (ExprDesc* Expr)
|
||||
static inline void ED_MarkAsUntested (ExprDesc* Expr)
|
||||
/* Mark the expression as not tested (condition codes not set). */
|
||||
{
|
||||
Expr->Flags &= ~E_CC_SET;
|
||||
}
|
||||
#else
|
||||
# define ED_MarkAsUntested(Expr) do { (Expr)->Flags &= ~E_CC_SET; } while (0)
|
||||
#endif
|
||||
|
||||
void ED_MarkForUneval (ExprDesc* Expr);
|
||||
/* Mark the expression as not to be evaluated */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void ED_PropagateFrom (ExprDesc* Expr, const ExprDesc* SubExpr)
|
||||
static inline void ED_PropagateFrom (ExprDesc* Expr, const ExprDesc* SubExpr)
|
||||
/* Propagate viral flags from subexpression */
|
||||
{
|
||||
Expr->Flags |= SubExpr->Flags & E_MASK_VIRAL;
|
||||
}
|
||||
#else
|
||||
# define ED_PropagateFrom(Expr, SubExpr) (void)((Expr)->Flags |= (SubExpr)->Flags & E_MASK_VIRAL)
|
||||
#endif
|
||||
|
||||
const Type* ReplaceType (ExprDesc* Expr, const Type* NewType);
|
||||
/* Replace the type of Expr by a copy of Newtype and return the old type string */
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
|
||||
/* common */
|
||||
#include "coll.h"
|
||||
#include "inline.h"
|
||||
#include "strbuf.h"
|
||||
|
||||
|
||||
@@ -109,15 +108,11 @@ void FreeUndefinedMacros (void);
|
||||
Macro* FindMacro (const char* Name);
|
||||
/* Find a macro with the given name. Return the macro definition or NULL */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsMacro (const char* Name)
|
||||
static inline int IsMacro (const char* Name)
|
||||
/* Return true if the given name is the name of a macro, return false otherwise */
|
||||
{
|
||||
return FindMacro (Name) != 0;
|
||||
}
|
||||
#else
|
||||
# define IsMacro(Name) (FindMacro (Name) != 0)
|
||||
#endif
|
||||
|
||||
int FindMacroParam (const Macro* M, const char* Param);
|
||||
/* Search for a macro parameter. If found, return the index of the parameter.
|
||||
|
||||
@@ -38,11 +38,6 @@
|
||||
|
||||
|
||||
|
||||
/* common */
|
||||
#include "inline.h"
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
@@ -216,27 +211,19 @@ const OPCDesc* FindOP65 (const char* OPC);
|
||||
unsigned GetInsnSize (opc_t OPC, am_t AM);
|
||||
/* Return the size of the given instruction */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE const OPCDesc* GetOPCDesc (opc_t OPC)
|
||||
static inline const OPCDesc* GetOPCDesc (opc_t OPC)
|
||||
/* Get an opcode description */
|
||||
{
|
||||
/* Return the description */
|
||||
return &OPCTable [OPC];
|
||||
}
|
||||
#else
|
||||
# define GetOPCDesc(OPC) (&OPCTable [(OPC)])
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned GetOPCInfo (opc_t OPC)
|
||||
static inline unsigned GetOPCInfo (opc_t OPC)
|
||||
/* Get opcode information */
|
||||
{
|
||||
/* Return the info */
|
||||
return OPCTable[OPC].Info;
|
||||
}
|
||||
#else
|
||||
# define GetOPCInfo(OPC) (OPCTable[(OPC)].Info)
|
||||
#endif
|
||||
|
||||
unsigned char GetAMUseInfo (am_t AM);
|
||||
/* Get usage info for the given addressing mode (addressing modes that use
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
/* common */
|
||||
#include "chartype.h"
|
||||
#include "check.h"
|
||||
#include "inline.h"
|
||||
#include "print.h"
|
||||
#include "xmalloc.h"
|
||||
|
||||
|
||||
@@ -111,44 +111,6 @@ void RC_Dump (FILE* F, const RegContents* RC)
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_INLINE)
|
||||
int PStatesAreKnown (unsigned short PFlags, unsigned WhatStates)
|
||||
/* Return true if all queried processor states are known.
|
||||
** Note: WhatStates takes PSTATE_* rather than PFVAL_*.
|
||||
*/
|
||||
{
|
||||
return ((PFlags << (PSTATE_BITS_SHIFT - 8)) & WhatStates & PSTATE_BITS_MASK) == 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_INLINE)
|
||||
int PStatesAreSet (unsigned short PFlags, unsigned WhatStates)
|
||||
/* Return true if all queried processor states are known to be set.
|
||||
** Note: WhatStates takes PSTATE_* rather than PFVAL_*.
|
||||
*/
|
||||
{
|
||||
return (PFlags & (WhatStates >> (PSTATE_BITS_SHIFT - 8))) == 0 &&
|
||||
(PFlags & (WhatStates >> PSTATE_BITS_SHIFT)) == WhatStates >> PSTATE_BITS_SHIFT;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_INLINE)
|
||||
int PStatesAreClear (unsigned short PFlags, unsigned WhatStates)
|
||||
/* Return true if all queried processor states are known to be cleared.
|
||||
** Note: WhatStates takes PSTATE_* rather than PFVAL_*.
|
||||
*/
|
||||
{
|
||||
return (PFlags & (WhatStates >> (PSTATE_BITS_SHIFT - 8))) == 0 &&
|
||||
(PFlags & (WhatStates >> PSTATE_BITS_SHIFT)) == 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
RegInfo* NewRegInfo (const RegContents* RC)
|
||||
/* Allocate a new register info, initialize and return it. If RC is not
|
||||
** a NULL pointer, it is used to initialize both, the input and output
|
||||
|
||||
@@ -40,9 +40,6 @@
|
||||
|
||||
#include <stdio.h> /* ### */
|
||||
|
||||
/* common */
|
||||
#include "inline.h"
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -160,52 +157,35 @@ void RC_InvalidatePS (RegContents* C);
|
||||
void RC_Dump (FILE* F, const RegContents* RC);
|
||||
/* Dump the contents of the given RegContents struct */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int RegValIsKnown (short Val)
|
||||
static inline int RegValIsKnown (short Val)
|
||||
/* Return true if the register value is known */
|
||||
{
|
||||
return (Val >= 0);
|
||||
}
|
||||
#else
|
||||
# define RegValIsKnown(S) ((S) >= 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int RegValIsUnknown (short Val)
|
||||
static inline int RegValIsUnknown (short Val)
|
||||
/* Return true if the register value is not known */
|
||||
{
|
||||
return (Val < 0);
|
||||
}
|
||||
#else
|
||||
# define RegValIsUnknown(S) ((S) < 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int PStatesAreKnown (unsigned short PFlags, unsigned WhatStates)
|
||||
static inline int PStatesAreKnown (unsigned short PFlags, unsigned WhatStates)
|
||||
/* Return true if all queried processor states are known.
|
||||
** Note: WhatStates takes PSTATE_* rather than PFVAL_*.
|
||||
*/
|
||||
{
|
||||
return ((PFlags << (PSTATE_BITS_SHIFT - 8)) & WhatStates & PSTATE_BITS_MASK) == 0;
|
||||
}
|
||||
#else
|
||||
int PStatesAreKnown (unsigned short PFlags, unsigned WhatStates);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int PStatesAreUnknown (unsigned short PFlags, unsigned WhatStates)
|
||||
static inline int PStatesAreUnknown (unsigned short PFlags, unsigned WhatStates)
|
||||
/* Return true if any queried processor states are unknown.
|
||||
** Note: WhatStates takes PSTATE_* rather than PFVAL_*.
|
||||
*/
|
||||
{
|
||||
return !PStatesAreKnown (PFlags, WhatStates);
|
||||
}
|
||||
#else
|
||||
# define PStatesAreUnknown(V, B) (!PStatesAreKnown (V, B))
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int PStatesAreSet (unsigned short PFlags, unsigned WhatStates)
|
||||
static inline int PStatesAreSet (unsigned short PFlags, unsigned WhatStates)
|
||||
/* Return true if all queried processor states are known to be set.
|
||||
** Note: WhatStates takes PSTATE_* rather than PFVAL_*.
|
||||
*/
|
||||
@@ -213,12 +193,8 @@ INLINE int PStatesAreSet (unsigned short PFlags, unsigned WhatStates)
|
||||
return (PFlags & (WhatStates >> (PSTATE_BITS_SHIFT - 8))) == 0 &&
|
||||
(PFlags & (WhatStates >> PSTATE_BITS_SHIFT)) == WhatStates >> PSTATE_BITS_SHIFT;
|
||||
}
|
||||
#else
|
||||
int PStatesAreSet (unsigned short PFlags, unsigned WhatStates);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int PStatesAreClear (unsigned short PFlags, unsigned WhatStates)
|
||||
static inline int PStatesAreClear (unsigned short PFlags, unsigned WhatStates)
|
||||
/* Return true if the queried processor states are known to be cleared.
|
||||
** Note: WhatStates takes PSTATE_* rather than PFVAL_*.
|
||||
*/
|
||||
@@ -226,9 +202,6 @@ INLINE int PStatesAreClear (unsigned short PFlags, unsigned WhatStates)
|
||||
return (PFlags & (WhatStates >> (PSTATE_BITS_SHIFT - 8))) == 0 &&
|
||||
(PFlags & (WhatStates >> PSTATE_BITS_SHIFT)) == 0;
|
||||
}
|
||||
#else
|
||||
int PStatesAreClear (unsigned short PFlags, unsigned WhatStates);
|
||||
#endif
|
||||
|
||||
RegInfo* NewRegInfo (const RegContents* RC);
|
||||
/* Allocate a new register info, initialize and return it. If RC is not
|
||||
|
||||
@@ -235,47 +235,29 @@ extern unsigned InPragmaParser; /* Depth of pragma parser calling */
|
||||
|
||||
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int TokIsPunc (const Token* T)
|
||||
static inline int TokIsPunc (const Token* T)
|
||||
/* Return true if the token is a punctuator */
|
||||
{
|
||||
return (T->Tok >= TOK_FIRST_PUNC && T->Tok <= TOK_LAST_PUNC);
|
||||
}
|
||||
#else
|
||||
# define TokIsPunc(T) \
|
||||
((T)->Tok >= TOK_FIRST_PUNC && (T)->Tok <= TOK_LAST_PUNC)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int TokIsStorageClass (const Token* T)
|
||||
static inline int TokIsStorageClass (const Token* T)
|
||||
/* Return true if the token is a storage class specifier */
|
||||
{
|
||||
return (T->Tok >= TOK_FIRST_STORAGE_CLASS && T->Tok <= TOK_LAST_STORAGE_CLASS);
|
||||
}
|
||||
#else
|
||||
# define TokIsStorageClass(T) \
|
||||
((T)->Tok >= TOK_FIRST_STORAGE_CLASS && (T)->Tok <= TOK_LAST_STORAGE_CLASS)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int TokIsType (const Token* T)
|
||||
static inline int TokIsType (const Token* T)
|
||||
/* Return true if the token is a type */
|
||||
{
|
||||
return (T->Tok >= TOK_FIRST_TYPE && T->Tok <= TOK_LAST_TYPE);
|
||||
}
|
||||
#else
|
||||
# define TokIsType(T) ((T)->Tok >= TOK_FIRST_TYPE && (T)->Tok <= TOK_LAST_TYPE)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int TokIsTypeQual (const Token* T)
|
||||
static inline int TokIsTypeQual (const Token* T)
|
||||
/* Return true if the token is a type qualifier */
|
||||
{
|
||||
return (T->Tok >= TOK_FIRST_TYPEQUAL && T->Tok <= TOK_LAST_TYPEQUAL);
|
||||
}
|
||||
#else
|
||||
# define TokIsTypeQual(T) ((T)->Tok >= TOK_FIRST_TYPEQUAL && (T)->Tok <= TOK_LAST_TYPEQUAL)
|
||||
#endif
|
||||
|
||||
int TokIsFuncSpec (const Token* T);
|
||||
/* Return true if the token is a function specifier */
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
|
||||
/* common */
|
||||
#include "coll.h"
|
||||
#include "inline.h"
|
||||
|
||||
/* cc65 */
|
||||
#include "datatype.h"
|
||||
@@ -262,118 +261,74 @@ void DumpSymEntry (FILE* F, const SymEntry* E);
|
||||
int SymIsOutputFunc (const SymEntry* Sym);
|
||||
/* Return true if this is a function that must be output */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int SymIsArray (const SymEntry* Sym)
|
||||
static inline int SymIsArray (const SymEntry* Sym)
|
||||
/* Return true if the given entry is an array entry */
|
||||
{
|
||||
return ((Sym->Flags & SC_TYPEMASK) == SC_ARRAY);
|
||||
}
|
||||
#else
|
||||
# define SymIsArray(Sym) (((Sym)->Flags & SC_TYPEMASK) == SC_ARRAY)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int SymIsBitField (const SymEntry* Sym)
|
||||
static inline int SymIsBitField (const SymEntry* Sym)
|
||||
/* Return true if the given entry is a bit-field entry */
|
||||
{
|
||||
return ((Sym->Flags & SC_TYPEMASK) == SC_BITFIELD);
|
||||
}
|
||||
#else
|
||||
# define SymIsBitField(Sym) (((Sym)->Flags & SC_TYPEMASK) == SC_BITFIELD)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int SymIsLabel (const SymEntry* Sym)
|
||||
static inline int SymIsLabel (const SymEntry* Sym)
|
||||
/* Return true if the given entry is a label entry */
|
||||
{
|
||||
return ((Sym)->Flags & SC_TYPEMASK) == SC_LABEL;
|
||||
}
|
||||
#else
|
||||
# define SymIsLabel(Sym) (((Sym)->Flags & SC_TYPEMASK) == SC_LABEL)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int SymIsTypeDef (const SymEntry* Sym)
|
||||
static inline int SymIsTypeDef (const SymEntry* Sym)
|
||||
/* Return true if the given entry is a typedef entry */
|
||||
{
|
||||
return ((Sym->Flags & SC_TYPEMASK) == SC_TYPEDEF);
|
||||
}
|
||||
#else
|
||||
# define SymIsTypeDef(Sym) (((Sym)->Flags & SC_TYPEMASK) == SC_TYPEDEF)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int SymIsDef (const SymEntry* Sym)
|
||||
static inline int SymIsDef (const SymEntry* Sym)
|
||||
/* Return true if the given entry is defined */
|
||||
{
|
||||
return ((Sym->Flags & SC_DEF) == SC_DEF);
|
||||
}
|
||||
#else
|
||||
# define SymIsDef(Sym) (((Sym)->Flags & SC_DEF) == SC_DEF)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int SymIsRef (const SymEntry* Sym)
|
||||
static inline int SymIsRef (const SymEntry* Sym)
|
||||
/* Return true if the given entry is referenced */
|
||||
{
|
||||
return ((Sym->Flags & SC_REF) == SC_REF);
|
||||
}
|
||||
#else
|
||||
# define SymIsRef(Sym) (((Sym)->Flags & SC_REF) == SC_REF)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int SymIsRegVar (const SymEntry* Sym)
|
||||
static inline int SymIsRegVar (const SymEntry* Sym)
|
||||
/* Return true if the given entry is a register variable */
|
||||
{
|
||||
return ((Sym->Flags & (SC_STORAGEMASK | SC_TYPEMASK)) == (SC_REGISTER | SC_NONE));
|
||||
}
|
||||
#else
|
||||
# define SymIsRegVar(Sym) (((Sym)->Flags & (SC_STORAGEMASK | SC_TYPEMASK)) == (SC_REGISTER | SC_NONE))
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int SymHasFlexibleArrayMember (const SymEntry* Sym)
|
||||
static inline int SymHasFlexibleArrayMember (const SymEntry* Sym)
|
||||
/* Return true if the given entry has a flexible array member */
|
||||
{
|
||||
return ((Sym->Flags & SC_HAVEFAM) == SC_HAVEFAM);
|
||||
}
|
||||
#else
|
||||
# define SymHasFlexibleArrayMember(Sym) (((Sym)->Flags & SC_HAVEFAM) == SC_HAVEFAM)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int SymHasConstMember (const SymEntry* Sym)
|
||||
static inline int SymHasConstMember (const SymEntry* Sym)
|
||||
/* Return true if the given entry has a const member */
|
||||
{
|
||||
return ((Sym->Flags & SC_HAVECONST) == SC_HAVECONST);
|
||||
}
|
||||
#else
|
||||
# define SymHasConstMember(Sym) (((Sym)->Flags & SC_HAVECONST) == SC_HAVECONST)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE const char* SymGetAsmName (const SymEntry* Sym)
|
||||
static inline const char* SymGetAsmName (const SymEntry* Sym)
|
||||
/* Return the assembler label name for the symbol (beware: may be NULL!) */
|
||||
{
|
||||
return Sym->AsmName;
|
||||
}
|
||||
#else
|
||||
# define SymGetAsmName(Sym) ((Sym)->AsmName)
|
||||
#endif
|
||||
|
||||
const DeclAttr* SymGetAttr (const SymEntry* Sym, DeclAttrType AttrType);
|
||||
/* Return an attribute for this symbol or NULL if the attribute does not exist */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int SymHasAttr (const SymEntry* Sym, DeclAttrType A)
|
||||
static inline int SymHasAttr (const SymEntry* Sym, DeclAttrType A)
|
||||
/* Return true if the symbol has the given attribute */
|
||||
{
|
||||
return (SymGetAttr (Sym, A) != 0);
|
||||
}
|
||||
#else
|
||||
# define SymHasAttr(Sym, A) (SymGetAttr (Sym, A) != 0)
|
||||
#endif
|
||||
|
||||
void SymUseAttr (SymEntry* Sym, struct Declarator* D);
|
||||
/* Use the attributes from the declarator for this symbol */
|
||||
|
||||
@@ -38,11 +38,6 @@
|
||||
|
||||
|
||||
|
||||
/* common */
|
||||
#include "inline.h"
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -40,8 +40,6 @@
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
/* common */
|
||||
#include "inline.h"
|
||||
|
||||
|
||||
/* This module contains replacements for functions in ctype.h besides other
|
||||
@@ -73,15 +71,11 @@ int IsAscii (char C);
|
||||
int IsBlank (char C);
|
||||
/* Check for a space or tab */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IsControl (char C)
|
||||
static inline int IsControl (char C)
|
||||
/* Check for control chars */
|
||||
{
|
||||
return iscntrl ((unsigned char) C);
|
||||
}
|
||||
#else
|
||||
# define IsControl(C) iscntrl (C)
|
||||
#endif
|
||||
|
||||
int IsSpace (char C);
|
||||
/* Check for any white space characters */
|
||||
|
||||
@@ -155,89 +155,6 @@ void CollInsert (Collection* C, void* Item, unsigned Index)
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_INLINE)
|
||||
void CollAppend (Collection* C, void* Item)
|
||||
/* Append an item to the end of the collection */
|
||||
{
|
||||
/* Insert the item at the end of the current list */
|
||||
CollInsert (C, Item, C->Count);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_INLINE)
|
||||
void* CollAt (const Collection* C, unsigned Index)
|
||||
/* Return the item at the given index */
|
||||
{
|
||||
/* Check the index */
|
||||
PRECONDITION (Index < C->Count);
|
||||
|
||||
/* Return the element */
|
||||
return C->Items[Index];
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_INLINE)
|
||||
const void* CollConstAt (const Collection* C, unsigned Index)
|
||||
/* Return the item at the given index */
|
||||
{
|
||||
/* Check the index */
|
||||
PRECONDITION (Index < C->Count);
|
||||
|
||||
/* Return the element */
|
||||
return C->Items[Index];
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_INLINE)
|
||||
void* CollLast (Collection* C)
|
||||
/* Return the last item in a collection */
|
||||
{
|
||||
/* We must have at least one entry */
|
||||
PRECONDITION (C->Count > 0);
|
||||
|
||||
/* Return the element */
|
||||
return C->Items[C->Count-1];
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_INLINE)
|
||||
const void* CollConstLast (const Collection* C)
|
||||
/* Return the last item in a collection */
|
||||
{
|
||||
/* We must have at least one entry */
|
||||
PRECONDITION (C->Count > 0);
|
||||
|
||||
/* Return the element */
|
||||
return C->Items[C->Count-1];
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_INLINE)
|
||||
void* CollPop (Collection* C)
|
||||
/* Remove the last segment from the stack and return it. Calls FAIL if the
|
||||
** collection is empty.
|
||||
*/
|
||||
{
|
||||
/* We must have at least one entry */
|
||||
PRECONDITION (C->Count > 0);
|
||||
|
||||
/* Return the element */
|
||||
return C->Items[--C->Count];
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
int CollIndex (Collection* C, const void* Item)
|
||||
/* Return the index of the given item in the collection. Return -1 if the
|
||||
** item was not found in the collection.
|
||||
@@ -290,22 +207,6 @@ void CollDeleteItem (Collection* C, const void* Item)
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_INLINE)
|
||||
void CollReplace (Collection* C, void* Item, unsigned Index)
|
||||
/* Replace the item at the given position. The old item will not be freed,
|
||||
** just the pointer will get replaced.
|
||||
*/
|
||||
{
|
||||
/* Check the index */
|
||||
PRECONDITION (Index < C->Count);
|
||||
|
||||
/* Replace the item pointer */
|
||||
C->Items[Index] = Item;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void CollReplaceExpand (Collection* C, void* Item, unsigned Index)
|
||||
/* If Index is a valid index for the collection, replace the item at this
|
||||
** position by the one passed. If the collection is too small, expand it,
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
/* common */
|
||||
#include "attrib.h"
|
||||
#include "check.h"
|
||||
#include "inline.h"
|
||||
|
||||
|
||||
|
||||
@@ -96,33 +95,23 @@ void CollGrow (Collection* C, unsigned Size);
|
||||
** of items to be placed in the collection is known in advance.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned CollCount (const Collection* C)
|
||||
static inline unsigned CollCount (const Collection* C)
|
||||
/* Return the number of items in the collection */
|
||||
{
|
||||
return C->Count;
|
||||
}
|
||||
#else
|
||||
# define CollCount(C) (C)->Count
|
||||
#endif
|
||||
|
||||
void CollInsert (Collection* C, void* Item, unsigned Index);
|
||||
/* Insert the data at the given position in the collection */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void CollAppend (Collection* C, void* Item)
|
||||
static inline void CollAppend (Collection* C, void* Item)
|
||||
/* Append an item to the end of the collection */
|
||||
{
|
||||
/* Insert the item at the end of the current list */
|
||||
CollInsert (C, Item, C->Count);
|
||||
}
|
||||
#else
|
||||
void CollAppend (Collection* C, void* Item);
|
||||
/* Append an item to the end of the collection */
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void* CollAt (const Collection* C, unsigned Index)
|
||||
static inline void* CollAt (const Collection* C, unsigned Index)
|
||||
/* Return the item at the given index */
|
||||
{
|
||||
/* Check the index */
|
||||
@@ -131,24 +120,15 @@ INLINE void* CollAt (const Collection* C, unsigned Index)
|
||||
/* Return the element */
|
||||
return C->Items[Index];
|
||||
}
|
||||
#else
|
||||
void* CollAt (const Collection* C, unsigned Index);
|
||||
/* Return the item at the given index */
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void* CollAtUnchecked (const Collection* C, unsigned Index)
|
||||
static inline void* CollAtUnchecked (const Collection* C, unsigned Index)
|
||||
/* Return the item at the given index */
|
||||
{
|
||||
/* Return the element */
|
||||
return C->Items[Index];
|
||||
}
|
||||
#else
|
||||
# define CollAtUnchecked(C, Index) ((C)->Items[(Index)])
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE const void* CollConstAt (const Collection* C, unsigned Index)
|
||||
static inline const void* CollConstAt (const Collection* C, unsigned Index)
|
||||
/* Return the item at the given index */
|
||||
{
|
||||
/* Check the index */
|
||||
@@ -157,13 +137,8 @@ INLINE const void* CollConstAt (const Collection* C, unsigned Index)
|
||||
/* Return the element */
|
||||
return C->Items[Index];
|
||||
}
|
||||
#else
|
||||
const void* CollConstAt (const Collection* C, unsigned Index);
|
||||
/* Return the item at the given index */
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void* CollLast (Collection* C)
|
||||
static inline void* CollLast (Collection* C)
|
||||
/* Return the last item in a collection */
|
||||
{
|
||||
/* We must have at least one entry */
|
||||
@@ -172,13 +147,8 @@ INLINE void* CollLast (Collection* C)
|
||||
/* Return the element */
|
||||
return C->Items[C->Count-1];
|
||||
}
|
||||
#else
|
||||
void* CollLast (Collection* C);
|
||||
/* Return the last item in a collection */
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE const void* CollConstLast (const Collection* C)
|
||||
static inline const void* CollConstLast (const Collection* C)
|
||||
/* Return the last item in a collection */
|
||||
{
|
||||
/* We must have at least one entry */
|
||||
@@ -187,13 +157,8 @@ INLINE const void* CollConstLast (const Collection* C)
|
||||
/* Return the element */
|
||||
return C->Items[C->Count-1];
|
||||
}
|
||||
#else
|
||||
const void* CollConstLast (const Collection* C);
|
||||
/* Return the last item in a collection */
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void* CollPop (Collection* C)
|
||||
static inline void* CollPop (Collection* C)
|
||||
/* Remove the last segment from the stack and return it. Calls FAIL if the
|
||||
** collection is empty.
|
||||
*/
|
||||
@@ -204,12 +169,6 @@ INLINE void* CollPop (Collection* C)
|
||||
/* Return the element */
|
||||
return C->Items[--C->Count];
|
||||
}
|
||||
#else
|
||||
void* CollPop (Collection* C);
|
||||
/* Remove the last segment from the stack and return it. Calls FAIL if the
|
||||
** collection is empty.
|
||||
*/
|
||||
#endif
|
||||
|
||||
int CollIndex (Collection* C, const void* Item);
|
||||
/* Return the index of the given item in the collection. Return -1 if the
|
||||
@@ -227,8 +186,7 @@ void CollDeleteItem (Collection* C, const void* Item);
|
||||
** collection, otherwise FAIL will be called.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void CollDeleteAll (Collection* C)
|
||||
static inline void CollDeleteAll (Collection* C)
|
||||
/* Delete all items from the given collection. This will not free the items
|
||||
** itself, it will only remove the pointers.
|
||||
*/
|
||||
@@ -236,12 +194,8 @@ INLINE void CollDeleteAll (Collection* C)
|
||||
/* This one is easy... */
|
||||
C->Count = 0;
|
||||
}
|
||||
#else
|
||||
# define CollDeleteAll(C) ((C)->Count = 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void CollReplace (Collection* C, void* Item, unsigned Index)
|
||||
static inline void CollReplace (Collection* C, void* Item, unsigned Index)
|
||||
/* Replace the item at the given position. The old item will not be freed,
|
||||
** just the pointer will get replaced.
|
||||
*/
|
||||
@@ -252,12 +206,6 @@ INLINE void CollReplace (Collection* C, void* Item, unsigned Index)
|
||||
/* Replace the item pointer */
|
||||
C->Items[Index] = Item;
|
||||
}
|
||||
#else
|
||||
void CollReplace (Collection* C, void* Item, unsigned Index);
|
||||
/* Replace the item at the given position. The old item will not be freed,
|
||||
** just the pointer will get replaced.
|
||||
*/
|
||||
#endif
|
||||
|
||||
void CollReplaceExpand (Collection* C, void* Item, unsigned Index);
|
||||
/* If Index is a valid index for the collection, replace the item at this
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
|
||||
|
||||
/* common */
|
||||
#include "inline.h"
|
||||
#include "xmalloc.h"
|
||||
|
||||
|
||||
@@ -99,15 +98,11 @@ struct HashTable {
|
||||
|
||||
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void InitHashNode (HashNode* N)
|
||||
static inline void InitHashNode (HashNode* N)
|
||||
/* Initialize a hash node. */
|
||||
{
|
||||
N->Next = 0;
|
||||
}
|
||||
#else
|
||||
#define InitHashNode(N) do { (N)->Next = 0; } while (0)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -125,29 +120,21 @@ void DoneHashTable (HashTable* T);
|
||||
** in the table!
|
||||
*/
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE HashTable* NewHashTable (unsigned Slots, const HashFunctions* Func)
|
||||
static inline HashTable* NewHashTable (unsigned Slots, const HashFunctions* Func)
|
||||
/* Create a new hash table and return it. */
|
||||
{
|
||||
/* Allocate memory, initialize and return it */
|
||||
return InitHashTable (xmalloc (sizeof (HashTable)), Slots, Func);
|
||||
}
|
||||
#else
|
||||
#define NewHashTable(Slots, Func) InitHashTable(xmalloc (sizeof (HashTable)), Slots, Func)
|
||||
#endif
|
||||
|
||||
void FreeHashTable (HashTable* T);
|
||||
/* Free a hash table. Note: This will not free the entries in the table! */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned HT_GetCount (const HashTable* T)
|
||||
static inline unsigned HT_GetCount (const HashTable* T)
|
||||
/* Return the number of items in the table. */
|
||||
{
|
||||
return T->Count;
|
||||
}
|
||||
#else
|
||||
#define HT_GetCount(T) ((T)->Count)
|
||||
#endif
|
||||
|
||||
HashNode* HT_FindHash (const HashTable* T, const void* Key, unsigned Hash);
|
||||
/* Find the node with the given key. Differs from HT_Find in that the hash
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* inline.h */
|
||||
/* */
|
||||
/* Definitions to use the inline compiler feature */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2001-2005 Ullrich von Bassewitz */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
/* 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 INLINE_H
|
||||
#define INLINE_H
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Defines */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#if defined(__GNUC__) && !defined(DISABLE_INLINE)
|
||||
# define HAVE_INLINE 1
|
||||
# define INLINE static __inline__
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* End of inline.h */
|
||||
|
||||
#endif
|
||||
@@ -35,10 +35,6 @@
|
||||
|
||||
|
||||
|
||||
#include "inline.h"
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
@@ -56,10 +52,16 @@ struct IntPtrStack {
|
||||
};
|
||||
|
||||
/* An initializer for an empty int stack */
|
||||
#define STATIC_INTPTRSTACK_INITIALIZER { 0, { 0, 0 }, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} } }
|
||||
#define STATIC_INTPTRSTACK_INITIALIZER { \
|
||||
0, \
|
||||
{ 0, 0 }, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} } \
|
||||
}
|
||||
|
||||
/* Declare an int stack with the given value as first element */
|
||||
#define INTPTRSTACK(Val, Ptr) { 1, { {Val, Ptr}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} } }
|
||||
#define INTPTRSTACK(Val, Ptr) { \
|
||||
1, \
|
||||
{ {Val, Ptr}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} } \
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -69,35 +71,23 @@ struct IntPtrStack {
|
||||
|
||||
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IPS_IsFull (const IntPtrStack* S)
|
||||
static inline int IPS_IsFull (const IntPtrStack* S)
|
||||
/* Return true if there is no space left on the given int stack */
|
||||
{
|
||||
return (S->Count >= sizeof (S->Stack) / sizeof (S->Stack[0]));
|
||||
}
|
||||
#else
|
||||
# define IPS_IsFull(S) ((S)->Count >= sizeof ((S)->Stack) / sizeof ((S)->Stack[0]))
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IPS_IsEmpty (const IntPtrStack* S)
|
||||
static inline int IPS_IsEmpty (const IntPtrStack* S)
|
||||
/* Return true if there are no values on the given int stack */
|
||||
{
|
||||
return (S->Count == 0);
|
||||
}
|
||||
#else
|
||||
# define IPS_IsEmpty(S) ((S)->Count == 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned IPS_GetCount (const IntPtrStack* S)
|
||||
static inline unsigned IPS_GetCount (const IntPtrStack* S)
|
||||
/* Return the number of elements on the given int stack */
|
||||
{
|
||||
return S->Count;
|
||||
}
|
||||
#else
|
||||
# define IPS_GetCount(S) (S)->Count
|
||||
#endif
|
||||
|
||||
void IPS_Get (const IntPtrStack* S, long *Val, void **Ptr);
|
||||
/* Get the value on top of an int stack */
|
||||
|
||||
@@ -38,10 +38,6 @@
|
||||
|
||||
|
||||
|
||||
#include "inline.h"
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
@@ -68,35 +64,23 @@ struct IntStack {
|
||||
|
||||
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IS_IsFull (const IntStack* S)
|
||||
static inline int IS_IsFull (const IntStack* S)
|
||||
/* Return true if there is no space left on the given int stack */
|
||||
{
|
||||
return (S->Count >= sizeof (S->Stack) / sizeof (S->Stack[0]));
|
||||
}
|
||||
#else
|
||||
# define IS_IsFull(S) ((S)->Count >= sizeof ((S)->Stack) / sizeof ((S)->Stack[0]))
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int IS_IsEmpty (const IntStack* S)
|
||||
static inline int IS_IsEmpty (const IntStack* S)
|
||||
/* Return true if there are no values on the given int stack */
|
||||
{
|
||||
return (S->Count == 0);
|
||||
}
|
||||
#else
|
||||
# define IS_IsEmpty(S) ((S)->Count == 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned IS_GetCount (const IntStack* S)
|
||||
static inline unsigned IS_GetCount (const IntStack* S)
|
||||
/* Return the number of elements on the given int stack */
|
||||
{
|
||||
return S->Count;
|
||||
}
|
||||
#else
|
||||
# define IS_GetCount(S) (S)->Count
|
||||
#endif
|
||||
|
||||
long IS_Get (const IntStack* S);
|
||||
/* Get the value on top of an int stack */
|
||||
|
||||
@@ -62,17 +62,6 @@ const StrBuf EmptyStrBuf = STATIC_STRBUF_INITIALIZER;
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_INLINE)
|
||||
StrBuf* SB_Init (StrBuf* B)
|
||||
/* Initialize a string buffer */
|
||||
{
|
||||
*B = EmptyStrBuf;
|
||||
return B;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
StrBuf* SB_InitFromString (StrBuf* B, const char* S)
|
||||
/* Initialize a string buffer from a literal string. Beware: The buffer won't
|
||||
** store a copy but a pointer to the actual string.
|
||||
@@ -195,17 +184,6 @@ static void SB_CheapRealloc (StrBuf* B, unsigned NewSize)
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_INLINE)
|
||||
char SB_At (const StrBuf* B, unsigned Index)
|
||||
/* Get a character from the buffer */
|
||||
{
|
||||
PRECONDITION (Index < B->Len);
|
||||
return B->Buf[Index];
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void SB_Drop (StrBuf* B, unsigned Count)
|
||||
/* Drop characters from the end of the string. */
|
||||
{
|
||||
@@ -263,27 +241,6 @@ void SB_CopyBufCooked (StrBuf* Target, const char* Buf, const char* Cooked, unsi
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_INLINE)
|
||||
void SB_CopyStr (StrBuf* Target, const char* S)
|
||||
/* Copy S to Target, discarding the old contents of Target */
|
||||
{
|
||||
SB_CopyBuf (Target, S, strlen (S));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_INLINE)
|
||||
void SB_Copy (StrBuf* Target, const StrBuf* Source)
|
||||
/* Copy Source to Target, discarding the old contents of Target */
|
||||
{
|
||||
SB_CopyBufCooked (Target, Source->Buf, Source->Cooked, Source->Len);
|
||||
Target->Index = Source->Index;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void SB_AppendChar (StrBuf* B, int C)
|
||||
/* Append a character to a string buffer */
|
||||
{
|
||||
@@ -326,46 +283,6 @@ void SB_AppendBuf (StrBuf* B, const char* S, unsigned Size)
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_INLINE)
|
||||
void SB_AppendStr (StrBuf* B, const char* S)
|
||||
/* Append a string to the end of the string buffer */
|
||||
{
|
||||
SB_AppendBuf (B, S, strlen (S));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_INLINE)
|
||||
void SB_Append (StrBuf* Target, const StrBuf* Source)
|
||||
/* Append the contents of Source to Target */
|
||||
{
|
||||
unsigned NewLen = Target->Len + Source->Len;
|
||||
if (NewLen > Target->Allocated) {
|
||||
SB_Realloc (Target, NewLen);
|
||||
}
|
||||
memcpy (Target->Buf + Target->Len, Source->Buf, Source->Len);
|
||||
memcpy (Target->Cooked + Target->Len, Source->Cooked, Source->Len);
|
||||
Target->Len = NewLen;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_INLINE)
|
||||
void SB_Cut (StrBuf* B, unsigned Len)
|
||||
/* Cut the contents of B at the given length. If the current length of the
|
||||
** buffer is smaller than Len, nothing will happen.
|
||||
*/
|
||||
{
|
||||
if (Len < B->Len) {
|
||||
B->Len = Len;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void SB_Slice (StrBuf* Target, const StrBuf* Source, unsigned Start, unsigned Len)
|
||||
/* Copy a slice from Source into Target. The current contents of Target are
|
||||
** destroyed. If Start is greater than the length of Source, or if Len
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
/* common */
|
||||
#include "attrib.h"
|
||||
#include "check.h"
|
||||
#include "inline.h"
|
||||
|
||||
|
||||
|
||||
@@ -89,16 +88,12 @@ extern const StrBuf EmptyStrBuf;
|
||||
|
||||
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE StrBuf* SB_Init (StrBuf* B)
|
||||
static inline StrBuf* SB_Init (StrBuf* B)
|
||||
/* Initialize a string buffer */
|
||||
{
|
||||
*B = EmptyStrBuf;
|
||||
return B;
|
||||
}
|
||||
#else
|
||||
StrBuf* SB_Init (StrBuf* B);
|
||||
#endif
|
||||
|
||||
StrBuf* SB_InitFromString (StrBuf* B, const char* S);
|
||||
/* Initialize a string buffer from a literal string. Beware: The buffer won't
|
||||
@@ -121,200 +116,126 @@ void SB_Realloc (StrBuf* B, unsigned NewSize);
|
||||
** available.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned SB_GetLen (const StrBuf* B)
|
||||
static inline unsigned SB_GetLen (const StrBuf* B)
|
||||
/* Return the length of the buffer contents */
|
||||
{
|
||||
return B->Len;
|
||||
}
|
||||
#else
|
||||
# define SB_GetLen(B) (B)->Len
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned SB_GetIndex (const StrBuf* B)
|
||||
static inline unsigned SB_GetIndex (const StrBuf* B)
|
||||
/* Return the user index of the string buffer */
|
||||
{
|
||||
return B->Index;
|
||||
}
|
||||
#else
|
||||
# define SB_GetIndex(B) (B)->Index
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void SB_SetIndex (StrBuf* B, unsigned Index)
|
||||
static inline void SB_SetIndex (StrBuf* B, unsigned Index)
|
||||
/* Set the user index of the string buffer */
|
||||
{
|
||||
B->Index = Index;
|
||||
}
|
||||
#else
|
||||
# define SB_SetIndex(B, Idx) ((B)->Index = (Idx))
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE const char* SB_GetConstBuf (const StrBuf* B)
|
||||
static inline const char* SB_GetConstBuf (const StrBuf* B)
|
||||
/* Return a buffer pointer */
|
||||
{
|
||||
return B->Buf;
|
||||
}
|
||||
#else
|
||||
# define SB_GetConstBuf(B) (B)->Buf
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE char* SB_GetBuf (StrBuf* B)
|
||||
static inline char* SB_GetBuf (StrBuf* B)
|
||||
/* Return a buffer pointer */
|
||||
{
|
||||
return B->Buf;
|
||||
}
|
||||
#else
|
||||
# define SB_GetBuf(B) (B)->Buf
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE char* SB_GetCooked (StrBuf* B)
|
||||
static inline char* SB_GetCooked (StrBuf* B)
|
||||
/* Return a cooked pointer */
|
||||
{
|
||||
return B->Cooked;
|
||||
}
|
||||
#else
|
||||
# define SB_GetCooked(B) (B)->Cooked
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE char SB_At (const StrBuf* B, unsigned Index)
|
||||
static inline char SB_At (const StrBuf* B, unsigned Index)
|
||||
/* Get a character from the buffer */
|
||||
{
|
||||
PRECONDITION (Index < B->Len);
|
||||
return B->Buf[Index];
|
||||
}
|
||||
#else
|
||||
char SB_At (const StrBuf* B, unsigned Index);
|
||||
/* Get a character from the buffer */
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE char SB_AtUnchecked (const StrBuf* B, unsigned Index)
|
||||
static inline char SB_AtUnchecked (const StrBuf* B, unsigned Index)
|
||||
/* Get a character from the buffer */
|
||||
{
|
||||
return B->Buf[Index];
|
||||
}
|
||||
#else
|
||||
# define SB_AtUnchecked(B, Index) ((B)->Buf[Index])
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int SB_IsEmpty (const StrBuf* B)
|
||||
static inline int SB_IsEmpty (const StrBuf* B)
|
||||
/* Return true if the string buffer is empty */
|
||||
{
|
||||
return (B->Len == 0);
|
||||
}
|
||||
#else
|
||||
# define SB_IsEmpty(B) ((B)->Len == 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int SB_NotEmpty (const StrBuf* B)
|
||||
static inline int SB_NotEmpty (const StrBuf* B)
|
||||
/* Return true if the string buffer is not empty */
|
||||
{
|
||||
return (B->Len > 0);
|
||||
}
|
||||
#else
|
||||
# define SB_NotEmpty(B) ((B)->Len > 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void SB_Clear (StrBuf* B)
|
||||
static inline void SB_Clear (StrBuf* B)
|
||||
/* Clear the string buffer (make it empty) */
|
||||
{
|
||||
B->Len = B->Index = 0;
|
||||
}
|
||||
#else
|
||||
# define SB_Clear(B) ((B)->Len = (B)->Index = 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void SB_Reset (StrBuf* B)
|
||||
static inline void SB_Reset (StrBuf* B)
|
||||
/* Reset the string buffer index to zero */
|
||||
{
|
||||
B->Index = 0;
|
||||
}
|
||||
#else
|
||||
# define SB_Reset(B) ((B)->Index = 0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE char SB_Get (StrBuf* B)
|
||||
static inline char SB_Get (StrBuf* B)
|
||||
/* Return the next character from the string incrementing Index. Returns NUL
|
||||
** if the end of the string is reached.
|
||||
*/
|
||||
{
|
||||
return (B->Index < B->Len)? B->Buf[B->Index++] : '\0';
|
||||
}
|
||||
#else
|
||||
# define SB_Get(B) (((B)->Index < (B)->Len)? (B)->Buf[(B)->Index++] : '\0')
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE char SB_Peek (const StrBuf* B)
|
||||
static inline char SB_Peek (const StrBuf* B)
|
||||
/* Look at the next character from the string without incrementing Index.
|
||||
** Returns NUL if the end of the string is reached.
|
||||
*/
|
||||
{
|
||||
return (B->Index < B->Len)? B->Buf[B->Index] : '\0';
|
||||
}
|
||||
#else
|
||||
# define SB_Peek(B) (((B)->Index < (B)->Len)? (B)->Buf[(B)->Index] : '\0')
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE char SB_LookAt (const StrBuf* B, unsigned Index)
|
||||
static inline char SB_LookAt (const StrBuf* B, unsigned Index)
|
||||
/* Look at a specific character from the string. Returns NUL if the given
|
||||
** index is greater than the size of the string.
|
||||
*/
|
||||
{
|
||||
return (Index < B->Len)? B->Buf[Index] : '\0';
|
||||
}
|
||||
#else
|
||||
# define SB_LookAt(B,Index) (((Index) < (B)->Len)? (B)->Buf[(Index)] : '\0')
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE char SB_LookAtLast (const StrBuf* B)
|
||||
static inline char SB_LookAtLast (const StrBuf* B)
|
||||
/* Look at the last character from the string. Returns NUL if the string buffer
|
||||
** is empty.
|
||||
*/
|
||||
{
|
||||
return (B->Len > 0)? B->Buf[B->Len-1] : '\0';
|
||||
}
|
||||
#else
|
||||
# define SB_LookAtLast(B) (((B)->Len > 0)? (B)->Buf[(B)->Len-1] : '\0')
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void SB_Skip (StrBuf* B)
|
||||
static inline void SB_Skip (StrBuf* B)
|
||||
/* Skip the next character in the string buffer if this is possible. */
|
||||
{
|
||||
if (B->Index < B->Len) {
|
||||
++B->Index;
|
||||
}
|
||||
}
|
||||
#else
|
||||
# define SB_Skip(B) do { if ((B)->Index < (B)->Len) ++(B)->Index; } while (0)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void SB_SkipMultiple (StrBuf* B, unsigned Count)
|
||||
static inline void SB_SkipMultiple (StrBuf* B, unsigned Count)
|
||||
/* Skip a number of characters in the string buffer if this is possible. */
|
||||
{
|
||||
if ((B->Index += Count) > B->Len) {
|
||||
B->Index = B->Len;
|
||||
}
|
||||
}
|
||||
#else
|
||||
# define SB_SkipMultiple(B, Count) \
|
||||
do { if (((B)->Index += (Count)) > (B)->Len) (B)->Index = (B)->Len; } while (0)
|
||||
#endif
|
||||
|
||||
void SB_Drop (StrBuf* B, unsigned Count);
|
||||
/* Drop characters from the end of the string. */
|
||||
@@ -330,28 +251,18 @@ void SB_CopyBuf (StrBuf* Target, const char* Buf, unsigned Size);
|
||||
void SB_CopyBufCooked (StrBuf* Target, const char* Buf, const char *Cooked, unsigned Size);
|
||||
/* Copy Buf and Cooked to Target, discarding the old contents of Target */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void SB_CopyStr (StrBuf* Target, const char* S)
|
||||
static inline void SB_CopyStr (StrBuf* Target, const char* S)
|
||||
/* Copy S to Target, discarding the old contents of Target */
|
||||
{
|
||||
SB_CopyBuf (Target, S, strlen (S));
|
||||
SB_CopyBuf (Target, S, (unsigned)strlen (S));
|
||||
}
|
||||
#else
|
||||
void SB_CopyStr (StrBuf* Target, const char* S);
|
||||
/* Copy S to Target, discarding the old contents of Target */
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void SB_Copy (StrBuf* Target, const StrBuf* Source)
|
||||
static inline void SB_Copy (StrBuf* Target, const StrBuf* Source)
|
||||
/* Copy Source to Target, discarding the old contents of Target */
|
||||
{
|
||||
SB_CopyBufCooked (Target, Source->Buf, Source->Cooked, Source->Len);
|
||||
Target->Index = Source->Index;
|
||||
}
|
||||
#else
|
||||
void SB_Copy (StrBuf* Target, const StrBuf* Source);
|
||||
/* Copy Source to Target, discarding the old contents of Target */
|
||||
#endif
|
||||
|
||||
void SB_AppendChar (StrBuf* B, int C);
|
||||
/* Append a character to a string buffer */
|
||||
@@ -362,19 +273,13 @@ void SB_AppendCharCooked (StrBuf* B, int C, int Cooked);
|
||||
void SB_AppendBuf (StrBuf* B, const char* S, unsigned Size);
|
||||
/* Append a character buffer to the end of the string buffer */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void SB_AppendStr (StrBuf* B, const char* S)
|
||||
static inline void SB_AppendStr (StrBuf* B, const char* S)
|
||||
/* Append a string to the end of the string buffer */
|
||||
{
|
||||
SB_AppendBuf (B, S, strlen (S));
|
||||
SB_AppendBuf (B, S, (unsigned)strlen (S));
|
||||
}
|
||||
#else
|
||||
void SB_AppendStr (StrBuf* B, const char* S);
|
||||
/* Append a string to the end of the string buffer */
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void SB_Append (StrBuf* Target, const StrBuf* Source)
|
||||
static inline void SB_Append (StrBuf* Target, const StrBuf* Source)
|
||||
/* Append the contents of Source to Target */
|
||||
{
|
||||
unsigned NewLen = Target->Len + Source->Len;
|
||||
@@ -385,13 +290,8 @@ INLINE void SB_Append (StrBuf* Target, const StrBuf* Source)
|
||||
memcpy (Target->Cooked + Target->Len, Source->Cooked, Source->Len);
|
||||
Target->Len = NewLen;
|
||||
}
|
||||
#else
|
||||
void SB_Append (StrBuf* Target, const StrBuf* Source);
|
||||
/* Append the contents of Source to Target */
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE void SB_Cut (StrBuf* B, unsigned Len)
|
||||
static inline void SB_Cut (StrBuf* B, unsigned Len)
|
||||
/* Cut the contents of B at the given length. If the current length of the
|
||||
** buffer is smaller than Len, nothing will happen.
|
||||
*/
|
||||
@@ -400,12 +300,6 @@ INLINE void SB_Cut (StrBuf* B, unsigned Len)
|
||||
B->Len = Len;
|
||||
}
|
||||
}
|
||||
#else
|
||||
void SB_Cut (StrBuf* B, unsigned Len);
|
||||
/* Cut the contents of B at the given length. If the current length of the
|
||||
** buffer is smaller than Len, nothing will happen.
|
||||
*/
|
||||
#endif
|
||||
|
||||
void SB_Slice (StrBuf* Target, const StrBuf* Source, unsigned Start, unsigned Len);
|
||||
/* Copy a slice from Source into Target. The current contents of Target are
|
||||
|
||||
@@ -38,10 +38,6 @@
|
||||
|
||||
|
||||
|
||||
#include "inline.h"
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
@@ -65,25 +61,17 @@ struct StrStack {
|
||||
|
||||
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int SS_IsFull (const StrStack* S)
|
||||
static inline int SS_IsFull (const StrStack* S)
|
||||
/* Return true if there is no space left on the given string stack */
|
||||
{
|
||||
return (S->Count >= sizeof (S->Stack) / sizeof (S->Stack[0]));
|
||||
}
|
||||
#else
|
||||
# define SS_IsFull(S) ((S)->Count >= sizeof ((S)->Stack) / sizeof ((S)->Stack[0]))
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned SS_GetCount (const StrStack* S)
|
||||
static inline unsigned SS_GetCount (const StrStack* S)
|
||||
/* Return the number of elements on the given string stack */
|
||||
{
|
||||
return S->Count;
|
||||
}
|
||||
#else
|
||||
# define SS_GetCount(S) (S)->Count
|
||||
#endif
|
||||
|
||||
const char* SS_Get (const StrStack* S);
|
||||
/* Get the value on top of a string stack */
|
||||
|
||||
@@ -87,25 +87,17 @@ struct Fragment {
|
||||
Fragment* NewFragment (unsigned char Type, unsigned Size, struct Section* S);
|
||||
/* Create a new fragment and insert it into the section S */
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE const char* GetFragmentSourceName (const Fragment* F)
|
||||
static inline const char* GetFragmentSourceName (const Fragment* F)
|
||||
/* Return the name of the source file for this fragment */
|
||||
{
|
||||
return GetSourceNameFromList (&F->LineInfos);
|
||||
}
|
||||
#else
|
||||
# define GetFragmentSourceName(F) GetSourceNameFromList (&(F)->LineInfos)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned GetFragmentSourceLine (const Fragment* F)
|
||||
static inline unsigned GetFragmentSourceLine (const Fragment* F)
|
||||
/* Return the source file line for this fragment */
|
||||
{
|
||||
return GetSourceLineFromList (&F->LineInfos);
|
||||
}
|
||||
#else
|
||||
# define GetFragmentSourceLine(F) GetSourceLineFromList (&(F)->LineInfos)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -110,69 +110,43 @@ const LineInfo* GetAsmLineInfo (const Collection* LineInfos);
|
||||
** and return it. Return NULL if no such line info was found.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE const FilePos* GetSourcePos (const LineInfo* LI)
|
||||
static inline const FilePos* GetSourcePos (const LineInfo* LI)
|
||||
/* Return the source file position from the given line info */
|
||||
{
|
||||
return &LI->Pos;
|
||||
}
|
||||
#else
|
||||
# define GetSourcePos(LI) (&(LI)->Pos)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE const char* GetSourceName (const LineInfo* LI)
|
||||
static inline const char* GetSourceName (const LineInfo* LI)
|
||||
/* Return the name of a source file from the given line info */
|
||||
{
|
||||
return GetString (LI->Pos.Name);
|
||||
}
|
||||
#else
|
||||
# define GetSourceName(LI) (GetString ((LI)->Pos.Name))
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned GetSourceLine (const LineInfo* LI)
|
||||
static inline unsigned GetSourceLine (const LineInfo* LI)
|
||||
/* Return the source file line from the given line info */
|
||||
{
|
||||
return LI->Pos.Line;
|
||||
}
|
||||
#else
|
||||
# define GetSourceLine(LI) ((LI)->Pos.Line)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned GetSourceCol (const LineInfo* LI)
|
||||
static inline unsigned GetSourceCol (const LineInfo* LI)
|
||||
/* Return the source file column from the given line info */
|
||||
{
|
||||
return LI->Pos.Col;
|
||||
}
|
||||
#else
|
||||
# define GetSourceCol(LI) ((LI)->Pos.Col)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE const char* GetSourceNameFromList (const Collection* LineInfos)
|
||||
static inline const char* GetSourceNameFromList (const Collection* LineInfos)
|
||||
/* Return the name of a source file from a list of line infos */
|
||||
{
|
||||
/* The relevant entry is in slot zero */
|
||||
return GetSourceName (CollConstAt (LineInfos, 0));
|
||||
}
|
||||
#else
|
||||
# define GetSourceNameFromList(LineInfos) \
|
||||
GetSourceName ((const LineInfo*) CollConstAt ((LineInfos), 0))
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned GetSourceLineFromList (const Collection* LineInfos)
|
||||
static inline unsigned GetSourceLineFromList (const Collection* LineInfos)
|
||||
/* Return the source file line from a list of line infos */
|
||||
{
|
||||
/* The relevant entry is in slot zero */
|
||||
return GetSourceLine (CollConstAt (LineInfos, 0));
|
||||
}
|
||||
#else
|
||||
# define GetSourceLineFromList(LineInfos) \
|
||||
GetSourceLine ((const LineInfo*) CollConstAt ((LineInfos), 0))
|
||||
#endif
|
||||
|
||||
unsigned LineInfoCount (void);
|
||||
/* Return the total number of line infos */
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
|
||||
/* common */
|
||||
#include "coll.h"
|
||||
#include "inline.h"
|
||||
#include "objdefs.h"
|
||||
|
||||
|
||||
@@ -136,15 +135,11 @@ const char* GetObjFileName (const ObjData* O);
|
||||
** file is NULL.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE int ObjHasFiles (const ObjData* O)
|
||||
static inline int ObjHasFiles (const ObjData* O)
|
||||
/* Return true if the files list does exist */
|
||||
{
|
||||
return (O != 0 && CollCount (&O->Files) != 0);
|
||||
}
|
||||
#else
|
||||
# define ObjHasFiles(O) ((O) != 0 && CollCount (&(O)->Files) != 0)
|
||||
#endif
|
||||
|
||||
const struct StrBuf* GetObjString (const ObjData* Obj, unsigned Id);
|
||||
/* Get a string from an object file checking for an invalid index */
|
||||
|
||||
@@ -63,45 +63,29 @@ extern StringPool* StrPool;
|
||||
|
||||
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned GetStrBufId (const StrBuf* S)
|
||||
static inline unsigned GetStrBufId (const StrBuf* S)
|
||||
/* Return the id of the given string buffer */
|
||||
{
|
||||
return SP_Add (StrPool, S);
|
||||
}
|
||||
#else
|
||||
# define GetStrBufId(S) SP_Add (StrPool, (S))
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned GetStringId (const char* S)
|
||||
static inline unsigned GetStringId (const char* S)
|
||||
/* Return the id of the given string */
|
||||
{
|
||||
return SP_AddStr (StrPool, S);
|
||||
}
|
||||
#else
|
||||
# define GetStringId(S) SP_AddStr (StrPool, (S))
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE const StrBuf* GetStrBuf (unsigned Index)
|
||||
static inline const StrBuf* GetStrBuf (unsigned Index)
|
||||
/* Convert a string index into a string */
|
||||
{
|
||||
return SP_Get (StrPool, Index);
|
||||
}
|
||||
#else
|
||||
# define GetStrBuf(Index) SP_Get (StrPool, (Index))
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE const char* GetString (unsigned Index)
|
||||
static inline const char* GetString (unsigned Index)
|
||||
/* Convert a string index into a string */
|
||||
{
|
||||
return SB_GetConstBuf (SP_Get (StrPool, Index));
|
||||
}
|
||||
#else
|
||||
# define GetString(Index) SB_GetConstBuf (SP_Get (StrPool, (Index)))
|
||||
#endif
|
||||
|
||||
void InitStrPool (void);
|
||||
/* Initialize the string pool */
|
||||
|
||||
@@ -65,35 +65,23 @@ extern StringPool* TypePool;
|
||||
|
||||
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned GetTypeId (const StrBuf* Type)
|
||||
static inline unsigned GetTypeId (const StrBuf* Type)
|
||||
/* Return the id of the given generic type */
|
||||
{
|
||||
return SP_Add (TypePool, Type);
|
||||
}
|
||||
#else
|
||||
# define GetTypeId(Type) SP_Add (TypePool, (Type))
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE const StrBuf* GetType (unsigned Index)
|
||||
static inline const StrBuf* GetType (unsigned Index)
|
||||
/* Convert a type index into a type string */
|
||||
{
|
||||
return SP_Get (TypePool, Index);
|
||||
}
|
||||
#else
|
||||
# define GetType(Index) SP_Get (TypePool, (Index))
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INLINE)
|
||||
INLINE unsigned TypeCount (void)
|
||||
static inline unsigned TypeCount (void)
|
||||
/* Return the number of types in the pool */
|
||||
{
|
||||
return SP_GetCount (TypePool);
|
||||
}
|
||||
#else
|
||||
# define TypeCount() SP_GetCount (TypePool)
|
||||
#endif
|
||||
|
||||
void PrintDbgTypes (FILE* F);
|
||||
/* Output the types to a debug info file */
|
||||
|
||||
Reference in New Issue
Block a user