try to make things work on 64 bit systems
patch 41656482809861d993607895eee0b410b4efda3d
Author: ben.franksen@online.de
Date: Wed Apr 6 20:59:29 CEST 2011
* try to make things work on 64 bit systems
hunk ./src/pv/pv.h 16
-#include "shareLib.h" /* reset share lib defines */
+#include "shareLib.h" /* reset share lib defines */
+#include "epicsTypes.h" /* for thread ids */
hunk ./src/pv/pv.h 64
-typedef char pvChar;
-typedef short pvShort;
-typedef long pvLong;
-typedef float pvFloat;
-typedef double pvDouble;
-typedef char pvString[256]; /* use sizeof( pvString ) */
+typedef epicsInt8 pvChar;
+typedef epicsInt16 pvShort;
+typedef epicsInt32 pvLong;
+typedef epicsFloat32 pvFloat;
+typedef epicsFloat64 pvDouble;
+typedef char pvString[256]; /* use sizeof( pvString ) */
hunk ./src/seq/seq_ca.c 215
- pVal = (void *)((long)pValue + pDB->dbOffset); /* ptr to data */
+ pVal = (void *)((char *)pValue + pDB->dbOffset); /* ptr to data */
hunk ./src/seq/seq_main.c 513
- sizeof (char), OFFSET(pvTimeChar, value[0])
+ sizeof (pvChar), OFFSET(pvTimeChar, value[0])
hunk ./src/seq/seq_main.c 518
- sizeof (short), OFFSET(pvTimeShort, value[0])
+ sizeof (pvShort), OFFSET(pvTimeShort, value[0])
hunk ./src/seq/seq_main.c 523
- sizeof (long), OFFSET(pvTimeLong, value[0])
+ sizeof (pvLong), OFFSET(pvTimeLong, value[0])
hunk ./src/seq/seq_main.c 528
- sizeof (long), OFFSET(pvTimeLong, value[0])
+ sizeof (pvLong), OFFSET(pvTimeLong, value[0])
hunk ./src/seq/seq_main.c 533
- sizeof (char), OFFSET(pvTimeChar, value[0])
+ sizeof (pvChar), OFFSET(pvTimeChar, value[0])
hunk ./src/seq/seq_main.c 538
- sizeof (short), OFFSET(pvTimeShort, value[0])
+ sizeof (pvShort), OFFSET(pvTimeShort, value[0])
hunk ./src/seq/seq_main.c 543
- sizeof (long), OFFSET(pvTimeLong, value[0])
+ sizeof (pvLong), OFFSET(pvTimeLong, value[0])
hunk ./src/seq/seq_main.c 548
- sizeof (long), OFFSET(pvTimeLong, value[0])
+ sizeof (pvLong), OFFSET(pvTimeLong, value[0])
hunk ./src/seq/seq_main.c 553
- sizeof (float), OFFSET(pvTimeFloat, value[0])
+ sizeof (pvFloat), OFFSET(pvTimeFloat, value[0])
hunk ./src/seq/seq_main.c 558
- sizeof (double), OFFSET(pvTimeDouble, value[0])
+ sizeof (pvDouble), OFFSET(pvTimeDouble, value[0])
hunk ./src/seq/seq_qry.c 399
- char *c;
- short *s;
- long *l;
- float *f;
- double *d;
+ pvChar *c;
+ pvShort *s;
+ pvLong *l;
+ pvFloat *f;
+ pvDouble *d;
+ pvString *r;
hunk ./src/seq/seq_qry.c 412
- c = (char *)pVal;
- for (i = 0; i < count; i++, c += sizeof(pvString))
+ r = (pvString *)pVal;
+ for (i = 0; i < count; i++, r++)
hunk ./src/seq/seq_qry.c 415
- printf(" %s", c);
+ printf(" %s", *r);
hunk ./src/seq/seq_qry.c 420
- c = (char *)pVal;
+ c = (pvChar *)pVal;
hunk ./src/seq/seq_qry.c 428
- s = (short *)pVal;
+ s = (pvShort *)pVal;
hunk ./src/seq/seq_qry.c 436
- l = (long *)pVal;
+ l = (pvLong *)pVal;
hunk ./src/seq/seq_qry.c 439
- printf(" %ld", *l);
+ printf(" %d", *l);
hunk ./src/seq/seq_qry.c 444
- f = (float *)pVal;
+ f = (pvFloat *)pVal;
hunk ./src/seq/seq_qry.c 452
- d = (double *)pVal;
+ d = (pvDouble *)pVal;
hunk ./src/snc/parse.c 197
+int check_type_too_long(Var *vp)
+{
+ extern int line_num;
+
+ if ((sizeof(long) > 4 && (vp->type == V_LONG || vp->type == V_ULONG))
+ || (sizeof(int) > 4 && (vp->type == V_INT || vp->type == V_UINT)))
+ {
+ fprintf(stderr,
+ "line %d: cannot assign variable >%s< because on this architecture "
+ "its (base) type is larger than 4 bytes. Such variables cannot be faithfully "
+ "mapped to any of the Channel Access base types.\nTry declaring the "
+ "variable as 'int' or, if that is still too large on your system, as 'short'.\n",
+ line_num, vp->name);
+ return FALSE;
+ }
+ return TRUE;
+}
+
hunk ./src/snc/parse.c 248
+ if (!check_type_too_long(vp)) return;
+
hunk ./src/snc/parse.c 293
+ if (!check_type_too_long(vp)) return;
+
hunk ./src/snc/parse.c 377
+ if (!check_type_too_long(vp)) return;
+
hunk ./test/demo/demo.st 39
+#if 0
+/* trying to assign a long variable now gives a compiler error on 64 bit systems */
hunk ./test/demo/demo.st 42
+#endif
+int light;
hunk ./test/validate/Makefile 14
-SEQS = sncDelay sncEntry sncEntryOpte sncEntryVar sncExitOptx sncOptt sncOpttVar
-PROD_HOST = $(SEQS)
-
-sncDelay_SRCS = sncDelay.st
-sncEntry_SRCS = sncEntry.st
-sncEntryOpte_SRCS = sncEntryOpte.st
-sncEntryVar_SRCS = sncEntryVar.st
-sncExitOptx_SRCS = sncExitOptx.st
-sncOptt_SRCS = sncOptt.st
-sncOpttVar_SRCS = sncOpttVar.st
+PROD += sncDelay
+PROD += sncEntry
+PROD += sncEntryOpte
+PROD += sncEntryVar
+PROD += sncExitOptx
+PROD += sncOptt
+PROD += sncOpttVar
+PROD += tooLong
hunk ./test/validate/Makefile 31
-
addfile ./test/validate/tooLong.st
hunk ./test/validate/tooLong.st 1
+/*
+ * Test proper rejection of variables whose type is too long
+ * to allow faithfull representation in CA, i.e. 64 bit types.
+ * On linux-x86_64 this should give error messages for the l and ul
+ * variables. On systems where sizeof(int)==8 (64 bit Windows?)
+ * even i and ui should be rejected.
+ */
+program tooLong
+
+int i;
+assign i to "";
+
+unsigned int ui;
+assign ui to "";
+
+long l;
+assign l to "";
+
+unsigned long ul;
+assign ul to "";
+
+ss tooLong {
+ state xy {
+ when () {
+ } state xy
+ }
+}