Example #1
0
File: gen.c Project: minux/subc
void queue(int type, int val, char *name) {
	commit();
	Q_type = type;
	Q_val = val;
	if (name) copyname(Q_name, name);
	Q_cmp = cnone;
}
Example #2
0
File: gen.c Project: minux/subc
char *gsym(char *s) {
	static char	name[NAMELEN+2];

	name[0] = PREFIX;
	copyname(&name[1], s);
	return name;
}
Example #3
0
void clonefile(const char *filename = defaultname) 
{
   TString copyname("copy-");
   copyname.Append(filename);
   
   TFile f(filename);
   TTree *in; f.GetObject("tree",in);
   
   TFile copy(copyname,"RECREATE");
   in->CloneTree(-1,"fast");
   
   copy.Write();
}
Example #4
0
File: decl.c Project: jezze/gaz
static void enumdecl(int glob)
{

    int v = 0;
    char name[NAMELEN+1];

    Token = scan();

    if (IDENT == Token)
        Token = scan();

    lbrace();

    while (RBRACE != Token)
    {

        copyname(name, Text);
        ident();

        if (ASSIGN == Token)
        {

            Token = scan();
            v = constexpr();

        }

        if (glob)
            addglob(name, PINT, TCONSTANT, 0, 0, v++, NULL, 0);
        else
            addloc(name, PINT, TCONSTANT, 0, 0, v++, 0);

        if (Token != COMMA)
            break;

        Token = scan();

        if (eofcheck())
            return;

    }
Example #5
0
void DreamGenContext::commandwithob(uint8 command, uint8 type, uint8 index) {
	uint8 commandLine[64] = "OBJECT NAME ONE                         ";
	deltextline();
	uint16 commandText = kTextstart + segRef(data.word(kCommandtext)).word(command * 2);
	uint8 textLen = data.byte(kTextlen);
	{
		uint16 y = data.word(kTextaddressy);
		const uint8 *string = segRef(data.word(kCommandtext)).ptr(commandText, 0);
		printdirect(&string, data.word(kTextaddressx), &y, textLen, (bool)(textLen & 1));
	}
	copyname(type, index, commandLine);
	uint16 x = data.word(kLastxpos);
	if (command != 0)
		x += 5;
	{
		uint16 y = data.word(kTextaddressy);
		const uint8 *string = commandLine;
		printdirect(&string, x, &y, textLen, (bool)(textLen & 1));
	}
	data.byte(kNewtextline) = 1;
}
Example #6
0
void DreamGenContext::copyname() {
	copyname(ah, al, cs.ptr(di, 0));
}
Example #7
0
int bouquet_exec( int fdfb, int fdrc, int fdlcd, char *cfgfile )
{
	struct timeval	tv;
	int				t;
	int				r;
	int				i;
	int				idx=0;
	int				cnum;
	int				x;
	Channel			*ch=NULL;
	FILE			*fp;
	char			line[512];
	char			l2[512];
	char			*p;

	if ( FBInitialize( 720, 576, 8, fdfb ) < 0 )
		return -1;

	setup_colors();

	if ( RcInitialize( fdrc ) < 0 )
		return -1;

/* load setup */
	fp = fopen( CONFIGDIR "/zapit/services.xml", "r" );
	if ( !fp )
	{
		FBDrawString( 190, 100, 64, "services.xml not found !", RED, 0 );
#ifdef USEX
		FBFlushGrafic();
#endif
		tv.tv_sec = 5;
		tv.tv_usec = 0;
		select( 0, 0, 0, 0, &tv );

		RcClose();
		FBClose();

		return 0;
	}

	while( fgets(line,512,fp) )
	{
		num_lines++;
		if ( strstr(line,"channelNR") )
		{
			p=strstr(line,"serviceType");
			if ( p && (*(p+15) == '0') )
			{
				p+=16;
				if ( *p == '1' )
					num_ch_tv++;
				if ( *p == '2' )
					num_ch_radio++;
				if ( *p == '4' )
					num_ch_tv++;
			}
		}
	}
	fclose(fp);

	lines = (char**)malloc(sizeof(char*)*num_lines);
	tv_ch = (Channel*)malloc(sizeof(Channel)*num_ch_tv);
	radio_ch = (Channel*)malloc(sizeof(Channel)*num_ch_radio);
	for( i=0;i<num_ch_tv;i++)
		tv_ch[i].flag=0;
	for( i=0;i<num_ch_radio;i++)
		radio_ch[i].flag=0;

	fp = fopen( CONFIGDIR "/zapit/services.xml", "r" );
	t=num_ch_tv-1;
	r=num_ch_radio-1;
	for(i=0; i<num_lines;i++)
	{
		fgets( line, 512, fp );
		lines[i] = strdup(line);
		if ( !strstr(line,"channelNR") )
			continue;

		p=strstr(line,"name=");
		copyname(l2,p+6);

		p=strstr(line,"channelNR=");
		cnum=_atoi(p+11);

		if ( cnum )
			idx=cnum-1;

		p=strstr(line,"serviceType");
		if ( !p || ( *(p+15) != '0' ) )
			continue;

		switch( *(p+16) )
		{
		case '1' :
		case '4' :
			ch=tv_ch;
			if ( !cnum || ch[idx].flag )
			{
				idx=t;
				t--;
			}
			break;
		case '2' :
			ch=radio_ch;
			if ( !cnum || ch[idx].flag )
			{
				idx=r;
				r--;
			}
			break;
		default:
			p=0;
			break;
		}
		if ( !p )
			continue;

		ch[idx].name=strdup(l2);
		ch[idx].flag=*(p+14);
		ch[idx].line=lines[i];
	}
	fclose(fp);

	t=0;
	while( doexit != 3 )
	{
		if ( t )
			SortBouquet( radio_ch, num_ch_radio );
		else
			SortBouquet( tv_ch, num_ch_tv );
		t=!t;
		switch( doexit )
		{
		case 2 :
			doexit=0;
			break;
		case 1 :
			SaveServices();
			doexit=3;
			break;
		}
	}

	for( i=0; i<num_ch_tv; i++ )
		free( tv_ch[i].name );
	for( i=0; i<num_ch_radio; i++ )
		free( radio_ch[i].name );
	for( i=0; i<num_lines; i++ )
		free( lines[i] );
	free( lines );
	free( tv_ch );
	free( radio_ch );

/* fx2 */
/* buffer leeren, damit neutrino nicht rumspinnt */
	realcode = RC_0;
	while( realcode != 0xee )
	{
		tv.tv_sec = 0;
		tv.tv_usec = 300000;
		x = select( 0, 0, 0, 0, &tv );		/* 300ms pause */
		RcGetActCode( );
	}

	RcClose();
	FBClose();

	return 0;
}