bool Wire2Movie(const b2msg::Movie& wire, struct Movie::MovieInfo& mov) { const b2msg::PlotInfo& info = wire.info(); mov.fractal = Fractal::FractalCommon::registry.get(info.fractal().name()); mov.palette = DiscretePalette::all.get(info.palette().name()); if (!mov.palette) mov.palette = SmoothPalette::all.get(info.palette().name()); mov.width = info.width(); mov.height = info.height(); mov.draw_hud = info.hud(); mov.antialias = info.antialias(); mov.preview = info.preview(); mov.fps = wire.fps(); mov.points.clear(); for (int i=0; i<wire.frames_size(); i++) { const b2msg::KeyFrame& kf = wire.frames(i); const b2msg::Frame& ff = kf.frame(); Fractal::Point cen, siz; Wire2Point(ff.centre(), cen); Wire2Point(ff.size(), siz); Movie::KeyFrame mkf(cen, siz, kf.hold_frames(), kf.speed_zoom(), kf.speed_translate()); mov.points.push_back(mkf); } return (mov.fractal && mov.palette); }
void mkf(int idx, int p) { int i; int last; last = (idx == len - 1); if (last) { buf[len] = '\0'; for (i = p * asplit; i < (p + 1) * asplit; i++) { buf[idx] = alpha[i]; if (dflag) { if (vflag) printf("[%d] mkdir %s\n", pid, buf); if (!nflag) { if (mkdir(buf, 0777)<0) { perror("mkdir"); exit(1); } } } else { if (vflag) printf("[%d] touch %s\n", pid, buf); if (!nflag) { int f=creat(buf, 0666); if (f<0) { perror("creat"); exit(1); } if (close(f)) { perror("close"); exit(1); } } } } } else { for (i = 0; i < asize; i++) { buf[idx] = alpha[i]; mkf(idx + 1, p); } } }
//====================>>> makefileMaker::saveMakefile <<<========================= void makefileMaker::saveMakefile() { bool isBorland = false; // set up Borland stuff char resName[50]; resName[0] = 0; libsBCC.erase(); //builds the file named makefile using infos stored in project cmdw = ((videApp*)theApp)->GetMsgWindow(); // Now, change directory, drive int ix = strlen(makeName); while (ix > 0) { if (makeName[ix] == '\\' || makeName[ix] == '/') { break; } --ix; } if (ix > 0) { char dirPath[maxFileNameSize]; vOS vos; strcpy(dirPath, makeName); // copy the makefile name makeName[ix] = 0; // strip the name if (dirPath[1] == ':') // a drive { int drive = dirPath[0]; // need to change drive, too. if (drive > 'a') drive = drive - ' '; vos.vChDrive(drive-'A'); } vos.vChDir(dirPath); // change dir } ofstream mkf(makeName); // where to write makefile //header char buff[256]; char date[20]; char time[40]; vGetLocalTime(time); vGetLocalDate(date); isBorland = (stricmp(cc,"BCC32") == 0); if (isBorland) cmdw->AddLine("Building Borland Makefile..."); else cmdw->AddLine("Building Makefile -- Running compiler to generate dependencies..."); mkf << "#=======================================================================\n"; mkf << "#@V@:Note: File automatically generated by VIDE: "; mkf << "(" << time << " " << date << ") (" << cc << ").\n"; mkf << "# This file regenerated each time you run VIDE, so save under a\n"; mkf << "# new name if you hand edit, or it will be overwritten.\n"; mkf << "#=======================================================================\n\n"; mkf << "# Standard defines:\n"; if (isBorland) { #ifdef V_VersionWindows mkf << ".AUTODEPEND\n\n" << "# Borland C++ tools\n" << "IMPLIB\t= $(BCCROOT)\\bin\\Implib\n" << "ILINK32\t= $(BCCROOT)\\bin\\ILink32\n" << "TLIB\t= $(BCCROOT)\\bin\\TLib\n" << "BRC32\t= $(BCCROOT)\\bin\\Brc32\n" << "TASM32\t= $(BCROOT)\\bin\\Tasm32\n" << "CC \t= $(BCCROOT)\\bin\\" << cc << "\n\n"; if (*((videApp*)theApp)->getBCCPath()) mkf << "BCCROOT\t= " << ((videApp*)theApp)->getBCCPath() << "\n\n"; else mkf << "BCCROOT\t= C:\\borland\\bcc55\n\n"; #endif } else // gnu stuff { mkf << "CC \t=\t" << cc << "\n\n"; mkf << "WRES\t=\twindres\n\n"; } // HomeV mkf << "HOMEV\t=\t" << fixBackSlash(homeV,isBorland) << endl; //Dirs if (isBorland) mkf << "VPATH\t=\t$(HOMEV)\\include" << endl; else mkf << "VPATH\t=\t$(HOMEV)/include" << endl; mkf << "oDir\t=\t" << fixBackSlash(ObjDir,isBorland) << endl; //Obj Dir mkf << "Bin\t=\t" << fixBackSlash(BinDir,isBorland) << endl; //Bin Dir mkf << "Src\t=\t" << fixBackSlash(SrcDir, isBorland) << endl; //Src Dir mkf << "libDirs\t="; int nxtld = libDirs.size(); if (isBorland && nxtld > 0) mkf << "\t-L"; for (int ixx = 0 ; ixx < nxtld ; ++ixx) { if (isBorland) // put out ; separated list { mkf << fixBackSlash(libDirs.list[ixx],isBorland); if (ixx + 1 < nxtld) mkf << ";"; } else { mkf << "\t-L" << fixBackSlash(libDirs.list[ixx],isBorland); if (ixx + 1 < nxtld) mkf << " \\"; mkf << endl; } } if (isBorland) mkf << endl; mkf << endl; mkf << "incDirs\t="; int nxtid = incDirs.size(); if (isBorland && nxtid > 0) mkf << "\t-I"; for (int ixa = 0 ; ixa < nxtid ; ++ixa) { if (isBorland) // put out ; separated list { mkf << fixBackSlash(incDirs.list[ixa],isBorland); if (ixa + 1 < nxtid) mkf << ";"; } else { mkf << "\t-I" << fixBackSlash(incDirs.list[ixa],isBorland); if (ixa + 1 < nxtid) mkf << " \\"; mkf << endl; } } if (isBorland) mkf << endl; mkf << endl; //Libs if (isBorland) { mkf << "LIBS\t=\t" << fixBCCLibs() << endl; } else mkf << "LIBS\t=\t" << Libs << endl; //C_FLAGS & paths to includes mkf << "C_FLAGS\t=\t" << fixBackSlash(cFlags,isBorland); //defines int nxtcd = curDefs.size(); for (int ixb = 0 ; ixb < nxtcd ; ++ixb) { mkf << "\\\n\t" << curDefs.list[ixb]; } mkf << endl << endl; //sources int nxtof = objFiles.size(); mkf << "SRCS\t="; for (int ixc = 0 ; ixc < nxtof ; ++ixc) { if (isBorland) mkf << "\\\n\t$(Src)\\" << fixBackSlash(objFiles.list[ixc], isBorland); else mkf << "\\\n\t$(Src)/" << objFiles.list[ixc]; } mkf << endl << endl; //objects mkf << "EXOBJS\t="; for (int ixd = 0 ; ixd < nxtof ; ++ixd) { char *objn; if (isBorland) { objn = fixBackSlash(srcN2ObjN(objFiles.list[ixd],".obj"),isBorland); mkf << "\\" << endl << "\t$(oDir)\\" << objn; if (strstr(objn,".res") != 0) strcpy(resName,srcN2ObjN(objFiles.list[ixd],".obj")); } else { objn = srcN2ObjN(objFiles.list[ixd],".o"); mkf << "\\" << endl << "\t$(oDir)/" << objn; } } mkf << endl << endl; mkf << "ALLOBJS\t=\t$(EXOBJS)" << endl; if (isBorland) { mkf << "BCCJUNK\t=\t*.il* *.csm *.tds\n"; mkf << "ALLBIN\t=\t$(Bin)\\" << exeName << endl; mkf << "ALLTGT\t=\t$(Bin)\\" << exeName << endl << endl; } else { mkf << "ALLBIN\t=\t$(Bin)/" << exeName << endl; mkf << "ALLTGT\t=\t$(Bin)/" << exeName << endl << endl; } // Options mkf << "# User defines:" << endl; int nxtOpts = curOpts.size(); for (int ixe = 0 ; ixe < nxtOpts ; ++ixe) { fixTabs(buff,curOpts.list[ixe]); mkf << buff << endl; } mkf << endl; mkf << "#@# Targets follow ---------------------------------" << endl << endl; //target file //all: mkf << "all:\t$(ALLTGT)" << endl << endl; //objs: mkf << "objs:\t$(ALLOBJS)" << endl << endl; //cleanobjs: mkf << "cleanobjs:\n\trm -f $(ALLOBJS)" << endl << endl; // cleanbin if (isBorland) mkf << "cleanbin:\n\trm -f $(ALLBIN) $(BCCJUNK)" << endl << endl; else mkf << "cleanbin:\n\trm -f $(ALLBIN)" << endl << endl; // clean mkf << "clean:\tcleanobjs cleanbin" << endl << endl; // cleanall mkf << "cleanall:\tcleanobjs cleanbin" << endl << endl; mkf << "#@# User Targets follow ---------------------------------" << endl << endl; for (int ixf = 0 ; userTargets.list[ixf] != 0 ; ++ixf) { fixTabs(buff,userTargets.list[ixf]); mkf << buff << endl; } mkf << endl; mkf << "#@# Dependency rules follow -----------------------------" << endl << endl; //dependency rules // allow user to override the all: target with a #all comment if (!(userTargets.list[0] && strstr(userTargets.list[0],"#all")!=0)) { bool isStaticLib = false; char ext[32]; // check for a static library splitFileName(exeName,0,0,ext); // get the extention if (stricmp(ext,".a") == 0 #ifdef V_VersionWindows || stricmp(ext,".lib") == 0 || stricmp(ext,".LIB") == 0 #endif ) isStaticLib = true; // found a static lib if (isBorland) { #ifdef V_VersionWindows mkf << "$(Bin)\\" << exeName << " : $(EXOBJS)" << endl ; if (isStaticLib) { mkf << " rm -f $<\n"; mkf << " $(TLIB) $< @&&|\n"; for (int ixg = 0 ; objFiles.list[ixg] != 0 ; ixg++) { char* objn = srcN2ObjN(objFiles.list[ixg],".obj"); if (ixg != 0) mkf << " &\n"; mkf << " +$(oDir)\\" << srcN2ObjN(objFiles.list[ixg],".obj"); } mkf << " \n|\n\n"; } else // standard linker commands { mkf << " $(ILINK32) @&&|\n" << " $(LIBS) $(incDirs) $(libDirs) +\n"; mkf << "$(BCC32STARTUP)"; for (int ixg = 0 ; objFiles.list[ixg] != 0 ; ixg++) { char* objn = srcN2ObjN(objFiles.list[ixg],".obj"); if (strstr(objn,".res") == 0) mkf << " +\n$(oDir)\\" << srcN2ObjN(objFiles.list[ixg],".obj"); } mkf << "\n$<,$*\n"; for (int ixa = 0 ; libsBCC.list[ixa] != 0 ; ixa++) { if (ixa != 0) mkf << " +\n"; mkf << libsBCC.list[ixa] ; } if (*resName) // had a .res file mkf << "\n\n$(oDir)\\" << resName << "\n\n|\n"; else mkf << "\n\n\n\n|\n"; } #endif } else // gnu compatible; { mkf << "$(Bin)/" << exeName << ": $(EXOBJS)" << endl; if (isStaticLib) { mkf << "\trm -f $(Bin)/" << exeName << endl; mkf << "\tar cr $(Bin)/" << exeName << " $(EXOBJS)\n"; mkf << "\tranlib $(Bin)" << exeName << endl; } else { mkf << "\t$(CC) -o $(Bin)/" << exeName << " $(EXOBJS) $(incDirs) $(libDirs) $(LIBS)" << endl ; } } } if (isBorland) { // now count on autodependency for borland for (int ixg = 0 ; objFiles.list[ixg] != 0 ; ixg++) { mkf << "$(oDir)\\" << srcN2ObjN(objFiles.list[ixg],".obj"); mkf << " : $(Src)\\" << objFiles.list[ixg] << endl; // check for .rc files if (strstr(objFiles.list[ixg],".rc") != 0 || strstr(objFiles.list[ixg],".RC") != 0) { mkf << " $(BRC32) -r $(incDirs) -fo$@ $(Src)\\" << objFiles.list[ixg] << "\n\n"; } else // it is a .rc file { mkf << " $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\\" << objFiles.list[ixg] << "\n\n"; } } } else { rules.erase(); // fix by chorn - 03/08/99 for (int ixg = 0 ; objFiles.list[ixg] != 0 ; ixg++) { #ifdef V_VersionWindows if (strstr(objFiles.list[ixg],".rc") != 0 || strstr(objFiles.list[ixg],".RC") != 0) { mkf << "\n$(oDir)/" << srcN2ObjN(objFiles.list[ixg],".o"); mkf << " : $(Src)/" << objFiles.list[ixg] << endl; mkf << "\t$(WRES) $(Src)/" << objFiles.list[ixg]; mkf << " $(oDir)/" << srcN2ObjN(objFiles.list[ixg],".o"); mkf << "\n"; } else { findRule(objFiles.list[ixg]); } #else findRule(objFiles.list[ixg]); #endif } int lim = rules.size(); for (int ixh = 0 ; ixh < lim ; ++ixh) { mkf << endl << "$(oDir)/" << rules.list[ixh] << endl; // check for continuation lines while (*(rules.list[ixh]+strlen(rules.list[ixh])-1) == '\\') { ++ixh; if (rules.list[ixh]) mkf << rules.list[ixh] << endl; } mkf << "\t$(CC) $(C_FLAGS) $(incDirs) -c -o $@ $<" << endl; } } mkf.close(); strcpy(buff,makeName); strcat(buff," ("); strcat(buff,time); strcat(buff," "); strcat(buff,date); strcat(buff,") - Makefile saved."); cmdw->AddLine(buff); }
///<param name = "type"> Type of node to generate </param> ///<param name = "*left"> Left subtree </param> ///<param name = "*right"> Right subtree </param> static INPparseNode *mkb(int type, INPparseNode *left, INPparseNode *right) { INPparseNode *p = (INPparseNode *)MALLOC(sizeof(INPparseNode)); int i; if ((right->type == PT_CONSTANT) && (left->type == PT_CONSTANT)) { switch (type) { case PT_TIMES: return (mkcon(left->constant * right->constant)); case PT_DIVIDE: return (mkcon(left->constant / right->constant)); case PT_PLUS: return (mkcon(left->constant + right->constant)); case PT_MINUS: return (mkcon(left->constant - right->constant)); case PT_POWER: return (mkcon(pow(left->constant, right->constant))); } } switch (type) { case PT_TIMES: if ((left->type == PT_CONSTANT) && (left->constant == 0)) return (left); else if ((right->type == PT_CONSTANT) && (right->constant == 0)) return (right); else if ((left->type == PT_CONSTANT) && (left->constant == 1)) return (right); else if ((right->type == PT_CONSTANT) && (right->constant == 1)) return (left); break; case PT_DIVIDE: if ((left->type == PT_CONSTANT) && (left->constant == 0)) return (left); else if ((right->type == PT_CONSTANT) && (right->constant == 1)) return (left); break; case PT_PLUS: if ((left->type == PT_CONSTANT) && (left->constant == 0)) return (right); else if ((right->type == PT_CONSTANT) && (right->constant == 0)) return (left); break; case PT_MINUS: if ((right->type == PT_CONSTANT) && (right->constant == 0)) return (left); else if ((left->type == PT_CONSTANT) && (left->constant == 0)) return (mkf(PTF_UMINUS, right)); break; case PT_POWER: if (right->type == PT_CONSTANT) { if (right->constant == 0) return (mkcon(1.0)); else if (right->constant == 1) return (left); } break; } p->type = type; p->left = left; p->right = right; for (i = 0; i < NUM_OPS; i++) { if (ops[i].number == type) break; } if (i == NUM_OPS) { fprintf(stderr, "Internal Error: bad type %d\n", type); return (NULL); } p->function = ops[i].funcptr; p->funcname = ops[i].name; return (p); }
///<param name = "*p"> Tree to differentiate </param> ///<param name = "varnum"> Number of variable to differentiate WRT </param> static INPparseNode *PTdifferentiate(INPparseNode *p, int varnum) { INPparseNode *arg1 = NULL, *arg2 = NULL, *newp = NULL; /* printf("differentiating: "); printTree(p); printf(" wrt var %d\n", varnum);*/ switch (p->type) { case PT_CONSTANT: newp = mkcon((double)0); break; case PT_VAR: /* Is this the variable we're differentiating wrt? */ if (p->valueIndex == varnum) newp = mkcon((double)1); else newp = mkcon((double)0); break; case PT_PLUS: case PT_MINUS: arg1 = PTdifferentiate(p->left, varnum); arg2 = PTdifferentiate(p->right, varnum); newp = mkb(p->type, arg1, arg2); break; case PT_TIMES: /* d(a * b) = d(a) * b + d(b) * a */ arg1 = PTdifferentiate(p->left, varnum); arg2 = PTdifferentiate(p->right, varnum); newp = mkb(PT_PLUS, mkb(PT_TIMES, arg1, p->right), mkb(PT_TIMES, p->left, arg2)); break; case PT_DIVIDE: /* d(a / b) = (d(a) * b - d(b) * a) / b^2 */ arg1 = PTdifferentiate(p->left, varnum); arg2 = PTdifferentiate(p->right, varnum); newp = mkb(PT_DIVIDE, mkb(PT_MINUS, mkb(PT_TIMES, arg1, p->right), mkb(PT_TIMES, p->left, arg2)), mkb(PT_POWER, p->right, mkcon((double)2))); break; case PT_POWER: /* Two cases... If the power is a constant then we're cool. * Otherwise we have to be tricky. */ if (p->right->type == PT_CONSTANT) { arg1 = PTdifferentiate(p->left, varnum); newp = mkb(PT_TIMES, mkb(PT_TIMES, mkcon(p->right->constant), mkb(PT_POWER, p->left, mkcon(p->right->constant - 1))), arg1); } else { /* This is complicated. f(x) ^ g(x) -> * exp(y(x) * ln(f(x)) ... */ arg1 = PTdifferentiate(p->left, varnum); arg2 = PTdifferentiate(p->right, varnum); newp = mkb(PT_TIMES, mkf(PTF_EXP, mkb(PT_TIMES, p->right, mkf(PTF_LN, p->left))), mkb(PT_PLUS, mkb(PT_TIMES, p->right, mkb(PT_DIVIDE, arg1, p->left)), mkb(PT_TIMES, arg2, mkf(PTF_LN, arg1)))); } break; case PT_FUNCTION: /* Many cases. Set arg1 to the derivative of the function, * and arg2 to the derivative of the argument. */ switch (p->funcnum) { case PTF_ABS: /* sgn(u) */ arg1 = mkf(PTF_SGN, p->left, 0); break; case PTF_SGN: arg1 = mkcon((double) 0.0); break; case PTF_ACOS: /* - 1 / sqrt(1 - u^2) */ arg1 = mkb(PT_DIVIDE, mkcon((double)-1), mkf(PTF_SQRT, mkb(PT_MINUS, mkcon((double)1), mkb(PT_POWER, p->left, mkcon((double)2))))); break; case PTF_ACOSH: /* 1 / sqrt(u^2 - 1) */ arg1 = mkb(PT_DIVIDE, mkcon((double)1), mkf(PTF_SQRT, mkb(PT_MINUS, mkb(PT_POWER, p->left, mkcon((double)2)), mkcon((double)1)))); break; case PTF_ASIN: /* 1 / sqrt(1 - u^2) */ arg1 = mkb(PT_DIVIDE, mkcon((double)1), mkf(PTF_SQRT, mkb(PT_MINUS, mkcon((double)1), mkb(PT_POWER, p->left, mkcon((double)2))))); break; case PTF_ASINH: /* 1 / sqrt(u^2 + 1) */ arg1 = mkb(PT_DIVIDE, mkcon((double)1), mkf(PTF_SQRT, mkb(PT_PLUS, mkb(PT_POWER, p->left, mkcon((double)2)), mkcon((double)1)))); break; case PTF_ATAN: /* 1 / (1 + u^2) */ arg1 = mkb(PT_DIVIDE, mkcon((double)1), mkb(PT_PLUS, mkb(PT_POWER, p->left, mkcon((double)2)), mkcon((double)1))); break; case PTF_ATANH: /* 1 / (1 - u^2) */ arg1 = mkb(PT_DIVIDE, mkcon((double)1), mkb(PT_MINUS, mkcon((double)1), mkb(PT_POWER, p->left, mkcon((double)2)))); break; case PTF_COS: /* - sin(u) */ arg1 = mkf(PTF_UMINUS, mkf(PTF_SIN, p->left)); break; case PTF_COSH: /* sinh(u) */ arg1 = mkf(PTF_SINH, p->left); break; case PTF_EXP: /* exp(u) */ arg1 = mkf(PTF_EXP, p->left, 0); break; case PTF_LN: /* 1 / u */ arg1 = mkb(PT_DIVIDE, mkcon((double)1), p->left); break; case PTF_LOG: /* log(e) / u */ arg1 = mkb(PT_DIVIDE, mkcon((double)M_LOG10E), p->left); break; case PTF_SIN: /* cos(u) */ arg1 = mkf(PTF_COS, p->left); break; case PTF_SINH: /* cosh(u) */ arg1 = mkf(PTF_COSH, p->left); break; case PTF_SQRT: /* 1 / (2 * sqrt(u)) */ arg1 = mkb(PT_DIVIDE, mkcon((double)1), mkb(PT_TIMES, mkcon((double)2), mkf(PTF_SQRT, p->left))); break; case PTF_TAN: /* 1 / (cos(u) ^ 2) */ arg1 = mkb(PT_DIVIDE, mkcon((double)1), mkb(PT_POWER, mkf(PTF_COS, p->left), mkcon((double)2))); break; case PTF_TANH: /* 1 / (cosh(u) ^ 2) */ arg1 = mkb(PT_DIVIDE, mkcon((double)1), mkb(PT_POWER, mkf(PTF_COSH, p->left), mkcon((double)2))); break; case PTF_USTEP: arg1 = mkcon((double) 0.0); break; case PTF_URAMP: arg1 = mkf(PTF_USTEP, p->left); break; case PTF_UMINUS: /* - 1 ; like a constant (was 0 !) */ arg1 = mkcon((double)-1.0); break; default: fprintf(stderr, "Internal Error: bad function # %d\n", p->funcnum); newp = NULL; break; } arg2 = PTdifferentiate(p->left, varnum); newp = mkb(PT_TIMES, arg1, arg2); break; default: fprintf(stderr, "Internal error: bad node type %d\n", p->type); newp = NULL; break; } /* printf("result is: "); printTree(newp); printf("\n"); */ return (newp); }
int main(int argc, char **argv) { int a; int stat; long long tot; int usage=0; char * argv0=argv[0]; argc--; argv++; pid=getpid(); if (!argc) usage++; while (argc) { if (strcmp(*argv, "-c") == 0) { argc--; argv++; asize = atoi(*argv); if (asize > 64 || asize < 1) { fprintf(stderr, "bad alpha size %s\n", *argv); return 1; } } else if (strcmp(*argv, "-d") == 0) { dflag = 1; } else if (strcmp(*argv, "-l") == 0) { argc--; argv++; len = atoi(*argv); if (len < 1) { fprintf(stderr, "bad name length %s\n", *argv); return 1; } } else if (strcmp(*argv, "-p") == 0) { argc--; argv++; nproc = atoi(*argv); if (nproc < 1) { fprintf(stderr, "bad process count %s\n", *argv); return 1; } } else if (strcmp(*argv, "-n") == 0) { nflag = 1; } else if (strcmp(*argv, "-v") == 0) { vflag = 1; } else if (strcmp(*argv, "-h") == 0) { usage++; } else { fprintf(stderr,"unknown switch \"%s\"\n", *argv); usage++; } argc--; argv++; } if (usage) { fprintf(stderr,"permname: usage %s [-c alpha size] [-l name length] " "[-p proc count] [-n] [-v] [-d] [-h]\n", argv0); fprintf(stderr," -n : don't actually perform action\n"); fprintf(stderr," -v : be verbose\n"); fprintf(stderr," -d : create directories, not files\n"); exit(1); } if (asize % nproc) { fprintf(stderr, "alphabet size must be multiple of process count\n"); return 1; } asplit = asize / nproc; alpha = malloc(asize + 1); buf = malloc(len + 1); for (a = 0, tot = 1; a < len; a++) tot *= asize; if (vflag) fprintf(stderr,"[%d] ",pid); fprintf(stderr, "alpha size = %d, name length = %d, total files = %lld, nproc=%d\n", asize, len, tot, nproc); fflush(stderr); for (a = 0; a < asize; a++) { if (a < 26) alpha[a] = 'a' + a; else if (a < 52) alpha[a] = 'A' + a - 26; else if (a < 62) alpha[a] = '0' + a - 52; else if (a == 62) alpha[62] = '_'; else if (a == 63) alpha[63] = '@'; } for (a = 0; a < nproc; a++) { int r=fork(); if (r<0) { perror("fork"); exit(1); } if (!r) { pid=getpid(); mkf(0, a); return 0; } } while (1) { int r=wait(&stat); if (r<0) { if (errno==ECHILD) break; perror("wait"); exit(1); } if (!r) break; } return 0; }