Esempio n. 1
0
void new_lookup_com(int i) {
  char file[128];
  int index, ok, status;
  double xlo, xhi;
  int npts;
  char newform[80];

  index = select_table();
  if (index == -1)
    return;
  if (i == 1) {
    view_table(index);
    return;
  }
  if (my_table[index].flag == 1) {
    strcpy(file, my_table[index].filename);
    status = file_selector("Load table", file, "*.tab");
    if (status == 0)
      return;
    ok = load_table(file, index);
    if (ok == 1)
      strcpy(my_table[index].filename, file);
  }
  if (my_table[index].flag == 2) {
    npts = my_table[index].n;

    xlo = my_table[index].xlo;
    xhi = my_table[index].xhi;
    strcpy(newform, my_table[index].filename);
    new_int("Auto-evaluate? (1/0)", &my_table[index].autoeval);
    new_int("NPts: ", &npts);
    new_float("Xlo: ", &xlo);
    new_float("Xhi: ", &xhi);
    new_string("Formula :", newform);
    create_fun_table(npts, xlo, xhi, newform, index);
  }
}
Esempio n. 2
0
/**
 * <A short one line description>
 *
 * <Longer description>
 * <May span multiple lines or paragraphs as needed>
 *
 * @param  Description of method's or function's input parameter
 * @param  ...
 * @return Description of the return value
 */
int main(int argc, char* argv[])
{
	int ch;
    /* keypress character */
	printf("Welcome to poorman's db, type ? for help\n");
	printf(TABLE_OPERATIONS_PROMPT);
    printf("keypress = %08x\n ", ch);
	
	create_table();
	return 0;
	while((ch = getchar()) != EOF){
		switch (ch)
		{
			case 0x31:
				create_table();			
				break;
			case 0x32:
				delete_table();			
				break;
			case 0x33:
				list_tables();			
				break;
			case 0x34:
				select_table();
				break;
			case 0x35:
				return 0;
				break;
			default:
				printf("Command not recognized.\n Type ? for help\n");
				continue;
		}
	}

	return 0;
	
#if 0
	struct record rec;

	sprintf(rec.field[3], "onurkom\n");
	
    printf("--->%s\n", rec.field[3]);
	//printf("size of fx is %d\n", sizeof(rec.field));
    return 0;

#endif
#if 0
	char fx[4][16] = {"1asdasd\n", "2adsasdas\n", "3asdsadas\n", "4asdadasd\n"};
	struct record rec;
    sprintf(fx[3], "onur\n");
   printf("--->%s\n", fx[3]);
	printf("size of fx is %d\n", sizeof(fx));
	char S[10][11];
	int i,j,k;
	char A;
	for (i=0;i<=9;i++){
		scanf ("%s",A);
		for (j=0;j<=10;j++)
		{
			S[i][j]=A;
		}
	}

	for (i=0;i<=9;i++){
		for (j=0;j<=10;j++)
		{
			printf("i=%d j=%d data=%s\n", i,j,S[i][j]);
		}
	}
#endif
#if 0	
	int i,j,k=0;

	for(i=0; i<4; i++)
		for(j=0; j<4; j++)
		{
			sprintf((rec.field[j][i]), "y%d\n", k);
			printf("field %d %d is now %d\n", i,j,k);
			k++;
		}
	
	for(i=0; i<4; i++)

		for(j=0; j<4; j++)
		{
			printf("i=%d j=%d field=%s\n", i,j,rec.field[i][j]);
		}
#endif
	printf("here\n");
	return 0;
}