Fix VAL
This commit is contained in:
@@ -1205,13 +1205,13 @@ class BuiltinFunction
|
|||||||
munch(str, " ");
|
munch(str, " ");
|
||||||
if(str.length > 2 && str[0..2] == "&H")
|
if(str.length > 2 && str[0..2] == "&H")
|
||||||
{
|
{
|
||||||
int r;
|
uint r;
|
||||||
str = str[2..$];
|
str = str[2..$];
|
||||||
if (tryParse!(int, wstring)(str, 16, r))
|
if (tryParse!(uint, wstring)(str, 16, r))
|
||||||
{
|
{
|
||||||
if (!str.empty)
|
if (!str.empty)
|
||||||
return 0;
|
return 0;
|
||||||
return r;
|
return cast(int)r;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1220,13 +1220,13 @@ class BuiltinFunction
|
|||||||
}
|
}
|
||||||
if(str.length > 2 && str[0..2] == "&B")
|
if(str.length > 2 && str[0..2] == "&B")
|
||||||
{
|
{
|
||||||
int r;
|
uint r;
|
||||||
str = str[2..$];
|
str = str[2..$];
|
||||||
if (tryParse!(int, wstring)(str, 2, r))
|
if (tryParse!(uint, wstring)(str, 2, r))
|
||||||
{
|
{
|
||||||
if (!str.empty)
|
if (!str.empty)
|
||||||
return 0;
|
return 0;
|
||||||
return r;
|
return cast(int)r;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -202,6 +202,13 @@ r"ファイルを書き込みます。
|
|||||||
File f = File(path, "rb");
|
File f = File(path, "rb");
|
||||||
DataHeader[1] harray;
|
DataHeader[1] harray;
|
||||||
f.rawRead(harray);
|
f.rawRead(harray);
|
||||||
|
if (harray[0].magic != "PCBN0001")
|
||||||
|
{
|
||||||
|
f.seek(0);
|
||||||
|
harray[0].dimension = 1;
|
||||||
|
harray[0].dim[] = [cast(int)f.size, 0, 0, 0];
|
||||||
|
harray[0].type = DataType.int_;
|
||||||
|
}
|
||||||
if (harray[0].dimension != contents.dimCount)
|
if (harray[0].dimension != contents.dimCount)
|
||||||
{
|
{
|
||||||
throw new TypeMismatch("LOAD");
|
throw new TypeMismatch("LOAD");
|
||||||
@@ -241,6 +248,10 @@ r"ファイルを書き込みます。
|
|||||||
f.rawRead(array);
|
f.rawRead(array);
|
||||||
result = array.map!(x => x.to!T).array;
|
result = array.map!(x => x.to!T).array;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new TypeMismatch("LOAD(invalid file)");
|
||||||
|
}
|
||||||
//配列に書き込むというより配列を差し替えている
|
//配列に書き込むというより配列を差し替えている
|
||||||
contents.array = result;
|
contents.array = result;
|
||||||
contents.dim[] = harray[0].dim[];
|
contents.dim[] = harray[0].dim[];
|
||||||
|
|||||||
Reference in New Issue
Block a user