Fix copy struct to value struct param, add vsprintf
This commit is contained in:
parent
f443c97f70
commit
9dc8489693
|
@ -556,6 +556,17 @@ int sprintf(char * str, const char * fmt, ...)
|
||||||
return d - str;
|
return d - str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void vprintf(const char * fmt, va_list vlist)
|
||||||
|
{
|
||||||
|
char buff[50];
|
||||||
|
sformat(buff, fmt, (int *)vlist, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
int vsprintf(char * str, const char * fmt, va_list vlist)
|
||||||
|
{
|
||||||
|
char * d = sformat(str, fmt, (int *)vlist, false);
|
||||||
|
return d - str;
|
||||||
|
}
|
||||||
|
|
||||||
static inline bool isspace(char c)
|
static inline bool isspace(char c)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
void putchar(char c);
|
void putchar(char c);
|
||||||
|
|
||||||
|
@ -18,6 +19,10 @@ void printf(const char * fmt, ...);
|
||||||
|
|
||||||
int sprintf(char * str, const char * fmt, ...);
|
int sprintf(char * str, const char * fmt, ...);
|
||||||
|
|
||||||
|
void vprintf(const char * fmt, va_list vlist);
|
||||||
|
|
||||||
|
int vsprintf(char * str, const char * fmt, va_list vlist);
|
||||||
|
|
||||||
int scanf(const char * fmt, ...);
|
int scanf(const char * fmt, ...);
|
||||||
|
|
||||||
int sscanf(const char * str, const char * fmt, ...);
|
int sscanf(const char * str, const char * fmt, ...);
|
||||||
|
|
|
@ -544,7 +544,7 @@ unsigned heapfree(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
struct Heap {
|
struct Heap {q
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
Heap * next;
|
Heap * next;
|
||||||
} * freeHeap;
|
} * freeHeap;
|
||||||
|
|
|
@ -8462,10 +8462,20 @@ NativeCodeBasicBlock * NativeCodeBasicBlock::CopyValue(InterCodeProcedure* proc,
|
||||||
{
|
{
|
||||||
for (int i = 0; i < size; i++)
|
for (int i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDY, ASMIM_IMMEDIATE, si));
|
if (ins->mSrc[0].mTemp < 0 && ins->mSrc[0].mMemory == IM_FPARAM)
|
||||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_INDIRECT_Y, sreg));
|
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ZERO_PAGE, BC_REG_FPARAMS + ins->mSrc[0].mVarIndex + ins->mSrc[0].mIntConst + i));
|
||||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDY, ASMIM_IMMEDIATE, di));
|
else
|
||||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_INDIRECT_Y, dreg));
|
{
|
||||||
|
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDY, ASMIM_IMMEDIATE, si));
|
||||||
|
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_INDIRECT_Y, sreg));
|
||||||
|
}
|
||||||
|
if (ins->mSrc[1].mTemp < 0 && ins->mSrc[1].mMemory == IM_FFRAME)
|
||||||
|
mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, BC_REG_FPARAMS + ins->mSrc[1].mVarIndex + ins->mSrc[1].mIntConst + i));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDY, ASMIM_IMMEDIATE, di));
|
||||||
|
mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_INDIRECT_Y, dreg));
|
||||||
|
}
|
||||||
|
|
||||||
si += sstride;
|
si += sstride;
|
||||||
di += dstride;
|
di += dstride;
|
||||||
|
@ -54640,7 +54650,7 @@ void NativeCodeProcedure::Compile(InterCodeProcedure* proc)
|
||||||
|
|
||||||
mInterProc->mLinkerObject->mNativeProc = this;
|
mInterProc->mLinkerObject->mNativeProc = this;
|
||||||
|
|
||||||
CheckFunc = !strcmp(mIdent->mString, "main");
|
CheckFunc = !strcmp(mIdent->mString, "mbox::configure_animations");
|
||||||
|
|
||||||
int nblocks = proc->mBlocks.Size();
|
int nblocks = proc->mBlocks.Size();
|
||||||
tblocks = new NativeCodeBasicBlock * [nblocks];
|
tblocks = new NativeCodeBasicBlock * [nblocks];
|
||||||
|
|
Loading…
Reference in New Issue