Skip to content

Instantly share code, notes, and snippets.

View genuinelucifer's full-sized avatar

Abhinav Tripathi genuinelucifer

  • Indore, Madhya Pradesh
View GitHub Profile
@genuinelucifer
genuinelucifer / typePrintingAlt.diff
Created May 28, 2015 06:04
Alternative to using type.replace with type.substring ...
diff --git a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs b/src/Generat
index 04b2f35..0c25c0a 100644
--- a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs
+++ b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs
@@ -863,8 +863,8 @@ private void GeneratePropertySetter<T>(QualifiedType returnT
{
CSharpTypePrinter typePrinter = new CSharpTypePrinter(ctx.D
string type = arrayType.CSharpType(typePrinter).Type;
- WriteLine(string.Format("fixed ({0} __arrPtr = {1}.{2})",
- type.Replace("[]","*"), Helpers.InstanceField,
@genuinelucifer
genuinelucifer / typPrinterCOntextTry.diff
Created May 28, 2015 04:54
Tried to change the context of typePrinter but didnt work as expected...
diff --git a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs b/src/Generat
index 04b2f35..692c222 100644
--- a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs
+++ b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs
@@ -862,9 +862,12 @@ private void GeneratePropertySetter<T>(QualifiedType return
if(arrayType != null && @class.IsValueType)
{
CSharpTypePrinter typePrinter = new CSharpTypePrinter(ctx.D
- string type = arrayType.CSharpType(typePrinter).Type;
+ typePrinter.PushContext(
diff --git a/src/Generator/Generators/CLI/CLIMarshal.cs b/src/Generator/Generato
index eb00737..bc6da59 100644
--- a/src/Generator/Generators/CLI/CLIMarshal.cs
+++ b/src/Generator/Generators/CLI/CLIMarshal.cs
@@ -40,13 +40,16 @@ public override bool VisitTagType(TagType tag, TypeQualifier
return decl.Visit(this);
}
+ private static int _arrayNum = 0;
public override bool VisitArrayType(ArrayType array, TypeQualifiers qua
diff --git a/src/Generator/Generators/CLI/CLIMarshal.cs b/src/Generator/Generato
index eb00737..bc6da59 100644
--- a/src/Generator/Generators/CLI/CLIMarshal.cs
+++ b/src/Generator/Generators/CLI/CLIMarshal.cs
@@ -40,13 +40,16 @@ public override bool VisitTagType(TagType tag, TypeQualifier
return decl.Visit(this);
}
+ private static int _arrayNum = 0;
public override bool VisitArrayType(ArrayType array, TypeQualifiers qua
@genuinelucifer
genuinelucifer / oneArray.diff
Created May 19, 2015 06:47
CS_VALUE_TYPE struct incompilable even with one array...
diff --git a/tests/Basic/Basic.h b/tests/Basic/Basic.h
index 488dd2c..62ec2a8 100644
--- a/tests/Basic/Basic.h
+++ b/tests/Basic/Basic.h
@@ -710,3 +710,17 @@ public:
bool operator ==(const DifferentConstOverloads& other);
bool operator ==(int number) const;
};
+
+#define SCE_NP_ONLINEID_MAX_LENGTH 5
@genuinelucifer
genuinelucifer / anonNesting.diff
Created May 14, 2015 03:34
compilable code when nesting more than one anonymous type! :)
diff --git a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs b/src/Generat
index ef0a242..1baed7a 100644
--- a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs
+++ b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs
@@ -34,11 +34,27 @@ public static class Helpers
"void", "partial", "yield", "where"
};
+ private static int numSafeIden = 0;
public static string SafeIdentifier(string id)
@genuinelucifer
genuinelucifer / varGeneration.diff
Created May 13, 2015 13:28
Trying to re-create variable regeneration issue
diff --git a/tests/Basic/Basic.h b/tests/Basic/Basic.h
index 488dd2c..41fdc5e 100644
--- a/tests/Basic/Basic.h
+++ b/tests/Basic/Basic.h
@@ -6,6 +6,9 @@
#endif
#include <string>
+static int staticTest;
+int normalTest;
@genuinelucifer
genuinelucifer / cs_internal_final.diff
Created May 11, 2015 05:46
Complete CS_INTERNAL Implementation and testing
diff --git a/src/AST/Class.cs b/src/AST/Class.cs
index 45b535f..07e1d53 100644
--- a/src/AST/Class.cs
+++ b/src/AST/Class.cs
@@ -10,7 +10,8 @@ public enum AccessSpecifier
{
Private,
Protected,
- Public
+ Public,
diff --git a/src/AST/Class.cs b/src/AST/Class.cs
index 45b535f..07e1d53 100644
--- a/src/AST/Class.cs
+++ b/src/AST/Class.cs
@@ -10,7 +10,8 @@ public enum AccessSpecifier
{
Private,
Protected,
- Public
+ Public,
diff --git a/src/AST/Class.cs b/src/AST/Class.cs
index 45b535f..07e1d53 100644
--- a/src/AST/Class.cs
+++ b/src/AST/Class.cs
@@ -10,7 +10,8 @@ public enum AccessSpecifier
{
Private,
Protected,
- Public
+ Public,