/** Return a lit of OpenCV conversion codes to get from one Format to the other * The key is a pair: <FromFormat, ToFormat> and the value a succession of OpenCV code conversion * It's not efficient code but it is only called once and the structure is small enough */ std::map<std::pair<Encoding, Encoding>, std::vector<int> > getConversionCodes() { std::map<std::pair<Encoding, Encoding>, std::vector<int> > res; for(int i=0; i<=5; ++i) res[std::pair<Encoding, Encoding>(Encoding(i),Encoding(i))].push_back(SAME_FORMAT); res[std::make_pair(GRAY, RGB)].push_back(cv::COLOR_GRAY2RGB); res[std::make_pair(GRAY, BGR)].push_back(cv::COLOR_GRAY2BGR); res[std::make_pair(GRAY, RGBA)].push_back(cv::COLOR_GRAY2RGBA); res[std::make_pair(GRAY, BGRA)].push_back(cv::COLOR_GRAY2BGRA); res[std::make_pair(RGB, GRAY)].push_back(cv::COLOR_RGB2GRAY); res[std::make_pair(RGB, BGR)].push_back(cv::COLOR_RGB2BGR); res[std::make_pair(RGB, RGBA)].push_back(cv::COLOR_RGB2RGBA); res[std::make_pair(RGB, BGRA)].push_back(cv::COLOR_RGB2BGRA); res[std::make_pair(BGR, GRAY)].push_back(cv::COLOR_BGR2GRAY); res[std::make_pair(BGR, RGB)].push_back(cv::COLOR_BGR2RGB); res[std::make_pair(BGR, RGBA)].push_back(cv::COLOR_BGR2RGBA); res[std::make_pair(BGR, BGRA)].push_back(cv::COLOR_BGR2BGRA); res[std::make_pair(RGBA, GRAY)].push_back(cv::COLOR_RGBA2GRAY); res[std::make_pair(RGBA, RGB)].push_back(cv::COLOR_RGBA2RGB); res[std::make_pair(RGBA, BGR)].push_back(cv::COLOR_RGBA2BGR); res[std::make_pair(RGBA, BGRA)].push_back(cv::COLOR_RGBA2BGRA); res[std::make_pair(BGRA, GRAY)].push_back(cv::COLOR_BGRA2GRAY); res[std::make_pair(BGRA, RGB)].push_back(cv::COLOR_BGRA2RGB); res[std::make_pair(BGRA, BGR)].push_back(cv::COLOR_BGRA2BGR); res[std::make_pair(BGRA, RGBA)].push_back(cv::COLOR_BGRA2RGBA); res[std::make_pair(YUV422, GRAY)].push_back(cv::COLOR_YUV2GRAY_UYVY); res[std::make_pair(YUV422, RGB)].push_back(cv::COLOR_YUV2RGB_UYVY); res[std::make_pair(YUV422, BGR)].push_back(cv::COLOR_YUV2BGR_UYVY); res[std::make_pair(YUV422, RGBA)].push_back(cv::COLOR_YUV2RGBA_UYVY); res[std::make_pair(YUV422, BGRA)].push_back(cv::COLOR_YUV2BGRA_UYVY); // Deal with Bayer res[std::make_pair(BAYER_RGGB, GRAY)].push_back(cv::COLOR_BayerBG2GRAY); res[std::make_pair(BAYER_RGGB, RGB)].push_back(cv::COLOR_BayerBG2RGB); res[std::make_pair(BAYER_RGGB, BGR)].push_back(cv::COLOR_BayerBG2BGR); res[std::make_pair(BAYER_BGGR, GRAY)].push_back(cv::COLOR_BayerRG2GRAY); res[std::make_pair(BAYER_BGGR, RGB)].push_back(cv::COLOR_BayerRG2RGB); res[std::make_pair(BAYER_BGGR, BGR)].push_back(cv::COLOR_BayerRG2BGR); res[std::make_pair(BAYER_GBRG, GRAY)].push_back(cv::COLOR_BayerGR2GRAY); res[std::make_pair(BAYER_GBRG, RGB)].push_back(cv::COLOR_BayerGR2RGB); res[std::make_pair(BAYER_GBRG, BGR)].push_back(cv::COLOR_BayerGR2BGR); res[std::make_pair(BAYER_GRBG, GRAY)].push_back(cv::COLOR_BayerGB2GRAY); res[std::make_pair(BAYER_GRBG, RGB)].push_back(cv::COLOR_BayerGB2RGB); res[std::make_pair(BAYER_GRBG, BGR)].push_back(cv::COLOR_BayerGB2BGR); return res; }
FloatRegisters::Code FloatRegisters::FromName(const char* name) { for (size_t i = 0; i < TotalSingle; ++i) { if (strcmp(GetSingleName(Encoding(i)), name) == 0) return VFPRegister(i, VFPRegister::Single).code(); } for (size_t i = 0; i < TotalDouble; ++i) { if (strcmp(GetDoubleName(Encoding(i)), name) == 0) return VFPRegister(i, VFPRegister::Double).code(); } return Invalid; }
EXPORT_C void CX509Certificate::InternalizeL(RReadStream& aStream) { if (iIssuerName != NULL) //just to check cert is uninitialised { User::Leave(KErrArgument); } iKeyFactory = new(ELeave) TX509KeyFactory; TInt len = aStream.ReadInt32L(); //Read the length of the streamed encoding HBufC8* temp= HBufC8::NewLC(len); TPtr8 ptr=temp->Des(); aStream.ReadL(ptr,len); iEncoding=temp->AllocL(); CleanupStack::PopAndDestroy(); // temp TASN1DecSequence encSeq; TInt pos = 0; CArrayPtrFlat<TASN1DecGeneric>* seq = encSeq.DecodeDERLC(*iEncoding, pos, 3, 3); TASN1DecGeneric* encSigAlg = seq->At(1); iSigningAlgorithm = CX509SigningAlgorithmIdentifier::NewL(encSigAlg->Encoding()); TASN1DecBitString encBS; iSignature = encBS.ExtractOctetStringL(*(seq->At(2))); CleanupStack::PopAndDestroy();//seq CSHA1* hash = CSHA1::NewL(); CleanupStack::PushL(hash); iFingerprint = hash->Final(Encoding()).AllocL(); CleanupStack::PopAndDestroy();//hash ConstructCertL(); }
Texture::Encoding::Encoding(const Any& a) { *this = Encoding(); if (a.type() == Any::STRING) { format = ImageFormat::fromString(a); } else if (a.nameBeginsWith("Color4")) { readMultiplyFirst = a; } else if (anyNameIsColor3Variant(a)) { readMultiplyFirst = Color4(Color3(a), 1.0f); } else if (a.type() == Any::NUMBER) { readMultiplyFirst = Color4::one() * float(a.number()); } else { AnyTableReader r(a); r.getIfPresent("frame", frame); r.getIfPresent("readMultiplyFirst", readMultiplyFirst); r.getIfPresent("readAddSecond", readAddSecond); String fmt; if (r.getIfPresent("format", fmt)) { format = ImageFormat::fromString(fmt); } } }
int main() { char choice; while(1) { welcome(); scanf("%c",&choice); switch(choice) { case 'i': case 'I':Init();break; case 'e': case 'E':Encoding();break; case 'd': case 'D':Decoding();break; case 'p': case 'P':Print();break; case 't': case 'T':Tree_printing();break; case 'q': case 'Q':Free();exit(1); default :printf("Input error!\n"); } getchar(); } return 0; }
std::shared_ptr<std::istream> Resources::OpenStream(std::wstring name) { LOG(Trace, L"Reading stream \"" << name << L"\""); if (name.empty()) { throw std::invalid_argument("empty resource name"); } if (name[0] == wchar_t(':')) { if (name.length() == 1) { throw std::invalid_argument("invalid resource name"); } // Internal binary resource std::wstring demangled_name = name.substr(1); // Drop leading colon for (auto& i: kBuiltinBinaryResources) { if (i.first == demangled_name) { auto result = std::make_shared<std::stringstream>(); auto blob = Base64::Decode(i.second); result->write((char*)blob.data(), blob.size()); return result; } } throw std::runtime_error(_FMT("resource \"" << Encoding::UTF8.FromUCS2(name) << "\" is not found")); // FIXME: remove _FMT } else { // Regular file #if defined(_WIN32) // Windows version: change slashes to backslashes for (auto& c: name) if (c == L'/') c = L'\\'; #else // No modifications #endif #ifdef _MSC_VER auto result = std::make_shared<std::ifstream>(name, std::ios_base::in|std::ios_base::binary); if (!result || result->fail()) { throw std::runtime_error(_FMT("file \"" << Encoding::UTF8.FromUCS2(name) << "\" cannot be opened")); } return result; #else std::string name_u8 = Encoding(L"utf8").FromUCS2(name); return std::shared_ptr<std::istream>(new std::ifstream(name_u8, std::ios_base::in|std::ios_base::binary)); #endif } }
void fgStringTest(const FgArgs &) { Construct(); Copy(); Assign(); Append(); Comparisons(); Encoding(); Replace(); Compare(); Split(); StartsWith(); }
void LearningRankN(double* x_training, double* x_trainingEncoded, int nx, int ntrain, int niter, KernelType kernel, double epsilon, double* p_Ci, double* p_Cinv, double sigma_A, double sigma_Pow, double* xmean, int doEncoding, double* optAlphas, double* pTwoSigmaPow2, double kernelParam1, double kernelParam2, int normalize, double* X_min, double* X_max) { //0. Init Temp Data int nAlpha = ntrain-1; double* p_Kij = (double*)mxCalloc(ntrain*ntrain,sizeof(double)); double* p_dKij = (double*)mxCalloc(nAlpha*nAlpha,sizeof(double)); double* p_alpha = (double*)mxCalloc(nAlpha,sizeof(double)); double* p_sumAlphaDKij = (double*)mxCalloc(nAlpha,sizeof(double)); double* p_div_dKij = (double*)mxCalloc(nAlpha*nAlpha,sizeof(double)); double* p_dx = (double*)mxCalloc(nx,sizeof(double)); double* Kvals = (double*)mxCalloc(ntrain,sizeof(double)); int i,j; double ttotal = 0; //1. Transform training points to the new coordinate system and //then compute Euclidean distance instead of 'EXPENSIVE' Mahalanobis distance if (doEncoding == 1) { //p_Cinv is the C^-0.5 ;) Encoding(x_training, x_trainingEncoded, p_Cinv, xmean, ntrain, nx); } if (normalize == 1) { normalizeX(x_trainingEncoded, ntrain, nx, X_min, X_max); } //2. Calculate the distance between points, then calculate sigma(gamma) and Kernel Matrix double TwoSigmaPow2 = 0; CalculateTrainingKernelMatrix(x_trainingEncoded, ntrain, nx, p_Kij, &TwoSigmaPow2, sigma_A, sigma_Pow, kernel, kernelParam1, kernelParam2); //3. Optimize alpha parameters OptimizeL(ntrain, p_Ci, epsilon, niter, p_Kij, p_dKij, p_alpha, p_sumAlphaDKij, p_div_dKij); *pTwoSigmaPow2 = TwoSigmaPow2; for (int i=0; i<nAlpha; i++) { optAlphas[i] = p_alpha[i]; } mxFree(p_sumAlphaDKij); mxFree(p_div_dKij); mxFree(p_dKij); mxFree(p_Kij); mxFree(p_dx); mxFree(p_alpha); mxFree(Kvals); }
status_t FFont::Flatten(void *buffer, ssize_t size) const { if( size < sizeof(flat_font_data) ) return B_BAD_VALUE; // Easy reference to the buffer. flat_font_data* fdat = (flat_font_data*)buffer; memset(fdat,0,sizeof(*fdat)); // Stash away name of family and style. GetFamilyAndStyle(&fdat->family,&fdat->style); // This is used as a temporary when byte-swapping floats. // Note that we are assuming a float is 4 bytes. union { uint32 aslong; float asfloat; } swap; // Byte-swap size, shear, and rotation into the flattened // structure. This is written for clarity more than speed, // since the additional overhead will be entirely subsumed // by everything else going on. swap.asfloat = Size(); swap.aslong = htonl(swap.aslong); fdat->size = swap.asfloat; swap.asfloat = Shear(); swap.aslong = htonl(swap.aslong); fdat->shear = swap.asfloat; swap.asfloat = Rotation(); swap.aslong = htonl(swap.aslong); fdat->rotation = swap.asfloat; // Byte-swap the remaining data into the flattened structure. fdat->flags = htonl(Flags()); fdat->face = htons(Face()); fdat->spacing = Spacing(); fdat->encoding = Encoding(); fdat->mask = htonl(Mask()); return B_NO_ERROR; }
void FFont::UpdateTo(BFont* font, uint32 mask) const { if( !font ) return; mask &= attrMask; if( (mask&B_FONT_ALL) == B_FONT_ALL ) { // Quickly copy everything. *font = *(BFont*)this; return; } // Only copy specific fields. if( mask & B_FONT_FAMILY_AND_STYLE ) { font->SetFamilyAndStyle(FamilyAndStyle()); } if( mask & B_FONT_SIZE ) { font->SetSize(Size()); } if( mask & B_FONT_SHEAR ) { font->SetShear(Shear()); } if( mask & B_FONT_ROTATION ) { font->SetRotation(Rotation()); } if( mask & B_FONT_SPACING ) { font->SetSpacing(Spacing()); } if( mask & B_FONT_ENCODING ) { font->SetEncoding(Encoding()); } if( mask & B_FONT_FACE ) { font->SetFace(Face()); } if( mask & B_FONT_FLAGS ) { font->SetFlags(Flags()); } }
void CX509Certificate::ConstructL(const TDesC8& aBinaryData, TInt& aPos) { TASN1DecGeneric gen(aBinaryData.Right(aBinaryData.Length() - aPos)); gen.InitL(); // The outermost tag for X509 certificates is always a sequence. // Since this tag does not form part of the signed data it is possible // to corrupt the tag by changing it to any other ASN.1 tag and process // the rest of the certificate as normal. // However, we still reject the certificate anyway to avoid // confusion because the data does not match the X.509 specification. if (gen.Tag() != EASN1Sequence) { User::Leave(KErrArgument); } aPos += gen.LengthDER(); iKeyFactory = new(ELeave) TX509KeyFactory; iEncoding = gen.Encoding().AllocL(); TASN1DecSequence encSeq; TInt pos = 0; CArrayPtrFlat<TASN1DecGeneric>* seq = encSeq.DecodeDERLC(*iEncoding, pos, 3, 3); TASN1DecGeneric* encSigAlg = seq->At(1); iSigningAlgorithm = CX509SigningAlgorithmIdentifier::NewL(encSigAlg->Encoding()); TASN1DecBitString encBS; iSignature = encBS.ExtractOctetStringL(*(seq->At(2))); CleanupStack::PopAndDestroy();//seq CSHA1* hash = CSHA1::NewL(); CleanupStack::PushL(hash); iFingerprint = hash->Final(Encoding()).AllocL(); CleanupStack::PopAndDestroy();//hash ConstructCertL(); }
void main() { datum key,value; GDBM_FILE index_dbm; hit l; N32 buf_size, fixed = 0; key.dptr = &(str[0]); if((index_dbm = gdbm_open("index",4096, GDBM_WRCREAT, 0644, 0)) == NULL) { fprintf(stderr,"Can't open gdbm file!\n"); exit(1); } fp2 = fopen(GUIDEFILE,"r"); fp4 = fopen(DIRFILE,"r"); fp3 = fopen("hlpfile","w"); setbuf (fp3, NULL); for ( i = 0; i < FIELDS; i++ ) fixed += lens[i]; /* The last file is for merely statistical info; I'm logging the sizes of gdbm entries for all words being stored, for future analysis and research. It is not used for any functional purposes. */ while( fscanf ( fp2, "%s %llu %u %u\n", str, &offst, &tot_fr, &blkn ) != EOF ) { free ( val_buffer ); buf_size = ( blkn * fixed + TYPE_LENGTH + FREQ2_LENGTH + OFFST_LENGTH ) / 8 + 1; val_buffer = (char *) malloc ( buf_size ); value.dptr = &(val_buffer[0]); byte_counter = 0; word_length = TYPE_LENGTH; word_code = TYPE2; encoding(); word_length = FREQ2_LENGTH; word_code = tot_fr; encoding(); word_length=OFFST_LENGTH; word_code=offst; encoding(); for( i = 0; i < blkn; i++) { if ( fgets (hstr, LINESIZE, fp4) ) { readhit (hstr, &l); Encoding( &l ); } else { fprintf (stderr, "synchronization error reading block directory.\n"); exit (1); } } /* "for" */ bytes_to_load=(71-free_space)/8; load(); bytes_to_load=8; key.dsize = strlen(str); value.dsize = byte_counter; if (gdbm_store(index_dbm,key,value,GDBM_REPLACE) !=0) { fprintf(stderr,"Problem storing gdbm entry for %s.\n",key.dptr); exit(1); } fprintf (fp3, "%s %d\n", str, byte_counter); } /* while */ fclose(fp2); fclose(fp3); fclose(fp4); gdbm_close(index_dbm); exit(0); }
KVDictionary::Encoding KVDictionary::Encoding::forIndex(const Ordering &o) { return Encoding(false, true, o); }
/*********************************************************** * Constructor ***********************************************************/ HAttachmentItem::HAttachmentItem(const char* name, off_t file_offset, int32 data_len, const char *content_type, const char *encoding, const char *charset) :CLVEasyItem(0,false,false,20.0) ,fFileOffset(file_offset) ,fDataLen(data_len) ,fExtracted(false) ,fContentType(NULL) ,fEncoding(NULL) ,fCharset(NULL) ,fName(NULL) { fName = (name)?name:_("Unknown"); Encoding().Mime2UTF8(fName); SetColumnContent(1,fName.String()); SetColumnContent(2,(content_type)?content_type:_("(Unknown)")); char *size = new char[15]; float d = 0; char *unit = new char[6]; if(data_len < 1024) { d = data_len; ::strcpy(unit,_("bytes")); }else if(data_len >= 1024 && data_len < 1024*1024){ d = data_len/1024.0; ::strcpy(unit,_("KB")); }else{ d = data_len/(1024.0*1024.0); ::strcpy(unit,_("MB")); } ::sprintf(size,"%6.2f %s",d,unit); SetColumnContent(3,size); delete[] size; delete[] unit; BBitmap *bitmap = new BBitmap(BRect(0,0,15,15),B_CMAP8); BMimeType preferredApp; if(content_type) { BMimeType mime(content_type); char prefApp[B_MIME_TYPE_LENGTH]; mime.GetPreferredApp(prefApp); preferredApp.SetTo(prefApp); fContentType = ::strdup(content_type); if(preferredApp.GetIconForType(content_type,bitmap,B_MINI_ICON) != B_OK) { mime.GetIcon(bitmap,B_MINI_ICON); } SetColumnContent(0,bitmap); } delete bitmap; if(encoding) fEncoding = ::strdup(encoding); if(charset) fCharset = ::strdup(charset); }
void cInstrTypeRI::Encode() { cInstrTypeR::Encode(); Encoding(Encoding() | (mInteger.Int() & 0x03ffffff)); }
TInt CVBookmarkConverter::ImportVBookmarkL( const TDesC8& aBuffer ) { LOGGER_ENTERFN( "CVBookmarkConverter::ImportVBookmarkL" ); ResetL(); TInt error = KErrNone; TInt position = 0; TPtrC8 tag; TPtrC8 value; TPtrC8 properties; error = ReadTagAndValue( aBuffer, position, tag, value, properties ); if( error != KErrNone ) { LOGGER_WRITE_1( "ReadTagAndValue err: %d", error ); return error; } if ( ( tag != KVBMKBegin ) || ( value != KVBMKVbkm ) ) { LOGGER_WRITE( "Invalid tag" ); return KErrNotFound; } while ( ( error = ReadTagAndValue( aBuffer, position, tag, value, properties ) ) == KErrNone ) { // Version if ( tag == KVBMKVersion ) { SetVersionL( value ); } // Url else if ( tag == KVBMKUrl ) { SetUrlL( value ); } // Title else if ( tag == KVBMKTitle ) { TBookmarkEncoding encoding = Encoding( properties ); SetTitleL( value, encoding ); } // Beginning of envelope else if ( ( tag == KVBMKBegin ) && ( value == KVBMKEnv ) ) { // Read the envelope, quit if error error = ReadEnvelopeL( aBuffer, position ); if( error != KErrNone ) { return error; } } // End of Bookmark else if ( ( tag == KVBMKEnd ) && ( value == KVBMKVbkm ) ) { return error; } else { // Unknown data, skip } } LOGGER_LEAVEFN( "CVBookmarkConverter::ImportVBookmarkL" ); return error; }
test ( Range&& range, Encoding&& encoding = Encoding(), Validation&& validation = Validation() ) { }
void part_four_describe() { bool flag=true; while(flag) { cout<<"******************************************"<<endl; cout<<"* 第四章 ACM程序设计实战 *"<<endl; cout<<"******************************************"<<endl; cout<<"*(1)Quicksum *"<<endl; cout<<"*(2)IBM Minus One *"<<endl; cout<<"*(3)Binary Numbers *"<<endl; cout<<"*(4)Encoding *"<<endl; cout<<"*(5)Look and Say *"<<endl; cout<<"*(6)Abbreviation *"<<endl; cout<<"*(7)The Seven Percent Solution *"<<endl; cout<<"*(8)Digital Roots *"<<endl; cout<<"*(9)Box of Bricks *"<<endl; cout<<"*(10)Geometry Made Simple *"<<endl; cout<<"*(11)Reverse Text *"<<endl; cout<<"*(12)Word Reversal* *"<<endl; cout<<"*(13)A Simple Question of Chemistry *"<<endl; cout<<"*(14)Adding Reversed Numbers *"<<endl; cout<<"*(15)Image Transformation *"<<endl; cout<<"*(16)Beautiful Meadow *"<<endl; cout<<"*(17)DNA Sorting *"<<endl; cout<<"*(18)Daffodil Number *"<<endl; cout<<"*(19)Error Correction *"<<endl; cout<<"*(20)Martian Addition *"<<endl; cout<<"*(21)FatMouse’ Trade *"<<endl; cout<<"*(22)List the Books *"<<endl; cout<<"*(23)Head-to-Head Match *"<<endl; cout<<"*(24)Windows Message Queue *"<<endl; cout<<"*(25)Language of FatMouse *"<<endl; cout<<"*(26)Palindromes *"<<endl; cout<<"*(27)Root of the Problem *"<<endl; cout<<"*(28)Magic Square *"<<endl; cout<<"*(29)Semi-Prime *"<<endl; cout<<"*(30)Beautiful Number *"<<endl; cout<<"*(31)Phone List *"<<endl; cout<<"*(32)Calendar *"<<endl; cout<<"*(33)No Brainer *"<<endl; cout<<"*(34)Quick Change *"<<endl; cout<<"*(35)Total Amount *"<<endl; cout<<"*(36)Electrical Outlets *"<<endl; cout<<"*(37)Speed Limit *"<<endl; cout<<"*(38)Beat the Spread! *"<<endl; cout<<"*(39)Champion of the Swordsmanship *"<<endl; cout<<"*(40)Doubles *"<<endl; cout<<"*(41)File Searching *"<<endl; cout<<"*(42)Old Bill *"<<endl; cout<<"*(43)Divisor Summation *"<<endl; cout<<"*(44)Easier Done Than Said? *"<<endl; cout<<"*(45)Let the Balloon Rise *"<<endl; cout<<"*(46)The Hardest Problem Ever *"<<endl; cout<<"*(47)Fibonacci Again *"<<endl; cout<<"*(48)Excuses, Excuses! *"<<endl; cout<<"*(49)Lowest Bit *"<<endl; cout<<"*(50)Longest Ordered Subsequence *"<<endl; cout<<"******************************************"<<endl; cout<<"请输入对应的编号进入相应的题目(返回上级输入0):"<<endl; int num; cin>>num; while(num<0&&num>50){ cout<<"编号不存在"<<endl; cout<<"请输入对应的编号进入相应的题目(返回上级输入0):"<<endl; cin>>num; } switch(num){ case 0:flag=false;break; case 1:QuickSum();break; case 2:IBMMinusOne();break; case 3:BinaryNumbers();break; case 4:Encoding();break; case 5:LookAndSay();break; case 6:Abbreviation();break; case 7:TheSevenPercentSolution();break; case 8:DigitalRoots();break; case 9:BoxofBricks();break; case 10:GeometryMadeSimple();break; case 11:ReverseText();break; case 12:WordReversal();break; case 13:ASimpleQuestionofChemistry();break; case 14:AddingReversedNumbers();break; case 15:ImageTransformation();break; case 16:BeautifulMeadow();break; case 17:DNASorting();break; case 18:DaffodilNumber();break; case 19:ErrorCorrection();break; case 20:MartianAddition();break; case 21:FatMouseTrade();break; case 22:ListtheBooks();break; case 23:HeadToHeadMatch();break; case 24:WindowsMessageQueue();break; case 25:LanguageofFatMouse();break; case 26:Palindromes();break; case 27:RootoftheProblem();break; case 28:MagicSquare();break; case 29:SemiPrime();break; case 30:BeautifulNumber();break; case 31:PhoneList();break; case 32:Calendar();break; case 33:NoBrainer();break; case 34:QuickChange();break; case 35:TotalAmount();break; case 36:ElectricalOutlets();break; case 37:SpeedLimit();break; case 38:BeattheSpread();break; case 39:ChampionoftheSwordsmanship();break; case 40:Doubles();break; case 41:FileSearching();break; case 42:OldBill();break; case 43:DivisorSummation();break; case 44:EasierDoneThanSaid();break; case 45:LettheBalloonRise();break; case 46:TheHardestProblemEver();break; case 47:FibonacciAgain();break; case 48:ExcusesExcuses();break; case 49:LowestBit();break; case 50:LongestOrderedSubsequence();break; //case 3:part_three_describe();break; //case 4:part_four_describe();break; } } total_describe(); }
void main() { datum key,value; GDBM_FILE index_dbm; Z32 local_counter; hit i; Z8 str[LINESIZE]; Z8 *s; setbuf (stdout, NULL); val_buffer = (char *) malloc ( BUFFERSIZE ); key.dptr = &(str[0]); value.dptr = &(val_buffer[0]); if((index_dbm = gdbm_open("index",4096, GDBM_WRCREAT, 0644, 0)) == NULL) { fprintf(stderr,"Can't open gdbm file!\n"); exit(1); } while ( gets (str) ) { s = index (str, ' ') + 1; str [ s - str - 1 ] = '\0'; if ( !strcmp (str, cntrl_str) ) { occ_num = atol (s); byte_counter = 0; conc_counter = 0; word_length = TYPE_LENGTH; word_code = TYPE1; encoding(); word_length=FREQ1_LENGTH; word_code=occ_num; encoding(); } else { readhit (s, &i); if(occ_num == conc_counter) { fprintf(stderr, "Input filter error!\n"); exit(1); } Encoding ( &i ); conc_counter++; if ( conc_counter == occ_num) { bytes_to_load=(71-free_space)/8; load(); bytes_to_load=8; key.dsize = strlen(str); value.dsize = byte_counter; if (gdbm_store(index_dbm,key,value,GDBM_REPLACE) !=0) { fprintf(stderr,"Problem storing dbm entry for %s.\n",key.dptr); exit(1); } local_counter++; if ( !( local_counter % 1000 )) putchar ('+'); else if ( !( local_counter % 100 )) putchar ('.'); } } /* "else" */ } /* while */ gdbm_close (index_dbm); exit(0); }
KVDictionary::Encoding KVDictionary::Encoding::forRecordStore() { return Encoding(true, false, Ordering::make(BSONObj())); }