fprintf(FILENAME(state), "    public static final String IID =\n        \"%s\";\n\n", iid);
fprintf(FILENAME(state), "    public static final IID IID =\n       new IID(\"%s\");\n\n", iid);
interface_declaration(TreeState *state) {    char *outname;    IDL_tree interface = state->tree;    IDL_tree iterator = NULL;    char *interface_name =         subscriptIdentifier(state, IDL_IDENT(IDL_INTERFACE(interface).ident).str);    const char *iid = NULL;    GSList *doc_comments = IDL_IDENT(IDL_INTERFACE(interface).ident).comments;    char *prefix = IDL_GENTREE(IDL_NS(state->ns).current)._cur_prefix;    /*     * Each interface decl is a single file     */    outname = g_strdup_printf("%s.%s", interface_name, "java");    FILENAME(state) =  fopen(outname, "w");    if (!FILENAME(state)) {        perror("error opening output file");        return FALSE;    }    fputs("/*\n * ************* DO NOT EDIT THIS FILE ***********\n",          FILENAME(state));        fprintf(FILENAME(state),             " *\n * This file was automatically generated from %s.idl.\n",             state->basename);        fputs(" */\n\n", FILENAME(state));	    if (prefix) {        if (strlen(prefix))            fprintf(FILENAME(state), "\npackage %s;\n\n", prefix);        fputs("import org.mozilla.xpcom.*;\n\n", FILENAME(state));    } else {        fputs("\npackage org.mozilla.xpcom;\n\n", FILENAME(state));    }    /*     * Write out JavaDoc comment     */    fprintf(FILENAME(state), "\n/**\n * Interface %s\n", interface_name);#ifndef LIBIDL_MAJOR_VERSION    iid = IDL_tree_property_get(interface, "uuid");#else    iid = IDL_tree_property_get(IDL_INTERFACE(interface).ident, "uuid");#endif    if (iid != NULL) {        fprintf(FILENAME(state), " *\n * IID: 0x%s\n */\n\n", iid);    } else {        fputs(" */\n\n", FILENAME(state));    }    if (doc_comments != NULL)        printlist(FILENAME(state), doc_comments);    /*     * Write "public interface <foo>"     */    fprintf(FILENAME(state), "public interface %s ", interface_name);    /*     * Check for inheritence, and iterator over the inherited names,     * if any.     */    if ((iterator = IDL_INTERFACE(interface).inheritance_spec)) {        fputs("extends ", FILENAME(state));        do {            fprintf(FILENAME(state), "%s",                     IDL_IDENT(IDL_LIST(iterator).data).str);	                if (IDL_LIST(iterator).next) {                fputs(", ", FILENAME(state));            }        } while ((iterator = IDL_LIST(iterator).next));    }    fputs("\n{\n", FILENAME(state));        if (iid) {        /*         * Write interface constants for IID         *//*          fputs("    public static final String ", FILENAME(state)); */        /* XXX s.b just "IID" ? *//*          if (!write_classname_iid_define(FILENAME(state), interface_name)) { *//*              return FALSE; *//*          } *//*          fprintf(FILENAME(state), "_STRING =\n        \"%s\";\n\n", iid); *//*          fputs("    public static final nsID ", FILENAME(state)); */        /* XXX s.b just "IID" ? *//*          if (!write_classname_iid_define(FILENAME(state), interface_name)) { *//*              return FALSE; *//*          } *//*          fprintf(FILENAME(state), " =\n        new nsID(\"%s\");\n\n", iid); */        fprintf(FILENAME(state), "    public static final String IID =\n        \"%s\";\n\n", iid);    }    /*     * Advance the state of the tree, go on to process more     */        state->tree = IDL_INTERFACE(interface).body;    if (state->tree && !xpidl_process_node(state)) {        return FALSE;    }    fputs("\n}\n", FILENAME(state));    fprintf(FILENAME(state), "\n/*\n * end\n */\n");    fclose(FILENAME(state));    free(outname);    return TRUE;}