Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions | Variables
GenerateJavaInterfaces.cpp File Reference
#include "nsXPCOM.h"
#include "nsString.h"
#include "nsLocalFile.h"
#include "nsIInterfaceInfoManager.h"
#include "xptinfo.h"
#include "nsCOMPtr.h"
#include "prmem.h"
#include "xptcall.h"
#include "nsNetUtil.h"
#include "nsHashSets.h"
#include "nsIWeakReference.h"
#include <stdio.h>
#include <ctype.h>

Go to the source code of this file.

Classes

class  TypeInfo
class  Generate

Defines

#define WRITE_NOSCRIPT_METHODS

Functions

void PrintUsage (char **argv)
int main (int argc, char **argv)

Variables

static const char * kJavaKeywords []
static const char * kNoscriptMethodIfaces []

Define Documentation

Definition at line 56 of file GenerateJavaInterfaces.cpp.


Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 822 of file GenerateJavaInterfaces.cpp.

{
  nsresult rv = NS_OK;
  nsCOMPtr<nsILocalFile> output_dir;

  // handle command line arguments
  for (int i = 1; i < argc; i++) {
    if (argv[i][0] != '-') {
      rv = NS_ERROR_FAILURE;
      break;
    }

    switch (argv[i][1]) {
      case 'd': {
        if (i + 1 == argc) {
          fprintf(stderr, "ERROR: missing output directory after -d\n");
          rv = NS_ERROR_FAILURE;
          break;
        }

        // see if given path exists
        rv = NS_NewNativeLocalFile(nsDependentCString(argv[++i]), PR_TRUE,
                                   getter_AddRefs(output_dir));
        PRBool val;
        if (NS_FAILED(rv) || NS_FAILED(output_dir->Exists(&val)) || !val ||
            NS_FAILED(output_dir->IsDirectory(&val)) || !val)
        {
          fprintf(stderr,
                  "ERROR: output directory doesn't exist / isn't a directory\n");
          rv = NS_ERROR_FAILURE;
          break;
        }

        break;
      }

      default: {
        fprintf(stderr, "ERROR: unknown option %s\n", argv[i]);
        rv = NS_ERROR_FAILURE;
        break;
      }
    }
  }

  if (NS_FAILED(rv)) {
    PrintUsage(argv);
    return 1;
  }

  rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);
  NS_ENSURE_SUCCESS(rv, rv);

  Generate gen(output_dir);
  rv = gen.GenerateInterfaces();

  NS_ShutdownXPCOM(nsnull);
  return rv;
}

Here is the call graph for this function:

void PrintUsage ( char **  argv)

Definition at line 814 of file GenerateJavaInterfaces.cpp.

{
  static const char usage_str[] =
      "Usage: %s -d path\n"
      "         -d output directory for Java interface files\n";
  fprintf(stderr, usage_str, argv[0]);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

const char* kJavaKeywords[] [static]
Initial value:
 {
  "abstract", "default"  , "if"        , "private"     , "throw"       ,
  "boolean" , "do"       , "implements", "protected"   , "throws"      ,
  "break"   , "double"   , "import",     "public"      , "transient"   ,
  "byte"    , "else"     , "instanceof", "return"      , "try"         ,
  "case"    , "extends"  , "int"       , "short"       , "void"        ,
  "catch"   , "final"    , "interface" , "static"      , "volatile"    ,
  "char"    , "finally"  , "long"      , "super"       , "while"       ,
  "class"   , "float"    , "native"    , "switch"      ,
  "const"   , "for"      , "new"       , "synchronized",
  "continue", "goto"     , "package"   , "this"        ,
    
  "strictfp",
    
  "assert"  ,
    
  "enum"    ,
    
  "true"    , "false"    , "null"      ,
    
  "clone"   , "equals"   , "finalize"  , "getClass"    , "hashCode"    ,
  "notify"  , "notifyAll",  "wait"
}

Definition at line 150 of file GenerateJavaInterfaces.cpp.

const char* kNoscriptMethodIfaces[] [static]
Initial value:
 {
  "nsIBaseWindow", "nsIEmbeddingSiteWindow"
}

Definition at line 179 of file GenerateJavaInterfaces.cpp.