pjs/xpcom/tools/xpidl/xpidl.h

122 строки
3.0 KiB
C
Исходник Обычный вид История

/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* Intramodule declarations.
*/
1998-11-24 00:02:31 +03:00
#ifndef __xpidl_h
#define __xpidl_h
1999-02-17 04:17:52 +03:00
#include <assert.h>
#include <errno.h>
1998-11-24 00:02:31 +03:00
#include <stddef.h>
#include <stdio.h>
1999-02-17 04:17:52 +03:00
#include <stdlib.h>
1998-11-24 00:02:31 +03:00
#include <string.h>
1999-02-17 04:17:52 +03:00
#include <glib.h>
1998-11-24 00:02:31 +03:00
#include <libIDL/IDL.h>
/*
* Internal operation flags.
*/
extern gboolean enable_debug;
extern gboolean enable_warnings;
extern gboolean verbose_mode;
typedef struct TreeState TreeState;
1998-11-24 00:02:31 +03:00
/*
* A function to handle an IDL_tree type.
*/
typedef gboolean (*nodeHandler)(TreeState *);
/* Function that produces a table of nodeHandlers for a given mode */
typedef nodeHandler *(*nodeHandlerFactory)();
1998-11-24 00:02:31 +03:00
1999-02-17 04:17:52 +03:00
extern nodeHandler *xpidl_header_dispatch(void);
extern nodeHandler *xpidl_stub_dispatch(void);
extern nodeHandler *xpidl_typelib_dispatch(void);
extern nodeHandler *xpidl_doc_dispatch(void);
1998-11-24 00:02:31 +03:00
/*
* nodeHandler that reports an error.
*/
gboolean node_is_error(TreeState *state);
typedef struct ModeData {
char *mode;
char *modeInfo;
char *suffix;
nodeHandlerFactory factory;
} ModeData;
typedef struct IncludePathEntry {
char *directory;
struct IncludePathEntry *next;
} IncludePathEntry;
struct TreeState {
FILE *file;
char *basename;
IDL_ns ns;
IDL_tree tree;
GHashTable *includes;
IncludePathEntry *include_path;
nodeHandler *dispatch;
void *priv; /* mode-private data */
};
1998-11-24 00:02:31 +03:00
/*
* Process an IDL file, generating InterfaceInfo, documentation and headers as
1998-11-24 00:02:31 +03:00
* appropriate.
*/
int
xpidl_process_idl(char *filename, IncludePathEntry *include_path,
char *basename, ModeData *mode);
1998-11-24 00:02:31 +03:00
/*
* Iterate over an IDLN_LIST -- why is this not part of libIDL?
*/
void
xpidl_list_foreach(IDL_tree p, IDL_tree_func foreach, gpointer user_data);
1998-11-24 00:02:31 +03:00
/*
1999-02-16 08:10:40 +03:00
* Wrapper whines to stderr then exits after null return from malloc or strdup.
1998-11-24 00:02:31 +03:00
*/
1999-02-16 08:10:40 +03:00
void *
xpidl_malloc(size_t nbytes);
1998-11-24 00:02:31 +03:00
1999-02-16 08:10:40 +03:00
char *
xpidl_strdup(const char *s);
1998-11-24 00:02:31 +03:00
1999-02-16 08:10:40 +03:00
/*
* Process an XPIDL node and its kids, if any.
*/
gboolean
1999-02-16 08:10:40 +03:00
xpidl_process_node(TreeState *state);
1999-02-17 04:17:52 +03:00
/*
* Write a newline folllowed by an indented, one-line comment containing IDL
* source decompiled from state->tree.
1999-02-17 04:17:52 +03:00
*/
void
xpidl_write_comment(TreeState *state, int indent);
1999-02-17 04:17:52 +03:00
1998-11-24 00:02:31 +03:00
#endif /* __xpidl_h */