Implement GSAVE -1
This commit is contained in:
@@ -578,17 +578,33 @@ class BuiltinFunction
|
|||||||
if (ary.type == ValueType.IntegerArray)
|
if (ary.type == ValueType.IntegerArray)
|
||||||
{
|
{
|
||||||
if (size > ary.length)
|
if (size > ary.length)
|
||||||
|
{
|
||||||
|
if (ary.dimCount != 2)
|
||||||
{
|
{
|
||||||
ary.integerArray.length = size;
|
ary.integerArray.length = size;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ary.integerArray.dim[0..2] = [w, h];
|
||||||
|
ary.integerArray.array = new int[size];
|
||||||
|
}
|
||||||
|
}
|
||||||
p.graphic.gsave(savepage, x, y, w, h, ary.integerArray.array, flag);
|
p.graphic.gsave(savepage, x, y, w, h, ary.integerArray.array, flag);
|
||||||
}
|
}
|
||||||
else if (ary.type == ValueType.DoubleArray)
|
else if (ary.type == ValueType.DoubleArray)
|
||||||
{
|
{
|
||||||
if (size > ary.length)
|
if (size > ary.length)
|
||||||
|
{
|
||||||
|
if (ary.dimCount != 2)
|
||||||
{
|
{
|
||||||
ary.doubleArray.length = size;
|
ary.doubleArray.length = size;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ary.doubleArray.dim[0..2] = [w, h];
|
||||||
|
ary.doubleArray.array = new double[size];
|
||||||
|
}
|
||||||
|
}
|
||||||
p.graphic.gsave(savepage, x, y, w, h, ary.doubleArray.array, flag);
|
p.graphic.gsave(savepage, x, y, w, h, ary.doubleArray.array, flag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -226,6 +226,14 @@ class IllegalSymbolString : SmileBasicError
|
|||||||
super("Illegal symbol string");
|
super("Illegal symbol string");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
class IllegalFileFormat : SmileBasicError
|
||||||
|
{
|
||||||
|
this(string func)
|
||||||
|
{
|
||||||
|
this.errnum = 35;
|
||||||
|
super("Illegal file format(" ~ func ~ ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
class UsePRGEDITBeforeAnyPRGFunction : SmileBasicError
|
class UsePRGEDITBeforeAnyPRGFunction : SmileBasicError
|
||||||
{
|
{
|
||||||
this(string func)
|
this(string func)
|
||||||
|
|||||||
@@ -1206,7 +1206,13 @@ class Graphic2 : Graphic
|
|||||||
{
|
{
|
||||||
int arrayH = h, arrayW = w;
|
int arrayH = h, arrayW = w;
|
||||||
int sx, sy;
|
int sx, sy;
|
||||||
int* buffer = cast(int*)GRP[savepage].surface.pixels;
|
int* buffer;
|
||||||
|
if (savepage == -1)
|
||||||
|
{
|
||||||
|
buffer = cast(int*)petitcom.console.GRPF.surface.pixels;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
buffer = cast(int*)GRP[savepage].surface.pixels;
|
||||||
for (int iy = sy; iy < h; iy++)
|
for (int iy = sy; iy < h; iy++)
|
||||||
{
|
{
|
||||||
for (int ix = sx; ix < w; ix++)
|
for (int ix = sx; ix < w; ix++)
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ r"ファイルを書き込みます。
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool loadDataFile(T)(FileName file, ref Array!T contents)
|
bool loadDataFile(T)(FileName file, ref Array!T contents, out DataHeader header)
|
||||||
if (is(T == int) || is(T == double))
|
if (is(T == int) || is(T == double))
|
||||||
{
|
{
|
||||||
wstring project;
|
wstring project;
|
||||||
@@ -211,6 +211,7 @@ r"ファイルを書き込みます。
|
|||||||
harray[0].dim[] = [cast(int)(f.size / int.sizeof), 0, 0, 0];
|
harray[0].dim[] = [cast(int)(f.size / int.sizeof), 0, 0, 0];
|
||||||
harray[0].type = DataType.int_;
|
harray[0].type = DataType.int_;
|
||||||
}
|
}
|
||||||
|
header = harray[0];
|
||||||
if (harray[0].dimension != contents.dimCount)
|
if (harray[0].dimension != contents.dimCount)
|
||||||
{
|
{
|
||||||
throw new TypeMismatch("LOAD");
|
throw new TypeMismatch("LOAD");
|
||||||
@@ -260,6 +261,12 @@ r"ファイルを書き込みます。
|
|||||||
contents.dimCount = harray[0].dimension;
|
contents.dimCount = harray[0].dimension;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
bool loadDataFile(T)(FileName file, ref Array!T contents)
|
||||||
|
if (is(T == int) || is(T == double))
|
||||||
|
{
|
||||||
|
DataHeader dh;
|
||||||
|
return loadDataFile(file, contents, dh);
|
||||||
|
}
|
||||||
|
|
||||||
void saveTextFile(FileName file, wstring content)
|
void saveTextFile(FileName file, wstring content)
|
||||||
{
|
{
|
||||||
@@ -359,6 +366,8 @@ r"ファイルを書き込みます。
|
|||||||
return Resource.data;
|
return Resource.data;
|
||||||
case "TXT":
|
case "TXT":
|
||||||
return Resource.text;
|
return Resource.text;
|
||||||
|
case "GRPF":
|
||||||
|
return Resource.graphicFont;
|
||||||
default:
|
default:
|
||||||
return Resource.illegal;
|
return Resource.illegal;
|
||||||
}
|
}
|
||||||
@@ -406,6 +415,7 @@ enum Resource
|
|||||||
data,
|
data,
|
||||||
text,
|
text,
|
||||||
illegal,
|
illegal,
|
||||||
|
graphicFont,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct FileName
|
struct FileName
|
||||||
|
|||||||
@@ -138,6 +138,21 @@ struct Value
|
|||||||
this.type = ValueType.Function;
|
this.type = ValueType.Function;
|
||||||
this.func = func;
|
this.func = func;
|
||||||
}
|
}
|
||||||
|
this(Array!int a)
|
||||||
|
{
|
||||||
|
this.type = ValueType.IntegerArray;
|
||||||
|
this.integerArray = a;
|
||||||
|
}
|
||||||
|
this(Array!double a)
|
||||||
|
{
|
||||||
|
this.type = ValueType.DoubleArray;
|
||||||
|
this.doubleArray = a;
|
||||||
|
}
|
||||||
|
this(Array!(Array!wchar) a)
|
||||||
|
{
|
||||||
|
this.type = ValueType.StringArray;
|
||||||
|
this.stringArray = a;
|
||||||
|
}
|
||||||
void castOp(ValueType type)
|
void castOp(ValueType type)
|
||||||
{
|
{
|
||||||
switch(type)
|
switch(type)
|
||||||
|
|||||||
Reference in New Issue
Block a user