Skip to content

overloading - more fixes for wordpad.py #170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update converter.cs
  • Loading branch information
denfromufa committed Feb 27, 2016
commit 70d81c2f8c218284b5846644203d274175e00a4c
28 changes: 28 additions & 0 deletions src/runtime/converter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ private Converter() {}
static NumberFormatInfo nfi;
static Type objectType;
static Type stringType;
static Type singleType;
static Type doubleType;
static Type decimalType;
static Type int16Type;
static Type int32Type;
static Type int64Type;
static Type flagsType;
Expand All @@ -40,9 +43,12 @@ static Converter () {
nfi = NumberFormatInfo.InvariantInfo;
objectType = typeof(Object);
stringType = typeof(String);
int16Type = typeof(Int16);
int32Type = typeof(Int32);
int64Type = typeof(Int64);
singleType = typeof(Single);
doubleType = typeof(Double);
decimalType = typeof(Decimal);
flagsType = typeof(FlagsAttribute);
boolType = typeof(Boolean);
typeType = typeof(Type);
Expand Down Expand Up @@ -73,6 +79,28 @@ internal static Type GetTypeByAlias(IntPtr op) {
return null;
}

internal static IntPtr GetPythonTypeByAlias(Type op)
{
if (op == stringType) {
return Runtime.PyUnicodeType;
}
else if ((op == int16Type) ||
(op == int32Type)) {
return Runtime.PyIntType;
}
else if (op == int64Type) {
return Runtime.PyLongType;
}
else if ((op == doubleType) ||
(op == singleType)) {
return Runtime.PyFloatType;
}
else if (op == boolType) {
return Runtime.PyBoolType;
}
return IntPtr.Zero;
}


//====================================================================
// Return a Python object for the given native object, converting
Expand Down