static int _StartBatch(MessageHandler *handler, char *name, char *param) { int (*apl)(char *); int rc; ValueStruct *val; char *arg; OpenCOBOL_Conv = NewConvOpt(); ConvSetSize(OpenCOBOL_Conv, ThisBD->textsize, ThisBD->arraysize); ConvSetCodeset(OpenCOBOL_Conv, ConvCodeset(handler->conv)); if (handler->conv != NULL) { OpenCOBOL_Conv->fBigEndian = handler->conv->fBigEndian; } else { Error("handler->conv is NULL"); } InitMONFUNC(OpenCOBOL_Conv, OpenCOBOL_PackValue, OpenCOBOL_UnPackValue, OpenCOBOL_SizeValue); #ifdef DEBUG printf("starting [%s][%s]\n", name, param); #endif if ((apl = cob_resolve(name)) != NULL) { val = NewValue(GL_TYPE_CHAR); SetValueStringWithLength(val, param, ThisBD->textsize, NULL); arg = StrnDup(ValueToString(val, "euc-jisx0213"), ThisBD->textsize); StringC2Cobol(arg, ThisBD->textsize); rc = apl(arg); FreeValueStruct(val); xfree(arg); } else { Warning("%s - %s is not found.", cob_resolve_error(), name); rc = -1; } return (rc); }
/* Fill out buffer with the compressed format Ganesh expects from a colortable based bitmap. [palette (colortable) + indices]. At the moment Ganesh only supports 8bit version. If Ganesh allowed we others we could detect that the colortable.count is <= 16, and then repack the indices as nibbles to save RAM, but it would take more time (i.e. a lot slower than memcpy), so skipping that for now. Ganesh wants a full 256 palette entry, even though Skia's ctable is only as big as the colortable.count says it is. */ static void build_compressed_data(void* buffer, const SkBitmap& bitmap) { SkASSERT(SkBitmap::kIndex8_Config == bitmap.config()); SkAutoLockPixels apl(bitmap); if (!bitmap.readyToDraw()) { SkASSERT(!"bitmap not ready to draw!"); return; } SkColorTable* ctable = bitmap.getColorTable(); char* dst = (char*)buffer; memcpy(dst, ctable->lockColors(), ctable->count() * sizeof(SkPMColor)); ctable->unlockColors(false); // always skip a full 256 number of entries, even if we memcpy'd fewer dst += kGrColorTableSize; if (bitmap.width() == bitmap.rowBytes()) { memcpy(dst, bitmap.getPixels(), bitmap.getSize()); } else { // need to trim off the extra bytes per row size_t width = bitmap.width(); size_t rowBytes = bitmap.rowBytes(); const char* src = (const char*)bitmap.getPixels(); for (int y = 0; y < bitmap.height(); y++) { memcpy(dst, src, width); src += rowBytes; dst += width; } } }
static Bool _ExecuteProcess(MessageHandler *handler, ProcessNode *node) { int (*apl)(char *, char *, char *, char *); char *module; long start, end; Bool rc; module = ValueStringPointer(GetItemLongName(node->mcprec->value, "dc.module")); if ((apl = cob_resolve(module)) != NULL) { PutApplication(node); start = GetNowTime(); (void)apl(McpData, SpaData, LinkData, ScrData); end = GetNowTime(); TimerPrintf(start, end, "OpenCOBOL %s:%s:%s\n", module, node->widget, node->event); GetApplication(node); if (ValueInteger(GetItemLongName(node->mcprec->value, "rc")) < 0) { rc = FALSE; } else { rc = TRUE; } } else { Warning("%s - %s is not found.", cob_resolve_error(), module); rc = FALSE; } return (rc); }