bool8 ScrCmd_bufferfirstpoke(struct ScriptContext *ctx) { u8 stringVarIndex = ScriptReadByte(ctx); u8 *dest = gUnknown_083762F0[stringVarIndex]; u8 partyIndex = GetLeadMonIndex(); u32 species = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPECIES, NULL); StringCopy(dest, gSpeciesNames[species]); return FALSE; }
DefinitionModel* HoroscopeExtractFromUDF(const UniversalDataFormat& udf, char_t*& date) { DefinitionModel* model = new_nt DefinitionModel(); if (NULL == model) return NULL; ulong_t size = udf.getItemsCount(); for (ulong_t i=0; i < size; i++) { const char* type = udf.getItemData(i, 0); if (StrEquals(horoscopeTitle, type)) { TXT(udf.getItemText(i, 1)); model->last()->setStyle(StyleGetStaticStyle(styleNameBold)); model->last()->setJustification(DefinitionElement::justifyCenter); } else if (StrEquals(horoscopeText, type)) { LBR(); TXT(udf.getItemText(i, 1)); } else if (StrEquals(horoscopeSection, type)) { LBR(); LBR(); TXT(udf.getItemText(i, 1)); model->last()->setStyle(StyleGetStaticStyle(styleNameBold)); } else if (StrEquals(horoscopeSmallSection, type)) { LBR(); TXT(udf.getItemText(i, 1)); model->last()->setStyle(StyleGetStaticStyle(styleNameBold)); } else if (StrEquals(horoscopeDate, type)) { char_t* d = StringCopy(udf.getItemText(i, 1)); free(date); date = d; if (NULL == date) goto Error; } else if (StrEquals(horoscopeUrlLink, type)) { LBR(); TXT(udf.getItemText(i, 1)); model->last()->setActionCallback(HoroscopesLinkCallback, (void*)udf.getItemData(i, 2)); model->last()->setHyperlink("", hyperlinkCallback); } else goto Error; } return model; Error: delete model; return NULL; }
RptField *RptFieldCreate(char *s, int just) { RptField *rf; rf = CREATE(RptField); rf->s = StringCopy(s, "RptFieldCreate"); rf->just = just; rf->next = NULL; return(rf); }
bool8 ScrCmd_vbuffer(struct ScriptContext *ctx) { u8 stringVarIndex = ScriptReadByte(ctx); u32 addr = ScriptReadWord(ctx); u8 *src = (u8 *)(addr - gUnknown_0202E8B0); u8 *dest = gUnknown_083762F0[stringVarIndex]; StringCopy(dest, src); return FALSE; }
void ResetRtcScreen_PrintTime(u8 x, u8 y, u16 days, u8 hours, u8 minutes, u8 seconds) { u8 *dest = gStringVar4; days %= 10000; hours %= 24; minutes %= 60; seconds %= 60; AlignInt2InMenuWindow(gStringVar1, days, 24, 1); dest = StringCopy(dest, gStringVar1); dest = StringCopy(dest, gOtherText_Day); AlignInt2InMenuWindow(gStringVar1, hours, 18, 1); dest = StringCopy(dest, gStringVar1); dest = StringCopy(dest, gUnknown_08376500); dest = ConvertIntToDecimalStringN(dest, minutes, STR_CONV_MODE_LEADING_ZEROS, 2); dest = StringCopy(dest, gUnknown_08376500); ConvertIntToDecimalStringN(dest, seconds, STR_CONV_MODE_LEADING_ZEROS, 2); Menu_PrintText(gStringVar4, x, y); }
bool StructuredSVM::SaveTrainingSet(int start_from) { if(!trainfile && modelfile) { char tmp[1000]; sprintf(tmp, "%s.train", modelfile); trainfile = StringCopy(tmp); } if(trainfile) return SaveDataset(trainset, trainfile, start_from); return false; }
char * FloatToString(Float value) { std::ostringstream oss; if ((oss << value) == false) { return ""; } return StringCopy(oss.str().c_str()); }
CCOMString CCOMString::Left(int nCount) { if (nCount < 0) nCount = 0; if (nCount >= GetLength()) return CCOMString(*this); CCOMString newStr; StringCopy(newStr, nCount, 0, 0); return newStr; }
CCOMStringW CCOMStringW::Right(int nCount) { if (nCount < 0) nCount = 0; if (nCount >= GetLength()) return CCOMStringW(*this); CCOMStringW newStr; StringCopy(newStr, nCount, GetLength() - nCount, 0); return newStr; }
CMyNumString::CMyNumString(const char *psz) { StringInit(); if (!CheckNum(psz)) { return; } StringCopy(psz); }
rc_t ProjectInit ( Project* self, uint32_t p_id, const String* name, const String* download_ticket, const String* encryption_key ) { rc_t rc = 0; memset(self, 0, sizeof(Project)); self->id = p_id; rc = StringCopy((const String**)&self->name, name); if (rc == 0) { rc = StringCopy((const String**)&self->download_ticket, download_ticket); if (rc == 0) { rc = StringCopy((const String**)&self->encryption_key, encryption_key); if (rc != 0) StringWhack(self->download_ticket); } else StringWhack(self->name); } return rc; }
void StructuredSVM::LoadTrainset(const char *fname) { if(trainfile) free(trainfile); trainfile = StringCopy(fname); trainset = LoadDataset(fname); if(!trainset) { fprintf(stderr, "Failed to load trainset %s\n", fname); assert(trainset != NULL); exit(0); } }
struct<6> func_22() { char[24] cVar0; StringCopy(&cVar0, "NULL", 24); if (Global_15712 == 4) { return Global_15331; } return cVar0; }
void test_StringCopy() { char *src = "normal string"; char dest[128]; I32 result = StringCopy(dest, 128, src, 0); ERROR(result == 13); ERROR(StringCompare(dest, src) == 0); result = StringCopy(dest, 128, src, 6); ERROR(result == 6); ERROR(StringCompare(dest, "normal") == 0); result = StringCopy(dest, 3, src, 128); ERROR(result == 2); ERROR(StringCompare(dest, "no") == 0); result = StringCopy(dest, 128, "", 128); ERROR(result == 0); ERROR(StringCompare(dest, "") == 0); }
void cDecodePgn129809(const tNmea2KMsg *msg, void* pData) { tcPgn129809Data *pDecodeData = (tcPgn129809Data*)pData; pDecodeData->MessageId = msg->data[0] & 0x3F; pDecodeData->RepeatIndicator = (msg->data[0] >> 6) & 0x03; ULongIn(pDecodeData->UserId, msg->data + 1 ); StringCopy(pDecodeData->Name, (char*)(msg->data + 5), PGN129809_NAME_LENGTH_BYTES + 1); // + 0-termination pDecodeData->AisTranceiverInformation = msg->data[25] & 0x1F; }
status_t StocksFetchDetails(const char* s, bool direct) { const char* schema = (direct ? urlSchemaStock urlSeparatorSchemaStr : urlSchemaStockName urlSeparatorSchemaStr); char* url = StringCopy(schema); if (NULL == url || NULL == (url = StrAppend(url, -1, s, -1))) return memErrNotEnoughSpace; LookupManager* lm = GetLookupManager(); status_t err = lm->fetchUrl(url); free(url); return err; }
NamedVar GetVariableByName(const char * n) { NamedVar var; for (uint8 x = 0; x < MAX_VARIABLES; x++) { eeprom_read_block((void*)&var,(const void*)&Variables[x], sizeof(NamedVar)); if (!strcmp(var.name,n)) return var; } StringCopy(var.name,"!FOUND"); return var; }
char *Pxf::StringPadCenter(char *dest, const char *src, int width, char pad_char) { int len = StringLength(src); int dst_off = (width-len) / 2; /* OPT (width-len) << 1 */ int src_off = (len-width) / 2; /* OPT (len-width) << 1 */ dst_off = (dst_off < 0) ? 0 : dst_off; src_off = (src_off < 0) ? 0 : src_off; MemorySet(dest, pad_char, width); StringCopy(dest + dst_off, src + src_off, Min(len, width)); /*dest[width] = 0x0;*/ return dest; }
rc_t ObjectInit ( Object* self, uint32_t p_id, const String* p_name, const String* p_project, const String* p_display_name, uint64_t p_size, const String* p_checksum, const String* p_encryption_key) { rc_t rc = 0; memset(self, 0, sizeof(Project)); self->id = p_id; rc = StringCopy((const String**)&self->name, p_name); if (rc == 0) { rc = StringCopy((const String**)&self->project, p_project); if (rc == 0) { rc = StringCopy((const String**)&self->display_name, p_display_name); if (rc == 0) { self->size = p_size; rc = StringCopy((const String**)&self->checksum, p_checksum); if (rc == 0) { rc = StringCopy((const String**)&self->encryption_key, p_encryption_key); if (rc != 0) StringWhack(self->checksum); } if (rc != 0) StringWhack(self->display_name); } if (rc != 0) StringWhack(self->project); } if (rc != 0) StringWhack(self->name); } return rc; }
void InitTime(void) { time_t raw_time; struct tm *now; FULL_CHAR buff[20]; OBJECT par, tmp, sym, env; OBJECT tag, second, minute, hour, weekday, monthday, yearday, month, year, century, dst; debug0(DTK, D, "InitTime()"); /* define @Moment symbol with its host of named parameters */ MomentSym = load(KW_MOMENT, LOCAL, StartSym); tag = load(KW_TAG, NPAR, MomentSym); second = load(KW_SECOND, NPAR, MomentSym); minute = load(KW_MINUTE, NPAR, MomentSym); hour = load(KW_HOUR, NPAR, MomentSym); monthday = load(KW_DAY, NPAR, MomentSym); month = load(KW_MONTH, NPAR, MomentSym); year = load(KW_YEAR, NPAR, MomentSym); century = load(KW_CENTURY, NPAR, MomentSym); weekday = load(KW_WEEKDAY, NPAR, MomentSym); yearday = load(KW_YEARDAY, NPAR, MomentSym); dst = load(KW_DAYLIGHTSAVING, NPAR, MomentSym); /* get current time and convert to ASCII */ if( time(&raw_time) == -1 ) Error(35, 1, "unable to obtain the current time", WARN, no_fpos); now = localtime(&raw_time); StringCopy(time_string, AsciiToFull(asctime(now))); time_string[StringLength(time_string) - 1] = '\0'; /* start of current_moment */ New(current_moment, CLOSURE); actual(current_moment) = MomentSym; /* attach its many parameters */ add_par("%s", KW_NOW, tag); add_par("%.2d", now->tm_sec, second); add_par("%.2d", now->tm_min, minute); add_par("%.2d", now->tm_hour, hour); add_par("%d", now->tm_mday, monthday); add_par("%d", now->tm_mon + 1, month); add_par("%.2d", now->tm_year % 100, year); add_par("%d", (now->tm_year+1900) / 100, century); add_par("%d", now->tm_wday + 1, weekday); add_par("%d", now->tm_yday, yearday); add_par("%d", now->tm_isdst, dst); /* add a null environment */ New(env, ENV); AttachEnv(env, current_moment); debug0(DTK, D, "InitTime() returning."); debug0(DTK, DD, "current_moment ="); ifdebug(DTK, DD, DebugObject(current_moment)); } /* end InitTime */
void func_4() { int iVar0; iVar0 = 0; while (iVar0 <= 69) { StringCopy(&(Global_14580[iVar0 /*6*/]), "", 24); iVar0++; } stop_scripted_conversation(false); Global_15712 = 1; }
void SVGPlotter::AddPlot(double *x, double *y, int numPts, double xOffset, double xScale, const char *legendName, const char *lineClass, const char *pointClass) { int stride = 1; while(numPts/stride > maxPoints) stride++; plots = (SVGPlot*)realloc(plots, sizeof(SVGPlot)*(numPlots+1)); plots[numPlots].lineClass = lineClass ? StringCopy(lineClass) : NULL; plots[numPlots].pointClass = pointClass ? StringCopy(pointClass) : NULL; plots[numPlots].legendName = legendName ? StringCopy(legendName) : NULL; plots[numPlots].numPts = 0; int num = numPts/stride+1; plots[numPlots].x = (double*)malloc(sizeof(double)*num); plots[numPlots].y = (double*)malloc(sizeof(double)*num); for(int i = 0, j = 0; i < numPts; i += stride, j++) { plots[numPlots].x[j] = x ? x[i] : xOffset+i*xScale; plots[numPlots].y[j] = y[i]; if(plots[numPlots].x[j] < xMin) xMin = plots[numPlots].x[j]; if(plots[numPlots].x[j] > xMax) xMax = plots[numPlots].x[j]; if(plots[numPlots].y[j] < yMin) yMin = plots[numPlots].y[j]; if(plots[numPlots].y[j] > yMax) yMax = plots[numPlots].y[j]; plots[numPlots].numPts++; } numPlots++; }
void MakePalindromAddingCharactersToTheRightSide(const char* const source, char* const destination) { int sourceLength = StringLength(source); char* const localPalindrom = new char[2 * sourceLength]; StringCopy(localPalindrom, source); for (int iterCount = 1; iterCount < sourceLength; iterCount++) { for (int charCopyCount = iterCount, i = 0; charCopyCount > 0; charCopyCount--, i++) { *(localPalindrom + sourceLength + i) = *(localPalindrom + charCopyCount - 1); } *(localPalindrom + sourceLength + iterCount) = '\0'; if (IsPalindrom(localPalindrom)) { StringCopy(destination, localPalindrom); break; } } delete[] localPalindrom; }
void func_44(auto uParam0, char* sParam1, char* sParam2, int iParam3, int iParam4, int iParam5) { func_45(uParam0, 145, sParam1, iParam4, iParam5, 0); if (iParam3 > 7) { if (iParam3 < 12) { iParam3 = 7; } } GAMEPLAY::SET_BIT(&Global_14578, false); Global_15715 = iParam3; StringCopy(&Global_15702, sParam2, 24); }
status_t StocksPortfolio::initialize(const char_t* name) { free(name_); name_ = StringCopy(name); if (NULL == name) return memErrNotEnoughSpace; if (!addSymbol(_T("^DJI"), 0) || !addSymbol(_T("^IXIC"), 0) || !addSymbol(_T("^GSPC"), 0)) return memErrNotEnoughSpace; return errNone; }
void func_16(int iParam0, char* sParam1, int iParam2, char* sParam3, int iParam4, int iParam5, int iParam6, int iParam7, int iParam8) { StringCopy(&(Global_2290[iParam0 /*15*/]), sParam1, 16); Global_2290[iParam0 /*15*/].f_4 = iParam2; StringCopy(&(Global_2290[iParam0 /*15*/].f_5), sParam3, 16); Global_2290[iParam0 /*15*/].f_9 = GAMEPLAY::GET_HASH_KEY(sParam3); Global_2290[iParam0 /*15*/].f_10 = iParam4; Global_2290[iParam0 /*15*/].f_11 = iParam5; Global_2290[iParam0 /*15*/].f_12 = iParam6; Global_2290[iParam0 /*15*/].f_13 = iParam7; Global_2290[iParam0 /*15*/].f_14 = iParam8; if (Global_2290[iParam0 /*15*/].f_12 == 0) { Global_2290[iParam0 /*15*/].f_12 = 0; } if (Global_2290[iParam0 /*15*/].f_13 == 0) { Global_2290[iParam0 /*15*/].f_13 = 0; } if (Global_2290[iParam0 /*15*/].f_14 == 0) { Global_2290[iParam0 /*15*/].f_14 = 0; } }
void ScriptEngine::Init() { NamedVar vars[MAX_VARIABLES]; eeprom_read_block((void*)&vars,(const void*)&Variables,(sizeof(NamedVar)*MAX_VARIABLES)); for(uint8 x = 0; x < MAX_VARIABLES; x++) { StringCopy(vars[x].name,"$FREE$"); vars[x].val.val16 = 0x0000; vars[x].slot = x; } eeprom_write_block((const void*)&vars,(void*)&Variables,(sizeof(NamedVar)*MAX_VARIABLES)); }
static spotgrp * make_spotgrp( const char *src, const size_t len ) { spotgrp * sg = calloc( 1, sizeof sg[ 0 ] ); if ( sg != NULL ) { String s; StringInit( &s, src, len, len ); if ( StringCopy ( &sg->name, &s ) != 0 ) { free( sg ); sg = NULL; } } return sg; }
static rc_t on_enter_path( const reply_obj * obj, void * data ) { rc_t rc = 0; if ( obj != NULL && data != NULL ) { reply_obj_list * list = data; reply_obj * found = find_obj( list, obj->id ); if ( found != NULL ) { if ( found->path != NULL ) StringWhack( found->path ); rc = StringCopy( &found->path, obj->path ); } } return rc; }
void func_15() { int iVar0; iVar0 = 0; while (iVar0 <= 15) { Global_15001[iVar0 /*10*/] = 0; StringCopy(&(Global_15001[iVar0 /*10*/].f_1), "", 24); Global_15001[iVar0 /*10*/].f_7 = 0; Global_15001[iVar0 /*10*/].f_8 = 0; iVar0++; } Global_15001.f_161 = -99; Global_15001.f_162 = {0f, 0f, 0f}; }