AREXPORT ArArgumentBuilder &ArArgumentBuilder::operator=(const ArArgumentBuilder & builder) { if (this != &builder) { size_t i = 0; // Delete old stuff... if (myOrigArgc > 0) { for (i = 0; i < myOrigArgc; ++i) delete[] myArgv[i]; } delete[] myArgv; // Then copy new stuff... myFullString = builder.myFullString; myExtraString = builder.myExtraString; myArgc = builder.getArgc(); myArgvLen = builder.getArgvLen(); myOrigArgc = myArgc; myArgv = new char *[myArgvLen]; for (i = 0; i < myArgc; i++) { myArgv[i] = cppstrdup(builder.getArg(i)); } myIsQuiet = builder.myIsQuiet; myExtraSpace = builder.myExtraSpace; myIgnoreNormalSpaces = builder.myIgnoreNormalSpaces; myIsPreCompressQuotes = builder.myIsPreCompressQuotes; } return *this; }
void drvTK::show_text(const TextInfo & textinfo) { int condensedfont = (strstr(textinfo.currentFontName.value(), "Condensed") != NIL); int narrowfont = (strstr(textinfo.currentFontName.value(), "Narrow") != NIL); int boldfont = (strstr(textinfo.currentFontName.value(), "Bold") != NIL); int italicfont = ((strstr(textinfo.currentFontName.value(), "Italic") != NIL) || (strstr(textinfo.currentFontName.value(), "Oblique") != NIL)); char* tempfontname = cppstrdup(textinfo.currentFontName.value()) ; // char tempfontname[1024]; char fonttype = 'r'; char *i; int actualFontSize; i = strchr(tempfontname, '-'); if (i != NIL) { *i = '\0'; } if (italicfont) fonttype = 'i'; actualFontSize = int ((textinfo.currentFontSize / .95) * 10); buffer << "set i [$Global(CurrentCanvas) create text " << textinfo.x + x_offset << " " << (currentDeviceHeight - textinfo.y + y_offset + actualFontSize / 7.2); buffer << " -text \""; outputEscapedText(textinfo.thetext.value()); buffer << endl << "\""; buffer << " -font {-*-" << tempfontname << "-"; if (boldfont) buffer << "bold"; else buffer << "medium"; buffer << "-" << fonttype; if (narrowfont) buffer << "-narrow--*-"; else if (condensedfont) buffer << "-condensed--*-"; else buffer << "-*--*-"; buffer << actualFontSize << "-72-72-*-*-*-*" << "}" << " -anchor sw" << " -fill " << colorstring(currentR(), currentG(), currentB()) << " -tags \"" << options->tagNames << "\" ]" << endl; if (strcmp(options->tagNames.value.value(), "") && !(options->noImPress)) { buffer << "set Group($Global(CurrentCanvas),$i) \"" << options->tagNames << "\"" << endl; } delete [] tempfontname; }
AREXPORT ArArgumentBuilder::ArArgumentBuilder(const ArArgumentBuilder & builder) { size_t i; myFullString = builder.myFullString; myExtraString = builder.myExtraString; myArgc = builder.getArgc(); myArgvLen = builder.getArgvLen(); myOrigArgc = myArgc; myArgv = new char *[myArgvLen]; for (i = 0; i < myArgc; i++) myArgv[i] = cppstrdup(builder.getArg(i)); //myArgv[i] = strdup(builder.getArg(i)); myIsQuiet = builder.myIsQuiet; }
AREXPORT ArArgumentBuilder::ArArgumentBuilder(const ArArgumentBuilder & builder) { size_t i; myFullString = builder.myFullString; myExtraString = builder.myExtraString; myArgc = builder.getArgc(); myArgvLen = builder.getArgvLen(); myOrigArgc = myArgc; myArgv = new char *[myArgvLen]; for (i = 0; i < myArgc; i++) myArgv[i] = cppstrdup(builder.getArg(i)); //myArgv[i] = strdup(builder.getArg(i)); myIsQuiet = builder.myIsQuiet; myExtraSpace = builder.myExtraSpace; myIgnoreNormalSpaces = builder.myIgnoreNormalSpaces; myIsPreCompressQuotes = builder.myIsPreCompressQuotes; }
void drvSWF::show_image(const PSImage & imageinfo) { if (outBaseName == "") { errf << "images cannot be handled via standard output. Use an output file" << endl; return; } if (imageinfo.isFileImage) { // use imageinfo.FileName; #if 0 outf << "<image " // x=\"" << 0 << "\" y=\"" << 0 << "\"" << " transform=\"matrix(" << imageinfo.normalizedImageCurrentMatrix[0] << ' ' << /* - */ -imageinfo.normalizedImageCurrentMatrix[1] << ' ' // doch doch - zumindest bei im.ps // - no longer needed due to normalization in pstoedit.pro << imageinfo.normalizedImageCurrentMatrix[2] << ' ' << -imageinfo.normalizedImageCurrentMatrix[3] << ' ' // transfer << imageinfo.normalizedImageCurrentMatrix[4] << ' ' << currentDeviceHeight - imageinfo.normalizedImageCurrentMatrix[5] << ")\"" << " width=\"" << imageinfo. width << "\"" << " height=\"" << imageinfo. height << "\"" << " xlink:href=\"" << imageinfo.FileName << "\"></image>" << endl; #endif #if (defined(USE_PNG) && USE_PNG) // from 0.3 on ming may support png directly SWFBitmap *bm = new SWFBitmap(imageinfo.FileName.value()); #else unsigned int len = strlen(imageinfo.FileName.value()); char *outfile = cppstrdup(imageinfo.FileName.value()); outfile[len - 3] = 'd'; outfile[len - 2] = 'b'; outfile[len - 1] = 'l'; png2dbl(imageinfo.FileName.value(), outfile); SWFBitmap *bm = new SWFBitmap(outfile); delete [] outfile; #endif (void) remove(imageinfo.FileName.value()); SWFShape *s = new SWFShape; SWFFill *swffill = s->addBitmapFill(bm, SWFFILL_TILED_BITMAP); s->setRightFill(swffill); const float h = (float) bm->getHeight(); const float w = (float) bm->getWidth(); s->movePen(0.0f, 0.0f); s->drawLine(w, 0.0f); s->drawLine(0.0f, h); s->drawLine(-w, 0.0f); s->drawLine(0.0f, -h); /// cout << " h:" << bm->getHeight() << " w:" << bm->getWidth() << endl; // SWFDisplayItem *d = movie->add(bm); s->end(); SWFDisplayItem *d = movie->add(s); const float *CTM = imageinfo.normalizedImageCurrentMatrix; float ma = CTM[0]; float mb = -CTM[1]; float mc = CTM[2]; float md = -CTM[3]; const Point p(CTM[4], CTM[5]); float mx = swfx(p); float my = swfy(p); #if 1 d->move(0.0f, 0.0f); SWFDisplayItem_setMatrix(d->item, ma, mb, mc, md, mx, my); // d->item->flags |= ITEM_DISPLACED; // d->item->flags |= ITEM_TRANSFORMED; #else const Point p(CTM[4], CTM[5]); d->move(swfx(p), swfy(p)); // d->rotate(30); d->scale(ma, -md); #endif } else { errf << "unhandled case for image " << endl; } }
AREXPORT void ArArgumentBuilder::compressQuoted(bool stripQuotationMarks) { size_t argLen; size_t i; std::string myNewArg; for (i = 0; i < myArgc; i++) { argLen = strlen(myArgv[i]); if (stripQuotationMarks && argLen >= 2 && myArgv[i][0] == '"' && myArgv[i][argLen - 1] == '"') { myNewArg = &myArgv[i][1]; myNewArg[myNewArg.size() - 1] = '\0'; delete[] myArgv[i]; // but replacing ourself with the new arg myArgv[i] = cppstrdup(myNewArg.c_str()); //myArgv[i] = strdup(myNewArg.c_str()); continue; } // if this arg begins with a quote but doesn't end with one if (argLen >= 2 && myArgv[i][0] == '"' && myArgv[i][argLen - 1] != '"') { // start the new value for this arg, if stripping quotations // then start after the quote if (stripQuotationMarks) myNewArg = &myArgv[i][1]; else myNewArg = myArgv[i]; bool isEndQuoteFound = false; // now while the end char of the next args isn't the end of our // start quote we toss things into this arg while ((i + 1 < myArgc) && !isEndQuoteFound) { int nextArgLen = strlen(myArgv[i+1]); // Check whether the next arg contains the ending quote... if ((nextArgLen > 0) && (myArgv[i+1][nextArgLen - 1] == '"')) { isEndQuoteFound = true; } // Concatenate the next arg to this one... myNewArg += " "; myNewArg += myArgv[i+1]; // if we are striping quotes off then replace the quote if (stripQuotationMarks && myNewArg.size() > 0 && isEndQuoteFound) myNewArg[myNewArg.size() - 1] = '\0'; // removing those next args removeArg(i+1); // and ourself delete[] myArgv[i]; // but replacing ourself with the new arg myArgv[i] = cppstrdup(myNewArg.c_str()); //myArgv[i] = strdup(myNewArg.c_str()); } } } }
char* determineBinaryLocation(const char* launchcmd) { FILE *f; char *path, *delim, *envpath, *testcmd; const char* initial; #ifdef __BEOS__ // Thanks Caz entry_ref ref; BPath bpath; if(get_ref_for_path(launchcmd, &ref) == B_NO_ERROR) { BEntry entry(&ref); if(entry.GetPath(&bpath) == B_NO_ERROR) { // since we dup anything returned, this isn't a problem initial = bpath.Path(); } } #else // not changing the constant, changing what it points to initial = launchcmd; #endif #ifdef _WIN32 #define DIRLISTSEPARATOR ';' #else #define DIRLISTSEPARATOR ':' #endif f = fopen(initial, "rb"); if( f != NULL ) { fclose(f); path = cppstrdup(initial); delim = strrchr(path, '/'); #ifdef _WIN32 delim = (char*)max((unsigned int)delim, (unsigned int)strrchr(path, '\\')); #endif if( delim == NULL ) { delete path; binloc = "."; return cppstrdup("."); } delim[0] = '\0'; binloc = path; return path; } envpath = getenv("PATH"); path = envpath; while( (delim = strchr(envpath, DIRLISTSEPARATOR)) != NULL ) { delim[0] = '\0'; delim++; if( path[strlen(path)-1] != '/' #ifdef _WIN32 && path[strlen(path)-1] != '\\' #endif ) { testcmd = new char[strlen(path)+strlen(initial)+1]; sprintf(testcmd, "%s/%s", path, initial); } else { testcmd = new char[strlen(path)+strlen(initial)]; sprintf(testcmd, "%s%s", path, initial); } if( (f = fopen(testcmd, "rb")) != NULL ) { fclose(f); path = cppstrdup(initial); delim = strrchr(path, '/'); #ifdef _WIN32 delim = (char*)max((unsigned int)delim, (unsigned int)strrchr(path, '\\')); #endif if( delim == NULL ) { delete[] path; delete[] testcmd; binloc = "."; return cppstrdup("."); } delim[0] = '\0'; delete[] testcmd; binloc = path; return path; } path = delim; delete[] testcmd; } binloc = "."; return cppstrdup("."); }