예제 #1
0
int main(void)
{
   char numString[MAX_STRING]; 
   int numArray[MAX_STRING];
   int graph[MAX_MATRIX][MAX_MATRIX];
   int limit, i;
   char N[10];

   /* clear the graph */
   clearGraph(graph);

   while (fgets(N, 10, stdin) != NULL)
   {
      int n = atoi(N);
      if (n == 0)
         break;

      for (i = 0; i < n; i++)
      {
         getNumString(numString);
         limit = split(numString, numArray);
         if (numArray[0] == 0)
            break;
         createGraph(numArray, graph);
      }

      /* find out how many cirtical nodes the graph have */
      findCriticalNode(graph, limit);
      clearGraph(graph);
   }

   return 0;
}
예제 #2
0
int LS_get_accel_string(void)
{
    RTC_TIME* time;
    ACC_SENSOR* sensor;
    
    time = &LS_accel_buffer[LS_accel_queue_out_count].time;
    sensor = &LS_accel_buffer[LS_accel_queue_out_count].sensor_data;
    
    LS_accel_string[0] = '[';
	LS_accel_string_size = 1;
	LS_accel_string_size += getUNumString(sensor->CurSeq, &LS_accel_string[1]);
	LS_accel_string[LS_accel_string_size++] = ']';
	LS_accel_string[LS_accel_string_size++] = ' ';
	LS_accel_string_size += getNumString(time->Hour, &LS_accel_string[LS_accel_string_size]);
	LS_accel_string[LS_accel_string_size++] = ':';
	LS_accel_string_size += getNumString(time->Minute, &LS_accel_string[LS_accel_string_size]);
	LS_accel_string[LS_accel_string_size++] = ':';
	LS_accel_string_size += getNumString(time->Second, &LS_accel_string[LS_accel_string_size]);
	LS_accel_string[LS_accel_string_size++] = '.';
	LS_accel_string_size += getNumString(time->MSecond, &LS_accel_string[LS_accel_string_size]);
	LS_accel_string[LS_accel_string_size++] = ' ';
	LS_accel_string_size += getNumString(sensor->Acc[ACC_X_AXIS].Data, &LS_accel_string[LS_accel_string_size]);
	LS_accel_string[LS_accel_string_size++] = ' ';
	LS_accel_string_size += getNumString(sensor->Acc[ACC_Y_AXIS].Data, &LS_accel_string[LS_accel_string_size]);
	LS_accel_string[LS_accel_string_size++] = ' ';
	LS_accel_string_size += getNumString(sensor->Acc[ACC_Z_AXIS].Data, &LS_accel_string[LS_accel_string_size]);
	LS_accel_string[LS_accel_string_size++] = '\n';
	LS_accel_string[LS_accel_string_size] = 0;
	
    return 1;
}
예제 #3
0
char *getNumString(EWorkCmd wca[])
{
	if (wca[0] == 0)
		return "";
	if (wca[1] == 0)
		return getNumString(wca[0]);
	else
	{
		char *str = new char[SHORT_STRING];
		strcpy(str, getNumString(wca[0]));
		int i=1;
		while ((i<=MAX_COMMANDS) && wca[i])
		{
			strcat(str, ",");
			strcat(str, getNumString(wca[i]));
			i++;
		}
		return str;
	}
}