Beispiel #1
0
static void open_notation_action(lua_State * L) {
    luaL_newmetatable(L, notation_action_mt);
    lua_pushvalue(L, -1);
    lua_setfield(L, -2, "__index");
    setfuncs(L, notation_action_m, 0);

    SET_GLOBAL_FUN(notation_action_pred,   "is_notation_action");
    SET_GLOBAL_FUN(mk_skip_action,         "skip_notation_action");
    SET_GLOBAL_FUN(mk_binder_action,       "binder_notation_action");
    SET_GLOBAL_FUN(mk_binders_action,      "binders_notation_action");
    SET_GLOBAL_FUN(mk_expr_action,         "expr_notation_action");
    SET_GLOBAL_FUN(mk_exprs_action,        "exprs_notation_action");
    SET_GLOBAL_FUN(mk_scoped_expr_action,  "scoped_expr_notation_action");
    SET_GLOBAL_FUN(mk_ext_lua_action,      "ext_action");

    push_notation_action(L, mk_skip_action());
    lua_setglobal(L, "Skip");
    push_notation_action(L, mk_binder_action());
    lua_setglobal(L, "Binder");
    push_notation_action(L, mk_binders_action());
    lua_setglobal(L, "Binders");

    lua_newtable(L);
    SET_ENUM("Skip",        action_kind::Skip);
    SET_ENUM("Expr",        action_kind::Expr);
    SET_ENUM("Exprs",       action_kind::Exprs);
    SET_ENUM("Binder",      action_kind::Binder);
    SET_ENUM("Binders",     action_kind::Binders);
    SET_ENUM("ScopedExpr",  action_kind::ScopedExpr);
    SET_ENUM("Ext",         action_kind::Ext);
    SET_ENUM("LuaExt",      action_kind::LuaExt);
    lua_setglobal(L, "notation_action_kind");
}
Beispiel #2
0
int Printer_postScriptSettings (void) {
	static UiForm *dia;
	if (dia == NULL) {
		UiForm::UiField *radio;
		dia = new UiForm (theCurrentPraatApplication -> topShell, L"PostScript settings", DO_Printer_postScriptSettings, NULL, L"PostScript settings...", L"PostScript settings...");
		#if defined (_WIN32) || defined (macintosh)
			BOOLEAN (L"Allow direct PostScript", TRUE);
		#endif
		RADIO_ENUM (L"Grey resolution", kGraphicsPostscript_spots, DEFAULT)
		#if defined (UNIX)
			RADIO_ENUM (L"Paper size", kGraphicsPostscript_paperSize, DEFAULT);
			RADIO_ENUM (L"Orientation", kGraphicsPostscript_orientation, DEFAULT);
			POSITIVE (L"Magnification", L"1.0");
			LABEL (L"label", L"Print command:");
			#if defined (linux)
				TEXTFIELD (L"printCommand", L"lpr %s");
			#else
				TEXTFIELD (L"printCommand", L"lp -c %s");
			#endif
		#endif
		RADIO_ENUM (L"Font choice strategy", kGraphicsPostscript_fontChoiceStrategy, DEFAULT);
		#if defined (macintosh)
			BOOLEAN (L"EPS files include preview", TRUE);
		#endif
		dia->finish ();
	}
	#if defined (_WIN32) || defined (macintosh)
		SET_INTEGER (L"Allow direct PostScript", thePrinter. allowDirectPostScript);
	#endif
	SET_ENUM (L"Grey resolution", kGraphicsPostscript_spots, thePrinter. spots);
	#if defined (UNIX)
		SET_ENUM (L"Paper size", kGraphicsPostscript_paperSize, thePrinter. paperSize);
		SET_ENUM (L"Orientation", kGraphicsPostscript_orientation, thePrinter. orientation);
		SET_REAL (L"Magnification", thePrinter. magnification);
		SET_STRING (L"printCommand", Site_getPrintCommand ());
	#endif
	SET_ENUM (L"Font choice strategy", kGraphicsPostscript_fontChoiceStrategy, thePrinter. fontChoiceStrategy);
	#if defined (macintosh)
		SET_INTEGER (L"EPS files include preview", thePrinter. epsFilesHavePreview);
	#endif
	dia->do_ (false);
	return 1;
}
Beispiel #3
0
void open_parser(lua_State * L) {
    open_local_scope(L);

    lua_newtable(L);
    SET_FUN(parse_expr,            "parse_expr");
    SET_FUN(parse_level,           "parse_level");
    SET_FUN(parse_led,             "parse_led");
    SET_FUN(parse_binders,         "parse_binders");
    SET_FUN(parse_binder,          "parse_binder");
    SET_FUN(parse_scoped_expr,     "parse_scoped_expr");
    SET_FUN(lambda_abstract,       "lambda_abstract");
    SET_FUN(lambda_abstract,       "abstract");
    SET_FUN(next,                  "next");
    SET_FUN(curr,                  "curr");
    SET_FUN(curr_is_token,         "curr_is_token");
    SET_FUN(curr_is_token_or_id,   "curr_is_token_or_id");
    SET_FUN(curr_is_identifier,    "curr_is_identifier");
    SET_FUN(curr_is_numeral,       "curr_is_numeral");
    SET_FUN(curr_is_string,        "curr_is_string");
    SET_FUN(curr_is_keyword,       "curr_is_keyword");
    SET_FUN(curr_is_command,       "curr_is_command");
    SET_FUN(curr_is_quoted_symbol, "curr_is_quoted_symbol");
    SET_FUN(check_token_next,      "check_token_next");
    SET_FUN(check_id_next,         "check_id_next");
    SET_FUN(pos,                   "pos");
    SET_FUN(save_pos,              "save_pos");
    SET_FUN(pos_of,                "pos_of");
    SET_FUN(env,                   "env");
    SET_FUN(ios,                   "ios");
    lua_setglobal(L, "parser");

    lua_newtable(L);
    SET_ENUM("Keyword",         scanner::token_kind::Keyword);
    SET_ENUM("CommandKeyword",  scanner::token_kind::CommandKeyword);
    SET_ENUM("ScriptBlock",     scanner::token_kind::ScriptBlock);
    SET_ENUM("Identifier",      scanner::token_kind::Identifier);
    SET_ENUM("Numeral",         scanner::token_kind::Numeral);
    SET_ENUM("Decimal",         scanner::token_kind::Decimal);
    SET_ENUM("String",          scanner::token_kind::String);
    SET_ENUM("QuotedSymbol",    scanner::token_kind::QuotedSymbol);
    lua_setglobal(L, "token_kind");
}
Beispiel #4
0
static void menu_cb_soundScaling (TimeSoundEditor me, EDITOR_ARGS_FORM) {
	EDITOR_FORM (U"Sound scaling", nullptr)
		OPTIONMENU_ENUM (U"Scaling strategy", kTimeSoundEditor_scalingStrategy, my default_sound_scalingStrategy ())
		LABEL (U"", U"For \"fixed height\":");
		POSITIVE (U"Height", my default_sound_scaling_height ())
		LABEL (U"", U"For \"fixed range\":");
		REAL (U"Minimum", my default_sound_scaling_minimum ())
		REAL (U"Maximum", my default_sound_scaling_maximum ())
	EDITOR_OK
		SET_ENUM (U"Scaling strategy", kTimeSoundEditor_scalingStrategy, my p_sound_scalingStrategy)
		SET_REAL (U"Height", my p_sound_scaling_height)
		SET_REAL (U"Minimum", my p_sound_scaling_minimum)
		SET_REAL (U"Maximum", my p_sound_scaling_maximum)
	EDITOR_DO
		my pref_sound_scalingStrategy () = my p_sound_scalingStrategy = GET_ENUM (kTimeSoundEditor_scalingStrategy, U"Scaling strategy");
		my pref_sound_scaling_height  () = my p_sound_scaling_height  = GET_REAL (U"Height");
		my pref_sound_scaling_minimum () = my p_sound_scaling_minimum = GET_REAL (U"Minimum");
		my pref_sound_scaling_maximum () = my p_sound_scaling_maximum = GET_REAL (U"Maximum");
		FunctionEditor_redraw (me);
	EDITOR_END
}
Beispiel #5
0
static void menu_cb_ExtractSelectedSound_windowed (TimeSoundEditor me, EDITOR_ARGS_FORM) {
	EDITOR_FORM (U"Extract selected sound (windowed)", nullptr)
		WORD (U"Name", U"slice")
		OPTIONMENU_ENUM (U"Window shape", kSound_windowShape, my default_extract_windowShape ())
		POSITIVE (U"Relative width", my default_extract_relativeWidth ())
		BOOLEAN (U"Preserve times", my default_extract_preserveTimes ())
	EDITOR_OK
		SET_ENUM (U"Window shape", kSound_windowShape, my pref_extract_windowShape ())
		SET_REAL (U"Relative width", my pref_extract_relativeWidth ())
		SET_INTEGER (U"Preserve times", my pref_extract_preserveTimes ())
	EDITOR_DO
		Sound sound = my d_sound.data;
		Melder_assert (sound);
		my pref_extract_windowShape () = GET_ENUM (kSound_windowShape, U"Window shape");
		my pref_extract_relativeWidth () = GET_REAL (U"Relative width");
		my pref_extract_preserveTimes () = GET_INTEGER (U"Preserve times");
		autoSound extract = Sound_extractPart (sound, my d_startSelection, my d_endSelection, my pref_extract_windowShape (),
			my pref_extract_relativeWidth (), my pref_extract_preserveTimes ());
		Thing_setName (extract.peek(), GET_STRING (U"Name"));
		Editor_broadcastPublication (me, extract.transfer());
	EDITOR_END
}
Beispiel #6
0
void FCDEffectPassState::SetDefaultValue()
{

#define SET_VALUE(offset, valueType, actualValue) *((valueType*)(data + offset)) = actualValue;
#define SET_ENUM(offset, nameSpace, actualValue) *((uint32*)(data + offset)) = nameSpace::actualValue;

	switch ((uint32) type)
	{
	case FUDaePassState::ALPHA_FUNC:
		SET_ENUM(0, FUDaePassStateFunction, ALWAYS);
		SET_VALUE(4, float, 0.0f);
		break;

	case FUDaePassState::BLEND_FUNC:
		SET_ENUM(0, FUDaePassStateBlendType, ONE);
		SET_ENUM(4, FUDaePassStateBlendType, ZERO);
		break;

	case FUDaePassState::BLEND_FUNC_SEPARATE:
		SET_ENUM(0, FUDaePassStateBlendType, ONE);
		SET_ENUM(4, FUDaePassStateBlendType, ZERO);
		SET_ENUM(8, FUDaePassStateBlendType, ONE);
		SET_ENUM(12, FUDaePassStateBlendType, ZERO);
		break;

	case FUDaePassState::BLEND_EQUATION:
		SET_ENUM(0, FUDaePassStateBlendEquation, ADD);
		break;

	case FUDaePassState::BLEND_EQUATION_SEPARATE:
		SET_ENUM(0, FUDaePassStateBlendEquation, ADD);
		SET_ENUM(4, FUDaePassStateBlendEquation, ADD);
		break;

	case FUDaePassState::COLOR_MATERIAL:
		SET_ENUM(0, FUDaePassStateFaceType, FRONT_AND_BACK);
		SET_ENUM(4, FUDaePassStateMaterialType, AMBIENT_AND_DIFFUSE);
		break;

	case FUDaePassState::CULL_FACE:
		SET_ENUM(0, FUDaePassStateFaceType, BACK);
		break;

	case FUDaePassState::DEPTH_FUNC:
		SET_ENUM(0, FUDaePassStateFunction, ALWAYS);
		break;

	case FUDaePassState::FOG_MODE:
		SET_ENUM(0, FUDaePassStateFogType, EXP);
		break;

	case FUDaePassState::FOG_COORD_SRC:
		SET_ENUM(0, FUDaePassStateFogCoordinateType, FOG_COORDINATE);
		break;

	case FUDaePassState::FRONT_FACE:
		SET_ENUM(0, FUDaePassStateFrontFaceType, COUNTER_CLOCKWISE);
		break;

	case FUDaePassState::LIGHT_MODEL_COLOR_CONTROL:
		SET_ENUM(0, FUDaePassStateLightModelColorControlType, SINGLE_COLOR);
		break;

	case FUDaePassState::LOGIC_OP:
		SET_ENUM(0, FUDaePassStateLogicOperation, COPY);
		break;

	case FUDaePassState::POLYGON_MODE:
		SET_ENUM(0, FUDaePassStateFaceType, FRONT_AND_BACK);
		SET_ENUM(4, FUDaePassStatePolygonMode, FILL);
		break;

	case FUDaePassState::SHADE_MODEL:
		SET_ENUM(0, FUDaePassStateShadeModel, SMOOTH);
		break;

	case FUDaePassState::STENCIL_FUNC:
		SET_ENUM(0, FUDaePassStateFunction, ALWAYS);
		SET_VALUE(4, uint8, 0);
		SET_VALUE(5, uint8, 0xFF);
		break;

	case FUDaePassState::STENCIL_OP:
		SET_ENUM(0, FUDaePassStateStencilOperation, KEEP);
		SET_ENUM(4, FUDaePassStateStencilOperation, KEEP);
		SET_ENUM(8, FUDaePassStateStencilOperation, KEEP);
		break;

	case FUDaePassState::STENCIL_FUNC_SEPARATE:
		SET_ENUM(0, FUDaePassStateFunction, ALWAYS);
		SET_ENUM(4, FUDaePassStateFunction, ALWAYS);
		SET_VALUE(8, uint8, 0);
		SET_VALUE(9, uint8, 0xFF);
		break;

	case FUDaePassState::STENCIL_OP_SEPARATE:
		SET_ENUM(0, FUDaePassStateFaceType, FRONT_AND_BACK);
		SET_ENUM(4, FUDaePassStateStencilOperation, KEEP);
		SET_ENUM(8, FUDaePassStateStencilOperation, KEEP);
		SET_ENUM(12, FUDaePassStateStencilOperation, KEEP);
		break;

	case FUDaePassState::STENCIL_MASK_SEPARATE:
		SET_ENUM(0, FUDaePassStateFaceType, FRONT_AND_BACK);
		SET_VALUE(4, uint8, 0xFF);
		break;

	case FUDaePassState::LIGHT_ENABLE:
		SET_VALUE(0, uint8, 0);
		SET_VALUE(1, bool, false);
		break;

	case FUDaePassState::LIGHT_AMBIENT:
		SET_VALUE(0, uint8, 0);
		SET_VALUE(1, FMVector4, FMVector4(0,0,0,1));
		break;

	case FUDaePassState::LIGHT_DIFFUSE:
	case FUDaePassState::LIGHT_SPECULAR:
	case FUDaePassState::TEXTURE_ENV_COLOR:
	case FUDaePassState::CLIP_PLANE:
		SET_VALUE(0, uint8, 0);
		SET_VALUE(1, FMVector4, FMVector4::Zero);
		break;

	case FUDaePassState::LIGHT_POSITION:
		SET_VALUE(0, uint8, 0);
		SET_VALUE(1, FMVector4, FMVector4(0,0,1,0));
		break;

	case FUDaePassState::LIGHT_CONSTANT_ATTENUATION:
		SET_VALUE(0, uint8, 0);
		SET_VALUE(1, float, 1.0f);
		break;

	case FUDaePassState::LIGHT_LINEAR_ATTENUATION:
		SET_VALUE(0, uint8, 0);
		SET_VALUE(1, float, 0.0f);
		break;

	case FUDaePassState::LIGHT_QUADRATIC_ATTENUATION:
		SET_VALUE(0, uint8, 0);
		SET_VALUE(1, float, 0.0f);
		break;

	case FUDaePassState::LIGHT_SPOT_CUTOFF:
		SET_VALUE(0, uint8, 0);
		SET_VALUE(1, float, 180.0f);
		break;

	case FUDaePassState::LIGHT_SPOT_DIRECTION:
		SET_VALUE(0, uint8, 0);
		SET_VALUE(1, FMVector3, FMVector3(0,0,-1));
		break;

	case FUDaePassState::LIGHT_SPOT_EXPONENT:
		SET_VALUE(0, uint8, 0);
		SET_VALUE(1, float, 0.0f);
		break;

	case FUDaePassState::TEXTURE1D:
	case FUDaePassState::TEXTURE2D:
	case FUDaePassState::TEXTURE3D:
	case FUDaePassState::TEXTURECUBE:
	case FUDaePassState::TEXTURERECT:
	case FUDaePassState::TEXTUREDEPTH:
		SET_VALUE(0, uint8, 0);
		SET_VALUE(1, uint32, 0);
		break;

	case FUDaePassState::TEXTURE1D_ENABLE:
	case FUDaePassState::TEXTURE2D_ENABLE:
	case FUDaePassState::TEXTURE3D_ENABLE:
	case FUDaePassState::TEXTURECUBE_ENABLE:
	case FUDaePassState::TEXTURERECT_ENABLE:
	case FUDaePassState::TEXTUREDEPTH_ENABLE:
	case FUDaePassState::CLIP_PLANE_ENABLE:
		SET_VALUE(0, uint8, 0);
		SET_VALUE(1, bool, false);
		break;

	case FUDaePassState::TEXTURE_ENV_MODE:
		memset(data, 0, dataSize);
		break;

	case FUDaePassState::BLEND_COLOR:
	case FUDaePassState::CLEAR_COLOR:
	case FUDaePassState::FOG_COLOR:
	case FUDaePassState::SCISSOR:
		SET_VALUE(0, FMVector4, FMVector4::Zero);
		break;

	case FUDaePassState::LIGHT_MODEL_AMBIENT:
	case FUDaePassState::MATERIAL_AMBIENT:
		SET_VALUE(0, FMVector4, FMVector4(0.2f,0.2f,0.2f,1.0f));
		break;

	case FUDaePassState::MATERIAL_DIFFUSE:
		SET_VALUE(0, FMVector4, FMVector4(0.8f,0.8f,0.8f,1.0f));
		break;

	case FUDaePassState::MATERIAL_EMISSION:
	case FUDaePassState::MATERIAL_SPECULAR:
		SET_VALUE(0, FMVector4, FMVector4(0,0,0,1));
		break;

	case FUDaePassState::POINT_DISTANCE_ATTENUATION:
		SET_VALUE(0, FMVector3, FMVector3(1,0,0));
		break;

	case FUDaePassState::DEPTH_BOUNDS:
	case FUDaePassState::DEPTH_RANGE:
		SET_VALUE(0, FMVector2, FMVector2(0,1));
		break;

	case FUDaePassState::POLYGON_OFFSET:
		SET_VALUE(0, FMVector2, FMVector2(0,0));
		break;

	case FUDaePassState::DEPTH_MASK:
		SET_VALUE(0, bool, true);
		break;

	case FUDaePassState::CLEAR_STENCIL:
		SET_VALUE(0, uint32, 0);
		break;

	case FUDaePassState::STENCIL_MASK:
		SET_VALUE(0, uint32, 0xFFFFFFFF);
		break;

	case FUDaePassState::CLEAR_DEPTH:
	case FUDaePassState::FOG_DENSITY:
	case FUDaePassState::FOG_END:
	case FUDaePassState::LINE_WIDTH:
	case FUDaePassState::POINT_FADE_THRESHOLD_SIZE:
	case FUDaePassState::POINT_SIZE:
	case FUDaePassState::POINT_SIZE_MAX:
		SET_VALUE(0, float, 1.0f);
		break;

	case FUDaePassState::FOG_START:
	case FUDaePassState::MATERIAL_SHININESS:
	case FUDaePassState::POINT_SIZE_MIN:
		SET_VALUE(0, float, 0.0f);
		break;

	case FUDaePassState::COLOR_MASK:
		SET_VALUE(0, bool, true);
		SET_VALUE(1, bool, true);
		SET_VALUE(2, bool, true);
		SET_VALUE(3, bool, true);
		break;

	case FUDaePassState::LINE_STIPPLE:
		SET_VALUE(0, uint16, 1);
		SET_VALUE(2, uint16, 0xFF);
		break;

	case FUDaePassState::MODEL_VIEW_MATRIX:
	case FUDaePassState::PROJECTION_MATRIX:
		SET_VALUE(0, FMMatrix44, FMMatrix44::Identity);
		break;

	case FUDaePassState::LIGHTING_ENABLE:
	case FUDaePassState::ALPHA_TEST_ENABLE:
	case FUDaePassState::AUTO_NORMAL_ENABLE:
	case FUDaePassState::BLEND_ENABLE:
	case FUDaePassState::COLOR_LOGIC_OP_ENABLE:
	case FUDaePassState::CULL_FACE_ENABLE:
	case FUDaePassState::DEPTH_BOUNDS_ENABLE:
	case FUDaePassState::DEPTH_CLAMP_ENABLE:
	case FUDaePassState::DEPTH_TEST_ENABLE:
	case FUDaePassState::DITHER_ENABLE:
	case FUDaePassState::FOG_ENABLE:
	case FUDaePassState::LIGHT_MODEL_LOCAL_VIEWER_ENABLE:
	case FUDaePassState::LIGHT_MODEL_TWO_SIDE_ENABLE:
	case FUDaePassState::LINE_SMOOTH_ENABLE:
	case FUDaePassState::LINE_STIPPLE_ENABLE:
	case FUDaePassState::LOGIC_OP_ENABLE:
	case FUDaePassState::MULTISAMPLE_ENABLE:
	case FUDaePassState::NORMALIZE_ENABLE:
	case FUDaePassState::POINT_SMOOTH_ENABLE:
	case FUDaePassState::POLYGON_OFFSET_FILL_ENABLE:
	case FUDaePassState::POLYGON_OFFSET_LINE_ENABLE:
	case FUDaePassState::POLYGON_OFFSET_POINT_ENABLE:
	case FUDaePassState::POLYGON_SMOOTH_ENABLE:
	case FUDaePassState::POLYGON_STIPPLE_ENABLE:
	case FUDaePassState::RESCALE_NORMAL_ENABLE:
	case FUDaePassState::SAMPLE_ALPHA_TO_COVERAGE_ENABLE:
	case FUDaePassState::SAMPLE_ALPHA_TO_ONE_ENABLE:
	case FUDaePassState::SAMPLE_COVERAGE_ENABLE:
	case FUDaePassState::SCISSOR_TEST_ENABLE:
	case FUDaePassState::STENCIL_TEST_ENABLE:
		SET_VALUE(0, bool, false);
		break;

	case FUDaePassState::COLOR_MATERIAL_ENABLE:
		SET_VALUE(0, bool, true);
		break;

	case FUDaePassState::COUNT:
	case FUDaePassState::INVALID:
	default:
		FUFail(break);
	}

#undef SET_ENUM
#undef SET_VALUE
}