+2003-04-20 Jackson Harper <jackson@latitudegeo.com>
+
+ * CodeGen.cs: Add method to add data
+ * FieldDef.cs: Add method to set a fields value
+ * TypeDef.cs: Add method to add data
+ * DataDef.cs: New file - Definition of a data constant
+
2003-04-18 Jackson Harper <jackson@latitudegeo.com>
* FieldDef.cs: Change peapi fielddef name.
private ExternTable extern_table;\r
private ArrayList global_field_list;\r
private ArrayList global_method_list;\r
+ private ArrayList global_data_list;\r
\r
public CodeGen (string output_file, bool is_dll, bool is_assembly)\r
{\r
typedef_stack = new Stack ();\r
global_field_list = new ArrayList ();\r
global_method_list = new ArrayList ();\r
+ global_data_list = new ArrayList ();\r
}\r
\r
public PEFile PEFile {\r
}\r
}\r
\r
+ public void AddDataDef (DataDef datadef)\r
+ {\r
+ if (current_typedef != null) {\r
+ current_typedef.AddDataDef (datadef);\r
+ } else {\r
+ global_data_list.Add (datadef);\r
+ }\r
+ }\r
+\r
public void BeginMethodDef (MethodDef methoddef)\r
{\r
if (current_typedef != null) {\r
--- /dev/null
+//
+// Mono.ILASM.DataDef
+//
+// Author(s):
+// Jackson Harper (Jackson@LatitudeGeo.com)
+//
+// (C) 2003 Jackson Harper, All rights reserved
+//
+
+
+using System;
+
+namespace Mono.ILASM {
+
+ public class DataDef {
+
+ private string name;
+ private bool is_tls;
+
+ private PEAPI.Constant constant;
+
+ public DataDef (string name, bool is_tls)
+ {
+ this.name = name;
+ this.is_tls = is_tls;
+ }
+
+ public PEAPI.Constant PeapiConstant {
+ get { return constant; }
+ set { constant = value; }
+ }
+
+ }
+
+}
+
private bool value_set;
private uint offset;
+ private PEAPI.Constant constant;
public FieldDef (PEAPI.FieldAttr attr, string name,
ITypeRef type)
get { return field_def; }
}
- public void SetOffset (uint val) {
+ public void SetOffset (uint val)
+ {
offset_set = true;
offset = val;
}
+ public void SetValue (PEAPI.Constant constant)
+ {
+ value_set = true;
+ this.constant = constant;
+ }
+
/// <summary>
/// Define a global field
/// </summary>
if (offset_set) {
field_def.SetOffset (offset);
+ }
+ if (value_set) {
+ field_def.AddValue (constant);
}
}