Ejemplo n.º 1
0
 EXPORT const uint8_t*
 bootJar(unsigned* size)
 {
   *size = SYMBOL(end) - SYMBOL(start);
  return SYMBOL(start);
 }
Ejemplo n.º 2
0
void Fcoerce(CL_FORM *base)
{
	if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 28))	/* LIST */
	{
		if(CL_LISTP(ARG(0)))
		{
		}
		else
		{
			LOAD_SYMBOL(SYMBOL(Slisp, 28), ARG(2));	/* LIST */
			COPY(ARG(0), ARG(3));
			Fconcatenate(ARG(2), 2);
			COPY(ARG(2), ARG(0));
		}
	}
	else
	{
		if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 40))	/* SIMPLE-STRING */
		{
			if(CL_SMSTRP(ARG(0)))
			{
			}
			else
			{
				LOAD_SYMBOL(SYMBOL(Slisp, 40), ARG(2));	/* SIMPLE-STRING */
				COPY(ARG(0), ARG(3));
				Fconcatenate(ARG(2), 2);
				COPY(ARG(2), ARG(0));
			}
		}
		else
		{
			if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 44))	/* STRING */
			{
				COPY(ARG(0), ARG(2));
				Fstringp(ARG(2));
				if(CL_TRUEP(ARG(2)))
				{
				}
				else
				{
					LOAD_SYMBOL(SYMBOL(Slisp, 44), ARG(2));	/* STRING */
					COPY(ARG(0), ARG(3));
					Fconcatenate(ARG(2), 2);
					COPY(ARG(2), ARG(0));
				}
			}
			else
			{
				if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 41))	/* SIMPLE-VECTOR */
				{
					if(CL_SMVEC_T_P(ARG(0)))
					{
					}
					else
					{
						LOAD_SYMBOL(SYMBOL(Slisp, 41), ARG(2));	/* SIMPLE-VECTOR */
						COPY(ARG(0), ARG(3));
						Fconcatenate(ARG(2), 2);
						COPY(ARG(2), ARG(0));
					}
				}
				else
				{
					if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 47))	/* VECTOR */
					{
						LOAD_BOOL(CL_SMVECP(ARG(0)), ARG(2));
						if(CL_TRUEP(ARG(2)))
						{
							goto THEN1;
						}
						else
						{
							COPY(ARG(0), ARG(3));
							LOAD_SYMBOL(SYMBOL(Slisp, 150), ARG(4));	/* COMPLEX-VECTOR */
							rt_struct_typep(ARG(3));
						}
						if(CL_TRUEP(ARG(3)))
						{
							THEN1:;
						}
						else
						{
							LOAD_SYMBOL(SYMBOL(Slisp, 47), ARG(2));	/* VECTOR */
							COPY(ARG(0), ARG(3));
							Fconcatenate(ARG(2), 2);
							COPY(ARG(2), ARG(0));
						}
					}
					else
					{
						if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 18))	/* CHARACTER */
						{
							Fcharacter(ARG(0));
						}
						else
						{
							LOAD_BOOL(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 24), ARG(2));	/* FLOAT */
							if(CL_TRUEP(ARG(2)))
							{
								goto THEN2;
							}
							else
							{
								LOAD_BOOL(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 37), ARG(3));	/* SHORT-FLOAT */
								if(CL_TRUEP(ARG(3)))
								{
									goto THEN2;
								}
								else
								{
									LOAD_BOOL(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 42), ARG(4));	/* SINGLE-FLOAT */
									if(CL_TRUEP(ARG(4)))
									{
										goto THEN2;
									}
									else
									{
										LOAD_BOOL(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 22), ARG(5));	/* DOUBLE-FLOAT */
										if(CL_TRUEP(ARG(5)))
										{
											goto THEN2;
										}
										else
										{
										}	/* LONG-FLOAT */
									}
								}
							}
							if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 29))
							{
								THEN2:;
								LOAD_NIL(ARG(1));
								float1(ARG(0));
							}
							else
							{
								if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 48))	/* T */
								{
								}
								else
								{
									LOAD_SMSTR((CL_FORM *)&KClisp[112], ARG(0));	/* cannot coerce to ~S */
									Ferror(ARG(0), 2);
								}
							}
						}
					}
				}
			}
		}
	}
}
Ejemplo n.º 3
0
void make_dispatch_macro_character1(CL_FORM *base)
{
    LOAD_FIXNUM(ARG(3), 256, ARG(3));
    LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(4));	/* T */
    LOAD_NIL(ARG(5));
    LOAD_NIL(ARG(6));
    LOAD_NIL(ARG(7));
    LOAD_NIL(ARG(8));
    LOAD_NIL(ARG(9));
    LOAD_FIXNUM(ARG(10), 0, ARG(10));
    LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(11));	/* T */
    LOAD_NIL(ARG(12));
    LOAD_NIL(ARG(13));
    make_array1(ARG(3));
    GEN_HEAPVAR(ARG(3), ARG(4));
    COPY(ARG(2), ARG(4));
    LOAD_SYMBOL(SYMBOL(Slisp, 420), ARG(5));	/* READTABLE */
    rt_struct_typep(ARG(4));
    if(CL_TRUEP(ARG(4)))
    {
        COPY(OFFSET(AR_BASE(GET_FORM(ARG(2))), 0 + 1), ARG(4));
    }
    else
    {
        COPY(SYMVAL(Slisp, 352), ARG(4));	/* NO_STRUCT */
        COPY(ARG(2), ARG(5));
        LOAD_SYMBOL(SYMBOL(Slisp, 420), ARG(6));	/* READTABLE */
        Ferror(ARG(4), 3);
    }
    if(CL_CHARP(ARG(0)))
    {
    }
    else
    {
        COPY(SYMVAL(Slisp, 58), ARG(5));	/* WRONG_TYPE */
        COPY(ARG(0), ARG(6));
        LOAD_SYMBOL(SYMBOL(Slisp, 18), ARG(7));	/* CHARACTER */
        Ferror(ARG(5), 3);
    }
    COPY(ARG(0), ARG(5));
    rt_char_code(ARG(5));
    {
        GEN_CLOSURE(array, ARG(6), 4, Z49_lambda, 2);
        COPY(ARG(3), &array[3]);
        LOAD_CLOSURE(array, ARG(6));
    }
    COPY(ARG(6), ARG(6));
    ALLOC_CONS(ARG(8), ARG(6), ARG(1), ARG(6));
    COPY(ARG(6), ARG(7));
    COPY(ARG(4), ARG(8));
    COPY(ARG(5), ARG(9));
    rt_set_vref(ARG(7));
    COPY(ARG(0), ARG(4));
    COPY(ARG(2), ARG(5));
    LOAD_SYMBOL(SYMBOL(Slisp, 420), ARG(6));	/* READTABLE */
    rt_struct_typep(ARG(5));
    if(CL_TRUEP(ARG(5)))
    {
        COPY(OFFSET(AR_BASE(GET_FORM(ARG(2))), 1 + 1), ARG(5));
    }
    else
    {
        COPY(SYMVAL(Slisp, 352), ARG(5));	/* NO_STRUCT */
        COPY(ARG(2), ARG(6));
        LOAD_SYMBOL(SYMBOL(Slisp, 420), ARG(7));	/* READTABLE */
        Ferror(ARG(5), 3);
    }
    LOAD_NIL(ARG(6));
    LOAD_NIL(ARG(7));
    LOAD_NIL(ARG(8));
    assoc1(ARG(4));
    if(CL_TRUEP(ARG(4)))
    {
        if(CL_CONSP(ARG(4)))
        {
            COPY(INDIRECT(ARG(3)), GET_CDR(ARG(4)));
        }
        else
        {
            LOAD_SMSTR((CL_FORM *)&KClisp[254], ARG(5));	/* ~a is not a cons */
            COPY(ARG(4), ARG(6));
            Ferror(ARG(5), 2);
        }
    }
    else
    {
        ALLOC_CONS(ARG(7), ARG(0), INDIRECT(ARG(3)), ARG(5));
        COPY(ARG(2), ARG(6));
        LOAD_SYMBOL(SYMBOL(Slisp, 420), ARG(7));	/* READTABLE */
        rt_struct_typep(ARG(6));
        if(CL_TRUEP(ARG(6)))
        {
            COPY(OFFSET(AR_BASE(GET_FORM(ARG(2))), 1 + 1), ARG(6));
        }
        else
        {
            COPY(SYMVAL(Slisp, 352), ARG(6));	/* NO_STRUCT */
            COPY(ARG(2), ARG(7));
            LOAD_SYMBOL(SYMBOL(Slisp, 420), ARG(8));	/* READTABLE */
            Ferror(ARG(6), 3);
        }
        ALLOC_CONS(ARG(7), ARG(5), ARG(6), ARG(5));
        LOAD_FIXNUM(ARG(6), 1, ARG(6));
        COPY(ARG(2), ARG(7));
        LOAD_SYMBOL(SYMBOL(Slisp, 420), ARG(8));	/* READTABLE */
        rt_struct_typep(ARG(7));
        if(CL_TRUEP(ARG(7)))
        {
            COPY(ARG(5), OFFSET(AR_BASE(GET_FORM(ARG(2))), 1 + 1));
        }
        else
        {
            COPY(SYMVAL(Slisp, 352), ARG(7));	/* NO_STRUCT */
            COPY(ARG(2), ARG(8));
            LOAD_SYMBOL(SYMBOL(Slisp, 420), ARG(9));	/* READTABLE */
            Ferror(ARG(7), 3);
        }
    }
    LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(0));	/* T */
}
Ejemplo n.º 4
0
void stringNE1(CL_FORM *base)
{
	COPY(ARG(0), ARG(6));
	Fstring(ARG(6));
	COPY(ARG(6), ARG(0));
	COPY(ARG(1), ARG(6));
	Fstring(ARG(6));
	COPY(ARG(6), ARG(1));
	COPY(ARG(2), ARG(6));
	COPY(ARG(3), ARG(7));
	COPY(ARG(0), ARG(8));
	Flength(ARG(8));
	check_seq_start_end(ARG(6));
	COPY(ARG(6), ARG(3));
	COPY(ARG(4), ARG(6));
	COPY(ARG(5), ARG(7));
	COPY(ARG(1), ARG(8));
	Flength(ARG(8));
	check_seq_start_end(ARG(6));
	COPY(ARG(6), ARG(5));
	COPY(ARG(2), ARG(6));
	COPY(ARG(4), ARG(7));
	LOAD_NIL(ARG(8));
	LOAD_NIL(ARG(9));
	M1_1:;
	COPY(ARG(6), ARG(10));
	COPY(ARG(3), ARG(11));
	Fnumeql(ARG(10), 2);
	if(CL_TRUEP(ARG(10)))
	{
		COPY(ARG(7), ARG(10));
		COPY(ARG(5), ARG(11));
		Fnumeql(ARG(10), 2);
		if(CL_TRUEP(ARG(10)))
		{
			LOAD_NIL(ARG(0));
		}
		else
		{
			COPY(ARG(6), ARG(0));
		}
		goto RETURN2;
	}
	COPY(ARG(7), ARG(10));
	COPY(ARG(5), ARG(11));
	Fnumeql(ARG(10), 2);
	if(CL_TRUEP(ARG(10)))
	{
		COPY(ARG(6), ARG(0));
		goto RETURN2;
	}
	COPY(ARG(0), ARG(10));
	COPY(ARG(6), ARG(11));
	COPY(ARG(10), ARG(12));
	Fstringp(ARG(12));
	if(CL_TRUEP(ARG(12)))
	{
	}
	else
	{
		COPY(SYMVAL(Slisp, 58), ARG(12));	/* WRONG_TYPE */
		COPY(ARG(10), ARG(13));
		LOAD_SYMBOL(SYMBOL(Slisp, 44), ARG(14));	/* STRING */
		Ferror(ARG(12), 3);
	}
	COPY(ARG(10), ARG(12));
	COPY(ARG(11), ARG(13));
	Frow_major_aref(ARG(12));
	COPY(ARG(12), ARG(8));
	COPY(ARG(1), ARG(10));
	COPY(ARG(7), ARG(11));
	COPY(ARG(10), ARG(12));
	Fstringp(ARG(12));
	if(CL_TRUEP(ARG(12)))
	{
	}
	else
	{
		COPY(SYMVAL(Slisp, 58), ARG(12));	/* WRONG_TYPE */
		COPY(ARG(10), ARG(13));
		LOAD_SYMBOL(SYMBOL(Slisp, 44), ARG(14));	/* STRING */
		Ferror(ARG(12), 3);
	}
	COPY(ARG(10), ARG(9));
	COPY(ARG(11), ARG(10));
	Frow_major_aref(ARG(9));
	COPY(ARG(8), ARG(10));
	COPY(ARG(9), ARG(11));
	rt_charE(ARG(10));
	if(CL_TRUEP(ARG(10)))
	{
	}
	else
	{
		COPY(ARG(6), ARG(0));
		goto RETURN1;
	}
	COPY(ARG(6), ARG(10));
	F1plus(ARG(10));
	F1plus(ARG(7));
	COPY(ARG(10), ARG(6));
	goto M1_1;
	RETURN2:;
	RETURN1:;
}
Ejemplo n.º 5
0
void eval_feature(CL_FORM *base)
{
	if(CL_ATOMP(ARG(0)))
	{
		COPY(SYMVAL(Slisp, 419), ARG(1));	/* *FEATURES* */
		LOAD_NIL(ARG(2));
		LOAD_NIL(ARG(3));
		LOAD_NIL(ARG(4));
		member1(ARG(0));
	}
	else
	{
		COPY(GET_CAR(ARG(0)), ARG(1));
		if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 396))	/* NOT */
		{
			COPY(GET_CDR(ARG(0)), ARG(2));
			if(CL_CONSP(ARG(2)))
			{
				COPY(GET_CAR(ARG(2)), ARG(2));
			}
			else
			{
				if(CL_TRUEP(ARG(2)))
				{
					LOAD_SMSTR((CL_FORM *)&KClisp[264], ARG(3));	/* ~a is not a list */
					COPY(ARG(2), ARG(4));
					Ferror(ARG(3), 2);
				}
				else
				{
				}
			}
			eval_feature(ARG(2));
			if(CL_TRUEP(ARG(2)))
			{
				LOAD_NIL(ARG(0));
			}
			else
			{
				LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(0));	/* T */
			}
		}
		else
		{
			if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 466))	/* AND */
			{
				LOAD_NIL(ARG(2));
				COPY(GET_CDR(ARG(0)), ARG(3));
				M1_1:;
				if(CL_ATOMP(ARG(3)))
				{
					LOAD_NIL(ARG(2));
					goto RETURN2;
				}
				COPY(ARG(3), ARG(4));
				COPY(GET_CAR(ARG(4)), ARG(2));
				COPY(ARG(2), ARG(4));
				eval_feature(ARG(4));
				if(CL_TRUEP(ARG(4)))
				{
				}
				else
				{
					LOAD_NIL(ARG(0));
					goto RETURN1;
				}
				COPY(ARG(3), ARG(4));
				COPY(GET_CDR(ARG(4)), ARG(3));
				goto M1_1;
				RETURN2:;
				LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(0));	/* T */
			}
			else
			{
				if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 467))	/* OR */
				{
					LOAD_NIL(ARG(2));
					COPY(GET_CDR(ARG(0)), ARG(3));
					M2_1:;
					if(CL_ATOMP(ARG(3)))
					{
						LOAD_NIL(ARG(2));
						COPY(ARG(2), ARG(0));
						goto RETURN3;
					}
					COPY(ARG(3), ARG(4));
					COPY(GET_CAR(ARG(4)), ARG(2));
					COPY(ARG(2), ARG(4));
					eval_feature(ARG(4));
					if(CL_TRUEP(ARG(4)))
					{
						LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(0));	/* T */
						goto RETURN1;
					}
					COPY(ARG(3), ARG(4));
					COPY(GET_CDR(ARG(4)), ARG(3));
					goto M2_1;
					RETURN3:;
				}
				else
				{
					LOAD_SMSTR((CL_FORM *)&Keval_feature[0], ARG(2));	/* illegal feature expression ~s */
					COPY(ARG(0), ARG(3));
					Ferror(ARG(2), 2);
				}
			}
		}
	}
	RETURN1:;
}
Ejemplo n.º 6
0
Class *classlibBootPackagesArrayClass() {
    return findArrayClass(SYMBOL(array_java_lang_String));
}
Ejemplo n.º 7
0
void string_equal1(CL_FORM *base)
{
	COPY(ARG(0), ARG(6));
	Fstring(ARG(6));
	COPY(ARG(6), ARG(0));
	COPY(ARG(1), ARG(6));
	Fstring(ARG(6));
	COPY(ARG(6), ARG(1));
	if(CL_TRUEP(ARG(3)))
	{
	}
	else
	{
		COPY(ARG(0), ARG(6));
		Flength(ARG(6));
		COPY(ARG(6), ARG(3));
	}
	if(CL_TRUEP(ARG(5)))
	{
	}
	else
	{
		COPY(ARG(1), ARG(5));
		Flength(ARG(5));
	}
	COPY(ARG(3), ARG(6));
	COPY(ARG(2), ARG(7));
	Fminus(ARG(6), 2);
	COPY(ARG(5), ARG(7));
	COPY(ARG(4), ARG(8));
	Fminus(ARG(7), 2);
	Fnumeql(ARG(6), 2);
	if(CL_TRUEP(ARG(6)))
	{
		COPY(ARG(2), ARG(6));
		COPY(ARG(4), ARG(7));
		M1_1:;
		COPY(ARG(6), ARG(8));
		COPY(ARG(3), ARG(9));
		Fnumeql(ARG(8), 2);
		if(CL_TRUEP(ARG(8)))
		{
			LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(0));	/* T */
			goto RETURN2;
		}
		COPY(ARG(0), ARG(8));
		COPY(ARG(6), ARG(9));
		Frow_major_aref(ARG(8));
		COPY(ARG(1), ARG(9));
		COPY(ARG(7), ARG(10));
		Frow_major_aref(ARG(9));
		if(CL_CHARP(ARG(8)))
		{
			COPY(ARG(8), ARG(10));
		}
		else
		{
			COPY(SYMVAL(Slisp, 58), ARG(10));	/* WRONG_TYPE */
			COPY(ARG(8), ARG(11));
			LOAD_SYMBOL(SYMBOL(Slisp, 18), ARG(12));	/* CHARACTER */
			Ferror(ARG(10), 3);
		}
		rt_char_upcase(ARG(10));
		rt_char_code(ARG(10));
		if(CL_CHARP(ARG(9)))
		{
			COPY(ARG(9), ARG(11));
		}
		else
		{
			COPY(SYMVAL(Slisp, 58), ARG(11));	/* WRONG_TYPE */
			COPY(ARG(9), ARG(12));
			LOAD_SYMBOL(SYMBOL(Slisp, 18), ARG(13));	/* CHARACTER */
			Ferror(ARG(11), 3);
		}
		rt_char_upcase(ARG(11));
		rt_char_code(ARG(11));
		Fnumeql(ARG(10), 2);
		if(CL_TRUEP(ARG(10)))
		{
		}
		else
		{
			LOAD_NIL(ARG(0));
			goto RETURN1;
		}
		COPY(ARG(6), ARG(8));
		F1plus(ARG(8));
		COPY(ARG(7), ARG(9));
		F1plus(ARG(9));
		COPY(ARG(9), ARG(7));
		COPY(ARG(8), ARG(6));
		goto M1_1;
		RETURN2:;
	}
	else
	{
		LOAD_NIL(ARG(0));
	}
	RETURN1:;
}
Ejemplo n.º 8
0
void pathname_name1(CL_FORM *base)
{
	COPY(ARG(0), ARG(2));
	LOAD_SYMBOL(SYMBOL(Slisp, 232), ARG(3));	/* PATHNAME */
	rt_struct_typep(ARG(2));
	if(CL_TRUEP(ARG(2)))
	{
		COPY(ARG(0), ARG(2));
	}
	else
	{
		COPY(ARG(0), ARG(2));
		Fstringp(ARG(2));
		if(CL_TRUEP(ARG(2)))
		{
			COPY(ARG(0), ARG(2));
			LOAD_NIL(ARG(3));
			COPY(SYMVAL(Slisp, 231), ARG(4));	/* *DEFAULT-PATHNAME-DEFAULTS* */
			LOAD_SMALLFIXNUM(0, ARG(5));
			LOAD_NIL(ARG(6));
			LOAD_NIL(ARG(7));
			parse_namestring1(ARG(2));
			mv_count = 1;
		}
		else
		{
			COPY(ARG(0), ARG(2));
			LOAD_SYMBOL(SYMBOL(Slisp, 64), ARG(3));	/* STREAM */
			rt_struct_typep(ARG(2));
			if(CL_TRUEP(ARG(2)))
			{
				COPY(ARG(0), ARG(2));
				LOAD_NIL(ARG(3));
				file_name1(ARG(2));
				COPY(SYMVAL(Slisp, 231), ARG(3));	/* *DEFAULT-PATHNAME-DEFAULTS* */
				LOAD_SMALLFIXNUM(0, ARG(4));
				COPY(ARG(2), ARG(5));
				LOAD_NIL(ARG(6));
				COPY(ARG(3), ARG(7));
				COPY(ARG(4), ARG(8));
				LOAD_NIL(ARG(9));
				LOAD_NIL(ARG(10));
				parse_namestring1(ARG(5));
				mv_count = 1;
				COPY(ARG(5), ARG(2));
			}
			else
			{
				LOAD_SMSTR((CL_FORM *)&Kpathname_name1[0], ARG(2));	/* etypecase: the value ~a is not a legal value */
				COPY(ARG(0), ARG(3));
				Ferror(ARG(2), 2);
			}
		}
	}
	COPY(ARG(2), ARG(3));
	LOAD_SYMBOL(SYMBOL(Slisp, 232), ARG(4));	/* PATHNAME */
	rt_struct_typep(ARG(3));
	if(CL_TRUEP(ARG(3)))
	{
		COPY(OFFSET(AR_BASE(GET_FORM(ARG(2))), 3 + 1), ARG(3));
	}
	else
	{
		COPY(SYMVAL(Slisp, 342), ARG(3));	/* NO_STRUCT */
		COPY(ARG(2), ARG(4));
		LOAD_SYMBOL(SYMBOL(Slisp, 232), ARG(5));	/* PATHNAME */
		Ferror(ARG(3), 3);
	}
	if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 269))	/* COMMON */
	{
		LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(4));	/* T */
	}
	else
	{
		LOAD_NIL(ARG(4));
	}
	maybe_diddle_case(ARG(3));
	COPY(ARG(3), ARG(0));
}
Ejemplo n.º 9
0
void unparse_unix_directory_list(CL_FORM *base)
{
	LOAD_NIL(STACK(base, 1));
	LOAD_NIL(STACK(base, 2));
	{
		CL_FORM *lptr;
		lptr = form_alloc(STACK(base, 3), 2);
		COPY(STACK(base, 1), CAR(lptr));
		COPY(STACK(base, 2), CDR(lptr));
		LOAD_CONS(lptr, STACK(base, 1));
	}
	if(CL_TRUEP(STACK(base, 0)))
	{
		COPY(STACK(base, 0), STACK(base, 2));
		Fcar(STACK(base, 2));
		COPY(STACK(base, 0), STACK(base, 3));
		COPY(STACK(base, 3), STACK(base, 4));
		Fcdr(STACK(base, 4));
		COPY(STACK(base, 4), STACK(base, 0));
		if(CL_SYMBOLP(STACK(base, 2)) && GET_SYMBOL(STACK(base, 2)) == SYMBOL(Slisp, 198))	/* ABSOLUTE */
		{
			LOAD_SMSTR((CL_FORM *)&Kunparse_unix_directory_list[0], STACK(base, 3));	/* / */
			COPY(STACK(base, 1), STACK(base, 4));
			add_q(STACK(base, 3));
		}
		else
		{
			if(CL_SYMBOLP(STACK(base, 2)) && GET_SYMBOL(STACK(base, 2)) == SYMBOL(Slisp, 201))	/* RELATIVE */
			{
				LOAD_T(STACK(base, 3));
			}
			else
			{
				LOAD_NIL(STACK(base, 3));
			}
			if(CL_TRUEP(STACK(base, 3)))
			{
			}
			else
			{
				LOAD_SMSTR((CL_FORM *)&Kunparse_unix_directory_list[2], STACK(base, 4));	/* ecase: the value ~a is not a legal value */
				COPY(STACK(base, 2), STACK(base, 5));
				Ferror(STACK(base, 4), 2);
			}
		}
		LOAD_NIL(STACK(base, 2));
		COPY(STACK(base, 0), STACK(base, 3));
		M33_1:;
		if(CL_ATOMP(STACK(base, 3)))
		{
			LOAD_NIL(STACK(base, 2));
			goto RETURN34;
		}
		COPY(STACK(base, 3), STACK(base, 4));
		Fcar(STACK(base, 4));
		COPY(STACK(base, 4), STACK(base, 2));
		if(CL_SYMBOLP(STACK(base, 2)) && GET_SYMBOL(STACK(base, 2)) == SYMBOL(Slisp, 205))	/* UP */
		{
			LOAD_SMSTR((CL_FORM *)&Kunparse_unix_directory_list[4], STACK(base, 4));	/* ../ */
			COPY(STACK(base, 1), STACK(base, 5));
			add_q(STACK(base, 4));
		}
		else
		{
			if(CL_SYMBOLP(STACK(base, 2)) && GET_SYMBOL(STACK(base, 2)) == SYMBOL(Slisp, 199))	/* BACK */
			{
				LOAD_SMSTR((CL_FORM *)&Kunparse_unix_directory_list[6], STACK(base, 4));	/* :BACK cannot be represented in namestrings. */
				Ferror(STACK(base, 4), 1);
			}
			else
			{
				if(CL_SMAR_P(STACK(base, 2)))
				{
					COPY(STACK(base, 2), STACK(base, 4));
					LOAD_SYMBOL(SYMBOL(Slisp, 43), STACK(base, 5));	/* STANDARD-CHAR */
					LOAD_SYMBOL(SYMBOL(Slisp, 48), STACK(base, 6));	/* * */
					check_array_internal(STACK(base, 4));
				}
				else
				{
					LOAD_NIL(STACK(base, 4));
				}
				if(CL_TRUEP(STACK(base, 4)))
				{
					bool_result = TRUE;
				}
				else
				{
					COPY(STACK(base, 2), STACK(base, 5));
					LOAD_SYMBOL(SYMBOL(Slisp, 181), STACK(base, 6));	/* PATTERN */
					struct_typep(STACK(base, 5));
					bool_result = CL_TRUEP(STACK(base, 5));
				}
				if(bool_result)
				{
					COPY(STACK(base, 2), STACK(base, 4));
					unparse_unix_piece(STACK(base, 4));
					COPY(STACK(base, 1), STACK(base, 5));
					add_q(STACK(base, 4));
					LOAD_SMSTR((CL_FORM *)&Kunparse_unix_directory_list[8], STACK(base, 4));	/* / */
					COPY(STACK(base, 1), STACK(base, 5));
					add_q(STACK(base, 4));
				}
				else
				{
					LOAD_SMSTR((CL_FORM *)&Kunparse_unix_directory_list[10], STACK(base, 4));	/* Invalid directory component: ~S */
					COPY(STACK(base, 2), STACK(base, 5));
					Ferror(STACK(base, 4), 2);
				}
			}
		}
		Fcdr(STACK(base, 3));
		goto M33_1;
		RETURN34:;
	}
	LOAD_GLOBFUN(&CFconcatenate, STACK(base, 2));
	LOAD_SYMBOL(SYMBOL(Slisp, 40), STACK(base, 3));	/* SIMPLE-STRING */
	COPY(STACK(base, 1), STACK(base, 4));
	Fcar(STACK(base, 4));
	Fapply(STACK(base, 2), 3);
	COPY(STACK(base, 2), STACK(base, 0));
}
Ejemplo n.º 10
0
bool
GLLibraryEGL::EnsureInitialized()
{
    if (mInitialized) {
        return true;
    }

    mozilla::ScopedGfxFeatureReporter reporter("EGL");

#ifdef MOZ_B2G
    if (!sCurrentContext.init())
      MOZ_CRASH("Tls init failed");
#endif

#ifdef XP_WIN
    if (!mEGLLibrary) {
        // On Windows, the GLESv2, EGL and DXSDK libraries are shipped with libxul and
        // we should look for them there. We have to load the libs in this
        // order, because libEGL.dll depends on libGLESv2.dll which depends on the DXSDK
        // libraries. This matters especially for WebRT apps which are in a different directory.
        // See bug 760323 and bug 749459

        // Also note that we intentionally leak the libs we load.

        do {
            // Windows 8.1 has d3dcompiler_47.dll in the system directory.
            // Try it first. Note that _46 will never be in the system
            // directory and we ship with at least _43. So there is no point
            // trying _46 and _43 in the system directory.

            if (LoadLibrarySystem32(L"d3dcompiler_47.dll"))
                break;

#ifdef MOZ_D3DCOMPILER_VISTA_DLL
            if (LoadLibraryForEGLOnWindows(NS_LITERAL_STRING(NS_STRINGIFY(MOZ_D3DCOMPILER_VISTA_DLL))))
                break;
#endif

#ifdef MOZ_D3DCOMPILER_XP_DLL
            if (LoadLibraryForEGLOnWindows(NS_LITERAL_STRING(NS_STRINGIFY(MOZ_D3DCOMPILER_XP_DLL))))
                break;
#endif

            MOZ_ASSERT(false, "d3dcompiler DLL loading failed.");
        } while (false);

        LoadLibraryForEGLOnWindows(NS_LITERAL_STRING("libGLESv2.dll"));

        mEGLLibrary = LoadLibraryForEGLOnWindows(NS_LITERAL_STRING("libEGL.dll"));

        if (!mEGLLibrary)
            return false;
    }

#else // !Windows

    // On non-Windows (Android) we use system copies of libEGL. We look for
    // the APITrace lib, libEGL.so, and libEGL.so.1 in that order.

#if defined(ANDROID)
    if (!mEGLLibrary)
        mEGLLibrary = LoadApitraceLibrary();
#endif

    if (!mEGLLibrary) {
        printf_stderr("Attempting load of libEGL.so\n");
        mEGLLibrary = PR_LoadLibrary("libEGL.so");
    }
#if defined(XP_UNIX)
    if (!mEGLLibrary) {
        mEGLLibrary = PR_LoadLibrary("libEGL.so.1");
    }
#endif

    if (!mEGLLibrary) {
        NS_WARNING("Couldn't load EGL LIB.");
        return false;
    }

#endif // !Windows

#define SYMBOL(name) \
{ (PRFuncPtr*) &mSymbols.f##name, { "egl" #name, nullptr } }

    GLLibraryLoader::SymLoadStruct earlySymbols[] = {
        SYMBOL(GetDisplay),
        SYMBOL(Terminate),
        SYMBOL(GetCurrentSurface),
        SYMBOL(GetCurrentContext),
        SYMBOL(MakeCurrent),
        SYMBOL(DestroyContext),
        SYMBOL(CreateContext),
        SYMBOL(DestroySurface),
        SYMBOL(CreateWindowSurface),
        SYMBOL(CreatePbufferSurface),
        SYMBOL(CreatePixmapSurface),
        SYMBOL(BindAPI),
        SYMBOL(Initialize),
        SYMBOL(ChooseConfig),
        SYMBOL(GetError),
        SYMBOL(GetConfigs),
        SYMBOL(GetConfigAttrib),
        SYMBOL(WaitNative),
        SYMBOL(GetProcAddress),
        SYMBOL(SwapBuffers),
        SYMBOL(CopyBuffers),
        SYMBOL(QueryString),
        SYMBOL(QueryContext),
        SYMBOL(BindTexImage),
        SYMBOL(ReleaseTexImage),
        SYMBOL(QuerySurface),
        { nullptr, { nullptr } }
    };

    if (!GLLibraryLoader::LoadSymbols(mEGLLibrary, &earlySymbols[0])) {
        NS_WARNING("Couldn't find required entry points in EGL library (early init)");
        return false;
    }

    GLLibraryLoader::SymLoadStruct optionalSymbols[] = {
        // On Android 4.3 and up, certain features like ANDROID_native_fence_sync
        // can only be queried by using a special eglQueryString.
        { (PRFuncPtr*) &mSymbols.fQueryStringImplementationANDROID,
          { "_Z35eglQueryStringImplementationANDROIDPvi", nullptr } },
        { nullptr, { nullptr } }
    };

    // Do not warn about the failure to load this - see bug 1092191
    GLLibraryLoader::LoadSymbols(mEGLLibrary, &optionalSymbols[0], nullptr, nullptr,
                                 false);

#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 18
    MOZ_RELEASE_ASSERT(mSymbols.fQueryStringImplementationANDROID,
                       "Couldn't find eglQueryStringImplementationANDROID");
#endif

    mEGLDisplay = GetAndInitDisplay(*this, EGL_DEFAULT_DISPLAY);

    const char* vendor = (char*)fQueryString(mEGLDisplay, LOCAL_EGL_VENDOR);
    if (vendor && (strstr(vendor, "TransGaming") != 0 ||
                   strstr(vendor, "Google Inc.") != 0))
    {
        mIsANGLE = true;
    }

    if (mIsANGLE) {
        EGLDisplay newDisplay = EGL_NO_DISPLAY;

        // D3D11 ANGLE only works with OMTC; there's a bug in the non-OMTC layer
        // manager, and it's pointless to try to fix it.  We also don't try
        // D3D11 ANGLE if the layer manager is prefering D3D9 (hrm, do we care?)
        if (gfxPrefs::LayersOffMainThreadCompositionEnabled() &&
            !gfxPrefs::LayersPreferD3D9())
        {
            if (gfxPrefs::WebGLANGLEForceD3D11()) {
                newDisplay = GetAndInitDisplay(*this,
                                               LOCAL_EGL_D3D11_ONLY_DISPLAY_ANGLE);
            } else if (gfxPrefs::WebGLANGLETryD3D11() && gfxPlatform::CanUseDirect3D11ANGLE()) {
                newDisplay = GetAndInitDisplay(*this,
                                               LOCAL_EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE);
            }
        }

        if (newDisplay != EGL_NO_DISPLAY) {
            DebugOnly<EGLBoolean> success = fTerminate(mEGLDisplay);
            MOZ_ASSERT(success == LOCAL_EGL_TRUE);

            mEGLDisplay = newDisplay;

            vendor = (char*)fQueryString(mEGLDisplay, LOCAL_EGL_VENDOR);
        }
    }

    InitExtensions();

    GLLibraryLoader::PlatformLookupFunction lookupFunction =
            (GLLibraryLoader::PlatformLookupFunction)mSymbols.fGetProcAddress;

    if (IsExtensionSupported(KHR_lock_surface)) {
        GLLibraryLoader::SymLoadStruct lockSymbols[] = {
            { (PRFuncPtr*) &mSymbols.fLockSurface,   { "eglLockSurfaceKHR",   nullptr } },
            { (PRFuncPtr*) &mSymbols.fUnlockSurface, { "eglUnlockSurfaceKHR", nullptr } },
            { nullptr, { nullptr } }
        };

        bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
                                                    &lockSymbols[0],
                                                    lookupFunction);
        if (!success) {
            NS_ERROR("EGL supports KHR_lock_surface without exposing its functions!");

            MarkExtensionUnsupported(KHR_lock_surface);

            mSymbols.fLockSurface = nullptr;
            mSymbols.fUnlockSurface = nullptr;
        }
    }

    if (IsExtensionSupported(ANGLE_surface_d3d_texture_2d_share_handle)) {
        GLLibraryLoader::SymLoadStruct d3dSymbols[] = {
            { (PRFuncPtr*) &mSymbols.fQuerySurfacePointerANGLE, { "eglQuerySurfacePointerANGLE", nullptr } },
            { nullptr, { nullptr } }
        };

        bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
                                                    &d3dSymbols[0],
                                                    lookupFunction);
        if (!success) {
            NS_ERROR("EGL supports ANGLE_surface_d3d_texture_2d_share_handle without exposing its functions!");

            MarkExtensionUnsupported(ANGLE_surface_d3d_texture_2d_share_handle);

            mSymbols.fQuerySurfacePointerANGLE = nullptr;
        }
    }

    //XXX: use correct extension name
    if (IsExtensionSupported(ANGLE_surface_d3d_texture_2d_share_handle)) {
        GLLibraryLoader::SymLoadStruct d3dSymbols[] = {
            { (PRFuncPtr*)&mSymbols.fSurfaceReleaseSyncANGLE, { "eglSurfaceReleaseSyncANGLE", nullptr } },
            { nullptr, { nullptr } }
        };

        bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
                                                    &d3dSymbols[0],
                                                    lookupFunction);
        if (!success) {
            NS_ERROR("EGL supports ANGLE_surface_d3d_texture_2d_share_handle without exposing its functions!");

            MarkExtensionUnsupported(ANGLE_surface_d3d_texture_2d_share_handle);

            mSymbols.fSurfaceReleaseSyncANGLE = nullptr;
        }
    }

    if (IsExtensionSupported(KHR_fence_sync)) {
        GLLibraryLoader::SymLoadStruct syncSymbols[] = {
            { (PRFuncPtr*) &mSymbols.fCreateSync,     { "eglCreateSyncKHR",     nullptr } },
            { (PRFuncPtr*) &mSymbols.fDestroySync,    { "eglDestroySyncKHR",    nullptr } },
            { (PRFuncPtr*) &mSymbols.fClientWaitSync, { "eglClientWaitSyncKHR", nullptr } },
            { (PRFuncPtr*) &mSymbols.fGetSyncAttrib,  { "eglGetSyncAttribKHR",  nullptr } },
            { nullptr, { nullptr } }
        };

        bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
                                                    &syncSymbols[0],
                                                    lookupFunction);
        if (!success) {
            NS_ERROR("EGL supports KHR_fence_sync without exposing its functions!");

            MarkExtensionUnsupported(KHR_fence_sync);

            mSymbols.fCreateSync = nullptr;
            mSymbols.fDestroySync = nullptr;
            mSymbols.fClientWaitSync = nullptr;
            mSymbols.fGetSyncAttrib = nullptr;
        }
    }

    if (IsExtensionSupported(KHR_image) || IsExtensionSupported(KHR_image_base)) {
        GLLibraryLoader::SymLoadStruct imageSymbols[] = {
            { (PRFuncPtr*) &mSymbols.fCreateImage,  { "eglCreateImageKHR",  nullptr } },
            { (PRFuncPtr*) &mSymbols.fDestroyImage, { "eglDestroyImageKHR", nullptr } },
            { nullptr, { nullptr } }
        };

        bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
                                                    &imageSymbols[0],
                                                    lookupFunction);
        if (!success) {
            NS_ERROR("EGL supports KHR_image(_base) without exposing its functions!");

            MarkExtensionUnsupported(KHR_image);
            MarkExtensionUnsupported(KHR_image_base);
            MarkExtensionUnsupported(KHR_image_pixmap);

            mSymbols.fCreateImage = nullptr;
            mSymbols.fDestroyImage = nullptr;
        }
    } else {
        MarkExtensionUnsupported(KHR_image_pixmap);
    }

    if (IsExtensionSupported(ANDROID_native_fence_sync)) {
        GLLibraryLoader::SymLoadStruct nativeFenceSymbols[] = {
            { (PRFuncPtr*) &mSymbols.fDupNativeFenceFDANDROID, { "eglDupNativeFenceFDANDROID", nullptr } },
            { nullptr, { nullptr } }
        };

        bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
                                                    &nativeFenceSymbols[0],
                                                    lookupFunction);
        if (!success) {
            NS_ERROR("EGL supports ANDROID_native_fence_sync without exposing its functions!");

            MarkExtensionUnsupported(ANDROID_native_fence_sync);

            mSymbols.fDupNativeFenceFDANDROID = nullptr;
        }
    }

    mInitialized = true;
    reporter.SetSuccessful();
    return true;
}
Ejemplo n.º 11
0
bool
GLLibraryEGL::EnsureInitialized(bool forceAccel, nsACString* const out_failureId)
{
    if (mInitialized) {
        return true;
    }

    mozilla::ScopedGfxFeatureReporter reporter("EGL");

#ifdef MOZ_B2G
    if (!sCurrentContext.init())
      MOZ_CRASH("GFX: Tls init failed");
#endif

#ifdef XP_WIN
    if (!mEGLLibrary) {
        // On Windows, the GLESv2, EGL and DXSDK libraries are shipped with libxul and
        // we should look for them there. We have to load the libs in this
        // order, because libEGL.dll depends on libGLESv2.dll which depends on the DXSDK
        // libraries. This matters especially for WebRT apps which are in a different directory.
        // See bug 760323 and bug 749459

        // Also note that we intentionally leak the libs we load.

        do {
            // Windows 8.1+ has d3dcompiler_47.dll in the system directory.
            // Try it first. Note that _46 will never be in the system
            // directory. So there is no point trying _46 in the system
            // directory.

            if (LoadLibrarySystem32(L"d3dcompiler_47.dll"))
                break;

#ifdef MOZ_D3DCOMPILER_VISTA_DLL
            if (LoadLibraryForEGLOnWindows(NS_LITERAL_STRING(NS_STRINGIFY(MOZ_D3DCOMPILER_VISTA_DLL))))
                break;
#endif

            MOZ_ASSERT(false, "d3dcompiler DLL loading failed.");
        } while (false);

        LoadLibraryForEGLOnWindows(NS_LITERAL_STRING("libGLESv2.dll"));

        mEGLLibrary = LoadLibraryForEGLOnWindows(NS_LITERAL_STRING("libEGL.dll"));

        if (!mEGLLibrary) {
            *out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_EGL_LOAD");
            return false;
        }
    }

#else // !Windows

    // On non-Windows (Android) we use system copies of libEGL. We look for
    // the APITrace lib, libEGL.so, and libEGL.so.1 in that order.

#if defined(ANDROID)
    if (!mEGLLibrary)
        mEGLLibrary = LoadApitraceLibrary();
#endif

    if (!mEGLLibrary) {
        printf_stderr("Attempting load of libEGL.so\n");
        mEGLLibrary = PR_LoadLibrary("libEGL.so");
    }
#if defined(XP_UNIX)
    if (!mEGLLibrary) {
        mEGLLibrary = PR_LoadLibrary("libEGL.so.1");
    }
#endif

    if (!mEGLLibrary) {
        NS_WARNING("Couldn't load EGL LIB.");
        *out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_EGL_LOAD_2");
        return false;
    }

#endif // !Windows

#define SYMBOL(name) \
{ (PRFuncPtr*) &mSymbols.f##name, { "egl" #name, nullptr } }

    GLLibraryLoader::SymLoadStruct earlySymbols[] = {
        SYMBOL(GetDisplay),
        SYMBOL(Terminate),
        SYMBOL(GetCurrentSurface),
        SYMBOL(GetCurrentContext),
        SYMBOL(MakeCurrent),
        SYMBOL(DestroyContext),
        SYMBOL(CreateContext),
        SYMBOL(DestroySurface),
        SYMBOL(CreateWindowSurface),
        SYMBOL(CreatePbufferSurface),
        SYMBOL(CreatePixmapSurface),
        SYMBOL(BindAPI),
        SYMBOL(Initialize),
        SYMBOL(ChooseConfig),
        SYMBOL(GetError),
        SYMBOL(GetConfigs),
        SYMBOL(GetConfigAttrib),
        SYMBOL(WaitNative),
        SYMBOL(GetProcAddress),
        SYMBOL(SwapBuffers),
        SYMBOL(CopyBuffers),
        SYMBOL(QueryString),
        SYMBOL(QueryContext),
        SYMBOL(BindTexImage),
        SYMBOL(ReleaseTexImage),
        SYMBOL(QuerySurface),
        { nullptr, { nullptr } }
    };

    if (!GLLibraryLoader::LoadSymbols(mEGLLibrary, &earlySymbols[0])) {
        NS_WARNING("Couldn't find required entry points in EGL library (early init)");
        *out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_EGL_SYM");
        return false;
    }

    GLLibraryLoader::SymLoadStruct optionalSymbols[] = {
        // On Android 4.3 and up, certain features like ANDROID_native_fence_sync
        // can only be queried by using a special eglQueryString.
        { (PRFuncPtr*) &mSymbols.fQueryStringImplementationANDROID,
          { "_Z35eglQueryStringImplementationANDROIDPvi", nullptr } },
        { nullptr, { nullptr } }
    };

    // Do not warn about the failure to load this - see bug 1092191
    Unused << GLLibraryLoader::LoadSymbols(mEGLLibrary, &optionalSymbols[0],
                                           nullptr, nullptr, false);

    InitClientExtensions();

    const auto lookupFunction =
        (GLLibraryLoader::PlatformLookupFunction)mSymbols.fGetProcAddress;

    // Client exts are ready. (But not display exts!)
    if (IsExtensionSupported(ANGLE_platform_angle_d3d)) {
        GLLibraryLoader::SymLoadStruct d3dSymbols[] = {
            { (PRFuncPtr*)&mSymbols.fANGLEPlatformInitialize, { "ANGLEPlatformInitialize", nullptr } },
            { (PRFuncPtr*)&mSymbols.fANGLEPlatformShutdown,   { "ANGLEPlatformShutdown", nullptr } },
            { (PRFuncPtr*)&mSymbols.fGetPlatformDisplayEXT,   { "eglGetPlatformDisplayEXT", nullptr } },
            { nullptr, { nullptr } }
        };

        bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
                                                    &d3dSymbols[0],
                                                    lookupFunction);
        if (!success) {
            NS_ERROR("EGL supports ANGLE_platform_angle_d3d without exposing its functions!");

            MarkExtensionUnsupported(ANGLE_platform_angle_d3d);

            mSymbols.fGetPlatformDisplayEXT = nullptr;
        }
    }

    // Check the ANGLE support the system has
    nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
    mIsANGLE = IsExtensionSupported(ANGLE_platform_angle);

    EGLDisplay chosenDisplay = nullptr;

    if (IsExtensionSupported(ANGLE_platform_angle_d3d)) {
        nsCString accelAngleFailureId;
        bool accelAngleSupport = IsAccelAngleSupported(gfxInfo, &accelAngleFailureId);
        bool shouldTryAccel = forceAccel || accelAngleSupport;
        bool shouldTryWARP = !forceAccel; // Only if ANGLE not supported or fails

        // If WARP preferred, will override ANGLE support
        if (gfxPrefs::WebGLANGLEForceWARP()) {
            shouldTryWARP = true;
            shouldTryAccel = false;
            if (accelAngleFailureId.IsEmpty()) {
                accelAngleFailureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_FORCE_WARP");
            }
        }

        // Hardware accelerated ANGLE path (supported or force accel)
        if (shouldTryAccel) {
            chosenDisplay = GetAndInitDisplayForAccelANGLE(*this, out_failureId);
        }

        // Report the acceleration status to telemetry
        if (!chosenDisplay) {
            if (accelAngleFailureId.IsEmpty()) {
                Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_ACCL_FAILURE_ID,
                                      NS_LITERAL_CSTRING("FEATURE_FAILURE_ACCL_ANGLE_UNKNOWN"));
            } else {
                Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_ACCL_FAILURE_ID,
                                      accelAngleFailureId);
            }
        } else {
            Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_ACCL_FAILURE_ID,
                                  NS_LITERAL_CSTRING("SUCCESS"));
        }

        // Fallback to a WARP display if ANGLE fails, or if WARP is forced
        if (!chosenDisplay && shouldTryWARP) {
            chosenDisplay = GetAndInitWARPDisplay(*this, EGL_DEFAULT_DISPLAY);
            if (!chosenDisplay) {
                if (out_failureId->IsEmpty()) {
                    *out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_WARP_FALLBACK");
                }
                NS_ERROR("Fallback WARP context failed to initialize.");
                return false;
            }
            mIsWARP = true;
        }
    } else {
        chosenDisplay = GetAndInitDisplay(*this, EGL_DEFAULT_DISPLAY);
    }

    if (!chosenDisplay) {
        if (out_failureId->IsEmpty()) {
            *out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_NO_DISPLAY");
        }
        NS_WARNING("Failed to initialize a display.");
        return false;
    }
    mEGLDisplay = chosenDisplay;

    InitDisplayExtensions();

    ////////////////////////////////////
    // Alright, load display exts.

    if (IsExtensionSupported(KHR_lock_surface)) {
        GLLibraryLoader::SymLoadStruct lockSymbols[] = {
            { (PRFuncPtr*) &mSymbols.fLockSurface,   { "eglLockSurfaceKHR",   nullptr } },
            { (PRFuncPtr*) &mSymbols.fUnlockSurface, { "eglUnlockSurfaceKHR", nullptr } },
            { nullptr, { nullptr } }
        };

        bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
                                                    &lockSymbols[0],
                                                    lookupFunction);
        if (!success) {
            NS_ERROR("EGL supports KHR_lock_surface without exposing its functions!");

            MarkExtensionUnsupported(KHR_lock_surface);

            mSymbols.fLockSurface = nullptr;
            mSymbols.fUnlockSurface = nullptr;
        }
    }

    if (IsExtensionSupported(ANGLE_surface_d3d_texture_2d_share_handle)) {
        GLLibraryLoader::SymLoadStruct d3dSymbols[] = {
            { (PRFuncPtr*) &mSymbols.fQuerySurfacePointerANGLE, { "eglQuerySurfacePointerANGLE", nullptr } },
            { nullptr, { nullptr } }
        };

        bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
                                                    &d3dSymbols[0],
                                                    lookupFunction);
        if (!success) {
            NS_ERROR("EGL supports ANGLE_surface_d3d_texture_2d_share_handle without exposing its functions!");

            MarkExtensionUnsupported(ANGLE_surface_d3d_texture_2d_share_handle);

            mSymbols.fQuerySurfacePointerANGLE = nullptr;
        }
    }

    if (IsExtensionSupported(KHR_fence_sync)) {
        GLLibraryLoader::SymLoadStruct syncSymbols[] = {
            { (PRFuncPtr*) &mSymbols.fCreateSync,     { "eglCreateSyncKHR",     nullptr } },
            { (PRFuncPtr*) &mSymbols.fDestroySync,    { "eglDestroySyncKHR",    nullptr } },
            { (PRFuncPtr*) &mSymbols.fClientWaitSync, { "eglClientWaitSyncKHR", nullptr } },
            { (PRFuncPtr*) &mSymbols.fGetSyncAttrib,  { "eglGetSyncAttribKHR",  nullptr } },
            { nullptr, { nullptr } }
        };

        bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
                                                    &syncSymbols[0],
                                                    lookupFunction);
        if (!success) {
            NS_ERROR("EGL supports KHR_fence_sync without exposing its functions!");

            MarkExtensionUnsupported(KHR_fence_sync);

            mSymbols.fCreateSync = nullptr;
            mSymbols.fDestroySync = nullptr;
            mSymbols.fClientWaitSync = nullptr;
            mSymbols.fGetSyncAttrib = nullptr;
        }
    }

    if (IsExtensionSupported(KHR_image) || IsExtensionSupported(KHR_image_base)) {
        GLLibraryLoader::SymLoadStruct imageSymbols[] = {
            { (PRFuncPtr*) &mSymbols.fCreateImage,  { "eglCreateImageKHR",  nullptr } },
            { (PRFuncPtr*) &mSymbols.fDestroyImage, { "eglDestroyImageKHR", nullptr } },
            { nullptr, { nullptr } }
        };

        bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
                                                    &imageSymbols[0],
                                                    lookupFunction);
        if (!success) {
            NS_ERROR("EGL supports KHR_image(_base) without exposing its functions!");

            MarkExtensionUnsupported(KHR_image);
            MarkExtensionUnsupported(KHR_image_base);
            MarkExtensionUnsupported(KHR_image_pixmap);

            mSymbols.fCreateImage = nullptr;
            mSymbols.fDestroyImage = nullptr;
        }
    } else {
        MarkExtensionUnsupported(KHR_image_pixmap);
    }

    if (IsExtensionSupported(ANDROID_native_fence_sync)) {
        GLLibraryLoader::SymLoadStruct nativeFenceSymbols[] = {
            { (PRFuncPtr*) &mSymbols.fDupNativeFenceFDANDROID, { "eglDupNativeFenceFDANDROID", nullptr } },
            { nullptr, { nullptr } }
        };

        bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
                                                    &nativeFenceSymbols[0],
                                                    lookupFunction);
        if (!success) {
            NS_ERROR("EGL supports ANDROID_native_fence_sync without exposing its functions!");

            MarkExtensionUnsupported(ANDROID_native_fence_sync);

            mSymbols.fDupNativeFenceFDANDROID = nullptr;
        }
    }

    mInitialized = true;
    reporter.SetSuccessful();
    return true;
}
Ejemplo n.º 12
0
void peek_char1(CL_FORM *base)
{
	if(CL_TRUEP(ARG(1)))
	{
		if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 48))	/* T */
		{
			COPY(SYMVAL(Slisp, 59), ARG(1));	/* *TERMINAL-IO* */
		}
	}
	else
	{
		COPY(SYMVAL(Slisp, 60), ARG(1));	/* *STANDARD-INPUT* */
	}
	COPY(ARG(1), ARG(5));
	LOAD_NIL(ARG(6));
	LOAD_NIL(ARG(7));
	COPY(ARG(4), ARG(8));
	read_char1(ARG(5));
	if(CL_SYMBOLP(ARG(0)) && GET_SYMBOL(ARG(0)) == SYMBOL(Slisp, 48))	/* T */
	{
		M1_1:;
		if(CL_TRUEP(ARG(5)))
		{
		}
		else
		{
			goto RETURN1;
		}
		COPY(SYMVAL(Slisp, 454), ARG(6));	/* *READTABLE* */
		COPY(ARG(6), ARG(7));
		LOAD_SYMBOL(SYMBOL(Slisp, 420), ARG(8));	/* READTABLE */
		rt_struct_typep(ARG(7));
		if(CL_TRUEP(ARG(7)))
		{
			COPY(OFFSET(AR_BASE(GET_FORM(ARG(6))), 0 + 1), ARG(6));
		}
		else
		{
			COPY(SYMVAL(Slisp, 352), ARG(7));	/* NO_STRUCT */
			COPY(ARG(6), ARG(8));
			LOAD_SYMBOL(SYMBOL(Slisp, 420), ARG(9));	/* READTABLE */
			Ferror(ARG(7), 3);
		}
		if(CL_CHARP(ARG(5)))
		{
		}
		else
		{
			COPY(SYMVAL(Slisp, 58), ARG(7));	/* WRONG_TYPE */
			COPY(ARG(5), ARG(8));
			LOAD_SYMBOL(SYMBOL(Slisp, 18), ARG(9));	/* CHARACTER */
			Ferror(ARG(7), 3);
		}
		COPY(ARG(5), ARG(7));
		rt_char_code(ARG(7));
		LOAD_BOOL(CL_SMVECP(ARG(6)), ARG(8));
		if(CL_TRUEP(ARG(8)))
		{
			goto THEN1;
		}
		else
		{
			COPY(ARG(6), ARG(9));
			LOAD_SYMBOL(SYMBOL(Slisp, 150), ARG(10));	/* COMPLEX-VECTOR */
			rt_struct_typep(ARG(9));
		}
		if(CL_TRUEP(ARG(9)))
		{
			THEN1:;
		}
		else
		{
			COPY(SYMVAL(Slisp, 58), ARG(8));	/* WRONG_TYPE */
			COPY(ARG(6), ARG(9));
			LOAD_SYMBOL(SYMBOL(Slisp, 47), ARG(10));	/* VECTOR */
			Ferror(ARG(8), 3);
		}
		Frow_major_aref(ARG(6));
		if(CL_SYMBOLP(ARG(6)) && GET_SYMBOL(ARG(6)) == SYMBOL(Slisp, 462))	/* WHITESPACE */
		{
		}
		else
		{
			goto RETURN1;
		}
		COPY(ARG(1), ARG(6));
		COPY(ARG(4), ARG(7));
		COPY(ARG(6), ARG(8));
		LOAD_NIL(ARG(9));
		LOAD_NIL(ARG(10));
		COPY(ARG(7), ARG(11));
		read_char1(ARG(8));
		COPY(ARG(8), ARG(5));
		goto M1_1;
		RETURN1:;
	}
	else
	{
		if(CL_CHARP(ARG(0)))
		{
			M2_1:;
			if(CL_TRUEP(ARG(5)))
			{
			}
			else
			{
				goto RETURN2;
			}
			if(EQL(ARG(0), ARG(5)))
			{
			}
			else
			{
				goto RETURN2;
			}
			COPY(ARG(1), ARG(6));
			COPY(ARG(4), ARG(7));
			COPY(ARG(6), ARG(8));
			LOAD_NIL(ARG(9));
			LOAD_NIL(ARG(10));
			COPY(ARG(7), ARG(11));
			read_char1(ARG(8));
			COPY(ARG(8), ARG(5));
			goto M2_1;
			RETURN2:;
		}
	}
	if(CL_TRUEP(ARG(5)))
	{
	}
	else
	{
		if(CL_TRUEP(ARG(2)))
		{
			LOAD_SMSTR((CL_FORM *)&Kpeek_char1[0], ARG(6));	/* unexpected end of file */
			Ferror(ARG(6), 1);
		}
	}
	COPY(ARG(5), ARG(6));
	COPY(ARG(1), ARG(7));
	unread_char1(ARG(6));
	mv_count = 1;
	COPY(ARG(5), ARG(0));
}
Ejemplo n.º 13
0
void Fset_hash_table_size(CL_FORM *base)
{
	LOAD_SMALLFIXNUM(0, ARG(2));
	LOAD_SYMBOL(SYMBOL(Slisp, 389), ARG(3));	/* HASH-TABLE */
	rt_set_struct_ref(ARG(0));
}
Ejemplo n.º 14
0
void Fset_hash_table_rehash_threshold(CL_FORM *base)
{
	LOAD_FIXNUM(ARG(2), 3, ARG(2));
	LOAD_SYMBOL(SYMBOL(Slisp, 399), ARG(3));	/* HASH-TABLE */
	rt_set_struct_ref(ARG(0));
}
Ejemplo n.º 15
0
void wild_pathname_p1(CL_FORM *base)
{
	COPY(ARG(0), ARG(2));
	LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(3));	/* PATHNAME */
	rt_struct_typep(ARG(2));
	if(CL_TRUEP(ARG(2)))
	{
		COPY(ARG(0), ARG(2));
	}
	else
	{
		COPY(ARG(0), ARG(2));
		Fstringp(ARG(2));
		if(CL_TRUEP(ARG(2)))
		{
			COPY(ARG(0), ARG(2));
			LOAD_NIL(ARG(3));
			COPY(SYMVAL(Slisp, 233), ARG(4));	/* *DEFAULT-PATHNAME-DEFAULTS* */
			LOAD_FIXNUM(ARG(5), 0, ARG(5));
			LOAD_NIL(ARG(6));
			LOAD_NIL(ARG(7));
			parse_namestring1(ARG(2));
			mv_count = 1;
		}
		else
		{
			COPY(ARG(0), ARG(2));
			LOAD_SYMBOL(SYMBOL(Slisp, 64), ARG(3));	/* STREAM */
			rt_struct_typep(ARG(2));
			if(CL_TRUEP(ARG(2)))
			{
				COPY(ARG(0), ARG(2));
				LOAD_NIL(ARG(3));
				file_name1(ARG(2));
				COPY(SYMVAL(Slisp, 233), ARG(3));	/* *DEFAULT-PATHNAME-DEFAULTS* */
				COPY(ARG(2), ARG(4));
				LOAD_NIL(ARG(5));
				COPY(ARG(3), ARG(6));
				LOAD_FIXNUM(ARG(7), 0, ARG(7));
				LOAD_NIL(ARG(8));
				LOAD_NIL(ARG(9));
				parse_namestring1(ARG(4));
				mv_count = 1;
				COPY(ARG(4), ARG(2));
			}
			else
			{
				LOAD_SMSTR((CL_FORM *)&Kwild_pathname_p1[0], ARG(2));	/* etypecase: the value ~a is not a legal value */
				COPY(ARG(0), ARG(3));
				Ferror(ARG(2), 2);
			}
		}
	}
	if(CL_TRUEP(ARG(1)))
	{
		if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 251))	/* HOST */
		{
			COPY(ARG(2), ARG(3));
			LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(4));	/* PATHNAME */
			rt_struct_typep(ARG(3));
			if(CL_TRUEP(ARG(3)))
			{
				COPY(OFFSET(AR_BASE(GET_FORM(ARG(2))), 0 + 1), ARG(3));
			}
			else
			{
				COPY(SYMVAL(Slisp, 352), ARG(3));	/* NO_STRUCT */
				COPY(ARG(2), ARG(4));
				LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(5));	/* PATHNAME */
				Ferror(ARG(3), 3);
			}
			COPY(ARG(3), ARG(0));
			LOAD_SYMBOL(SYMBOL(Slisp, 250), ARG(1));	/* PATTERN */
			rt_struct_typep(ARG(0));
		}
		else
		{
			if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 252))	/* DEVICE */
			{
				COPY(ARG(2), ARG(3));
				LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(4));	/* PATHNAME */
				rt_struct_typep(ARG(3));
				if(CL_TRUEP(ARG(3)))
				{
					COPY(OFFSET(AR_BASE(GET_FORM(ARG(2))), 0 + 1), ARG(3));
				}
				else
				{
					COPY(SYMVAL(Slisp, 352), ARG(3));	/* NO_STRUCT */
					COPY(ARG(2), ARG(4));
					LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(5));	/* PATHNAME */
					Ferror(ARG(3), 3);
				}
				COPY(ARG(3), ARG(0));
				LOAD_SYMBOL(SYMBOL(Slisp, 250), ARG(1));	/* PATTERN */
				rt_struct_typep(ARG(0));
			}
			else
			{
				if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 253))	/* DIRECTORY */
				{
					LOAD_GLOBFUN(&Cpattern_p, ARG(3));
					COPY(ARG(2), ARG(4));
					LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(5));	/* PATHNAME */
					rt_struct_typep(ARG(4));
					if(CL_TRUEP(ARG(4)))
					{
						COPY(OFFSET(AR_BASE(GET_FORM(ARG(2))), 2 + 1), ARG(4));
					}
					else
					{
						COPY(SYMVAL(Slisp, 352), ARG(4));	/* NO_STRUCT */
						COPY(ARG(2), ARG(5));
						LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(6));	/* PATHNAME */
						Ferror(ARG(4), 3);
					}
					Fsome(ARG(3), 2);
					COPY(ARG(3), ARG(0));
				}
				else
				{
					if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 254))	/* NAME */
					{
						COPY(ARG(2), ARG(3));
						LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(4));	/* PATHNAME */
						rt_struct_typep(ARG(3));
						if(CL_TRUEP(ARG(3)))
						{
							COPY(OFFSET(AR_BASE(GET_FORM(ARG(2))), 3 + 1), ARG(3));
						}
						else
						{
							COPY(SYMVAL(Slisp, 352), ARG(3));	/* NO_STRUCT */
							COPY(ARG(2), ARG(4));
							LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(5));	/* PATHNAME */
							Ferror(ARG(3), 3);
						}
						COPY(ARG(3), ARG(0));
						LOAD_SYMBOL(SYMBOL(Slisp, 250), ARG(1));	/* PATTERN */
						rt_struct_typep(ARG(0));
					}
					else
					{
						if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 80))	/* TYPE */
						{
							COPY(ARG(2), ARG(3));
							LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(4));	/* PATHNAME */
							rt_struct_typep(ARG(3));
							if(CL_TRUEP(ARG(3)))
							{
								COPY(OFFSET(AR_BASE(GET_FORM(ARG(2))), 4 + 1), ARG(3));
							}
							else
							{
								COPY(SYMVAL(Slisp, 352), ARG(3));	/* NO_STRUCT */
								COPY(ARG(2), ARG(4));
								LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(5));	/* PATHNAME */
								Ferror(ARG(3), 3);
							}
							COPY(ARG(3), ARG(0));
							LOAD_SYMBOL(SYMBOL(Slisp, 250), ARG(1));	/* PATTERN */
							rt_struct_typep(ARG(0));
						}
						else
						{
							if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 255))	/* VERSION */
							{
								COPY(ARG(2), ARG(3));
								LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(4));	/* PATHNAME */
								rt_struct_typep(ARG(3));
								if(CL_TRUEP(ARG(3)))
								{
									COPY(OFFSET(AR_BASE(GET_FORM(ARG(2))), 5 + 1), ARG(3));
								}
								else
								{
									COPY(SYMVAL(Slisp, 352), ARG(3));	/* NO_STRUCT */
									COPY(ARG(2), ARG(4));
									LOAD_SYMBOL(SYMBOL(Slisp, 234), ARG(5));	/* PATHNAME */
									Ferror(ARG(3), 3);
								}
								LOAD_BOOL(CL_SYMBOLP(ARG(3)) && GET_SYMBOL(ARG(3)) == SYMBOL(Slisp, 271), ARG(0));	/* WILD */
							}
							else
							{
								LOAD_SMSTR((CL_FORM *)&Kwild_pathname_p1[2], ARG(0));	/* ecase: the value ~a is not a legal value */
								Ferror(ARG(0), 2);
							}
						}
					}
				}
			}
		}
	}
	else
	{
		COPY(ARG(2), ARG(3));
		LOAD_SYMBOL(SYMBOL(Slisp, 251), ARG(4));	/* HOST */
		wild_pathname_p1(ARG(3));
		if(CL_TRUEP(ARG(3)))
		{
			COPY(ARG(3), ARG(0));
		}
		else
		{
			COPY(ARG(2), ARG(4));
			LOAD_SYMBOL(SYMBOL(Slisp, 252), ARG(5));	/* DEVICE */
			wild_pathname_p1(ARG(4));
			if(CL_TRUEP(ARG(4)))
			{
				COPY(ARG(4), ARG(0));
			}
			else
			{
				COPY(ARG(2), ARG(5));
				LOAD_SYMBOL(SYMBOL(Slisp, 253), ARG(6));	/* DIRECTORY */
				wild_pathname_p1(ARG(5));
				if(CL_TRUEP(ARG(5)))
				{
					COPY(ARG(5), ARG(0));
				}
				else
				{
					COPY(ARG(2), ARG(6));
					LOAD_SYMBOL(SYMBOL(Slisp, 254), ARG(7));	/* NAME */
					wild_pathname_p1(ARG(6));
					if(CL_TRUEP(ARG(6)))
					{
						COPY(ARG(6), ARG(0));
					}
					else
					{
						COPY(ARG(2), ARG(7));
						LOAD_SYMBOL(SYMBOL(Slisp, 80), ARG(8));	/* TYPE */
						wild_pathname_p1(ARG(7));
						if(CL_TRUEP(ARG(7)))
						{
							COPY(ARG(7), ARG(0));
						}
						else
						{
							COPY(ARG(2), ARG(0));
							LOAD_SYMBOL(SYMBOL(Slisp, 255), ARG(1));	/* VERSION */
							wild_pathname_p1(ARG(0));
						}
					}
				}
			}
		}
	}
}
Ejemplo n.º 16
0
void write_to_string1(CL_FORM *base)
{
	BIND_SPECIAL(SYMBOL(Slisp, 474), ARG(1));	/* *PRINT-ESCAPE* */
	BIND_SPECIAL(SYMBOL(Slisp, 479), ARG(2));	/* *PRINT-RADIX* */
	BIND_SPECIAL(SYMBOL(Slisp, 471), ARG(3));	/* *PRINT-BASE* */
	BIND_SPECIAL(SYMBOL(Slisp, 473), ARG(4));	/* *PRINT-CIRCLE* */
	BIND_SPECIAL(SYMBOL(Slisp, 478), ARG(5));	/* *PRINT-PRETTY* */
	BIND_SPECIAL(SYMBOL(Slisp, 477), ARG(6));	/* *PRINT-LEVEL* */
	BIND_SPECIAL(SYMBOL(Slisp, 476), ARG(7));	/* *PRINT-LENGTH* */
	BIND_SPECIAL(SYMBOL(Slisp, 472), ARG(8));	/* *PRINT-CASE* */
	BIND_SPECIAL(SYMBOL(Slisp, 475), ARG(9));	/* *PRINT-GENSYM* */
	BIND_SPECIAL(SYMBOL(Slisp, 470), ARG(10));	/* *PRINT-ARRAY* */
	LOAD_FIXNUM(ARG(11), 10, ARG(11));
	LOAD_SYMBOL(SYMBOL(Slisp, 18), ARG(12));	/* CHARACTER */
	LOAD_NIL(ARG(13));
	LOAD_NIL(ARG(14));
	LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(15));	/* T */
	LOAD_FIXNUM(ARG(16), 0, ARG(16));
	LOAD_NIL(ARG(17));
	LOAD_FIXNUM(ARG(18), 0, ARG(18));
	LOAD_NIL(ARG(19));
	LOAD_NIL(ARG(20));
	LOAD_NIL(ARG(21));
	make_array1(ARG(11));
	make_string_output_stream1(ARG(11));
	COPY(ARG(0), ARG(12));
	COPY(ARG(11), ARG(13));
	write2(ARG(12));
	COPY(ARG(11), ARG(12));
	LOAD_SYMBOL(SYMBOL(Slisp, 64), ARG(13));	/* STREAM */
	rt_struct_typep(ARG(12));
	if(CL_TRUEP(ARG(12)))
	{
		COPY(OFFSET(AR_BASE(GET_FORM(ARG(11))), 0 + 1), ARG(12));
	}
	else
	{
		COPY(SYMVAL(Slisp, 352), ARG(12));	/* NO_STRUCT */
		COPY(ARG(11), ARG(13));
		LOAD_SYMBOL(SYMBOL(Slisp, 64), ARG(14));	/* STREAM */
		Ferror(ARG(12), 3);
	}
	if(CL_SYMBOLP(ARG(12)) && GET_SYMBOL(ARG(12)) == SYMBOL(Slisp, 102))	/* STRING-OUTPUT */
	{
	}
	else
	{
		LOAD_SMSTR((CL_FORM *)&KClisp[268], ARG(12));	/* string-output-stream expected */
		Ferror(ARG(12), 1);
	}
	COPY(ARG(11), ARG(12));
	COPY(ARG(12), ARG(13));
	COPY(ARG(13), ARG(14));
	LOAD_SYMBOL(SYMBOL(Slisp, 64), ARG(15));	/* STREAM */
	rt_struct_typep(ARG(14));
	if(CL_TRUEP(ARG(14)))
	{
		COPY(OFFSET(AR_BASE(GET_FORM(ARG(13))), 1 + 1), ARG(12));
	}
	else
	{
		COPY(SYMVAL(Slisp, 352), ARG(12));	/* NO_STRUCT */
		LOAD_SYMBOL(SYMBOL(Slisp, 64), ARG(14));	/* STREAM */
		Ferror(ARG(12), 3);
	}
	Ffuncall(ARG(12), 1);
	COPY(ARG(12), ARG(0));
	RESTORE_SPECIAL;
	RESTORE_SPECIAL;
	RESTORE_SPECIAL;
	RESTORE_SPECIAL;
	RESTORE_SPECIAL;
	RESTORE_SPECIAL;
	RESTORE_SPECIAL;
	RESTORE_SPECIAL;
	RESTORE_SPECIAL;
	RESTORE_SPECIAL;
}
Ejemplo n.º 17
0
void check_array_internal(CL_FORM *base)
{
	LOAD_BOOL(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 49), ARG(3));	/* * */
	if(CL_TRUEP(ARG(3)))
	{
		goto THEN1;
	}
	else
	{
		COPY(ARG(0), ARG(4));
		array_element_type_internal(ARG(4));
		to_element_type(ARG(4));
		COPY(ARG(1), ARG(5));
		Fupgraded_array_element_type(ARG(5));
	}
	if(EQL(ARG(4), ARG(5)))
	{
		THEN1:;
		LOAD_BOOL(CL_SYMBOLP(ARG(2)) && GET_SYMBOL(ARG(2)) == SYMBOL(Slisp, 49), ARG(3));	/* * */
		if(CL_TRUEP(ARG(3)))
		{
			COPY(ARG(3), ARG(0));
		}
		else
		{
			if(CL_ATOMP(ARG(2)))
			{
				COPY(ARG(0), ARG(4));
				Farray_rank(ARG(4));
				COPY(ARG(2), ARG(5));
				Fnumeql(ARG(4), 2);
				COPY(ARG(4), ARG(0));
			}
			else
			{
				COPY(ARG(0), ARG(4));
				Farray_rank(ARG(4));
				COPY(ARG(2), ARG(5));
				Flength(ARG(5));
				Fnumeql(ARG(4), 2);
				if(CL_TRUEP(ARG(4)))
				{
					LOAD_NIL(ARG(4));
					LOAD_FIXNUM(ARG(5), 0, ARG(5));
					M1_1:;
					COPY(ARG(5), ARG(6));
					COPY(ARG(2), ARG(7));
					Flength(ARG(7));
					Fge(ARG(6), 2);
					if(CL_TRUEP(ARG(6)))
					{
						LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(0));	/* T */
						goto RETURN1;
					}
					COPY(ARG(2), ARG(6));
					COPY(ARG(6), ARG(7));
					if(CL_CONSP(ARG(7)))
					{
						COPY(GET_CAR(ARG(7)), ARG(6));
					}
					else
					{
						if(CL_TRUEP(ARG(7)))
						{
							LOAD_SMSTR((CL_FORM *)&KClisp[264], ARG(6));	/* ~a is not a list */
							Ferror(ARG(6), 2);
						}
						else
						{
							COPY(ARG(7), ARG(6));
						}
					}
					COPY(ARG(2), ARG(7));
					COPY(ARG(7), ARG(8));
					if(CL_CONSP(ARG(8)))
					{
						COPY(GET_CDR(ARG(8)), ARG(2));
					}
					else
					{
						if(CL_TRUEP(ARG(8)))
						{
							LOAD_SMSTR((CL_FORM *)&KClisp[262], ARG(9));	/* ~a is not a list */
							COPY(ARG(8), ARG(10));
							Ferror(ARG(9), 2);
						}
						else
						{
							COPY(ARG(8), ARG(2));
						}
					}
					COPY(ARG(6), ARG(4));
					LOAD_BOOL(CL_SYMBOLP(ARG(4)) && GET_SYMBOL(ARG(4)) == SYMBOL(Slisp, 49), ARG(6));	/* * */
					if(CL_TRUEP(ARG(6)))
					{
						goto THEN2;
					}
					else
					{
						COPY(ARG(0), ARG(7));
						COPY(ARG(5), ARG(8));
						Farray_dimension(ARG(7));
						COPY(ARG(4), ARG(8));
						Fnumeql(ARG(7), 2);
					}
					if(CL_TRUEP(ARG(7)))
					{
						THEN2:;
					}
					else
					{
						LOAD_NIL(ARG(0));
						goto RETURN1;
					}
					F1plus(ARG(5));
					goto M1_1;
					RETURN1:;
				}
				else
				{
					LOAD_NIL(ARG(0));
				}
			}
		}
	}
	else
	{
		LOAD_NIL(ARG(0));
	}
}
Ejemplo n.º 18
0
int arch_elf_relocate_rel(struct elf_image_info *image, const char *sym_prepend,
	struct elf_image_info *resolve_image, struct Elf32_Rel *rel, int rel_len)
{
	int i;
	struct Elf32_Sym *sym;
	int vlErr;
	addr_t S;
	addr_t A;
	addr_t P;
	addr_t final_val;

	S = A = P = 0;

	for(i = 0; i * (int)sizeof(struct Elf32_Rel) < rel_len; i++) {
		//dprintf("looking at rel type %d, offset 0x%x\n", ELF32_R_TYPE(rel[i].r_info), rel[i].r_offset);

		// calc S
		switch(ELF32_R_TYPE(rel[i].r_info)) {
			case R_386_32:
			case R_386_PC32:
			case R_386_GLOB_DAT:
			case R_386_JMP_SLOT:
			case R_386_GOTOFF:
				sym = SYMBOL(image, ELF32_R_SYM(rel[i].r_info));

				vlErr = elf_resolve_symbol(image, sym, resolve_image, sym_prepend, &S);
                                if(vlErr<0) return vlErr;
				//dprintf("S 0x%x\n", S);
		}
		// calc A
		switch(ELF32_R_TYPE(rel[i].r_info)) {
			case R_386_32:
			case R_386_PC32:
			case R_386_GOT32:
			case R_386_PLT32:
			case R_386_RELATIVE:
			case R_386_GOTOFF:
			case R_386_GOTPC:
				A = *(addr_t *)(image->regions[0].delta + rel[i].r_offset);
//					dprintf("A 0x%x\n", A);
				break;
		}
		// calc P
		switch(ELF32_R_TYPE(rel[i].r_info)) {
			case R_386_PC32:
			case R_386_GOT32:
			case R_386_PLT32:
			case R_386_GOTPC:
				P = image->regions[0].delta + rel[i].r_offset;
//					dprintf("P 0x%x\n", P);
				break;
		}

		switch(ELF32_R_TYPE(rel[i].r_info)) {
			case R_386_NONE:
				continue;
			case R_386_32:
				final_val = S + A;
				break;
			case R_386_PC32:
				final_val = S + A - P;
				break;
			case R_386_RELATIVE:
				// B + A;
				final_val = image->regions[0].delta + A;
				break;
			case R_386_JMP_SLOT:
				final_val = S;
				//dprintf( "final = %lx\n", final_val );
				break;
			default:
				dprintf("arch_elf_relocate_rel: unhandled relocation type %d\n", ELF32_R_TYPE(rel[i].r_info));
				return ERR_NOT_ALLOWED;
		}
		*(addr_t *)(image->regions[0].delta + rel[i].r_offset) = final_val;
	}

	return NO_ERROR;
}
Ejemplo n.º 19
0
bool
GLLibraryEGL::EnsureInitialized()
{
    if (mInitialized) {
        return true;
    }

    mozilla::ScopedGfxFeatureReporter reporter("EGL");

#ifdef XP_WIN
#ifdef MOZ_WEBGL
    if (!mEGLLibrary) {
        // On Windows, the GLESv2, EGL and DXSDK libraries are shipped with libxul and
        // we should look for them there. We have to load the libs in this
        // order, because libEGL.dll depends on libGLESv2.dll which depends on the DXSDK
        // libraries. This matters especially for WebRT apps which are in a different directory.
        // See bug 760323 and bug 749459

        // Also note that we intentionally leak the libs we load.

        do {
            // Windows 8.1 has d3dcompiler_47.dll in the system directory.
            // Try it first. Note that _46 will never be in the system
            // directory and we ship with at least _43. So there is no point
            // trying _46 and _43 in the system directory.

            if (LoadLibrarySystem32(L"d3dcompiler_47.dll"))
                break;

#ifdef MOZ_D3DCOMPILER_VISTA_DLL
            if (LoadLibraryForEGLOnWindows(NS_LITERAL_STRING(NS_STRINGIFY(MOZ_D3DCOMPILER_VISTA_DLL))))
                break;
#endif

#ifdef MOZ_D3DCOMPILER_XP_DLL
            if (LoadLibraryForEGLOnWindows(NS_LITERAL_STRING(NS_STRINGIFY(MOZ_D3DCOMPILER_XP_DLL))))
                break;
#endif

            MOZ_ASSERT(false, "d3dcompiler DLL loading failed.");
        } while (false);

        LoadLibraryForEGLOnWindows(NS_LITERAL_STRING("libGLESv2.dll"));

        mEGLLibrary = LoadLibraryForEGLOnWindows(NS_LITERAL_STRING("libEGL.dll"));

        if (!mEGLLibrary)
            return false;
    }
#endif // MOZ_WEBGL
#else // !Windows

    // On non-Windows (Android) we use system copies of libEGL. We look for
    // the APITrace lib, libEGL.so, and libEGL.so.1 in that order.

#if defined(ANDROID)
    if (!mEGLLibrary)
        mEGLLibrary = LoadApitraceLibrary();
#endif

    if (!mEGLLibrary) {
        printf_stderr("Attempting load of libEGL.so\n");
        mEGLLibrary = PR_LoadLibrary("libEGL.so");
    }
#if defined(XP_UNIX)
    if (!mEGLLibrary) {
        mEGLLibrary = PR_LoadLibrary("libEGL.so.1");
    }
#endif

    if (!mEGLLibrary) {
        NS_WARNING("Couldn't load EGL LIB.");
        return false;
    }

#endif // !Windows

#define SYMBOL(name) \
{ (PRFuncPtr*) &mSymbols.f##name, { "egl" #name, nullptr } }

    GLLibraryLoader::SymLoadStruct earlySymbols[] = {
        SYMBOL(GetDisplay),
        SYMBOL(GetCurrentSurface),
        SYMBOL(GetCurrentContext),
        SYMBOL(MakeCurrent),
        SYMBOL(DestroyContext),
        SYMBOL(CreateContext),
        SYMBOL(DestroySurface),
        SYMBOL(CreateWindowSurface),
        SYMBOL(CreatePbufferSurface),
        SYMBOL(CreatePixmapSurface),
        SYMBOL(BindAPI),
        SYMBOL(Initialize),
        SYMBOL(ChooseConfig),
        SYMBOL(GetError),
        SYMBOL(GetConfigs),
        SYMBOL(GetConfigAttrib),
        SYMBOL(WaitNative),
        SYMBOL(GetProcAddress),
        SYMBOL(SwapBuffers),
        SYMBOL(CopyBuffers),
        SYMBOL(QueryString),
        SYMBOL(QueryContext),
        SYMBOL(BindTexImage),
        SYMBOL(ReleaseTexImage),
        SYMBOL(QuerySurface),
        { nullptr, { nullptr } }
    };

    if (!GLLibraryLoader::LoadSymbols(mEGLLibrary, &earlySymbols[0])) {
        NS_WARNING("Couldn't find required entry points in EGL library (early init)");
        return false;
    }

    mEGLDisplay = fGetDisplay(EGL_DEFAULT_DISPLAY);
    if (!fInitialize(mEGLDisplay, nullptr, nullptr))
        return false;

    const char *vendor = (const char*) fQueryString(mEGLDisplay, LOCAL_EGL_VENDOR);
    if (vendor && (strstr(vendor, "TransGaming") != 0 || strstr(vendor, "Google Inc.") != 0)) {
        mIsANGLE = true;
    }

    InitExtensions();

    GLLibraryLoader::PlatformLookupFunction lookupFunction =
            (GLLibraryLoader::PlatformLookupFunction)mSymbols.fGetProcAddress;

    if (IsExtensionSupported(KHR_lock_surface)) {
        GLLibraryLoader::SymLoadStruct lockSymbols[] = {
            { (PRFuncPtr*) &mSymbols.fLockSurface,   { "eglLockSurfaceKHR",   nullptr } },
            { (PRFuncPtr*) &mSymbols.fUnlockSurface, { "eglUnlockSurfaceKHR", nullptr } },
            { nullptr, { nullptr } }
        };

        bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
                                                    &lockSymbols[0],
                                                    lookupFunction);
        if (!success) {
            NS_ERROR("EGL supports KHR_lock_surface without exposing its functions!");

            MarkExtensionUnsupported(KHR_lock_surface);

            mSymbols.fLockSurface = nullptr;
            mSymbols.fUnlockSurface = nullptr;
        }
    }

    if (IsExtensionSupported(ANGLE_surface_d3d_texture_2d_share_handle)) {
        GLLibraryLoader::SymLoadStruct d3dSymbols[] = {
            { (PRFuncPtr*) &mSymbols.fQuerySurfacePointerANGLE, { "eglQuerySurfacePointerANGLE", nullptr } },
            { nullptr, { nullptr } }
        };

        bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
                                                    &d3dSymbols[0],
                                                    lookupFunction);
        if (!success) {
            NS_ERROR("EGL supports ANGLE_surface_d3d_texture_2d_share_handle without exposing its functions!");

            MarkExtensionUnsupported(ANGLE_surface_d3d_texture_2d_share_handle);

            mSymbols.fQuerySurfacePointerANGLE = nullptr;
        }
    }

    if (IsExtensionSupported(KHR_fence_sync)) {
        GLLibraryLoader::SymLoadStruct syncSymbols[] = {
            { (PRFuncPtr*) &mSymbols.fCreateSync,     { "eglCreateSyncKHR",     nullptr } },
            { (PRFuncPtr*) &mSymbols.fDestroySync,    { "eglDestroySyncKHR",    nullptr } },
            { (PRFuncPtr*) &mSymbols.fClientWaitSync, { "eglClientWaitSyncKHR", nullptr } },
            { (PRFuncPtr*) &mSymbols.fGetSyncAttrib,  { "eglGetSyncAttribKHR",  nullptr } },
            { nullptr, { nullptr } }
        };

        bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
                                                    &syncSymbols[0],
                                                    lookupFunction);
        if (!success) {
            NS_ERROR("EGL supports KHR_fence_sync without exposing its functions!");

            MarkExtensionUnsupported(KHR_fence_sync);

            mSymbols.fCreateSync = nullptr;
            mSymbols.fDestroySync = nullptr;
            mSymbols.fClientWaitSync = nullptr;
            mSymbols.fGetSyncAttrib = nullptr;
        }
    }

    if (IsExtensionSupported(KHR_image) || IsExtensionSupported(KHR_image_base)) {
        GLLibraryLoader::SymLoadStruct imageSymbols[] = {
            { (PRFuncPtr*) &mSymbols.fCreateImage,  { "eglCreateImageKHR",  nullptr } },
            { (PRFuncPtr*) &mSymbols.fDestroyImage, { "eglDestroyImageKHR", nullptr } },
            { nullptr, { nullptr } }
        };

        bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
                                                    &imageSymbols[0],
                                                    lookupFunction);
        if (!success) {
            NS_ERROR("EGL supports KHR_image(_base) without exposing its functions!");

            MarkExtensionUnsupported(KHR_image);
            MarkExtensionUnsupported(KHR_image_base);
            MarkExtensionUnsupported(KHR_image_pixmap);

            mSymbols.fCreateImage = nullptr;
            mSymbols.fDestroyImage = nullptr;
        }
    } else {
        MarkExtensionUnsupported(KHR_image_pixmap);
    }

    mInitialized = true;
    reporter.SetSuccessful();
    return true;
}
Ejemplo n.º 20
0
/**
 * load_symbols:
 * @type                        : Type of core to be loaded.
 *                                If CORE_TYPE_DUMMY, will 
 *                                load dummy symbols.
 *
 * Setup libretro callback symbols.
 **/
static void load_symbols(enum rarch_core_type type)
{
   switch (type)
   {
      case CORE_TYPE_PLAIN:
         {
#ifdef HAVE_DYNAMIC
            settings_t *settings = config_get_ptr();
            function_t sym       = dylib_proc(NULL, "retro_init");

            if (sym)
            {
               /* Try to verify that -lretro was not linked in from other modules
                * since loading it dynamically and with -l will fail hard. */
               RARCH_ERR("Serious problem. RetroArch wants to load libretro cores dyamically, but it is already linked.\n");
               RARCH_ERR("This could happen if other modules RetroArch depends on link against libretro directly.\n");
               RARCH_ERR("Proceeding could cause a crash. Aborting ...\n");
               rarch_fail(1, "init_libretro_sym()");
            }

            if (!*settings->libretro)
            {
               RARCH_ERR("RetroArch is built for dynamic libretro cores, but libretro_path is not set. Cannot continue.\n");
               rarch_fail(1, "init_libretro_sym()");
            }

            /* Need to use absolute path for this setting. It can be 
             * saved to content history, and a relative path would 
             * break in that scenario. */
            path_resolve_realpath(settings->libretro,
                  sizeof(settings->libretro));

            RARCH_LOG("Loading dynamic libretro core from: \"%s\"\n",
                  settings->libretro);
            lib_handle = dylib_load(settings->libretro);
            if (!lib_handle)
            {
               RARCH_ERR("Failed to open libretro core: \"%s\"\n",
                     settings->libretro);
               RARCH_ERR("Error(s): %s\n", dylib_error());
               rarch_fail(1, "load_dynamic()");
            }
#endif
         }

         SYMBOL(retro_init);
         SYMBOL(retro_deinit);

         SYMBOL(retro_api_version);
         SYMBOL(retro_get_system_info);
         SYMBOL(retro_get_system_av_info);

         SYMBOL(retro_set_environment);
         SYMBOL(retro_set_video_refresh);
         SYMBOL(retro_set_audio_sample);
         SYMBOL(retro_set_audio_sample_batch);
         SYMBOL(retro_set_input_poll);
         SYMBOL(retro_set_input_state);

         SYMBOL(retro_set_controller_port_device);

         SYMBOL(retro_reset);
         SYMBOL(retro_run);

         SYMBOL(retro_serialize_size);
         SYMBOL(retro_serialize);
         SYMBOL(retro_unserialize);

         SYMBOL(retro_cheat_reset);
         SYMBOL(retro_cheat_set);

         SYMBOL(retro_load_game);
         SYMBOL(retro_load_game_special);

         SYMBOL(retro_unload_game);
         SYMBOL(retro_get_region);
         SYMBOL(retro_get_memory_data);
         SYMBOL(retro_get_memory_size);
         break;
      case CORE_TYPE_DUMMY:
         SYMBOL_DUMMY(retro_init);
         SYMBOL_DUMMY(retro_deinit);

         SYMBOL_DUMMY(retro_api_version);
         SYMBOL_DUMMY(retro_get_system_info);
         SYMBOL_DUMMY(retro_get_system_av_info);

         SYMBOL_DUMMY(retro_set_environment);
         SYMBOL_DUMMY(retro_set_video_refresh);
         SYMBOL_DUMMY(retro_set_audio_sample);
         SYMBOL_DUMMY(retro_set_audio_sample_batch);
         SYMBOL_DUMMY(retro_set_input_poll);
         SYMBOL_DUMMY(retro_set_input_state);

         SYMBOL_DUMMY(retro_set_controller_port_device);

         SYMBOL_DUMMY(retro_reset);
         SYMBOL_DUMMY(retro_run);

         SYMBOL_DUMMY(retro_serialize_size);
         SYMBOL_DUMMY(retro_serialize);
         SYMBOL_DUMMY(retro_unserialize);

         SYMBOL_DUMMY(retro_cheat_reset);
         SYMBOL_DUMMY(retro_cheat_set);

         SYMBOL_DUMMY(retro_load_game);
         SYMBOL_DUMMY(retro_load_game_special);

         SYMBOL_DUMMY(retro_unload_game);
         SYMBOL_DUMMY(retro_get_region);
         SYMBOL_DUMMY(retro_get_memory_data);
         SYMBOL_DUMMY(retro_get_memory_size);
         break;
#ifdef HAVE_FFMPEG
      case CORE_TYPE_FFMPEG:
         SYMBOL_FFMPEG(retro_init);
         SYMBOL_FFMPEG(retro_deinit);

         SYMBOL_FFMPEG(retro_api_version);
         SYMBOL_FFMPEG(retro_get_system_info);
         SYMBOL_FFMPEG(retro_get_system_av_info);

         SYMBOL_FFMPEG(retro_set_environment);
         SYMBOL_FFMPEG(retro_set_video_refresh);
         SYMBOL_FFMPEG(retro_set_audio_sample);
         SYMBOL_FFMPEG(retro_set_audio_sample_batch);
         SYMBOL_FFMPEG(retro_set_input_poll);
         SYMBOL_FFMPEG(retro_set_input_state);

         SYMBOL_FFMPEG(retro_set_controller_port_device);

         SYMBOL_FFMPEG(retro_reset);
         SYMBOL_FFMPEG(retro_run);

         SYMBOL_FFMPEG(retro_serialize_size);
         SYMBOL_FFMPEG(retro_serialize);
         SYMBOL_FFMPEG(retro_unserialize);

         SYMBOL_FFMPEG(retro_cheat_reset);
         SYMBOL_FFMPEG(retro_cheat_set);

         SYMBOL_FFMPEG(retro_load_game);
         SYMBOL_FFMPEG(retro_load_game_special);

         SYMBOL_FFMPEG(retro_unload_game);
         SYMBOL_FFMPEG(retro_get_region);
         SYMBOL_FFMPEG(retro_get_memory_data);
         SYMBOL_FFMPEG(retro_get_memory_size);
         break;
#endif
      case CORE_TYPE_IMAGEVIEWER:
#ifdef HAVE_IMAGEVIEWER
         SYMBOL_IMAGEVIEWER(retro_init);
         SYMBOL_IMAGEVIEWER(retro_deinit);

         SYMBOL_IMAGEVIEWER(retro_api_version);
         SYMBOL_IMAGEVIEWER(retro_get_system_info);
         SYMBOL_IMAGEVIEWER(retro_get_system_av_info);

         SYMBOL_IMAGEVIEWER(retro_set_environment);
         SYMBOL_IMAGEVIEWER(retro_set_video_refresh);
         SYMBOL_IMAGEVIEWER(retro_set_audio_sample);
         SYMBOL_IMAGEVIEWER(retro_set_audio_sample_batch);
         SYMBOL_IMAGEVIEWER(retro_set_input_poll);
         SYMBOL_IMAGEVIEWER(retro_set_input_state);

         SYMBOL_IMAGEVIEWER(retro_set_controller_port_device);

         SYMBOL_IMAGEVIEWER(retro_reset);
         SYMBOL_IMAGEVIEWER(retro_run);

         SYMBOL_IMAGEVIEWER(retro_serialize_size);
         SYMBOL_IMAGEVIEWER(retro_serialize);
         SYMBOL_IMAGEVIEWER(retro_unserialize);

         SYMBOL_IMAGEVIEWER(retro_cheat_reset);
         SYMBOL_IMAGEVIEWER(retro_cheat_set);

         SYMBOL_IMAGEVIEWER(retro_load_game);
         SYMBOL_IMAGEVIEWER(retro_load_game_special);

         SYMBOL_IMAGEVIEWER(retro_unload_game);
         SYMBOL_IMAGEVIEWER(retro_get_region);
         SYMBOL_IMAGEVIEWER(retro_get_memory_data);
         SYMBOL_IMAGEVIEWER(retro_get_memory_size);
#endif
         break;
   }
}
Ejemplo n.º 21
0
void FcharLE(CL_FORM *base, int nargs)
{
	CL_FORM *rest_0;
	CL_FORM *local;
	rest_0 = ARG(1);
	local = ARG(nargs);
	{
		CL_FORM *rest_1;
		LOAD_NIL(LOCAL(0));
		rest_1 = rest_0;
		M1_1:;
		if(NOT(REST_NOT_EMPTY(rest_1)))
		{
			LOAD_NIL(LOCAL(0));
			LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(0));	/* T */
			goto RETURN1;
		}
		{
			CL_FORM *rest_2;
			rest_2 = rest_1;
			REST_CAR(rest_2, LOCAL(0));
		}
		if(CL_CHARP(ARG(0)))
		{
		}
		else
		{
			COPY(SYMVAL(Slisp, 58), LOCAL(1));	/* WRONG_TYPE */
			COPY(ARG(0), LOCAL(2));
			LOAD_SYMBOL(SYMBOL(Slisp, 18), LOCAL(3));	/* CHARACTER */
			Ferror(LOCAL(1), 3);
		}
		COPY(ARG(0), LOCAL(1));
		rt_char_code(LOCAL(1));
		if(CL_CHARP(LOCAL(0)))
		{
		}
		else
		{
			COPY(SYMVAL(Slisp, 58), LOCAL(2));	/* WRONG_TYPE */
			COPY(LOCAL(0), LOCAL(3));
			LOAD_SYMBOL(SYMBOL(Slisp, 18), LOCAL(4));	/* CHARACTER */
			Ferror(LOCAL(2), 3);
		}
		COPY(LOCAL(0), LOCAL(2));
		rt_char_code(LOCAL(2));
		Fgt(LOCAL(1), 2);
		if(CL_TRUEP(LOCAL(1)))
		{
			LOAD_NIL(ARG(0));
			goto RETURN1;
		}
		COPY(LOCAL(0), ARG(0));
		{
			CL_FORM *rest_3;
			rest_3 = rest_1;
			rest_1 = REST_CDR(rest_3);
		}
		goto M1_1;
	}
	RETURN1:;
}
Ejemplo n.º 22
0
bool
GLLibraryEGL::EnsureInitialized(bool forceAccel)
{
    if (mInitialized) {
        return true;
    }

    mozilla::ScopedGfxFeatureReporter reporter("EGL");

#ifdef MOZ_B2G
    if (!sCurrentContext.init())
      MOZ_CRASH("Tls init failed");
#endif

#ifdef XP_WIN
    if (!mEGLLibrary) {
        // On Windows, the GLESv2, EGL and DXSDK libraries are shipped with libxul and
        // we should look for them there. We have to load the libs in this
        // order, because libEGL.dll depends on libGLESv2.dll which depends on the DXSDK
        // libraries. This matters especially for WebRT apps which are in a different directory.
        // See bug 760323 and bug 749459

        // Also note that we intentionally leak the libs we load.

        do {
            // Windows 8.1 has d3dcompiler_47.dll in the system directory.
            // Try it first. Note that _46 will never be in the system
            // directory and we ship with at least _43. So there is no point
            // trying _46 and _43 in the system directory.

            if (LoadLibrarySystem32(L"d3dcompiler_47.dll"))
                break;

#ifdef MOZ_D3DCOMPILER_VISTA_DLL
            if (LoadLibraryForEGLOnWindows(NS_LITERAL_STRING(NS_STRINGIFY(MOZ_D3DCOMPILER_VISTA_DLL))))
                break;
#endif

#ifdef MOZ_D3DCOMPILER_XP_DLL
            if (LoadLibraryForEGLOnWindows(NS_LITERAL_STRING(NS_STRINGIFY(MOZ_D3DCOMPILER_XP_DLL))))
                break;
#endif

            MOZ_ASSERT(false, "d3dcompiler DLL loading failed.");
        } while (false);

        LoadLibraryForEGLOnWindows(NS_LITERAL_STRING("libGLESv2.dll"));

        mEGLLibrary = LoadLibraryForEGLOnWindows(NS_LITERAL_STRING("libEGL.dll"));

        if (!mEGLLibrary)
            return false;
    }

#else // !Windows

    // On non-Windows (Android) we use system copies of libEGL. We look for
    // the APITrace lib, libEGL.so, and libEGL.so.1 in that order.

#if defined(ANDROID)
    if (!mEGLLibrary)
        mEGLLibrary = LoadApitraceLibrary();
#endif

    if (!mEGLLibrary) {
        printf_stderr("Attempting load of libEGL.so\n");
        mEGLLibrary = PR_LoadLibrary("libEGL.so");
    }
#if defined(XP_UNIX)
    if (!mEGLLibrary) {
        mEGLLibrary = PR_LoadLibrary("libEGL.so.1");
    }
#endif

    if (!mEGLLibrary) {
        NS_WARNING("Couldn't load EGL LIB.");
        return false;
    }

#endif // !Windows

#define SYMBOL(name) \
{ (PRFuncPtr*) &mSymbols.f##name, { "egl" #name, nullptr } }

    GLLibraryLoader::SymLoadStruct earlySymbols[] = {
        SYMBOL(GetDisplay),
        SYMBOL(Terminate),
        SYMBOL(GetCurrentSurface),
        SYMBOL(GetCurrentContext),
        SYMBOL(MakeCurrent),
        SYMBOL(DestroyContext),
        SYMBOL(CreateContext),
        SYMBOL(DestroySurface),
        SYMBOL(CreateWindowSurface),
        SYMBOL(CreatePbufferSurface),
        SYMBOL(CreatePixmapSurface),
        SYMBOL(BindAPI),
        SYMBOL(Initialize),
        SYMBOL(ChooseConfig),
        SYMBOL(GetError),
        SYMBOL(GetConfigs),
        SYMBOL(GetConfigAttrib),
        SYMBOL(WaitNative),
        SYMBOL(GetProcAddress),
        SYMBOL(SwapBuffers),
        SYMBOL(CopyBuffers),
        SYMBOL(QueryString),
        SYMBOL(QueryContext),
        SYMBOL(BindTexImage),
        SYMBOL(ReleaseTexImage),
        SYMBOL(QuerySurface),
        { nullptr, { nullptr } }
    };

    if (!GLLibraryLoader::LoadSymbols(mEGLLibrary, &earlySymbols[0])) {
        NS_WARNING("Couldn't find required entry points in EGL library (early init)");
        return false;
    }

    GLLibraryLoader::SymLoadStruct optionalSymbols[] = {
        // On Android 4.3 and up, certain features like ANDROID_native_fence_sync
        // can only be queried by using a special eglQueryString.
        { (PRFuncPtr*) &mSymbols.fQueryStringImplementationANDROID,
          { "_Z35eglQueryStringImplementationANDROIDPvi", nullptr } },
        { nullptr, { nullptr } }
    };

    // Do not warn about the failure to load this - see bug 1092191
    GLLibraryLoader::LoadSymbols(mEGLLibrary, &optionalSymbols[0], nullptr, nullptr,
                                 false);

#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 18
    MOZ_RELEASE_ASSERT(mSymbols.fQueryStringImplementationANDROID,
                       "Couldn't find eglQueryStringImplementationANDROID");
#endif

    InitClientExtensions();

    const auto lookupFunction =
        (GLLibraryLoader::PlatformLookupFunction)mSymbols.fGetProcAddress;

    // Client exts are ready. (But not display exts!)
    if (IsExtensionSupported(ANGLE_platform_angle_d3d)) {
        GLLibraryLoader::SymLoadStruct d3dSymbols[] = {
            { (PRFuncPtr*)&mSymbols.fGetPlatformDisplayEXT, { "eglGetPlatformDisplayEXT", nullptr } },
            { nullptr, { nullptr } }
        };

        bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
                                                    &d3dSymbols[0],
                                                    lookupFunction);
        if (!success) {
            NS_ERROR("EGL supports ANGLE_platform_angle_d3d without exposing its functions!");

            MarkExtensionUnsupported(ANGLE_platform_angle_d3d);

            mSymbols.fGetPlatformDisplayEXT = nullptr;
        }
    }

    // Check the ANGLE support the system has
    nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
    mIsANGLE = IsExtensionSupported(ANGLE_platform_angle);

    EGLDisplay chosenDisplay = nullptr;

    if (IsExtensionSupported(ANGLE_platform_angle_d3d)) {
        bool accelAngleSupport = IsAccelAngleSupported(gfxInfo);
        bool warpAngleSupport = gfxPlatform::CanUseDirect3D11ANGLE();

        bool shouldTryAccel = forceAccel || accelAngleSupport;
        bool shouldTryWARP = !shouldTryAccel && warpAngleSupport;
        if (gfxPrefs::WebGLANGLEForceWARP()) {
            shouldTryWARP = true;
            shouldTryAccel = false;
        }

        // Fallback to a WARP display if non-WARP is blacklisted,
        // or if WARP is forced
        if (shouldTryWARP) {
            chosenDisplay = GetAndInitWARPDisplay(*this, EGL_DEFAULT_DISPLAY);
            if (chosenDisplay) {
                mIsWARP = true;
            }
        }

        if (!chosenDisplay) {
            // If falling back to WARP did not work and we don't want to try
            // using HW accelerated ANGLE, then fail
            if (!shouldTryAccel) {
                NS_ERROR("Fallback WARP ANGLE context failed to initialize.");
                return false;
            }

            // Hardware accelerated ANGLE path

            // D3D11 ANGLE only works with OMTC; there's a bug in the non-OMTC layer
            // manager, and it's pointless to try to fix it.  We also don't try
            // D3D11 ANGLE if the layer manager is prefering D3D9 (hrm, do we care?)
            if (gfxPrefs::LayersOffMainThreadCompositionEnabled() &&
                !gfxPrefs::LayersPreferD3D9())
            {
                if (gfxPrefs::WebGLANGLEForceD3D11()) {
                    chosenDisplay = GetAndInitDisplay(*this,
                                                      LOCAL_EGL_D3D11_ONLY_DISPLAY_ANGLE);
                } else if (gfxPrefs::WebGLANGLETryD3D11() &&
                           gfxPlatform::CanUseDirect3D11ANGLE())
                {
                    chosenDisplay = GetAndInitDisplay(*this,
                                                      LOCAL_EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE);
                }
            }
        }
    } else {
        chosenDisplay = GetAndInitDisplay(*this, EGL_DEFAULT_DISPLAY);
    }

    if (!chosenDisplay) {
        NS_WARNING("Failed to initialize a display.");
        return false;
    }
    mEGLDisplay = chosenDisplay;

    InitDisplayExtensions();

    ////////////////////////////////////
    // Alright, load display exts.

    if (IsExtensionSupported(KHR_lock_surface)) {
        GLLibraryLoader::SymLoadStruct lockSymbols[] = {
            { (PRFuncPtr*) &mSymbols.fLockSurface,   { "eglLockSurfaceKHR",   nullptr } },
            { (PRFuncPtr*) &mSymbols.fUnlockSurface, { "eglUnlockSurfaceKHR", nullptr } },
            { nullptr, { nullptr } }
        };

        bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
                                                    &lockSymbols[0],
                                                    lookupFunction);
        if (!success) {
            NS_ERROR("EGL supports KHR_lock_surface without exposing its functions!");

            MarkExtensionUnsupported(KHR_lock_surface);

            mSymbols.fLockSurface = nullptr;
            mSymbols.fUnlockSurface = nullptr;
        }
    }

    if (IsExtensionSupported(ANGLE_surface_d3d_texture_2d_share_handle)) {
        GLLibraryLoader::SymLoadStruct d3dSymbols[] = {
            { (PRFuncPtr*) &mSymbols.fQuerySurfacePointerANGLE, { "eglQuerySurfacePointerANGLE", nullptr } },
            { nullptr, { nullptr } }
        };

        bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
                                                    &d3dSymbols[0],
                                                    lookupFunction);
        if (!success) {
            NS_ERROR("EGL supports ANGLE_surface_d3d_texture_2d_share_handle without exposing its functions!");

            MarkExtensionUnsupported(ANGLE_surface_d3d_texture_2d_share_handle);

            mSymbols.fQuerySurfacePointerANGLE = nullptr;
        }
    }

    if (IsExtensionSupported(KHR_fence_sync)) {
        GLLibraryLoader::SymLoadStruct syncSymbols[] = {
            { (PRFuncPtr*) &mSymbols.fCreateSync,     { "eglCreateSyncKHR",     nullptr } },
            { (PRFuncPtr*) &mSymbols.fDestroySync,    { "eglDestroySyncKHR",    nullptr } },
            { (PRFuncPtr*) &mSymbols.fClientWaitSync, { "eglClientWaitSyncKHR", nullptr } },
            { (PRFuncPtr*) &mSymbols.fGetSyncAttrib,  { "eglGetSyncAttribKHR",  nullptr } },
            { nullptr, { nullptr } }
        };

        bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
                                                    &syncSymbols[0],
                                                    lookupFunction);
        if (!success) {
            NS_ERROR("EGL supports KHR_fence_sync without exposing its functions!");

            MarkExtensionUnsupported(KHR_fence_sync);

            mSymbols.fCreateSync = nullptr;
            mSymbols.fDestroySync = nullptr;
            mSymbols.fClientWaitSync = nullptr;
            mSymbols.fGetSyncAttrib = nullptr;
        }
    }

    if (IsExtensionSupported(KHR_image) || IsExtensionSupported(KHR_image_base)) {
        GLLibraryLoader::SymLoadStruct imageSymbols[] = {
            { (PRFuncPtr*) &mSymbols.fCreateImage,  { "eglCreateImageKHR",  nullptr } },
            { (PRFuncPtr*) &mSymbols.fDestroyImage, { "eglDestroyImageKHR", nullptr } },
            { nullptr, { nullptr } }
        };

        bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
                                                    &imageSymbols[0],
                                                    lookupFunction);
        if (!success) {
            NS_ERROR("EGL supports KHR_image(_base) without exposing its functions!");

            MarkExtensionUnsupported(KHR_image);
            MarkExtensionUnsupported(KHR_image_base);
            MarkExtensionUnsupported(KHR_image_pixmap);

            mSymbols.fCreateImage = nullptr;
            mSymbols.fDestroyImage = nullptr;
        }
    } else {
        MarkExtensionUnsupported(KHR_image_pixmap);
    }

    if (IsExtensionSupported(ANDROID_native_fence_sync)) {
        GLLibraryLoader::SymLoadStruct nativeFenceSymbols[] = {
            { (PRFuncPtr*) &mSymbols.fDupNativeFenceFDANDROID, { "eglDupNativeFenceFDANDROID", nullptr } },
            { nullptr, { nullptr } }
        };

        bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
                                                    &nativeFenceSymbols[0],
                                                    lookupFunction);
        if (!success) {
            NS_ERROR("EGL supports ANDROID_native_fence_sync without exposing its functions!");

            MarkExtensionUnsupported(ANDROID_native_fence_sync);

            mSymbols.fDupNativeFenceFDANDROID = nullptr;
        }
    }

    mInitialized = true;
    reporter.SetSuccessful();
    return true;
}
Ejemplo n.º 23
0
Object *classlibThreadPreInit(Class *thread_class, Class *thrdGrp_class) {
    MethodBlock *system_init_mb, *main_init_mb;
    FieldBlock *thread_status_fb, *eetop_fb;
    Object *system, *main, *main_name;

    init_mb_with_name = findMethod(thread_class, SYMBOL(object_init),
                           SYMBOL(_java_lang_ThreadGroup_java_lang_String__V));

    init_mb_no_name = findMethod(thread_class, SYMBOL(object_init),
                         SYMBOL(_java_lang_ThreadGroup_java_lang_Runnable__V));

    thread_status_fb = findField(thread_class, SYMBOL(threadStatus),
                                               SYMBOL(I));

    eetop_fb = findField(thread_class, SYMBOL(eetop), SYMBOL(J));

    system_init_mb = findMethod(thrdGrp_class, SYMBOL(object_init),
                                               SYMBOL(___V));

    main_init_mb = findMethod(thrdGrp_class, SYMBOL(object_init),
                           SYMBOL(_java_lang_ThreadGroup_java_lang_String__V));

    if(init_mb_with_name   == NULL || init_mb_no_name == NULL ||
          system_init_mb   == NULL || main_init_mb    == NULL ||
          thread_status_fb == NULL || eetop_fb        == NULL)
        return NULL;

    CLASS_CB(thread_class)->flags |= JTHREAD;

    thread_status_offset = thread_status_fb->u.offset;
    eetop_offset = eetop_fb->u.offset;

    if((system = allocObject(thrdGrp_class)) == NULL)
        return NULL;

    executeMethod(system, system_init_mb);
    if(exceptionOccurred())
        return NULL;

    if((main = allocObject(thrdGrp_class)) == NULL ||
       (main_name = Cstr2String("main")) == NULL)
        return NULL;

    executeMethod(main, main_init_mb, system, main_name);
    if(exceptionOccurred())
        return NULL;

    return main;
}
Ejemplo n.º 24
0
#include <linux/netfilter/nf_tables.h>
#include <linux/netfilter/nf_conntrack_common.h>
#include <linux/netfilter/nf_conntrack_tuple_common.h>

#include <erec.h>
#include <expression.h>
#include <datatype.h>
#include <gmputil.h>
#include <ct.h>
#include <gmputil.h>
#include <utils.h>
#include <statement.h>

static const struct symbol_table ct_state_tbl = {
	.symbols	= {
		SYMBOL("invalid",	NF_CT_STATE_INVALID_BIT),
		SYMBOL("new",		NF_CT_STATE_BIT(IP_CT_NEW)),
		SYMBOL("established",	NF_CT_STATE_BIT(IP_CT_ESTABLISHED)),
		SYMBOL("related",	NF_CT_STATE_BIT(IP_CT_RELATED)),
		SYMBOL("untracked",	NF_CT_STATE_UNTRACKED_BIT),
		SYMBOL_LIST_END
	}
};

static const struct datatype ct_state_type = {
	.type		= TYPE_CT_STATE,
	.name		= "ct_state",
	.desc		= "conntrack state",
	.byteorder	= BYTEORDER_HOST_ENDIAN,
	.size		= 4 * BITS_PER_BYTE,
	.basetype	= &bitmask_type,
Ejemplo n.º 25
0
/**
 * load_symbols:
 * @type                        : Type of core to be loaded.
 *                                If CORE_TYPE_DUMMY, will
 *                                load dummy symbols.
 *
 * Setup libretro callback symbols.
 **/
static void load_symbols(enum rarch_core_type type, struct retro_core_t *current_core)
{
   switch (type)
   {
      case CORE_TYPE_PLAIN:
#ifdef HAVE_DYNAMIC
         load_dynamic_core();
#endif

         SYMBOL(retro_init);
         SYMBOL(retro_deinit);

         SYMBOL(retro_api_version);
         SYMBOL(retro_get_system_info);
         SYMBOL(retro_get_system_av_info);

         SYMBOL(retro_set_environment);
         SYMBOL(retro_set_video_refresh);
         SYMBOL(retro_set_audio_sample);
         SYMBOL(retro_set_audio_sample_batch);
         SYMBOL(retro_set_input_poll);
         SYMBOL(retro_set_input_state);

         SYMBOL(retro_set_controller_port_device);

         SYMBOL(retro_reset);
         SYMBOL(retro_run);

         SYMBOL(retro_serialize_size);
         SYMBOL(retro_serialize);
         SYMBOL(retro_unserialize);

         SYMBOL(retro_cheat_reset);
         SYMBOL(retro_cheat_set);

         SYMBOL(retro_load_game);
         SYMBOL(retro_load_game_special);

         SYMBOL(retro_unload_game);
         SYMBOL(retro_get_region);
         SYMBOL(retro_get_memory_data);
         SYMBOL(retro_get_memory_size);
         break;
      case CORE_TYPE_DUMMY:
         SYMBOL_DUMMY(retro_init);
         SYMBOL_DUMMY(retro_deinit);

         SYMBOL_DUMMY(retro_api_version);
         SYMBOL_DUMMY(retro_get_system_info);
         SYMBOL_DUMMY(retro_get_system_av_info);

         SYMBOL_DUMMY(retro_set_environment);
         SYMBOL_DUMMY(retro_set_video_refresh);
         SYMBOL_DUMMY(retro_set_audio_sample);
         SYMBOL_DUMMY(retro_set_audio_sample_batch);
         SYMBOL_DUMMY(retro_set_input_poll);
         SYMBOL_DUMMY(retro_set_input_state);

         SYMBOL_DUMMY(retro_set_controller_port_device);

         SYMBOL_DUMMY(retro_reset);
         SYMBOL_DUMMY(retro_run);

         SYMBOL_DUMMY(retro_serialize_size);
         SYMBOL_DUMMY(retro_serialize);
         SYMBOL_DUMMY(retro_unserialize);

         SYMBOL_DUMMY(retro_cheat_reset);
         SYMBOL_DUMMY(retro_cheat_set);

         SYMBOL_DUMMY(retro_load_game);
         SYMBOL_DUMMY(retro_load_game_special);

         SYMBOL_DUMMY(retro_unload_game);
         SYMBOL_DUMMY(retro_get_region);
         SYMBOL_DUMMY(retro_get_memory_data);
         SYMBOL_DUMMY(retro_get_memory_size);
         break;
      case CORE_TYPE_FFMPEG:
#ifdef HAVE_FFMPEG
         SYMBOL_FFMPEG(retro_init);
         SYMBOL_FFMPEG(retro_deinit);

         SYMBOL_FFMPEG(retro_api_version);
         SYMBOL_FFMPEG(retro_get_system_info);
         SYMBOL_FFMPEG(retro_get_system_av_info);

         SYMBOL_FFMPEG(retro_set_environment);
         SYMBOL_FFMPEG(retro_set_video_refresh);
         SYMBOL_FFMPEG(retro_set_audio_sample);
         SYMBOL_FFMPEG(retro_set_audio_sample_batch);
         SYMBOL_FFMPEG(retro_set_input_poll);
         SYMBOL_FFMPEG(retro_set_input_state);

         SYMBOL_FFMPEG(retro_set_controller_port_device);

         SYMBOL_FFMPEG(retro_reset);
         SYMBOL_FFMPEG(retro_run);

         SYMBOL_FFMPEG(retro_serialize_size);
         SYMBOL_FFMPEG(retro_serialize);
         SYMBOL_FFMPEG(retro_unserialize);

         SYMBOL_FFMPEG(retro_cheat_reset);
         SYMBOL_FFMPEG(retro_cheat_set);

         SYMBOL_FFMPEG(retro_load_game);
         SYMBOL_FFMPEG(retro_load_game_special);

         SYMBOL_FFMPEG(retro_unload_game);
         SYMBOL_FFMPEG(retro_get_region);
         SYMBOL_FFMPEG(retro_get_memory_data);
         SYMBOL_FFMPEG(retro_get_memory_size);
#endif
         break;
      case CORE_TYPE_IMAGEVIEWER:
#ifdef HAVE_IMAGEVIEWER
         SYMBOL_IMAGEVIEWER(retro_init);
         SYMBOL_IMAGEVIEWER(retro_deinit);

         SYMBOL_IMAGEVIEWER(retro_api_version);
         SYMBOL_IMAGEVIEWER(retro_get_system_info);
         SYMBOL_IMAGEVIEWER(retro_get_system_av_info);

         SYMBOL_IMAGEVIEWER(retro_set_environment);
         SYMBOL_IMAGEVIEWER(retro_set_video_refresh);
         SYMBOL_IMAGEVIEWER(retro_set_audio_sample);
         SYMBOL_IMAGEVIEWER(retro_set_audio_sample_batch);
         SYMBOL_IMAGEVIEWER(retro_set_input_poll);
         SYMBOL_IMAGEVIEWER(retro_set_input_state);

         SYMBOL_IMAGEVIEWER(retro_set_controller_port_device);

         SYMBOL_IMAGEVIEWER(retro_reset);
         SYMBOL_IMAGEVIEWER(retro_run);

         SYMBOL_IMAGEVIEWER(retro_serialize_size);
         SYMBOL_IMAGEVIEWER(retro_serialize);
         SYMBOL_IMAGEVIEWER(retro_unserialize);

         SYMBOL_IMAGEVIEWER(retro_cheat_reset);
         SYMBOL_IMAGEVIEWER(retro_cheat_set);

         SYMBOL_IMAGEVIEWER(retro_load_game);
         SYMBOL_IMAGEVIEWER(retro_load_game_special);

         SYMBOL_IMAGEVIEWER(retro_unload_game);
         SYMBOL_IMAGEVIEWER(retro_get_region);
         SYMBOL_IMAGEVIEWER(retro_get_memory_data);
         SYMBOL_IMAGEVIEWER(retro_get_memory_size);
#endif
         break;
      case CORE_TYPE_NETRETROPAD:
#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORKGAMEPAD)
         SYMBOL_NETRETROPAD(retro_init);
         SYMBOL_NETRETROPAD(retro_deinit);

         SYMBOL_NETRETROPAD(retro_api_version);
         SYMBOL_NETRETROPAD(retro_get_system_info);
         SYMBOL_NETRETROPAD(retro_get_system_av_info);

         SYMBOL_NETRETROPAD(retro_set_environment);
         SYMBOL_NETRETROPAD(retro_set_video_refresh);
         SYMBOL_NETRETROPAD(retro_set_audio_sample);
         SYMBOL_NETRETROPAD(retro_set_audio_sample_batch);
         SYMBOL_NETRETROPAD(retro_set_input_poll);
         SYMBOL_NETRETROPAD(retro_set_input_state);

         SYMBOL_NETRETROPAD(retro_set_controller_port_device);

         SYMBOL_NETRETROPAD(retro_reset);
         SYMBOL_NETRETROPAD(retro_run);

         SYMBOL_NETRETROPAD(retro_serialize_size);
         SYMBOL_NETRETROPAD(retro_serialize);
         SYMBOL_NETRETROPAD(retro_unserialize);

         SYMBOL_NETRETROPAD(retro_cheat_reset);
         SYMBOL_NETRETROPAD(retro_cheat_set);

         SYMBOL_NETRETROPAD(retro_load_game);
         SYMBOL_NETRETROPAD(retro_load_game_special);

         SYMBOL_NETRETROPAD(retro_unload_game);
         SYMBOL_NETRETROPAD(retro_get_region);
         SYMBOL_NETRETROPAD(retro_get_memory_data);
         SYMBOL_NETRETROPAD(retro_get_memory_size);
#endif
         break;
      case CORE_TYPE_VIDEO_PROCESSOR:
#if defined(HAVE_VIDEO_PROCESSOR)
         SYMBOL_VIDEOPROCESSOR(retro_init);
         SYMBOL_VIDEOPROCESSOR(retro_deinit);

         SYMBOL_VIDEOPROCESSOR(retro_api_version);
         SYMBOL_VIDEOPROCESSOR(retro_get_system_info);
         SYMBOL_VIDEOPROCESSOR(retro_get_system_av_info);

         SYMBOL_VIDEOPROCESSOR(retro_set_environment);
         SYMBOL_VIDEOPROCESSOR(retro_set_video_refresh);
         SYMBOL_VIDEOPROCESSOR(retro_set_audio_sample);
         SYMBOL_VIDEOPROCESSOR(retro_set_audio_sample_batch);
         SYMBOL_VIDEOPROCESSOR(retro_set_input_poll);
         SYMBOL_VIDEOPROCESSOR(retro_set_input_state);

         SYMBOL_VIDEOPROCESSOR(retro_set_controller_port_device);

         SYMBOL_VIDEOPROCESSOR(retro_reset);
         SYMBOL_VIDEOPROCESSOR(retro_run);

         SYMBOL_VIDEOPROCESSOR(retro_serialize_size);
         SYMBOL_VIDEOPROCESSOR(retro_serialize);
         SYMBOL_VIDEOPROCESSOR(retro_unserialize);

         SYMBOL_VIDEOPROCESSOR(retro_cheat_reset);
         SYMBOL_VIDEOPROCESSOR(retro_cheat_set);

         SYMBOL_VIDEOPROCESSOR(retro_load_game);
         SYMBOL_VIDEOPROCESSOR(retro_load_game_special);

         SYMBOL_VIDEOPROCESSOR(retro_unload_game);
         SYMBOL_VIDEOPROCESSOR(retro_get_region);
         SYMBOL_VIDEOPROCESSOR(retro_get_memory_data);
         SYMBOL_VIDEOPROCESSOR(retro_get_memory_size);
#endif
         break;
   }
}
Ejemplo n.º 26
0
void Fhash_table_test(CL_FORM *base)
{
	LOAD_FIXNUM(ARG(1), 4, ARG(1));
	LOAD_SYMBOL(SYMBOL(Slisp, 399), ARG(2));	/* HASH-TABLE */
	rt_struct_ref(ARG(0));
}
Ejemplo n.º 27
0
int
arch_elf_relocate_rela(struct elf_image_info *image,
	struct elf_image_info *resolve_image, struct Elf32_Rela *rel, int rel_len)
#endif
{
	int i;
	struct Elf32_Sym *sym;
	int vlErr;
	addr_t S = 0;	// symbol address
	addr_t R = 0;	// section relative symbol address

	addr_t G = 0;	// GOT address
	addr_t L = 0;	// PLT address

	#define P	((addr_t)(image->text_region.delta + rel[i].r_offset))
	#define A	((addr_t)rel[i].r_addend)
	#define B	(image->text_region.delta)

	// TODO: Get the GOT address!
	#define REQUIRE_GOT	\
		if (G == 0) {	\
			dprintf("arch_elf_relocate_rela(): Failed to get GOT address!\n"); \
			return B_ERROR;	\
		}

	// TODO: Get the PLT address!
	#define REQUIRE_PLT	\
		if (L == 0) {	\
			dprintf("arch_elf_relocate_rela(): Failed to get PLT address!\n"); \
			return B_ERROR;	\
		}

	for (i = 0; i * (int)sizeof(struct Elf32_Rela) < rel_len; i++) {
#if CHATTY
		dprintf("looking at rel type %d, offset 0x%lx, sym 0x%lx, addend 0x%lx\n",
			ELF32_R_TYPE(rel[i].r_info), rel[i].r_offset, ELF32_R_SYM(rel[i].r_info), rel[i].r_addend);
#endif
		switch (ELF32_R_TYPE(rel[i].r_info)) {
			case R_68K_32:
			case R_68K_16:
			case R_68K_8:
			case R_68K_PC32:
			case R_68K_PC16:
			case R_68K_PC8:
			case R_68K_GLOB_DAT:
			case R_68K_JMP_SLOT:
				sym = SYMBOL(image, ELF32_R_SYM(rel[i].r_info));

#ifdef _BOOT_MODE
				vlErr = boot_elf_resolve_symbol(image, sym, &S);
#else
				vlErr = elf_resolve_symbol(image, sym, resolve_image, &S);
#endif
				if (vlErr < 0) {
					dprintf("%s(): Failed to relocate "
						"entry index %d, rel type %d, offset 0x%lx, sym 0x%lx, "
						"addend 0x%lx\n", __FUNCTION__, i, ELF32_R_TYPE(rel[i].r_info),
						rel[i].r_offset, ELF32_R_SYM(rel[i].r_info),
						rel[i].r_addend);
					return vlErr;
				}
				break;
		}

		switch (ELF32_R_TYPE(rel[i].r_info)) {
			case R_68K_NONE:
				break;

			case R_68K_COPY:
				// TODO: Implement!
				dprintf("arch_elf_relocate_rela(): R_68K_COPY not yet "
					"supported!\n");
				return B_ERROR;

			case R_68K_32:
			case R_68K_GLOB_DAT:
				write_32(P, S + A);
				break;

			case R_68K_16:
				if (write_16_check(P, S + A))
					break;
dprintf("R_68K_16 overflow\n");
				return B_BAD_DATA;

			case R_68K_8:
				if (write_8_check(P, S + A))
					break;
dprintf("R_68K_8 overflow\n");
				return B_BAD_DATA;

			case R_68K_PC32:
				write_32(P, (S + A - P));
				break;

			case R_68K_PC16:
				if (write_16_check(P, (S + A - P)))
					break;
dprintf("R_68K_PC16 overflow\n");
				return B_BAD_DATA;

			case R_68K_PC8:
				if (write_8(P, (S + A - P)))
					break;
dprintf("R_68K_PC8 overflow\n");
				return B_BAD_DATA;

			case R_68K_GOT32:
				REQUIRE_GOT;
				write_32(P, (G + A - P));
				break;

			case R_68K_GOT16:
				REQUIRE_GOT;
				if (write_16_check(P, (G + A - P)))
					break;
dprintf("R_68K_GOT16 overflow\n");
				return B_BAD_DATA;

			case R_68K_GOT8:
				REQUIRE_GOT;
				if (write_8_check(P, (G + A - P)))
					break;
dprintf("R_68K_GOT8 overflow\n");
				return B_BAD_DATA;

			case R_68K_GOT32O:
				REQUIRE_GOT;
				write_32(P, (G + A));
				break;

			case R_68K_GOT16O:
				REQUIRE_GOT;
				if (write_16_check(P, (G + A)))
					break;
dprintf("R_68K_GOT16 overflow\n");
				return B_BAD_DATA;

			case R_68K_GOT8O:
				REQUIRE_GOT;
				if (write_8_check(P, (G + A)))
					break;
dprintf("R_68K_GOT8 overflow\n");
				return B_BAD_DATA;

			case R_68K_JMP_SLOT:
				write_32(P, (G + A));
				break;

			case R_68K_RELATIVE:
				write_32(P, B + A);
				break;

			case R_68K_PLT32:
				REQUIRE_PLT;
				write_32(P, (L + A - P));
				break;

			case R_68K_PLT16:
				REQUIRE_PLT;
				if (write_16_check(P, (L + A - P)))
					break;
dprintf("R_68K_PLT16 overflow\n");
				return B_BAD_DATA;

			case R_68K_PLT8:
				REQUIRE_PLT;
				if (write_8_check(P, (L + A - P)))
					break;
dprintf("R_68K_PLT8 overflow\n");
				return B_BAD_DATA;

			case R_68K_PLT32O:
				REQUIRE_PLT;
				write_32(P, (L + A));
				break;

			case R_68K_PLT16O:
				REQUIRE_PLT;
				if (write_16_check(P, (L + A)))
					break;
dprintf("R_68K_PLT16O overflow\n");
				return B_BAD_DATA;

			case R_68K_PLT8O:
				REQUIRE_PLT;
				if (write_8_check(P, (L + A)))
					break;
dprintf("R_68K_PLT8O overflow\n");
				return B_BAD_DATA;

			default:
				dprintf("arch_elf_relocate_rela: unhandled relocation type %d\n", ELF32_R_TYPE(rel[i].r_info));
				return B_ERROR;
		}
	}

	return B_NO_ERROR;
}
Ejemplo n.º 28
0
void list_remove(CL_FORM *base)
{
	LOAD_NIL(ARG(8));
	LOAD_NIL(ARG(9));
	ALLOC_CONS(ARG(10), ARG(8), ARG(9), ARG(8));
	LOAD_SMALLFIXNUM(0, ARG(9));
	LOAD_NIL(ARG(10));
	LOAD_NIL(ARG(11));
	ALLOC_CONS(ARG(12), ARG(10), ARG(11), ARG(10));
	LOAD_SMALLFIXNUM(0, ARG(11));
	LOAD_NIL(ARG(12));
	COPY(ARG(1), ARG(13));
	M1_1:;
	if(CL_ATOMP(ARG(13)))
	{
		LOAD_NIL(ARG(12));
		goto RETURN1;
	}
	COPY(ARG(13), ARG(14));
	COPY(GET_CAR(ARG(14)), ARG(12));
	COPY(ARG(11), ARG(14));
	COPY(ARG(5), ARG(15));
	Fge(ARG(14), 2);
	if(CL_TRUEP(ARG(14)))
	{
		goto RETURN1;
	}
	COPY(ARG(11), ARG(14));
	COPY(ARG(4), ARG(15));
	Fge(ARG(14), 2);
	if(CL_TRUEP(ARG(14)))
	{
		COPY(ARG(3), ARG(14));
		COPY(ARG(0), ARG(15));
		if(CL_TRUEP(ARG(7)))
		{
			COPY(ARG(7), ARG(16));
			COPY(ARG(12), ARG(17));
			Ffuncall(ARG(16), 2);
			mv_count = 1;
		}
		else
		{
			COPY(ARG(12), ARG(16));
		}
		Ffuncall(ARG(14), 3);
		mv_count = 1;
	}
	else
	{
		goto ELSE1;
	}
	if(CL_TRUEP(ARG(14)))
	{
		COPY(ARG(11), ARG(14));
		COPY(ARG(8), ARG(15));
		add_q(ARG(14));
		COPY(ARG(9), ARG(14));
		F1plus(ARG(14));
		COPY(ARG(14), ARG(9));
	}
	ELSE1:;
	COPY(ARG(11), ARG(14));
	F1plus(ARG(14));
	COPY(ARG(14), ARG(11));
	COPY(ARG(13), ARG(14));
	COPY(GET_CDR(ARG(14)), ARG(13));
	goto M1_1;
	RETURN1:;
	COPY(ARG(8), ARG(11));
	COPY(ARG(11), ARG(12));
	COPY(GET_CAR(ARG(12)), ARG(8));
	if(CL_TRUEP(ARG(2)))
	{
		LOAD_SMALLFIXNUM(0, ARG(11));
		M2_1:;
		if(CL_TRUEP(ARG(1)))
		{
			if(CL_CONSP(ARG(1)))
			{
				LOAD_NIL(ARG(12));
			}
			else
			{
				LOAD_SMSTR((CL_FORM *)&KClisp[233], ARG(12));	/* ~a is not a list */
				COPY(ARG(1), ARG(13));
				Ferror(ARG(12), 2);
			}
		}
		else
		{
			LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(12));	/* T */
		}
		if(CL_TRUEP(ARG(12)))
		{
			goto THEN2;
		}
		else
		{
			COPY(ARG(11), ARG(13));
			COPY(ARG(5), ARG(14));
			Fge(ARG(13), 2);
		}
		if(CL_TRUEP(ARG(13)))
		{
			THEN2:;
			goto RETURN2;
		}
		COPY(ARG(9), ARG(12));
		COPY(ARG(6), ARG(13));
		Fle(ARG(12), 2);
		if(CL_TRUEP(ARG(12)))
		{
			if(CL_CONSP(ARG(8)))
			{
				COPY(GET_CAR(ARG(8)), ARG(13));
			}
			else
			{
				if(CL_TRUEP(ARG(8)))
				{
					LOAD_SMSTR((CL_FORM *)&KClisp[239], ARG(13));	/* ~a is not a list */
					COPY(ARG(8), ARG(14));
					Ferror(ARG(13), 2);
				}
				else
				{
					COPY(ARG(8), ARG(13));
				}
			}
		}
		else
		{
			goto ELSE3;
		}
		if(EQL(ARG(11), ARG(13)))
		{
			if(CL_CONSP(ARG(8)))
			{
			}
			else
			{
				if(CL_TRUEP(ARG(8)))
				{
					LOAD_SMSTR((CL_FORM *)&KClisp[239], ARG(12));	/* ~a is not a list */
					COPY(ARG(8), ARG(13));
					Ferror(ARG(12), 2);
				}
				else
				{
				}
			}
			COPY(ARG(8), ARG(12));
			COPY(ARG(12), ARG(13));
			if(CL_CONSP(ARG(13)))
			{
				COPY(GET_CDR(ARG(13)), ARG(8));
			}
			else
			{
				if(CL_TRUEP(ARG(13)))
				{
					LOAD_SMSTR((CL_FORM *)&KClisp[241], ARG(14));	/* ~a is not a list */
					COPY(ARG(13), ARG(15));
					Ferror(ARG(14), 2);
				}
				else
				{
					LOAD_NIL(ARG(8));
				}
			}
			COPY(ARG(9), ARG(12));
			F1minus(ARG(12));
			COPY(ARG(12), ARG(9));
			if(CL_CONSP(ARG(1)))
			{
			}
			else
			{
				if(CL_TRUEP(ARG(1)))
				{
					LOAD_SMSTR((CL_FORM *)&KClisp[239], ARG(12));	/* ~a is not a list */
					COPY(ARG(1), ARG(13));
					Ferror(ARG(12), 2);
				}
				else
				{
				}
			}
			COPY(ARG(1), ARG(12));
			COPY(ARG(12), ARG(13));
			if(CL_CONSP(ARG(13)))
			{
				COPY(GET_CDR(ARG(13)), ARG(1));
			}
			else
			{
				if(CL_TRUEP(ARG(13)))
				{
					LOAD_SMSTR((CL_FORM *)&KClisp[241], ARG(14));	/* ~a is not a list */
					COPY(ARG(13), ARG(15));
					Ferror(ARG(14), 2);
				}
				else
				{
					LOAD_NIL(ARG(1));
				}
			}
		}
		else
		{
			ELSE3:;
			if(CL_CONSP(ARG(1)))
			{
				COPY(GET_CAR(ARG(1)), ARG(12));
			}
			else
			{
				if(CL_TRUEP(ARG(1)))
				{
					LOAD_SMSTR((CL_FORM *)&KClisp[239], ARG(12));	/* ~a is not a list */
					COPY(ARG(1), ARG(13));
					Ferror(ARG(12), 2);
				}
				else
				{
					COPY(ARG(1), ARG(12));
				}
			}
			COPY(ARG(1), ARG(13));
			COPY(ARG(13), ARG(14));
			if(CL_CONSP(ARG(14)))
			{
				COPY(GET_CDR(ARG(14)), ARG(1));
			}
			else
			{
				if(CL_TRUEP(ARG(14)))
				{
					LOAD_SMSTR((CL_FORM *)&KClisp[241], ARG(15));	/* ~a is not a list */
					COPY(ARG(14), ARG(16));
					Ferror(ARG(15), 2);
				}
				else
				{
					LOAD_NIL(ARG(1));
				}
			}
			COPY(ARG(10), ARG(13));
			add_q(ARG(12));
			if(CL_CONSP(ARG(8)))
			{
				COPY(GET_CAR(ARG(8)), ARG(13));
			}
			else
			{
				if(CL_TRUEP(ARG(8)))
				{
					LOAD_SMSTR((CL_FORM *)&KClisp[239], ARG(13));	/* ~a is not a list */
					COPY(ARG(8), ARG(14));
					Ferror(ARG(13), 2);
				}
				else
				{
					COPY(ARG(8), ARG(13));
				}
			}
			if(EQL(ARG(11), ARG(13)))
			{
				if(CL_CONSP(ARG(8)))
				{
				}
				else
				{
					if(CL_TRUEP(ARG(8)))
					{
						LOAD_SMSTR((CL_FORM *)&KClisp[239], ARG(12));	/* ~a is not a list */
						COPY(ARG(8), ARG(13));
						Ferror(ARG(12), 2);
					}
					else
					{
					}
				}
				COPY(ARG(8), ARG(12));
				COPY(ARG(12), ARG(13));
				if(CL_CONSP(ARG(13)))
				{
					COPY(GET_CDR(ARG(13)), ARG(8));
				}
				else
				{
					if(CL_TRUEP(ARG(13)))
					{
						LOAD_SMSTR((CL_FORM *)&KClisp[241], ARG(14));	/* ~a is not a list */
						COPY(ARG(13), ARG(15));
						Ferror(ARG(14), 2);
					}
					else
					{
						LOAD_NIL(ARG(8));
					}
				}
				COPY(ARG(9), ARG(12));
				F1minus(ARG(12));
				COPY(ARG(12), ARG(9));
			}
		}
		F1plus(ARG(11));
		goto M2_1;
		RETURN2:;
	}
	else
	{
		LOAD_SMALLFIXNUM(0, ARG(11));
		M3_1:;
		if(CL_TRUEP(ARG(1)))
		{
			if(CL_CONSP(ARG(1)))
			{
				LOAD_NIL(ARG(12));
			}
			else
			{
				LOAD_SMSTR((CL_FORM *)&KClisp[233], ARG(12));	/* ~a is not a list */
				COPY(ARG(1), ARG(13));
				Ferror(ARG(12), 2);
			}
		}
		else
		{
			LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(12));	/* T */
		}
		if(CL_TRUEP(ARG(12)))
		{
			goto THEN4;
		}
		else
		{
			COPY(ARG(11), ARG(13));
			COPY(ARG(5), ARG(14));
			Fge(ARG(13), 2);
		}
		if(CL_TRUEP(ARG(13)))
		{
			THEN4:;
			goto RETURN3;
		}
		COPY(ARG(6), ARG(12));
		Fplusp(ARG(12));
		if(CL_TRUEP(ARG(12)))
		{
			if(CL_CONSP(ARG(8)))
			{
				COPY(GET_CAR(ARG(8)), ARG(13));
			}
			else
			{
				if(CL_TRUEP(ARG(8)))
				{
					LOAD_SMSTR((CL_FORM *)&KClisp[239], ARG(13));	/* ~a is not a list */
					COPY(ARG(8), ARG(14));
					Ferror(ARG(13), 2);
				}
				else
				{
					COPY(ARG(8), ARG(13));
				}
			}
		}
		else
		{
			goto ELSE5;
		}
		if(EQL(ARG(11), ARG(13)))
		{
			if(CL_CONSP(ARG(8)))
			{
			}
			else
			{
				if(CL_TRUEP(ARG(8)))
				{
					LOAD_SMSTR((CL_FORM *)&KClisp[239], ARG(12));	/* ~a is not a list */
					COPY(ARG(8), ARG(13));
					Ferror(ARG(12), 2);
				}
				else
				{
				}
			}
			COPY(ARG(8), ARG(12));
			COPY(ARG(12), ARG(13));
			if(CL_CONSP(ARG(13)))
			{
				COPY(GET_CDR(ARG(13)), ARG(8));
			}
			else
			{
				if(CL_TRUEP(ARG(13)))
				{
					LOAD_SMSTR((CL_FORM *)&KClisp[241], ARG(14));	/* ~a is not a list */
					COPY(ARG(13), ARG(15));
					Ferror(ARG(14), 2);
				}
				else
				{
					LOAD_NIL(ARG(8));
				}
			}
			COPY(ARG(6), ARG(12));
			F1minus(ARG(12));
			COPY(ARG(12), ARG(6));
			if(CL_CONSP(ARG(1)))
			{
			}
			else
			{
				if(CL_TRUEP(ARG(1)))
				{
					LOAD_SMSTR((CL_FORM *)&KClisp[239], ARG(12));	/* ~a is not a list */
					COPY(ARG(1), ARG(13));
					Ferror(ARG(12), 2);
				}
				else
				{
				}
			}
			COPY(ARG(1), ARG(12));
			COPY(ARG(12), ARG(13));
			if(CL_CONSP(ARG(13)))
			{
				COPY(GET_CDR(ARG(13)), ARG(1));
			}
			else
			{
				if(CL_TRUEP(ARG(13)))
				{
					LOAD_SMSTR((CL_FORM *)&KClisp[241], ARG(14));	/* ~a is not a list */
					COPY(ARG(13), ARG(15));
					Ferror(ARG(14), 2);
				}
				else
				{
					LOAD_NIL(ARG(1));
				}
			}
		}
		else
		{
			ELSE5:;
			if(CL_CONSP(ARG(1)))
			{
				COPY(GET_CAR(ARG(1)), ARG(12));
			}
			else
			{
				if(CL_TRUEP(ARG(1)))
				{
					LOAD_SMSTR((CL_FORM *)&KClisp[239], ARG(12));	/* ~a is not a list */
					COPY(ARG(1), ARG(13));
					Ferror(ARG(12), 2);
				}
				else
				{
					COPY(ARG(1), ARG(12));
				}
			}
			COPY(ARG(1), ARG(13));
			COPY(ARG(13), ARG(14));
			if(CL_CONSP(ARG(14)))
			{
				COPY(GET_CDR(ARG(14)), ARG(1));
			}
			else
			{
				if(CL_TRUEP(ARG(14)))
				{
					LOAD_SMSTR((CL_FORM *)&KClisp[241], ARG(15));	/* ~a is not a list */
					COPY(ARG(14), ARG(16));
					Ferror(ARG(15), 2);
				}
				else
				{
					LOAD_NIL(ARG(1));
				}
			}
			COPY(ARG(10), ARG(13));
			add_q(ARG(12));
		}
		F1plus(ARG(11));
		goto M3_1;
		RETURN3:;
	}
	COPY(GET_CAR(ARG(10)), ARG(0));
}
Ejemplo n.º 29
0
static void Z49_lambda(CL_FORM *base)
{
    LOAD_NIL(ARG(3));
    COPY(ARG(1), ARG(4));
    LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(5));	/* T */
    LOAD_NIL(ARG(6));
    LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(7));	/* T */
    read_char1(ARG(4));
    COPY(ARG(4), ARG(5));
    LOAD_FIXNUM(ARG(6), 10, ARG(6));
    digit_char_p1(ARG(5));
    LOAD_NIL(ARG(6));
    if(CL_TRUEP(ARG(5)))
    {
        COPY(ARG(5), ARG(3));
M1_1:
        ;
        COPY(ARG(1), ARG(7));
        COPY(ARG(7), ARG(8));
        LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(9));	/* T */
        LOAD_NIL(ARG(10));
        LOAD_SYMBOL(SYMBOL(Slisp, 48), ARG(11));	/* T */
        read_char1(ARG(8));
        COPY(ARG(8), ARG(4));
        COPY(ARG(4), ARG(7));
        COPY(ARG(7), ARG(8));
        LOAD_FIXNUM(ARG(9), 10, ARG(9));
        digit_char_p1(ARG(8));
        COPY(ARG(8), ARG(5));
        if(CL_TRUEP(ARG(5)))
        {
        }
        else
        {
            if(CL_TRUEP(SYMVAL(Slisp, 418)))	/* *READ-SUPPRESS* */
            {
                LOAD_NIL(ARG(3));
            }
            goto RETURN1;
        }
        COPY(ARG(5), ARG(7));
        LOAD_FIXNUM(ARG(8), 10, ARG(8));
        COPY(ARG(3), ARG(9));
        Fmult(ARG(8), 2);
        Fplus(ARG(7), 2);
        COPY(ARG(7), ARG(3));
        goto M1_1;
RETURN1:
        ;
    }
    COPY(INDIRECT(GET_FORM(ARG(0)) + 3), ARG(7));
    COPY(ARG(4), ARG(8));
    if(CL_CHARP(ARG(8)))
    {
        COPY(ARG(8), ARG(9));
    }
    else
    {
        COPY(SYMVAL(Slisp, 58), ARG(9));	/* WRONG_TYPE */
        COPY(ARG(8), ARG(10));
        LOAD_SYMBOL(SYMBOL(Slisp, 18), ARG(11));	/* CHARACTER */
        Ferror(ARG(9), 3);
    }
    rt_char_upcase(ARG(9));
    COPY(ARG(9), ARG(8));
    rt_char_code(ARG(8));
    COPY(ARG(7), ARG(9));
    LOAD_BOOL(CL_SMVECP(ARG(9)), ARG(10));
    if(CL_TRUEP(ARG(10)))
    {
        goto THEN1;
    }
    else
    {
        COPY(ARG(9), ARG(11));
        COPY(ARG(11), ARG(12));
        LOAD_SYMBOL(SYMBOL(Slisp, 150), ARG(13));	/* COMPLEX-VECTOR */
        rt_struct_typep(ARG(12));
    }
    if(CL_TRUEP(ARG(12)))
    {
THEN1:
        ;
    }
    else
    {
        COPY(SYMVAL(Slisp, 58), ARG(9));	/* WRONG_TYPE */
        COPY(ARG(7), ARG(10));
        LOAD_SYMBOL(SYMBOL(Slisp, 47), ARG(11));	/* VECTOR */
        Ferror(ARG(9), 3);
    }
    COPY(ARG(7), ARG(6));
    COPY(ARG(8), ARG(7));
    Frow_major_aref(ARG(6));
    if(CL_TRUEP(ARG(6)))
    {
    }
    else
    {
        LOAD_SMSTR((CL_FORM *)&Kmake_dispatch_macro_character1[0], ARG(7));	/* no ~S dispatch function defined for subchar ~S ~
                           (with arg ~S) */
        COPY(ARG(2), ARG(8));
        COPY(ARG(4), ARG(9));
        COPY(ARG(3), ARG(10));
        Ferror(ARG(7), 4);
    }
    COPY(ARG(6), ARG(7));
    COPY(ARG(1), ARG(8));
    COPY(ARG(4), ARG(9));
    COPY(ARG(3), ARG(10));
    Ffuncall(ARG(7), 4);
    COPY(ARG(7), ARG(0));
}
Ejemplo n.º 30
0
static void scan_vmcoreinfo(char *start, size_t size)
{
	char *last = start + size - 1;
	char *pos, *eol;
	char temp_buf[1024];
	bool last_line = false;

#define SYMBOL(sym) {					\
	.str = "SYMBOL(" #sym  ")=",			\
	.name = #sym,					\
	.len = sizeof("SYMBOL(" #sym  ")=") - 1,	\
	.vaddr = & sym ## _vaddr,			\
 }
	static struct symbol {
		const char *str;
		const char *name;
		size_t len;
		loff_t *vaddr;
	} symbol[] = {
		SYMBOL(log_buf),
		SYMBOL(log_end),
		SYMBOL(log_buf_len),
		SYMBOL(logged_chars),
		SYMBOL(log_first_idx),
		SYMBOL(log_next_idx),
	};

	for (pos = start; pos <= last; pos = eol + 1) {
		size_t len, i;
		/* Find the end of the current line */
		for (eol = pos; (eol <= last) && (*eol != '\n') ; eol++)
			;
		if (eol > last) {
			/*
			 * We did not find \n and note ended. Currently kernel
			 * is appending last field CRASH_TIME without \n. It
			 * is ugly but handle it.
			 */
			eol = last;
			len = eol - pos + 1;
			if (len >= sizeof(temp_buf))
				len = sizeof(temp_buf) - 1;
			strncpy(temp_buf, pos, len);
			temp_buf[len + 1] = '\0';

			pos = temp_buf;
			len = len + 1;
			eol = pos + len -1;
			last_line = true;
		} else  {
			len = eol - pos + 1;
		}

		/* Stomp the last character so I am guaranteed a terminating null */
		*eol = '\0';
		/* Copy OSRELEASE if I see it */
		if ((len >= 10) && (memcmp("OSRELEASE=", pos, 10) == 0)) {
			size_t to_copy = len - 10;
			if (to_copy >= sizeof(osrelease))
				to_copy = sizeof(osrelease) - 1;
			memcpy(osrelease, pos + 10, to_copy);
			osrelease[to_copy] = '\0';
		}
		/* See if the line is mentions a symbol I am looking for */
		for (i = 0; i < sizeof(symbol)/sizeof(symbol[0]); i++ ) {
			unsigned long long vaddr;
			if (symbol[i].len >= len)
				continue;
			if (memcmp(symbol[i].str, pos, symbol[i].len) != 0)
				continue;
			/* Found a symbol now decode it */
			vaddr = strtoull(pos + symbol[i].len, NULL, 16);
			/* Remember the virtual address */
			*symbol[i].vaddr = vaddr;
		}

		/* Check for "SIZE(log)=" */
		if (memcmp("SIZE(log)=", pos, 10) == 0)
			log_sz = strtoull(pos + 10, NULL, 10);

		/* Check for struct log field offsets */
		if (memcmp("OFFSET(log.ts_nsec)=", pos, 20) == 0)
			log_offset_ts_nsec = strtoull(pos + 20, NULL, 10);

		if (memcmp("OFFSET(log.len)=", pos, 16) == 0)
			log_offset_len = strtoul(pos + 16, NULL, 10);

		if (memcmp("OFFSET(log.text_len)=", pos, 21) == 0)
			log_offset_text_len = strtoul(pos + 21, NULL, 10);

		if (last_line)
			break;
	}
}