Commit ced2fee8 authored by kollo's avatar kollo

corrected usage of long integer type --> uint32_t

parent ea551924
......@@ -9,6 +9,7 @@
*/
#include <stdlib.h>
#include <stdint.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
......@@ -1014,10 +1015,10 @@ short rsrc_load(const char *filename) {
rsrc=malloc(len);
int i,a;
if((a=fread(rsrc,1,len,dptr))==len) {
WSWAP((char *)((long)rsrc));
WSWAP((char *)rsrc);
if(rsrc->rsh_vrsn==0 || rsrc->rsh_vrsn==1) {
// if(rsrc->rsh_vrsn==0) {
for(i=1;i<HDR_LENGTH/2;i++) {WSWAP((char *)((long)rsrc+2*i));}
for(i=1;i<HDR_LENGTH/2;i++) {WSWAP((char *)((char *)rsrc+2*i));}
// }
#if DEBUG
printf("RSC loaded: name=<%s> len=%d Bytes\n",filename,len);
......
......@@ -13,19 +13,18 @@
//#define GEMFONTSMALL "-*-fixed-*-r-normal-*-8-*-ISO10646-1"
#define GEMFONTSMALL "*5x8*"
#define WORD short
#define WORD int16_t
#define UWORD uint16_t
#define LONG uint32_t
#ifdef _LP64
#define LONG unsigned int
#define TEDINFO_P LONG
#define BITBLK_P LONG
#define ICONBLK_P LONG
#define USRBLK_P LONG
#define OBSPEK_P LONG
#define CHAR_P LONG
#else
#define LONG unsigned long
#define TEDINFO_P TEDINFO *
#define BITBLK_P BITBLK *
#define ICONBLK_P BITBLK *
......@@ -76,14 +75,13 @@
#define WHITEBAK 0x40
#define DRAW3D 0x80
#undef BLACK
#undef WHITE
#undef RED
#undef GREEN
#undef BLUE
#undef YELLOW
#undef MAGENTA
#undef BLACK
#undef WHITE
#undef RED
#undef GREEN
#undef BLUE
#undef YELLOW
#undef MAGENTA
/* Object colors */
#define WHITE 0
#define BLACK 1
......@@ -205,9 +203,9 @@ OBJECT {
WORD ob_next; /* -> object's next sibling */
WORD ob_head; /* -> head of object's children */
WORD ob_tail; /* -> tail of object's children */
unsigned WORD ob_type; /* type of object- BOX, CHAR,...*/
unsigned WORD ob_flags; /* flags */
unsigned WORD ob_state; /* state- SELECTED, OPEN, ... */
UWORD ob_type; /* type of object- BOX, CHAR,...*/
UWORD ob_flags; /* flags */
UWORD ob_state; /* state- SELECTED, OPEN, ... */
OBSPEC ob_spec; /* "out"- -> anything else */
WORD ob_x; /* upper left corner of object */
WORD ob_y; /* upper left corner of object */
......
......@@ -8,6 +8,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <math.h>
......
......@@ -8,6 +8,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <math.h>
#include "defs.h"
......
......@@ -9,6 +9,7 @@
*/
#include <stdlib.h>
#include <stdint.h>
#include <stddef.h>
#include <stdio.h>
#include <dirent.h>
......
......@@ -10,6 +10,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <errno.h>
#include <string.h>
#include <ctype.h>
......
......@@ -14,14 +14,14 @@ typedef struct {
unsigned char BRAs; /* DC_BRAs */
unsigned char offs; /* sizeof(BYTECODE_HEADER)-2*/
unsigned short rsv; /* not used */
unsigned long textseglen; /* size of the text/code segment */
unsigned long rodataseglen; /* size of the readonly data segment */
unsigned long sdataseglen; /* size of the data segment for DATA statements*/
unsigned long dataseglen; /* size of the data segment */
unsigned long bssseglen; /* storage space for variables */
unsigned long symbolseglen; /* size of the symbol table segment */
unsigned long stringseglen; /* size of the string segment */
unsigned long relseglen; /* size of the relocation data */
uint32_t textseglen; /* size of the text/code segment */
uint32_t rodataseglen; /* size of the readonly data segment */
uint32_t sdataseglen; /* size of the data segment for DATA statements*/
uint32_t dataseglen; /* size of the data segment */
uint32_t bssseglen; /* storage space for variables */
uint32_t symbolseglen; /* size of the symbol table segment */
uint32_t stringseglen; /* size of the string segment */
uint32_t relseglen; /* size of the relocation data */
unsigned short flags; /* not used */
unsigned short version; /* version, currently=0x117 */
} BYTECODE_HEADER;
......@@ -33,8 +33,8 @@ typedef struct {
unsigned char typ; /* Typ of the symbol */
unsigned char subtyp;
unsigned short rsv; /* not used */
unsigned long name; /* Pointer to Symbol string table */
unsigned long adr; /* address */
uint32_t name; /* Pointer to Symbol string table */
uint32_t adr; /* address */
} BYTECODE_SYMBOL;
/* Symbol types */
......
......@@ -10,6 +10,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include "defs.h"
......@@ -50,9 +51,8 @@ void add_history(const char *line) {
for(i=0;i<MAX_HISTORY;i++) history[i]=NULL;
historyp=0;
}
if(historyp<MAX_HISTORY) {
history[historyp++]=strdup(line);
} else {
if(historyp<MAX_HISTORY) history[historyp++]=strdup(line);
else {
free(history[0]);
for(i=0;i<MAX_HISTORY-1;i++) history[i]=history[i+1];
history[historyp-1]=strdup(line);
......
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "config.h"
#include "defs.h"
#ifdef HAVE_RFFTW
#include <rfftw.h>
#include "defs.h"
#include "x11basic.h"
#include "mathematics.h"
#include "fft.h"
......
......@@ -8,6 +8,7 @@
#define _GNU_SOURCE
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
......@@ -730,7 +731,7 @@ static int f_swap(int a) {return(((a&0xffff)<<16)|((a&0xffff0000)>>16));}
static double f_cvd(STRING n) {return((double)(*((double *)n.pointer))); }
static double f_cvf(STRING n) {return((double)(*((float *)n.pointer))); }
static int f_cvi(STRING n) {return((int)(*((short *)n.pointer))); }
static int f_cvl(STRING n) {return((int)(*((long *)n.pointer))); }
static int f_cvl(STRING n) {return((int)(*((int32_t *)n.pointer))); }
static double f_deg(double d) {return(d/PI*180);}
static int f_device(STRING n) {return(stat_device(n.pointer)); }
static int f_dpeek(int adr) {return((int)(*(short *)INT2POINTER(adr)));}
......@@ -742,7 +743,7 @@ static double f_frac(double b) {return(b-((double)((int)b)));}
//static double f_real(COMPLEX b) {return(b.r);}
static int f_inode(STRING n) {return(stat_inode(n.pointer)); }
static int f_len(STRING n) {return(n.len); }
static int f_lpeek(int adr) {return((int)(*(long *)INT2POINTER(adr)));}
static int f_lpeek(int adr) {return((int)(*(int32_t *)INT2POINTER(adr)));}
static double f_ltextlen(STRING n) {return((double)ltextlen(ltextxfaktor,ltextpflg,n.pointer)); }
static int f_malloc(int size) {return(POINTER2INT(malloc((size_t)size)));}
static int f_mshrink(int adr,int size) {return(0);} /*always return zero*/
......@@ -1051,7 +1052,7 @@ static int f_julian(STRING n) { /* Julianischer Tag aus time$ */
char buf[n.len+1],buf2[n.len+1];
int e;
int day,mon,jahr;
long jul;
int32_t jul;
int ja,jy,jm;
memcpy(buf,n.pointer,n.len);
......@@ -1067,7 +1068,7 @@ static int f_julian(STRING n) { /* Julianischer Tag aus time$ */
if(jy<0) ++jy;
if(mon>2) jm=mon+1;
else { --jy; jm=mon+13; }
jul=(long)(floor(365.25*jy)+floor(30.6001*jm)+day+1720995);
jul=(int32_t)(floor(365.25*jy)+floor(30.6001*jm)+day+1720995);
if(day+31L*(mon+12L*jahr)>=IGREG) {
ja=(int)(0.01*jy);
jul+=2-ja+(int)(0.25*ja);
......
......@@ -13,6 +13,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#if defined(__CYGWIN__) || defined(__MINGW32__)
#include <windows.h>
......
......@@ -9,6 +9,7 @@
*/
#include <stdlib.h>
#include <stdint.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
......@@ -399,7 +400,7 @@ Status my_XAllocColor(Display *display,Colormap map,XColor *pixcolor) {
Status rval;
if((rval=XAllocColor(display, map, pixcolor))==0) {
int i,r,g,b;
unsigned long e=0xfffffff,d;
uint32_t e=0xfffffff,d;
XColor savecolor;
XColor ppixcolor[256];
for(i=0;i<256;i++) ppixcolor[i].pixel=i;
......
......@@ -10,6 +10,7 @@
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#if defined(__CYGWIN__) || defined(__MINGW32__)
#include <windows.h>
#endif
......@@ -1785,7 +1786,7 @@ int inp32(PARAMETER *plist,int e) {
unsigned int ergebnis;
FILEINFO fff=get_fileptr(plist->integer);
if(fff.typ==0) {xberror(24,"");return(-1);} /* File nicht geoeffnet */
if(fread(&ergebnis,sizeof(long),1,fff.dptr)<1) io_error(errno,"fread");
if(fread(&ergebnis,sizeof(unsigned int),1,fff.dptr)<1) io_error(errno,"fread");
return(ergebnis);
}
......
......@@ -9,6 +9,7 @@
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "defs.h"
#ifdef HAVE_ERRNO_H
......
......@@ -10,6 +10,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
......@@ -2520,8 +2521,8 @@ static void c_dpoke(PARAMETER *plist,int e) {
*adr=(short)plist[1].integer;
}
static void c_lpoke(PARAMETER *plist,int e) {
long *adr=(long *)INT2POINTER(plist->integer);
*adr=(long)plist[1].integer;
uint32_t *adr=(uint32_t *)INT2POINTER(plist->integer);
*adr=(uint32_t)plist[1].integer;
}
/* SOUND channel,frequency [Hz],volume (0-1),duration (s)*/
......
......@@ -6,6 +6,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include "defs.h"
......
......@@ -11,6 +11,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
......@@ -33,7 +34,6 @@
#include "android.h"
#endif
#include "config.h"
#include "defs.h"
#include "x11basic.h"
#include "wort_sep.h"
......
......@@ -11,10 +11,11 @@
#include <string.h>
#include <math.h>
#include "defs.h"
#include "x11basic.h"
#include "mathematics.h"
#include "fft.h"
#define min(a,b) ((a<b)?a:b)
#define max(a,b) ((a>b)?a:b)
/*Gibt 1 zurueck wenn sich der Punkt (x,y) innerhalb des
Polygonzugs befindet*/
......
......@@ -8,10 +8,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <math.h>
#include "config.h"
#include "defs.h"
#include "options.h"
#include "x11basic.h"
......
......@@ -8,6 +8,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <math.h>
#include "defs.h"
......
......@@ -8,6 +8,7 @@
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
......
......@@ -11,6 +11,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
......
......@@ -9,6 +9,7 @@
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <math.h>
#include <unistd.h>
......@@ -789,10 +790,10 @@ static STRING f_mkis(int n) {
}
static STRING f_mkls(int n) {
STRING ergebnis;
ergebnis.pointer=malloc(sizeof(long)+1);
ergebnis.len=sizeof(long);
*((long *)ergebnis.pointer)=(long)n;
*(ergebnis.pointer+sizeof(long))=0;
ergebnis.pointer=malloc(4+1);
ergebnis.len=4;
*((uint32_t *)ergebnis.pointer)=(uint32_t)n;
*(ergebnis.pointer+4)=0;
return(ergebnis);
}
static STRING f_mkfs(double n) {
......
......@@ -12,6 +12,7 @@
*/
#include <stdlib.h>
#include <stdint.h>
#include <stddef.h>
#include <stdio.h>
#include <unistd.h>
......
......@@ -10,9 +10,9 @@
#include <SDL/SDL.h>
#include <SDL/SDL_audio.h>
#else
#define Uint32 unsigned long
#define Uint16 unsigned short
#define Uint8 unsigned char
#define Uint32 uint32_t
#define Uint16 uint16_t
#define Uint8 uint8_t
#endif
......
......@@ -8,6 +8,7 @@
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <math.h>
#include <errno.h>
......
......@@ -8,9 +8,10 @@
* COPYING for details
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "defs.h"
#include "x11basic.h"
......
......@@ -6,6 +6,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include "defs.h"
......
......@@ -6,6 +6,7 @@
* COPYING for details
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
......
......@@ -8,6 +8,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <math.h>
#include "defs.h"
......
......@@ -8,6 +8,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdarg.h>
#include <math.h>
#include <string.h>
......
......@@ -9,6 +9,7 @@
*/
#include <stdlib.h>
#include <stdint.h>
#include <stddef.h>
#include <stdio.h>
#include <dirent.h>
......@@ -341,14 +342,14 @@ static int create_window2(int nummer,const char *title, const char* info,int x,i
}
/* Welchen Bildschirm nehmen ? */
int screen_num = DefaultScreen(window[nummer].display);/* Ein Server kann mehrere Bildschirme haben */
unsigned long border=0;
unsigned int border=0;
/* Fenster Oeffnen */
window[nummer].bcolor=BlackPixel(window[nummer].display, DefaultScreen(window[nummer].display));
window[nummer].fcolor=WhitePixel(window[nummer].display, screen_num);
window[nummer].win = XCreateSimpleWindow(window[nummer].display, RootWindow(window[nummer].display, screen_num),
x, y, w, h, border, window[nummer].fcolor, window[nummer].bcolor);
// printf("border=%d\n",border);
XGetGeometry(window[nummer].display,window[nummer].win,&root,&(window[nummer].x),&(window[nummer].y),
&(window[nummer].w),&(window[nummer].h),
&(window[nummer].b),&(window[nummer].d));
......@@ -772,9 +773,8 @@ void put_bitmap(const char *adr,int x,int y,unsigned int w, unsigned int h) {
// memdump((char *)(data->format),sizeof(SDL_PixelFormat));
// memdump((char *)(data->format->palette),sizeof(SDL_Palette));
// memdump((char *)(data->format->palette->colors),2*sizeof(SDL_Color));
unsigned char *pal;
pal=(unsigned char *)(data->format->palette->colors);
unsigned long col=window[usewindow].bcolor;
unsigned char *pal=(unsigned char *)(data->format->palette->colors);
uint32_t col=window[usewindow].bcolor;
col>>=8;
pal[2]=(col&0xff); col>>=8;
pal[1]=(col&0xff); col>>=8;
......
......@@ -147,7 +147,7 @@ typedef COMPLEX (*cfunc)();
typedef PARAMETER (*ppfunc)();
typedef struct {
unsigned long opcode;
uint32_t opcode;
const char *name;
void (*routine)();
signed char pmin; /* Mindestanzahl an Parametern */
......@@ -156,7 +156,7 @@ typedef struct {
} COMMAND;
typedef struct {
unsigned long opcode;
uint32_t opcode;
const char *name;
double (*routine)();
signed char pmin; /* Mindestanzahl an Parametern */
......@@ -165,7 +165,7 @@ typedef struct {
} FUNCTION;
typedef struct {
unsigned long opcode;
uint32_t opcode;
const char *name;
COMPLEX (*routine)();
signed char pmin; /* Mindestanzahl an Parametern */
......@@ -174,7 +174,7 @@ typedef struct {
} CFUNCTION;
typedef struct {
unsigned long opcode;
uint32_t opcode;
const char *name;
STRING (*routine)();
signed char pmin; /* Mindestanzahl an Parametern */
......
......@@ -10,6 +10,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <errno.h>
#include <ctype.h>
#include <string.h>
......
......@@ -34,6 +34,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#if defined(__CYGWIN__) || defined(__MINGW32__)
#include <windows.h>
......@@ -49,6 +50,7 @@
#include "x11basic.h"
#include "variablen.h"
#include "xbasic.h"
#include "memory.h"
#include "type.h"
#include "parser.h"
#include "parameter.h"
......@@ -134,7 +136,7 @@ BYTECODE_SYMBOL *symtab;
static void do_relocation(char *adr,unsigned char *fixup, int l) {
int i=0;
long ll;
uint32_t ll;
// printf("Relocation table:\n");
// memdump(fixup,l);
while(i<l) {
......@@ -142,15 +144,15 @@ static void do_relocation(char *adr,unsigned char *fixup, int l) {
else if(fixup[i]==1) adr+=254;
else {
adr+=fixup[i];
memcpy(&ll,adr,sizeof(long));
memcpy(&ll,adr,sizeof(uint32_t));
#ifdef ATARI
LWSWAP((short *)&ll);
#endif
ll+=(long)adr;
ll+=POINTER2INT(adr);
#ifdef ATARI
LWSWAP((short *)&ll);
#endif
memcpy(adr,&ll,sizeof(long));
memcpy(adr,&ll,sizeof(uint32_t));
}
}
}
......
......@@ -10,6 +10,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
......
......@@ -10,6 +10,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#if defined(__CYGWIN__) || defined(__MINGW32__)
#include <windows.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment