Beispiel #1
0
bool MCNativeControl::ParseBoolean(MCExecPoint& ep, bool& r_value)
{
	Boolean t_bool;
	if (!MCU_stob(ep.getsvalue(), t_bool))
	{
		MCeerror->add(EE_OBJECT_NAB, 0, 0, ep.getsvalue());
		return false;
	}
	r_value = t_bool == True;
	return true;
}
Beispiel #2
0
Exec_stat MCExecPoint::getboolean(Boolean &d, uint2 l, uint2 p, Exec_errors e)
{
	if (format == VF_UNDEFINED || format == VF_NUMBER
	        || !MCU_stob(svalue, d))
	{
		if (format == VF_UNDEFINED)
			clear();
		if (format == VF_NUMBER)
			tos();
		MCeerror->add(e, l, p, svalue);
		return ES_ERROR;
	}
	return ES_NORMAL;
}
void MCStack::mode_load(void)
{
	// We introduce the notion of an 'IDE' stack - such a stack is set by giving it
	// a custom property 'ideOverride' with value true.
	if (props != NULL)
	{
		MCAutoNameRef t_ide_override_name;
		/* UNCHECKED */ t_ide_override_name . CreateWithCString("ideOverride");

		MCExecPoint ep;
		MClockmessages++;
		getcustomprop(ep, kMCEmptyName, t_ide_override_name);
		MClockmessages--;

		Boolean t_treat_as_ide;
		if (MCU_stob(ep . getsvalue(), t_treat_as_ide) && t_treat_as_ide)
			setextendedstate(true, ECS_IDE);
	}
}
Exec_stat MCStack::mode_setprop(uint4 parid, Properties which, MCExecPoint &ep, const MCString &cprop, const MCString &carray, Boolean effective)
{
	switch(which)
	{
	case P_IDE_OVERRIDE:
		Boolean t_state;
		if (!MCU_stob(ep . getsvalue(), t_state))
		{
			MCeerror -> add(EE_OBJECT_NAB, 0, 0, ep . getsvalue());
			return ES_ERROR;
		}

		setextendedstate(t_state == True, ECS_IDE);
	break;

	default:
		return ES_NOT_HANDLED;
	}

	return ES_NORMAL;
}
Exec_stat MCProperty::mode_set(MCExecPoint& ep)
{
	switch(which)
	{
	case P_REV_CRASH_REPORT_SETTINGS:
		{
			MCVariableValue *t_settings;
			t_settings = ep . getarray();

			if (t_settings == NULL)
				break;

			MCExecPoint ep_key(ep);

			if (t_settings -> fetch_element(ep_key, "verbose") == ES_NORMAL)
				MCU_stob(ep_key . getsvalue(), MCcrashreportverbose);

			if (t_settings -> fetch_element(ep_key, "filename") == ES_NORMAL)
			{
				if (MCcrashreportfilename != NULL)
					delete MCcrashreportfilename;
				MCcrashreportfilename = ep_key . getsvalue() . getlength() > 0 ? ep_key . getsvalue() . clone() : NULL;
			}
		}
		break;

	case P_REV_LICENSE_LIMITS:
		{
			if(!MCenvironmentactive)
				break;

			MCVariableValue *t_settings = ep.getarray();

			if (t_settings == NULL)
				break;

			MCExecPoint ep_key(ep);

			if (t_settings -> fetch_element(ep_key, "token") == ES_NORMAL)
				MClicenseparameters . license_token = ep_key . getsvalue() . clone();

			if (t_settings -> fetch_element(ep_key, "name") == ES_NORMAL)
				MClicenseparameters . license_name = ep_key . getsvalue() . clone();

			if (t_settings -> fetch_element(ep_key, "organization") == ES_NORMAL)
				MClicenseparameters . license_organization = ep_key . getsvalue() . clone();

			if (t_settings -> fetch_element(ep_key, "class") == ES_NORMAL)
			{
				static struct { const char *tag; uint32_t value; } s_class_map[] =
				{
					{ "community", kMCLicenseClassCommunity },
					{ "commercial", kMCLicenseClassCommercial },
					{ "professional", kMCLicenseClassProfessional },
					{ NULL, kMCLicenseClassNone }
				};
				
				uint4 t_index;
				for(t_index = 0; s_class_map[t_index] . tag != NULL; ++t_index)
					if (ep_key . getsvalue() == s_class_map[t_index] . tag)
						break;

				MClicenseparameters . license_class = s_class_map[t_index] . value;
			}

			if (t_settings -> fetch_element(ep_key, "multiplicity") == ES_NORMAL && ep_key . ton() == ES_NORMAL)
				MClicenseparameters . license_multiplicity = ep_key . getuint4();

			if (t_settings -> fetch_element(ep_key, "scriptlimit") == ES_NORMAL && ep_key . ton() == ES_NORMAL)
				MClicenseparameters . script_limit = ep_key . getnvalue() <= 0 ? 0 : ep_key . getuint4();

			if (t_settings -> fetch_element(ep_key, "dolimit") == ES_NORMAL && ep_key . ton() == ES_NORMAL)
				MClicenseparameters . do_limit = ep_key . getnvalue() <= 0 ? 0 : ep_key . getuint4();

			if (t_settings -> fetch_element(ep_key, "usinglimit") == ES_NORMAL && ep_key . ton() == ES_NORMAL)
				MClicenseparameters . using_limit = ep_key . getnvalue() <= 0 ? 0 : ep_key . getuint4();

			if (t_settings -> fetch_element(ep_key, "insertlimit") == ES_NORMAL && ep_key . ton() == ES_NORMAL)
				MClicenseparameters . insert_limit = ep_key . getnvalue() <= 0 ? 0 : ep_key . getuint4();

			if (t_settings -> fetch_element(ep_key, "deploy") == ES_NORMAL)
			{
				static struct { const char *tag; uint32_t value; } s_deploy_map[] =
				{
					{ "windows", kMCLicenseDeployToWindows },
					{ "macosx", kMCLicenseDeployToMacOSX },
					{ "linux", kMCLicenseDeployToLinux },
					{ "ios", kMCLicenseDeployToIOS },
					{ "android", kMCLicenseDeployToAndroid },
					{ "winmobile", kMCLicenseDeployToWinMobile },
					{ "meego", kMCLicenseDeployToLinuxMobile },
					{ "server", kMCLicenseDeployToServer },
					{ "ios-embedded", kMCLicenseDeployToIOSEmbedded },
					{ "android-embedded", kMCLicenseDeployToIOSEmbedded },
				};

				MClicenseparameters . deploy_targets = 0;

				uint32_t t_target_count;
				char **t_targets;
				t_target_count = 0;
				t_targets = nil;
				if (MCCStringSplit(ep_key . getcstring(), ',', t_targets, t_target_count))
				{
					for(uint32_t i = 0; i < t_target_count; i++)
					{
						for(uint32_t j = 0; j < sizeof(s_deploy_map) / sizeof(s_deploy_map[0]); j++)
							if (MCCStringEqualCaseless(s_deploy_map[j] . tag, t_targets[i]))
							{
								MClicenseparameters . deploy_targets |= s_deploy_map[j] . value;
								break;
							}
					}
					MCCStringArrayFree(t_targets, t_target_count);
				}
			}

			if (t_settings -> fetch_element(ep_key, "addons") == ES_NORMAL && ep_key . getformat() == VF_ARRAY)
				MClicenseparameters . addons = new MCVariableValue(*(ep_key . getarray()));
		}
		break;

	case P_REV_MESSAGE_BOX_REDIRECT:
		{
			MCObject *t_object;
			t_object = getobj(ep);
			if (t_object != NULL)
				MCmessageboxredirect = t_object;
			else
				MCmessageboxredirect = NULL;
		}
		break;

#ifdef FEATURE_PROPERTY_LISTENER
	// MM-2012-11-06: [[ Property Listener ]]
	case P_REV_PROPERTY_LISTENER_THROTTLE_TIME:
		if (ep.getuint4(MCpropertylistenerthrottletime, line, pos, EE_OBJECT_NAN) != ES_NORMAL)
			return ES_ERROR;			
		break;
#endif
			
	default:
		return ES_NOT_HANDLED;
	}

	return ES_NORMAL;
}
Beispiel #6
0
// Parse the fonts folder (as set up by the standalone builder), locating any font files.
// For each font file found, attempt to parse using freetype and if successful, add to the custom font list.
// If particularly intensive, the parsing step could be moved to the IDE, which would just generate the required meta-data.
void MCAndroidCustomFontsLoad()
{    
    bool t_success;
    t_success = true;
    
    FT_Library t_ft_library;
    t_ft_library = nil;
    if (t_success)
        t_success = FT_Init_FreeType(&t_ft_library) == 0;
    
    char *t_file_list;
    t_file_list = nil;
    if (t_success)
    {
        MCAndroidEngineCall("getAssetFolderEntryList", "ss", &t_file_list, s_font_folder);
        t_success = t_file_list != nil;
    }
    
	char *t_next_entry;
	t_next_entry = t_file_list;
    MCAndroidCustomFont *t_last_font;
    t_last_font = s_custom_fonts;
	while (t_success && *t_next_entry != '\0')
	{
        char *t_file_name;
        t_file_name = nil;
        char *t_file_name_end;
        t_file_name_end = nil;        
        if (t_success)
        {
            t_file_name = t_next_entry;
            t_file_name_end = strchr(t_file_name, '\n');
            t_success = t_file_name_end != nil;
        }
        
        char *t_folder;
        t_folder = nil;
        if (t_success)
        {
			*t_file_name_end = '\0';            
			t_folder = strchr(t_file_name_end + 1, ',');
            t_success = t_folder != nil;
        }
        
        char *t_folder_end;
        t_folder_end = nil;
        if (t_success)
        {
            t_folder++;
			t_folder_end = strchr(t_folder, '\n');
            if (t_folder_end == nil)
                t_folder_end = strchr(t_folder, '\0');
            t_success = t_folder_end != nil;
        }
        
        Boolean t_is_folder;
        t_is_folder = false;
        if (t_success)
        {
            if (*t_folder_end != '\0')
                *t_folder_end++ = '\0';
            t_success = MCU_stob(t_folder, t_is_folder);
        }
        
        if (t_success)
            if (!t_is_folder)
            {
                MCAndroidCustomFont *t_font;
                t_font = nil;
                if (create_custom_font_from_path(t_file_name, t_ft_library, t_font))
                {
                    if (t_last_font == nil)
                        s_custom_fonts = t_font;
                    else
                        t_last_font->next = t_font;
                    t_last_font = t_font;
                }                
            }
        
        t_next_entry = t_folder_end;
	}
    
    if (t_ft_library != nil)
        FT_Done_FreeType(t_ft_library);
}