int oursp = 0;
/* Current segment */
-static enum { SEG_CODE, SEG_RODATA, SEG_DATA, SEG_BSS } CurSeg = SEG_CODE;
+static enum {
+ SEG_INV = -1, /* Invalid segment */
+ SEG_CODE,
+ SEG_RODATA,
+ SEG_DATA,
+ SEG_BSS
+} CurSeg = SEG_CODE;
/* Segment names */
static char* SegmentNames [4];
-static void UseSeg (unsigned NewSeg)
+static void UseSeg (int NewSeg)
/* Switch to a specific segment */
{
if (CurSeg != NewSeg) {
-void SegName (unsigned Seg, const char* Name)
+static void SegName (int Seg, const char* Name)
/* Set the name of a segment */
{
/* Free the old name and set a new one */
* with the new name.
*/
if (Seg == CurSeg) {
- CurSeg = -1; /* Invalidate */
+ CurSeg = SEG_INV; /* Invalidate */
UseSeg (Seg);
}
}
void g_enter (unsigned flags, unsigned argsize)
-/* Function prologue */
+/* Function prologue */
{
if ((flags & CF_FIXARGC) != 0) {
/* Just remember the argument size for the leave */
} else {
/* Handle as 16 bit value */
- hi = val >> 8;
+ hi = (unsigned char) (val >> 8);
if (val <= 7) {
- AddCodeLine ("\tjsr\tpush%u", val);
+ AddCodeLine ("\tjsr\tpush%u", (unsigned) val);
} else if (hi == 0 || hi == 0xFF) {
/* Use special function */
ldaconst (val);
*/
{
const char* P;
- unsigned Count;
int Max;
char PathName [FILENAME_MAX];
/* Start the search */
while (*P) {
/* Copy the next path element into the buffer */
- Count = 0;
+ int Count = 0;
while (*P != '\0' && *P != ';' && Count < Max) {
PathName [Count++] = *P++;
}
/* Register variable management */
unsigned MaxRegSpace = 6; /* Maximum space available */
-static int RegOffs = 0; /* Offset into register space */
+static unsigned RegOffs = 0; /* Offset into register space */
static const SymEntry** RegSyms = 0; /* The register variables */
static unsigned RegSymCount = 0; /* Number of register variables */
* the accumulator must be saved across the restore.
*/
{
- int I, J, Bytes, Offs;
+ unsigned I, J;
+ int Bytes, Offs;
/* If we don't have register variables in this function, bail out early */
if (RegSymCount == 0) {
}
}
-
+
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
-#ifdef __WATCOMC__
+#if defined(__WATCOMC__) || defined(_MSC_VER)
# include <malloc.h>
#endif
constexpr (&val);
/* Store the value into the flag parameter */
- *Flag = val.e_const;
+ *Flag = (val.e_const != 0);
}
{
static const struct tok_elt Pragmas [] = {
{ "bssseg", PR_BSSSEG },
- { "codeseg", PR_CODESEG },
- { "dataseg", PR_DATASEG },
- { "regvaraddr", PR_REGVARADDR },
- { "rodataseg", PR_RODATASEG },
+ { "codeseg", PR_CODESEG },
+ { "dataseg", PR_DATASEG },
+ { "regvaraddr", PR_REGVARADDR },
+ { "rodataseg", PR_RODATASEG },
{ "signedchars", PR_SIGNEDCHARS },
{ "staticlocals", PR_STATICLOCALS },
{ "zpsym", PR_ZPSYM },
- { 0, PR_ILLEGAL },
+ { 0, PR_ILLEGAL },
};
int Pragma;