bool DirReader::openFolder(const std::string &str) { file = NULL; folder = str; if ((directory = opendir(str.c_str()))) genList(); directory = opendir(str.c_str()); return (!!(directory)); }
// 初期化データの生成 void genData(int idx) { int root = syGetRoot(); int typ = syGetType(root); int dim = ntGetDim(idx); if (typ==SyLIST) genList(root,dim); // 初期化された配列 else if (typ==SyARRY) genArray(root); // 非初期化配列[array(n1,...)] vmNam(idx); // 次のような出力をする genDW(root); // Name DW xx }
int main (int argc,char *argv[]) { int i, n; srand((unsigned) time(NULL)); out = fopen("out-list.txt", "w+"); for(i = 0, n = 0; argv[1][i]!='\0'; i++){ n+= argv[1][i] - '0'; n *= 10; } n /= 10; genList(n); return 0; }
void genList(int n){ int v; if(n==0){ fprintf(out, "Nil ()"); return; } v = (rand() % 1000) -400; if(v>=0) fprintf(out, "Some (%d, ", v); else fprintf(out, "Some (~%d, ", 0-v); genList(n-1); fprintf(out, ") "); }
void executeQSort(int x, int y, int seed) { char *list = (char*)malloc(sizeof(char)*x); genList((char*)list, x,y, seed); qsort(list,x, 0, x-1); free(list); }