Project::Project( const std::string &name, const std::string &libname, const std::string &headername, const std::list<std::string> &libs_list_shared, const std::list<std::string> &libs_list_release, const std::list<std::string> &libs_list_debug, const std::list<std::string> &ignore_list, const std::list<std::string> &exclude_list ) : name(name), libname(libname), headername(headername), libs_shared(libs_list_shared), libs_release(libs_list_release), libs_debug(libs_list_debug) { std::string lib_main_header; lib_main_header = std::string("Sources\\Include\\") + headername; files.push_back(ProjectFiles(false, lib_main_header)); generate_dir(std::string("Sources\\Include\\")+name, ignore_list, exclude_list); generate_dir(std::string("Sources\\")+name, ignore_list, exclude_list); }
void Project::generate_dir( const std::string &dir, const std::list<std::string> &ignore_list, const std::list<std::string> &exclude_list, bool force_exclude_all ) { std::string path = dir; if (path[path.length()-1] != '\\') path += '\\'; WIN32_FIND_DATAA data; HANDLE handle = FindFirstFileA(std::string(path + "*.*").c_str(), &data); if (handle == INVALID_HANDLE_VALUE) return; do { bool skip = false; bool exclude = force_exclude_all; if (strncmp(data.cFileName, ".#", 2) == 0) continue; // don't add CVS revision backups. if (strchr(data.cFileName, '~') != NULL) continue; //Don't get those emacs/bcc backup files for (auto it = ignore_list.begin(); it != ignore_list.end(); it++) { if (_stricmp(data.cFileName, it->c_str()) == 0) skip = true; } if (skip) continue; for (auto it = exclude_list.begin(); it != exclude_list.end(); it++) { if (_stricmp(data.cFileName, it->c_str()) == 0) exclude = true; } if ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) { generate_dir(path + data.cFileName, ignore_list, exclude_list, exclude); } else { files.push_back(ProjectFiles(exclude, path + data.cFileName)); } } while (FindNextFileA(handle, &data)); }
/* simple utility for concat strings */ char *xdb_file_full(int create, pool p, char *spl, char *host, char *file, char *ext) { struct stat s; int lenf = strlen(file); int lenh = strlen(host); int lens = strlen(spl); int lene = strlen(ext); int index; char xdb_file[lenf+10]; char xdb_path[20]; char *full = pmalloco(p,lens+lenh+lenf+lene+15); memcpy(full,spl,lens); index = lens; full[index] = '/'; index++; memcpy(full+index,host,lenh); index += lenh; full[index] = '/'; index++; memcpy(xdb_file,file,lenf); xdb_file[lenf]='.'; memcpy(xdb_file+lenf+1,ext,lene); xdb_file[lenf+lene+1] = 0; generate_dir(xdb_file,xdb_path,20); memcpy(full+index,xdb_path+1,5); index+=5; /* check dir */ if (stat(full,&s) == 0) { full[index] = '/'; index++; memcpy(full+index,xdb_file,lenf+lene+2); return full; } /* if GET why create */ if (!create) { return NULL; } /* try to create directory */ index = lens+lenh+1; full[index] = 0; /* create host */ if (stat(full,&s) < 0) { mkdir(full, S_IRWXU); } full[index] = '/'; index+=3; full[index] = 0; /* create 1 dir */ if (stat(full,&s) < 0) { mkdir(full, S_IRWXU); } full[index] = '/'; index+=3; full[index] = 0; /* create 2 dir */ if (stat(full,&s) < 0) { mkdir(full, S_IRWXU); } full[index] = '/'; index++; memcpy(full+index,xdb_file,lenf+lene+2); return full; }
int main (int argc, char** argv) { struct stat s; char buf[500]; char sciezka[500]; char * a,*b; char *f; char *t[10]; int index = 0; void * start; int fd,fd2; if (argc != 2) { fprintf(stderr,"xdb_copy needs parameter.\r\n"); return 0; } /* build path */ /* we have */ /* 0 1 */ /* ./spool/offline/jabber.wp.pl/a/aa/ala.xml */ a = argv[1]; b = sciezka; a += 6; memcpy(b,"./spool1/",9); b +=9; *b=0; while(1) { if (*a == 0) { break; } if (*a == '/') { f = a; if (index < 2) { *b = 0; //fprintf(stderr,"create >%s<\r\n",sciezka); if (stat(sciezka,&s) < 0) mkdir(sciezka, S_IRWXU); t[index] = b; index++; *b = *a; b++; } a++; continue; } if (index < 2) { *b = *a; b++; } a++; } /* generate path_info */ f++; generate_dir(f,buf,200); memcpy(b,buf+1,2); b+=2; *b=0; // fprintf(stderr,"create >%s<\r\n",sciezka); if (stat(sciezka,&s) < 0) mkdir(sciezka, S_IRWXU); *b='/'; memcpy(b+1,buf+4,2); b+=3; *b=0; // fprintf(stderr,"create >%s<\r\n",sciezka); if (stat(sciezka,&s) < 0) mkdir(sciezka, S_IRWXU); *b='/'; memcpy(b+1,f,a-f); b+=a-f+1; *b=0; /* copy file */ if (stat(argv[1],&s) < 0) { fprintf(stdout,"error >%s<\r\n",argv[1]); return 0; } fd = open(argv[1],O_RDONLY); start = mmap(NULL,s.st_size,PROT_READ,MAP_SHARED,fd,0); fd2 = open(sciezka,O_TRUNC | O_CREAT | O_WRONLY,S_IRUSR|S_IWUSR|S_IRGRP); write(fd2,start,s.st_size); close(fd2); munmap(start,s.st_size); close(fd); fprintf(stdout,"%s\r\n",sciezka); return 0; }
void UmlOperation::generate_decl(QTextStream & f, const WrapperStr & cl_stereotype, WrapperStr indent, bool) { if (!idlDecl().isEmpty()) { if ((cl_stereotype != "interface") && (cl_stereotype != "valuetype")) { write_trace_header(); UmlCom::trace(" <font color=\"red\"><b>cannot have operation</b></font><br>"); incr_warning(); return; } const char * p = idlDecl(); const char * pp = 0; const QList<UmlParameter> & params = this->params(); const QList<UmlTypeSpec> & exceptions = this->exceptions(); unsigned rank; while ((*p == ' ') || (*p == '\t')) indent += *p++; if (*p != '#') f << indent; for (;;) { if (*p == 0) { if (pp == 0) break; // comment management done p = pp; pp = 0; if (*p == 0) break; if (*p != '#') f << indent; } if (*p == '\n') { f << *p++; if (*p && (*p != '#')) f << indent; } else if (*p == '@') manage_alias(p, f); else if (*p != '$') f << *p++; else if (!strncmp(p, "${comment}", 10)) manage_comment(p, pp); else if (!strncmp(p, "${description}", 14)) manage_description(p, pp); else if (!strncmp(p, "${oneway}", 9)) { p += 9; if (isIdlOneway()) f << "oneway "; } else if (!strncmp(p, "${type}", 7)) { p += 7; UmlClass::write(f, returnType()); } else if (!strncmp(p, "${name}", 7)) { p += 7; f << compute_name(); } else if (!strncmp(p, "${(}", 4)) { p += 4; f << '('; } else if (!strncmp(p, "${)}", 4)) { p += 4; f << ')'; } else if (sscanf(p, "${d%u}", &rank) == 1) { if (!generate_dir(params, rank, f)) param_error(parent()->name(), name(), rank, "declaration"); p = strchr(p, '}') + 1; } else if (sscanf(p, "${t%u}", &rank) == 1) { if (!generate_type(params, rank, f)) param_error(parent()->name(), name(), rank, "declaration"); p = strchr(p, '}') + 1; } else if (sscanf(p, "${p%u}", &rank) == 1) { if (!generate_var(params, rank, f)) param_error(parent()->name(), name(), rank, "declaration"); p = strchr(p, '}') + 1; } else if (!strncmp(p, "${stereotype}", 13)) { p += 13; f << IdlSettings::relationAttributeStereotype(stereotype()); } else if (!strncmp(p, "${raisesnl}", 11)) { if (exceptions.count() != 0) { f << '\n' << indent << " "; } p += 11; } else if (!strncmp(p, "${raises}", 9)) { p += 9; if (! exceptions.isEmpty()) { const char * sep; QList<UmlTypeSpec>::ConstIterator it; for (it = exceptions.begin(), sep = " raises ("; it != exceptions.end(); ++it, sep = " ") f << sep << IdlSettings::type((*it).toString()); f << ')'; } } else if (!strncmp(p, "${association}", 14)) { p += 14; UmlClassMember * m; if (((m = getOf()) != 0) && (m->kind() == aRelation)) f << IdlSettings::type(((UmlRelation *) m)->association().toString()); else if (((m = setOf()) != 0) && (m->kind() == aRelation)) f << IdlSettings::type(((UmlRelation *) m)->association().toString()); } else // strange f << *p++; } f << '\n'; } }