예제 #1
0
파일: poly.c 프로젝트: thefkboss/proxmark3
poly_t
filtop(FILE *input, unsigned long length, int flags, int bperhx) {
	/* reads binary data from input into a poly_t until EOF or until
	 * length bits are read.  Characters are read until
	 * ceil(bperhx / CHAR_BIT) bits are collected; if P_LTLBYT is
	 * set in flags then the first character contains the LSB,
	 * otherwise the last one does.  The least significant bperhx
	 * bits are taken, reflected (if P_REFIN) and appended to the
	 * result, then more characters are read.  The maximum number of
	 * characters read is
	 *   floor(length / bperhx) * ceil(bperhx / * CHAR_BIT).
	 * The returned poly_t is CLEAN.
	 */

	bmp_t accu = BMP_C(0);
	bmp_t mask = bperhx == BMP_BIT ? ~BMP_C(0) : (BMP_C(1) << bperhx) - BMP_C(1);
	unsigned long iter = 0UL, idx;
	int cmask = ~(~0U << CHAR_BIT), c;
	int count = 0, ofs;
	poly_t poly = PZERO;
	if(bperhx == 0) return(poly);

	length -= length % bperhx;
	palloc(&poly, length); /* >= 0 */

	while(iter < length && (c = fgetc(input)) != EOF) {
		if(flags & P_LTLBYT)
			accu |= (bmp_t) (c & cmask) << count;
		else
			accu = (accu << CHAR_BIT) | (bmp_t) (c & cmask);
		count += CHAR_BIT;
		if(count >= bperhx) {
			/* the low bperhx bits of accu contain bits of the poly.*/
			iter += bperhx;
			count = 0;
			if(flags & P_REFIN)
				accu = rev(accu, bperhx);
			accu &= mask;

			/* iter >= bperhx > 0 */
			idx = IDX(iter - 1UL);
			ofs = OFS(iter - 1UL);
			poly.bitmap[idx] |= accu << ofs;
			if(ofs + bperhx > BMP_BIT) {
				poly.bitmap[idx-1] |= accu >> (BMP_BIT - ofs);
			}
			accu = BMP_C(0); /* only needed for P_LTLBYT */
		}
예제 #2
0
	}
	if (cfg.max_log_size != 0 && cfg.max_log_size <= 10) cfg.max_log_size = 10;
	if (cfg.ftimeout >= cfg.ctimeout) cfg.ftimeout = cfg.ctimeout - 100;
#ifdef WITH_LB
	if (cfg.lb_save > 0 && cfg.lb_save < 100) cfg.lb_save = 100;
	if (cfg.lb_nbest_readers < 2) cfg.lb_nbest_readers = DEFAULT_NBEST;
#endif
}

#define OFS(X) offsetof(struct s_config, X)
#define SIZEOF(X) sizeof(((struct s_config *)0)->X)

static const struct config_list global_opts[] = {
	DEF_OPT_FIXUP_FUNC(global_fixups_fn),
#ifdef LEDSUPPORT
	DEF_OPT_INT8("enableled"				, OFS(enableled),			0 ),
#endif
	DEF_OPT_FUNC("disablelog"				, OFS(disablelog),			disablelog_fn ),
#if defined(WEBIF) || defined(MODULE_MONITOR)
	DEF_OPT_FUNC("loghistorysize"			, OFS(loghistorysize),		loghistorysize_fn ),
#endif
	DEF_OPT_FUNC("serverip"					, OFS(srvip),				serverip_fn ),
	DEF_OPT_FUNC("logfile"					, OFS(logfile),				logfile_fn ),
	DEF_OPT_INT8("logduplicatelines"		, OFS(logduplicatelines),	0 ),
	DEF_OPT_STR("pidfile"					, OFS(pidfile),				NULL ),
	DEF_OPT_INT8("disableuserfile"			, OFS(disableuserfile),		1 ),
	DEF_OPT_INT8("disablemail"				, OFS(disablemail),			1 ),
	DEF_OPT_INT8("usrfileflag"				, OFS(usrfileflag),			0 ),
	DEF_OPT_UINT32("clienttimeout"			, OFS(ctimeout),			CS_CLIENT_TIMEOUT ),
	DEF_OPT_UINT32("fallbacktimeout"		, OFS(ftimeout),			CS_CLIENT_TIMEOUT / 2 ),
	DEF_OPT_UINT32("clientmaxidle"			, OFS(cmaxidle),			CS_CLIENT_MAXIDLE ),
예제 #3
0
#ifdef CS_ANTICASC
static void account_fixups_fn(void *var) {
	struct s_auth *account = var;
	if (account->ac_users < -1) account->ac_users = DEFAULT_AC_USERS;
	if (account->ac_penalty < -1) account->ac_penalty = DEFAULT_AC_PENALTY;
}
#endif

#define OFS(X) offsetof(struct s_auth, X)
#define SIZEOF(X) sizeof(((struct s_auth *)0)->X)

static const struct config_list account_opts[] = {
#ifdef CS_ANTICASC
	DEF_OPT_FIXUP_FUNC(account_fixups_fn),
#endif
	DEF_OPT_INT8("disabled"				, OFS(disabled),				0 ),
	DEF_OPT_SSTR("user"					, OFS(usr),						"", SIZEOF(usr) ),
	DEF_OPT_STR("pwd"					, OFS(pwd),						NULL ),
#ifdef WEBIF
	DEF_OPT_STR("description"			, OFS(description),				NULL ),
#endif
	DEF_OPT_STR("hostname"				, OFS(dyndns),					NULL ),
	DEF_OPT_FUNC("caid"					, OFS(ctab),					check_caidtab_fn ),
	DEF_OPT_INT8("uniq"					, OFS(uniq),					0 ),
	DEF_OPT_UINT8("sleepsend"			, OFS(c35_sleepsend),			0 ),
	DEF_OPT_INT32("failban"				, OFS(failban),					0 ),
	DEF_OPT_INT8("monlevel"				, OFS(monlvl),					0 ),
	DEF_OPT_FUNC("sleep"				, OFS(tosleep),					account_tosleep_fn ),
	DEF_OPT_FUNC("suppresscmd08"		, OFS(c35_suppresscmd08),		account_c35_suppresscmd08_fn ),
	DEF_OPT_FUNC("keepalive"			, OFS(ncd_keepalive),			account_ncd_keepalive_fn ),
	DEF_OPT_FUNC("au"					, 0,							account_au_fn ),
예제 #4
0
파일: MAIN.C 프로젝트: jskripsky/ancient
MSG MenuProc( HWND HWnd, MSG Msg, MPARAM MP1, MPARAM MP2 )
    {
    static struct MenuPoint MenuPoints[NUMMENUPOINTS] =
	{ { DOT,  0, "Einstellungen", EinstellungenProc, NULL },
	  { 0,	  0, "", NULL, NULL },
	  { 0,	  0, "", NULL, NULL },
	  { 0,	  0, "Durchschnitt", DurchschnittProc, NULL },
	  { 0,	  0, "������������", NULL, NULL },
	  { DOT,  1, "Periode", PeriodeProc, NULL },
	  { DOT,  1, "Abteilungen", AbteilungenProc, NULL },
	  { DOT,  1, "Begr�ndungen", BegruendungenProc, NULL },
	  { 0,	  0, "", NULL, NULL },

	  { 0,	  0, "�bersicht", UebersichtProc, NULL },
	  { 0,	  0, "���������", NULL, NULL },
	  { DOT,  1, "Periode", PeriodeProc, NULL },
	  { DOT,  1, "Person(en)", PersonenProc, NULL },
	  { DOT,  1, "Begr�ndungen", BegruendungenProc, NULL },
	  { 0,	  0, "", NULL, NULL },

	  { 0,	  0, "Grenzwerte �berschritten", UeberzeitProc, NULL },
	  { 0,	  0, "������������������������", NULL, NULL },
	  { DOT,  1, "Periode", PeriodeProc, NULL },
	  { DOT,  1, "Abteilungen", AbteilungenProc, NULL },
	  { DOT,  1, "Begr�ndungen", PMBegruendungenProc, NULL },
	  { 0,	  0, "", NULL, NULL },

	  { 0,	  0, "Summierung Zeitkonti", ZeitKontiSumProc, NULL },
	  { 0,	  0, "��������������������", NULL, NULL },
	  { DOT,  1, "Periode", PeriodeProc, NULL },
	  { DOT,  1, "Zeitkonti", ZeitKontiProc, NULL } };

    static struct HelpKey HelpKeys[NUMMENUHELPKEYS] =
	{ {  0,  0, "</>    Men�punkt anw�hlen" },
	  {  0,  1, "<Enter>  Men�punkt ausf�hren" },
	  { 40,  1, "<Esc>    Programm verlassen" } };

    static BYTE Selection;
    static BYTE TopLine;

    static BOOL PanelFocus;

    switch( Msg )
	{
	case WM_CREATE:
	    {

	    MenuPoints[5].Data = &ConfigData->Perioden[0];
	    MenuPoints[11].Data = &ConfigData->Perioden[1];
	    MenuPoints[17].Data = &ConfigData->Perioden[2];
	    MenuPoints[23].Data = &ConfigData->Perioden[3];

	    MenuPoints[6].Data = (VOID FAR *)0;
	    MenuPoints[12].Data = (VOID FAR *)1;
	    MenuPoints[18].Data = (VOID FAR *)2;

	    MenuPoints[7].Data = (VOID FAR *)0;
	    MenuPoints[13].Data = (VOID FAR *)1;
	    MenuPoints[19].Data = (VOID FAR *)2;

	    MenuPoints[24].Data = (VOID FAR *)3;
	    WinCreateWindow( HWnd, &MenuArrows, MenuArrowsProc, 0, 0, 25, -1, 25, 20 );
	    Selection = 0;
	    TopLine = 0;
	    PanelFocus = FALSE;
	    return( WM_PROCESSED );
	    }

	case WM_SHOW:
	    {
	    BYTE LineCounter;

	    WinColor( HWnd, MENU, 0, 0, WinGetx2( HWnd ), WinGety2( HWnd ) );
	    WinFill( HWnd, SPACECHAR, 0, 0, WinGetx2( HWnd ), WinGety2( HWnd ) );

	    for( LineCounter = 0; LineCounter <= WinGety2( HWnd ); LineCounter++ )
		{
		if( LineCounter + TopLine == NUMMENUPOINTS )
		    break;

		if( MenuPoints[LineCounter + TopLine].Style & DOT )
		    {
		    WinString( HWnd, "� ", LEFT, (BYTE)(MenuPoints[LineCounter + TopLine].Indent + 1), LineCounter );
		    WinString( HWnd, MenuPoints[LineCounter + TopLine].Text, LEFT, (BYTE)(MenuPoints[LineCounter + TopLine].Indent + 3), LineCounter );
		    }
		else
		    WinString( HWnd, MenuPoints[LineCounter + TopLine].Text, LEFT, (BYTE)(MenuPoints[LineCounter + TopLine].Indent + 1), LineCounter );
		}

	    return( WM_PROCESSED );
	    }

	case WM_SETFOCUS:
	    {
	    BYTE Length;

	    WinSendMsg( MenuArrows, WM_SET, (TopLine == 0 ? FALSE : TRUE ),
					    ((BYTE)(NUMMENUPOINTS - 1 - TopLine) <= WinGety2( HWnd ) ? FALSE : TRUE ) );

	    WinSendMsg( MenuArrows, WM_SHOW, 0, 0 );

	    Length = (BYTE)strlen( MenuPoints[Selection].Text );
	    if( MenuPoints[Selection].Style & DOT )
		Length += 2;

	    WinColor( HWnd, HIGHLIGHT, (BYTE)(MenuPoints[Selection].Indent), (BYTE)(Selection - TopLine), (BYTE)(MenuPoints[Selection].Indent + Length + 1), (BYTE)(Selection - TopLine) );

	    WinSendMsg( Bottomline, WM_HELP, (WORD)&HelpKeys, NUMMENUHELPKEYS );

	    WinCreateWindow( HWnd, &Panel, MenuPoints[Selection].Proc, SEG(MenuPoints[Selection].Data), OFS(MenuPoints[Selection].Data), PANELX1, PANELY1, PANELX2, PANELY2 );
	    WinSendMsg( Panel, WM_SHOW, 0, 0 );
	    return( WM_PROCESSED );
	    }

	case WM_CLEARFOCUS:
	    WinDestroyWindow( Panel );
	    WinColor( HWnd, MENU, 0, 0, WinGetx2( HWnd ), WinGety2( HWnd ) );
	    return( WM_PROCESSED );

	case WM_CHAR:
	    if( PanelFocus )
		if( WinSendMsg( Panel, Msg, MP1, MP2 ) == WM_PROCESSED )
		    return( WM_PROCESSED );

	    switch( (WORD)MP1 )
		{
		case KBDOWN:
		case KBRIGHT:
		case KBTAB:
		    WinSendMsg( HWnd, WM_CLEARFOCUS, 0, 0 );
		    do
			{
			if( Selection == NUMMENUPOINTS - 1)
			    break;

			Selection++;

			if( Selection - TopLine > WinGety2( HWnd ) )
			    {
			    TopLine++;
			    WinSendMsg( HWnd, WM_SHOW, 0, 0 );
			    }
			}
		    while( MenuPoints[Selection].Proc == NULL );

		    WinSendMsg( HWnd, WM_SETFOCUS, 0, 0 );
		    break;

		case KBUP:
		case KBLEFT:
		case KBSHTAB:
		    WinSendMsg( HWnd, WM_CLEARFOCUS, 0, 0 );
		    do
			{
			if( Selection == 0)
			    break;

			Selection--;

			if( Selection < TopLine )
			    {
			    TopLine--;
			    WinSendMsg( HWnd, WM_SHOW, 0, 0 );
			    }
			}
		    while( MenuPoints[Selection].Proc == NULL );

		    WinSendMsg( HWnd, WM_SETFOCUS, 0, 0 );
		    break;

		case KBHOME:
		    WinSendMsg( HWnd, WM_CLEARFOCUS, 0, 0 );

		    TopLine = 0;
		    Selection = 0;

		    WinSendMsg( HWnd, WM_SHOW, 0, 0 );
		    WinSendMsg( HWnd, WM_SETFOCUS, 0, 0 );
		    break;

		case KBEND:
		    WinSendMsg( HWnd, WM_CLEARFOCUS, 0, 0 );

		    Selection = NUMMENUPOINTS - 1;
		    if( NUMMENUPOINTS - 1 < WinGety2( HWnd ) )
			TopLine = 0;
		    else
			TopLine = (BYTE)(NUMMENUPOINTS - 1 - WinGety2( HWnd ));

		    WinSendMsg( HWnd, WM_SHOW, 0, 0 );
		    WinSendMsg( HWnd, WM_SETFOCUS, 0, 0 );
		    break;

		case KBENTER:
		    if( !PanelFocus )
			{
			WinSendMsg( Panel, WM_SETFOCUS, 0, 0 );
			PanelFocus = TRUE;
			return( WM_PROCESSED );
			}
		    else
			WinSendMsg( HWnd, WM_CHAR, (MPARAM)KBESC, 0 );


		case KBESC:
		    if( PanelFocus )
			{
			WinSendMsg( Panel, WM_CLEARFOCUS, 0, 0 );
			PanelFocus = FALSE;
			WinSendMsg( HWnd, WM_SETFOCUS, 0, 0 );
			return( WM_PROCESSED );
			}

		default:
		    return( MP1 );
		}
	    return( WM_PROCESSED );

	case WM_DESTROY:
	    WinDestroyWindow( MenuArrows );
	    return( WM_PROCESSED );

	}

    return( WinDefWindowProc( HWnd, Msg, MP1, MP2 ) );
    }
예제 #5
0
	if(account->acosc_zap_limit < -1) { account->acosc_zap_limit = -1; }
	if(account->acosc_penalty < -1) { account->acosc_penalty = -1; }
	if(account->acosc_penalty_duration < -1) { account->acosc_penalty_duration = -1; }
	if(account->acosc_delay < -1) { account->acosc_delay = -1; }
}
#endif

#define OFS(X) offsetof(struct s_auth, X)
#define SIZEOF(X) sizeof(((struct s_auth *)0)->X)

static const struct config_list account_opts[] =
{
#ifdef CS_ANTICASC
	DEF_OPT_FIXUP_FUNC(account_fixups_fn),
#endif
	DEF_OPT_INT8("disabled"             , OFS(disabled),                0),
	DEF_OPT_SSTR("user"                 , OFS(usr),                     "", SIZEOF(usr)),
	DEF_OPT_STR("pwd"                   , OFS(pwd),                     NULL),
#ifdef WEBIF
	DEF_OPT_STR("description"           , OFS(description),             NULL),
#endif
	DEF_OPT_STR("hostname"              , OFS(dyndns),                  NULL),
	DEF_OPT_FUNC("caid"                 , OFS(ctab),                    check_caidtab_fn),
	DEF_OPT_INT8("uniq"                 , OFS(uniq),                    0),
	DEF_OPT_UINT8("sleepsend"           , OFS(c35_sleepsend),           0),
	DEF_OPT_INT32("failban"             , OFS(failban),                 0),
	DEF_OPT_INT8("monlevel"             , OFS(monlvl),                  0),
	DEF_OPT_FUNC("sleep"                , OFS(tosleep),                 account_tosleep_fn),
	DEF_OPT_FUNC("suppresscmd08"        , OFS(c35_suppresscmd08),       account_c35_suppresscmd08_fn),
	DEF_OPT_INT32("umaxidle"            , OFS(umaxidle),                -1),
	DEF_OPT_FUNC("keepalive"            , OFS(ncd_keepalive),           account_ncd_keepalive_fn),
예제 #6
0
void PCMLoop(pcm_soft* p,bool_t Speed)
{
	bool_t SrcPacked = !(p->Src.Flags & PCM_PLANES) && p->Src.Channels==2;
	dyninst* Loop;
	reg Left;
	reg Right;
	reg Shift;

	if (!p->ActualDither && p->Shift)
		I1C(MOVI,R13,p->Shift);

	if (p->ActualDither)
		if (Speed)
			I2C(MOVL_STOFS,R7,SP,OFS(stack,Step)); // save backup
		else
			I1C(MOVI,R7,-p->Shift);

	Loop = Label(1);

	Left = R2;
	if (p->UseLeft)
		Right = R3;
	else
		Right = R2;

	if (Speed)
	{
		I2(MOV,R8,R0);
		IShift(R0,NONE,-8);
		IShift(R0,NONE,p->SrcShift);

		switch (p->Src.Bits)
		{
		case 8:
			if (p->UseLeft)
				I2(MOVB_LDR0,R9,Left);
			if (p->UseRight)
				I2(MOVB_LDR0,R10,Right);

			if (p->SrcUnsigned)	
			{
				I2(EXTUB,R2,R2);
				if (p->SrcChannels>1)
					I2(EXTUB,R3,R3);
			}
			break;

		case 16:
			if (p->UseLeft)
				I2(MOVW_LDR0,R9,Left);
			if (p->UseRight)
				I2(MOVW_LDR0,R10,Right);

			if (p->SrcUnsigned)	
			{
				I2(EXTUW,R2,R2);
				if (p->SrcChannels>1)
					I2(EXTUW,R3,R3);
			}
			break;

		case 32:
			if (p->UseLeft)
				I2(MOVL_LDR0,R9,Left);
			if (p->UseRight)
				I2(MOVL_LDR0,R10,Right);
			break;
		}

		I2(ADD,R7,R8);
	}
	else
	{
		switch (p->Src.Bits)
		{
		case 8:
			if (p->UseLeft)
			{
				I2(MOVB_LDADD,R9,Left);
				if (SrcPacked && !p->UseRight) I1C(ADDI,R9,1);
			}
			if (p->UseRight)
				if (SrcPacked)
				{
					if (!p->UseLeft) I1C(ADDI,R9,1);
					I2(MOVB_LDADD,R9,Right);
				}
				else
					I2(MOVB_LDADD,R10,Right);

			if (p->SrcUnsigned)	
			{
				I2(EXTUB,R2,R2);
				if (p->SrcChannels>1)
					I2(EXTUB,R3,R3);
			}
			break;

		case 16:
			if (p->UseLeft)
			{
				I2(MOVW_LDADD,R9,Left);
				if (SrcPacked && !p->UseRight) I1C(ADDI,R9,2);
			}
			if (p->UseRight)
				if (SrcPacked)
				{
					if (!p->UseLeft) I1C(ADDI,R9,2);
					I2(MOVW_LDADD,R9,Right);
				}
				else
					I2(MOVW_LDADD,R10,Right);

			if (p->SrcUnsigned)	
			{
				I2(EXTUW,R2,R2);
				if (p->SrcChannels>1)
					I2(EXTUW,R3,R3);
			}
			break;

		case 32:
			if (p->UseLeft)
			{
				I2(MOVL_LDADD,R9,Left);
				if (SrcPacked && !p->UseRight) I1C(ADDI,R9,4);
			}
			if (p->UseRight)
				if (SrcPacked)
				{
					if (!p->UseLeft) I1C(ADDI,R9,4);
					I2(MOVL_LDADD,R9,Right);
				}
				else
					I2(MOVL_LDADD,R10,Right);
			break;
		}
	}

	if (p->InstSrcUnsigned)
	{
		MB(); I1P(MOVL_PC,R0,p->InstSrcUnsigned,0);
		I2(SUB,R0,R2);
		if (p->SrcChannels>1)
			I2(SUB,R0,R3);
	}
	else
	if (p->SrcUnsigned == 128) 
	{
		I1C(ADDI,R2,-128);
		if (p->SrcChannels>1)
			I1C(ADDI,R3,-128);
	}

	if (p->Stereo)
	{
		if ((p->Src.Flags ^ p->Dst.Flags) & PCM_SWAPPEDSTEREO)
		{
			Left = R3;
			Right = R2;
		}
		else
		{
			Left = R2;
			Right = R3;
		}
	}
	else
	{
		if (p->Join)
			I2(ADD,R3,R2);
		Right = Left = R2;
	}


	if (p->ActualDither)
	{
		I2(ADD,R13,R2);
		I2(MOV,R2,R13);
		if (p->Stereo) 
		{
			I2(ADD,R1,R3);
			I2(MOV,R3,R1);
		}
	}

	if (p->Clip>0)
	{
		dyninst* ClipMin = Label(0);
		dyninst* ClipMax = Label(0);

		I2(CMPGT,R2,R4);
		I0P(BFS,ClipMin);
		I2(CMPGT,R5,R2); // delay slot
		I2(MOV,R4,R2);
		InstPost(ClipMin);

		I0P(BFS,ClipMax);
		I1C(ADDI,R11,1<<p->DstShift); // delay slot
		I2(MOV,R5,R2);
		InstPost(ClipMax);

		if (p->Stereo)
		{
			ClipMin = Label(0);
			ClipMax = Label(0);

			I2(CMPGT,R3,R4);
			I0P(BFS,ClipMin);
			I2(CMPGT,R5,R3); // delay slot
			I2(MOV,R4,R3);
			InstPost(ClipMin);

			I0P(BFS,ClipMax);
			I1C(ADDI,R12,1<<p->DstShift); // delay slot
			I2(MOV,R5,R3);
			InstPost(ClipMax);
		}
		else
		if (p->Dst.Channels>1)
			I1C(ADDI,R12,1<<p->DstShift); // delay slot
	}
	else
	{
		I1C(ADDI,R11,1<<p->DstShift);
		if (p->Dst.Channels>1)
			I1C(ADDI,R12,1<<p->DstShift);
	}

	I2(CMPEQ,R11,R14);

	if (p->Shift)
	{
		if (p->ActualDither)
		{
			I1C(MOVI,R0,p->Shift);
			Shift = R0;
		}
		else
			Shift = R13;
		I2(SHAD,Shift,R2);
		if (p->Stereo) I2(SHAD,Shift,R3);
	}

	if (p->ActualDither)
	{
		if (Speed)
			I1C(MOVI,R7,-p->Shift);

		I2(MOV,R2,R0);
		I2(SHAD,R7,R0);
		I2(SUB,R0,R13);
		if (p->Stereo)
		{
			I2(MOV,R3,R0);
			I2(SHAD,R7,R0);
			I2(SUB,R0,R1);
		}

		if (Speed)
			I2C(MOVL_LDOFS,SP,R7,OFS(stack,Step));
	}

	if (p->InstDstUnsigned)
	{
		MB(); I1P(MOVL_PC,R0,p->InstDstUnsigned,0);
		I1C(ADD,R0,Left);
		if (Left != Right)
			I1C(ADD,R0,Right);
	}
	else
	if (p->DstUnsigned == 128) 
	{
		// p->Dst.Bits=8 so doesn't matter if it's add or sub
		I1C(ADDI,Left,-128); 
		if (Left != Right)
			I1C(ADDI,Right,-128);
	}

	switch (p->Dst.Bits)
	{
	case 8:
		I2(MOVB_ST,Left,R11);
		if (p->Dst.Channels>1)
			I2(MOVB_ST,Right,R12);
		break;

	case 16:
		I2(MOVW_ST,Left,R11);
		if (p->Dst.Channels>1)
			I2(MOVW_ST,Right,R12);
		break;

	case 32:
		I2(MOVL_ST,Left,R11);
		if (p->Dst.Channels>1)
			I2(MOVL_ST,Right,R12);
		break;
	}

	DS(); I0P(BFS,Loop);

	if (p->ActualDither)
	{
		I2(MOV,SP,R0);
		I1C(ADDI,R0,OFS(stack,State));
		I2(MOVL_LD,R0,R4);

		I2C(MOVL_STOFS,R13,R4,OFS(pcmstate,Dither[0]));
		I2C(MOVL_STOFS,R1,R4,OFS(pcmstate,Dither[1]));
	}

	CodeEnd(7,OFS(stack,StackFrame));
}
예제 #7
0
void PCMCompile(pcm_soft* p)
{
	dyninst* Speed;
	dyninst* Min = NULL;
	dyninst* Max = NULL;

	CodeBegin(7,OFS(stack,StackFrame));

	p->InstSrcUnsigned = NULL;
	p->InstDstUnsigned = NULL;

	if (p->SrcUnsigned && p->SrcUnsigned != 128)
		p->InstSrcUnsigned = InstCreate32(p->SrcUnsigned,NONE,NONE,NONE,0,0);
	if (p->DstUnsigned && p->DstUnsigned != 128)
		p->InstDstUnsigned = InstCreate32(p->DstUnsigned,NONE,NONE,NONE,0,0);

	// dst pointers
	I2C(MOVL_LDOFS,R5,R11,0);
	I1C(ADDI,R11,-(1<<p->DstShift)); // back one step

	if (p->Dst.Channels > 1)
	{
		if (p->Dst.Flags & PCM_PLANES)
		{
			I2C(MOVL_LDOFS,R5,R12,4);
			I1C(ADDI,R12,-(1<<p->DstShift)); // back one step
		}
		else
		{
			I2(MOV,R11,R12);
			I1C(ADDI,R12,1<<(p->DstShift-1));
		}
	}
	I2(MOV,R7,R14);
	I2(ADD,R11,R14); // dstend

	// src pointers
	I2C(MOVL_LDOFS,R6,R9,0);

	if (p->Src.Channels > 1)
	{
		if (p->Src.Flags & PCM_PLANES)
			I2C(MOVL_LDOFS,R6,R10,4);
		else
		{
			I2(MOV,R9,R10);
			I1C(ADDI,R10,p->Src.Bits>>3);
		}
	}

	I2(MOV,SP,R0);
	I1C(ADDI,R0,OFS(stack,State));
	I2(MOVL_LD,R0,R4);

	I2C(MOVL_LDOFS,R4,R7,OFS(pcmstate,Step));
	I2C(MOVL_LDOFS,R4,R8,OFS(pcmstate,Pos));

	/*
	if (p->UseVolume)
	{
		I1C(ADDI,R0,OFS(stack,Volume)-OFS(stack,State));
		I2(MOVL_LD,R0,R1);
	}
	*/

	if (p->ActualDither)
	{
		I2C(MOVL_LDOFS,R4,R13,OFS(pcmstate,Dither[0]));
		I2C(MOVL_LDOFS,R4,R1,OFS(pcmstate,Dither[1]));
	}

	if (p->Clip>0)
	{
		Min = InstCreate32(p->MinLimit,NONE,NONE,NONE,0,0);
		Max = InstCreate32(p->MaxLimit,NONE,NONE,NONE,0,0);

		I1P(MOVL_PC,R4,Min,0);
		I1P(MOVL_PC,R5,Max,0);
	}

	Speed = Label(0);

	I1C(MOVI,R2,64);
	I1(SHLL2,R2);
	I2(CMPEQ,R2,R7);
	I0P(BF,Speed);

	PCMLoop(p,0);

	InstPost(Speed);

	PCMLoop(p,1);

	Align(4);
	if (Min) InstPost(Min);
	if (Max) InstPost(Max);
	if (p->InstSrcUnsigned) InstPost(p->InstSrcUnsigned);
	if (p->InstDstUnsigned) InstPost(p->InstDstUnsigned);
}
예제 #8
0
	}
	if(cfg.max_log_size != 0 && cfg.max_log_size <= 10) { cfg.max_log_size = 10; }
#ifdef WITH_LB
	if(cfg.lb_save > 0 && cfg.lb_save < 100) { cfg.lb_save = 100; }
	if(cfg.lb_nbest_readers < 2) { cfg.lb_nbest_readers = DEFAULT_NBEST; }
#endif
}

#define OFS(X) offsetof(struct s_config, X)
#define SIZEOF(X) sizeof(((struct s_config *)0)->X)

static const struct config_list global_opts[] =
{
	DEF_OPT_FIXUP_FUNC(global_fixups_fn),
#ifdef LEDSUPPORT
	DEF_OPT_INT8("enableled"                , OFS(enableled),           0),
#endif
	DEF_OPT_FUNC("disablelog"               , OFS(disablelog),          disablelog_fn),
#if defined(WEBIF) || defined(MODULE_MONITOR)
	DEF_OPT_FUNC("loghistorylines"          , OFS(loghistorylines),    loghistorylines_fn),
#endif
	DEF_OPT_FUNC("serverip"                 , OFS(srvip),               serverip_fn),
	DEF_OPT_FUNC("logfile"                  , OFS(logfile),             logfile_fn),
	DEF_OPT_INT32("initial_debuglevel"      , OFS(initial_debuglevel),  0), 
	DEF_OPT_STR("sysloghost"                , OFS(sysloghost),          NULL),
	DEF_OPT_INT32("syslogport"              , OFS(syslogport),          514),
	DEF_OPT_INT8("logduplicatelines"        , OFS(logduplicatelines),   0),
	DEF_OPT_STR("pidfile"                   , OFS(pidfile),             NULL),
	DEF_OPT_INT8("disableuserfile"          , OFS(disableuserfile),     1),
	DEF_OPT_INT8("disablemail"              , OFS(disablemail),         1),
	DEF_OPT_INT8("usrfileflag"              , OFS(usrfileflag),         0),
예제 #9
0
파일: config.c 프로젝트: mmocean/shttpd
	ctx->ssl_ctx = CTX;
}
#endif /* NO_SSL */

static void
set_mime(struct shttpd_ctx *ctx, void *arg, const char *string)
{
	arg = NULL;
	set_mime_types(ctx, string);
}

#define	OFS(x)	offsetof(struct shttpd_ctx, x)
#define BOOL_OPT	"0|1"
const struct opt options[] = {
	{'d', "document_root", "Web root directory", set_str,
		OFS(document_root), "directory", NULL, OPT_DIR},
	{'i', "index_files", "Index files", set_str, OFS(index_files),
		"file_list", INDEX_FILES, OPT_ADVANCED},
	{'p', "listen_ports", "Listening ports", set_str,
		OFS(ports), "ports", LISTENING_PORTS, OPT_ADVANCED},
	{'D', "list_directories", "Directory listing", set_int,
		OFS(dirlist), BOOL_OPT, "1", OPT_BOOL | OPT_ADVANCED},
#ifndef NO_CGI
	{'c', "cgi_extensions", "CGI extensions", set_str,
		OFS(cgi_extensions), "ext_list", CGI_EXT, OPT_ADVANCED},
	{'C', "cgi_interpreter", "CGI interpreter", set_str,
		OFS(cgi_interpreter), "file", NULL, OPT_FILE | OPT_ADVANCED},
	{'V', "cgi_envvar", "CGI envir variables", set_str,
		OFS(cgi_vars), "X=Y,....", NULL, OPT_ADVANCED},
#endif /* NO_CGI */
#if !defined(NO_SSI)