1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259
|
Author: Peter De Wachter <pdewacht@gmail.com>
Description: Fix some issues on 64-bit platforms
Last-Update: 2008
--- a/src/sdlBasic/src/sdlBasic/gtk/SciTEGTK.cxx
+++ b/src/sdlBasic/src/sdlBasic/gtk/SciTEGTK.cxx
@@ -2217,7 +2217,7 @@
}
void SciTEGTK::ButtonSignal(GtkWidget *, gpointer data) {
- instance->Command((guint)data);
+ instance->Command((long)data);
}
void SciTEGTK::MenuSignal(SciTEGTK *scitew, guint action, GtkWidget *) {
--- a/src/sdlBasic/src/sdlBasic/src/Exporters.cxx
+++ b/src/sdlBasic/src/sdlBasic/src/Exporters.cxx
@@ -941,7 +941,7 @@
// PDF1.4Ref(p38) EOL marker preceding endstream not counted
char *textObj = new char[pageData.length() + 100];
// concatenate stream within the text object
- sprintf(textObj, "<</Length %d>>\nstream\n%s"
+ sprintf(textObj, "<</Length %zd>>\nstream\n%s"
"ET\nendstream\n",
pageData.length() - 1 + 3,
pageData.c_str());
--- a/src/sdlBasic/src/sdlBrt/BASengine/file.c
+++ b/src/sdlBasic/src/sdlBrt/BASengine/file.c
@@ -82,7 +82,7 @@
ePrintf( Runtime, "fileOpen: unknown file mode" );
}
- if ((int)(fileHandles[handle-1] ) == EOF) {
+ if (!fileHandles[handle-1]) {
ePrintf( Runtime, "fileOpen: Error opening file #%d", handle );
}
}
--- a/src/sdlBasic/src/sdlBrt/error.c
+++ b/src/sdlBasic/src/sdlBrt/error.c
@@ -157,7 +157,7 @@
}
/* set values */
- link->start = (int)p;
+ link->start = (intptr_t)p;
link->end = link->start+(n-1);
link->next = lastMemLink;
lastMemLink = link;
@@ -176,7 +176,7 @@
prev = NULL;
for ( link = lastMemLink; link != NULL; link = link->next ) {
- if (link->start == (int)address) {
+ if (link->start == (intptr_t)address) {
if (prev == NULL) {
lastMemLink = link->next;
@@ -196,7 +196,7 @@
MemLink *link = lastMemLink;
for ( ; link != NULL; link = link->next ) {
- if ((int)p >= link->start && (int)p <= link->end) {
+ if ((intptr_t)p >= link->start && (intptr_t)p <= link->end) {
return link;
}
}
@@ -439,7 +439,7 @@
strncpy(indexvar,&binputvar[ba],a-ba);
indexvar[a-ba]='\0';
}
- printf("indexvar:%s - a:%d - ba:%d - i:%d -len:%d \n",indexvar,a,ba,i,strlen(binputvar));
+ printf("indexvar:%s - a:%d - ba:%d - i:%d -len:%zd \n",indexvar,a,ba,i,strlen(binputvar));
strcpy(stackstring[i],indexvar);
}
i++;
--- a/src/sdlBasic/src/sdlBrt/error.h
+++ b/src/sdlBasic/src/sdlBrt/error.h
@@ -6,13 +6,14 @@
The Practice of Programming
*/
+#include <stdint.h>
typedef struct MemLink MemLink;
struct MemLink {
- int start; /* start of allocated block */
- int end; /* end of allocated block */
+ intptr_t start; /* start of allocated block */
+ intptr_t end; /* end of allocated block */
MemLink *next; /* in list */
};
--- a/src/sdlBasic/src/sdlBrt/sdlBrt_tab.y
+++ b/src/sdlBasic/src/sdlBrt/sdlBrt_tab.y
@@ -438,7 +438,7 @@
{ if (currentScope == NULL) {
ePrintf( Syntax, "Shared illegal outside Sub or Function");
}
- pushStack(blockStack, (int)currentScope );
+ pushStack(blockStack, (intptr_t)currentScope );
currentScope = NULL; }
sharedList sep
{ currentScope = (Symbol *)popStack(blockStack);
@@ -824,7 +824,7 @@
{ if (currentScope == NULL) {
ePrintf( Syntax, "Shared illegal outside Sub or Function");
}
- pushStack(blockStack, (int)currentScope );
+ pushStack(blockStack, (intptr_t)currentScope );
currentScope = NULL; }
sharedList sep
{ currentScope = (Symbol *)popStack(blockStack);
@@ -1521,11 +1521,11 @@
{ if ($1->scope != NULL) {
ePrintf( Syntax, "Can't share local variable %s", $1->name );
- } else if (inStack(sharedStack,(int)$1)) {
+ } else if (inStack(sharedStack,(intptr_t)$1)) {
ePrintf( Syntax, "Variable %s is already shared", $1->name );
} else {
- pushStack( sharedStack, (int)$1 );
+ pushStack( sharedStack, (intptr_t)$1 );
} }
@@ -1534,11 +1534,11 @@
{ if ($1->scope != NULL) {
ePrintf( Syntax, "Can't share local array %s", $1->name );
- } else if (inStack(sharedStack,(int)$1)) {
+ } else if (inStack(sharedStack,(intptr_t)$1)) {
ePrintf( Syntax, "Array %s is already shared", $1->name );
} else {
- pushStack( sharedStack, (int)$1 );
+ pushStack( sharedStack, (intptr_t)$1 );
} }
--- a/src/sdlBasic/src/sdlBrt/stack.c
+++ b/src/sdlBasic/src/sdlBrt/stack.c
@@ -13,7 +13,7 @@
/* allocate stack */
stack = (Stack *)eMalloc( sizeof( Stack ) +
- (sizeof(int) * (size)) );
+ (sizeof(intptr_t) * (size)) );
stack->tos = -1;
stack->size = size;
@@ -21,7 +21,7 @@
}
/* push an item on the stack */
-void pushStack( Stack *stack, int value )
+void pushStack( Stack *stack, intptr_t value )
{
if (stack->tos == stack->size) {
ePrintf( Runtime, "pushStack: stack overflow");
@@ -31,13 +31,13 @@
}
/* incrStack: increment the value on the stack */
-void incrStack( Stack *stack, int value )
+void incrStack( Stack *stack, intptr_t value )
{
stack->data[stack->tos] += value;
}
/* decrStack: decrement the value on the stack */
-void decrStack( Stack *stack, int value )
+void decrStack( Stack *stack, intptr_t value )
{
stack->data[stack->tos] -= value;
}
@@ -46,7 +46,7 @@
/* swapStack: swap top two stack items */
void swapStack( Stack *stack )
{
- int tmp;
+ intptr_t tmp;
if (stack->tos < 1) {
ePrintf( Runtime, "swapStack: stack underflow");
@@ -71,7 +71,7 @@
/* return copy of top stack item */
-int peekStack( Stack *stack )
+intptr_t peekStack( Stack *stack )
{
if (stack->tos < 0) {
ePrintf( Runtime, "peekStack: underflow" );
@@ -81,7 +81,7 @@
/* pop an item off the stack */
-int popStack( Stack *stack )
+intptr_t popStack( Stack *stack )
{
if (stack->tos < 0) {
ePrintf( Runtime, "popStack: underflow" );
@@ -98,7 +98,7 @@
}
/* inStack: return true if item is in the stack */
-int inStack( Stack *stack, int val )
+int inStack( Stack *stack, intptr_t val )
{
int i;
for ( i = stack->tos; i > -1; i-- ) {
--- a/src/sdlBasic/src/sdlBrt/stack.h
+++ b/src/sdlBasic/src/sdlBrt/stack.h
@@ -6,21 +6,23 @@
Licence: LGPL
*/
+#include <stdint.h>
+
struct Stack {
- int tos; /* top of stack */
- int size; /* size of stack */
- int data[1]; /* stack data */
+ int tos; /* top of stack */
+ int size; /* size of stack */
+ intptr_t data[1]; /* stack data */
};
Stack *newStack( int size );
-void pushStack( Stack *stack, int value );
-void incrStack( Stack *stack, int value );
-void decrStack( Stack *stack, int value );
+void pushStack( Stack *stack, intptr_t value );
+void incrStack( Stack *stack, intptr_t value );
+void decrStack( Stack *stack, intptr_t value );
void swapStack( Stack *stack );
void dupStack( Stack *stack );
-int peekStack( Stack *stack );
-int popStack( Stack *stack );
+intptr_t peekStack( Stack *stack );
+intptr_t popStack( Stack *stack );
int isEmptyStack( Stack *stack );
-int inStack( Stack *stack, int val );
+int inStack( Stack *stack, intptr_t val );
void clearStack( Stack *stack );
void freeStack( Stack *stack );
--- a/src/sdlBasic/src/sdlBrt/symbol.c
+++ b/src/sdlBasic/src/sdlBrt/symbol.c
@@ -28,7 +28,7 @@
}
/* visible if not shared */
- if (inStack(sharedStack, (int)s )) {
+ if (inStack(sharedStack, (intptr_t)s )) {
return s;
}
}
|