-
Notifications
You must be signed in to change notification settings - Fork 53
[x64 fix]: Scintilla structures required correction for x64 #75
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,3 +109,4 @@ UpgradeLog*.XML | |
*.pyc | ||
|
||
Visual Studio Project Template C#/$projectname$.sln | ||
.vscode/launch.json |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,12 +35,12 @@ def isTypeUnsupported(t): | |
if t in ["formatrange"]: return True | ||
return False | ||
|
||
def translateType(t): | ||
def translateType(t:str): | ||
if t == "cells": return "Cells" | ||
if t == "colour": return "Colour" | ||
if t == "line": return "int" | ||
if t == "line": return "long" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. line and position types need to be atleast 64-bit wide which can accommodate both 32-bit data in x86 execution and 64-bit data in x64 execution. IntPtr could have been used as suggested, but that complicates things with arithmetic operations. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this the correct assumption if you build a 32bit and a64 bit version There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you are right, there is a potential issue for set operations, if we allow the long to be used and user supplies a long value but the execution env is x86. This might result in overflow/truncation. I was just focusing on get operation where the system returned type can fit on the target container for both x86 and x64. So we are again left with only option of using IntPtr to make it work for both environment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have suggested alternative fix for this: see my reply below |
||
if t == "pointer": return "IntPtr" | ||
if t == "position": return "int" | ||
if t == "position": return "long" | ||
if t == "textrange": return "TextRange" | ||
if t == "findtext": return "TextToFind" | ||
if t == "keymod": return "KeyModifier" | ||
|
@@ -81,7 +81,7 @@ def getUnsafeModifier(returnType, param1Type, param2Type): | |
def translateReturnType(v, param1Type, param2Type): | ||
if param1Type == "stringresult" or param2Type == "stringresult": | ||
return "string" | ||
else: | ||
else: | ||
return translateType(v["ReturnType"]) | ||
|
||
def getParameterList(param1Type, param1Name, param2Type, param2Name): | ||
|
@@ -100,6 +100,7 @@ def printEnumDefinitions(f): | |
if v["FeatureType"] in ["enu"] and name not in ["Keys"]: # for all except excluded enums [conflicting] | ||
appendComment(indent, out, v) | ||
prefix = v["Value"] | ||
out.append(indent + "[Flags]") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Enums now have the [Flags] Attribute which makes them combinable with other constants of same enum type. |
||
out.append(indent + "public enum " + name) | ||
out.append(indent + "{") | ||
for ename in f.order: | ||
|
@@ -189,10 +190,6 @@ def printLexGatewayFile(f): | |
out.append(iindent + "return 1 == (int)" +res+ ";") | ||
elif returnType == "Colour": | ||
out.append(iindent + "return new Colour((int) " +res+ ");") | ||
# elif returnType == "Line": | ||
# out.append(iindent + "return new Line((int) " +res+ ");") | ||
# elif returnType == "Position": | ||
# out.append(iindent + "return new Position((int) " +res+ ");") | ||
elif returnType == "string": | ||
out.append(iindent + res + ";") | ||
out.append(iindent + "return Encoding.UTF8.GetString("+bufferVariableName+").TrimEnd('\\0');") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set cwd to script path for traversing relative file paths correctly such as ../../ etc