mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 18:02:25 +00:00
Update bootstrap C source.
This commit is contained in:
parent
9f0cbccf55
commit
19af6d76d3
185 changed files with 334 additions and 340 deletions
|
|
@ -1,4 +1,4 @@
|
|||
/* voc 2.00 [2016/11/28]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */
|
||||
/* voc 2.00 [2016/11/29]. Bootstrapping compiler for address size 8, alignment 8. tspaSF */
|
||||
|
||||
#define SHORTINT INT8
|
||||
#define INTEGER INT16
|
||||
|
|
@ -232,7 +232,8 @@ static void Files_Create (Files_File f)
|
|||
if (f->state == 1) {
|
||||
Files_GetTempName(f->registerName, 101, (void*)f->workName, 101);
|
||||
f->tempFile = 1;
|
||||
} else if (f->state == 2) {
|
||||
} else {
|
||||
__ASSERT(f->state == 2, 0);
|
||||
__COPY(f->registerName, f->workName, 101);
|
||||
f->registerName[0] = 0x00;
|
||||
f->tempFile = 0;
|
||||
|
|
@ -284,27 +285,6 @@ static void Files_Flush (Files_Buffer buf)
|
|||
}
|
||||
}
|
||||
|
||||
static void Files_CloseOSFile (Files_File f)
|
||||
{
|
||||
Files_File prev = NIL;
|
||||
INT16 error;
|
||||
if (Files_files == f) {
|
||||
Files_files = f->next;
|
||||
} else {
|
||||
prev = Files_files;
|
||||
while ((prev != NIL && prev->next != f)) {
|
||||
prev = prev->next;
|
||||
}
|
||||
if (prev->next != NIL) {
|
||||
prev->next = f->next;
|
||||
}
|
||||
}
|
||||
error = Platform_Close(f->fd);
|
||||
f->fd = -1;
|
||||
f->state = 1;
|
||||
Heap_FileCount -= 1;
|
||||
}
|
||||
|
||||
void Files_Close (Files_File f)
|
||||
{
|
||||
INT32 i;
|
||||
|
|
@ -316,7 +296,6 @@ void Files_Close (Files_File f)
|
|||
Files_Flush(f->bufs[i]);
|
||||
i += 1;
|
||||
}
|
||||
Files_CloseOSFile(f);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -465,6 +444,7 @@ Files_File Files_Old (CHAR *name, ADDRESS name__len)
|
|||
error = Platform_Identify(fd, &identity, Platform_FileIdentity__typ);
|
||||
f = Files_CacheEntry(identity);
|
||||
if (f != NIL) {
|
||||
error = Platform_Close(fd);
|
||||
__DEL(name);
|
||||
return f;
|
||||
} else {
|
||||
|
|
@ -804,7 +784,6 @@ void Files_Register (Files_File f)
|
|||
{
|
||||
INT16 idx, errcode;
|
||||
Files_File f1 = NIL;
|
||||
CHAR file[104];
|
||||
if ((f->state == 1 && f->registerName[0] != 0x00)) {
|
||||
f->state = 2;
|
||||
}
|
||||
|
|
@ -812,8 +791,7 @@ void Files_Register (Files_File f)
|
|||
if (f->registerName[0] != 0x00) {
|
||||
Files_Rename(f->workName, 101, f->registerName, 101, &errcode);
|
||||
if (errcode != 0) {
|
||||
__COPY(f->registerName, file, 104);
|
||||
__HALT(99);
|
||||
Files_Err((CHAR*)"Couldn't rename temp name as register name", 43, f, errcode);
|
||||
}
|
||||
__COPY(f->registerName, f->workName, 101);
|
||||
f->registerName[0] = 0x00;
|
||||
|
|
@ -1005,6 +983,27 @@ void Files_GetName (Files_File f, CHAR *name, ADDRESS name__len)
|
|||
__COPY(f->workName, name, name__len);
|
||||
}
|
||||
|
||||
static void Files_CloseOSFile (Files_File f)
|
||||
{
|
||||
Files_File prev = NIL;
|
||||
INT16 error;
|
||||
if (Files_files == f) {
|
||||
Files_files = f->next;
|
||||
} else {
|
||||
prev = Files_files;
|
||||
while ((prev != NIL && prev->next != f)) {
|
||||
prev = prev->next;
|
||||
}
|
||||
if (prev->next != NIL) {
|
||||
prev->next = f->next;
|
||||
}
|
||||
}
|
||||
error = Platform_Close(f->fd);
|
||||
f->fd = -1;
|
||||
f->state = 1;
|
||||
Heap_FileCount -= 1;
|
||||
}
|
||||
|
||||
static void Files_Finalize (SYSTEM_PTR o)
|
||||
{
|
||||
Files_File f = NIL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue