示例#1
0
//================================================================
// Name:				PrintSubClasses (private)
// Class:			ToolDocFileOutput
//
// Description:	Recursive function that prints all the passed classes
//						subclasses.
//
// Parameters:		ClassDef *in_class -- the class to print the subclasses of
//
// Returns:			None
//
//================================================================
void ToolDocFileOutput::PrintSubClasses(ClassDef *in_class, ClassDef *classlist)
{
	ClassDef *c;
	OutputClass(in_class);
	for( c = classlist->next; c != classlist; c = c->next )
	{
		if ( c->super == in_class )
			PrintSubClasses(c, classlist);
	}
}
示例#2
0
//================================================================
// Name:				OutputClasses
// Class:			DocFileOutput
//
// Description:	Loops through all the classes and calls OutputClass on each
//						(which will usually be a derived classes' version of it).
//
// Parameters:		ClassDef *classlist -- The list of classes to loop through
//
// Returns:			None
//
//================================================================
void DocFileOutput::OutputClasses(ClassDef *classlist)
{
	ClassDef *c;
	int num = 0;
	
	for( c = classlist->next; c != classlist; c = c->next )
	{
		if ( num < MAX_CLASSES )
		{
			OutputClass(c);
			num++;
		}
	}
}
示例#3
0
文件: typout.cpp 项目: mingpen/OpenNT
// For each library entry, creates a typeinfo in the typelib,
// and fills it in.
VOID NEAR OutputTypeInfos
(
    ICreateTypeLib FAR * lpdtlib
)
{
    LPENTRY	pEntry;
    TYPEKIND	tkind;
    HRESULT	res;
    ICreateTypeInfo FAR* lpdtinfo;
    WORD	wTypeFlags;

    // First allocate an array of ELEMDESCs to hold the max # of
    // args of any function we need to describe.
    rgFuncArgs = (ELEMDESC FAR*)_fmalloc(cArgsMax * sizeof(ELEMDESC));
    rgszFuncArgNames = (LPOLESTR FAR *)_fmalloc((cArgsMax+1) * sizeof(LPOLESTR));
    if (rgFuncArgs == NULL || rgszFuncArgNames == NULL)
	ParseError(ERR_OM);

    // pass 1 -- create the typeinfo's
    pEntry = (LPENTRY)ListFirst(typlib.pEntry);	// point to first entry
    for (;;)
	{

	    // determine if we are going to create a typeinfo for this guy
	    switch (pEntry->type.tentrykind)
		{
		case tTYPEDEF:
		    if (pEntry->attr.fAttr)	// create lpdtinfo only if
			break;			// this is a 'PUBLIC' typedef

NoTypeInfos:
		    pEntry->lpdtinfo = NULL;	// no lpdtinfo for this

		case tREF:			// no typeinfo's made for these
		case tINTRINSIC:
		    goto Next_Entry1;

		default:
		    // no typeinfo's made for forward declarations
		    if (pEntry->type.tentrykind & tFORWARD)
			goto NoTypeInfos;
		    if (pEntry->type.tentrykind & tIMPORTED)
			goto Next_Entry1;	// nothing for imported types
		    break;
		}

	    // 1. determine kind of typeinfo to create
	    tkind = rgtkind[pEntry->type.tentrykind];

	    // 2. Create type library entry (TypeInfo) of a given name/and
	    //    type, getting a pointer to the ICreateTypeInfo interface
	    SETITEMCUR(pEntry->type.szName);
	    CHECKRESULT(lpdtlib->CreateTypeInfo(ToW(pEntry->type.szName), tkind, &lpdtinfo));
	    pEntry->lpdtinfo = lpdtinfo;

	    // 3. Set the item's attributes:
	    if (pEntry->attr.fAttr & fUUID)
		CHECKRESULT(lpdtinfo->SetGuid(*pEntry->attr.lpUuid));

	    if (pEntry->attr.fAttr & fHELPSTRING)
		CHECKRESULT(lpdtinfo->SetDocString(ToW(pEntry->attr.lpszHelpString)));

	    if (pEntry->attr.fAttr & fHELPCONTEXT)
		CHECKRESULT(lpdtinfo->SetHelpContext(pEntry->attr.lHelpContext));

	    if (pEntry->attr.fAttr & fVERSION)
		CHECKRESULT(lpdtinfo->SetVersion(pEntry->attr.wVerMajor, pEntry->attr.wVerMinor));

	    // 4. save lptinfo for this guy in case somebody references it
	    CHECKRESULT(lpdtinfo->QueryInterface(IID_ITypeInfo, (VOID FAR* FAR*)&pEntry->type.lptinfo));

	    // if this type has a forward declaration
	    if (pEntry->lpEntryForward)
		{
		    // copy "real" type info over top of forward declaration,
		    // because folks have pointers to the forward declaration
		    pEntry->lpEntryForward->type.tdesc = pEntry->type.tdesc;
		    pEntry->lpEntryForward->type.lptinfo = pEntry->type.lptinfo;
		    // Only need to copy these 2 fields from the type (the
		    // others aren't referenced at type creation time.
		}

Next_Entry1:
	    // advance to next entry if not all done
	    if (pEntry == (LPENTRY)ListLast(typlib.pEntry))
		break;			// exit if all done
	    pEntry = (LPENTRY)pEntry->type.pNext;
	}


    // pass 2 -- process each entry
    pEntry = (LPENTRY)ListFirst(typlib.pEntry);	// point to first entry
    for (;;)
	{

	    // 1.  Get our lpdtinfo again if we have one

	    switch (pEntry->type.tentrykind)
		{
		case tREF:
		case tINTRINSIC:
		    goto Next_Entry2;	// these guys don't have lpdtinfo field
		default:
		    if (pEntry->type.tentrykind & tIMPORTED)
			goto Next_Entry2;	// no lpdtinfo field
		    break;
		}

	    lpdtinfo = pEntry->lpdtinfo;
	    if (lpdtinfo == NULL)	// skip if no lpdtinfo created
		goto Next_Entry2;	// (forward decl or non-public typedef)

	    // set up for error reporting
	    SETITEMCUR(pEntry->type.szName);

	    // 2. determine kind of typeinfo we're dealing with
	    tkind = rgtkind[pEntry->type.tentrykind];

	    // 2a. Set the typeinfo flags
	    wTypeFlags = 0;
	    if (tkind == TKIND_COCLASS) {
		// COCLASSs always have FCANCREATE bit set
		wTypeFlags |= TYPEFLAG_FCANCREATE;
		// these are only valid on COCLASSs
	        if (pEntry->attr.fAttr & fAPPOBJECT)
		    wTypeFlags |= (WORD)TYPEFLAG_FAPPOBJECT;
	        if (pEntry->attr.fAttr & fLICENSED)
		    wTypeFlags |= (WORD)TYPEFLAG_FLICENSED;
	        if (pEntry->attr.fAttr & fPREDECLID)
		    wTypeFlags |= (WORD)TYPEFLAG_FPREDECLID;
 	    }
	    if (pEntry->attr.fAttr & fHIDDEN)
		wTypeFlags |= (WORD)TYPEFLAG_FHIDDEN;
	    if (pEntry->attr.fAttr2 & f2CONTROL)
		wTypeFlags |= (WORD)TYPEFLAG_FCONTROL;
	    if (pEntry->attr.fAttr2 & f2NONEXTENSIBLE)
		wTypeFlags |= (WORD)TYPEFLAG_FNONEXTENSIBLE;
	    if (pEntry->attr.fAttr2 & f2DUAL) // DUAL implies OLEAUTOMATION
		wTypeFlags |= (WORD)(TYPEFLAG_FDUAL | TYPEFLAG_FOLEAUTOMATION);
	    if (pEntry->attr.fAttr2 & f2OLEAUTOMATION)
		wTypeFlags |= (WORD)TYPEFLAG_FOLEAUTOMATION;
	    CHECKRESULT(lpdtinfo->SetTypeFlags(wTypeFlags));

	    // 3. now process each kind of entry
	    switch (tkind)
		{
		case TKIND_ALIAS:
	
		    OutputAlias(lpdtinfo, pEntry->type.td.ptypeAlias);
		    break;

		case TKIND_RECORD: 	// struct's, enum's, and union's are
		case TKIND_ENUM:	// all very similar
		case TKIND_UNION:
		    OutputElems(lpdtinfo, pEntry->type.structenum.elemList, tkind);
		    break;

		case TKIND_MODULE:
		    OutputFuncs(lpdtinfo, pEntry, pEntry->module.funcList, tkind);
		    OutputElems(lpdtinfo, pEntry->module.constList, tkind);
		    break;

		case TKIND_INTERFACE:
		    OutputInterface(lpdtinfo, pEntry);
		    break;

		case TKIND_DISPATCH:
		    OutputDispinter(lpdtinfo, pEntry);
		    break;

		case TKIND_COCLASS:
		    OutputClass(lpdtinfo, pEntry);
		    break;

#if FV_PROPSET
		case TKIND_PROPSET:
		    // CONSIDER: (FV_PROPSET) do something with base_propset name
		    OutputElems(lpdtinfo, pEntry->propset.propList, tkind);
		    break;
#endif //FV_PROPSET
		default:
		    Assert(FALSE);
		};

            // 3a. Set the alignment for this TypeInfo.  Must be done before
	    // Layout().
            CHECKRESULT(lpdtinfo->SetAlignment(iAlignMax));

	    // 4. Compile this typeinfo we've just created.
	    SETITEMCUR(pEntry->type.szName);
	    CHECKRESULT(lpdtinfo->LayOut());

	    // 5. Cleanup.  All done with lpdtinfo.
	    lpdtinfo->Release();

Next_Entry2:
	    // advance to next entry if not all done
	    if (pEntry == (LPENTRY)ListLast(typlib.pEntry))
		break;			// exit if all done
	    pEntry = (LPENTRY)pEntry->type.pNext;
	}


    // now clean up everything else
    _ffree(rgFuncArgs);	 	// done with function args we allocated
    _ffree(rgszFuncArgNames);

}