diff --git a/mozilla/config/autoconf.mk.in b/mozilla/config/autoconf.mk.in index 036c3d623df..8a42dd45b23 100644 --- a/mozilla/config/autoconf.mk.in +++ b/mozilla/config/autoconf.mk.in @@ -42,6 +42,7 @@ SMART_MAIL = @MOZ_SMART_MAIL@ DOM = @MOZ_DOM@ MOZ_MAIL_COMPOSE = @MOZ_MAIL_COMPOSE@ NO_UNIX_LDAP = @NO_UNIX_LDAP@ +BUILD_IDL_TOOL = @MOZ_IDL_TOOL@ MOZ_NATIVE_ZLIB = @SYSTEM_ZLIB@ MOZ_NATIVE_JPEG = @SYSTEM_JPEG@ diff --git a/mozilla/configure.in b/mozilla/configure.in index 7a96e6aed38..91e08d6da8f 100644 --- a/mozilla/configure.in +++ b/mozilla/configure.in @@ -505,6 +505,12 @@ AC_ARG_ENABLE(ldap, NO_UNIX_LDAP= fi] ) +AC_ARG_ENABLE(idltool, +[ --enable-idltool build idl tool (default=no) ], + [if test "$enableval" = "yes"; then + MOZ_IDL_TOOL=1 + fi] ) + AC_SUBST(OS_TARGET) AC_SUBST(MOZ_TOOLKIT) AC_SUBST(MOZ_SECURITY) @@ -526,6 +532,7 @@ AC_SUBST(MOZ_DOM) AC_SUBST(MOZ_MAIL_COMPOSE) AC_SUBST(FULL_STATIC_BUILD) AC_SUBST(NO_UNIX_LDAP) +AC_SUBST(MOZ_IDL_TOOL) dnl Checks for X libraries. dnl Ordering is important. diff --git a/mozilla/dom/Makefile.in b/mozilla/dom/Makefile.in index b8c9041ff5b..f8342c07321 100644 --- a/mozilla/dom/Makefile.in +++ b/mozilla/dom/Makefile.in @@ -23,6 +23,9 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk DIRS = public src +ifdef BUILD_IDL_TOOL +DIRS += tools +endif include $(topsrcdir)/config/config.mk diff --git a/mozilla/dom/tools/Exceptions.cpp b/mozilla/dom/tools/Exceptions.cpp index 3c6fec0d060..14c79efa0d5 100644 --- a/mozilla/dom/tools/Exceptions.cpp +++ b/mozilla/dom/tools/Exceptions.cpp @@ -80,7 +80,11 @@ AbortParser::AbortParser(char *aFileName, long aLineNumber) strcat(message, aFileName); strcat(message, ". Line Number: "); +#ifdef XP_UNIX + sprintf(lineNumber,"%d",aLineNumber); +#else itoa(aLineNumber, lineNumber, 10); +#endif strcat(message, lineNumber); SetMessage(message); diff --git a/mozilla/dom/tools/IdlParser.cpp b/mozilla/dom/tools/IdlParser.cpp index 07906b213fe..a6d30092c95 100644 --- a/mozilla/dom/tools/IdlParser.cpp +++ b/mozilla/dom/tools/IdlParser.cpp @@ -834,13 +834,25 @@ IdlParameter* IdlParser::ParseFunctionParameter(IdlSpecification &aSpecification switch(token->id) { // base type case INPUT_PARAM_TOKEN: +#ifdef XP_UNIX + argObj->SetAttribute(IdlParameter::INPUT); +#else argObj->SetAttribute(IdlParameter.INPUT); +#endif break; case OUTPUT_PARAM_TOKEN: +#ifdef XP_UNIX + argObj->SetAttribute(IdlParameter::OUTPUT); +#else argObj->SetAttribute(IdlParameter.OUTPUT); +#endif break; case INOUT_PARAM_TOKEN: +#ifdef XP_UNIX + argObj->SetAttribute(IdlParameter::INOUT); +#else argObj->SetAttribute(IdlParameter.INOUT); +#endif break; default: delete argObj; @@ -924,3 +936,6 @@ void IdlParser::TrimComments() mScanner->NextToken(); } } + + + diff --git a/mozilla/dom/tools/IdlVariable.h b/mozilla/dom/tools/IdlVariable.h index 6563b3f5652..548916c2bd0 100644 --- a/mozilla/dom/tools/IdlVariable.h +++ b/mozilla/dom/tools/IdlVariable.h @@ -19,6 +19,10 @@ #ifndef _IdlVariable_h__ #define _IdlVariable_h__ +#ifdef XP_UNIX +#include +#endif + #include "IdlObject.h" enum Type { @@ -56,7 +60,7 @@ public: void SetType(Type aType); Type GetType(); void SetTypeName(char *aTypeName); - char* GetTypeName(); + char* GetTypeName(void); void GetTypeAsString(char *aString, size_t aStringSize); void SetValue(unsigned long aValue); diff --git a/mozilla/dom/tools/JSStubGen.cpp b/mozilla/dom/tools/JSStubGen.cpp index 8dcd585e89b..a0a635e0277 100644 --- a/mozilla/dom/tools/JSStubGen.cpp +++ b/mozilla/dom/tools/JSStubGen.cpp @@ -18,7 +18,9 @@ #include #include +#ifndef XP_UNIX #include +#endif #include #include #include "nsIPtr.h" diff --git a/mozilla/dom/tools/Makefile.in b/mozilla/dom/tools/Makefile.in index e319835aca5..806662d1a24 100644 --- a/mozilla/dom/tools/Makefile.in +++ b/mozilla/dom/tools/Makefile.in @@ -24,42 +24,58 @@ include $(DEPTH)/config/autoconf.mk include $(topsrcdir)/config/config.mk -PROGRAM = idlc -CPPSRCS = \ - main.cpp \ - IdlParser.cpp \ - IdlScanner.cpp \ - Exceptions.cpp \ - Id.cppect.cpp \ - IdlVariable.cpp \ - IdlAttribute.cpp \ - IdlEnum.cpp \ - IdlFunction.cpp \ - IdlInterface.cpp \ - IdlParameter.cpp \ - IdlSpecification.cpp \ - FileGen.cpp \ - XPCOMGen.cpp \ - JSStubGen.cpp \ - $(NULL) +CPPSRCS = \ + main.cpp \ + IdlParser.cpp \ + IdlScanner.cpp \ + Exceptions.cpp \ + IdlObject.cpp \ + IdlVariable.cpp \ + IdlAttribute.cpp \ + IdlEnum.cpp \ + IdlFunction.cpp \ + IdlInterface.cpp \ + IdlParameter.cpp \ + IdlSpecification.cpp \ + FileGen.cpp \ + XPCOMGen.cpp \ + JSStubGen.cpp \ + $(NULL) OBJS = $(CPPSRCS:.cpp=.o) -EX_LIBS = \ - $(NULL) +PROGS = $(OBJDIR)/idlc + +TARGETS = $(PROGS) + +INCLUDES += \ + -I$(PUBLIC)/raptor \ + -I$(PUBLIC)/xpcom \ + $(NULL) + +EX_LIBS = \ + -L$(DIST)/bin \ + -lraptorbase -NON_DIRS = $(PROGS) -TARGETS = $(NON_DIRS) include $(topsrcdir)/config/rules.mk -$(OBJDIR)/%.o: %.cpp +$(PROGS): $(OBJS) # $(EX_LIBS) @$(MAKE_OBJDIR) - $(CCC) -o $@ $(CFLAGS) -DUSE_NSREG -c $< +ifeq ($(OS_ARCH),Linux) + $(CCC) -rdynamic -o $@ $(OBJS) $(LDFLAGS) $(EX_LIBS) $(NSPR_LIBS) $(TOOLKIT_LIBS) $(OS_LIBS) +else +ifeq ($(OS_ARCH),IRIX) + $(CCC) -o $@ -woff 84,85 $(LDFLAGS) $(OBJS) $(EX_LIBS) $(NSPR_LIBS) $(TOOLKIT_LIBS) $(OS_LIBS) +else + $(CCC) -o $@ $(LDFLAGS) $(OBJS) $(EX_LIBS) $(NSPR_LIBS) $(TOOLKIT_LIBS) $(OS_LIBS) +endif +endif export:: -install:: $(PROGRAM) - $(INSTALL) $(PROGRAM) $(DIST)/bin +install:: $(TARGETS) + $(INSTALL) $(PROGS) $(DIST)/bin + diff --git a/mozilla/dom/tools/XPCOMGen.cpp b/mozilla/dom/tools/XPCOMGen.cpp index 4aea96ccd46..2eb51bb6124 100644 --- a/mozilla/dom/tools/XPCOMGen.cpp +++ b/mozilla/dom/tools/XPCOMGen.cpp @@ -18,10 +18,12 @@ #include #include +#ifndef XP_UNIX #include +#endif #include #include -#include "XPComGen.h" +#include "XPCOMGen.h" #include "Exceptions.h" #include "plhash.h" #include "IdlSpecification.h" diff --git a/mozilla/dom/tools/main.cpp b/mozilla/dom/tools/main.cpp index 113194e74c3..b4d10732286 100644 --- a/mozilla/dom/tools/main.cpp +++ b/mozilla/dom/tools/main.cpp @@ -21,7 +21,9 @@ #include "string.h" #include #include +#ifndef XP_UNIX #include +#endif #include "IdlParser.h" #include "Exceptions.h" #include "IdlSpecification.h" @@ -66,9 +68,17 @@ int main(int argc, char *argv[]) if (op_dir) { struct stat sb; if (stat(argv[op_dir_arg], &sb) == 0) { +#ifdef XP_UNIX + if (!(sb.st_mode & S_IFDIR)) { +#else if (!(sb.st_mode & _S_IFDIR)) { +#endif cout << "Creating directory " << argv[op_dir_arg] << " ...\n"; +#ifdef XP_UNIX + if (mkdir(argv[op_dir_arg],S_IWGRP | S_IWOTH) < 0) { +#else if (mkdir(argv[op_dir_arg]) < 0) { +#endif cout << "WARNING: cannot create output directory [" << argv[op_dir_arg] << "]\n"; cout << "++++++++ using current directory\n"; } @@ -107,7 +117,7 @@ int main(int argc, char *argv[]) cout << "Generating XPCOM headers for " << argv[i] << ".\n"; try { - xpcomgen->Generate(argv[i], op_dir ? argv[op_dir_arg] : NULL, + xpcomgen->Generate(argv[i], op_dir ? argv[op_dir_arg] :(char*)NULL, *specification, is_global); } catch(CantOpenFileException &exc) { @@ -124,7 +134,7 @@ int main(int argc, char *argv[]) cout << "Generating JavaScript stubs for " << argv[i] << ".\n"; try { - jsgen->Generate(argv[i], op_dir ? argv[op_dir_arg] : NULL, + jsgen->Generate(argv[i], op_dir ? argv[op_dir_arg] : (char*)NULL, *specification, is_global); } catch(CantOpenFileException &exc) {