示例#1
0
文件: pro.c 项目: ashrithhc/blindfold
void instrn()
{
 s=18;sp=6;
 w9=w8=w4=w6=w5=w2=w3=w7=w0=wk=we=wf=wj=wl=wp=wr=ws=s/2;//1/2
 w1=wi=s/4;
 wg=wc=wh=wn=wb=wu=wt=wv=wx=wy=2*s/3;//2/3
 ww=wm=wa=wd=wo=wq=wz=3*s/4;//3/4
 h=s;//1

 xnxt=-190;ynxt=320;
 how();
////////////////

 s=18;sp=6;
 w9=w8=w4=w6=w5=w2=w3=w7=w0=wk=we=wf=wj=wl=wp=wr=ws=s/2;//1/2
 w1=wi=s/4;
 wg=wc=wh=wn=wb=wu=wt=wv=wx=wy=2*s/3;//2/3
 ww=wm=wa=wd=wo=wq=wz=3*s/4;//3/4
 h=s;//1
 
 xnxt=-190;ynxt-=4*s;
 first();

 xnxt=-190;ynxt-=2*s;
 second();

 xnxt=-190;ynxt-=2*s;
 third();

 xnxt=-190;ynxt-=2*s;
 fourth();

}
示例#2
0
FILE *Inkscape::IO::fopen_utf8name( char const *utf8name, char const *mode )
{
    static gint counter = 0;
    FILE* fp = NULL;

    DEBUG_MESSAGE( dumpOne, "entering fopen_utf8name( '%s', '%s' )[%d]", utf8name, mode, (counter++) );

#ifndef WIN32
    DEBUG_MESSAGE( dumpOne, "           STEP 0              ( '%s', '%s' )[%d]", utf8name, mode, (counter++) );
    gchar *filename = g_filename_from_utf8( utf8name, -1, NULL, NULL, NULL );
    if ( filename )
    {
        DEBUG_MESSAGE( dumpOne, "           STEP 1              ( '%s', '%s' )[%d]", utf8name, mode, (counter++) );
        fp = std::fopen(filename, mode);
        DEBUG_MESSAGE( dumpOne, "           STEP 2              ( '%s', '%s' )[%d]", utf8name, mode, (counter++) );
        g_free(filename);
        DEBUG_MESSAGE( dumpOne, "           STEP 3              ( '%s', '%s' )[%d]", utf8name, mode, (counter++) );
        filename = 0;
    }
#else
    Glib::ustring how( mode );
    how.append("b");
    DEBUG_MESSAGE( dumpOne, "   calling is_os_wide()       ( '%s', '%s' )[%d]", utf8name, mode, (counter++) );

    fp = g_fopen(utf8name, how.c_str());
#endif

    DEBUG_MESSAGE( dumpOne, "leaving fopen_utf8name( '%s', '%s' )[%d]", utf8name, mode, (counter++) );

    return fp;
}
示例#3
0
// { int32  ver, string desc } = archiver.info()
xmlrpc_value *get_info(xmlrpc_env *env, xmlrpc_value *args, void *user)
{
#ifdef LOGFILE
    LOG_MSG("archiver.info\n");
#endif
    int i;
    const char *config = get_config_name(env);
    if (!config)
        return 0;
#ifdef LOGFILE
    LOG_MSG("config: '%s'\n", config);
#endif
    char description[500];
    sprintf(description,
            "Channel Archiver Data Server V%d,\n"
            "for " EPICS_VERSION_STRING ",\n"
            "built " __DATE__ ", " __TIME__ "\n"
            "from sources for version " ARCH_VERSION_TXT "\n"
            "Config: '%s'\n",
            ARCH_VER, config);
    AutoXmlRpcValue how(xmlrpc_build_value(env, "(sssss)",
                                           "raw",
                                           "spreadsheet",
                                           "average",
                                           "plot-binning",
                                           "linear"));
    if (env->fault_occurred)
        return 0;
    // 'status': array of all status string.
    AutoXmlRpcValue element;
    AutoXmlRpcValue status(xmlrpc_build_value(env, "()"));
    if (env->fault_occurred)
        return 0;
    for (i=0; i<=lastEpicsAlarmCond; ++i)
    {
        element = xmlrpc_build_value(env, "s", epicsAlarmConditionStrings[i]);
        xmlrpc_array_append_item(env, status, element);
        if (env->fault_occurred)
            return 0;
    }
    // 'severity': array of all severity strings.
    AutoXmlRpcValue severity(xmlrpc_build_value(env, "()"));
    for (i=0; i<=lastEpicsAlarmSev; ++i)
    {
        element = xmlrpc_build_value(env, "{s:i,s:s,s:b,s:b}",
                                     "num", (xmlrpc_int32)i,
                                     "sevr", epicsAlarmSeverityStrings[i],
                                     "has_value", (xmlrpc_bool) 1,
                                     "txt_stat", (xmlrpc_bool) 1);
        xmlrpc_array_append_item(env, severity, element);
        if (env->fault_occurred)
            return 0;
    }
    // ... including the archive-specific ones.
    element = xmlrpc_build_value(env, "{s:i,s:s,s:b,s:b}",
                                 "num", (xmlrpc_int32)ARCH_EST_REPEAT,
                                 "sevr", "Est_Repeat",
                                 "has_value", (xmlrpc_bool) 1,
                                 "txt_stat", (xmlrpc_bool) 0);
    xmlrpc_array_append_item(env, severity, element);
    element = xmlrpc_build_value(env, "{s:i,s:s,s:b,s:b}",
                                 "num", (xmlrpc_int32)ARCH_REPEAT,
                                 "sevr", "Repeat",
                                 "has_value", (xmlrpc_bool) 1,
                                 "txt_stat", (xmlrpc_bool) 0);
    xmlrpc_array_append_item(env, severity, element);
    element = xmlrpc_build_value(env, "{s:i,s:s,s:b,s:b}",
                                 "num", (xmlrpc_int32)ARCH_DISCONNECT,
                                 "sevr", "Disconnected",
                                 "has_value", (xmlrpc_bool) 0,
                                 "txt_stat", (xmlrpc_bool) 1);
    xmlrpc_array_append_item(env, severity, element);
    element = xmlrpc_build_value(env, "{s:i,s:s,s:b,s:b}",
                                 "num", (xmlrpc_int32)ARCH_STOPPED,
                                 "sevr", "Archive_Off",
                                 "has_value", (xmlrpc_bool) 0,
                                 "txt_stat", (xmlrpc_bool) 1);
    xmlrpc_array_append_item(env, severity, element);
    element = xmlrpc_build_value(env, "{s:i,s:s,s:b,s:b}",
                                 "num", (xmlrpc_int32)ARCH_DISABLED,
                                 "sevr", "Archive_Disabled",
                                 "has_value", (xmlrpc_bool) 0,
                                 "txt_stat", (xmlrpc_bool) 1);
    xmlrpc_array_append_item(env, severity, element);
    // Overall result.
    return xmlrpc_build_value(env, "{s:i,s:s,s:V,s:V,s:V}",
                              "ver", ARCH_VER,
                              "desc", description,
                              "how", how.get(),
                              "stat", status.get(),
                              "sevr", severity.get());
}
示例#4
0
文件: man.c 项目: SylvestreG/bitrig
int
main(int argc, char *argv[])
{
	extern char *optarg;
	extern int optind;
	TAG *searchlist;
	glob_t pg;
	size_t len;
	int ch, f_cat, f_how, found;
	const char *pager, *p_path;
	char **ap, *cmd, *machine, *p, *p_add, *sflag;
	char *conffile;

	if (argv[1] == NULL && strcmp(basename(__progname), "help") == 0) {
		static char *nargv[3];
		nargv[0] = "man";
		nargv[1] = "help";
		nargv[2] = NULL;
		argv = nargv;
		argc = 2;
	}

	machine = sflag = NULL;
	f_cat = f_how = 0;
	conffile = p_add = NULL;
	p_path = (const char *)NULL;
	while ((ch = getopt(argc, argv, "aC:cfhkM:m:P:s:S:w-")) != -1)
		switch (ch) {
		case 'a':
			f_all = 1;
			break;
		case 'C':
			conffile = optarg;
			break;
		case 'c':
		case '-':		/* Deprecated. */
			f_cat = 1;
			break;
		case 'h':
			f_how = 1;
			break;
		case 'm':
			p_add = optarg;
			break;
		case 'M':
		case 'P':		/* Backward compatibility. */
			p_path = optarg;
			break;
		case 's':		/* SVR4 compatibility. */
			sflag = optarg;
			break;
		case 'S':
			machine = optarg;
			break;
		/*
		 * The -f and -k options are backward compatible
		 * ways of calling whatis(1) and apropos(1).
		 */
		case 'f':
			jump(argv, "-f", "whatis");
			/* NOTREACHED */
		case 'k':
			jump(argv, "-k", "apropos");
			/* NOTREACHED */
		case 'w':
			f_where = 1;
			break;
		case '?':
		default:
			usage();
		}
	argc -= optind;
	argv += optind;

	if (!*argv)
		usage();

	if (!f_cat && !f_how && !f_where) {
		if (!isatty(1))
			f_cat = 1;
		else {
			pager = getenv("MANPAGER");
			if (pager == NULL || *pager == '\0')
				pager = getenv("PAGER");
			if (pager == NULL || *pager == '\0')
				pager = _PATH_PAGER;
		}
	}

	/* Read the configuration file. */
	config(conffile);

	/*
	 * 1: If the user specified a section,
	 *    use the section list from the configuration file.
	 *    Otherwise, fall back to the default list or to an empty list.
	 */
	if (sflag && (section = getlist(sflag)) == NULL)
		errx(1, "unknown manual section `%s'", sflag);
	else if (argv[1] && (section = getlist(*argv)) != NULL)
		++argv;

	searchlist = section;
	if (searchlist == NULL)
		searchlist = getlist("_default");
	if (searchlist == NULL)
		searchlist = addlist("_default");

	/*
	 * 2: If the user set the -M option or defined the MANPATH variable,
	 *    clear what we have and take the user's list instead.
	 */
	if (p_path == NULL)
		p_path = getenv("MANPATH");

	if (p_path) {
		clearlist(searchlist);
		parse_path(searchlist, p_path);
	}

	/*
	 * 3: If the user set the -m option, insert the user's list before
	 *    whatever list we have.
	 */
	if (p_add)
		parse_path(searchlist, p_add);

	/*
	 * 4: Append the _subdir list where appropriate,
	 *    and always append the machine type.
	 */
	if (machine || (machine = getenv("MACHINE"))) {
		/* Avoid mangling argv/environment. */
		if ((machine = strdup(machine)) == NULL)
			err(1, NULL);
		for (p = machine; *p; ++p)
			*p = tolower(*p);
	} else
		machine = MACHINE;

	append_subdirs(searchlist, machine);

	/*
	 * 5: Search for the files.  Set up an interrupt handler, so the
	 *    temporary files go away.
	 */
	(void)signal(SIGINT, onsig);
	(void)signal(SIGHUP, onsig);

	sigemptyset(&blocksigs);
	sigaddset(&blocksigs, SIGINT);
	sigaddset(&blocksigs, SIGHUP);

	memset(&pg, 0, sizeof(pg));
	for (found = 0; *argv; ++argv)
		if (manual(*argv, searchlist, &pg))
			found = 1;

	/* 6: If nothing found, we're done. */
	if (!found) {
		(void)cleanup(0);
		exit (1);
	}

	/* 7: If it's simple, display it fast. */
	if (f_cat) {
		for (ap = pg.gl_pathv; *ap != NULL; ++ap) {
			if (**ap == '\0')
				continue;
			cat(*ap);
		}
		exit (cleanup(0));
	}
	if (f_how) {
		for (ap = pg.gl_pathv; *ap != NULL; ++ap) {
			if (**ap == '\0')
				continue;
			how(*ap);
		}
		exit(cleanup(0));
	}
	if (f_where) {
		for (ap = pg.gl_pathv; *ap != NULL; ++ap) {
			if (**ap == '\0')
				continue;
			(void)puts(*ap);
		}
		exit(cleanup(0));
	}

	/*
	 * 8: We display things in a single command; build a list of things
	 *    to display.
	 */
	for (ap = pg.gl_pathv, len = strlen(pager) + 1; *ap != NULL; ++ap) {
		if (**ap == '\0')
			continue;
		len += strlen(*ap) + 1;
	}
	if ((cmd = malloc(len)) == NULL) {
		warn(NULL);
		(void)cleanup(0);
		exit(1);
	}
	p = cmd;
	len = strlen(pager);
	memcpy(p, pager, len);
	p += len;
	*p++ = ' ';
	for (ap = pg.gl_pathv; *ap != NULL; ++ap) {
		if (**ap == '\0')
			continue;
		len = strlen(*ap);
		memcpy(p, *ap, len);
		p += len;
		*p++ = ' ';
	}
	*--p = '\0';

	/* Use system(3) in case someone's pager is "pager arg1 arg2". */
	(void)system(cmd);

	exit(cleanup(0));
}
示例#5
0
void main()
{
	int sss,q,ll,gd=DETECT,p,gm,area,a=(450-(50*5)),d,cat=77,ch,dh,eh,t1,t2,t12,t22,len,cc,hh;
	char *str,*str1,*tim;
	initgraph(&gd,&gm,"");
	p=1;
	front();
	dr:
	viewport();
	q=menu();
	if(q==3)
	{
	     arun:	hh=help();
		if(hh==1)
		{
			how();
			goto arun;
		}
		if(hh==2)
		{
			select();
			goto arun;
		}
		if(hh==3)
		{
			credit();
			goto arun;
		}
		if(hh==4)
		{
			design();
			goto arun;
		}
		if(hh==5)
			goto dr;
	}
	if(q==2)
	{
	 rr:
		ll=sivakumar();
	       if(ll==1)
	       {
			p=m2();

			goto rr;
	       }
	       if(ll==2)
	       {
			a=speed();
			viewport();
			goto rr;
	       }
	       if(ll==3)
	       {
			topscore();
			goto rr;
		}
	       if(ll==4)
		    goto dr;
	}
	if(q==4)
		exit(0);
      if(q==1)
      {
	names();
	hide();
	viewport();
	x[0]=85;
	x[1]=70;
	x[2]=55;
	x[3]=40;
	y[0]=y[1]=y[2]=y[3]=35;
	setcolor(4);
	rectangle(24,19,626,396);
	ra();
	setcolor(15);
	setfillstyle(1,10);
	bar(32,32,43,43);
	area=imagesize(30,30,45,45);
	buff=malloc(area);
	getimage(30,30,45,45,buff);
	putimage(30,30,buff,XOR_PUT);
	setpos(0,0);
	setfillstyle(1,0);
	bar(100,100,500,350);
	prakash(p);
	level=p;
	putimage(40,35,buff,XOR_PUT);
	putimage(55,35,buff,XOR_PUT);
	putimage(70,35,buff,XOR_PUT);
	putimage(85,35,buff,XOR_PUT);
	textcolor(GREEN+BLINK);
	len=0;
	status("Game Play: Arrow keys       Menu: Esc         Pause (or) Play: Others key");
	while(1)
	{

	sss=getpixel(5,5);
	if(sss!=0);
	{
		setfillstyle(SOLID_FILL,0);
		bar(0,0,15,15);
	}
		if(((i-4)%11==0)&&(bon==0)&&(len!=(i-4)))
		{
			len=(i-4);
			gettime(&t);
			bonous();
				bon=1;
			t1=t.ti_sec;
			cc=10;
		}
		gettime(&t);
		if((t1!=t.ti_sec)&&(bon==1))
		{
			cc--;
			t1=t.ti_sec;
			itoa(cc,tim,10);
			setfillstyle(SOLID_FILL,0);
			bar(470,0,530,18);
			outtextxy(500,0,tim);

		}
		if((cc==0)&&(bon==1))
		{
			putimage(xc1,yc1,f2,XOR_PUT);
			bar(470,0,530,18);
			bon=0;
		}
		gotoxy(68,1);
		setcolor(6);
	       itoa(score,str,10);
	       setfillstyle(1,0);
	       settextstyle(3,0,1);
	       if(strcmp(str,str1)!=0)
	       {    bar(80,400,350,450);
		    outtextxy(100,420,"Score : ");
		    outtextxy(180,420,str);
		    strcpy(str1,str);
	       }
		if(kbhit())
		{
		       //	ch=getch();
			dh=getch();
			cat=dh;
		}
		else
		{
			arrange(x,y,i);
			if(set==0)
				food();
			if(cat!=dupli)
				cat=lock(cat,dupli);
			switch(cat)
			{
				case 72:
					     if(y[1]==20)
						  y[0]=380;
					     else
						  y[0]=y[1]-15;
					     x[0]=x[1];
					     d=getpixel(x[0]+8,y[0]+8);
					     if((d==10)||(d==14))
						doctor();
					     if((d==4)&&(bon==1))
					     {
						i++;
						sound(1000);
						delay(90);
						nosound();
						bon=0;
						score+=(cc*10);
					       putimage(xc1,yc1,f2,XOR_PUT);
					       putimage(x[0],y[0],buff,XOR_PUT);
					       putimage(x[i],y[i],buff,XOR_PUT);
					       setfillstyle(SOLID_FILL,0);
						bar(470,0,530,18);
					     }
					     else if(d==15)
					     {
						i++;
						set=0;
						sound(800);
						delay(40);
						score+=bb;
						nosound();
						putimage(x[0],y[0],buff,XOR_PUT);
					     }
					     else
					     {
						 putimage(x[0],y[0],buff,XOR_PUT);
						 putimage(x[i-1],y[i-1],buff,XOR_PUT);
					     }
						delay(a);
				     break;
				case 80:
				     if(y[1]==380)
					  y[0]=20;
				     else
					  y[0]=y[1]+15;
				     x[0]=x[1];
				      d=getpixel(x[0]+8,y[0]+8);
				      if((d==10)||(d==14))
					doctor();
					     if((d==4)&&(bon==1))
					     {
						i++;
						sound(1000);
						delay(90);
						nosound();
						bon=0;
						score+=(cc*10);
					       putimage(xc1,yc1,f2,XOR_PUT);
					       putimage(x[0],y[0],buff,XOR_PUT);
					       putimage(x[i],y[i],buff,XOR_PUT);
					       setfillstyle(SOLID_FILL,0);
						bar(470,0,530,18);
					     }
				      else if(d==15)
					     {
						i++;
						score+=bb;
						sound(800);
						delay(40);
						set=0;
						nosound();
						putimage(x[0],y[0],buff,XOR_PUT);
					     }
				       else
				      {
					     putimage(x[0],y[0],buff,XOR_PUT);
					     putimage(x[i-1],y[i-1],buff,XOR_PUT);
				      }
				     delay(a);
				     break;
				case 75:
				     if(x[1]==25)
					  x[0]=610;
				     else
					  x[0]=x[1]-15;
				     y[0]=y[1];
				     d=getpixel(x[0]+8,y[0]+8);
					if((d==10)||(d==14))
						doctor();
					     if((d==4)&&(bon==1))
					     {
						i++;
						sound(1000);
						delay(90);
						nosound();
						bon=0;
						score+=(cc*10);
					       putimage(xc1,yc1,f2,XOR_PUT);
					       putimage(x[0],y[0],buff,XOR_PUT);
					       putimage(x[i],y[i],buff,XOR_PUT);
					       setfillstyle(SOLID_FILL,0);
						bar(470,0,530,18);
					     }
					else if(d==15)
					  {
						i++;
						sound(800);
						delay(40);
						set=0;
						nosound();
						score+=bb;
						putimage(x[0],y[0],buff,XOR_PUT);
					  }
					  else
					  {
					     putimage(x[0],y[0],buff,XOR_PUT);
					     putimage(x[i-1],y[i-1],buff,XOR_PUT);
					  }
				      delay(a);
				 break;
				case 77:
				     if(x[1]==610)
					  x[0]=25;
				     else
					  x[0]=x[1]+15;
				     y[0]=y[1];
				     d=getpixel(x[0]+8,y[0]+8);
				      if((d==10)||(d==14))
					doctor();
					    if((d==4)&&(bon==1))
					     {
						i++;
						sound(1000);
						delay(90);
						nosound();
						bon=0;
						score+=(cc*10);
					       putimage(xc1,yc1,f2,XOR_PUT);
					       putimage(x[0],y[0],buff,XOR_PUT);
					       putimage(x[i],y[i],buff,XOR_PUT);
					       setfillstyle(SOLID_FILL,0);
						bar(470,0,530,18);
					     }
					else if(d==15)
					    {
						i++;
						set=0;
						sound(800);
						delay(40);
						score+=bb;
						nosound();
						putimage(x[0],y[0],buff,XOR_PUT);
					     }
					     else
					     {
						     putimage(x[0],y[0],buff,XOR_PUT);
						     putimage(x[i-1],y[i-1],buff,XOR_PUT);
					     }
				       delay(a);
					break;
				case 27:
					goto dx;
				//	break;
			}
			dupli=cat;
		}
    }
     }
     dx:
     call();
}