Skip to content

Commit d884146

Browse files
committed
COMMON: set SB_DWORD_VER from configure
1 parent d805eb9 commit d884146

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

configure.ac

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,9 @@ PACKAGE_CFLAGS="${PACKAGE_CFLAGS} -Wall -Wno-unused-result"
367367
BUILD_DATE=`date +"%a, %d %b %Y"`
368368
AC_DEFINE_UNQUOTED([BUILD_DATE],["$BUILD_DATE"],[Build date])
369369

370+
SB_DWORD_VER=`awk -F "." '{printf "0x%02d%02d%02d", $1,$2,$3}' <<< ${PACKAGE_VERSION}`
371+
AC_DEFINE_UNQUOTED([SB_DWORD_VER],[$SB_DWORD_VER],[SB_DWORD_VER])
372+
370373
AC_SUBST(PACKAGE_CFLAGS)
371374
AC_SUBST(PACKAGE_LIBS)
372375

src/common/brun.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,9 @@ int brun_create_task(const char *filename, byte *preloaded_bc, int libf) {
11961196
lseek(h, sizeof(unit_sym_t) * uft.sym_count, SEEK_CUR);
11971197
}
11981198
read(h, &hdr, sizeof(bc_head_t));
1199-
1199+
if (hdr.sbver != SB_DWORD_VER) {
1200+
panic("File '%s' version incorrect", fname);
1201+
}
12001202
source = malloc(hdr.size + 4);
12011203
lseek(h, 0, SEEK_SET);
12021204
read(h, source, hdr.size);

src/common/sys.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ typedef long int var_int_t;
8383
#else
8484
#define SB_STR_VER VERSION " Console " SB_VERSYS SB_BIT_SZ BUILD_DATE
8585
#endif
86-
#define SB_DWORD_VER 0x908 // 00 (major) 08 (minor) 03 (patch)
8786
#define SB_PANICMSG_SIZE 1023
8887
#define SB_ERRMSG_SIZE 2048
8988
#define SB_KEYWORD_SIZE 128

src/common/units.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ typedef enum {
6565
*/
6666
typedef struct {
6767
char sign[4]; /**< Always "SBUn" */
68-
int version; /**< version of this structure, always 1 */
68+
int version; /**< version of this structure */
6969
char base[SB_KEYWORD_SIZE + 1]; /**< unit-base name */
7070
int sym_count; /**< number of symbols */
7171
} unit_file_t;

0 commit comments

Comments
 (0)