Skip to content

Commit

Permalink
Merge pull request #44 from ibuclaw/rmcomplex
Browse files Browse the repository at this point in the history
Remove support for formatting complex and imaginary types
  • Loading branch information
PetarKirov authored Apr 7, 2021
2 parents 7d6d0b6 + 5226368 commit 9a7b2ad
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 75 deletions.
39 changes: 0 additions & 39 deletions src/undead/doformat.d
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,6 @@ enum Mangle : char
Tdouble = 'd',
Treal = 'e',

Tifloat = 'o',
Tidouble = 'p',
Tireal = 'j',
Tcfloat = 'q',
Tcdouble = 'r',
Tcreal = 'c',

Tchar = 'a',
Twchar = 'u',
Tdchar = 'w',
Expand Down Expand Up @@ -125,12 +118,6 @@ private TypeInfo primitiveTypeInfo(Mangle m)
Mangle.Tfloat : typeid(float),
Mangle.Tdouble : typeid(double),
Mangle.Treal : typeid(real),
Mangle.Tifloat : typeid(ifloat),
Mangle.Tidouble : typeid(idouble),
Mangle.Tireal : typeid(ireal),
Mangle.Tcfloat : typeid(cfloat),
Mangle.Tcdouble : typeid(cdouble),
Mangle.Tcreal : typeid(creal),
Mangle.Tchar : typeid(char),
Mangle.Twchar : typeid(wchar),
Mangle.Tdchar : typeid(dchar)
Expand Down Expand Up @@ -491,7 +478,6 @@ void doFormat()(scope void delegate(dchar) putc, TypeInfo[] arguments, va_list a
dchar vdchar;
Object vobject;
real vreal;
creal vcreal;
Mangle m2;
int signed = 0;
uint base = 10;
Expand Down Expand Up @@ -824,36 +810,21 @@ void doFormat()(scope void delegate(dchar) putc, TypeInfo[] arguments, va_list a
goto Lnumber;

case Mangle.Tfloat:
case Mangle.Tifloat:
if (fc == 'x' || fc == 'X')
goto Luint;
vreal = getArg!(float)();
goto Lreal;

case Mangle.Tdouble:
case Mangle.Tidouble:
if (fc == 'x' || fc == 'X')
goto Lulong;
vreal = getArg!(double)();
goto Lreal;

case Mangle.Treal:
case Mangle.Tireal:
vreal = getArg!(real)();
goto Lreal;

case Mangle.Tcfloat:
vcreal = getArg!(cfloat)();
goto Lcomplex;

case Mangle.Tcdouble:
vcreal = getArg!(cdouble)();
goto Lcomplex;

case Mangle.Tcreal:
vcreal = getArg!(creal)();
goto Lcomplex;

case Mangle.Tsarray:
putArray(argptr, (cast(TypeInfo_StaticArray)ti).len, (cast(TypeInfo_StaticArray)ti).next);
return;
Expand Down Expand Up @@ -1066,16 +1037,6 @@ void doFormat()(scope void delegate(dchar) putc, TypeInfo[] arguments, va_list a
putreal(vreal);
return;

Lcomplex:
putreal(vcreal.re);
if (vcreal.im >= 0)
{
putc('+');
}
putreal(vcreal.im);
putc('i');
return;

Lerror:
throw new FormatException("formatArg");
}
Expand Down
36 changes: 0 additions & 36 deletions src/undead/stream.d
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,6 @@ interface InputStream {
void read(out float x); /// ditto
void read(out double x); /// ditto
void read(out real x); /// ditto
void read(out ifloat x); /// ditto
void read(out idouble x); /// ditto
void read(out ireal x); /// ditto
void read(out cfloat x); /// ditto
void read(out cdouble x); /// ditto
void read(out creal x); /// ditto
void read(out char x); /// ditto
void read(out wchar x); /// ditto
void read(out dchar x); /// ditto
Expand Down Expand Up @@ -288,12 +282,6 @@ interface OutputStream {
void write(float x); /// ditto
void write(double x); /// ditto
void write(real x); /// ditto
void write(ifloat x); /// ditto
void write(idouble x); /// ditto
void write(ireal x); /// ditto
void write(cfloat x); /// ditto
void write(cdouble x); /// ditto
void write(creal x); /// ditto
void write(char x); /// ditto
void write(wchar x); /// ditto
void write(dchar x); /// ditto
Expand Down Expand Up @@ -447,12 +435,6 @@ class Stream : InputStream, OutputStream {
void read(out float x) { readExact(&x, x.sizeof); }
void read(out double x) { readExact(&x, x.sizeof); }
void read(out real x) { readExact(&x, x.sizeof); }
void read(out ifloat x) { readExact(&x, x.sizeof); }
void read(out idouble x) { readExact(&x, x.sizeof); }
void read(out ireal x) { readExact(&x, x.sizeof); }
void read(out cfloat x) { readExact(&x, x.sizeof); }
void read(out cdouble x) { readExact(&x, x.sizeof); }
void read(out creal x) { readExact(&x, x.sizeof); }
void read(out char x) { readExact(&x, x.sizeof); }
void read(out wchar x) { readExact(&x, x.sizeof); }
void read(out dchar x) { readExact(&x, x.sizeof); }
Expand Down Expand Up @@ -1113,12 +1095,6 @@ class Stream : InputStream, OutputStream {
void write(float x) { writeExact(&x, x.sizeof); }
void write(double x) { writeExact(&x, x.sizeof); }
void write(real x) { writeExact(&x, x.sizeof); }
void write(ifloat x) { writeExact(&x, x.sizeof); }
void write(idouble x) { writeExact(&x, x.sizeof); }
void write(ireal x) { writeExact(&x, x.sizeof); }
void write(cfloat x) { writeExact(&x, x.sizeof); }
void write(cdouble x) { writeExact(&x, x.sizeof); }
void write(creal x) { writeExact(&x, x.sizeof); }
void write(char x) { writeExact(&x, x.sizeof); }
void write(wchar x) { writeExact(&x, x.sizeof); }
void write(dchar x) { writeExact(&x, x.sizeof); }
Expand Down Expand Up @@ -2469,12 +2445,6 @@ class EndianStream : FilterStream {
override void read(out float x) { readExact(&x, x.sizeof); fixBO(&x,x.sizeof); }
override void read(out double x) { readExact(&x, x.sizeof); fixBO(&x,x.sizeof); }
override void read(out real x) { readExact(&x, x.sizeof); fixBO(&x,x.sizeof); }
override void read(out ifloat x) { readExact(&x, x.sizeof); fixBO(&x,x.sizeof); }
override void read(out idouble x) { readExact(&x, x.sizeof); fixBO(&x,x.sizeof); }
override void read(out ireal x) { readExact(&x, x.sizeof); fixBO(&x,x.sizeof); }
override void read(out cfloat x) { readExact(&x, x.sizeof); fixBlockBO(&x,float.sizeof,2); }
override void read(out cdouble x) { readExact(&x, x.sizeof); fixBlockBO(&x,double.sizeof,2); }
override void read(out creal x) { readExact(&x, x.sizeof); fixBlockBO(&x,real.sizeof,2); }
override void read(out char x) { readExact(&x, x.sizeof); }
override void read(out wchar x) { readExact(&x, x.sizeof); fixBO(&x,x.sizeof); }
override void read(out dchar x) { readExact(&x, x.sizeof); fixBO(&x,x.sizeof); }
Expand Down Expand Up @@ -2524,12 +2494,6 @@ class EndianStream : FilterStream {
override void write(float x) { fixBO(&x,x.sizeof); writeExact(&x, x.sizeof); }
override void write(double x) { fixBO(&x,x.sizeof); writeExact(&x, x.sizeof); }
override void write(real x) { fixBO(&x,x.sizeof); writeExact(&x, x.sizeof); }
override void write(ifloat x) { fixBO(&x,x.sizeof); writeExact(&x, x.sizeof); }
override void write(idouble x) { fixBO(&x,x.sizeof); writeExact(&x, x.sizeof); }
override void write(ireal x) { fixBO(&x,x.sizeof); writeExact(&x, x.sizeof); }
override void write(cfloat x) { fixBlockBO(&x,float.sizeof,2); writeExact(&x, x.sizeof); }
override void write(cdouble x) { fixBlockBO(&x,double.sizeof,2); writeExact(&x, x.sizeof); }
override void write(creal x) { fixBlockBO(&x,real.sizeof,2); writeExact(&x, x.sizeof); }
override void write(char x) { writeExact(&x, x.sizeof); }
override void write(wchar x) { fixBO(&x,x.sizeof); writeExact(&x, x.sizeof); }
override void write(dchar x) { fixBO(&x,x.sizeof); writeExact(&x, x.sizeof); }
Expand Down

0 comments on commit 9a7b2ad

Please sign in to comment.