Exemple #1
0
void VL_SetPalette(const byte *palette)
{
	memcpy(pal, palette, 768);
	FrameBuffer_setPalette(0, 0, 256, palette, FLAG_RGB666);
}
static void work_a_0977831778_3212880686_p_3(char *t0)
{
    char *t1;
    char *t2;
    char *t3;
    char *t4;
    char *t5;
    char *t6;
    char *t7;
    unsigned char t8;
    unsigned char t9;
    unsigned char t10;
    unsigned char t11;
    unsigned char t12;
    unsigned int t13;
    char *t14;
    char *t15;
    char *t16;
    char *t17;
    char *t18;
    int t19;
    int t20;
    int t21;
    int t22;
    int t23;
    unsigned int t24;
    unsigned int t25;
    static char *nl0[] = {&&LAB3, &&LAB4, &&LAB5, &&LAB6, &&LAB7, &&LAB8, &&LAB9, &&LAB10};

LAB0:    xsi_set_current_line(318, ng0);
    t1 = (t0 + 193416);
    t2 = (t1 + 56U);
    t3 = *((char **)t2);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    *((unsigned char *)t5) = (unsigned char)2;
    xsi_driver_first_trans_fast(t1);
    xsi_set_current_line(319, ng0);
    t1 = xsi_get_transient_memory(256U);
    memset(t1, 0, 256U);
    t2 = t1;
    memset(t2, (unsigned char)2, 256U);
    t3 = (t0 + 193480);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    t6 = (t5 + 56U);
    t7 = *((char **)t6);
    memcpy(t7, t1, 256U);
    xsi_driver_first_trans_fast(t3);
    xsi_set_current_line(320, ng0);
    t1 = (t0 + 142600U);
    t2 = *((char **)t1);
    t8 = *((unsigned char *)t2);
    t1 = (t0 + 193544);
    t3 = (t1 + 56U);
    t4 = *((char **)t3);
    t5 = (t4 + 56U);
    t6 = *((char **)t5);
    *((unsigned char *)t6) = t8;
    xsi_driver_first_trans_fast(t1);
    xsi_set_current_line(321, ng0);
    t1 = (t0 + 137960U);
    t2 = *((char **)t1);
    t1 = (t0 + 193608);
    t3 = (t1 + 56U);
    t4 = *((char **)t3);
    t5 = (t4 + 56U);
    t6 = *((char **)t5);
    memcpy(t6, t2, 2048U);
    xsi_driver_first_trans_fast(t1);
    xsi_set_current_line(322, ng0);
    t1 = (t0 + 140680U);
    t2 = *((char **)t1);
    t8 = *((unsigned char *)t2);
    t1 = (t0 + 193672);
    t3 = (t1 + 56U);
    t4 = *((char **)t3);
    t5 = (t4 + 56U);
    t6 = *((char **)t5);
    *((unsigned char *)t6) = t8;
    xsi_driver_first_trans_fast(t1);
    xsi_set_current_line(323, ng0);
    t1 = (t0 + 139560U);
    t2 = *((char **)t1);
    t1 = (t0 + 193736);
    t3 = (t1 + 56U);
    t4 = *((char **)t3);
    t5 = (t4 + 56U);
    t6 = *((char **)t5);
    memcpy(t6, t2, 8U);
    xsi_driver_first_trans_fast(t1);
    xsi_set_current_line(324, ng0);
    t1 = (t0 + 138600U);
    t2 = *((char **)t1);
    t1 = (t0 + 193800);
    t3 = (t1 + 56U);
    t4 = *((char **)t3);
    t5 = (t4 + 56U);
    t6 = *((char **)t5);
    memcpy(t6, t2, 8U);
    xsi_driver_first_trans_fast(t1);
    xsi_set_current_line(325, ng0);
    t1 = (t0 + 138920U);
    t2 = *((char **)t1);
    t1 = (t0 + 193864);
    t3 = (t1 + 56U);
    t4 = *((char **)t3);
    t5 = (t4 + 56U);
    t6 = *((char **)t5);
    memcpy(t6, t2, 8U);
    xsi_driver_first_trans_fast(t1);
    xsi_set_current_line(326, ng0);
    t1 = (t0 + 142600U);
    t2 = *((char **)t1);
    t8 = *((unsigned char *)t2);
    t1 = (char *)((nl0) + t8);
    goto **((char **)t1);

LAB2:    t1 = (t0 + 192536);
    *((int *)t1) = 1;

LAB1:    return;
LAB3:    xsi_set_current_line(329, ng0);
    t3 = (t0 + 136520U);
    t4 = *((char **)t3);
    t10 = *((unsigned char *)t4);
    t11 = (t10 == (unsigned char)3);
    if (t11 == 1)
        goto LAB15;

LAB16:    t9 = (unsigned char)0;

LAB17:    if (t9 != 0)
        goto LAB12;

LAB14:
LAB13:    goto LAB2;

LAB4:    xsi_set_current_line(334, ng0);
    t1 = (t0 + 136520U);
    t2 = *((char **)t1);
    t8 = *((unsigned char *)t2);
    t9 = (t8 == (unsigned char)3);
    if (t9 != 0)
        goto LAB24;

LAB26:
LAB25:    goto LAB2;

LAB5:    xsi_set_current_line(352, ng0);
    t1 = (t0 + 136520U);
    t2 = *((char **)t1);
    t8 = *((unsigned char *)t2);
    t9 = (t8 == (unsigned char)3);
    if (t9 != 0)
        goto LAB40;

LAB42:
LAB41:    goto LAB2;

LAB6:    xsi_set_current_line(358, ng0);
    t1 = (t0 + 136520U);
    t2 = *((char **)t1);
    t8 = *((unsigned char *)t2);
    t9 = (t8 == (unsigned char)3);
    if (t9 != 0)
        goto LAB43;

LAB45:
LAB44:    goto LAB2;

LAB7:    xsi_set_current_line(365, ng0);
    t1 = (t0 + 193672);
    t2 = (t1 + 56U);
    t3 = *((char **)t2);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    *((unsigned char *)t5) = (unsigned char)2;
    xsi_driver_first_trans_fast(t1);
    xsi_set_current_line(366, ng0);
    t1 = (t0 + 140680U);
    t2 = *((char **)t1);
    t8 = *((unsigned char *)t2);
    t9 = (t8 == (unsigned char)3);
    if (t9 != 0)
        goto LAB46;

LAB48:
LAB47:    xsi_set_current_line(369, ng0);
    t1 = (t0 + 136520U);
    t2 = *((char **)t1);
    t8 = *((unsigned char *)t2);
    t9 = (t8 == (unsigned char)3);
    if (t9 != 0)
        goto LAB49;

LAB51:
LAB50:    goto LAB2;

LAB8:    xsi_set_current_line(375, ng0);
    t1 = (t0 + 136520U);
    t2 = *((char **)t1);
    t8 = *((unsigned char *)t2);
    t9 = (t8 == (unsigned char)3);
    if (t9 != 0)
        goto LAB52;

LAB54:
LAB53:    goto LAB2;

LAB9:    xsi_set_current_line(381, ng0);
    t1 = (t0 + 142280U);
    t2 = *((char **)t1);
    t19 = *((int *)t2);
    t20 = (t19 - 0);
    t13 = (t20 * 1);
    t24 = (1 * t13);
    t25 = (0U + t24);
    t1 = (t0 + 193480);
    t3 = (t1 + 56U);
    t4 = *((char **)t3);
    t5 = (t4 + 56U);
    t6 = *((char **)t5);
    *((unsigned char *)t6) = (unsigned char)3;
    xsi_driver_first_trans_delta(t1, t25, 1, 0LL);
    xsi_set_current_line(382, ng0);
    t1 = (t0 + 193544);
    t2 = (t1 + 56U);
    t3 = *((char **)t2);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    *((unsigned char *)t5) = (unsigned char)0;
    xsi_driver_first_trans_fast(t1);
    goto LAB2;

LAB10:    xsi_set_current_line(385, ng0);
    t1 = (t0 + 193672);
    t2 = (t1 + 56U);
    t3 = *((char **)t2);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    *((unsigned char *)t5) = (unsigned char)3;
    xsi_driver_first_trans_fast(t1);
    xsi_set_current_line(386, ng0);
    t1 = (t0 + 193544);
    t2 = (t1 + 56U);
    t3 = *((char **)t2);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    *((unsigned char *)t5) = (unsigned char)0;
    xsi_driver_first_trans_fast(t1);
    goto LAB2;

LAB11:    xsi_set_current_line(389, ng0);
    t1 = (t0 + 193544);
    t2 = (t1 + 56U);
    t3 = *((char **)t2);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    *((unsigned char *)t5) = (unsigned char)0;
    xsi_driver_first_trans_fast(t1);
    goto LAB2;

LAB12:    xsi_set_current_line(330, ng0);
    t14 = (t0 + 193544);
    t15 = (t14 + 56U);
    t16 = *((char **)t15);
    t17 = (t16 + 56U);
    t18 = *((char **)t17);
    *((unsigned char *)t18) = (unsigned char)1;
    xsi_driver_first_trans_fast(t14);
    goto LAB13;

LAB15:    t3 = (t0 + 136680U);
    t5 = *((char **)t3);
    t3 = (t0 + 155536U);
    t6 = *((char **)t3);
    t12 = 1;
    if (8U == 8U)
        goto LAB18;

LAB19:    t12 = 0;

LAB20:    t9 = t12;
    goto LAB17;

LAB18:    t13 = 0;

LAB21:    if (t13 < 8U)
        goto LAB22;
    else
        goto LAB20;

LAB22:    t3 = (t5 + t13);
    t7 = (t6 + t13);
    if (*((unsigned char *)t3) != *((unsigned char *)t7))
        goto LAB19;

LAB23:    t13 = (t13 + 1);
    goto LAB21;

LAB24:    xsi_set_current_line(335, ng0);
    t1 = (t0 + 136680U);
    t3 = *((char **)t1);
    t1 = (t0 + 155656U);
    t4 = *((char **)t1);
    t19 = xsi_mem_cmp(t4, t3, 8U);
    if (t19 == 1)
        goto LAB28;

LAB34:    t1 = (t0 + 155776U);
    t5 = *((char **)t1);
    t20 = xsi_mem_cmp(t5, t3, 8U);
    if (t20 == 1)
        goto LAB29;

LAB35:    t1 = (t0 + 155896U);
    t6 = *((char **)t1);
    t21 = xsi_mem_cmp(t6, t3, 8U);
    if (t21 == 1)
        goto LAB30;

LAB36:    t1 = (t0 + 156016U);
    t7 = *((char **)t1);
    t22 = xsi_mem_cmp(t7, t3, 8U);
    if (t22 == 1)
        goto LAB31;

LAB37:    t1 = (t0 + 156136U);
    t14 = *((char **)t1);
    t23 = xsi_mem_cmp(t14, t3, 8U);
    if (t23 == 1)
        goto LAB32;

LAB38:
LAB33:    xsi_set_current_line(347, ng0);
    t1 = (t0 + 193544);
    t2 = (t1 + 56U);
    t3 = *((char **)t2);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    *((unsigned char *)t5) = (unsigned char)0;
    xsi_driver_first_trans_fast(t1);

LAB27:    goto LAB25;

LAB28:    xsi_set_current_line(337, ng0);
    t1 = (t0 + 193544);
    t15 = (t1 + 56U);
    t16 = *((char **)t15);
    t17 = (t16 + 56U);
    t18 = *((char **)t17);
    *((unsigned char *)t18) = (unsigned char)2;
    xsi_driver_first_trans_fast(t1);
    goto LAB27;

LAB29:    xsi_set_current_line(339, ng0);
    t1 = (t0 + 193544);
    t2 = (t1 + 56U);
    t3 = *((char **)t2);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    *((unsigned char *)t5) = (unsigned char)4;
    xsi_driver_first_trans_fast(t1);
    goto LAB27;

LAB30:    xsi_set_current_line(341, ng0);
    t1 = (t0 + 193544);
    t2 = (t1 + 56U);
    t3 = *((char **)t2);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    *((unsigned char *)t5) = (unsigned char)5;
    xsi_driver_first_trans_fast(t1);
    goto LAB27;

LAB31:    xsi_set_current_line(343, ng0);
    t1 = (t0 + 193544);
    t2 = (t1 + 56U);
    t3 = *((char **)t2);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    *((unsigned char *)t5) = (unsigned char)6;
    xsi_driver_first_trans_fast(t1);
    goto LAB27;

LAB32:    xsi_set_current_line(345, ng0);
    t1 = (t0 + 193544);
    t2 = (t1 + 56U);
    t3 = *((char **)t2);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    *((unsigned char *)t5) = (unsigned char)7;
    xsi_driver_first_trans_fast(t1);
    goto LAB27;

LAB39:;
LAB40:    xsi_set_current_line(353, ng0);
    t1 = (t0 + 136680U);
    t3 = *((char **)t1);
    t1 = (t0 + 193736);
    t4 = (t1 + 56U);
    t5 = *((char **)t4);
    t6 = (t5 + 56U);
    t7 = *((char **)t6);
    memcpy(t7, t3, 8U);
    xsi_driver_first_trans_fast(t1);
    xsi_set_current_line(354, ng0);
    t1 = (t0 + 193544);
    t2 = (t1 + 56U);
    t3 = *((char **)t2);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    *((unsigned char *)t5) = (unsigned char)3;
    xsi_driver_first_trans_fast(t1);
    goto LAB41;

LAB43:    xsi_set_current_line(359, ng0);
    t1 = (t0 + 136680U);
    t3 = *((char **)t1);
    t1 = (t0 + 141960U);
    t4 = *((char **)t1);
    t19 = *((int *)t4);
    t20 = (t19 - 0);
    t13 = (t20 * 1);
    t24 = (8U * t13);
    t25 = (0U + t24);
    t1 = (t0 + 193608);
    t5 = (t1 + 56U);
    t6 = *((char **)t5);
    t7 = (t6 + 56U);
    t14 = *((char **)t7);
    memcpy(t14, t3, 8U);
    xsi_driver_first_trans_delta(t1, t25, 8U, 0LL);
    xsi_set_current_line(360, ng0);
    t1 = (t0 + 193544);
    t2 = (t1 + 56U);
    t3 = *((char **)t2);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    *((unsigned char *)t5) = (unsigned char)0;
    xsi_driver_first_trans_fast(t1);
    goto LAB44;

LAB46:    xsi_set_current_line(367, ng0);
    t1 = (t0 + 193416);
    t3 = (t1 + 56U);
    t4 = *((char **)t3);
    t5 = (t4 + 56U);
    t6 = *((char **)t5);
    *((unsigned char *)t6) = (unsigned char)3;
    xsi_driver_first_trans_fast(t1);
    goto LAB47;

LAB49:    xsi_set_current_line(370, ng0);
    t1 = (t0 + 136680U);
    t3 = *((char **)t1);
    t1 = (t0 + 193800);
    t4 = (t1 + 56U);
    t5 = *((char **)t4);
    t6 = (t5 + 56U);
    t7 = *((char **)t6);
    memcpy(t7, t3, 8U);
    xsi_driver_first_trans_fast(t1);
    xsi_set_current_line(371, ng0);
    t1 = (t0 + 193544);
    t2 = (t1 + 56U);
    t3 = *((char **)t2);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    *((unsigned char *)t5) = (unsigned char)0;
    xsi_driver_first_trans_fast(t1);
    goto LAB50;

LAB52:    xsi_set_current_line(376, ng0);
    t1 = (t0 + 136680U);
    t3 = *((char **)t1);
    t1 = (t0 + 193864);
    t4 = (t1 + 56U);
    t5 = *((char **)t4);
    t6 = (t5 + 56U);
    t7 = *((char **)t6);
    memcpy(t7, t3, 8U);
    xsi_driver_first_trans_fast(t1);
    xsi_set_current_line(377, ng0);
    t1 = (t0 + 193544);
    t2 = (t1 + 56U);
    t3 = *((char **)t2);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    *((unsigned char *)t5) = (unsigned char)0;
    xsi_driver_first_trans_fast(t1);
    goto LAB53;

}

static void work_a_0977831778_3212880686_p_4(char *t0)
{
    char t24[16];
    char t25[16];
    char *t1;
    char *t2;
    char *t3;
    char *t4;
    char *t5;
    char *t6;
    unsigned char t7;
    char *t8;
    char *t9;
    char *t10;
    unsigned char t11;
    int t12;
    int t13;
    unsigned int t14;
    unsigned int t15;
    unsigned int t16;
    int t17;
    int t18;
    char *t19;
    char *t20;
    char *t21;
    char *t22;
    char *t23;
    static char *nl0[] = {&&LAB3, &&LAB4, &&LAB5, &&LAB6, &&LAB7, &&LAB8, &&LAB9, &&LAB10};

LAB0:    xsi_set_current_line(398, ng0);
    t1 = (t0 + 139240U);
    t2 = *((char **)t1);
    t1 = (t0 + 193928);
    t3 = (t1 + 56U);
    t4 = *((char **)t3);
    t5 = (t4 + 56U);
    t6 = *((char **)t5);
    memcpy(t6, t2, 8U);
    xsi_driver_first_trans_fast(t1);
    xsi_set_current_line(399, ng0);
    t1 = (t0 + 137480U);
    t2 = *((char **)t1);
    t1 = (t0 + 193992);
    t3 = (t1 + 56U);
    t4 = *((char **)t3);
    t5 = (t4 + 56U);
    t6 = *((char **)t5);
    memcpy(t6, t2, 256U);
    xsi_driver_first_trans_fast(t1);
    xsi_set_current_line(400, ng0);
    t1 = (t0 + 140200U);
    t2 = *((char **)t1);
    t1 = (t0 + 194056);
    t3 = (t1 + 56U);
    t4 = *((char **)t3);
    t5 = (t4 + 56U);
    t6 = *((char **)t5);
    memcpy(t6, t2, 2U);
    xsi_driver_first_trans_fast(t1);
    xsi_set_current_line(401, ng0);
    t1 = (t0 + 142920U);
    t2 = *((char **)t1);
    t7 = *((unsigned char *)t2);
    t1 = (t0 + 194120);
    t3 = (t1 + 56U);
    t4 = *((char **)t3);
    t5 = (t4 + 56U);
    t6 = *((char **)t5);
    *((unsigned char *)t6) = t7;
    xsi_driver_first_trans_fast(t1);
    xsi_set_current_line(402, ng0);
    t1 = (t0 + 142920U);
    t2 = *((char **)t1);
    t7 = *((unsigned char *)t2);
    t1 = (char *)((nl0) + t7);
    goto **((char **)t1);

LAB2:    t1 = (t0 + 192552);
    *((int *)t1) = 1;

LAB1:    return;
LAB3:    xsi_set_current_line(405, ng0);
    t3 = xsi_get_transient_memory(2U);
    memset(t3, 0, 2U);
    t4 = t3;
    memset(t4, (unsigned char)2, 2U);
    t5 = (t0 + 194056);
    t6 = (t5 + 56U);
    t8 = *((char **)t6);
    t9 = (t8 + 56U);
    t10 = *((char **)t9);
    memcpy(t10, t3, 2U);
    xsi_driver_first_trans_fast(t5);
    xsi_set_current_line(406, ng0);
    t1 = xsi_get_transient_memory(256U);
    memset(t1, 0, 256U);
    t2 = t1;
    memset(t2, (unsigned char)2, 256U);
    t3 = (t0 + 193992);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    t6 = (t5 + 56U);
    t8 = *((char **)t6);
    memcpy(t8, t1, 256U);
    xsi_driver_first_trans_fast(t3);
    xsi_set_current_line(407, ng0);
    t1 = (t0 + 138920U);
    t2 = *((char **)t1);
    t1 = (t0 + 193928);
    t3 = (t1 + 56U);
    t4 = *((char **)t3);
    t5 = (t4 + 56U);
    t6 = *((char **)t5);
    memcpy(t6, t2, 8U);
    xsi_driver_first_trans_fast(t1);
    xsi_set_current_line(409, ng0);
    t1 = (t0 + 141000U);
    t2 = *((char **)t1);
    t7 = *((unsigned char *)t2);
    t11 = (t7 == (unsigned char)3);
    if (t11 != 0)
        goto LAB12;

LAB14:
LAB13:    goto LAB2;

LAB4:    xsi_set_current_line(414, ng0);
    t1 = (t0 + 142120U);
    t2 = *((char **)t1);
    t12 = *((int *)t2);
    t13 = (t12 - 0);
    t14 = (t13 * 1);
    t15 = (1 * t14);
    t16 = (0U + t15);
    t1 = (t0 + 193992);
    t3 = (t1 + 56U);
    t4 = *((char **)t3);
    t5 = (t4 + 56U);
    t6 = *((char **)t5);
    *((unsigned char *)t6) = (unsigned char)3;
    xsi_driver_first_trans_delta(t1, t16, 1, 0LL);
    xsi_set_current_line(415, ng0);
    t1 = (t0 + 137800U);
    t2 = *((char **)t1);
    t1 = (t0 + 142120U);
    t3 = *((char **)t1);
    t12 = *((int *)t3);
    t13 = (t12 - 0);
    t14 = (t13 * 1);
    xsi_vhdl_check_range_of_index(0, 255, 1, t12);
    t15 = (2U * t14);
    t16 = (0 + t15);
    t1 = (t2 + t16);
    t4 = (t0 + 194056);
    t5 = (t4 + 56U);
    t6 = *((char **)t5);
    t8 = (t6 + 56U);
    t9 = *((char **)t8);
    memcpy(t9, t1, 2U);
    xsi_driver_first_trans_fast(t4);
    xsi_set_current_line(416, ng0);
    t1 = (t0 + 194120);
    t2 = (t1 + 56U);
    t3 = *((char **)t2);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    *((unsigned char *)t5) = (unsigned char)2;
    xsi_driver_first_trans_fast(t1);
    goto LAB2;

LAB5:    xsi_set_current_line(420, ng0);
    t1 = (t0 + 139240U);
    t2 = *((char **)t1);
    t1 = (t0 + 302784U);
    t3 = (t0 + 138600U);
    t4 = *((char **)t3);
    t3 = (t0 + 302784U);
    t7 = ieee_p_1242562249_sub_1434220770680401498_1035706684(IEEE_P_1242562249, t2, t1, t4, t3);
    if (t7 != 0)
        goto LAB15;

LAB17:    xsi_set_current_line(434, ng0);
    t1 = (t0 + 194120);
    t2 = (t1 + 56U);
    t3 = *((char **)t2);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    *((unsigned char *)t5) = (unsigned char)7;
    xsi_driver_first_trans_fast(t1);

LAB16:    goto LAB2;

LAB6:    xsi_set_current_line(438, ng0);
    t1 = (t0 + 139240U);
    t2 = *((char **)t1);
    t1 = (t0 + 302784U);
    t3 = (t0 + 312088);
    t5 = (t25 + 0U);
    t6 = (t5 + 0U);
    *((int *)t6) = 0;
    t6 = (t5 + 4U);
    *((int *)t6) = 4;
    t6 = (t5 + 8U);
    *((int *)t6) = 1;
    t12 = (4 - 0);
    t14 = (t12 * 1);
    t14 = (t14 + 1);
    t6 = (t5 + 12U);
    *((unsigned int *)t6) = t14;
    t6 = ieee_p_1242562249_sub_1701011461141789389_1035706684(IEEE_P_1242562249, t24, t2, t1, t3, t25);
    t8 = (t24 + 12U);
    t14 = *((unsigned int *)t8);
    t15 = (1U * t14);
    t7 = (8U != t15);
    if (t7 == 1)
        goto LAB29;

LAB30:    t9 = (t0 + 193928);
    t10 = (t9 + 56U);
    t19 = *((char **)t10);
    t20 = (t19 + 56U);
    t21 = *((char **)t20);
    memcpy(t21, t6, 8U);
    xsi_driver_first_trans_fast(t9);
    xsi_set_current_line(439, ng0);
    t1 = (t0 + 194120);
    t2 = (t1 + 56U);
    t3 = *((char **)t2);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    *((unsigned char *)t5) = (unsigned char)1;
    xsi_driver_first_trans_fast(t1);
    goto LAB2;

LAB7:    xsi_set_current_line(442, ng0);
    t1 = (t0 + 139240U);
    t2 = *((char **)t1);
    t1 = (t0 + 302784U);
    t3 = (t0 + 312093);
    t5 = (t25 + 0U);
    t6 = (t5 + 0U);
    *((int *)t6) = 0;
    t6 = (t5 + 4U);
    *((int *)t6) = 4;
    t6 = (t5 + 8U);
    *((int *)t6) = 1;
    t12 = (4 - 0);
    t14 = (t12 * 1);
    t14 = (t14 + 1);
    t6 = (t5 + 12U);
    *((unsigned int *)t6) = t14;
    t6 = ieee_p_1242562249_sub_1701011461141717515_1035706684(IEEE_P_1242562249, t24, t2, t1, t3, t25);
    t8 = (t24 + 12U);
    t14 = *((unsigned int *)t8);
    t15 = (1U * t14);
    t7 = (8U != t15);
    if (t7 == 1)
        goto LAB31;

LAB32:    t9 = (t0 + 193928);
    t10 = (t9 + 56U);
    t19 = *((char **)t10);
    t20 = (t19 + 56U);
    t21 = *((char **)t20);
    memcpy(t21, t6, 8U);
    xsi_driver_first_trans_fast(t9);
    xsi_set_current_line(443, ng0);
    t1 = (t0 + 194120);
    t2 = (t1 + 56U);
    t3 = *((char **)t2);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    *((unsigned char *)t5) = (unsigned char)1;
    xsi_driver_first_trans_fast(t1);
    goto LAB2;

LAB8:    xsi_set_current_line(446, ng0);
    t1 = (t0 + 139240U);
    t2 = *((char **)t1);
    t1 = (t0 + 302784U);
    t3 = (t0 + 312098);
    t5 = (t25 + 0U);
    t6 = (t5 + 0U);
    *((int *)t6) = 0;
    t6 = (t5 + 4U);
    *((int *)t6) = 4;
    t6 = (t5 + 8U);
    *((int *)t6) = 1;
    t12 = (4 - 0);
    t14 = (t12 * 1);
    t14 = (t14 + 1);
    t6 = (t5 + 12U);
    *((unsigned int *)t6) = t14;
    t6 = ieee_p_1242562249_sub_1701011461141717515_1035706684(IEEE_P_1242562249, t24, t2, t1, t3, t25);
    t8 = (t24 + 12U);
    t14 = *((unsigned int *)t8);
    t15 = (1U * t14);
    t7 = (8U != t15);
    if (t7 == 1)
        goto LAB33;

LAB34:    t9 = (t0 + 193928);
    t10 = (t9 + 56U);
    t19 = *((char **)t10);
    t20 = (t19 + 56U);
    t21 = *((char **)t20);
    memcpy(t21, t6, 8U);
    xsi_driver_first_trans_fast(t9);
    xsi_set_current_line(447, ng0);
    t1 = (t0 + 194120);
    t2 = (t1 + 56U);
    t3 = *((char **)t2);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    *((unsigned char *)t5) = (unsigned char)1;
    xsi_driver_first_trans_fast(t1);
    goto LAB2;

LAB9:    xsi_set_current_line(450, ng0);
    t1 = (t0 + 139240U);
    t2 = *((char **)t1);
    t1 = (t0 + 302784U);
    t3 = (t0 + 312103);
    t5 = (t25 + 0U);
    t6 = (t5 + 0U);
    *((int *)t6) = 0;
    t6 = (t5 + 4U);
    *((int *)t6) = 4;
    t6 = (t5 + 8U);
    *((int *)t6) = 1;
    t12 = (4 - 0);
    t14 = (t12 * 1);
    t14 = (t14 + 1);
    t6 = (t5 + 12U);
    *((unsigned int *)t6) = t14;
    t6 = ieee_p_1242562249_sub_1701011461141789389_1035706684(IEEE_P_1242562249, t24, t2, t1, t3, t25);
    t8 = (t24 + 12U);
    t14 = *((unsigned int *)t8);
    t15 = (1U * t14);
    t7 = (8U != t15);
    if (t7 == 1)
        goto LAB35;

LAB36:    t9 = (t0 + 193928);
    t10 = (t9 + 56U);
    t19 = *((char **)t10);
    t20 = (t19 + 56U);
    t21 = *((char **)t20);
    memcpy(t21, t6, 8U);
    xsi_driver_first_trans_fast(t9);
    xsi_set_current_line(451, ng0);
    t1 = (t0 + 194120);
    t2 = (t1 + 56U);
    t3 = *((char **)t2);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    *((unsigned char *)t5) = (unsigned char)1;
    xsi_driver_first_trans_fast(t1);
    goto LAB2;

LAB10:    xsi_set_current_line(454, ng0);
    t1 = (t0 + 140520U);
    t2 = *((char **)t1);
    t7 = *((unsigned char *)t2);
    t11 = (t7 == (unsigned char)3);
    if (t11 != 0)
        goto LAB37;

LAB39:
LAB38:    goto LAB2;

LAB11:    xsi_set_current_line(459, ng0);
    t1 = (t0 + 194120);
    t2 = (t1 + 56U);
    t3 = *((char **)t2);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    *((unsigned char *)t5) = (unsigned char)0;
    xsi_driver_first_trans_fast(t1);
    goto LAB2;

LAB12:    xsi_set_current_line(410, ng0);
    t1 = (t0 + 194120);
    t3 = (t1 + 56U);
    t4 = *((char **)t3);
    t5 = (t4 + 56U);
    t6 = *((char **)t5);
    *((unsigned char *)t6) = (unsigned char)1;
    xsi_driver_first_trans_fast(t1);
    goto LAB13;

LAB15:    xsi_set_current_line(421, ng0);
    t5 = (t0 + 194120);
    t6 = (t5 + 56U);
    t8 = *((char **)t6);
    t9 = (t8 + 56U);
    t10 = *((char **)t9);
    *((unsigned char *)t10) = (unsigned char)1;
    xsi_driver_first_trans_fast(t5);
    xsi_set_current_line(422, ng0);
    t1 = (t0 + 140200U);
    t2 = *((char **)t1);
    t1 = (t0 + 312080);
    t12 = xsi_mem_cmp(t1, t2, 2U);
    if (t12 == 1)
        goto LAB19;

LAB24:    t4 = (t0 + 312082);
    t13 = xsi_mem_cmp(t4, t2, 2U);
    if (t13 == 1)
        goto LAB20;

LAB25:    t6 = (t0 + 312084);
    t17 = xsi_mem_cmp(t6, t2, 2U);
    if (t17 == 1)
        goto LAB21;

LAB26:    t9 = (t0 + 312086);
    t18 = xsi_mem_cmp(t9, t2, 2U);
    if (t18 == 1)
        goto LAB22;

LAB27:
LAB23:    xsi_set_current_line(431, ng0);

LAB18:    goto LAB16;

LAB19:    xsi_set_current_line(424, ng0);
    t19 = (t0 + 194120);
    t20 = (t19 + 56U);
    t21 = *((char **)t20);
    t22 = (t21 + 56U);
    t23 = *((char **)t22);
    *((unsigned char *)t23) = (unsigned char)3;
    xsi_driver_first_trans_fast(t19);
    goto LAB18;

LAB20:    xsi_set_current_line(426, ng0);
    t1 = (t0 + 194120);
    t2 = (t1 + 56U);
    t3 = *((char **)t2);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    *((unsigned char *)t5) = (unsigned char)4;
    xsi_driver_first_trans_fast(t1);
    goto LAB18;

LAB21:    xsi_set_current_line(428, ng0);
    t1 = (t0 + 194120);
    t2 = (t1 + 56U);
    t3 = *((char **)t2);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    *((unsigned char *)t5) = (unsigned char)5;
    xsi_driver_first_trans_fast(t1);
    goto LAB18;

LAB22:    xsi_set_current_line(430, ng0);
    t1 = (t0 + 194120);
    t2 = (t1 + 56U);
    t3 = *((char **)t2);
    t4 = (t3 + 56U);
    t5 = *((char **)t4);
    *((unsigned char *)t5) = (unsigned char)6;
    xsi_driver_first_trans_fast(t1);
    goto LAB18;

LAB28:;
LAB29:    xsi_size_not_matching(8U, t15, 0);
    goto LAB30;

LAB31:    xsi_size_not_matching(8U, t15, 0);
    goto LAB32;

LAB33:    xsi_size_not_matching(8U, t15, 0);
    goto LAB34;

LAB35:    xsi_size_not_matching(8U, t15, 0);
    goto LAB36;

LAB37:    xsi_set_current_line(455, ng0);
    t1 = (t0 + 194120);
    t3 = (t1 + 56U);
    t4 = *((char **)t3);
    t5 = (t4 + 56U);
    t6 = *((char **)t5);
    *((unsigned char *)t6) = (unsigned char)0;
    xsi_driver_first_trans_fast(t1);
    goto LAB38;

}

static void work_a_0977831778_3212880686_p_5(char *t0)
{
    char *t1;
    char *t2;
    char *t3;
    int t4;
    int t5;
    unsigned int t6;
    unsigned int t7;
    unsigned int t8;
    unsigned char t9;
    char *t10;
    char *t11;
    char *t12;
    char *t13;
    char *t14;

LAB0:    xsi_set_current_line(466, ng0);
    t1 = (t0 + 137480U);
    t2 = *((char **)t1);
    t1 = (t0 + 141800U);
    t3 = *((char **)t1);
    t4 = *((int *)t3);
    t5 = (t4 - 0);
    t6 = (t5 * 1);
    xsi_vhdl_check_range_of_index(0, 255, 1, t4);
    t7 = (1U * t6);
    t8 = (0 + t7);
    t1 = (t2 + t8);
    t9 = *((unsigned char *)t1);
    t10 = (t0 + 194184);
    t11 = (t10 + 56U);
    t12 = *((char **)t11);
    t13 = (t12 + 56U);
    t14 = *((char **)t13);
    *((unsigned char *)t14) = t9;
    xsi_driver_first_trans_fast_port(t10);
    xsi_set_current_line(467, ng0);
    t1 = (t0 + 138280U);
    t2 = *((char **)t1);
    t1 = (t0 + 141800U);
    t3 = *((char **)t1);
    t4 = *((int *)t3);
    t5 = (t4 - 0);
    t6 = (t5 * 1);
    xsi_vhdl_check_range_of_index(0, 255, 1, t4);
    t7 = (8U * t6);
    t8 = (0 + t7);
    t1 = (t2 + t8);
    t10 = (t0 + 194248);
    t11 = (t10 + 56U);
    t12 = *((char **)t11);
    t13 = (t12 + 56U);
    t14 = *((char **)t13);
    memcpy(t14, t1, 8U);
    xsi_driver_first_trans_fast_port(t10);
    t1 = (t0 + 192568);
    *((int *)t1) = 1;

LAB1:    return;
}
static void work_a_2539110652_3212880686_p_0(char *t0)
{
    char t10[16];
    char *t1;
    char *t2;
    unsigned char t3;
    unsigned char t4;
    char *t5;
    char *t6;
    char *t7;
    char *t8;
    char *t9;
    int t11;
    unsigned int t12;
    int t13;
    char *t14;
    char *t15;
    int t16;
    int t17;
    int t18;
    int t19;
    int t20;
    int t21;
    unsigned char t22;
    int t23;
    int t24;
    int t25;
    int t26;
    int t27;
    char *t28;

LAB0:    xsi_set_current_line(57, ng0);
    t1 = (t0 + 1192U);
    t2 = *((char **)t1);
    t3 = *((unsigned char *)t2);
    t4 = (t3 == (unsigned char)3);
    if (t4 != 0)
        goto LAB2;

LAB4:    xsi_set_current_line(64, ng0);
    t1 = (t0 + 1992U);
    t2 = *((char **)t1);
    t1 = (t0 + 4008U);
    t5 = *((char **)t1);
    t1 = (t5 + 0);
    memcpy(t1, t2, 3U);
    xsi_set_current_line(65, ng0);
    t1 = (t0 + 4008U);
    t2 = *((char **)t1);
    t1 = (t0 + 9056U);
    t5 = (t0 + 9180);
    t7 = (t10 + 0U);
    t8 = (t7 + 0U);
    *((int *)t8) = 0;
    t8 = (t7 + 4U);
    *((int *)t8) = 2;
    t8 = (t7 + 8U);
    *((int *)t8) = 1;
    t11 = (2 - 0);
    t12 = (t11 * 1);
    t12 = (t12 + 1);
    t8 = (t7 + 12U);
    *((unsigned int *)t8) = t12;
    t3 = ieee_std_logic_unsigned_equal_stdv_stdv(IEEE_P_3620187407, t2, t1, t5, t10);
    if (t3 != 0)
        goto LAB5;

LAB7:    t1 = (t0 + 4008U);
    t2 = *((char **)t1);
    t1 = (t0 + 9056U);
    t5 = (t0 + 9183);
    t7 = (t10 + 0U);
    t8 = (t7 + 0U);
    *((int *)t8) = 0;
    t8 = (t7 + 4U);
    *((int *)t8) = 2;
    t8 = (t7 + 8U);
    *((int *)t8) = 1;
    t11 = (2 - 0);
    t12 = (t11 * 1);
    t12 = (t12 + 1);
    t8 = (t7 + 12U);
    *((unsigned int *)t8) = t12;
    t3 = ieee_p_3620187407_sub_1306455576380142462_3965413181(IEEE_P_3620187407, t2, t1, t5, t10);
    if (t3 != 0)
        goto LAB23;

LAB24:
LAB6:
LAB3:    t1 = (t0 + 5424);
    *((int *)t1) = 1;

LAB1:    return;
LAB2:    xsi_set_current_line(58, ng0);
    t1 = (t0 + 5504);
    t5 = (t1 + 56U);
    t6 = *((char **)t5);
    t7 = (t6 + 56U);
    t8 = *((char **)t7);
    *((unsigned char *)t8) = (unsigned char)3;
    xsi_driver_first_trans_fast_port(t1);
    xsi_set_current_line(59, ng0);
    t1 = (t0 + 5568);
    t2 = (t1 + 56U);
    t5 = *((char **)t2);
    t6 = (t5 + 56U);
    t7 = *((char **)t6);
    *((unsigned char *)t7) = (unsigned char)3;
    xsi_driver_first_trans_fast(t1);
    xsi_set_current_line(60, ng0);
    t1 = (t0 + 9156);
    t5 = (t0 + 5632);
    t6 = (t5 + 56U);
    t7 = *((char **)t6);
    t8 = (t7 + 56U);
    t9 = *((char **)t8);
    memcpy(t9, t1, 8U);
    xsi_driver_first_trans_fast_port(t5);
    xsi_set_current_line(61, ng0);
    t1 = (t0 + 9164);
    t5 = (t0 + 5696);
    t6 = (t5 + 56U);
    t7 = *((char **)t6);
    t8 = (t7 + 56U);
    t9 = *((char **)t8);
    memcpy(t9, t1, 8U);
    xsi_driver_first_trans_fast_port(t5);
    xsi_set_current_line(62, ng0);
    t1 = (t0 + 9172);
    t5 = (t0 + 5760);
    t6 = (t5 + 56U);
    t7 = *((char **)t6);
    t8 = (t7 + 56U);
    t9 = *((char **)t8);
    memcpy(t9, t1, 8U);
    xsi_driver_first_trans_fast_port(t5);
    goto LAB3;

LAB5:    xsi_set_current_line(66, ng0);
    t8 = (t0 + 1512U);
    t9 = *((char **)t8);
    t8 = (t0 + 8944U);
    t13 = ieee_p_1242562249_sub_1871261289446890672_1035706684(IEEE_P_1242562249, t9, t8);
    t14 = (t0 + 3768U);
    t15 = *((char **)t14);
    t14 = (t15 + 0);
    *((int *)t14) = t13;
    xsi_set_current_line(67, ng0);
    t1 = (t0 + 1672U);
    t2 = *((char **)t1);
    t1 = (t0 + 8960U);
    t11 = ieee_p_1242562249_sub_1871261289446890672_1035706684(IEEE_P_1242562249, t2, t1);
    t5 = (t0 + 3888U);
    t6 = *((char **)t5);
    t5 = (t6 + 0);
    *((int *)t5) = t11;
    xsi_set_current_line(68, ng0);
    t1 = (t0 + 1832U);
    t2 = *((char **)t1);
    t1 = (t0 + 8976U);
    t11 = ieee_p_1242562249_sub_1871261289446890672_1035706684(IEEE_P_1242562249, t2, t1);
    t5 = (t0 + 3168U);
    t6 = *((char **)t5);
    t5 = (t6 + 0);
    *((int *)t5) = t11;
    xsi_set_current_line(69, ng0);
    t1 = (t0 + 3768U);
    t2 = *((char **)t1);
    t11 = *((int *)t2);
    t13 = (t11 + 10);
    t16 = (t13 / 6);
    t1 = (t0 + 3888U);
    t5 = *((char **)t1);
    t17 = *((int *)t5);
    t18 = (t17 / 5);
    t3 = (t16 > t18);
    if (t3 != 0)
        goto LAB8;

LAB10:    xsi_set_current_line(72, ng0);
    t1 = (t0 + 3888U);
    t2 = *((char **)t1);
    t11 = *((int *)t2);
    t13 = (t11 / 5);
    t1 = (t0 + 3648U);
    t5 = *((char **)t1);
    t1 = (t5 + 0);
    *((int *)t1) = t13;

LAB9:    xsi_set_current_line(75, ng0);
    t11 = (7 * 60);
    t1 = (t0 + 3168U);
    t2 = *((char **)t1);
    t13 = *((int *)t2);
    t16 = (t11 / t13);
    t17 = (t16 + 2);
    t1 = (t0 + 3528U);
    t5 = *((char **)t1);
    t1 = (t5 + 0);
    *((int *)t1) = t17;
    xsi_set_current_line(80, ng0);
    t1 = (t0 + 3168U);
    t2 = *((char **)t1);
    t11 = *((int *)t2);
    t1 = (t0 + 3648U);
    t5 = *((char **)t1);
    t13 = *((int *)t5);
    t4 = (t11 > t13);
    if (t4 == 1)
        goto LAB14;

LAB15:    t3 = (unsigned char)0;

LAB16:    if (t3 != 0)
        goto LAB11;

LAB13:    xsi_set_current_line(92, ng0);
    t1 = (t0 + 3288U);
    t2 = *((char **)t1);
    t1 = (t2 + 0);
    *((int *)t1) = 90;
    xsi_set_current_line(93, ng0);
    t1 = (t0 + 3408U);
    t2 = *((char **)t1);
    t1 = (t2 + 0);
    *((int *)t1) = 30;

LAB12:    xsi_set_current_line(99, ng0);
    t1 = (t0 + 3288U);
    t2 = *((char **)t1);
    t11 = *((int *)t2);
    t1 = ieee_p_1242562249_sub_17126692536656888728_1035706684(IEEE_P_1242562249, t10, t11, 8);
    t5 = (t0 + 5632);
    t6 = (t5 + 56U);
    t7 = *((char **)t6);
    t8 = (t7 + 56U);
    t9 = *((char **)t8);
    memcpy(t9, t1, 8U);
    xsi_driver_first_trans_fast_port(t5);
    xsi_set_current_line(100, ng0);
    t1 = (t0 + 3408U);
    t2 = *((char **)t1);
    t11 = *((int *)t2);
    t1 = ieee_p_1242562249_sub_17126692536656888728_1035706684(IEEE_P_1242562249, t10, t11, 8);
    t5 = (t0 + 5696);
    t6 = (t5 + 56U);
    t7 = *((char **)t6);
    t8 = (t7 + 56U);
    t9 = *((char **)t8);
    memcpy(t9, t1, 8U);
    xsi_driver_first_trans_fast_port(t5);
    xsi_set_current_line(101, ng0);
    t1 = (t0 + 3528U);
    t2 = *((char **)t1);
    t11 = *((int *)t2);
    t1 = ieee_p_1242562249_sub_17126692536656888728_1035706684(IEEE_P_1242562249, t10, t11, 8);
    t5 = (t0 + 5760);
    t6 = (t5 + 56U);
    t7 = *((char **)t6);
    t8 = (t7 + 56U);
    t9 = *((char **)t8);
    memcpy(t9, t1, 8U);
    xsi_driver_first_trans_fast_port(t5);
    xsi_set_current_line(102, ng0);
    t1 = (t0 + 5504);
    t2 = (t1 + 56U);
    t5 = *((char **)t2);
    t6 = (t5 + 56U);
    t7 = *((char **)t6);
    *((unsigned char *)t7) = (unsigned char)3;
    xsi_driver_first_trans_fast_port(t1);
    xsi_set_current_line(103, ng0);
    t1 = (t0 + 5568);
    t2 = (t1 + 56U);
    t5 = *((char **)t2);
    t6 = (t5 + 56U);
    t7 = *((char **)t6);
    *((unsigned char *)t7) = (unsigned char)3;
    xsi_driver_first_trans_fast(t1);
    goto LAB6;

LAB8:    xsi_set_current_line(70, ng0);
    t1 = (t0 + 3768U);
    t6 = *((char **)t1);
    t19 = *((int *)t6);
    t20 = (t19 + 10);
    t21 = (t20 / 6);
    t1 = (t0 + 3648U);
    t7 = *((char **)t1);
    t1 = (t7 + 0);
    *((int *)t1) = t21;
    goto LAB9;

LAB11:    xsi_set_current_line(81, ng0);
    t1 = (t0 + 3648U);
    t7 = *((char **)t1);
    t17 = *((int *)t7);
    t18 = (14 * t17);
    t19 = (t18 * 60);
    t1 = (t0 + 3168U);
    t8 = *((char **)t1);
    t20 = *((int *)t8);
    t1 = (t0 + 3168U);
    t9 = *((char **)t1);
    t21 = *((int *)t9);
    t1 = (t0 + 3648U);
    t14 = *((char **)t1);
    t23 = *((int *)t14);
    t24 = (t21 - t23);
    t25 = (t20 * t24);
    t26 = (t19 / t25);
    t27 = (t26 + 4);
    t1 = (t0 + 3288U);
    t15 = *((char **)t1);
    t1 = (t15 + 0);
    *((int *)t1) = t27;
    xsi_set_current_line(82, ng0);
    t1 = (t0 + 3288U);
    t2 = *((char **)t1);
    t11 = *((int *)t2);
    t3 = (t11 > 90);
    if (t3 != 0)
        goto LAB17;

LAB19:
LAB18:    xsi_set_current_line(86, ng0);
    t1 = (t0 + 3288U);
    t2 = *((char **)t1);
    t11 = *((int *)t2);
    t1 = (t0 + 3528U);
    t5 = *((char **)t1);
    t13 = *((int *)t5);
    t16 = (t11 + t13);
    t17 = (5 * t16);
    t1 = (t0 + 3168U);
    t6 = *((char **)t1);
    t18 = *((int *)t6);
    t19 = (t18 - 5);
    t20 = (t17 / t19);
    t21 = (t20 + 1);
    t1 = (t0 + 3408U);
    t7 = *((char **)t1);
    t1 = (t7 + 0);
    *((int *)t1) = t21;
    xsi_set_current_line(87, ng0);
    t1 = (t0 + 3408U);
    t2 = *((char **)t1);
    t11 = *((int *)t2);
    t3 = (t11 > 30);
    if (t3 != 0)
        goto LAB20;

LAB22:
LAB21:    goto LAB12;

LAB14:    t1 = (t0 + 3168U);
    t6 = *((char **)t1);
    t16 = *((int *)t6);
    t22 = (t16 > 5);
    t3 = t22;
    goto LAB16;

LAB17:    xsi_set_current_line(83, ng0);
    t1 = (t0 + 3288U);
    t5 = *((char **)t1);
    t1 = (t5 + 0);
    *((int *)t1) = 90;
    goto LAB18;

LAB20:    xsi_set_current_line(88, ng0);
    t1 = (t0 + 3408U);
    t5 = *((char **)t1);
    t1 = (t5 + 0);
    *((int *)t1) = 30;
    goto LAB21;

LAB23:    xsi_set_current_line(105, ng0);
    t8 = (t0 + 5504);
    t9 = (t8 + 56U);
    t14 = *((char **)t9);
    t15 = (t14 + 56U);
    t28 = *((char **)t15);
    *((unsigned char *)t28) = (unsigned char)2;
    xsi_driver_first_trans_fast_port(t8);
    xsi_set_current_line(106, ng0);
    t1 = (t0 + 5568);
    t2 = (t1 + 56U);
    t5 = *((char **)t2);
    t6 = (t5 + 56U);
    t7 = *((char **)t6);
    *((unsigned char *)t7) = (unsigned char)2;
    xsi_driver_first_trans_fast(t1);
    goto LAB6;

}
Exemple #4
0
/* fparseln():
 *	Read a line from a file parsing continuations ending in \
 *	and eliminating trailing newlines, or comments starting with
 *	the comment char.
 */
char *
fparseln(FILE *fp, size_t *size, size_t *lineno, const char str[3],
    int flags)
{
	static const char dstr[3] = { '\\', '\\', '#' };
	char	*buf = NULL, *ptr, *cp, esc, con, nl, com;
	size_t	s, len = 0;
	int	cnt = 1;

	if (str == NULL)
		str = dstr;

	esc = str[0];
	con = str[1];
	com = str[2];

	/*
	 * XXX: it would be cool to be able to specify the newline character,
	 * but unfortunately, fgetln does not let us
	 */
	nl  = '\n';

	while (cnt) {
		cnt = 0;

		if (lineno)
			(*lineno)++;

		if ((ptr = fgetln(fp, &s)) == NULL)
			break;

		if (s && com) {		/* Check and eliminate comments */
			for (cp = ptr; cp < ptr + s; cp++)
				if (*cp == com && !isescaped(ptr, cp, esc)) {
					s = cp - ptr;
					cnt = s == 0 && buf == NULL;
					break;
				}
		}

		if (s && nl) {		/* Check and eliminate newlines */
			cp = &ptr[s - 1];

			if (*cp == nl)
				s--;	/* forget newline */
		}

		if (s && con) {		/* Check and eliminate continuations */
			cp = &ptr[s - 1];

			if (*cp == con && !isescaped(ptr, cp, esc)) {
				s--;	/* forget escape */
				cnt = 1;
			}
		}

		if (s == 0 && buf != NULL)
			continue;

		if ((cp = realloc(buf, len + s + 1)) == NULL) {
			free(buf);
			return NULL;
		}
		buf = cp;

		(void) memcpy(buf + len, ptr, s);
		len += s;
		buf[len] = '\0';
	}

	if ((flags & FPARSELN_UNESCALL) != 0 && esc && buf != NULL &&
	    strchr(buf, esc) != NULL) {
		ptr = cp = buf;
		while (cp[0] != '\0') {
			int skipesc;

			while (cp[0] != '\0' && cp[0] != esc)
				*ptr++ = *cp++;
			if (cp[0] == '\0' || cp[1] == '\0')
				break;

			skipesc = 0;
			if (cp[1] == com)
				skipesc += (flags & FPARSELN_UNESCCOMM);
			if (cp[1] == con)
				skipesc += (flags & FPARSELN_UNESCCONT);
			if (cp[1] == esc)
				skipesc += (flags & FPARSELN_UNESCESC);
			if (cp[1] != com && cp[1] != con && cp[1] != esc)
				skipesc = (flags & FPARSELN_UNESCREST);

			if (skipesc)
				cp++;
			else
				*ptr++ = *cp++;
			*ptr++ = *cp++;
		}
		*ptr = '\0';
		len = strlen(buf);
	}

	if (size)
		*size = len;
	return buf;
}
Exemple #5
0
/////////////////////////////////////
// Name:	LightGetDat
// Purpose:	get data of given light
// Output:	lightDat set
// Return:	none
/////////////////////////////////////
void F_API LightGetDat(hLIGHT l, gfxLight *lightDat)
{
	memcpy(lightDat, &l->lDat, sizeof(gfxLight));
}
Exemple #6
0
static int
aes_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
    const unsigned char *iv, int enc)
{
	EVP_AES_XTS_CTX *xctx = ctx->cipher_data;

	if (!iv && !key)
		return 1;

	if (key) do {
#ifdef AES_XTS_ASM
		xctx->stream = enc ? AES_xts_encrypt : AES_xts_decrypt;
#else
		xctx->stream = NULL;
#endif
		/* key_len is two AES keys */
#ifdef BSAES_CAPABLE
		if (BSAES_CAPABLE)
			xctx->stream = enc ? bsaes_xts_encrypt :
			    bsaes_xts_decrypt;
		else
#endif
#ifdef VPAES_CAPABLE
		if (VPAES_CAPABLE) {
			if (enc) {
				vpaes_set_encrypt_key(key, ctx->key_len * 4,
				    &xctx->ks1);
				xctx->xts.block1 = (block128_f)vpaes_encrypt;
			} else {
				vpaes_set_decrypt_key(key, ctx->key_len * 4,
				    &xctx->ks1);
				xctx->xts.block1 = (block128_f)vpaes_decrypt;
			}

			vpaes_set_encrypt_key(key + ctx->key_len / 2,
			    ctx->key_len * 4, &xctx->ks2);
			xctx->xts.block2 = (block128_f)vpaes_encrypt;

			xctx->xts.key1 = &xctx->ks1;
			break;
		} else
#endif
			(void)0;	/* terminate potentially open 'else' */

		if (enc) {
			AES_set_encrypt_key(key, ctx->key_len * 4, &xctx->ks1);
			xctx->xts.block1 = (block128_f)AES_encrypt;
		} else {
			AES_set_decrypt_key(key, ctx->key_len * 4, &xctx->ks1);
			xctx->xts.block1 = (block128_f)AES_decrypt;
		}

		AES_set_encrypt_key(key + ctx->key_len / 2,
		    ctx->key_len * 4, &xctx->ks2);
		xctx->xts.block2 = (block128_f)AES_encrypt;

		xctx->xts.key1 = &xctx->ks1;
	} while (0);

	if (iv) {
		xctx->xts.key2 = &xctx->ks2;
		memcpy(ctx->iv, iv, 16);
	}

	return 1;
}
Exemple #7
0
static int fail_this_path(int fd, int lun, int use_6_byte)
{
    unsigned char fail_paths_pg[308];
    struct rdac_legacy_page *rdac_page;
    struct rdac_expanded_page *rdac_page_exp;
    struct rdac_page_common *rdac_common = NULL;
    int res;
    char b[80];

    if (use_6_byte && lun > 32) {
        pr2serr("must use 10 byte cdb to fail luns over 32\n");
        return -1;
    }

    memset(fail_paths_pg, 0, 308);
    if (use_6_byte) {
        memcpy(fail_paths_pg, mode6_hdr, 4);
        memcpy(fail_paths_pg + 4, block_descriptor, 8);
        rdac_page = (struct rdac_legacy_page *)(fail_paths_pg + 4 + 8);
        rdac_page->page_code = RDAC_CONTROLLER_PAGE;
        rdac_page->page_length = RDAC_CONTROLLER_PAGE_LEN;
        rdac_common = &rdac_page->attr;
        memset(rdac_page->lun_table, 0x0, 32);
        rdac_page->lun_table[lun] = 0x81;
    } else {
        memcpy(fail_paths_pg, mode10_hdr, 8);
        rdac_page_exp = (struct rdac_expanded_page *)
                        (fail_paths_pg + 8);
        rdac_page_exp->page_code = RDAC_CONTROLLER_PAGE | 0x40;
        rdac_page_exp->subpage_code = 0x1;
        sg_put_unaligned_be16(EXPANDED_LUN_SPACE_PAGE_LEN,
                              rdac_page_exp->page_length + 0);
        rdac_common = &rdac_page_exp->attr;
        memset(rdac_page_exp->lun_table, 0x0, 256);
        rdac_page_exp->lun_table[lun] = 0x81;
    }

    rdac_common->current_mode_lsb =  RDAC_FAIL_SELECTED_PATHS;
    rdac_common->quiescence = RDAC_QUIESCENCE_TIME;
    rdac_common->options = RDAC_FORCE_QUIESCENCE;

    if (use_6_byte) {
        res = sg_ll_mode_select6(fd, 1 /* pf */, 0 /* sp */,
                                 fail_paths_pg, 118,
                                 1, (do_verbose ? 2 : 0));
    } else {
        res = sg_ll_mode_select10(fd, 1 /* pf */, 0 /* sp */,
                                  fail_paths_pg, 308,
                                  1, (do_verbose ? 2: 0));
    }

    switch (res) {
    case 0:
        if (do_verbose)
            pr2serr("fail paths successful\n");
        break;
    default:
        sg_get_category_sense_str(res, sizeof(b), b, do_verbose);
        pr2serr("fail paths page (lun=%d) failed: %s\n", lun, b);
        break;
    }

    return res;
}
Exemple #8
0
PyObject *session_connect(PyObject *self, PyObject *args) {
#ifdef DEBUG
    fprintf(stderr, "> entering session_connect\n");
#endif
    sp_session_config config;
    PyObject *client;
    sp_session *session;
    sp_error error;
    PyObject *uobj, *pobj;
    char *username, *password;

    if(!PyArg_ParseTuple(args, "O", &client))
	return NULL;

    PyEval_InitThreads();
    config.api_version = SPOTIFY_API_VERSION;
    config.userdata = (void *)client;
    config.callbacks = &g_callbacks;
    config.user_agent = "unset";

#ifdef DEBUG
    fprintf(stderr, "Config mark 1\n");
#endif
    PyObject *cache_location = PyObject_GetAttr(client, PyString_FromString("cache_location"));
#ifdef DEBUG
    fprintf(stderr, "Cache location is '%s'\n", PyString_AsString(cache_location));
#endif
    if(cache_location == NULL) {
	PyErr_SetString(SpotifyError, "Client did not provide a cache_location");
        return NULL;
    }
#ifdef DEBUG
    fprintf(stderr, "Config mark 1.1\n");
#endif
    config.cache_location = copystring(cache_location);

#ifdef DEBUG
    fprintf(stderr, "Config mark 2\n");
#endif
    PyObject *settings_location = PyObject_GetAttr(client, PyString_FromString("settings_location"));
    if(settings_location == NULL) {
	PyErr_SetString(SpotifyError, "Client did not provide a settings_location");
        return NULL;
    }
    config.settings_location = copystring(settings_location);

#ifdef DEBUG
    fprintf(stderr, "Config mark 3\n");
#endif
    PyObject *application_key = PyObject_GetAttr(client, PyString_FromString("application_key"));
    if(application_key == NULL) {
	PyErr_SetString(SpotifyError, "Client did not provide an application_key");
        return NULL;
    }
    char *s_appkey;
    Py_ssize_t l_appkey;
    PyString_AsStringAndSize(application_key, &s_appkey, &l_appkey);
    config.application_key_size = l_appkey;
    config.application_key = PyMem_Malloc(l_appkey);
    memcpy(config.application_key, s_appkey, l_appkey);

#ifdef DEBUG
    fprintf(stderr, "Config mark 4\n");
#endif
    PyObject *user_agent = PyObject_GetAttr(client, PyString_FromString("user_agent"));
    if(user_agent == NULL) {
	PyErr_SetString(SpotifyError, "Client did not provide a user_agent");
        return NULL;
    }
    config.user_agent = copystring(user_agent);

#ifdef DEBUG
    fprintf(stderr, "Config mark 5\n");
#endif
    uobj = PyObject_GetAttr(client, PyString_FromString("username"));
    if(uobj == NULL) {
	PyErr_SetString(SpotifyError, "Client did not provide a username");
	return NULL;
    }
    username = copystring(uobj);

    pobj = PyObject_GetAttr(client, PyString_FromString("password"));
    if(pobj == NULL) {
	PyErr_SetString(SpotifyError, "Client did not provide a password");
	return NULL;
    }
    password = copystring(pobj);

    Py_BEGIN_ALLOW_THREADS
#ifdef DEBUG
    fprintf(stderr, "Calling sp_session_init\n");
#endif
    error = sp_session_init(&config, &session);
#ifdef DEBUG
    fprintf(stderr, "Returned from sp_session_init\n");
#endif
    Py_END_ALLOW_THREADS
    session_constructed = 1;
    if(error != SP_ERROR_OK) {
	PyErr_SetString(SpotifyError, sp_error_message(error));
        return NULL;
    }
    Py_BEGIN_ALLOW_THREADS
    error = sp_session_login(session, username, password);
    Py_END_ALLOW_THREADS
    if(error != SP_ERROR_OK) {
	PyErr_SetString(SpotifyError, sp_error_message(error));
        return NULL;
    }
    Session *psession = (Session *)PyObject_CallObject((PyObject *)&SessionType, NULL);
    Py_INCREF(psession);
    psession->_session = session;
    return (PyObject *)psession;
}
Exemple #9
0
/* StoreCode - store the function or method under construction */
VMVALUE StoreCode(ParseContext *c)
{
    size_t codeSize;
    VMVALUE code;
    uint8_t *p;

    /* check for unterminated blocks */
    switch (CurrentBlockType(c)) {
    case BLOCK_IF:
    case BLOCK_ELSE:
        ParseError(c, "expecting END IF");
    case BLOCK_FOR:
        ParseError(c, "expecting NEXT");
    case BLOCK_DO:
        ParseError(c, "expecting LOOP");
    case BLOCK_NONE:
        break;
    }

    /* fixup the RESERVE instruction at the start of the code */
    if (c->codeType != CODE_TYPE_MAIN) {
        c->codeBuf[1] = 2 + c->localOffset;
        putcbyte(c, OP_RETURN);
    }

    /* make sure all referenced labels were defined */
    CheckLabels(c);
    
    /* allocate code space */
    codeSize = (int)(c->codeFree - c->codeBuf);
    p = (uint8_t *)ImageTextAlloc(c, codeSize);
    memcpy(p, c->codeBuf, codeSize);
    
    /* get the address of the compiled code */
    code = (VMVALUE)(p - (uint8_t *)c->image);

#ifdef COMPILER_DEBUG
{
    VM_printf("%s:\n", c->codeSymbol ? c->codeSymbol->name : "<main>");
    DecodeFunction((uint8_t *)c->image, (uint8_t *)c->image + code, codeSize);
    DumpSymbols(&c->arguments, "arguments");
    DumpSymbols(&c->locals, "locals");
    VM_printf("\n");
}
#endif

    /* prepare the buffer for the next function */
    c->codeFree = c->codeBuf;

    /* empty the local heap */
    c->localFree = c->heapBase;
    InitSymbolTable(&c->arguments);
    InitSymbolTable(&c->locals);
    c->labels = NULL;

    /* reset to compile the next code */
    c->codeType = CODE_TYPE_MAIN;
    
    /* return the code vector */
    return code;
}
Exemple #10
0
/* Compile - compile a program */
int Compile(ParseContext *c, uint8_t *imageSpace, size_t imageSize, size_t textMax, size_t dataMax)
{
    ImageHdr *image = (ImageHdr *)imageSpace;
    VMUVALUE textSize;

    /* setup an error target */
    if (setjmp(c->errorTarget) != 0)
        return -1;

    /* initialize the image */
    if (imageSize < sizeof(ImageHdr) + textMax + dataMax)
        return -1;
    memset(image, 0, sizeof(ImageHdr));
    c->image = image;
    
    /* empty the heap */
    c->localFree = c->heapBase;
    c->globalFree = c->heapTop;

    /* initialize the image */
    c->textBase = c->textFree = imageSpace + sizeof(ImageHdr);
    c->textTop = c->textBase + textMax;
    c->dataBase = c->dataFree = c->textBase + textMax;
    c->dataTop = c->dataBase + dataMax;
    
    /* initialize the code buffer */
    c->codeFree = c->codeBuf;
	c->codeTop = c->codeBuf + sizeof(c->codeBuf);

    /* initialize block nesting table */
    c->btop = (Block *)((char *)c->blockBuf + sizeof(c->blockBuf));
    c->bptr = c->blockBuf - 1;

    /* initialize the global symbol table and string table */
    InitSymbolTable(&c->globals);
    
    /* enter the built-in functions */
    EnterBuiltInFunction(c, "delayMs", bi_delayms, sizeof(bi_delayms));
    EnterBuiltInFunction(c, "updateLeds", bi_updateleds, sizeof(bi_updateleds));
    
    /* enter the built-in variables */
    /*
        typedef struct {
            int32_t triggerTop;
            int32_t triggerBottom;
            int32_t numLeds;
            int32_t led[RGB_SIZE];
			int32_t patternnum;
        } VM_variables;
    */
    EnterBuiltInVariable(c, "triggerTop", sizeof(VMVALUE));
    EnterBuiltInVariable(c, "triggerBottom", sizeof(VMVALUE));
    EnterBuiltInVariable(c, "numLeds", sizeof(VMVALUE));
    EnterBuiltInVariable(c, "led", sizeof(VMVALUE) * RGB_SIZE);
	EnterBuiltInVariable(c, "patternNum", sizeof(VMVALUE));
    
    /* initialize the string table */
    c->strings = NULL;

    /* initialize the label table */
    c->labels = NULL;

    /* start in the main code */
    c->codeType = CODE_TYPE_MAIN;

    /* initialize scanner */
    c->inComment = VMFALSE;
    c->lineNumber = 0;
    
    /* compile each line */
    while (GetLine(c)) {
        int tkn;
        if ((tkn = GetToken(c)) != T_EOL)
            ParseStatement(c, tkn);
    }

    /* end the main code with a halt */
    putcbyte(c, OP_HALT);
    
    /* write the main code */
    StartCode(c, CODE_TYPE_MAIN);
    image->entry = StoreCode(c);
    
    /* determine the text size */
    textSize = c->textFree - c->textBase;

    /* fill in the image header */
    image->dataOffset = sizeof(ImageHdr) + textSize;
    image->dataSize = c->dataFree - c->dataBase;
    image->imageSize = image->dataOffset + image->dataSize;
    
    /* make the data contiguous with the code */
    memcpy(&imageSpace[image->dataOffset], c->dataBase, image->dataSize);

#ifdef COMPILER_DEBUG
    VM_printf("entry      "); PrintValue(image->entry); VM_printf("\n");
    VM_printf("imageSize  "); PrintValue(image->imageSize); VM_printf("\n");
    VM_printf("textSize   "); PrintValue(textSize); VM_printf("\n");
    VM_printf("dataOffset ");  PrintValue(image->dataOffset); VM_printf("\n");
    VM_printf("dataSize   "); PrintValue(image->dataSize); VM_printf("\n");
    DumpSymbols(&c->globals, "symbols");
#endif

    /* return successfully */
    return 0;
}
Exemple #11
0
/* EnterBuiltInFunction - enter a built-in function */
static void EnterBuiltInFunction(ParseContext *c, char *name, uint8_t *code, size_t codeSize)
{
    uint8_t *p = ImageTextAlloc(c, codeSize);
    memcpy(p, code, codeSize);
    AddGlobal(c, name, SC_CONSTANT,  (VMVALUE)(p - (uint8_t *)c->image));
}
Exemple #12
0
inline void append(YYCTYPE *output, size_t & outsize, const YYCTYPE * text, size_t len)
{
    memcpy(output + outsize, text, len);
    outsize += (len / sizeof(YYCTYPE));
}
static void work_a_0977831778_3212880686_p_0(char *t0)
{
    char t3[16];
    char t8[16];
    char *t1;
    unsigned char t2;
    char *t4;
    char *t5;
    char *t6;
    char *t9;
    char *t10;
    int t11;
    unsigned int t12;
    char *t13;
    unsigned int t14;
    unsigned char t15;
    char *t16;
    char *t17;
    char *t18;
    char *t19;
    char *t20;

LAB0:    xsi_set_current_line(283, ng0);
    t1 = (t0 + 136160U);
    t2 = ieee_p_2592010699_sub_2763492388968962707_503743352(IEEE_P_2592010699, t1, 0U, 0U);
    if (t2 != 0)
        goto LAB2;

LAB4:
LAB3:    t1 = (t0 + 192488);
    *((int *)t1) = 1;

LAB1:    return;
LAB2:    xsi_set_current_line(284, ng0);
    t4 = (t0 + 143240U);
    t5 = *((char **)t4);
    t4 = (t0 + 302832U);
    t6 = (t0 + 312078);
    t9 = (t8 + 0U);
    t10 = (t9 + 0U);
    *((int *)t10) = 0;
    t10 = (t9 + 4U);
    *((int *)t10) = 1;
    t10 = (t9 + 8U);
    *((int *)t10) = 1;
    t11 = (1 - 0);
    t12 = (t11 * 1);
    t12 = (t12 + 1);
    t10 = (t9 + 12U);
    *((unsigned int *)t10) = t12;
    t10 = ieee_p_1242562249_sub_1701011461141717515_1035706684(IEEE_P_1242562249, t3, t5, t4, t6, t8);
    t13 = (t3 + 12U);
    t12 = *((unsigned int *)t13);
    t14 = (1U * t12);
    t15 = (4U != t14);
    if (t15 == 1)
        goto LAB5;

LAB6:    t16 = (t0 + 192840);
    t17 = (t16 + 56U);
    t18 = *((char **)t17);
    t19 = (t18 + 56U);
    t20 = *((char **)t19);
    memcpy(t20, t10, 4U);
    xsi_driver_first_trans_fast(t16);
    goto LAB3;

LAB5:    xsi_size_not_matching(4U, t14, 0);
    goto LAB6;

}
void Test_M2MResourceInstance::test_handle_get_request()
{
    uint8_t value[] = {"name"};
    sn_coap_hdr_s *coap_header = (sn_coap_hdr_s *)malloc(sizeof(sn_coap_hdr_s));
    memset(coap_header, 0, sizeof(sn_coap_hdr_s));

    coap_header->uri_path_ptr = value;
    coap_header->uri_path_len = sizeof(value);

    coap_header->msg_code = COAP_MSG_CODE_REQUEST_GET;

    String *name = new String("name");
    common_stub::int_value = 0;
    m2mbase_stub::string_value = name;

    m2mbase_stub::operation = M2MBase::GET_ALLOWED;
    m2mbase_stub::uint8_value = 200;
    common_stub::coap_header = (sn_coap_hdr_ *)malloc(sizeof(sn_coap_hdr_));
    memset(common_stub::coap_header,0,sizeof(sn_coap_hdr_));

    coap_header->token_ptr = (uint8_t*)malloc(sizeof(value));
    memcpy(coap_header->token_ptr, value, sizeof(value));

    coap_header->options_list_ptr = (sn_coap_options_list_s*)malloc(sizeof(sn_coap_options_list_s));
    coap_header->options_list_ptr->observe = 0;

    coap_header->content_type_ptr = (uint8_t*)malloc(1);
    coap_header->content_type_len = 1;
    *coap_header->content_type_ptr = 110;

    CHECK(resource_instance->handle_get_request(NULL,coap_header,handler) != NULL);

    if(coap_header->content_type_ptr) {
        free(coap_header->content_type_ptr);
        coap_header->content_type_ptr = NULL;
    }

    if(common_stub::coap_header->content_type_ptr) {
        free(common_stub::coap_header->content_type_ptr);
        common_stub::coap_header->content_type_ptr = NULL;
    }
    if(common_stub::coap_header->options_list_ptr->max_age_ptr) {
        free(common_stub::coap_header->options_list_ptr->max_age_ptr);
        common_stub::coap_header->options_list_ptr->max_age_ptr = NULL;
    }
    if(common_stub::coap_header->options_list_ptr) {
        free(common_stub::coap_header->options_list_ptr);
        common_stub::coap_header->options_list_ptr = NULL;
    }

    // Not OMA TLV or JSON
    m2mbase_stub::uint8_value = 110;
    CHECK(resource_instance->handle_get_request(NULL,coap_header,handler) != NULL);

    if(common_stub::coap_header->content_type_ptr) {
        free(common_stub::coap_header->content_type_ptr);
        common_stub::coap_header->content_type_ptr = NULL;
    }
    if(common_stub::coap_header->options_list_ptr->max_age_ptr) {
        free(common_stub::coap_header->options_list_ptr->max_age_ptr);
        common_stub::coap_header->options_list_ptr->max_age_ptr = NULL;
    }
    if(common_stub::coap_header->options_list_ptr) {
        free(common_stub::coap_header->options_list_ptr);
        common_stub::coap_header->options_list_ptr = NULL;
    }

    // OMA TLV
    m2mbase_stub::uint8_value = 99;
    CHECK(resource_instance->handle_get_request(NULL,coap_header,handler) != NULL);

    if(common_stub::coap_header->content_type_ptr) {
        free(common_stub::coap_header->content_type_ptr);
        common_stub::coap_header->content_type_ptr = NULL;
    }
    if(common_stub::coap_header->options_list_ptr->max_age_ptr) {
        free(common_stub::coap_header->options_list_ptr->max_age_ptr);
        common_stub::coap_header->options_list_ptr->max_age_ptr = NULL;
    }
    if(common_stub::coap_header->options_list_ptr) {
        free(common_stub::coap_header->options_list_ptr);
        common_stub::coap_header->options_list_ptr = NULL;
    }

    // OMA JSON
    m2mbase_stub::uint8_value = 100;
    CHECK(resource_instance->handle_get_request(NULL,coap_header,handler) != NULL);

    if(common_stub::coap_header->content_type_ptr) {
        free(common_stub::coap_header->content_type_ptr);
        common_stub::coap_header->content_type_ptr = NULL;
    }
    if(common_stub::coap_header->options_list_ptr->max_age_ptr) {
        free(common_stub::coap_header->options_list_ptr->max_age_ptr);
        common_stub::coap_header->options_list_ptr->max_age_ptr = NULL;
    }
    if(common_stub::coap_header->options_list_ptr) {
        free(common_stub::coap_header->options_list_ptr);
        common_stub::coap_header->options_list_ptr = NULL;
    }

    coap_header->options_list_ptr->observe = 1;

    uint8_t obs = 0;
    coap_header->options_list_ptr->observe_ptr = (uint8_t*)malloc(sizeof(obs));
    memcpy(coap_header->options_list_ptr->observe_ptr,&obs,sizeof(obs));
    coap_header->options_list_ptr->observe_len = 0;
    m2mbase_stub::uint16_value = 0x1c1c;
    m2mbase_stub::bool_value = true;

    CHECK(resource_instance->handle_get_request(NULL,coap_header,handler) != NULL);

    if(common_stub::coap_header->content_type_ptr) {
        free(common_stub::coap_header->content_type_ptr);
        common_stub::coap_header->content_type_ptr = NULL;
    }
    if(common_stub::coap_header->options_list_ptr->observe_ptr) {
        free(common_stub::coap_header->options_list_ptr->observe_ptr);
        common_stub::coap_header->options_list_ptr->observe_ptr = NULL;
    }
    if(common_stub::coap_header->options_list_ptr->max_age_ptr) {
        free(common_stub::coap_header->options_list_ptr->max_age_ptr);
        common_stub::coap_header->options_list_ptr->max_age_ptr = NULL;
    }
    if(common_stub::coap_header->options_list_ptr) {
        free(common_stub::coap_header->options_list_ptr);
        common_stub::coap_header->options_list_ptr = NULL;
    }

    // Not observable
    m2mbase_stub::bool_value = false;
    CHECK(resource_instance->handle_get_request(NULL,coap_header,handler) != NULL);

    if(common_stub::coap_header->content_type_ptr) {
        free(common_stub::coap_header->content_type_ptr);
        common_stub::coap_header->content_type_ptr = NULL;
    }
    if(common_stub::coap_header->options_list_ptr->observe_ptr) {
        free(common_stub::coap_header->options_list_ptr->observe_ptr);
        common_stub::coap_header->options_list_ptr->observe_ptr = NULL;
    }
    if(common_stub::coap_header->options_list_ptr->max_age_ptr) {
        free(common_stub::coap_header->options_list_ptr->max_age_ptr);
        common_stub::coap_header->options_list_ptr->max_age_ptr = NULL;
    }
    if(common_stub::coap_header->options_list_ptr) {
        free(common_stub::coap_header->options_list_ptr);
        common_stub::coap_header->options_list_ptr = NULL;
    }

    m2mbase_stub::bool_value = true;

    coap_header->options_list_ptr->observe_len = 1;

    CHECK(resource_instance->handle_get_request(NULL,coap_header,handler) != NULL);

    if(common_stub::coap_header->content_type_ptr) {
        free(common_stub::coap_header->content_type_ptr);
        common_stub::coap_header->content_type_ptr = NULL;
    }

    if(common_stub::coap_header->options_list_ptr->observe_ptr) {
        free(common_stub::coap_header->options_list_ptr->observe_ptr);
        common_stub::coap_header->options_list_ptr->observe_ptr = NULL;
    }
    if(common_stub::coap_header->options_list_ptr->max_age_ptr) {
        free(common_stub::coap_header->options_list_ptr->max_age_ptr);
        common_stub::coap_header->options_list_ptr->max_age_ptr = NULL;
    }
    if(common_stub::coap_header->options_list_ptr) {
        free(common_stub::coap_header->options_list_ptr);
        common_stub::coap_header->options_list_ptr = NULL;
    }


    obs = 1;
    memcpy(coap_header->options_list_ptr->observe_ptr,&obs,sizeof(obs));
    CHECK(resource_instance->handle_get_request(NULL,coap_header,handler) != NULL);

    if(common_stub::coap_header->content_type_ptr) {
        free(common_stub::coap_header->content_type_ptr);
        common_stub::coap_header->content_type_ptr = NULL;
    }

    if(common_stub::coap_header->options_list_ptr->observe_ptr) {
        free(common_stub::coap_header->options_list_ptr->observe_ptr);
        common_stub::coap_header->options_list_ptr->observe_ptr = NULL;
    }
    if(common_stub::coap_header->options_list_ptr->max_age_ptr) {
        free(common_stub::coap_header->options_list_ptr->max_age_ptr);
        common_stub::coap_header->options_list_ptr->max_age_ptr = NULL;
    }
    if(common_stub::coap_header->options_list_ptr) {
        free(common_stub::coap_header->options_list_ptr);
        common_stub::coap_header->options_list_ptr = NULL;
    }

    m2mbase_stub::operation = M2MBase::NOT_ALLOWED;
    CHECK(resource_instance->handle_get_request(NULL,coap_header,handler) != NULL);

    CHECK(resource_instance->handle_get_request(NULL,NULL,handler) != NULL);

    if(coap_header->token_ptr) {
        free(coap_header->token_ptr);
        coap_header->token_ptr = NULL;
    }
    if(coap_header->content_type_ptr) {
        free(coap_header->content_type_ptr);
        coap_header->content_type_ptr = NULL;
    }
    if(coap_header->options_list_ptr->observe_ptr) {
        free(coap_header->options_list_ptr->observe_ptr);
        coap_header->options_list_ptr->observe_ptr = NULL;
    }
    if(coap_header->options_list_ptr) {
        free(coap_header->options_list_ptr);
        coap_header->options_list_ptr = NULL;
    }

    if(common_stub::coap_header){
        if(common_stub::coap_header->content_type_ptr) {
            free(common_stub::coap_header->content_type_ptr);
            common_stub::coap_header->content_type_ptr = NULL;
        }
        if(common_stub::coap_header->options_list_ptr) {
            free(common_stub::coap_header->options_list_ptr);
            common_stub::coap_header->options_list_ptr = NULL;
        }
        free(common_stub::coap_header);
        common_stub::coap_header = NULL;
    }
    free(coap_header);
    coap_header = NULL;

    delete name;
    name = NULL;

    m2mbase_stub::clear();
    common_stub::clear();
}
Exemple #15
0
// Split from the basic MakePet to allow backward compatiblity with existing code while also
// making it possible for petpower to be retained without the focus item having to
// stay equipped when the character zones. petpower of -1 means that the currently equipped petfocus
// of a client is searched for and used instead.
void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower,
		const char *petname, float in_size) {
	// Sanity and early out checking first.
	if(HasPet() || pettype == nullptr)
		return;

	int16 act_power = 0; // The actual pet power we'll use.
	if (petpower == -1) {
		if (this->IsClient()) {
			act_power = CastToClient()->GetFocusEffect(focusPetPower, spell_id);//Client only
			act_power = CastToClient()->mod_pet_power(act_power, spell_id);
		}
#ifdef BOTS
		else if (this->IsBot())
			act_power = CastToBot()->GetBotFocusEffect(Bot::BotfocusPetPower, spell_id);
#endif
	}
	else if (petpower > 0)
		act_power = petpower;

	// optional rule: classic style variance in pets. Achieve this by
	// adding a random 0-4 to pet power, since it only comes in increments
	// of five from focus effects.

	//lookup our pets table record for this type
	PetRecord record;
	if(!database.GetPoweredPetEntry(pettype, act_power, &record)) {
		Message(13, "Unable to find data for pet %s", pettype);
		Log.Out(Logs::General, Logs::Error, "Unable to find data for pet %s, check pets table.", pettype);
		return;
	}

	//find the NPC data for the specified NPC type
	const NPCType *base = database.LoadNPCTypesData(record.npc_type);
	if(base == nullptr) {
		Message(13, "Unable to load NPC data for pet %s", pettype);
		Log.Out(Logs::General, Logs::Error, "Unable to load NPC data for pet %s (NPC ID %d), check pets and npc_types tables.", pettype, record.npc_type);
		return;
	}

	//we copy the npc_type data because we need to edit it a bit
	NPCType *npc_type = new NPCType;
	memcpy(npc_type, base, sizeof(NPCType));

	// If pet power is set to -1 in the DB, use stat scaling
	if ((this->IsClient() 
#ifdef BOTS
		|| this->IsBot()
#endif
		) && record.petpower == -1)
	{
		float scale_power = (float)act_power / 100.0f;
		if(scale_power > 0)
		{
			npc_type->max_hp *= (1 + scale_power);
			npc_type->cur_hp = npc_type->max_hp;
			npc_type->AC *= (1 + scale_power);
			npc_type->level += 1 + ((int)act_power / 25) > npc_type->level + RuleR(Pets, PetPowerLevelCap) ? RuleR(Pets, PetPowerLevelCap) : 1 + ((int)act_power / 25); // gains an additional level for every 25 pet power
			npc_type->min_dmg = (npc_type->min_dmg * (1 + (scale_power / 2)));
			npc_type->max_dmg = (npc_type->max_dmg * (1 + (scale_power / 2)));
			npc_type->size = npc_type->size * (1 + (scale_power / 2)) > npc_type->size * 3 ? npc_type->size * 3 : (1 + (scale_power / 2));
		}
		record.petpower = act_power;
	}

	//Live AA - Elemental Durability
	int16 MaxHP = aabonuses.PetMaxHP + itembonuses.PetMaxHP + spellbonuses.PetMaxHP;

	if (MaxHP){
		npc_type->max_hp += (npc_type->max_hp*MaxHP)/100;
		npc_type->cur_hp = npc_type->max_hp;
	}

	//TODO: think about regen (engaged vs. not engaged)

	// Pet naming:
	// 0 - `s pet
	// 1 - `s familiar
	// 2 - `s Warder
	// 3 - Random name if client, `s pet for others
	// 4 - Keep DB name


	if (petname != nullptr) {
		// Name was provided, use it.
		strn0cpy(npc_type->name, petname, 64);
	} else if (record.petnaming == 0) {
		strcpy(npc_type->name, this->GetCleanName());
		npc_type->name[25] = '\0';
		strcat(npc_type->name, "`s_pet");
	} else if (record.petnaming == 1) {
		strcpy(npc_type->name, this->GetName());
		npc_type->name[19] = '\0';
		strcat(npc_type->name, "`s_familiar");
	} else if (record.petnaming == 2) {
		strcpy(npc_type->name, this->GetName());
		npc_type->name[21] = 0;
		strcat(npc_type->name, "`s_Warder");
	} else if (record.petnaming == 4) {
		// Keep the DB name
	} else if (record.petnaming == 3 && IsClient()) {
		strcpy(npc_type->name, GetRandPetName());
	} else {
		strcpy(npc_type->name, this->GetCleanName());
		npc_type->name[25] = '\0';
		strcat(npc_type->name, "`s_pet");
	}

	//handle beastlord pet appearance
	if(record.petnaming == 2)
	{
		switch(GetBaseRace())
		{
		case VAHSHIR:
			npc_type->race = TIGER;
			npc_type->size *= 0.8f;
			break;
		case TROLL:
			npc_type->race = ALLIGATOR;
			npc_type->size *= 2.5f;
			break;
		case OGRE:
			npc_type->race = BEAR;
			npc_type->texture = 3;
			npc_type->gender = 2;
			break;
		case BARBARIAN:
			npc_type->race = WOLF;
			npc_type->texture = 2;
			break;
		case IKSAR:
			npc_type->race = WOLF;
			npc_type->texture = 0;
			npc_type->gender = 1;
			npc_type->size *= 2.0f;
			npc_type->luclinface = 0;
			break;
		default:
			npc_type->race = WOLF;
			npc_type->texture = 0;
		}
	}

	// handle monster summoning pet appearance
	if(record.monsterflag) {

		uint32 monsterid = 0;

		// get a random npc id from the spawngroups assigned to this zone
		auto query = StringFormat("SELECT npcID "
									"FROM (spawnentry INNER JOIN spawn2 ON spawn2.spawngroupID = spawnentry.spawngroupID) "
									"INNER JOIN npc_types ON npc_types.id = spawnentry.npcID "
									"WHERE spawn2.zone = '%s' AND npc_types.bodytype NOT IN (11, 33, 66, 67) "
									"AND npc_types.race NOT IN (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 44, "
									"55, 67, 71, 72, 73, 77, 78, 81, 90, 92, 93, 94, 106, 112, 114, 127, 128, "
									"130, 139, 141, 183, 236, 237, 238, 239, 254, 266, 329, 330, 378, 379, "
									"380, 381, 382, 383, 404, 522) "
									"ORDER BY RAND() LIMIT 1", zone->GetShortName());
		auto results = database.QueryDatabase(query);
		if (!results.Success()) {
			return;
		}

		if (results.RowCount() != 0) {
			auto row = results.begin();
			monsterid = atoi(row[0]);
		}

		// since we don't have any monsters, just make it look like an earth pet for now
		if (monsterid == 0)
			monsterid = 567;

		// give the summoned pet the attributes of the monster we found
		const NPCType* monster = database.LoadNPCTypesData(monsterid);
		if(monster) {
			npc_type->race = monster->race;
			npc_type->size = monster->size;
			npc_type->texture = monster->texture;
			npc_type->gender = monster->gender;
			npc_type->luclinface = monster->luclinface;
			npc_type->helmtexture = monster->helmtexture;
			npc_type->herosforgemodel = monster->herosforgemodel;
		} else
			Log.Out(Logs::General, Logs::Error, "Error loading NPC data for monster summoning pet (NPC ID %d)", monsterid);

	}

	//this takes ownership of the npc_type data
	Pet *npc = new Pet(npc_type, this, (PetType)record.petcontrol, spell_id, record.petpower);

	// Now that we have an actual object to interact with, load
	// the base items for the pet. These are always loaded
	// so that a rank 1 suspend minion does not kill things
	// like the special back items some focused pets may receive.
	uint32 petinv[EmuConstants::EQUIPMENT_SIZE];
	memset(petinv, 0, sizeof(petinv));
	const Item_Struct *item = 0;

	if (database.GetBasePetItems(record.equipmentset, petinv)) {
		for (int i = 0; i<EmuConstants::EQUIPMENT_SIZE; i++)
			if (petinv[i]) {
				item = database.GetItem(petinv[i]);
				npc->AddLootDrop(item, &npc->itemlist, 0, 1, 127, true, true);
			}
	}

	npc->UpdateEquipmentLight();

	// finally, override size if one was provided
	if (in_size > 0.0f)
		npc->size = in_size;

	entity_list.AddNPC(npc, true, true);
	SetPetID(npc->GetID());
	// We need to handle PetType 5 (petHatelist), add the current target to the hatelist of the pet


	if (record.petcontrol == petTargetLock)
	{
		Mob* target = GetTarget();

		if (target){
			npc->AddToHateList(target, 1);
			npc->SetPetTargetLockID(target->GetID());
			npc->SetSpecialAbility(IMMUNE_AGGRO, 1);
		}
		else
			npc->Kill(); //On live casts spell 892 Unsummon (Kayen - Too limiting to use that for emu since pet can have more than 20k HP)
	}
}
Exemple #16
0
static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
			   int offset)
{
	int ret = 0;
	size_t clen;
	unsigned long handle;
	struct page *page;
	unsigned char *user_mem, *cmem, *src, *uncmem = NULL;
	struct zram_meta *meta = zram->meta;

	page = bvec->bv_page;
	src = meta->compress_buffer;

	if (is_partial_io(bvec)) {
		/*
		 * This is a partial IO. We need to read the full page
		 * before to write the changes.
		 */
		uncmem = kmalloc(PAGE_SIZE, GFP_NOIO);
		if (!uncmem) {
			ret = -ENOMEM;
			goto out;
		}
		ret = zram_decompress_page(zram, uncmem, index);
		if (ret)
			goto out;
	}

	/*
	 * System overwrites unused sectors. Free memory associated
	 * with this sector now.
	 */
	if (meta->table[index].handle ||
	    zram_test_flag(meta, index, ZRAM_ZERO))
		zram_free_page(zram, index);

	user_mem = kmap_atomic(page);

	if (is_partial_io(bvec)) {
		memcpy(uncmem + offset, user_mem + bvec->bv_offset,
		       bvec->bv_len);
		kunmap_atomic(user_mem);
		user_mem = NULL;
	} else {
		uncmem = user_mem;
	}

	if (page_zero_filled(uncmem)) {
		kunmap_atomic(user_mem);
		zram->stats.pages_zero++;
		zram_set_flag(meta, index, ZRAM_ZERO);
		ret = 0;
		goto out;
	}

	ret = lzo1x_1_compress(uncmem, PAGE_SIZE, src, &clen,
			       meta->compress_workmem);

	if (!is_partial_io(bvec)) {
		kunmap_atomic(user_mem);
		user_mem = NULL;
		uncmem = NULL;
	}

	if (unlikely(ret != LZO_E_OK)) {
		pr_err("Compression failed! err=%d\n", ret);
		goto out;
	}

	if (unlikely(clen > max_zpage_size)) {
		zram->stats.bad_compress++;
		clen = PAGE_SIZE;
		src = NULL;
		if (is_partial_io(bvec))
			src = uncmem;
	}

	handle = zs_malloc(meta->mem_pool, clen);
	if (!handle) {
		pr_info("Error allocating memory for compressed "
			"page: %u, size=%zu\n", index, clen);
		ret = -ENOMEM;
		goto out;
	}
	cmem = zs_map_object(meta->mem_pool, handle, ZS_MM_WO);

	if ((clen == PAGE_SIZE) && !is_partial_io(bvec)) {
		src = kmap_atomic(page);
		copy_page(cmem, src);
		kunmap_atomic(src);
	} else {
		memcpy(cmem, src, clen);
	}

	zs_unmap_object(meta->mem_pool, handle);

	meta->table[index].handle = handle;
	meta->table[index].size = clen;

	/* Update stats */
	zram_stat64_add(zram, &zram->stats.compr_size, clen);
	zram->stats.pages_stored++;
	if (clen <= PAGE_SIZE / 2)
		zram->stats.good_compress++;

out:
	if (is_partial_io(bvec))
		kfree(uncmem);

	if (ret)
		zram_stat64_inc(zram, &zram->stats.failed_writes);
	return ret;
}
Exemple #17
0
static int __init fpe_setup(char *line)
{
	memcpy(fpe_type, line, 8);
	return 1;
}
Exemple #18
0
/////////////////////////////////////
// Name:	LightSetDat
// Purpose:	set the light data
// Output:	light data set
// Return:	none
/////////////////////////////////////
void F_API LightSetDat(hLIGHT l, const gfxLight *lightDat)
{
	memcpy(&l->lDat, lightDat, sizeof(gfxLight));
}
CAInterface_t *CAFindInterfaceChange()
{
    char buf[MAX_INTERFACE_INFO_LENGTH] = { 0 };
    struct ifconf ifc  = { .ifc_len = MAX_INTERFACE_INFO_LENGTH, .ifc_buf = buf };

    int s = caglobals.ip.u6.fd != -1 ? caglobals.ip.u6.fd : caglobals.ip.u4.fd;
    if (ioctl(s, SIOCGIFCONF, &ifc) < 0)
    {
        OIC_LOG_V(ERROR, TAG, "SIOCGIFCONF failed: %s", strerror(errno));
        return NULL;
    }

    CAInterface_t *foundNewInterface = NULL;

    struct ifreq* ifr = ifc.ifc_req;
    size_t interfaces = ifc.ifc_len / sizeof (ifc.ifc_req[0]);
    size_t ifreqsize = ifc.ifc_len;

    CAIfItem_t *previous = (CAIfItem_t *)OICMalloc(ifreqsize);
    if (!previous)
    {
        OIC_LOG(ERROR, TAG, "OICMalloc failed");
        return NULL;
    }

    memcpy(previous, caglobals.ip.nm.ifItems, ifreqsize);
    size_t numprevious = caglobals.ip.nm.numIfItems;

    if (ifreqsize > caglobals.ip.nm.sizeIfItems)
    {

        CAIfItem_t *items = (CAIfItem_t *)OICRealloc(caglobals.ip.nm.ifItems, ifreqsize);
        if (!items)
        {
            OIC_LOG(ERROR, TAG, "OICRealloc failed");
            OICFree(previous);
            return NULL;
        }
        caglobals.ip.nm.ifItems = items;
        caglobals.ip.nm.sizeIfItems = ifreqsize;
    }

    caglobals.ip.nm.numIfItems = 0;
    for (size_t i = 0; i < interfaces; i++)
    {
        struct ifreq* item = &ifr[i];
        char *name = item->ifr_name;
        struct sockaddr_in *sa4 = (struct sockaddr_in *)&item->ifr_addr;
        uint32_t ipv4addr = sa4->sin_addr.s_addr;

        if (ioctl(s, SIOCGIFFLAGS, item) < 0)
        {
            OIC_LOG_V(ERROR, TAG, "SIOCGIFFLAGS failed: %s", strerror(errno));
            continue;
        }
        int16_t flags = item->ifr_flags;
        if ((flags & IFF_LOOPBACK) || !(flags & IFF_RUNNING))
        {
            continue;
        }
        if (ioctl(s, SIOCGIFINDEX, item) < 0)
        {
            OIC_LOG_V(ERROR, TAG, "SIOCGIFINDEX failed: %s", strerror(errno));
            continue;
        }

        int ifIndex = item->ifr_ifindex;
        caglobals.ip.nm.ifItems[i].ifIndex = ifIndex;  // refill interface list
        caglobals.ip.nm.numIfItems++;

        if (foundNewInterface)
        {
            continue;   // continue updating interface list
        }

        // see if this interface didn't previously exist
        bool found = false;
        for (size_t j = 0; j < numprevious; j++)
        {
            if (ifIndex == previous[j].ifIndex)
            {
                found = true;
                break;
            }
        }
        if (found)
        {
            OIC_LOG_V(INFO, TAG, "Interface found: %s", name);
            continue;
        }

        foundNewInterface = CANewInterfaceItem(ifIndex, name, AF_INET, ipv4addr, flags);
    }

    OICFree(previous);
    return foundNewInterface;
}
HullError HullLibrary::CreateConvexHull(const HullDesc       &desc,           // describes the input request
																					HullResult           &result)         // contains the resulst
{
	HullError ret = QE_FAIL;


	PHullResult hr;

	unsigned int vcount = desc.mVcount;
	if ( vcount < 8 ) vcount = 8;

	btAlignedObjectArray<btVector3> vertexSource;
	vertexSource.resize(static_cast<int>(vcount));

	btVector3 scale;

	unsigned int ovcount;

	bool ok = CleanupVertices(desc.mVcount,desc.mVertices, ovcount, &vertexSource[0], desc.mNormalEpsilon, scale ); // normalize point cloud, remove duplicates!

	if ( ok )
	{


//		if ( 1 ) // scale vertices back to their original size.
		{
			for (unsigned int i=0; i<ovcount; i++)
			{
				btVector3& v = vertexSource[static_cast<int>(i)];
				v[0]*=scale[0];
				v[1]*=scale[1];
				v[2]*=scale[2];
			}
		}

		ok = ComputeHull(ovcount,&vertexSource[0],hr,desc.mMaxVertices);

		if ( ok )
		{

			// re-index triangle mesh so it refers to only used vertices, rebuild a new vertex table.
			btAlignedObjectArray<btVector3>	vertexScratch;
			vertexScratch.resize(static_cast<int>(hr.mVcount));

			BringOutYourDead(hr.mVertices,hr.mVcount, &vertexScratch[0], ovcount, &hr.m_Indices[0], hr.mIndexCount );

			ret = QE_OK;

			if ( desc.HasHullFlag(QF_TRIANGLES) ) // if he wants the results as triangle!
			{
				result.mPolygons          = false;
				result.mNumOutputVertices = ovcount;
				result.m_OutputVertices.resize(static_cast<int>(ovcount));
				result.mNumFaces          = hr.mFaceCount;
				result.mNumIndices        = hr.mIndexCount;

				result.m_Indices.resize(static_cast<int>(hr.mIndexCount));

				memcpy(&result.m_OutputVertices[0], &vertexScratch[0], sizeof(btVector3)*ovcount );

  			if ( desc.HasHullFlag(QF_REVERSE_ORDER) )
				{

					const unsigned int *source = &hr.m_Indices[0];
					unsigned int *dest   = &result.m_Indices[0];

					for (unsigned int i=0; i<hr.mFaceCount; i++)
					{
						dest[0] = source[2];
						dest[1] = source[1];
						dest[2] = source[0];
						dest+=3;
						source+=3;
					}

				}
				else
				{
					memcpy(&result.m_Indices[0], &hr.m_Indices[0], sizeof(unsigned int)*hr.mIndexCount);
				}
			}
			else
			{
				result.mPolygons          = true;
				result.mNumOutputVertices = ovcount;
				result.m_OutputVertices.resize(static_cast<int>(ovcount));
				result.mNumFaces          = hr.mFaceCount;
				result.mNumIndices        = hr.mIndexCount+hr.mFaceCount;
				result.m_Indices.resize(static_cast<int>(result.mNumIndices));
				memcpy(&result.m_OutputVertices[0], &vertexScratch[0], sizeof(btVector3)*ovcount );

//				if ( 1 )
				{
					const unsigned int *source = &hr.m_Indices[0];
					unsigned int *dest   = &result.m_Indices[0];
					for (unsigned int i=0; i<hr.mFaceCount; i++)
					{
						dest[0] = 3;
						if ( desc.HasHullFlag(QF_REVERSE_ORDER) )
						{
							dest[1] = source[2];
							dest[2] = source[1];
							dest[3] = source[0];
						}
						else
						{
							dest[1] = source[0];
							dest[2] = source[1];
							dest[3] = source[2];
						}

						dest+=4;
						source+=3;
					}
				}
			}
			ReleaseHull(hr);
		}
	}

	return ret;
}
Exemple #21
0
void *memmove (void *dest, const void *src, size_t len)
{
  unsigned long int dstp = (long int) dest;
  unsigned long int srcp = (long int) src;

  /* This test makes the forward copying code be used whenever possible.
     Reduces the working set.  */
  if (dstp - srcp >= len)	/* *Unsigned* compare!  */
    {
#if 1
#warning REMINDER: generic-opt memmove assumes memcpy does forward copying!
      memcpy(dest, src, len);
#else
      /* Copy from the beginning to the end.  */

      /* If there not too few bytes to copy, use word copy.  */
      if (len >= OP_T_THRES)
	{
	  /* Copy just a few bytes to make DSTP aligned.  */
	  len -= (-dstp) % OPSIZ;
	  BYTE_COPY_FWD (dstp, srcp, (-dstp) % OPSIZ);

	  /* Copy whole pages from SRCP to DSTP by virtual address
	     manipulation, as much as possible.  */

	  PAGE_COPY_FWD_MAYBE (dstp, srcp, len, len);

	  /* Copy from SRCP to DSTP taking advantage of the known
	     alignment of DSTP.  Number of bytes remaining is put
	     in the third argument, i.e. in LEN.  This number may
	     vary from machine to machine.  */

	  WORD_COPY_FWD (dstp, srcp, len, len);

	  /* Fall out and copy the tail.  */
	}

      /* There are just a few bytes to copy.  Use byte memory operations.  */
      BYTE_COPY_FWD (dstp, srcp, len);
#endif
    }
  else
    {
      /* Copy from the end to the beginning.  */
      srcp += len;
      dstp += len;

      /* If there not too few bytes to copy, use word copy.  */
      if (len >= OP_T_THRES)
	{
	  /* Copy just a few bytes to make DSTP aligned.  */
	  len -= dstp % OPSIZ;
	  BYTE_COPY_BWD (dstp, srcp, dstp % OPSIZ);

	  /* Copy from SRCP to DSTP taking advantage of the known
	     alignment of DSTP.  Number of bytes remaining is put
	     in the third argument, i.e. in LEN.  This number may
	     vary from machine to machine.  */

	  WORD_COPY_BWD (dstp, srcp, len, len);

	  /* Fall out and copy the tail.  */
	}

      /* There are just a few bytes to copy.  Use byte memory operations.  */
      BYTE_COPY_BWD (dstp, srcp, len);
    }

  return (dest);
}
Exemple #22
0
static int
aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
{
	EVP_AES_GCM_CTX *gctx = c->cipher_data;

	switch (type) {
	case EVP_CTRL_INIT:
		gctx->key_set = 0;
		gctx->iv_set = 0;
		gctx->ivlen = c->cipher->iv_len;
		gctx->iv = c->iv;
		gctx->taglen = -1;
		gctx->iv_gen = 0;
		gctx->tls_aad_len = -1;
		return 1;

	case EVP_CTRL_GCM_SET_IVLEN:
		if (arg <= 0)
			return 0;
		/* Allocate memory for IV if needed */
		if ((arg > EVP_MAX_IV_LENGTH) && (arg > gctx->ivlen)) {
			if (gctx->iv != c->iv)
				free(gctx->iv);
			gctx->iv = malloc(arg);
			if (!gctx->iv)
				return 0;
		}
		gctx->ivlen = arg;
		return 1;

	case EVP_CTRL_GCM_SET_TAG:
		if (arg <= 0 || arg > 16 || c->encrypt)
			return 0;
		memcpy(c->buf, ptr, arg);
		gctx->taglen = arg;
		return 1;

	case EVP_CTRL_GCM_GET_TAG:
		if (arg <= 0 || arg > 16 || !c->encrypt || gctx->taglen < 0)
			return 0;
		memcpy(ptr, c->buf, arg);
		return 1;

	case EVP_CTRL_GCM_SET_IV_FIXED:
		/* Special case: -1 length restores whole IV */
		if (arg == -1) {
			memcpy(gctx->iv, ptr, gctx->ivlen);
			gctx->iv_gen = 1;
			return 1;
		}
		/* Fixed field must be at least 4 bytes and invocation field
		 * at least 8.
		 */
		if ((arg < 4) || (gctx->ivlen - arg) < 8)
			return 0;
		if (arg)
			memcpy(gctx->iv, ptr, arg);
		if (c->encrypt &&
		    RAND_bytes(gctx->iv + arg, gctx->ivlen - arg) <= 0)
			return 0;
		gctx->iv_gen = 1;
		return 1;

	case EVP_CTRL_GCM_IV_GEN:
		if (gctx->iv_gen == 0 || gctx->key_set == 0)
			return 0;
		CRYPTO_gcm128_setiv(&gctx->gcm, gctx->iv, gctx->ivlen);
		if (arg <= 0 || arg > gctx->ivlen)
			arg = gctx->ivlen;
		memcpy(ptr, gctx->iv + gctx->ivlen - arg, arg);
		/* Invocation field will be at least 8 bytes in size and
		 * so no need to check wrap around or increment more than
		 * last 8 bytes.
		 */
		ctr64_inc(gctx->iv + gctx->ivlen - 8);
		gctx->iv_set = 1;
		return 1;

	case EVP_CTRL_GCM_SET_IV_INV:
		if (gctx->iv_gen == 0 || gctx->key_set == 0 || c->encrypt)
			return 0;
		memcpy(gctx->iv + gctx->ivlen - arg, ptr, arg);
		CRYPTO_gcm128_setiv(&gctx->gcm, gctx->iv, gctx->ivlen);
		gctx->iv_set = 1;
		return 1;

	case EVP_CTRL_AEAD_TLS1_AAD:
		/* Save the AAD for later use */
		if (arg != 13)
			return 0;
		memcpy(c->buf, ptr, arg);
		gctx->tls_aad_len = arg;
		{
			unsigned int len = c->buf[arg - 2] << 8 |
			    c->buf[arg - 1];

			/* Correct length for explicit IV */
			len -= EVP_GCM_TLS_EXPLICIT_IV_LEN;

			/* If decrypting correct for tag too */
			if (!c->encrypt)
				len -= EVP_GCM_TLS_TAG_LEN;
			c->buf[arg - 2] = len >> 8;
			c->buf[arg - 1] = len & 0xff;
		}
		/* Extra padding: tag appended to record */
		return EVP_GCM_TLS_TAG_LEN;

	default:
		return -1;

	}
}
Exemple #23
0
static int init( hnd_t *handle, cli_vid_filter_t *filter, video_info_t *info, x264_param_t *param, char *opt_string )
{
    selvry_hnd_t *h = malloc( sizeof(selvry_hnd_t) );
    if( !h )
        return -1;
    h->pattern_len = 0;
    h->step_size = 0;
    int offsets[MAX_PATTERN_SIZE];
    for( char *tok, *p = opt_string; (tok = strtok( p, "," )); p = NULL )
    {
        int val = x264_otoi( tok, -1 );
        if( p )
        {
            FAIL_IF_ERROR( val <= 0, "invalid step `%s'\n", tok );
            h->step_size = val;
            continue;
        }
        FAIL_IF_ERROR( val < 0 || val >= h->step_size, "invalid offset `%s'\n", tok );
        FAIL_IF_ERROR( h->pattern_len >= MAX_PATTERN_SIZE, "max pattern size %d reached\n", MAX_PATTERN_SIZE );
        offsets[h->pattern_len++] = val;
    }
    FAIL_IF_ERROR( !h->step_size, "no step size provided\n" );
    FAIL_IF_ERROR( !h->pattern_len, "no offsets supplied\n" );

    h->pattern = malloc( h->pattern_len * sizeof(int) );
    if( !h->pattern )
        return -1;
    memcpy( h->pattern, offsets, h->pattern_len * sizeof(int) );

    /* determine required cache size to maintain pattern. */
    intptr_t max_rewind = 0;
    int min = h->step_size;
    for( int i = h->pattern_len-1; i >= 0; i-- )
    {
         min = X264_MIN( min, offsets[i] );
         if( i )
             max_rewind = X264_MAX( max_rewind, offsets[i-1] - min + 1 );
         /* reached maximum rewind size */
         if( max_rewind == h->step_size )
             break;
    }
    char name[20];
    sprintf( name, "cache_%d", param->i_bitdepth );
    if( x264_init_vid_filter( name, handle, filter, info, param, (void*)max_rewind ) )
        return -1;

    /* done initing, overwrite properties */
    if( h->step_size != h->pattern_len )
    {
        info->num_frames = (uint64_t)info->num_frames * h->pattern_len / h->step_size;
        info->fps_den *= h->step_size;
        info->fps_num *= h->pattern_len;
        x264_reduce_fraction( &info->fps_num, &info->fps_den );
        if( info->vfr )
        {
            info->timebase_den *= h->pattern_len;
            info->timebase_num *= h->step_size;
            x264_reduce_fraction( &info->timebase_num, &info->timebase_den );
        }
    }

    h->pts = 0;
    h->vfr = info->vfr;
    h->prev_filter = *filter;
    h->prev_hnd = *handle;
    *filter = select_every_filter;
    *handle = h;

    return 0;
}
Exemple #24
0
int ifconf_acquire_addresses(struct address **_list, unsigned *_n_list) {

    struct {
        struct nlmsghdr hdr;
        struct rtgenmsg gen;
    } req;
    struct rtgenmsg *gen;
    int fd, r, on = 1;
    uint32_t seq = 4711;
    struct address *list = NULL;
    unsigned n_list = 0;

    fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);
    if (fd < 0)
        return -errno;

    if (setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)) < 0) {
        r = -errno;
        goto finish;
    }

    memset(&req, 0, sizeof(req));
    req.hdr.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtgenmsg));
    req.hdr.nlmsg_type = RTM_GETADDR;
    req.hdr.nlmsg_flags = NLM_F_REQUEST|NLM_F_DUMP|NLM_F_ACK;
    req.hdr.nlmsg_seq = seq;
    req.hdr.nlmsg_pid = 0;

    gen = NLMSG_DATA(&req.hdr);
    gen->rtgen_family = AF_UNSPEC;

    if (send(fd, &req, req.hdr.nlmsg_len, 0) < 0) {
        r = -errno;
        goto finish;
    }

    for (;;) {
        ssize_t bytes;
        struct msghdr msg;
        struct cmsghdr *cmsg;
        struct ucred *ucred;
        struct iovec iov;
        struct nlmsghdr *p;
        uint8_t cred_buffer[CMSG_SPACE(sizeof(struct ucred))];
        struct {
            struct nlmsghdr hdr;
            struct ifaddrmsg ifaddrmsg;
            uint8_t payload[16*1024];
        } resp;

        memset(&iov, 0, sizeof(iov));
        iov.iov_base = &resp;
        iov.iov_len = sizeof(resp);

        memset(&msg, 0, sizeof(msg));
        msg.msg_name = NULL;
        msg.msg_namelen = 0;
        msg.msg_iov = &iov;
        msg.msg_iovlen = 1;
        msg.msg_control = cred_buffer;
        msg.msg_controllen = sizeof(cred_buffer);
        msg.msg_flags = 0;

        bytes = recvmsg(fd, &msg, 0);
        if (bytes < 0) {
            r = -errno;
            goto finish;
        }

        cmsg = CMSG_FIRSTHDR(&msg);
        if (!cmsg || cmsg->cmsg_type != SCM_CREDENTIALS) {
            r = -EIO;
            goto finish;
        }

        ucred = (struct ucred*) CMSG_DATA(cmsg);
        if (ucred->uid != 0 || ucred->pid != 0)
            continue;

        for (p = &resp.hdr; bytes > 0; p = NLMSG_NEXT(p, bytes)) {
            struct ifaddrmsg *ifaddrmsg;
            struct rtattr *a;
            size_t l;
            void *local = NULL, *address = NULL;

            if (!NLMSG_OK(p, (size_t) bytes)) {
                r = -EIO;
                goto finish;
            }

            if (p->nlmsg_seq != seq)
                continue;

            if (p->nlmsg_type == NLMSG_DONE) {
                r = 0;
                goto finish;
            }

            if (p->nlmsg_type == NLMSG_ERROR) {
                struct nlmsgerr *nlmsgerr;

                nlmsgerr = NLMSG_DATA(p);
                r = -nlmsgerr->error;
                goto finish;
            }

            if (p->nlmsg_type != RTM_NEWADDR)
                continue;

            ifaddrmsg = NLMSG_DATA(p);

            if (ifaddrmsg->ifa_family != AF_INET &&
                    ifaddrmsg->ifa_family != AF_INET6)
                continue;

            if (ifaddrmsg->ifa_scope == RT_SCOPE_HOST ||
                    ifaddrmsg->ifa_scope == RT_SCOPE_NOWHERE)
                continue;

            if (ifaddrmsg->ifa_flags & IFA_F_DEPRECATED)
                continue;

            l = NLMSG_PAYLOAD(p, sizeof(struct ifaddrmsg));
            a = IFA_RTA(ifaddrmsg);

            while (RTA_OK(a, l)) {

                if (a->rta_type == IFA_ADDRESS)
                    address = RTA_DATA(a);
                else if (a->rta_type == IFA_LOCAL)
                    local = RTA_DATA(a);

                a = RTA_NEXT(a, l);
            }

            if (local)
                address = local;

            if (!address)
                continue;

            // Avoid link-local address
            // http://bugs.debian.org/705900
            if (ifaddrmsg->ifa_family == AF_INET6 &&
                    IN6_IS_ADDR_LINKLOCAL((const struct in6_addr *)address))
                continue;

            list = realloc(list, (n_list+1) * sizeof(struct address));
            if (!list) {
                r = -ENOMEM;
                goto finish;
            }

            list[n_list].family = ifaddrmsg->ifa_family;
            list[n_list].scope = ifaddrmsg->ifa_scope;
            memcpy(list[n_list].address, address, ifaddrmsg->ifa_family == AF_INET ? 4 : 16);
            list[n_list].ifindex = ifaddrmsg->ifa_index;

            n_list++;
        }
    }

finish:
    close(fd);

    if (r < 0)
        free(list);
    else {
        qsort(list, n_list, sizeof(struct address), address_compare);

        *_list = list;
        *_n_list = n_list;
    }

    return r;
}
Exemple #25
0
SkCodec::Result SkScaledCodec::onGetPixels(const SkImageInfo& requestedInfo, void* dst,
                                           size_t rowBytes, const Options& options,
                                           SkPMColor ctable[], int* ctableCount) {

    if (options.fSubset) {
        // Subsets are not supported.
        return kUnimplemented;
    } 

    Result result = fScanlineDecoder->start(requestedInfo, &options, ctable, ctableCount);
    if (kSuccess == result) {
        // native decode supported
        return fScanlineDecoder->getScanlines(dst, requestedInfo.height(), rowBytes);

    }

    if (kInvalidScale != result) {
        // no scaling requested
        return result;
    }
    
    // scaling requested
    int sampleX;
    int sampleY;
    if (!scaling_supported(requestedInfo, fScanlineDecoder->getInfo(), &sampleX, &sampleY)) {
        return kInvalidScale;
    }
    // set first sample pixel in y direction
    int Y0 = sampleY >> 1;

    int dstHeight = requestedInfo.height();
    int srcHeight = fScanlineDecoder->getInfo().height();
    
    SkImageInfo info = requestedInfo;
    // use original height as scanlineDecoder does not support y sampling natively
    info = info.makeWH(requestedInfo.width(), srcHeight);

    // update scanlineDecoder with new info
    result = fScanlineDecoder->start(info, &options, ctable, ctableCount);
    if (kSuccess != result) {
        return result;
    }
    
    const bool requiresPostYSampling = fScanlineDecoder->requiresPostYSampling();

    if (requiresPostYSampling) {
        SkAutoMalloc storage(srcHeight * rowBytes);
        uint8_t* storagePtr = static_cast<uint8_t*>(storage.get());
        result = fScanlineDecoder->getScanlines(storagePtr, srcHeight, rowBytes);
        if (kSuccess != result) {
            return result;
        }
        storagePtr += Y0 * rowBytes;
        for (int y = 0; y < dstHeight; y++) {
            memcpy(dst, storagePtr, rowBytes);
            storagePtr += sampleY * rowBytes;
            dst = SkTAddOffset<void>(dst, rowBytes);
        }
    } else {
        // does not require post y sampling
        result = fScanlineDecoder->skipScanlines(Y0);
        if (kSuccess != result) {
            return result;
        }
        for (int y = 0; y < dstHeight; y++) {
            result = fScanlineDecoder->getScanlines(dst, 1, rowBytes);
            if (kSuccess != result) {
                return result;
            }
            if (y < dstHeight - 1) {
                result = fScanlineDecoder->skipScanlines(sampleY - 1);
                if (kSuccess != result) {
                    return result;
                }
            }
            dst = SkTAddOffset<void>(dst, rowBytes);
        }
    }
    return kSuccess;
}
Exemple #26
0
/*
 * Handle the detection and initialisation of a card.
 *
 * In the case of a resume, "oldcard" will contain the card
 * we're trying to reinitialise.
 */
static int mmc_init_card(struct mmc_host *host, u32 ocr,
	struct mmc_card *oldcard)
{
	struct mmc_card *card;
	int err;
	u32 cid[4];
#if defined(CONFIG_INAND_VERSION_PATCH)
	u32 rocr[1];
#endif
	unsigned int max_dtr;

	BUG_ON(!host);
	WARN_ON(!host->claimed);

	/*
	 * Since we're changing the OCR value, we seem to
	 * need to tell some cards to go back to the idle
	 * state.  We wait 1ms to give cards time to
	 * respond.
	 */
	mmc_go_idle(host);

	/* The extra bit indicates that we support high capacity */
#if defined(CONFIG_INAND_VERSION_PATCH)		
	err = mmc_send_op_cond(host, ocr | (1 << 30), rocr);
#else
	err = mmc_send_op_cond(host, ocr | (1 << 30), NULL);
#endif
	if (err)
		goto err;

	/*
	 * For SPI, enable CRC as appropriate.
	 */
	if (mmc_host_is_spi(host)) {
		err = mmc_spi_set_crc(host, use_spi_crc);
		if (err)
			goto err;
	}

	/*
	 * Fetch CID from card.
	 */
	if (mmc_host_is_spi(host))
		err = mmc_send_cid(host, cid);
	else
		err = mmc_all_send_cid(host, cid);
	if (err)
		goto err;

	if (oldcard) {
		if (memcmp(cid, oldcard->raw_cid, sizeof(cid)) != 0) {
			err = -ENOENT;
			goto err;
		}

		oldcard->err_count = 0;
		card = oldcard;
	} else {
		/*
		 * Allocate card structure.
		 */
		card = mmc_alloc_card(host, &mmc_type);
		if (IS_ERR(card)) {
			err = PTR_ERR(card);
			goto err;
		}

		card->type = MMC_TYPE_MMC;
		card->rca = 1;
		memcpy(card->raw_cid, cid, sizeof(card->raw_cid));
		host->card = card;
	}

	/*
	 * For native busses:  set card RCA and quit open drain mode.
	 */
	if (!mmc_host_is_spi(host)) {
		err = mmc_set_relative_addr(card);
		if (err)
			goto free_card;

		mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL);
	}

	if (!oldcard) {
		/*
		 * Fetch CSD from card.
		 */
		err = mmc_send_csd(card, card->raw_csd);
		if (err)
			goto free_card;

		err = mmc_decode_csd(card);
		if (err)
			goto free_card;
		err = mmc_decode_cid(card);
		if (err)
			goto free_card;
	}

	/*
	 * Select card, as all following commands rely on that.
	 */
	if (!mmc_host_is_spi(host)) {
		err = mmc_select_card(card);
		if (err)
			goto free_card;
	}

	if (!oldcard) {
		/*
		 * Fetch and process extended CSD.
		 */
		err = mmc_read_ext_csd(card);
		if (err)
			goto free_card;
#if defined(CONFIG_INAND_VERSION_PATCH)		
		if (rocr[0] & 0x40000000)
			mmc_card_set_blockaddr(card);
#endif
	}

	/*
	 * Activate high speed (if supported)
	 */
	if ((card->ext_csd.hs_max_dtr != 0) &&
		(host->caps & MMC_CAP_MMC_HIGHSPEED)) {
		err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
			EXT_CSD_HS_TIMING, 1);
		if (err && err != -EBADMSG)
			goto free_card;

		if (err) {
			printk(KERN_WARNING "%s: switch to highspeed failed\n",
			       mmc_hostname(card->host));
			err = 0;
		} else {
			mmc_card_set_highspeed(card);
			mmc_set_timing(card->host, MMC_TIMING_MMC_HS);
		}
	}

	/*
	 * Compute bus speed.
	 */
	max_dtr = (unsigned int)-1;

	if (mmc_card_highspeed(card)) {
		if (max_dtr > card->ext_csd.hs_max_dtr)
			max_dtr = card->ext_csd.hs_max_dtr;
	} else if (max_dtr > card->csd.max_dtr) {
		max_dtr = card->csd.max_dtr;
	}

	mmc_set_clock(host, max_dtr);

	/*
	 * Activate wide bus (if supported).
	 */
	if ((card->csd.mmca_vsn >= CSD_SPEC_VER_4) &&
	    (host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) {
		unsigned ext_csd_bit, bus_width;

		if (host->caps & MMC_CAP_8_BIT_DATA) {
			ext_csd_bit = EXT_CSD_BUS_WIDTH_8;
			bus_width = MMC_BUS_WIDTH_8;
		} else {
			ext_csd_bit = EXT_CSD_BUS_WIDTH_4;
			bus_width = MMC_BUS_WIDTH_4;
		}

		err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
				 EXT_CSD_BUS_WIDTH, ext_csd_bit);

		if (err && err != -EBADMSG)
			goto free_card;

		if (err) {
			printk(KERN_WARNING "%s: switch to bus width %d "
			       "failed\n", mmc_hostname(card->host),
			       1 << bus_width);
			err = 0;
		} else {
			mmc_set_bus_width(card->host, bus_width);
		}
	}

	return 0;

free_card:
	if (!oldcard) {
		mmc_remove_card(card);
		host->card = NULL;
	}
err:

	return err;
}
void Test_M2MResourceInstance::test_set_value()
{
    u_int8_t value[] = {"value2"};
    resource_instance->_value = (u_int8_t*)malloc(sizeof(u_int8_t));
    m2mbase_stub::bool_value = true;

    CHECK(resource_instance->set_value(value,(u_int32_t)sizeof(value)) == true);
    CHECK( resource_instance->_value_length == sizeof(value));
    CHECK( *resource_instance->_value == *value);

    m2mbase_stub::observe = (M2MObservationHandler*)handler;

    u_int8_t value2[] = {"12"};
    CHECK(resource_instance->set_value(value2,(u_int32_t)sizeof(value2)) == true);

    u_int8_t value3[] = {"13"};
    CHECK(resource_instance->set_value(value3,(u_int32_t)sizeof(value3)) == true);

    free(resource_instance->_value);
    resource_instance->_value_length = 0;

    CHECK(resource_instance->set_value(NULL,0) == false);

    CHECK(resource_instance->set_value(NULL,0) == false);

    m2mbase_stub::observation_level_value = M2MBase::R_Attribute;
    resource_instance->_value = (u_int8_t*)malloc(sizeof(value)+1);
    memset(resource_instance->_value,0,sizeof(value)+1);
    memcpy(resource_instance->_value,value,sizeof(value));
    resource_instance->_value_length = sizeof(value);    
    TestReportObserver obs;
    m2mbase_stub::report = new M2MReportHandler(obs);

    u_int8_t value4[] = {"value4"};
    CHECK(resource_instance->set_value(value4,(u_int32_t)sizeof(value4)) == true);


    m2mbase_stub::base_type = M2MBase::ResourceInstance;
    m2mbase_stub::observation_level_value = M2MBase::O_Attribute;
    resource_instance->_resource_type = M2MResourceInstance::INTEGER;
    m2mbase_stub::mode_value = M2MBase::Dynamic;
    ResourceCallback *resource_cb = new ResourceCallback();
    resource_instance->set_resource_observer(resource_cb);
    CHECK(resource_instance->set_value(value2,(u_int32_t)sizeof(value2)) == true);
    CHECK(resource_cb->visited == true);

    resource_cb->visited = false;
    m2mbase_stub::observation_level_value = M2MBase::R_Attribute;
    CHECK(resource_instance->set_value(value3,(u_int32_t)sizeof(value3)) == true);
    CHECK(resource_cb->visited == true);

    resource_instance->set_resource_observer(NULL);
    resource_cb->visited = false;
    m2mbase_stub::observation_level_value = M2MBase::R_Attribute;
    CHECK(resource_instance->set_value(value2,(u_int32_t)sizeof(value2)) == true);
    CHECK(resource_cb->visited == false);


    CHECK(resource_instance->set_value(value3,(u_int32_t)sizeof(value3)) == true);

    m2mbase_stub::observation_level_value = M2MBase::OI_Attribute;

    resource_instance->_resource_type = M2MResourceInstance::INTEGER;

    m2mbase_stub::mode_value = M2MBase::Dynamic;

    CHECK(resource_instance->set_value(value2,(u_int32_t)sizeof(value2)) == true);

    m2mbase_stub::observation_level_value = M2MBase::OOI_Attribute;

    resource_instance->_resource_type = M2MResourceInstance::INTEGER;

    m2mbase_stub::mode_value = M2MBase::Dynamic;

    CHECK(resource_instance->set_value(value2,(u_int32_t)sizeof(value2)) == true);

    delete m2mbase_stub::report;
    m2mbase_stub::report = NULL;
    delete resource_cb;
}
Exemple #28
0
void VL_GetPalette(byte *palette)
{
	memcpy(palette, pal, 768);
}
static void work_a_0977831778_3212880686_p_2(char *t0)
{
    char *t1;
    unsigned char t2;
    char *t3;
    char *t4;
    unsigned char t5;
    char *t6;
    char *t7;
    char *t8;
    char *t9;

LAB0:    xsi_set_current_line(303, ng0);
    t1 = (t0 + 136160U);
    t2 = ieee_p_2592010699_sub_2763492388968962707_503743352(IEEE_P_2592010699, t1, 0U, 0U);
    if (t2 != 0)
        goto LAB2;

LAB4:
LAB3:    t1 = (t0 + 192520);
    *((int *)t1) = 1;

LAB1:    return;
LAB2:    xsi_set_current_line(304, ng0);
    t3 = (t0 + 142760U);
    t4 = *((char **)t3);
    t5 = *((unsigned char *)t4);
    t3 = (t0 + 192968);
    t6 = (t3 + 56U);
    t7 = *((char **)t6);
    t8 = (t7 + 56U);
    t9 = *((char **)t8);
    *((unsigned char *)t9) = t5;
    xsi_driver_first_trans_fast(t3);
    xsi_set_current_line(305, ng0);
    t1 = (t0 + 143080U);
    t3 = *((char **)t1);
    t2 = *((unsigned char *)t3);
    t1 = (t0 + 193032);
    t4 = (t1 + 56U);
    t6 = *((char **)t4);
    t7 = (t6 + 56U);
    t8 = *((char **)t7);
    *((unsigned char *)t8) = t2;
    xsi_driver_first_trans_fast(t1);
    xsi_set_current_line(306, ng0);
    t1 = (t0 + 138120U);
    t3 = *((char **)t1);
    t1 = (t0 + 193096);
    t4 = (t1 + 56U);
    t6 = *((char **)t4);
    t7 = (t6 + 56U);
    t8 = *((char **)t7);
    memcpy(t8, t3, 2048U);
    xsi_driver_first_trans_fast(t1);
    xsi_set_current_line(307, ng0);
    t1 = (t0 + 141160U);
    t3 = *((char **)t1);
    t2 = *((unsigned char *)t3);
    t1 = (t0 + 193160);
    t4 = (t1 + 56U);
    t6 = *((char **)t4);
    t7 = (t6 + 56U);
    t8 = *((char **)t7);
    *((unsigned char *)t8) = t2;
    xsi_driver_first_trans_fast(t1);
    xsi_set_current_line(308, ng0);
    t1 = (t0 + 137640U);
    t3 = *((char **)t1);
    t1 = (t0 + 193224);
    t4 = (t1 + 56U);
    t6 = *((char **)t4);
    t7 = (t6 + 56U);
    t8 = *((char **)t7);
    memcpy(t8, t3, 256U);
    xsi_driver_first_trans_fast(t1);
    xsi_set_current_line(309, ng0);
    t1 = (t0 + 140360U);
    t3 = *((char **)t1);
    t1 = (t0 + 193288);
    t4 = (t1 + 56U);
    t6 = *((char **)t4);
    t7 = (t6 + 56U);
    t8 = *((char **)t7);
    memcpy(t8, t3, 2U);
    xsi_driver_first_trans_fast(t1);
    xsi_set_current_line(310, ng0);
    t1 = (t0 + 140840U);
    t3 = *((char **)t1);
    t2 = *((unsigned char *)t3);
    t1 = (t0 + 193352);
    t4 = (t1 + 56U);
    t6 = *((char **)t4);
    t7 = (t6 + 56U);
    t8 = *((char **)t7);
    *((unsigned char *)t8) = t2;
    xsi_driver_first_trans_fast(t1);
    goto LAB3;

}