-#define METHODNAME "main"
-#define NRARGS 0
-#define NRES 2
-
- owner = new_type_class (id_from_str (CLASSNAME, strlen(CLASSNAME)));
- proc_main = new_type_method(id_from_str(METHODNAME, strlen(METHODNAME)), NRARGS, NRES);
- ent = new_entity ((type *)owner,
- id_from_str (METHODNAME, strlen(METHODNAME)),
- (type *)proc_main);
-
-#define RES_NAME "res1"
- typ = new_type_primitive(ID_FROM_STR(RES_NAME, strlen(RES_NAME)), mode_i);
- set_method_res_type(proc_main, 0, (type*)typ);
-#undef RES_NAME
-
-#define RES_NAME "res2"
- typ = new_type_primitive(ID_FROM_STR(RES_NAME, strlen(RES_NAME)), mode_i);
- set_method_res_type(proc_main, 1, (type*)typ);
-#undef RES_NAME
-
-
- /* Generates start and end blocks and nodes and a first, initial block */
- irg = new_ir_graph (ent, 1);
-
- /* The value position used for a: */
+#define METHODNAME "IF_EXAMPLE_main"
+#define NRARGS 1
+#define NRES 1
+
+ /** Type information for the procedure **/
+
+ owner = get_glob_type();
+ /* Type information for the procedure */
+ proc_main = new_type_method(new_id_from_chars(METHODNAME, strlen(METHODNAME)),
+ NRARGS, NRES);
+ /* The ir_entity for the procedure */
+ ent = new_entity(owner,
+ new_id_from_chars(METHODNAME, strlen(METHODNAME)),
+ proc_main);
+ /* The ir_type int. This ir_type is necessary to model the result and parameters
+ the procedure. */
+#define PRIM_NAME "int"
+ typ = new_type_primitive(new_id_from_chars(PRIM_NAME, strlen(PRIM_NAME)), mode_Is);
+ /* The parameter and result types of the procedure. */
+ set_method_param_type(proc_main, 0, typ);
+ set_method_res_type(proc_main, 0, typ);
+
+ /** The code of the procedure **/
+
+ /* Generates start and end blocks and nodes, and a first, initial block */
+#define NRLOCS 2
+ irg = new_ir_graph(ent, NRLOCS);
+
+ /* The value position used for: */