Add version to symbol files to avoid confusing symptoms from format changes.

This commit is contained in:
David Brown 2016-11-10 18:54:40 +00:00
parent 9f5d4c6b0d
commit ef815aa131
7 changed files with 33 additions and 20 deletions

View file

@ -764,15 +764,16 @@ void OPM_CloseOldSym (void)
void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done)
{
CHAR ch;
CHAR tag, ver;
OPM_FileName fileName;
OPM_MakeFileName((void*)modName, modName__len, (void*)fileName, 32, (CHAR*)".sym", 5);
OPM_oldSFile = Files_Old(fileName, 32);
*done = OPM_oldSFile != NIL;
if (*done) {
Files_Set(&OPM_oldSF, Files_Rider__typ, OPM_oldSFile, 0);
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&ch);
if (ch != 0xf7) {
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&tag);
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&ver);
if (tag != 0xf7 || ver != 0x82) {
OPM_err(-306);
OPM_CloseOldSym();
*done = 0;
@ -829,6 +830,7 @@ void OPM_NewSym (CHAR *modName, LONGINT modName__len)
if (OPM_newSFile != NIL) {
Files_Set(&OPM_newSF, Files_Rider__typ, OPM_newSFile, 0);
Files_Write(&OPM_newSF, Files_Rider__typ, 0xf7);
Files_Write(&OPM_newSF, Files_Rider__typ, 0x82);
} else {
OPM_err(153);
}

View file

@ -764,15 +764,16 @@ void OPM_CloseOldSym (void)
void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done)
{
CHAR ch;
CHAR tag, ver;
OPM_FileName fileName;
OPM_MakeFileName((void*)modName, modName__len, (void*)fileName, 32, (CHAR*)".sym", 5);
OPM_oldSFile = Files_Old(fileName, 32);
*done = OPM_oldSFile != NIL;
if (*done) {
Files_Set(&OPM_oldSF, Files_Rider__typ, OPM_oldSFile, 0);
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&ch);
if (ch != 0xf7) {
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&tag);
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&ver);
if (tag != 0xf7 || ver != 0x82) {
OPM_err(-306);
OPM_CloseOldSym();
*done = 0;
@ -829,6 +830,7 @@ void OPM_NewSym (CHAR *modName, LONGINT modName__len)
if (OPM_newSFile != NIL) {
Files_Set(&OPM_newSF, Files_Rider__typ, OPM_newSFile, 0);
Files_Write(&OPM_newSF, Files_Rider__typ, 0xf7);
Files_Write(&OPM_newSF, Files_Rider__typ, 0x82);
} else {
OPM_err(153);
}

View file

@ -764,15 +764,16 @@ void OPM_CloseOldSym (void)
void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done)
{
CHAR ch;
CHAR tag, ver;
OPM_FileName fileName;
OPM_MakeFileName((void*)modName, modName__len, (void*)fileName, 32, (CHAR*)".sym", 5);
OPM_oldSFile = Files_Old(fileName, 32);
*done = OPM_oldSFile != NIL;
if (*done) {
Files_Set(&OPM_oldSF, Files_Rider__typ, OPM_oldSFile, 0);
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&ch);
if (ch != 0xf7) {
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&tag);
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&ver);
if (tag != 0xf7 || ver != 0x82) {
OPM_err(-306);
OPM_CloseOldSym();
*done = 0;
@ -829,6 +830,7 @@ void OPM_NewSym (CHAR *modName, LONGINT modName__len)
if (OPM_newSFile != NIL) {
Files_Set(&OPM_newSF, Files_Rider__typ, OPM_newSFile, 0);
Files_Write(&OPM_newSF, Files_Rider__typ, 0xf7);
Files_Write(&OPM_newSF, Files_Rider__typ, 0x82);
} else {
OPM_err(153);
}

View file

@ -764,15 +764,16 @@ void OPM_CloseOldSym (void)
void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done)
{
CHAR ch;
CHAR tag, ver;
OPM_FileName fileName;
OPM_MakeFileName((void*)modName, modName__len, (void*)fileName, 32, (CHAR*)".sym", 5);
OPM_oldSFile = Files_Old(fileName, 32);
*done = OPM_oldSFile != NIL;
if (*done) {
Files_Set(&OPM_oldSF, Files_Rider__typ, OPM_oldSFile, 0);
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&ch);
if (ch != 0xf7) {
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&tag);
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&ver);
if (tag != 0xf7 || ver != 0x82) {
OPM_err(-306);
OPM_CloseOldSym();
*done = 0;
@ -829,6 +830,7 @@ void OPM_NewSym (CHAR *modName, LONGINT modName__len)
if (OPM_newSFile != NIL) {
Files_Set(&OPM_newSF, Files_Rider__typ, OPM_newSFile, 0);
Files_Write(&OPM_newSF, Files_Rider__typ, 0xf7);
Files_Write(&OPM_newSF, Files_Rider__typ, 0x82);
} else {
OPM_err(153);
}

View file

@ -764,15 +764,16 @@ void OPM_CloseOldSym (void)
void OPM_OldSym (CHAR *modName, LONGINT modName__len, BOOLEAN *done)
{
CHAR ch;
CHAR tag, ver;
OPM_FileName fileName;
OPM_MakeFileName((void*)modName, modName__len, (void*)fileName, 32, (CHAR*)".sym", 5);
OPM_oldSFile = Files_Old(fileName, 32);
*done = OPM_oldSFile != NIL;
if (*done) {
Files_Set(&OPM_oldSF, Files_Rider__typ, OPM_oldSFile, 0);
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&ch);
if (ch != 0xf7) {
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&tag);
Files_Read(&OPM_oldSF, Files_Rider__typ, (void*)&ver);
if (tag != 0xf7 || ver != 0x82) {
OPM_err(-306);
OPM_CloseOldSym();
*done = 0;
@ -829,6 +830,7 @@ void OPM_NewSym (CHAR *modName, LONGINT modName__len)
if (OPM_newSFile != NIL) {
Files_Set(&OPM_newSF, Files_Rider__typ, OPM_newSFile, 0);
Files_Write(&OPM_newSF, Files_Rider__typ, 0xf7);
Files_Write(&OPM_newSF, Files_Rider__typ, 0x82);
} else {
OPM_err(153);
}

View file

@ -68,6 +68,7 @@ if errorlevel 1 (
echo make full - administrator rights required. Please run under an administrator command prompt.
goto :eof
)
call :uninstall || exit /b
call :clean || exit /b
call :compiler || exit /b
call :browsercmd || exit /b
@ -447,7 +448,7 @@ goto :eof
:initlibrary
del /s /q %BUILDDIR%\%MODEL% >nul 2>nul
rd /s /q %BUILDDIR%\%MODEL% >nul 2>nul
mkdir %BUILDDIR% >nul 2>nul
mkdir %BUILDDIR%\%MODEL% >nul 2>nul
copy src\runtime\*.c %BUILDDIR%\%MODEL% >nul

View file

@ -76,6 +76,7 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *)
BFext = ".c"; (* body file extension *)
HFext = ".h"; (* header file extension *)
SFtag = 0F7X; (* symbol file tag *)
SFver = 082X; (* symbol file version. Increment if symbol file format is changed. *)
@ -618,13 +619,13 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *)
END CloseOldSym;
PROCEDURE OldSym*(VAR modName: ARRAY OF CHAR; VAR done: BOOLEAN);
VAR ch: CHAR; fileName: FileName;
VAR tag, ver: CHAR; fileName: FileName;
BEGIN
MakeFileName(modName, fileName, SFext);
oldSFile := Files.Old(fileName); done := oldSFile # NIL;
IF done THEN
Files.Set(oldSF, oldSFile, 0); Files.Read(oldSF, ch);
IF ch # SFtag THEN err(-306); (*possibly a symbol file from another Oberon implementation, e.g. HP-Oberon*)
Files.Set(oldSF, oldSFile, 0); Files.Read(oldSF, tag); Files.Read(oldSF, ver);
IF (tag # SFtag) OR (ver # SFver) THEN err(-306); (*possibly a symbol file from another Oberon implementation, e.g. HP-Oberon*)
CloseOldSym; done := FALSE
END
END
@ -671,7 +672,8 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *)
VAR fileName: FileName;
BEGIN MakeFileName(modName, fileName, SFext);
newSFile := Files.New(fileName);
IF newSFile # NIL THEN Files.Set(newSF, newSFile, 0); Files.Write(newSF, SFtag)
IF newSFile # NIL THEN Files.Set(newSF, newSFile, 0);
Files.Write(newSF, SFtag); Files.Write(newSF, SFver)
ELSE err(153)
END
END NewSym;