1998-06-04 03:32:26 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The contents of this file are subject to the Netscape Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/NPL/
|
1998-06-04 03:32:26 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
1998-06-04 03:32:26 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
1998-06-04 03:32:26 +04:00
|
|
|
* Communications Corporation. Portions created by Netscape are
|
1999-11-06 06:40:37 +03:00
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
1998-06-04 03:32:26 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _JSStubGen_h__
|
|
|
|
#define _JSStubGen_h__
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include "plhash.h"
|
|
|
|
#include "FileGen.h"
|
|
|
|
|
1999-03-06 03:33:35 +03:00
|
|
|
#ifdef XP_MAC
|
|
|
|
#include <ostream.h> // required for namespace resolution
|
|
|
|
#else
|
1998-06-04 03:32:26 +04:00
|
|
|
class ofstream;
|
1999-03-06 03:33:35 +03:00
|
|
|
#endif
|
|
|
|
|
1998-06-04 03:32:26 +04:00
|
|
|
class IdlSpecification;
|
|
|
|
class IdlInterface;
|
|
|
|
class IdlAttribute;
|
|
|
|
|
|
|
|
class JSStubGen : public FileGen {
|
|
|
|
public:
|
|
|
|
JSStubGen();
|
1999-09-01 04:54:53 +04:00
|
|
|
virtual ~JSStubGen();
|
1998-06-04 03:32:26 +04:00
|
|
|
|
|
|
|
virtual void Generate(char *aFileName, char *aOutputDirName,
|
1998-07-03 04:48:06 +04:00
|
|
|
IdlSpecification &aSpec, int aIsGlobal);
|
1998-06-04 03:32:26 +04:00
|
|
|
|
|
|
|
friend PRIntn JSStubGen_IIDEnumerator(PLHashEntry *he,
|
|
|
|
PRIntn i,
|
|
|
|
void *arg);
|
|
|
|
friend PRIntn JSStubGen_DefPtrEnumerator(PLHashEntry *he,
|
|
|
|
PRIntn i,
|
|
|
|
void *arg);
|
|
|
|
|
|
|
|
protected:
|
1998-07-15 03:07:26 +04:00
|
|
|
enum {
|
|
|
|
JSSTUBGEN_PRIMARY,
|
|
|
|
JSSTUBGEN_NONPRIMARY,
|
1998-08-04 04:08:29 +04:00
|
|
|
JSSTUBGEN_DEFAULT,
|
1998-08-08 03:01:52 +04:00
|
|
|
JSSTUBGEN_DEFAULT_NONPRIMARY,
|
1999-12-22 04:48:47 +03:00
|
|
|
JSSTUBGEN_DEFAULT_ELLIPSIS,
|
|
|
|
JSSTUBGEN_DEFAULT_NONPRIMARY_ELLIPSIS,
|
1998-08-08 03:01:52 +04:00
|
|
|
JSSTUBGEN_NAMED_ITEM,
|
1999-12-22 04:48:47 +03:00
|
|
|
JSSTUBGEN_NAMED_ITEM_NONPRIMARY,
|
|
|
|
JSSTUBGEN_NAMED_ITEM_ELLIPSIS,
|
|
|
|
JSSTUBGEN_NAMED_ITEM_NONPRIMARY_ELLIPSIS
|
1998-07-15 03:07:26 +04:00
|
|
|
};
|
|
|
|
|
1998-06-04 03:32:26 +04:00
|
|
|
void GenerateIncludes(IdlSpecification &aSpec);
|
|
|
|
void GenerateIIDDefinitions(IdlSpecification &aSpec);
|
|
|
|
void GenerateDefPtrs(IdlSpecification &aSpec);
|
|
|
|
void GeneratePropertySlots(IdlSpecification &aSpec);
|
|
|
|
void GeneratePropertyFunc(IdlSpecification &aSpec, PRBool aIsGetter);
|
2000-02-23 01:08:36 +03:00
|
|
|
void GenerateCustomPropertyFuncs(IdlSpecification &aSpec);
|
1998-06-04 03:32:26 +04:00
|
|
|
void GenerateFinalize(IdlSpecification &aSpec);
|
|
|
|
void GenerateEnumerate(IdlSpecification &aSpec);
|
|
|
|
void GenerateResolve(IdlSpecification &aSpec);
|
|
|
|
void GenerateMethods(IdlSpecification &aSpec);
|
|
|
|
void GenerateJSClass(IdlSpecification &aSpec);
|
|
|
|
void GenerateClassProperties(IdlSpecification &aSpec);
|
|
|
|
void GenerateClassFunctions(IdlSpecification &aSpec);
|
|
|
|
void GenerateConstructor(IdlSpecification &aSpec);
|
|
|
|
void GenerateInitClass(IdlSpecification &aSpec);
|
|
|
|
void GenerateNew(IdlSpecification &aSpec);
|
|
|
|
|
|
|
|
void GeneratePropGetter(ofstream *file,
|
|
|
|
IdlInterface &aInterface,
|
1998-07-15 03:07:26 +04:00
|
|
|
IdlVariable &aAttribute,
|
|
|
|
PRInt32 aType);
|
1998-06-04 03:32:26 +04:00
|
|
|
void GeneratePropSetter(ofstream *file,
|
|
|
|
IdlInterface &aInterface,
|
|
|
|
IdlAttribute &aAttribute,
|
|
|
|
PRBool aIsPrimary);
|
1998-07-03 04:48:06 +04:00
|
|
|
|
|
|
|
int mIsGlobal;
|
1998-06-04 03:32:26 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _JSStubGen_h__
|