Exemplo n.º 1
0
void game_log_move(game_description *game, packet_figure_move *move){
	if(white_team_turn(game)){
		fprintf(game->game_log, "%3d. %c%d:%c%d ", game->moves_made/2 + 1,
			num_to_char((int)(move->from_letter+1)), move->from_number+1,
			num_to_char((int)(move->to_letter+1)), move->to_number+1);
		fflush(game->game_log);
	} else {
		fprintf(game->game_log, "%c%d:%c%d\n", 
			num_to_char((int)(move->from_letter+1)), move->from_number+1,
			num_to_char((int)(move->to_letter+1)), move->to_number+1);
		fflush(game->game_log);
	}
}
Exemplo n.º 2
0
int main(int argc, char **argv)
{
  int c;

  c = getchar();

  while (c != EOF)
  {
    putchar(num_to_char(last_four(c)));    /* MSB first */
    putchar(num_to_char(first_four(c)));

    c = getchar();
  }

  return 0;
}
Exemplo n.º 3
0
void  OSStart (void)
{
    INT8U y;
    INT8U x;
#ifdef __DEBUG__
	INT8U debug_num[] = {'0','x','0','0','0','0','0','0','0','0',0};
#endif

    if (OSRunning == FALSE) {
        y             = OSUnMapTbl[OSRdyGrp];        /* Find highest priority's task priority number   */
        x             = OSUnMapTbl[OSRdyTbl[y]];
        OSPrioHighRdy = (INT8U)((y << 3) + x);
        OSPrioCur     = OSPrioHighRdy;
        OSTCBHighRdy  = OSTCBPrioTbl[OSPrioHighRdy]; /* Point to highest priority task ready to run    */
        OSTCBCur      = OSTCBHighRdy;
#ifdef __DEBUG__
	putc_string("\n\r");
	putc_string("OSStartHighRdy() enter");
	putc_string("\n\r");
	putc_string("OSPrioHighRdy:  ");
	num_to_char(OSPrioHighRdy,debug_num);
	putc_string(debug_num);
#endif
        OSStartHighRdy();                            /* Execute target specific code to start task     */
    }
}
Exemplo n.º 4
0
int main()
{
	int n,i=0;
	int tmp;
	scanf("%d",&n);
	getchar();
	while(i<n)
	{
		gets(in[i]);
		i++;
	}
	for(i=0;i<n;i++)
	{
		memset(ans,0,10);
		if(isNum(in[i]))
		{
			tmp = GetNum(in[i]);
			num_to_char(tmp,ans);
			printf("%s\n",ans);				
		}
		else
		{
			tmp = mars_to_earth(in[i]);
			printf("%d\n",tmp);
		}
	}
	return 0;
}
Exemplo n.º 5
0
static int ath_iw_gethwaddr(struct net_device *dev, struct iw_request_info *info, void *w, char *extra)
{
    struct iw_point *wri = (struct iw_point *)w;
    char *buf = extra;
    int i, j = 0;

    for ( i = 0; i < IEEE80211_ADDR_LEN; i++ ) {
        buf[j++] = num_to_char(dev->dev_addr[i] >> 4);
        buf[j++] = num_to_char(dev->dev_addr[i] & 0xF);

        if ( i < IEEE80211_ADDR_LEN - 1 )
            buf[j++] = ':';
        else
            buf[j++] = '\0';
    }

    wri->length = (IEEE80211_ADDR_LEN * 3) - 1;

    return 0;
}
Exemplo n.º 6
0
void print_lmers(struct llist **headptr, int *sortedfreq, int *sortedocc, long *sortedindex, int ngoodlmers)
{
  int n, x;
  char lmer[l];
  FILE *fp;

  if( (fp = fopen(LMER_TABLE_FILE, "w")) == NULL)
  {
    fprintf(stderr,"Could not open file %s\n", LMER_TABLE_FILE);  exit(1);
  }


  for(n=0; n<ngoodlmers; n++)
  {
    for(x=0; x<l; x++) lmer[x] = sequence[sortedocc[n]+x];
    reverse_if_necessary(lmer);
    for(x=0; x<l; x++) fprintf(fp,"%c",num_to_char(lmer[x]));
    fprintf(fp,"\t%d\t%d\n",sortedfreq[n],sortedocc[n]);
  }
  fclose(fp);
}