Example #1
0
/**
 * @brief Completes the second phase of Symbian object construction. 
 * Put initialization code that could leave here. 
 */ 
void CTap2MenuAppUi::ConstructL()
	{
	// [[[ begin generated region: do not modify [Generated Contents]
	ReadSettings();
	ReadExceptions();
	BaseConstructL( EAknEnableSkin  | 
					 EAknEnableMSK ); 
	InitializeContainersL();
	// ]]] end generated region [Generated Contents]
	
	iWinGroup=new (ELeave) RWindowGroup(CEikonEnv::Static()->WsSession());
	iWinGroup->Construct((TUint32)&iWinGroup, EFalse);
	iWinGroup->EnableReceiptOfFocus(EFalse); // Don't capture any key events.
	iWinGroup->SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront);
	
	CApaWindowGroupName* wn=CApaWindowGroupName::NewL(CEikonEnv::Static()->WsSession());
	wn->SetHidden(ETrue);
	wn->SetSystem(ETrue);
	wn->SetWindowGroupName(*iWinGroup);
	delete wn;
	iButton=CContainerButton::NewL(iWinGroup);
	iButton->SetSize(TSize(iSettings[4],iSettings[4]));
	iButton->SetPosition(TPoint(iSettings[0],iSettings[1]));
	iButton->MakeVisible(ETrue);
	CGulIcon* icon;
	const TUid KMenuUid=TUid::Uid(0x101f4cd2);
	TRAPD(erreasy,icon=LoadAppIconEasy(KMenuUid));
	if (erreasy==KErrNotFound)
		{
		CFbsBitmap*	AppIcon(NULL);
		CFbsBitmap*	AppIconMsk(NULL);
		AknIconUtils::CreateIconL(AppIcon,AppIconMsk,_L("\\resource\\apps\\Tap2Menu_aif.mif"), EMbmTap2menu_aifQgn_menu_tap2menu, EMbmTap2menu_aifQgn_menu_tap2menu_mask);
		AknIconUtils::SetSize(AppIcon,TSize(iSettings[4],iSettings[4]));
		AknIconUtils::SetSize(AppIconMsk,TSize(iSettings[4],iSettings[4]));
		icon=CGulIcon::NewL(AppIcon,AppIconMsk);
		}
	else if (erreasy!=KErrNone){TRAPD(errhard,icon=LoadAppIconHard(KMenuUid));}
	iButton->SetIcon(icon);
	iButton->MakeVisible(ETrue);
	iButton->DrawNow();
	iWsSession=new (ELeave) RWsSession();
	iWsSession->Connect();
	UpdateSettings();
	iObserver=CFgrObserver::NewL(*iWsSession,*this);
	CEikonEnv::Static()->RootWin().SetOrdinalPosition(-4);
	HideApplicationFromFSW(ETrue);
	}
Example #2
0
static void
createInternalClass0(CICcontext *context, ClassClass *cb, 
		     struct Hjava_lang_ClassLoader *loader, char *name)
{
    int i, j;
    union cp_item_type *constant_pool;
    unsigned char *type_table;
    int attribute_count;
    unsigned fields_count;
    struct methodblock *mb;
    struct fieldblock *fb;
    struct Classjava_lang_Class *ucb = unhand(cb);
    
    if (get4bytes(context) != JAVA_CLASSFILE_MAGIC) 
	JAVA_ERROR(context, "Bad magic number");

    ucb->minor_version = get2bytes(context);
    ucb->major_version = get2bytes(context);
    ucb->loader = loader;
    if (ucb->major_version != JAVA_VERSION) 
	JAVA_ERROR(context, "Bad major version number");

    LoadConstantPool(context);
    constant_pool = ucb->constantpool;
    type_table = constant_pool[CONSTANT_POOL_TYPE_TABLE_INDEX].type;

    ucb->access = get2bytes(context) & ACC_WRITTEN_FLAGS;

	/* Work around javac bug */
	if (ucb->access & ACC_INTERFACE) {
		ucb->access |= ACC_ABSTRACT;
	}


    /* Get the name of the class */
    i = get2bytes(context);	/* index in constant pool of class */
    ucb->name = getAscizFromClass(context, i);
    if (name != NULL && strcmp(ucb->name, name) != 0)
	JAVA_ERROR(context, "Wrong name");
    constant_pool[i].clazz = cb;
    CONSTANT_POOL_TYPE_TABLE_SET_RESOLVED(type_table, i);

    if (loader) { 
	/* We don't trust a classloader to do the right thing. . . */
	ClassClass **pcb, **end_pcb;
	char *name = ucb->name;
	if (name == NULL || !IsLegalClassname(name, FALSE)) {
	    JAVA_ERROR(context, "Bad name");
	}
	BINCLASS_LOCK();
	for (pcb = binclasses, end_pcb = pcb + nbinclasses; 
	         pcb < end_pcb; pcb++) { 
	    ClassClass *cb = *pcb;
	    if ((cbLoader(cb) == loader) && (strcmp(name, cbName(cb)) == 0))
	        break;
	}
	BINCLASS_UNLOCK();
	if (pcb < end_pcb)
	    /* There's already a class with the same name and loader */
	    JAVA_ERROR(context, "Duplicate name");
    }

    /* Get the super class name. */
    i = get2bytes(context);	/* index in constant pool of class */
    if (i > 0) {
	ucb->super_name = getAscizFromClass(context, i);
	if (!IsLegalClassname(ucb->super_name, FALSE)) { 
	    JAVA_ERROR(context, "Bad superclass name");
	}

    } 

    i = ucb->implements_count = get2bytes(context);
    if (i > 0) {
	int j;
	ucb->implements = allocNBytes(context, i * sizeof(short));
	for (j = 0; j < i; j++) {
	    ucb->implements[j] = get2bytes(context);
	}
    }

    fields_count = ucb->fields_count = get2bytes(context);
    if (fields_count > 0) 
        ucb->fields = (struct fieldblock *)
	    allocNBytes(context, ucb->fields_count * sizeof(struct fieldblock));
    for (i = fields_count, fb = ucb->fields; --i >= 0; fb++) {
	fieldclass(fb) = cb;
	fb->access = get2bytes(context) & ACC_WRITTEN_FLAGS;
	fb->name = getAsciz(context);
	fb->signature = getAsciz(context);
	attribute_count = get2bytes(context);
	for (j = 0; j < (int)attribute_count; j++) {
	    char *name = getAsciz(context);
	    int length = get4bytes(context);
	    if ((fb->access & ACC_STATIC) 
		 && strcmp(name, "ConstantValue") == 0) {
		if (length != 2) 
		    JAVA_ERROR(context, "Wrong size for VALUE attribute");
		fb->access |= ACC_VALKNOWN;
		/* we'll change this below */
		fb->u.offset = get2bytes(context); 
	    } else {
		getNbytes(context, length, NULL);
	    }
	}
	/*
	if (fb->access & ACC_STATIC) {
	    InitializeStaticVar(fb, context);
	}
	*/
    }

    if ((ucb->methods_count = get2bytes(context)) > 0) 
	ucb->methods = (struct methodblock *)
	  allocNBytes(context, ucb->methods_count * sizeof(struct methodblock));
    for (i = cbMethodsCount(cb), mb = cbMethods(cb); --i >= 0; mb++) {
	fieldclass(&mb->fb) = cb;
	mb->fb.access = get2bytes(context) & ACC_WRITTEN_FLAGS;
	mb->fb.name = getAsciz(context);
	mb->fb.signature = getAsciz(context);

	if (strcmp(mb->fb.name, "<clinit>") == 0 &&
	    strcmp(mb->fb.signature, "()V") == 0)
	    context->in_clinit = TRUE;

	mb->args_size = Signature2ArgsSize(mb->fb.signature) 
	                + ((mb->fb.access & ACC_STATIC) ? 0 : 1);
	if (mb->args_size > 255)
	    JAVA_ERROR(context, "Too many arguments");
	attribute_count = get2bytes(context);
	for (j = 0; j < attribute_count; j++) {
	    char *attr_name = getAsciz(context);
            if ((strcmp(attr_name, "Code") == 0) 
		       && ((mb->fb.access & (ACC_NATIVE | ACC_ABSTRACT))==0)) {
		ReadInCode(context, mb);
	    } else if (strcmp(attr_name, "Exceptions") == 0) {
		ReadExceptions(context, mb);
	    } else {
		int length = get4bytes(context);
		getNbytes(context, length, NULL);
	    }
	}
	context->in_clinit = FALSE;
    }

    /* See if there are class attributes */
    attribute_count = get2bytes(context); 
    for (j = 0; j < attribute_count; j++) {
	char *name = getAsciz(context);
	int length = get4bytes(context);
	if (strcmp(name, "SourceFile") == 0) {
	    if (length != 2) {
		JAVA_ERROR(context, "Wrong size for VALUE attribute");
	    }
	    ucb->source_name = getAsciz(context);
#ifdef JCOV
	} else if (strcmp(name, "AbsoluteSourcePath") == 0) {
	    if (length == 2) {
	    	ucb->absolute_source_name = getAsciz(context);
	    } else
		getNbytes(context, length, NULL);
	} else if (strcmp(name, "TimeStamp") == 0) {
	    unsigned high;
	    unsigned low;
	    int64_t  value;
	    Java8    t1;

	    if (length == 8) {
		high = get4bytes(context);
		low  = get4bytes(context);
	    	value = ll_add(ll_shl(uint2ll(high), 32), uint2ll(low));
	    	SET_INT64(t1, &ucb->timestamp, value);
	    } else 
	    	getNbytes(context, length, NULL);
#endif
	} else {
	    getNbytes(context, length, NULL);
	}
    }
}