obstack access function
[libfirm] / testprograms / if_else_example.c
index fd13452..cd1a478 100644 (file)
@@ -1,9 +1,9 @@
 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
-** All rights reserved.
-**
-** Authors: Christian Schaefer, Goetz Lindenmaier
-**
-** testprogram.
+* All rights reserved.
+*
+* Authors: Christian Schaefer, Goetz Lindenmaier
+*
+* testprogram.
 */
 
 # include <stdio.h>
  */
 
 /**
-***  This file constructs the ir for the following pseudo-program:
-***
-***  main() {
-***    int a = 0;
-***    int b = 1;
-***
-***    if (a > 2)
-***      { a = b; }
-***    else
-***      { b = 2; }
-***
-***    return a, b;
+*  This file constructs the ir for the following pseudo-program:
+*
+*  main() {
+*    int a = 0;
+*    int b = 1;
+*
+*    if (a > 2)
+*      { a = b; }
+*    else
+*      { b = 2; }
+*
+*    return a, b;
 **/
 
 int main(int argc, char **argv)
@@ -44,7 +44,7 @@ int main(int argc, char **argv)
   printf("\ncreating an IR graph: IF_ELSE_EXAMPLE...\n");
 
   /* init library */
-  init_firm ();
+  init_firm (NULL);
 
   /*** Make basic type information for primitive type int. ***/
   prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_Is);
@@ -55,10 +55,10 @@ int main(int argc, char **argv)
    * Therefore we define a class "IF_ELSE_EXAMPLE" with a method main as an
    * entity.
    */
-#define ENTITYNAME "main"
+#define ENTITYNAME "IF_ELSE_EXAMPLE_main"
 
   owner = get_glob_type();
-  method = new_type_method (id_from_str("main", 4), 0, 2);
+  method = new_type_method (id_from_str(ENTITYNAME, strlen(ENTITYNAME)), 0, 2);
   set_method_res_type(method, 0, prim_t_int);
   set_method_res_type(method, 1, prim_t_int);