├── .dockerignore ├── .env ├── .gitignore ├── CMakeCustom ├── FindGMP.cmake ├── FindMEMCACHED.cmake └── FindREADLINE.cmake ├── CMakeLists.txt ├── Dockerfile ├── LICENSE ├── README.md ├── build └── CMakeLists.txt ├── docker-compose.yml ├── docker ├── config │ ├── bin │ │ ├── CheckSignature │ │ ├── EllipsisCompiler │ │ ├── InfCompiler │ │ └── InfServer │ └── conf │ │ ├── Environment.conf │ │ ├── InfCompiler.conf │ │ ├── InfServer.conf │ │ ├── ap-process-server.conf │ │ └── functions.lst ├── deb │ ├── libinfengine-common-perl_0.1.6-1_all.deb │ └── libinfengine-server-perl_0.2.3-1_all.deb ├── dldata │ ├── .gitignore │ ├── aliases.dl │ ├── defvars.lst │ ├── dict.lst │ ├── dl.lst │ ├── syn.lst │ ├── synonyms │ │ └── synonyms25062013.txt │ └── templates.txt ├── start.sh └── syslog │ └── rsyslog.conf ├── ext ├── CMakeLists.txt ├── aip │ ├── CMakeLists.txt │ ├── headers │ │ └── CMakeLists.txt │ └── src │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── Filtration3 │ │ ├── CMakeLists.txt │ │ ├── common │ │ │ ├── CMakeLists.txt │ │ │ ├── DocMessage.cpp │ │ │ └── DocMessage.h │ │ ├── stopdict_ex │ │ │ ├── CMakeLists.txt │ │ │ ├── StopDictEx.cpp │ │ │ └── StopDictEx.h │ │ └── terms │ │ │ ├── CMakeLists.txt │ │ │ ├── FltTerm.h │ │ │ ├── FltTermsArray.cpp │ │ │ ├── FltTermsArray.h │ │ │ ├── FltTermsBase.cpp │ │ │ ├── FltTermsBase.h │ │ │ ├── FltTermsBaseLP.cpp │ │ │ ├── FltTermsBaseRO.cpp │ │ │ ├── FltTermsBaseWR.cpp │ │ │ ├── FltTermsMatcher.cpp │ │ │ ├── FltTermsMatcher.h │ │ │ ├── FltTermsStop.cpp │ │ │ ├── FltTermsStopEx.h │ │ │ ├── FltTermsWFuncs.cpp │ │ │ ├── TermsDocImageIterator.h │ │ │ ├── term_attrs.h │ │ │ ├── term_attrs_ntoh.h │ │ │ ├── terms.cpp │ │ │ ├── terms.h │ │ │ └── terms_types.h │ │ ├── LingProc4 │ │ ├── ArabicMorph │ │ │ └── libbuckwalter │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── LPArabicMorph.cpp │ │ │ │ ├── LPArabicMorph.h │ │ │ │ ├── buckwalter.table │ │ │ │ ├── compatibility_consumer_iface.h │ │ │ │ ├── compatibility_file_parser.cpp │ │ │ │ ├── compatibility_file_parser.h │ │ │ │ ├── compatibility_storage.cpp │ │ │ │ ├── compatibility_storage.h │ │ │ │ ├── forms.cpp │ │ │ │ ├── forms.h │ │ │ │ ├── fstorage_utils.cpp │ │ │ │ ├── fstorage_utils.h │ │ │ │ ├── grammar.cpp │ │ │ │ ├── grammar.h │ │ │ │ ├── grammar_consumer_iface.h │ │ │ │ ├── grammar_file_parser.cpp │ │ │ │ ├── grammar_file_parser.h │ │ │ │ ├── grammar_storage.cpp │ │ │ │ ├── grammar_storage.h │ │ │ │ ├── lexemes.cpp │ │ │ │ ├── lexemes.h │ │ │ │ ├── morphology.cpp │ │ │ │ ├── morphology.h │ │ │ │ ├── pascalstrings.cpp │ │ │ │ ├── pascalstrings.h │ │ │ │ ├── perl_tr_to_include.py │ │ │ │ ├── transformation.cpp │ │ │ │ ├── transformation.h │ │ │ │ ├── utils.cpp │ │ │ │ └── utils.h │ │ ├── BinaryData.h │ │ ├── CMakeLists.txt │ │ ├── Constants.h │ │ ├── DetectWords.cpp │ │ ├── DetectWords.h │ │ ├── DocImage │ │ │ ├── DocImage.cpp │ │ │ ├── DocImage.h │ │ │ ├── DocImageFunctor.h │ │ │ ├── DocImageIterator.h │ │ │ └── DocImageTypes.h │ │ ├── DocText │ │ │ ├── DocText.cpp │ │ │ ├── DocText.h │ │ │ ├── DocTextBin.h │ │ │ ├── DocTextLine.h │ │ │ ├── DocTextPara.h │ │ │ ├── DocTextPhrase.h │ │ │ ├── DocTextStorage.h │ │ │ ├── DocTextWord.h │ │ │ └── DocTextWordBreaker.h │ │ ├── IndirectTable.h │ │ ├── IndirectTableFS.h │ │ ├── LPStrict.cpp │ │ ├── LPStrict.h │ │ ├── LanguageInfo.cpp │ │ ├── LanguageInfo.h │ │ ├── LemmatizeResultFunctor.h │ │ ├── LexID.h │ │ ├── LexID32.h │ │ ├── LexID64.h │ │ ├── LexIDExtra.h │ │ ├── LingProc.cpp │ │ ├── LingProc.h │ │ ├── LingProcData.cpp │ │ ├── LingProcData.h │ │ ├── LingProcDict.cpp │ │ ├── LingProcDict.h │ │ ├── LingProcErrors.cpp │ │ ├── LingProcErrors.h │ │ ├── LingProcPresets.h │ │ ├── Markup.h │ │ ├── MarkupAttr.h │ │ ├── MarkupBin.h │ │ ├── MarkupStorage.h │ │ ├── MarkupTypes.h │ │ ├── NormalizeResultFunctor.h │ │ ├── PhraseBreak │ │ │ ├── LPPhraseBreak.cpp │ │ │ ├── PhraseBreakerDict.cpp │ │ │ └── PhraseBreakerDict.h │ │ ├── Process │ │ │ ├── LPLangDetector.cpp │ │ │ ├── LangDetector │ │ │ │ ├── DetectWordsTrigrams.h │ │ │ │ ├── LangDetector.cpp │ │ │ │ ├── LangDetector.h │ │ │ │ ├── Trigrams.h │ │ │ │ ├── trigrams_ar.gperf.h │ │ │ │ ├── trigrams_de.gperf.h │ │ │ │ ├── trigrams_en.gperf.h │ │ │ │ ├── trigrams_es.gperf.h │ │ │ │ ├── trigrams_fr.gperf.h │ │ │ │ ├── trigrams_ru.gperf.h │ │ │ │ ├── trigrams_ua.gperf.h │ │ │ │ └── trigrams_vi.gperf.h │ │ │ ├── ParagraphBreaker.cpp │ │ │ ├── Process.cpp │ │ │ ├── WordBreaker.cpp │ │ │ └── WordBreaker │ │ │ │ ├── DefaultLineBreakerSM.h │ │ │ │ ├── DefaultWordBreakerSM.h │ │ │ │ ├── LPDocTextWordBreaker.h │ │ │ │ ├── RunSM.h │ │ │ │ └── SequenceSM.h │ │ ├── RusLatConv │ │ │ ├── RusLatConv.cpp │ │ │ ├── RusLatConv.h │ │ │ ├── RusLatConvFS.cpp │ │ │ ├── RusLatConvFS.h │ │ │ └── ruslat.h │ │ ├── SimpleMorph │ │ │ ├── LPMorphCommon.h │ │ │ ├── LPMorphFuzzy.cpp │ │ │ ├── LPMorphFuzzy.h │ │ │ ├── LPMorphInterface.h │ │ │ ├── LPMorphNumber.cpp │ │ │ ├── LPMorphNumber.h │ │ │ ├── LPMorphPunct.cpp │ │ │ ├── LPMorphPunct.h │ │ │ ├── LPMorphStrict.cpp │ │ │ ├── LPMorphStrict.h │ │ │ ├── LPMorphTilde.cpp │ │ │ ├── LPMorphTilde.h │ │ │ ├── LPMorphTildeRev.h │ │ │ └── MorphEnumerator.h │ │ ├── StemmatizeResultFunctor.h │ │ ├── StrictMorph │ │ │ ├── API │ │ │ │ ├── StrictMorph.h │ │ │ │ ├── StrictMorphFS.h │ │ │ │ ├── StrictMorphMemoryHandler.h │ │ │ │ ├── StrictMorphParams.h │ │ │ │ └── StrictMorphStorageChunk.h │ │ │ ├── CMakeLists.txt │ │ │ ├── CompoundExclude.h │ │ │ ├── DecompositionProcessor.cpp │ │ │ ├── DecompositionProcessor.h │ │ │ ├── DictionnaryInfo.cpp │ │ │ ├── DictionnaryInfo.h │ │ │ ├── DictionnaryInfoFSRW.cpp │ │ │ ├── DictionnaryInfoFSRW.h │ │ │ ├── DictionnaryInfoRW.cpp │ │ │ ├── DictionnaryInfoRW.h │ │ │ ├── Flexion.h │ │ │ ├── FlexionRW.h │ │ │ ├── FormGram.cpp │ │ │ ├── FormGramDescShadow.h │ │ │ ├── FormGramDescShadowRW.h │ │ │ ├── FormGramRW.cpp │ │ │ ├── LexGram.cpp │ │ │ ├── LexGramDescShadow.h │ │ │ ├── LexGramDescShadowRW.h │ │ │ ├── LexGramRW.cpp │ │ │ ├── LexUnit.cpp │ │ │ ├── LexUnit.h │ │ │ ├── Lexeme.h │ │ │ ├── LexemeRW.h │ │ │ ├── OrthVariantList.h │ │ │ ├── Pack32.cpp │ │ │ ├── Pack64.cpp │ │ │ ├── Paradigm.h │ │ │ ├── ParadigmRW.h │ │ │ ├── PriorityQueue.cpp │ │ │ ├── PriorityQueue.h │ │ │ ├── Stem.h │ │ │ ├── StemCommon.h │ │ │ ├── StemRW.h │ │ │ ├── StrictMorph.cpp │ │ │ ├── StrictMorphFS.cpp │ │ │ ├── StrictMorphFStorageIds.h │ │ │ ├── StrictMorphGram.cpp │ │ │ ├── StrictMorphHeader.cpp │ │ │ ├── StrictMorphHeader.h │ │ │ ├── StrictMorphHeaderFSRW.cpp │ │ │ ├── StrictMorphHeaderFSRW.h │ │ │ ├── StrictMorphHeaderRW.cpp │ │ │ ├── StrictMorphHeaderRW.h │ │ │ ├── StrictMorphParamsMap.h │ │ │ ├── StrictMorphShadow.cpp │ │ │ ├── StrictMorphShadow.h │ │ │ ├── StrictMorphShadowFS.cpp │ │ │ ├── StrictMorphShadowFS.h │ │ │ ├── StrictMorphShadowFSRW.cpp │ │ │ ├── StrictMorphShadowFSRW.h │ │ │ ├── StrictMorphStatus.cpp │ │ │ ├── StrictMorphSynthesis.cpp │ │ │ ├── WordForm.h │ │ │ └── WordFormRW.h │ │ ├── StrictMorphGram │ │ │ ├── FormFilter.h │ │ │ ├── FormGram.h │ │ │ ├── FormGramRW.h │ │ │ ├── Functor.h │ │ │ ├── LexGram.h │ │ │ ├── LexGramRW.h │ │ │ ├── Shadowed.h │ │ │ ├── StrictAllocator.h │ │ │ ├── StrictDictInfo.h │ │ │ ├── StrictLex.h │ │ │ ├── StrictLexOrthVariant.h │ │ │ ├── StrictMorphErrors.h │ │ │ ├── StrictTextBuffer.h │ │ │ ├── StrictWordForm.h │ │ │ ├── StrictWordFormsSet.h │ │ │ └── sm_dll.h │ │ ├── StringsReceiver.h │ │ ├── UCharSet │ │ │ ├── CMakeLists.txt │ │ │ ├── UCharSet.cpp │ │ │ ├── UCharSet.h │ │ │ ├── UCharSetFS.cpp │ │ │ ├── UCharSetFS.h │ │ │ ├── lang_ar.h │ │ │ ├── lang_cy.h │ │ │ ├── lang_cz.h │ │ │ ├── lang_de.h │ │ │ ├── lang_en.h │ │ │ ├── lang_es.h │ │ │ ├── lang_eu.h │ │ │ ├── lang_fr.h │ │ │ ├── lang_ge.h │ │ │ ├── lang_gr.h │ │ │ ├── lang_kz.h │ │ │ ├── lang_pl.h │ │ │ ├── lang_ru.h │ │ │ ├── lang_ua.h │ │ │ ├── lang_vi.h │ │ │ └── props.h │ │ ├── UTFCanonizer.cpp │ │ ├── UTFCanonizer.h │ │ ├── WordNormalizer.cpp │ │ ├── WordNormalizer.h │ │ ├── WordNormalizer │ │ │ ├── WordNormalizerArabic.cpp │ │ │ ├── WordNormalizerArabic.h │ │ │ ├── WordNormalizerDefault.h │ │ │ ├── WordNormalizerEuro.h │ │ │ ├── WordNormalizerGerman.cpp │ │ │ ├── WordNormalizerGerman.h │ │ │ ├── WordNormalizerMorphFuzzy.h │ │ │ ├── WordNormalizerMorphPunct.h │ │ │ ├── WordNormalizerMorphStrict.h │ │ │ └── WordNormalizerMorphTilde.h │ │ ├── WordNormalizerInterface.h │ │ ├── data │ │ │ ├── CMakeLists.txt │ │ │ ├── _tmpl_detect_deu.cpp │ │ │ ├── _tmpl_detect_eng.cpp │ │ │ ├── _tmpl_detect_esp.cpp │ │ │ ├── _tmpl_detect_eur.cpp │ │ │ ├── _tmpl_detect_fra.cpp │ │ │ ├── _tmpl_detect_rus.cpp │ │ │ ├── _tmpl_detect_ukr.cpp │ │ │ ├── _tmpl_detect_vie.cpp │ │ │ ├── _tmpl_phrases_abbr_deu.cpp │ │ │ ├── _tmpl_phrases_abbr_eng.cpp │ │ │ ├── _tmpl_phrases_abbr_esp.cpp │ │ │ ├── _tmpl_phrases_abbr_fra.cpp │ │ │ ├── _tmpl_phrases_abbr_rus.cpp │ │ │ ├── _tmpl_phrases_abbr_vie.cpp │ │ │ ├── _tmpl_phrases_compend.cpp │ │ │ ├── _tmpl_phrases_stop_deu.cpp │ │ │ ├── _tmpl_phrases_stop_eng.cpp │ │ │ ├── _tmpl_phrases_stop_esp.cpp │ │ │ ├── _tmpl_phrases_stop_fra.cpp │ │ │ ├── _tmpl_phrases_stop_rus.cpp │ │ │ ├── _tmpl_phrases_stop_vie.cpp │ │ │ ├── _tmpl_stop_cyr.cpp │ │ │ ├── _tmpl_stop_deu.cpp │ │ │ ├── _tmpl_stop_eng.cpp │ │ │ ├── _tmpl_stop_esp.cpp │ │ │ ├── _tmpl_stop_eur.cpp │ │ │ ├── _tmpl_stop_fra.cpp │ │ │ ├── _tmpl_stop_rus.cpp │ │ │ ├── _tmpl_stop_ukr.cpp │ │ │ ├── _tmpl_suff_cyr.cpp │ │ │ ├── _tmpl_suff_deu.cpp │ │ │ ├── _tmpl_suff_eng.cpp │ │ │ ├── _tmpl_suff_esp.cpp │ │ │ ├── _tmpl_suff_eur.cpp │ │ │ ├── _tmpl_suff_fra.cpp │ │ │ ├── _tmpl_suff_rus.cpp │ │ │ ├── _tmpl_suff_ukr.cpp │ │ │ ├── detect_tables.c │ │ │ ├── detect_tables.h │ │ │ ├── morph_tables.c │ │ │ ├── morph_tables.h │ │ │ ├── phrases_tables.c │ │ │ ├── phrases_tables.h │ │ │ └── source │ │ │ │ ├── CyrList.utf │ │ │ │ ├── CyrStop.utf │ │ │ │ ├── DetectDe.utf │ │ │ │ ├── DetectEn.utf │ │ │ │ ├── DetectEs.utf │ │ │ │ ├── DetectEu.utf │ │ │ │ ├── DetectFr.utf │ │ │ │ ├── DetectRu.utf │ │ │ │ ├── DetectUa.utf │ │ │ │ ├── DetectVi.utf │ │ │ │ ├── DeuList.utf │ │ │ │ ├── DeuStop.utf │ │ │ │ ├── EngList.utf │ │ │ │ ├── EngStop.utf │ │ │ │ ├── EspList.utf │ │ │ │ ├── EspStop.utf │ │ │ │ ├── EurList.utf │ │ │ │ ├── EurStop.utf │ │ │ │ ├── FraList.utf │ │ │ │ ├── FraStop.utf │ │ │ │ ├── FuzzyRusAnalyzeThis.ini │ │ │ │ ├── FuzzyRusNovoteka.ini │ │ │ │ ├── FuzzyRusRegnum.ini │ │ │ │ ├── FuzzyRusSpamtest.ini │ │ │ │ ├── PhraseBreaker │ │ │ │ ├── PhraseBrAbbrDe.utf │ │ │ │ ├── PhraseBrAbbrEn.utf │ │ │ │ ├── PhraseBrAbbrEs.utf │ │ │ │ ├── PhraseBrAbbrFr.utf │ │ │ │ ├── PhraseBrAbbrRu.utf │ │ │ │ ├── PhraseBrAbbrVi.utf │ │ │ │ ├── PhraseBrCompend.utf │ │ │ │ ├── PhraseBrStopwordDe.utf │ │ │ │ ├── PhraseBrStopwordEn.utf │ │ │ │ ├── PhraseBrStopwordEs.utf │ │ │ │ ├── PhraseBrStopwordFr.utf │ │ │ │ ├── PhraseBrStopwordRu.utf │ │ │ │ └── PhraseBrStopwordVi.utf │ │ │ │ ├── RusList.utf │ │ │ │ ├── RusStop.utf │ │ │ │ ├── RusStopKhu.utf │ │ │ │ ├── RusStopMain.utf │ │ │ │ ├── RusStopOvEv.utf │ │ │ │ ├── RusStopVerbs.utf │ │ │ │ ├── RusSuffMain.utf │ │ │ │ ├── RusSuffOvEv.utf │ │ │ │ ├── RusSuffVerbs.utf │ │ │ │ ├── UkrList.utf │ │ │ │ ├── UkrStop.utf │ │ │ │ ├── VieList.utf │ │ │ │ └── VieStop.utf │ │ └── tools │ │ │ ├── CMakeLists.txt │ │ │ ├── UMakeCArray │ │ │ ├── CMakeLists.txt │ │ │ └── UMakeCArray.cpp │ │ │ └── common │ │ │ └── file_raii.h │ │ ├── ZTools │ │ ├── CMakeLists.txt │ │ └── ZUtils │ │ │ ├── Alpha.cpp │ │ │ ├── Alpha.h │ │ │ ├── CMakeLists.txt │ │ │ ├── CSParams.cpp │ │ │ ├── CSParams.h │ │ │ ├── EString.cpp │ │ │ ├── EString.h │ │ │ ├── ScanPath.cpp │ │ │ ├── ScanPath.h │ │ │ ├── StrUtils.cpp │ │ │ └── StrUtils.h │ │ ├── _include │ │ ├── CodePages.h │ │ ├── Cp2Uni.h │ │ ├── _inttype.h │ │ ├── _stdio_.h │ │ ├── _string.h │ │ ├── _time.h │ │ ├── _utf8.h │ │ ├── cc_compat.h │ │ ├── koi8_ctype.h │ │ ├── language.h │ │ ├── ntoh.h │ │ └── wintypes.h │ │ └── lib │ │ ├── CMakeLists.txt │ │ ├── aptl │ │ ├── Functor.h │ │ ├── FunctorBuffer.h │ │ ├── GrowingPool.h │ │ ├── OpenAddressingDict.h │ │ ├── OpenAddressingDict │ │ │ ├── BufferDictStorage.h │ │ │ ├── Common.h │ │ │ ├── FileDictStorage.h │ │ │ └── Preprocessor.h │ │ ├── Pipeline.h │ │ ├── RAII.h │ │ ├── WorkersPool.h │ │ ├── array.h │ │ ├── avector.h │ │ ├── hashmap.h │ │ ├── localbuf.h │ │ ├── memory │ │ │ ├── BaseArena.h │ │ │ ├── MmapCommon.h │ │ │ ├── RawArena.h │ │ │ ├── RefCountArena.h │ │ │ └── ZeroArena.h │ │ ├── ptr_array.h │ │ ├── root_file.h │ │ ├── sfile.h │ │ ├── sizeof.hpp │ │ ├── stable_sort.h │ │ ├── stringmap.h │ │ └── unordered_map.h │ │ ├── component_info │ │ ├── ChangeLog │ │ ├── component_info.h │ │ └── readme │ │ ├── fstorage │ │ ├── CMakeLists.txt │ │ ├── ChangeLog │ │ ├── fstorage.c │ │ ├── fstorage.h │ │ ├── fstorage_id.h │ │ └── readme │ │ ├── hash │ │ ├── hash_fnv.h │ │ └── hash_fnv_tmpl.h │ │ ├── libpts │ │ ├── CMakeLists.txt │ │ ├── ChangeLog │ │ ├── pat_imp.c │ │ ├── pat_imp.h │ │ ├── pat_tree.c │ │ ├── pat_tree.h │ │ ├── pat_types.h │ │ ├── pts.c │ │ ├── pts.h │ │ ├── pts_imp.c │ │ ├── pts_imp.h │ │ ├── ptsfs.c │ │ ├── ptsfs.h │ │ └── readme │ │ ├── libpts2 │ │ ├── CMakeLists.txt │ │ ├── CrossPathFunctor.h │ │ ├── CrossTable.h │ │ ├── CrossTree.cpp │ │ ├── CrossTree.h │ │ ├── CrossTreeInterface.h │ │ ├── CrossTree_Compact.cpp │ │ ├── CrossTree_Standard.cpp │ │ ├── CrossTree_StandardRaw.cpp │ │ ├── PatriciaStorageHandler.h │ │ ├── PatriciaTree.cpp │ │ ├── PatriciaTree.h │ │ ├── PatriciaTreeCore.h │ │ ├── PatriciaTreeFS.cpp │ │ ├── PatriciaTreeFS.h │ │ ├── PatriciaTreeInterface.h │ │ ├── PatriciaTreeOverlay.cpp │ │ ├── PatriciaTreeOverlay.h │ │ ├── PatriciaTreeOverlay_Compact.cpp │ │ ├── PatriciaTreeOverlay_Generic.cpp │ │ ├── PatriciaTreeOverlay_Standard.cpp │ │ ├── PatriciaTreeOverlay_StandardRaw.cpp │ │ ├── PolicyCompact.h │ │ ├── PolicyGeneric.h │ │ ├── PolicyStandard.h │ │ ├── PolicyStandardRaw.h │ │ ├── ReverseIndexMixin.cpp │ │ ├── ReverseIndexMixin.h │ │ ├── ReversedIndexTreeInterface.h │ │ ├── StorageDynamic.h │ │ ├── StorageInterface.h │ │ ├── StorageNodes.h │ │ ├── StorageStatic.h │ │ └── TODO │ │ ├── md5a │ │ ├── CMakeLists.txt │ │ ├── md5a.c │ │ └── md5a.h │ │ ├── mmfile │ │ ├── CMakeLists.txt │ │ ├── MemMapFile.h │ │ ├── MemMapFileUnix.h │ │ ├── mm_file.cpp │ │ └── mm_file.h │ │ └── pcommon │ │ ├── Arab2Uni.cpp │ │ ├── CMakeLists.txt │ │ ├── Dos2Uni.cpp │ │ ├── EucJp2Uni.cpp │ │ ├── Greek2Uni.cpp │ │ ├── Iso2Uni.cpp │ │ ├── Koi2Uni.cpp │ │ ├── Lat12Uni.cpp │ │ ├── Lat12Uni_cyr.cpp │ │ ├── Mac2Uni.cpp │ │ ├── Viet2Uni.cpp │ │ ├── Win2Uni.cpp │ │ ├── convert.cpp │ │ ├── convert2UTF.cpp │ │ ├── koi8_ctype.c │ │ ├── readme │ │ ├── string.c │ │ ├── strptime.c │ │ ├── tabJisX02082uni.c │ │ └── tabJisX02122uni.c └── clientlib │ ├── .gitignore │ ├── CMakeLists.txt │ ├── ClientLib │ ├── Allocator.cpp │ ├── Allocator.h │ ├── Answer.c │ ├── Answer.h │ ├── CMakeLists.txt │ ├── CSData.hpp │ ├── ClientLib.c │ ├── ClientLib.h │ ├── ClientLib.hpp │ ├── Errors.h │ ├── InfData.c │ ├── InfData.h │ ├── ItemTypes.hpp │ ├── Protocol.hpp │ ├── SessionData.c │ ├── SessionData.h │ ├── csDataPack.cpp │ └── csDataPack.h │ ├── apcs │ ├── CMakeLists.txt │ ├── ap-server.c │ ├── csdata.c │ ├── csdata.h │ ├── libclient.c │ ├── readwrite.c │ └── readwrite.h │ ├── aptl │ └── avector.h │ └── nMemoryAllocator │ ├── CMakeLists.txt │ ├── nMemoryAllocator.cpp │ ├── nMemoryAllocator.h │ └── nMemoryAllocator.hpp ├── scripts ├── build.sh ├── dlupdate.sh ├── down.sh ├── start.sh └── stop.sh └── src ├── CMakeLists.txt ├── EllipsisCompiler ├── CMakeLists.txt ├── EllipsisCompiler.conf ├── EllipsisCompiler.cpp ├── EllipsisCompiler.hpp ├── EllipsisSources.conf └── MainEllipsisCompiler.cpp ├── InfCompiler ├── CMakeLists.txt ├── InfCompiler.cpp ├── InfCompiler.hpp └── MainCompiler.cpp ├── InfEngine2 ├── Build.hpp ├── CMakeLists.txt ├── Common.hpp ├── Functions │ └── FunctionLib.hpp ├── InfEngine │ ├── CMakeLists.txt │ ├── CoreRO.cpp │ ├── CoreRO.hpp │ ├── CoreWR.cpp │ ├── CoreWR.hpp │ ├── DLData.cpp │ ├── DLData.hpp │ ├── ExtFinder.cpp │ ├── ExtFinder.hpp │ ├── Finder.cpp │ ├── Finder.hpp │ ├── Format.hpp │ ├── IndexBase.cpp │ ├── IndexBase.hpp │ ├── Indexer.cpp │ ├── Indexer.hpp │ ├── InfDict │ │ ├── InfDict.cpp │ │ ├── InfDict.hpp │ │ ├── InfDictInstrInclude.cpp │ │ ├── InfDictInstrInclude.hpp │ │ ├── InfDictInstruction.hpp │ │ ├── InfDictManipulator.cpp │ │ ├── InfDictManipulator.hpp │ │ ├── InfDictSource.cpp │ │ ├── InfDictSource.hpp │ │ ├── InfDictString.cpp │ │ ├── InfDictString.hpp │ │ ├── InfDictStringManipulator.cpp │ │ ├── InfDictStringManipulator.hpp │ │ └── InfDictWrapManipulator.hpp │ ├── InfFunctions │ │ ├── Alias.cpp │ │ ├── Alias.hpp │ │ ├── AliasParser.cpp │ │ ├── AliasParser.hpp │ │ ├── AliasRegistry.cpp │ │ ├── AliasRegistry.hpp │ │ ├── FuncTagRegistry.cpp │ │ ├── FuncTagRegistry.hpp │ │ ├── FunctionsRegistry.cpp │ │ ├── FunctionsRegistry.hpp │ │ ├── InfExternalFunction.cpp │ │ ├── InfExternalFunction.hpp │ │ ├── InfFunction.cpp │ │ ├── InfFunction.hpp │ │ ├── InfInternalFunction.cpp │ │ ├── InfInternalFunction.hpp │ │ ├── InternalFunctions │ │ │ ├── BelongsTo.cpp │ │ │ ├── BelongsTo.hpp │ │ │ ├── BelongsToExt.cpp │ │ │ ├── BelongsToExt.hpp │ │ │ ├── CalcTime.cpp │ │ │ ├── CalcTime.hpp │ │ │ ├── Capitalize.cpp │ │ │ ├── Capitalize.hpp │ │ │ ├── Date.cpp │ │ │ ├── Date.hpp │ │ │ ├── DayOfWeek.cpp │ │ │ ├── DayOfWeek.hpp │ │ │ ├── Dec.cpp │ │ │ ├── Dec.hpp │ │ │ ├── DictsMatch.cpp │ │ │ ├── DictsMatch.hpp │ │ │ ├── DictsMatchExt.cpp │ │ │ ├── DictsMatchExt.hpp │ │ │ ├── DictsNotMatch.cpp │ │ │ ├── DictsNotMatch.hpp │ │ │ ├── DumpVar.cpp │ │ │ ├── DumpVar.hpp │ │ │ ├── FindContacts │ │ │ │ ├── FindContacts.cpp │ │ │ │ ├── FindContacts.hpp │ │ │ │ ├── FindEmail.cpp │ │ │ │ ├── FindEmail.hpp │ │ │ │ ├── FindPhone.cpp │ │ │ │ ├── FindPhone.hpp │ │ │ │ ├── contacts_finder.flex │ │ │ │ └── contacts_finder.hpp │ │ │ ├── In.cpp │ │ │ ├── In.hpp │ │ │ ├── Inc.cpp │ │ │ ├── Inc.hpp │ │ │ ├── InternalFunction.cpp │ │ │ ├── InternalFunction.hpp │ │ │ ├── IsEmpty.cpp │ │ │ ├── IsEmpty.hpp │ │ │ ├── IsEqual.cpp │ │ │ ├── IsEqual.hpp │ │ │ ├── IsNotEmpty.cpp │ │ │ ├── IsNotEmpty.hpp │ │ │ ├── IsNotEqual.cpp │ │ │ ├── IsNotEqual.hpp │ │ │ ├── ListTree.cpp │ │ │ ├── ListTree.hpp │ │ │ ├── MeasConv.cpp │ │ │ ├── MeasConv.hpp │ │ │ ├── NotBelongsTo.cpp │ │ │ ├── NotBelongsTo.hpp │ │ │ ├── NotIn.cpp │ │ │ ├── NotIn.hpp │ │ │ ├── NumberToString.cpp │ │ │ ├── NumberToString.hpp │ │ │ ├── SetValue.cpp │ │ │ ├── SetValue.hpp │ │ │ ├── StringToNumber.cpp │ │ │ ├── StringToNumber.hpp │ │ │ ├── Time.cpp │ │ │ ├── Time.hpp │ │ │ ├── True.cpp │ │ │ ├── True.hpp │ │ │ ├── length.cpp │ │ │ └── length.hpp │ │ ├── TagFunctionsCache.cpp │ │ └── TagFunctionsCache.hpp │ ├── InfOutput.h │ ├── InfPattern.cpp │ ├── InfPattern.hpp │ ├── InfPattern │ │ ├── ConditionsRegistry.cpp │ │ ├── ConditionsRegistry.hpp │ │ ├── Dict.cpp │ │ ├── Dict.hpp │ │ ├── Errors.hpp │ │ ├── ItemTypes.h │ │ ├── Items.hpp │ │ ├── Items │ │ │ ├── Array.cpp │ │ │ ├── Array.hpp │ │ │ ├── Base.hpp │ │ │ ├── BaseCondition.hpp │ │ │ ├── Br.hpp │ │ │ ├── DictRef.hpp │ │ │ ├── Disableautovars.hpp │ │ │ ├── EliReference.hpp │ │ │ ├── EliStar.hpp │ │ │ ├── Empty.hpp │ │ │ ├── KeywordArgument.cpp │ │ │ ├── KeywordArgument.hpp │ │ │ ├── Lists.hpp │ │ │ ├── Nothing.hpp │ │ │ ├── Reference.hpp │ │ │ ├── Space.hpp │ │ │ ├── Star.hpp │ │ │ ├── TLCS.hpp │ │ │ ├── TagBreak.hpp │ │ │ ├── TagDict.hpp │ │ │ ├── TagDictInline.cpp │ │ │ ├── TagDictInline.hpp │ │ │ ├── TagExtendAnswer.cpp │ │ │ ├── TagExtendAnswer.hpp │ │ │ ├── TagFunction.cpp │ │ │ ├── TagFunction.hpp │ │ │ ├── TagGetAnswer.hpp │ │ │ ├── TagHref.cpp │ │ │ ├── TagHref.hpp │ │ │ ├── TagIf.cpp │ │ │ ├── TagIf.hpp │ │ │ ├── TagInf.hpp │ │ │ ├── TagInstruct.hpp │ │ │ ├── TagOpenWindow.hpp │ │ │ ├── TagPre.cpp │ │ │ ├── TagPre.hpp │ │ │ ├── TagRSS.cpp │ │ │ ├── TagRSS.hpp │ │ │ ├── TagSwitch.cpp │ │ │ ├── TagSwitch.hpp │ │ │ ├── TagVar.hpp │ │ │ ├── Text.cpp │ │ │ └── Text.hpp │ │ ├── Parser.cpp │ │ ├── Parser.hpp │ │ ├── String.hpp │ │ ├── StringParser.cpp │ │ ├── StringParser.hpp │ │ └── Weight.hpp │ ├── InfProfile.cpp │ ├── InfProfile.hpp │ ├── MatchedPattern.cpp │ ├── MatchedPattern.hpp │ ├── NDocImage.cpp │ ├── NDocImage.hpp │ ├── PatternsStorage.cpp │ ├── PatternsStorage.hpp │ ├── RequestStat.hpp │ ├── SearchEngine.cpp │ ├── SearchEngine.hpp │ ├── Session.cpp │ ├── Session.hpp │ ├── Signature │ │ ├── BFunctions.cpp │ │ ├── BFunctions.hpp │ │ ├── BInfEngineInfo.cpp │ │ ├── BInfEngineInfo.hpp │ │ ├── Format.hpp │ │ ├── Function.cpp │ │ ├── Function.hpp │ │ ├── Signature.cpp │ │ ├── Signature.hpp │ │ ├── SignatureFormat.hpp │ │ ├── SignatureUtils.cpp │ │ └── SignatureUtils.hpp │ ├── Symbolyms │ │ ├── SymbolymBase.cpp │ │ ├── SymbolymBase.hpp │ │ ├── SymbolymCommon.hpp │ │ ├── SymbolymTables.cpp │ │ ├── SymbolymTables.hpp │ │ └── tables │ │ │ ├── georgian.hpp │ │ │ ├── kyrgyz.hpp │ │ │ └── ukraine.hpp │ ├── Synonyms │ │ ├── ListFileParser.cpp │ │ ├── ListFileParser.hpp │ │ ├── SynonymBase.cpp │ │ ├── SynonymBase.hpp │ │ ├── SynonymCommon.hpp │ │ ├── SynonymCompiler.cpp │ │ ├── SynonymCompiler.hpp │ │ ├── SynonymFormat.hpp │ │ ├── SynonymIndex.cpp │ │ ├── SynonymIndex.hpp │ │ ├── SynonymMatcher.cpp │ │ ├── SynonymMatcher.hpp │ │ ├── SynonymParser.cpp │ │ └── SynonymParser.hpp │ ├── TLCSCache.cpp │ ├── TLCSCache.hpp │ ├── Terms │ │ ├── InfTermAttrs.hpp │ │ ├── InfTerms.hpp │ │ ├── Matcher.cpp │ │ └── Matcher.hpp │ ├── TermsStorage.cpp │ ├── TermsStorage.hpp │ ├── Vars │ │ ├── Default.hpp │ │ ├── Id.hpp │ │ ├── Registry.cpp │ │ ├── Registry.hpp │ │ ├── Vector.cpp │ │ └── Vector.hpp │ ├── iAnswer.cpp │ └── iAnswer.hpp └── _Include │ ├── BinaryData.hpp │ ├── ConsoleOutput.hpp │ ├── Errors.h │ └── FStorage.hpp ├── InfServer ├── CMakeLists.txt ├── InfEngineServer.cpp ├── InfEngineServer.hpp └── MainServer.cpp ├── NanoLib ├── Blocks.cpp ├── Blocks.hpp ├── CMakeLists.txt ├── Cache.hpp ├── CacheMemcached.cpp ├── CacheMemcached.hpp ├── ConfigFile.cpp ├── ConfigFile.hpp ├── Doxyfile ├── Encoding.hpp ├── FlagsStorage.hpp ├── KeyboardNumberParser.cpp ├── KeyboardNumberParser.hpp ├── LogSystem.cpp ├── LogSystem.hpp ├── LongFloat.cpp ├── LongFloat.hpp ├── NameIndex.cpp ├── NameIndex.hpp ├── NanoLib.hpp ├── NanoRandomBox.cpp ├── NanoRandomBox.hpp ├── NumberConvertor.cpp ├── NumberConvertor.hpp ├── NumberParser.cpp ├── NumberParser.hpp ├── RawHashTable.cpp ├── RawHashTable.hpp ├── ReturnCode.hpp ├── TextFuncs.hpp ├── VoiceNumberParser.cpp ├── VoiceNumberParser.hpp ├── aTextString.hpp ├── aTextStringFunctions.hpp ├── nMemoryAllocator.cpp ├── nMemoryAllocator.h ├── nMemoryAllocator.hpp └── nVector.hpp ├── Utils ├── CMakeLists.txt ├── FuncMon │ ├── CMakeLists.txt │ └── FuncMon.cpp └── Signature │ ├── CMakeLists.txt │ └── CheckSignature.cpp ├── ap-process-server ├── CMakeLists.txt └── ap-process-server.c └── lib ├── CMakeLists.txt └── functions ├── CMakeLists.txt ├── Common ├── AllTrim.cpp ├── And.cpp ├── CMakeLists.txt ├── Concatenate.cpp ├── IsNum.cpp ├── Not.cpp ├── Or.cpp ├── ProperName.cpp ├── Replace.cpp ├── Shuffle.cpp ├── ToLower.cpp └── ToUpper.cpp ├── Dates ├── CMakeLists.txt ├── DateDist.cpp ├── DateGreater.cpp ├── DateLess.cpp ├── Extract.cpp ├── TimeGreater.cpp └── TimeLess.cpp ├── FunctionLib.hpp └── Math ├── BigGreater.cpp ├── BigLess.cpp ├── CMakeLists.txt ├── Diff.cpp ├── Divide.cpp ├── Greater.cpp ├── Less.cpp ├── Minus.cpp ├── Multiply.cpp ├── Plus.cpp ├── Random.cpp └── Remainder.cpp /.dockerignore: -------------------------------------------------------------------------------- 1 | /cmake-build* 2 | /dldata* 3 | /docker/dldata/dldata.ie2 4 | /.* 5 | 6 | .DS_Store 7 | 8 | /.idea 9 | 10 | Dockerfile -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | APS_MAX_FILTERS=1 2 | APS_START_FILTERS=0 3 | APS_MIN_FILTERS=0 4 | APS_LOG_LEVEL=4 5 | IFS_LOG_LEVEL=DEBUG 6 | IFS_LOG_DATA_FLOW=TRUE 7 | IFS_CACHE_TTL=604800 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.DS_Store 3 | 4 | # Директория проектов CLion. 5 | /.idea/ 6 | 7 | # Директория сборки для обратной совместимости. 8 | /build/ 9 | 10 | # Директории сборки CLion. 11 | /cmake-build-* 12 | 13 | /dldata* -------------------------------------------------------------------------------- /CMakeCustom/FindGMP.cmake: -------------------------------------------------------------------------------- 1 | #.rst: 2 | # FindGMP 3 | # ------- 4 | # 5 | # Finds the GMP library 6 | # 7 | 8 | find_package( PkgConfig QUIET ) 9 | if( PKG_CONFIG_FOUND ) 10 | pkg_check_modules( PC_GMP QUIET gmp ) 11 | endif( PKG_CONFIG_FOUND ) 12 | 13 | find_path( GMP_INCLUDE_DIR 14 | NAMES gmpxx.h 15 | PATHS ${PC_GMP_INCLUDE_DIRS} /usr/include /usr/local/include /opt/local/include ) 16 | 17 | find_library( GMP_LIBRARY 18 | NAMES gmp 19 | PATHS ${PC_GMP_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib ) 20 | 21 | set( GMP_VERSION ${PC_GMP_VERSION} ) 22 | set( GMP_VERSION_STRING ${PC_GMP_VERSION} ) 23 | 24 | include( FindPackageHandleStandardArgs ) 25 | find_package_handle_standard_args( GMP 26 | # FOUND_VAR GMP_FOUND 27 | REQUIRED_VARS GMP_INCLUDE_DIR GMP_LIBRARY 28 | VERSION_VAR GMP_VERSION ) 29 | 30 | if( GMP_FOUND ) 31 | set( GMP_LIBRARIES ${GMP_LIBRARY} ) 32 | set( GMP_INCLUDE_DIRS ${GMP_INCLUDE_DIR} ) 33 | set( GMP_DEFINITIONS ${PC_GMP_CFLAGS_OTHER} ) 34 | 35 | if( NOT TARGET GMP::GMP ) 36 | add_library( GMP::GMP UNKNOWN IMPORTED ) 37 | set_target_properties( GMP::GMP PROPERTIES 38 | IMPORTED_LOCATION "${GMP_LIBRARY}" 39 | INTERFACE_COMPILE_OPTION "${PC_GMP_CFLAGS_OTHER}" 40 | INTERFACE_INCLUDE_DIRECTORIES "${GMP_INCLUDE_DIR}" ) 41 | endif( NOT TARGET GMP::GMP ) 42 | endif( GMP_FOUND ) 43 | 44 | mark_as_advanced( GMP_INCLUDE_DIR GMP_LIBRARY ) 45 | -------------------------------------------------------------------------------- /build/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.0 ) 2 | 3 | project( InfEngine ) 4 | 5 | # Добавлено для совместимости со скриптами и старыми системами. 6 | add_subdirectory( .. InfEngine2 ) 7 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.4' 2 | 3 | # Глобальная настрока логирования. 4 | x-logging: 5 | &default-logging 6 | options: 7 | max-size: '100k' 8 | max-file: '3' 9 | driver: json-file 10 | 11 | services: 12 | # Кэш сервер для диалогового процессора. 13 | memcached.local: 14 | image: memcached 15 | env_file: 16 | - .env 17 | restart: always 18 | logging: *default-logging 19 | engine: 20 | build: . 21 | env_file: 22 | - .env 23 | environment: 24 | - IFS_CACHE_SERVERS=memcached.local:11211 25 | ports: 26 | - 2255:2255 27 | volumes: 28 | - ./dldata:/dldata 29 | depends_on: 30 | - memcached.local -------------------------------------------------------------------------------- /docker/config/bin/CheckSignature: -------------------------------------------------------------------------------- 1 | ../release/bin/CheckSignature -------------------------------------------------------------------------------- /docker/config/bin/EllipsisCompiler: -------------------------------------------------------------------------------- 1 | ../release/bin/EllipsisCompiler -------------------------------------------------------------------------------- /docker/config/bin/InfCompiler: -------------------------------------------------------------------------------- 1 | ../release/bin/InfCompiler -------------------------------------------------------------------------------- /docker/config/bin/InfServer: -------------------------------------------------------------------------------- 1 | ../release/bin/InfServer -------------------------------------------------------------------------------- /docker/config/conf/Environment.conf: -------------------------------------------------------------------------------- 1 | [InfEngine] 2 | Sources = /src -------------------------------------------------------------------------------- /docker/config/conf/InfServer.conf: -------------------------------------------------------------------------------- 1 | // Конфигурация Диалогового Ядра. 2 | 3 | [Functions] 4 | // Директория с библиотеками внешних функций. 5 | RootDir = release/lib/functions 6 | 7 | // Список внешних функций. 8 | ConfigFile = conf/functions.lst 9 | 10 | 11 | [Log] 12 | // Уровень логирования. Возможные значения: [ "NONE", "ERROR", "WARN", "INFO", "DEBUG" ]. Значение по умолчанию: "NONE". 13 | Level = WARN 14 | 15 | // Идентификатор логирования. По умолчанию: "InfEngine Server". 16 | Identificator = InfEngine Server 17 | 18 | // Flag for logging all data flow between server and clients. Default value: "false". 19 | // Флаг для логгирования всех данных проходящих через Диалоговое Ядро. 20 | DataFlow = false 21 | 22 | 23 | [Cache] 24 | // Сервер кэширования. 25 | Servers = localhost:11211 26 | 27 | // TTL для кэш записей. Значение по умолчанию: "604800" ( одна неделя ). 28 | TTL = 604800 29 | 30 | 31 | [InfServer] 32 | // Путь к бинарной Базе Знаний. 33 | BasePath = release/dldata/dldata.ie2 34 | 35 | // Максимальное число запросов, обрабатываемых одним процессом. Значение по умолчанию: "100". 36 | MaxRequestsNumber = 50 37 | 38 | // Таймаут для запроса. Значение по умолчанию: "30". 39 | TimeOut = 30 40 | 41 | // Путь к файлу с алиасами на языке DL. 42 | DLAliases = release/dldata/aliases.dl 43 | 44 | // Флаг отладочного режима. 45 | DebugMode = YES 46 | -------------------------------------------------------------------------------- /docker/config/conf/ap-process-server.conf: -------------------------------------------------------------------------------- 1 | # Путь к InfServer. 2 | FilterPath ./bin/InfServer 3 | 4 | # Параметры запуска InfServer. 5 | FilterParam ./conf/InfServer.conf 6 | 7 | # Сокет, который процесс-сервер будет слушать. 8 | Listen tcp::2255 9 | 10 | # Логгирование. 11 | LogLevel 0 12 | SyslogFacility local3 13 | 14 | # Путь к файлу с pid'ом процесс сервера. 15 | PidFile ./tmp/process-server.pid 16 | 17 | # Максимальное количество одновременных процессов InfServer. 18 | MaxFilters 1 19 | # Количество процессов InfServer, которые будут запущены при старте процесс-сервера. 20 | StartFilters 0 21 | # Минимальное разрешенное количество запущенных процессов InfServer. 22 | MinSpareFilters 0 23 | -------------------------------------------------------------------------------- /docker/config/conf/functions.lst: -------------------------------------------------------------------------------- 1 | ../release/conf/functions.lst -------------------------------------------------------------------------------- /docker/deb/libinfengine-common-perl_0.1.6-1_all.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sovaai/sova-engine/783b04072bb243891bc332fcb0f61e938e456f4f/docker/deb/libinfengine-common-perl_0.1.6-1_all.deb -------------------------------------------------------------------------------- /docker/deb/libinfengine-server-perl_0.2.3-1_all.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sovaai/sova-engine/783b04072bb243891bc332fcb0f61e938e456f4f/docker/deb/libinfengine-server-perl_0.2.3-1_all.deb -------------------------------------------------------------------------------- /docker/dldata/.gitignore: -------------------------------------------------------------------------------- 1 | /dldata.ie2 -------------------------------------------------------------------------------- /docker/dldata/defvars.lst: -------------------------------------------------------------------------------- 1 | test -------------------------------------------------------------------------------- /docker/dldata/dict.lst: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sovaai/sova-engine/783b04072bb243891bc332fcb0f61e938e456f4f/docker/dldata/dict.lst -------------------------------------------------------------------------------- /docker/dldata/dl.lst: -------------------------------------------------------------------------------- 1 | templates.txt 2 | -------------------------------------------------------------------------------- /docker/dldata/syn.lst: -------------------------------------------------------------------------------- 1 | synonyms25062013.txt -------------------------------------------------------------------------------- /docker/dldata/templates.txt: -------------------------------------------------------------------------------- 1 | BEGIN 1 2 | $ * 3 | # default 4 | # test 5 | END 6 | 7 | -------------------------------------------------------------------------------- /docker/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Save environment variables. 4 | mkdir -p ~/.ssh && 5 | chmod 700 ~/.ssh && 6 | env | grep '^IFS_' > /root/.ssh/environment && 7 | 8 | # Start sshd. 9 | if [[ -n "$SSHD_ENABLE" ]]; then 10 | if [[ -n "$SSHD_AUTHORIZED_KEYS" ]]; then 11 | echo "$SSHD_AUTHORIZED_KEYS" >> ~/.ssh/authorized_keys && 12 | chmod 600 ~/.ssh/authorized_keys 13 | fi && 14 | /etc/init.d/ssh start 15 | fi && 16 | 17 | # Start rsyslog. 18 | rm -f /run/rsyslogd.pid && 19 | /etc/init.d/rsyslog start && 20 | while ! /etc/init.d/rsyslog status; do sleep 1; done; 21 | 22 | # Update Knowledge Base. 23 | if [ -f /dldata/dldata.ie2 ]; then 24 | InfEngineManager.pl --dl-update /dldata/dldata.ie2 -v; 25 | fi && 26 | 27 | # Start engine. 28 | rm -f /engine/tmp/process-server.pid && 29 | InfEngineControl.pl --start && 30 | 31 | # Infinite cycle. 32 | while true; do sleep 1; done; -------------------------------------------------------------------------------- /docker/syslog/rsyslog.conf: -------------------------------------------------------------------------------- 1 | ################# 2 | #### MODULES #### 3 | ################# 4 | 5 | module(load="imuxsock") # provides support for local system logging 6 | 7 | ########################### 8 | #### GLOBAL DIRECTIVES #### 9 | ########################### 10 | 11 | # 12 | # Use traditional timestamp format. 13 | # To enable high precision timestamps, comment out the following line. 14 | # 15 | $ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat 16 | 17 | # 18 | # Set the default permissions for all log files. 19 | # 20 | $FileOwner root 21 | $FileGroup adm 22 | $FileCreateMode 0640 23 | $DirCreateMode 0755 24 | $Umask 0022 25 | 26 | # 27 | # Where to place spool and state files 28 | # 29 | $WorkDirectory /var/spool/rsyslog 30 | 31 | # 32 | # Include all config files in /etc/rsyslog.d/ 33 | # 34 | $IncludeConfig /etc/rsyslog.d/*.conf 35 | 36 | 37 | ############### 38 | #### RULES #### 39 | ############### 40 | *.* -/var/log/syslog -------------------------------------------------------------------------------- /ext/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if( ${APPLE} AND ${CMAKE_HOST_APPLE} AND ( ${CMAKE_MAJOR_VERSION} GREATER 2 OR ${CMAKE_MINOR_VERSION} GREATER 7 ) ) 2 | add_compile_options( -w ) 3 | endif() 4 | 5 | add_subdirectory( clientlib ) 6 | add_subdirectory( aip ) -------------------------------------------------------------------------------- /ext/aip/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.7 ) 2 | if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.12 ) 3 | cmake_policy( SET CMP0074 NEW ) 4 | endif( ${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.12 ) 5 | find_package( ICU COMPONENTS uc data REQUIRED ) 6 | 7 | add_definitions( 8 | "-DNO_PRINT_VERSION" 9 | "-DPTS2_CROSS_HASHTABLE_SIZE=64" 10 | "-DPTS2_CROSS_HASHTABLE_INC=32" 11 | 12 | "-DUSE_INF_TERMS" 13 | "-DLOG_DATA_FLOW_ENABLED" 14 | "-DINF_ENGINE_STATISTICS" 15 | "-DCSDATA_EXTENDED" 16 | 17 | "-D_STL=std" 18 | ) 19 | 20 | add_subdirectory( src ) 21 | add_subdirectory( headers ) 22 | -------------------------------------------------------------------------------- /ext/aip/headers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.7 ) 2 | 3 | # Фиктивная библиотека для установки путей к заголовочным файлам A&P библиотеки. 4 | project( aipheaders ) 5 | 6 | file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy.c "int c;" ) 7 | add_library( ${PROJECT_NAME} STATIC ${CMAKE_CURRENT_BINARY_DIR}/dummy.c ) 8 | 9 | target_include_directories( ${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/../src/ ) 10 | 11 | target_compile_definitions( ${PROJECT_NAME} PUBLIC 12 | -DPTS2_CROSS_HASHTABLE_SIZE=64 -DPTS2_CROSS_HASHTABLE_INC=32 -D_STL=std -DUSE_INF_TERMS ) 13 | -------------------------------------------------------------------------------- /ext/aip/src/.gitignore: -------------------------------------------------------------------------------- 1 | *~ -------------------------------------------------------------------------------- /ext/aip/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory( Filtration3 ) 2 | add_subdirectory( lib ) 3 | add_subdirectory( LingProc4 ) 4 | add_subdirectory( ZTools ) 5 | -------------------------------------------------------------------------------- /ext/aip/src/Filtration3/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory( common ) 2 | add_subdirectory( stopdict_ex ) 3 | add_subdirectory( terms ) 4 | -------------------------------------------------------------------------------- /ext/aip/src/Filtration3/common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.7 ) 2 | 3 | project( clingproc ) 4 | add_library( ${PROJECT_NAME} STATIC DocMessage.cpp ) 5 | target_include_directories( ${PROJECT_NAME} PUBLIC ${ICU_INCLUDE_DIRS} ${CMAKE_CURRENT_LIST_DIR}/../.. ) 6 | -------------------------------------------------------------------------------- /ext/aip/src/Filtration3/stopdict_ex/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.7 ) 2 | 3 | project( stopdict_ex ) 4 | add_library( ${PROJECT_NAME} STATIC StopDictEx.cpp ) 5 | target_include_directories( ${PROJECT_NAME} PUBLIC ${ICU_INCLUDE_DIRS} ${CMAKE_CURRENT_LIST_DIR}/../.. ) 6 | -------------------------------------------------------------------------------- /ext/aip/src/Filtration3/terms/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.7 ) 2 | 3 | project( terms ) 4 | add_library( ${PROJECT_NAME} STATIC 5 | FltTermsArray.cpp 6 | FltTermsBase.cpp 7 | FltTermsBaseRO.cpp 8 | FltTermsBaseLP.cpp 9 | FltTermsBaseWR.cpp 10 | FltTermsMatcher.cpp 11 | FltTermsStop.cpp 12 | FltTermsWFuncs.cpp 13 | terms.cpp ) 14 | 15 | target_link_libraries( ${PROJECT_NAME} PUBLIC 16 | stopdict_ex 17 | clingproc 18 | lingproc4 ) 19 | target_include_directories( terms PUBLIC ${ICU_INCLUDE_DIRS} ) 20 | -------------------------------------------------------------------------------- /ext/aip/src/Filtration3/terms/FltTermsStopEx.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file FltTermsStopEx.h 3 | * @author swizard 4 | * @date Sat Oct 10 15:16:16 2009 5 | * 6 | * @brief FltTerms stop words class with extended functionality. 7 | * 8 | * 9 | */ 10 | #ifndef _FLTTERMSSTOPEX_H_ 11 | #define _FLTTERMSSTOPEX_H_ 12 | 13 | #include 14 | 15 | #include "terms_types.h" 16 | 17 | class TermsStopDict : public StopDictEx 18 | { 19 | public: 20 | TermsStopDict() : StopDictEx() { } 21 | 22 | public: 23 | FltTermsErrors init( LingProc &lp ); 24 | }; 25 | 26 | inline FltTermsErrors mapStopStatus( StopDictEx::Status status ) 27 | { 28 | switch ( status ) 29 | { 30 | case StopDictEx::OK: return TERMS_OK; 31 | case StopDictEx::ENUM_STOP: return TERMS_ERROR_BREAK; 32 | case StopDictEx::ERROR_FS_FAILED: return TERMS_ERROR_FS_FAILED; 33 | case StopDictEx::ERROR_INVALID_MODE: return TERMS_ERROR_INVALID_MODE; 34 | case StopDictEx::ERROR_LP_FAILED: return TERMS_ERROR_LP_FAILED; 35 | 36 | default: return TERMS_ERROR_EFAULT; 37 | }; 38 | } 39 | 40 | #endif /* _FLTTERMSSTOPEX_H_ */ 41 | 42 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/ArabicMorph/libbuckwalter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.7 ) 2 | 3 | if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.12 ) 4 | cmake_policy( SET CMP0074 NEW ) 5 | endif( ${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.12 ) 6 | cmake_policy( SET CMP0054 NEW ) 7 | find_package( ICU COMPONENTS UC DATA REQUIRED ) 8 | 9 | project( buckwalter ) 10 | add_library( ${PROJECT_NAME} STATIC 11 | transformation.cpp 12 | morphology.cpp 13 | utils.cpp 14 | grammar.cpp 15 | grammar_file_parser.cpp 16 | grammar_storage.cpp 17 | compatibility_storage.cpp 18 | compatibility_file_parser.cpp 19 | lexemes.cpp 20 | forms.cpp 21 | pascalstrings.cpp 22 | LPArabicMorph.cpp 23 | fstorage_utils.cpp ) 24 | target_link_libraries( ${PROJECT_NAME} PUBLIC ${ICU_UC_LIBRARIES} ${ICU_DATA_LIBRARIES} pts2 language_info fstorage ) 25 | target_include_directories( ${PROJECT_NAME} PUBLIC ${ICU_INCLUDE_DIRS} ) 26 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/ArabicMorph/libbuckwalter/compatibility_consumer_iface.h: -------------------------------------------------------------------------------- 1 | #ifndef _LIBBUCKWALTER_COMPATIBILITY_CONSUMER_IFACE_H_ 2 | #define _LIBBUCKWALTER_COMPATIBILITY_CONSUMER_IFACE_H_ 3 | #include "utils.h" 4 | 5 | class ICompatibilityConsumer { 6 | public: 7 | virtual bool Consume(TCharBuffer first, TCharBuffer second) = 0; 8 | virtual ~ICompatibilityConsumer() {}; 9 | }; 10 | 11 | #endif /* _LIBBUCKWALTER_COMPATIBILITY_CONSUMER_IFACE_H_ */ 12 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/ArabicMorph/libbuckwalter/compatibility_file_parser.h: -------------------------------------------------------------------------------- 1 | #ifndef _LIBBUCKWALTER_COMPATIBILITY_FILE_PARSER_IFACE_H_ 2 | #define _LIBBUCKWALTER_COMPATIBILITY_FILE_PARSER_IFACE_H_ 3 | #include 4 | 5 | class ICompatibilityConsumer; 6 | extern const size_t KNoErrorInCompatibilityFile; 7 | size_t ParseCompatibilityFile(const char* filePath, ICompatibilityConsumer& consumer); 8 | #endif /* _LIBBUCKWALTER_COMPATIBILITY_FILE_PARSER_IFACE_H_ */ 9 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/ArabicMorph/libbuckwalter/compatibility_storage.h: -------------------------------------------------------------------------------- 1 | #ifndef _LIBBUCKWALTER_COMPATABILITY_STORAGE_H_ 2 | #define _LIBBUCKWALTER_COMPATABILITY_STORAGE_H_ 3 | #include 4 | #include 5 | #include 6 | 7 | class TCompatibilityStorage { 8 | public: 9 | bool Init(EMorphologyMode mode); 10 | bool AddComaptibleRule(TCharBuffer first, TCharBuffer second); 11 | bool IsCompatible(TCharBuffer first, TCharBuffer second) const; 12 | // \return section id after last used stored section, or kStoreError on error 13 | fstorage_section_id Store(fstorage* storage, fstorage_section_id startSection); 14 | // \return section id after last used stored section, or kStoreError on error 15 | fstorage_section_id Restore(fstorage* storage, fstorage_section_id startSection); 16 | private: 17 | PatriciaTree Storage; 18 | }; 19 | 20 | #endif /* _LIBBUCKWALTER_COMPATABILITY_STORAGE_H_ */ 21 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/ArabicMorph/libbuckwalter/fstorage_utils.h: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | #include 3 | #include <_include/_inttype.h> 4 | 5 | class PatriciaTree; 6 | 7 | extern const fstorage_section_id kStoreError; 8 | // \return section id after last used stored section, or kStoreError on error 9 | fstorage_section_id StorePatriciaTree(PatriciaTree& tree, fstorage* storage, fstorage_section_id startSection); 10 | // \return section id after last used stored section, or kStoreError on error 11 | fstorage_section_id RestorePatriciaTree(PatriciaTree& tree, uint16_t flags, fstorage* storage, fstorage_section_id startSection); 12 | fstorage_section_id StoreAvector(avector& v, fstorage* storage, fstorage_section_id startSection); 13 | fstorage_section_id RestoreAvector(TCharBuffer& buffer, fstorage* storage, fstorage_section_id startSection); 14 | fstorage_section_id StoreBuffer(TCharBuffer buffer, fstorage* storage, fstorage_section_id startSection); 15 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/ArabicMorph/libbuckwalter/grammar_consumer_iface.h: -------------------------------------------------------------------------------- 1 | #ifndef _LIBBUCKWALTER_GRAMMAR_CONSUMER_IFACE_H_ 2 | #define _LIBBUCKWALTER_GRAMMAR_CONSUMER_IFACE_H_ 3 | #include "grammar.h" 4 | 5 | class IGrammarConsumer { 6 | public: 7 | virtual bool Consume(const TPartGrammar& grammar) = 0; 8 | virtual ~IGrammarConsumer() {}; 9 | }; 10 | 11 | #endif /* _LIBBUCKWALTER_GRAMMAR_CONSUMER_IFACE_H_ */ 12 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/ArabicMorph/libbuckwalter/grammar_storage.h: -------------------------------------------------------------------------------- 1 | #ifndef _LIBBUCKWALTER_GRAMMAR_STORAGE_H_ 2 | #define _LIBBUCKWALTER_GRAMMAR_STORAGE_H_ 3 | #include "utils.h" 4 | #include "grammar.h" 5 | #include "lexemes.h" 6 | #include 7 | #include 8 | 9 | class TGrammarStorage { 10 | public: 11 | bool Init(EMorphologyMode mode); 12 | bool AddVariants( TPartGrammarVariants& variants 13 | , TLexemes* lexemes 14 | , TStemsForLexemes* stemsForLexemes ); 15 | TBundledVariantsHelper GetVariants(const uint8_t* key, uint32_t size); 16 | void DebugPrint(); 17 | // \return section id after last used stored section, or kStoreError on error 18 | fstorage_section_id Store(fstorage* storage, fstorage_section_id startSection); 19 | // \return section id after last used stored section, or kStoreError on error 20 | fstorage_section_id Restore(fstorage* storage, fstorage_section_id startSection); 21 | private: 22 | void ApplyZeroLengtVariants(TCharBuffer zeroVariants); 23 | PatriciaTree Storage; 24 | avector ZeroLengthStorage; 25 | TBundledVariantsHelper ZeroLengthVariants; 26 | }; 27 | #endif /* _LIBBUCKWALTER_GRAMMAR_STORAGE_H_ */ 28 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/ArabicMorph/libbuckwalter/pascalstrings.cpp: -------------------------------------------------------------------------------- 1 | #include "pascalstrings.h" 2 | #include 3 | 4 | size_t pascal_size(const std::string& str) 5 | { 6 | return str.size() + 1; 7 | } 8 | 9 | void pascal_write(const std::string& str, uint8_t* buffer) 10 | { 11 | uint8_t length = str.size(); 12 | memcpy(buffer, static_cast(&length), sizeof(length)); 13 | memcpy(buffer + 1, static_cast(str.c_str()), sizeof(char) * length); 14 | } 15 | 16 | uint8_t pascal_size(const uint8_t* buffer) 17 | { 18 | return *buffer; 19 | } 20 | 21 | TCharBuffer pascal_get(const uint8_t* buffer) 22 | { 23 | return TCharBuffer(buffer + 1, pascal_size(buffer) + 1 + buffer); 24 | } 25 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/ArabicMorph/libbuckwalter/pascalstrings.h: -------------------------------------------------------------------------------- 1 | #ifndef _LIBBUCKWALTER_PASCAL_H_ 2 | #define _LIBBUCKWALTER_PASCAL_H_ 3 | #include "utils.h" 4 | #include <_include/_inttype.h> 5 | #include 6 | size_t pascal_size(const std::string& str); 7 | void pascal_write(const std::string& str, uint8_t* buffer); 8 | uint8_t pascal_size(const uint8_t* buffer); 9 | TCharBuffer pascal_get(const uint8_t* buffer); 10 | #endif /* _LIBBUCKWALTER_PASCAL_H_ */ 11 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/ArabicMorph/libbuckwalter/transformation.h: -------------------------------------------------------------------------------- 1 | #ifndef _LIBBUCKWALTER_TRANSFORMATION_H_ 2 | #define _LIBBUCKWALTER_TRANSFORMATION_H_ 3 | 4 | #include 5 | #include 6 | #include <_include/_inttype.h> 7 | 8 | //both functions return 0 if symbol is not mapped by buckwalter transforamtion 9 | uint32_t buckwalterFromArabicToLatin(uint32_t symbol); 10 | uint32_t buckwalterFromLatinToArabic(uint32_t symbol); 11 | 12 | void buckwalterFromArabicToLatin(const char* str, size_t strLen, avector& latin); 13 | void buckwalterFromLatinToArabic(const char* str, size_t strLen, avector& arabic); 14 | 15 | #endif /* _LIBBUCKWALTER_TRANSFORMATION_H_ */ 16 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/ArabicMorph/libbuckwalter/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | #include 3 | 4 | TConstString Strip(TConstString str, char c) 5 | { 6 | if (str.IsEmpty()) { 7 | return str; 8 | } 9 | 10 | const char* begin = str.Begin; 11 | while ((begin != str.End) && (c == *begin)) { 12 | ++begin; 13 | } 14 | const char* end = str.End; 15 | while ((begin != end) && (c == *(end - 1))) { 16 | --end; 17 | } 18 | 19 | return TConstString(begin, end); 20 | } 21 | 22 | void Split(TConstString str, char c, TSplits& splits) 23 | { 24 | const char* begin = str.Begin; 25 | const char* end = NULL; 26 | while ((begin != str.End) && (end != str.End)) { 27 | end = std::find(begin, str.End, c); 28 | splits.push_back(TConstString(begin, end)); 29 | begin = end + 1; 30 | } 31 | if (begin == str.End) { 32 | end = begin; 33 | splits.push_back(TConstString(begin, end)); 34 | } 35 | } 36 | 37 | const uint16_t kTreeFlags = PatriciaTree::TREE_GENERIC; 38 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/Constants.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONSTANTS_H_ 2 | #define _CONSTANTS_H_ 3 | 4 | #include "LexID.h" 5 | #include "BinaryData.h" 6 | 7 | /* Constants */ 8 | static const uint16_t lpMaxMorphsNum = (1 << BitsCounter< static_cast(LEX_MORPH) >::n); 9 | static const uint16_t lpMaxLangNum = ( lpMaxMorphsNum - 3 /* hier, punct, num */ ) / 2; /* fuzzy and strict */ 10 | static const uint32_t lpMaxWordLength = 4095; 11 | static const uint32_t lpAvgWordImageSize = 3; 12 | 13 | #endif /* _CONSTANTS_H_ */ 14 | 15 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/DetectWords.h: -------------------------------------------------------------------------------- 1 | #ifndef _DETECTWORDS_H_ 2 | #define _DETECTWORDS_H_ 3 | 4 | #include 5 | 6 | #include "LingProcDict.h" 7 | 8 | class DetectWords : public LingProcDict 9 | { 10 | public: 11 | DetectWords() : LingProcDict() { } 12 | ~DetectWords() { } 13 | 14 | LingProcErrors Init( LangCodes lang, const UCharSet *charset ); 15 | 16 | /* returns 0 - not detected, 1 - charset match, 2 - word match, 17 | enum LingProcErrors - on errors */ 18 | int CheckWord( const char *word, size_t len = static_cast(-1) ) const; 19 | 20 | private: 21 | // copy prevention 22 | DetectWords( const DetectWords &src ) : LingProcDict( src ) { } 23 | DetectWords &operator=( const DetectWords & ) { assert(false); abort(); return *this; } 24 | }; 25 | 26 | #endif /* _DETECTWORDS_H_ */ 27 | 28 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/DocImage/DocImageTypes.h: -------------------------------------------------------------------------------- 1 | #ifndef _DOCIMAGETYPES_H_ 2 | #define _DOCIMAGETYPES_H_ 3 | 4 | #include <_include/_inttype.h> 5 | 6 | #include 7 | 8 | struct DocImageTypes 9 | { 10 | struct DocImageWord 11 | { 12 | uint32_t imgIndex; 13 | uint16_t imgLength; 14 | uint16_t attrs; 15 | uint32_t chainsIndex; 16 | uint32_t chainsCount; 17 | }; 18 | 19 | typedef avector ImageArray; 20 | typedef avector WordsArray; 21 | typedef avector CompoundLexPool; 22 | typedef avector FormsSetsArray; 23 | 24 | struct DecompositionChain 25 | { 26 | size_t chainOffset; 27 | size_t chainLength; 28 | }; 29 | 30 | typedef avector ChainsPool; 31 | }; 32 | 33 | #endif /* _DOCIMAGETYPES_H_ */ 34 | 35 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/DocText/DocTextLine.h: -------------------------------------------------------------------------------- 1 | #ifndef _DOCTEXTLINE_H_ 2 | #define _DOCTEXTLINE_H_ 3 | 4 | #include "DocTextWord.h" 5 | 6 | typedef DocTextPhrase DocTextLine; 7 | 8 | typedef avector DocTextLinesSet; 9 | 10 | #endif /* _DOCTEXTLINE_H_ */ 11 | 12 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/DocText/DocTextWordBreaker.h: -------------------------------------------------------------------------------- 1 | #ifndef _DOCTEXTWORDBREAKER_ 2 | #define _DOCTEXTWORDBREAKER_ 3 | 4 | #include 5 | 6 | #include "DocTextWord.h" 7 | 8 | class DocTextWordBreaker 9 | { 10 | public: 11 | typedef Functor< const DocTextWord &, LingProcErrors > WordReceiver; 12 | 13 | public: 14 | virtual LingProcErrors performWordBreaking( const char *text, size_t textLength, WordReceiver &receiver ) = 0; 15 | }; 16 | 17 | #endif /* _DOCTEXTWORDBREAKER_ */ 18 | 19 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/LexID.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file LexID.h 3 | * @author swizard 4 | * @date Tue Feb 26 20:31:27 2008 5 | * 6 | * @brief LingProc meta-header, a frontend for LexID32.h or LexID64.h depending on compilation mode. 7 | * 8 | * 9 | */ 10 | #ifndef _LEXID_H_ 11 | #define _LEXID_H_ 12 | 13 | #ifdef FORCE_LEXID64 14 | # include "LexID64.h" 15 | #else 16 | # include "LexID32.h" 17 | #endif 18 | 19 | #endif /* _LEXID_H_ */ 20 | 21 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/LexIDExtra.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file LexIDExtra.h 3 | * @author swizard 4 | * @date Fri Mar 21 15:52:30 2008 5 | * 6 | * @brief Additional routines for LEXIDs 7 | * 8 | * 9 | */ 10 | #ifndef _LEXIDEXTRA_H_ 11 | #define _LEXIDEXTRA_H_ 12 | 13 | #ifndef _LEXID32_H_ 14 | # ifndef _LEXID64_H_ 15 | # error You should include LexID32.h or LexID64.h first 16 | # endif 17 | #endif 18 | 19 | #include <_include/_inttype.h> 20 | #include <_include/ntoh.h> 21 | 22 | #if defined(FORCE_LEXID32) 23 | 24 | #define HTONLEXID(lexid) (htobe32((uint32_t)lexid)) 25 | #define NTOHLEXID(lexid) (be32toh((uint32_t)lexid)) 26 | 27 | #elif defined(FORCE_LEXID64) 28 | 29 | #define HTONLEXID(lexid) (htobe64((uint64_t)lexid)) 30 | #define NTOHLEXID(lexid) (be64toh((uint64_t)lexid)) 31 | 32 | #else 33 | # error No FORCE_LEXID32 nor FORCE_LEXID64 defined 34 | #endif 35 | 36 | #endif /* _LEXIDEXTRA_H_ */ 37 | 38 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/Process/LangDetector/LangDetector.h: -------------------------------------------------------------------------------- 1 | #ifndef _LANGDETECTOR_H_ 2 | #define _LANGDETECTOR_H_ 3 | 4 | #include 5 | 6 | #include <_include/_inttype.h> 7 | #include <_include/language.h> 8 | 9 | #include 10 | 11 | #include "../../LingProcErrors.h" 12 | 13 | class UCharSet; 14 | 15 | class LangDetector 16 | { 17 | protected: 18 | LangDetector( float _probLowerLimit ) : probLowerLimit( _probLowerLimit ) { } 19 | 20 | public: 21 | virtual ~LangDetector() { } 22 | 23 | public: 24 | static LangDetector *factory( LangCodes lang ); 25 | 26 | public: 27 | virtual LingProcErrors init( LangCodes lang, const UCharSet &charset ) = 0; 28 | virtual LingProcErrors reset() = 0; 29 | virtual LingProcErrors update( const char *word, size_t wordLength ) = 0; 30 | virtual LingProcErrors finish() = 0; 31 | 32 | virtual LingProcErrors save( fstorage *fs, fstorage_section_id secId ) = 0; 33 | virtual LingProcErrors load( fstorage *fs, fstorage_section_id secId, const UCharSet &charset ) = 0; 34 | 35 | float getLangProbability() 36 | { 37 | float prob = getProbability(); 38 | if ( prob < probLowerLimit ) 39 | return 0.0; 40 | return prob; 41 | } 42 | 43 | protected: 44 | virtual float getProbability() = 0; 45 | 46 | protected: 47 | float probLowerLimit; 48 | }; 49 | 50 | #endif /* _LANGDETECTOR_H_ */ 51 | 52 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/Process/WordBreaker/LPDocTextWordBreaker.h: -------------------------------------------------------------------------------- 1 | #ifndef _LPDOCTEXTWORDBREAKER_H_ 2 | #define _LPDOCTEXTWORDBREAKER_H_ 3 | 4 | #include "DefaultWordBreakerSM.h" 5 | #include "RunSM.h" 6 | 7 | #include "../../DocText/DocTextWordBreaker.h" 8 | 9 | class UCharSet; 10 | 11 | class LPDocTextWordBreaker : public RunSM< DefaultWordBreakerSM< LPDocTextWordBreaker > >, 12 | public DocTextWordBreaker 13 | { 14 | public: 15 | LPDocTextWordBreaker( const UCharSet &_genericCharset ) : 16 | RunSM< DefaultWordBreakerSM< LPDocTextWordBreaker > >( _genericCharset ), 17 | DocTextWordBreaker(), 18 | currentReceiver( 0 ) 19 | { 20 | } 21 | 22 | public: 23 | LingProcErrors performWordBreaking( const char *text, size_t textLength, WordReceiver &receiver ) 24 | { 25 | currentReceiver = &receiver; 26 | return run( text, textLength ); 27 | } 28 | 29 | LingProcErrors receiveWord( const DocTextWord &word ) 30 | { 31 | if ( unlikely(currentReceiver == 0) ) 32 | return LP_ERROR_EFAULT; 33 | 34 | return currentReceiver->apply( word ); 35 | } 36 | 37 | private: 38 | WordReceiver *currentReceiver; 39 | }; 40 | 41 | #endif /* _LPDOCTEXTWORDBREAKER_H_ */ 42 | 43 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/Process/WordBreaker/RunSM.h: -------------------------------------------------------------------------------- 1 | #ifndef _RUNSM_H_ 2 | #define _RUNSM_H_ 3 | 4 | #include <_include/_inttype.h> 5 | #include <_include/cc_compat.h> 6 | 7 | #include 8 | 9 | #include "../../LingProcErrors.h" 10 | 11 | class UCharSet; 12 | 13 | template< typename TextSM > 14 | class RunSM : public TextSM 15 | { 16 | public: 17 | RunSM( const UCharSet &_genericCharset ) : TextSM( _genericCharset ) { } 18 | 19 | public: 20 | LingProcErrors run( const char *text, size_t textLength ) 21 | { 22 | TextSM::reset(); 23 | 24 | size_t current = 0; 25 | 26 | for ( size_t textOffset = 0; ; current = textOffset ) 27 | { 28 | uint32_t ch = static_cast(-1); 29 | if ( textOffset < textLength ) 30 | { 31 | U8_NEXT_UNSAFE( text, textOffset, ch ); 32 | } 33 | 34 | LingProcErrors status = TextSM::nextChar( current, ch ); 35 | if ( unlikely(status != LP_OK) ) 36 | return status; 37 | 38 | if ( ch == static_cast(-1) ) 39 | break; 40 | } 41 | 42 | return TextSM::flush(); 43 | } 44 | }; 45 | 46 | #endif /* _RUNSM_H_ */ 47 | 48 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/Process/WordBreaker/SequenceSM.h: -------------------------------------------------------------------------------- 1 | #ifndef _SEQUENCESM_H_ 2 | #define _SEQUENCESM_H_ 3 | 4 | #include <_include/cc_compat.h> 5 | 6 | #include "../../LingProcErrors.h" 7 | 8 | class UCharSet; 9 | 10 | template< typename SM1, typename SM2 > 11 | class SequenceSM2 : public SM1, public SM2 12 | { 13 | public: 14 | SequenceSM2( const UCharSet &_genericCharset ) : 15 | SM1( _genericCharset ), 16 | SM2( _genericCharset ) 17 | { 18 | } 19 | 20 | LingProcErrors nextChar( size_t current, uint32_t ch ) 21 | { 22 | LingProcErrors status = SM1::nextChar( current, ch ); 23 | if ( likely(status == LP_OK) ) 24 | status = SM2::nextChar( current, ch ); 25 | return status; 26 | } 27 | 28 | LingProcErrors flush() 29 | { 30 | LingProcErrors status = SM1::flush(); 31 | if ( likely(status == LP_OK) ) 32 | status = SM2::flush(); 33 | return status; 34 | } 35 | 36 | void reset() 37 | { 38 | SM1::reset(); 39 | SM2::reset(); 40 | } 41 | }; 42 | 43 | #endif /* _SEQUENCESM_H_ */ 44 | 45 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/RusLatConv/RusLatConvFS.h: -------------------------------------------------------------------------------- 1 | #ifndef _RUSLATCONVFS_H_ 2 | #define _RUSLATCONVFS_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "RusLatConv.h" 10 | #include "../LingProcErrors.h" 11 | 12 | class RusLatConverterFS : public RusLatConverter 13 | { 14 | public: 15 | RusLatConverterFS() : RusLatConverter() { } 16 | ~RusLatConverterFS() { } 17 | 18 | LingProcErrors Load( fstorage* fs, fstorage_section_id sec_id ); 19 | LingProcErrors Connect( fstorage* fs, fstorage_section_id sec_id ); 20 | LingProcErrors Save( fstorage* fs, fstorage_section_id sec_id ); 21 | 22 | private: 23 | // copy prevention 24 | RusLatConverterFS( const RusLatConverterFS &src ) : RusLatConverter( src ) {} 25 | RusLatConverterFS &operator=(const RusLatConverterFS & ) { assert(false); abort(); return *this; } 26 | }; 27 | 28 | #endif /* _RUSLATCONVFS_H_ */ 29 | 30 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/SimpleMorph/MorphEnumerator.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file MorphEnumerator.h 3 | * @author swizard 4 | * @date Tue Jun 10 15:43:11 2008 5 | * 6 | * @brief Functor object for morphology enumeration. 7 | * 8 | * 9 | */ 10 | #ifndef _MORPHENUMERATOR_H_ 11 | #define _MORPHENUMERATOR_H_ 12 | 13 | #include "../LexID.h" 14 | #include "../LingProcErrors.h" 15 | 16 | /* An enumerator functor object: inherit from it to enumerate and overlap its 'nextLexid' method */ 17 | class MorphEnumerator 18 | { 19 | public: 20 | MorphEnumerator() { } 21 | virtual ~MorphEnumerator() { } 22 | 23 | virtual LingProcErrors nextLexid( LEXID lexid ) = 0; 24 | }; 25 | 26 | #endif /* _MORPHENUMERATOR_H_ */ 27 | 28 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/StrictMorph/API/StrictMorphFS.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRICTMORPHFS_H_ 2 | #define _STRICTMORPHFS_H_ 3 | 4 | #include 5 | 6 | #include "StrictMorph.h" 7 | 8 | class UCharSet; 9 | class StrictMorphFS : public StrictMorph 10 | { 11 | public: 12 | StrictMorphFS(); 13 | ~StrictMorphFS(); 14 | 15 | public: 16 | /** 17 | * Initializes the StrictMorphFS instance with the data in the fstorage provided. 18 | * 19 | * @param charset A charset to use for the current morphology 20 | * @param params A structure with creation parameters filled 21 | * @param fs A fstorage with the morphology data 22 | * @param startSection A first section within morphologies sections sequence 23 | * @param underlyingError The error lifted if failure 24 | * 25 | * @return Creation result as enum StrictMorphErrors 26 | * @see enum StrictMorphErrors 27 | */ 28 | StrictMorphErrors load( const UCharSet *charset, 29 | const StrictMorphParams ¶ms, 30 | fstorage *fs, 31 | fstorage_section_id startSection, 32 | int &underlyingError ); 33 | }; 34 | 35 | #endif /* _STRICTMORPHFS_H_ */ 36 | 37 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/StrictMorph/API/StrictMorphParams.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRICTMORPHPARAMS_H_ 2 | #define _STRICTMORPHPARAMS_H_ 3 | 4 | #include 5 | #include <_include/language.h> 6 | 7 | class StrictMorphParams 8 | { 9 | public: 10 | enum Flags 11 | { 12 | FlagNone = 0x00000000U, 13 | FlagCaseInsensitive = 0x00000001U, 14 | FlagLwrAccent = 0x00000002U, 15 | FlagLwrPunct = 0x00000004U, 16 | FlagRemIgnore = 0x00000008U, 17 | FlagNativeOnly = 0x00000010U, 18 | FlagProcessCompounds = 0x00000020U, 19 | FlagArabicSeqCollapse = 0x00000040U, 20 | FlagUseDefault = 0x80000000U, 21 | FlagInvalid = 0xFFFFFFFFU 22 | }; 23 | 24 | public: 25 | StrictMorphParams() : 26 | language( LNG_RUSSIAN ), 27 | internalNumber( 0 ), 28 | maxWordLength( 0 ), 29 | minStemLength( 0 ), 30 | minCompoundStemLength( 0 ), 31 | flags( (unsigned int)FlagUseDefault ) 32 | { 33 | } 34 | ~StrictMorphParams() { } 35 | 36 | public: /* Data */ 37 | LangCodes language; 38 | unsigned int internalNumber; 39 | size_t maxWordLength; 40 | size_t minStemLength; 41 | size_t minCompoundStemLength; 42 | unsigned int flags; 43 | }; 44 | 45 | #endif /* _STRICTMORPHPARAMS_H_ */ 46 | 47 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/StrictMorph/API/StrictMorphStorageChunk.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRICTMORPHSTORAGECHUNK_H_ 2 | #define _STRICTMORPHSTORAGECHUNK_H_ 3 | 4 | #include 5 | 6 | struct StrictMorphStorageChunk 7 | { 8 | const void *buffer; 9 | size_t size; 10 | 11 | StrictMorphStorageChunk() : buffer(0), size(0) { } 12 | 13 | enum Status 14 | { 15 | SUCCESS, 16 | ERROR_INVALID_SIZE, 17 | ERROR_CORRUPT_DATA, 18 | ERROR_VERSION_MISMATCH, 19 | ERROR_FSTORAGE 20 | }; 21 | }; 22 | 23 | #endif /* _STRICTMORPHSTORAGECHUNK_H_ */ 24 | 25 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/StrictMorph/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.7 ) 2 | 3 | if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.12 ) 4 | cmake_policy( SET CMP0074 NEW ) 5 | endif( ${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.12 ) 6 | cmake_policy( SET CMP0054 NEW ) 7 | find_package( ICU COMPONENTS UC REQUIRED ) 8 | 9 | project( strict_morph ) 10 | add_library( ${PROJECT_NAME} STATIC 11 | LexUnit.cpp 12 | StrictMorph.cpp 13 | StrictMorphStatus.cpp 14 | StrictMorphFS.cpp 15 | StrictMorphShadow.cpp 16 | StrictMorphShadowFS.cpp 17 | StrictMorphShadowFSRW.cpp 18 | StrictMorphSynthesis.cpp 19 | PriorityQueue.cpp 20 | DecompositionProcessor.cpp 21 | DictionnaryInfo.cpp 22 | DictionnaryInfoRW.cpp 23 | DictionnaryInfoFSRW.cpp 24 | StrictMorphHeader.cpp 25 | StrictMorphHeaderRW.cpp 26 | StrictMorphHeaderFSRW.cpp 27 | Pack32.cpp 28 | Pack64.cpp 29 | StrictMorphGram.cpp 30 | LexGram.cpp 31 | LexGramRW.cpp 32 | FormGram.cpp 33 | FormGramRW.cpp ) 34 | target_link_libraries( ${PROJECT_NAME} PUBLIC lpucharset pts2 word_normalizer ) 35 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/StrictMorph/CompoundExclude.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file CompoundExclude.h 3 | * @author swizard 4 | * @date Mon Feb 16 22:01:44 2009 5 | * 6 | * @brief Compounds decomposition exclude dictionary. 7 | * 8 | * 9 | */ 10 | #ifndef _COMPOUNDEXCLUDE_H_ 11 | #define _COMPOUNDEXCLUDE_H_ 12 | 13 | #include 14 | 15 | typedef uint32_t ExcludePatriciaLink; 16 | typedef uint32_t ExcludeChainOffset; 17 | 18 | typedef OpenAddressingDict< ExcludePatriciaLink, 19 | ExcludeChainOffset, 20 | 2048, 21 | 256 > ExcludeIndex; 22 | 23 | typedef const uint64_t *ExcludeChain; 24 | 25 | #endif /* _COMPOUNDEXCLUDE_H_ */ 26 | 27 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/StrictMorph/DecompositionProcessor.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file DecompositionProcessor.h 3 | * @author swizard 4 | * @date Mon Aug 25 02:44:19 2008 5 | * 6 | * @brief A word decomposition processor used in lemmatization. 7 | * 8 | * 9 | */ 10 | #ifndef _DECOMPOSITIONPROCESSOR_H_ 11 | #define _DECOMPOSITIONPROCESSOR_H_ 12 | 13 | #include 14 | 15 | #include "API/StrictMorph.h" 16 | 17 | class DecompositionProcessor : public FunctorMarkAdapter 18 | { 19 | private: 20 | enum Constants 21 | { 22 | chainsPoolSize = 1536 23 | }; 24 | 25 | public: 26 | DecompositionProcessor( StrictLex::LemmatizeFunctor &_target ); 27 | ~DecompositionProcessor(); 28 | 29 | public: 30 | int apply( const StrictLex &lex ); 31 | 32 | StrictMorphErrors getStatus() const { return status; } 33 | 34 | private: 35 | int recurseCompound( const StrictLex *lex, size_t depth ); 36 | bool checkBoundsAbsorbing( size_t startA, size_t endA, size_t startB, size_t endB ) const; 37 | 38 | private: 39 | StrictMorphErrors status; 40 | 41 | size_t currentPoolSize; 42 | size_t chainsPool[chainsPoolSize]; 43 | }; 44 | 45 | #endif /* _DECOMPOSITIONPROCESSOR_H_ */ 46 | 47 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/StrictMorph/DictionnaryInfo.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file DictionnaryInfo.h 3 | * @author swizard 4 | * @date Tue May 27 00:55:30 2008 5 | * 6 | * @brief The dictionary information that strict morphology is using. 7 | * 8 | * 9 | */ 10 | #ifndef _DICTIONNARYINFO_H_ 11 | #define _DICTIONNARYINFO_H_ 12 | 13 | #include 14 | 15 | #include "API/StrictMorphStorageChunk.h" 16 | 17 | struct DictionnaryInfo : public StrictDictInfo 18 | { 19 | DictionnaryInfo(); 20 | 21 | /** 22 | * Given the chunk of a raw memory deserializes the data from it. 23 | * 24 | * @param chunk A chunk with a buffer and buffer size 25 | * 26 | * @return Deserialization status as StrictMorphStorageChunk::Status 27 | */ 28 | StrictMorphStorageChunk::Status load(const StrictMorphStorageChunk &chunk); 29 | }; 30 | 31 | #endif /* _DICTIONNARYINFO_H_ */ 32 | 33 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/StrictMorph/DictionnaryInfoFSRW.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file DictionnaryInfoFSRW.cpp 3 | * @author swizard 4 | * @date Sun Jun 8 19:38:19 2008 5 | * 6 | * @brief The dictionary information that strict morphology is using (fstorage, read/write version) (implementation). 7 | * 8 | * 9 | */ 10 | 11 | #include <_include/cc_compat.h> 12 | #include <_include/_inttype.h> 13 | 14 | #include "DictionnaryInfoFSRW.h" 15 | 16 | DictionnaryInfoFSRW::DictionnaryInfoFSRW() : 17 | DictionnaryInfoRW() 18 | { 19 | } 20 | 21 | StrictMorphStorageChunk::Status DictionnaryInfoFSRW::save(fstorage *fs, fstorage_section_id sectionId) 22 | { 23 | /* Create a section for a dictionary */ 24 | fstorage_section *section = fstorage_get_section(fs, sectionId); 25 | if ( unlikely(section == 0) ) 26 | return StrictMorphStorageChunk::ERROR_FSTORAGE; 27 | 28 | /* Resize the section */ 29 | int status = fstorage_section_realloc(section, sizeof(uint32_t) * DictionnaryInfo::infoFieldsCount); 30 | if ( unlikely(status != FSTORAGE_OK) ) 31 | return StrictMorphStorageChunk::ERROR_FSTORAGE; 32 | 33 | /* Create a chunk wrapper */ 34 | StrictMorphStorageChunk chunk; 35 | chunk.buffer = fstorage_section_get_all_data(section); 36 | chunk.size = fstorage_section_get_size(section); 37 | 38 | /* Save the dictionary */ 39 | return DictionnaryInfoRW::save(chunk); 40 | } 41 | 42 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/StrictMorph/DictionnaryInfoFSRW.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file DictionnaryInfoFSRW.h 3 | * @author swizard 4 | * @date Sun Jun 8 19:36:20 2008 5 | * 6 | * @brief The dictionary information that strict morphology is using (fstorage, read/write version). 7 | * 8 | * 9 | */ 10 | #ifndef _DICTIONNARYINFOFSRW_H_ 11 | #define _DICTIONNARYINFOFSRW_H_ 12 | 13 | #include 14 | 15 | #include "DictionnaryInfoRW.h" 16 | 17 | struct DictionnaryInfoFSRW : public DictionnaryInfoRW 18 | { 19 | DictionnaryInfoFSRW(); 20 | 21 | StrictMorphStorageChunk::Status save(fstorage *fs, fstorage_section_id sectionId); 22 | }; 23 | 24 | #endif /* _DICTIONNARYINFOFSRW_H_ */ 25 | 26 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/StrictMorph/DictionnaryInfoRW.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file DictionnaryInfoRW.h 3 | * @author swizard 4 | * @date Tue May 27 01:46:09 2008 5 | * 6 | * @brief The dictionary information that strict morphology is using (read/write variant). 7 | * 8 | * 9 | */ 10 | #ifndef _DICTIONNARYINFORW_H_ 11 | #define _DICTIONNARYINFORW_H_ 12 | 13 | #include "DictionnaryInfo.h" 14 | 15 | struct DictionnaryInfoRW : public DictionnaryInfo 16 | { 17 | DictionnaryInfoRW(); 18 | 19 | /** 20 | * Given the raw memory buffer as a chunk serializes the data to it. 21 | * The chunk size should be more or equal than this class fields count 22 | * multiple by the sizeof(uint32_t). 23 | * 24 | * @param chunk A chunk with a buffer and buffer size set 25 | * 26 | * @return Deserialization status as StrictMorphStorageChunk::Status 27 | */ 28 | StrictMorphStorageChunk::Status save(StrictMorphStorageChunk &chunk); 29 | }; 30 | 31 | #endif /* _DICTIONNARYINFORW_H_ */ 32 | 33 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/StrictMorph/LexUnit.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file LexUnit.cpp 3 | * @author swizard 4 | * @date Wed Jul 23 18:12:30 2008 5 | * 6 | * @brief One lexical unit: contains enough data to restore any morphology information about it (implementation). 7 | * 8 | * 9 | */ 10 | 11 | #include <_include/cc_compat.h> 12 | 13 | #include 14 | 15 | #include "LexUnit.h" 16 | #include "StrictMorphShadow.h" 17 | 18 | StrictMorphErrors LexUnit::callWithMorphPosition( LexUnit::PositionFunctor &functor ) const 19 | { 20 | /* If the current lex unit contains direct morphological position, invoke the functor with it */ 21 | if ( isDirectPosition ) 22 | return functor.apply( *this ); 23 | 24 | /* Otherwise perform a scanning */ 25 | return morph.scanForms(functor, lexId, lexOrthVariant, formNumber, formVariant); 26 | } 27 | 28 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/StrictMorph/StrictMorphFS.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file StrictMorphFS.cpp 3 | * @author swizard 4 | * @date Tue May 27 00:21:59 2008 5 | * 6 | * @brief Strict (dictionary) morphology user interface implementation (fstorage version). 7 | * 8 | * 9 | */ 10 | 11 | #include "API/StrictMorphFS.h" 12 | #include "StrictMorphShadowFS.h" 13 | 14 | StrictMorphFS::StrictMorphFS() : 15 | StrictMorph() 16 | { 17 | } 18 | 19 | StrictMorphFS::~StrictMorphFS() 20 | { 21 | } 22 | 23 | StrictMorphErrors StrictMorphFS::load( const UCharSet *charset, 24 | const StrictMorphParams ¶ms, 25 | fstorage *fs, 26 | fstorage_section_id startSection, 27 | int &underlyingError ) 28 | { 29 | StrictMorphShadowFS *shadowFS = new StrictMorphShadowFS(); 30 | shadow = shadowFS; 31 | 32 | if ( unlikely(shadowFS == 0) ) 33 | return STRICT_ERROR_INTERNAL_ERROR; 34 | 35 | return shadowFS->load(charset, params, fs, startSection, underlyingError); 36 | } 37 | 38 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/StrictMorph/StrictMorphHeader.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file StrictMorphHeader.h 3 | * @author swizard 4 | * @date Mon Jun 9 01:52:59 2008 5 | * 6 | * @brief The header data for strict (dictionary) morphology. 7 | * 8 | * 9 | */ 10 | #ifndef _STRICTMORPHHEADER_H_ 11 | #define _STRICTMORPHHEADER_H_ 12 | 13 | #include 14 | #include <_include/_inttype.h> 15 | 16 | #include 17 | 18 | #include "API/StrictMorphStorageChunk.h" 19 | 20 | /* Constants */ 21 | const uint32_t strictMorphMagic = 0xB767847C; 22 | const unsigned int strictMorphWFMajor = 4; 23 | const unsigned int strictMorphWFMinor = 0; 24 | 25 | const size_t strictMorphHeaderSize = sizeof(uint32_t) * 16; 26 | 27 | /* Actual header */ 28 | struct StrictMorphHeader 29 | { 30 | uint32_t magic; 31 | unsigned int workFormatMajor; 32 | unsigned int workFormatMinor; 33 | 34 | LPMorphDictInfo dict; 35 | 36 | StrictMorphStorageChunk::Status load(const StrictMorphStorageChunk &chunk); 37 | }; 38 | 39 | #endif /* _STRICTMORPHHEADER_H_ */ 40 | 41 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/StrictMorph/StrictMorphHeaderFSRW.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file StrictMorphHeaderFSRW.cpp 3 | * @author swizard 4 | * @date Mon Jun 9 03:07:48 2008 5 | * 6 | * @brief The header data for strict (dictionary) morphology (fstorage, read/write version) (implementation). 7 | * 8 | * 9 | */ 10 | 11 | #include <_include/cc_compat.h> 12 | 13 | #include "StrictMorphHeaderFSRW.h" 14 | 15 | StrictMorphStorageChunk::Status StrictMorphHeaderFSRW::save(fstorage *fs, fstorage_section_id sectionId) 16 | { 17 | /* Create a section for a header */ 18 | fstorage_section *section = fstorage_get_section(fs, sectionId); 19 | if ( unlikely(section == 0) ) 20 | return StrictMorphStorageChunk::ERROR_FSTORAGE; 21 | 22 | /* Resize the section */ 23 | int status = fstorage_section_realloc(section, strictMorphHeaderSize); 24 | if ( unlikely(status != FSTORAGE_OK) ) 25 | return StrictMorphStorageChunk::ERROR_FSTORAGE; 26 | 27 | /* Create a chunk wrapper */ 28 | StrictMorphStorageChunk chunk; 29 | chunk.buffer = fstorage_section_get_all_data(section); 30 | chunk.size = fstorage_section_get_size(section); 31 | 32 | /* Save the dictionary */ 33 | return StrictMorphHeaderRW::save(chunk); 34 | } 35 | 36 | 37 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/StrictMorph/StrictMorphHeaderFSRW.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file StrictMorphHeaderFSRW.h 3 | * @author swizard 4 | * @date Mon Jun 9 03:06:03 2008 5 | * 6 | * @brief The header data for strict (dictionary) morphology (fstorage, read/write version). 7 | * 8 | * 9 | */ 10 | #ifndef _STRICTMORPHHEADERFSRW_H_ 11 | #define _STRICTMORPHHEADERFSRW_H_ 12 | 13 | #include 14 | 15 | #include "StrictMorphHeaderRW.h" 16 | 17 | /* Actual header */ 18 | struct StrictMorphHeaderFSRW : public StrictMorphHeaderRW 19 | { 20 | StrictMorphStorageChunk::Status save(fstorage *fs, fstorage_section_id sectionId); 21 | }; 22 | 23 | #endif /* _STRICTMORPHHEADERFSRW_H_ */ 24 | 25 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/StrictMorph/StrictMorphHeaderRW.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file StrictMorphHeaderRW.h 3 | * @author swizard 4 | * @date Mon Jun 9 02:23:40 2008 5 | * 6 | * @brief The header data for strict (dictionary) morphology (read/write version). 7 | * 8 | * 9 | */ 10 | #ifndef _STRICTMORPHHEADERRW_H_ 11 | #define _STRICTMORPHHEADERRW_H_ 12 | 13 | #include <_include/language.h> 14 | 15 | #include "StrictMorphHeader.h" 16 | 17 | /* Actual header */ 18 | struct StrictMorphHeaderRW : public StrictMorphHeader 19 | { 20 | void setDefaults(LangCodes language); 21 | StrictMorphStorageChunk::Status save(const StrictMorphStorageChunk &chunk); 22 | }; 23 | 24 | #endif /* _STRICTMORPHHEADERRW_H_ */ 25 | 26 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/StrictMorph/StrictMorphShadowFSRW.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file StrictMorphShadowFSRW.h 3 | * @author swizard 4 | * @date Fri Jun 6 20:46:20 2008 5 | * 6 | * @brief Strict (dictionary) morphology class (fstorage, read/write version). 7 | * 8 | * 9 | */ 10 | #ifndef _STRICTMORPHSHADOWFSRW_H_ 11 | #define _STRICTMORPHSHADOWFSRW_H_ 12 | 13 | #include "StrictMorphShadowFS.h" 14 | 15 | class StrictMorphShadowFSRW : public StrictMorphShadowFS 16 | { 17 | public: 18 | StrictMorphShadowFSRW(); 19 | ~StrictMorphShadowFSRW(); 20 | 21 | public: 22 | /** 23 | * Stores the strict StrictMorphShadowFSRW instance with the data into the fstorage provided. 24 | * 25 | * @param fs A fstorage for the morphology data 26 | * @param startSection A first section within morphologies sections sequence 27 | * @param underlyingError The error lifted if failure 28 | * 29 | * @return Creation result as enum StrictMorphErrors 30 | * @see enum StrictMorphErrors 31 | */ 32 | enum StrictMorphErrors save( fstorage *fs, 33 | fstorage_section_id startSection, 34 | int &underlyingError ); 35 | }; 36 | 37 | #endif /* _STRICTMORPHSHADOWFSRW_H_ */ 38 | 39 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/StrictMorphGram/Functor.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/StrictMorphGram/Shadowed.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Shadowed.h 3 | * @author swizard 4 | * @date Tue Oct 20 03:55:54 2009 5 | * 6 | * @brief Real implementation shadow interface. 7 | * 8 | * 9 | */ 10 | #ifndef _SHADOWED_H_ 11 | #define _SHADOWED_H_ 12 | 13 | #include "sm_dll.h" 14 | 15 | #include "StrictAllocator.h" 16 | 17 | class SM_DLL Shadowed 18 | { 19 | public: 20 | Shadowed() : shadow(0) { } 21 | ~Shadowed() { } 22 | 23 | void assignShadow( const void *shadow ) { this->shadow = shadow; } 24 | const void *getShadow() const { return shadow; } 25 | 26 | private: 27 | const void *shadow; 28 | }; 29 | 30 | class SM_DLL ShadowedRW 31 | { 32 | public: 33 | ShadowedRW( StrictAllocator *_allocator = 0 ); 34 | ~ShadowedRW(); 35 | 36 | protected: 37 | void dropUserBuffer(); 38 | 39 | protected: 40 | void *userBuffer; 41 | StrictAllocator *userAllocator; 42 | }; 43 | 44 | #endif /* _SHADOWED_H_ */ 45 | 46 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/StrictMorphGram/StrictAllocator.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file StrictAllocator.h 3 | * @author swizard 4 | * @date Sun Jan 31 06:09:36 2010 5 | * 6 | * @brief Allocator interface for strict morph. 7 | * 8 | * 9 | */ 10 | #ifndef _STRICTALLOCATOR_H_ 11 | #define _STRICTALLOCATOR_H_ 12 | 13 | #include 14 | 15 | class SM_DLL StrictAllocator 16 | { 17 | public: 18 | virtual void *alloc( size_t size ) = 0; 19 | virtual void free( void *ptr ) = 0; 20 | }; 21 | 22 | #endif /* _STRICTALLOCATOR_H_ */ 23 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/StrictMorphGram/StrictDictInfo.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file StrictDictInfo.h 3 | * @author swizard 4 | * @date Fri Oct 30 23:34:50 2009 5 | * 6 | * @brief Strict morphology dictionary file data. 7 | * 8 | * 9 | */ 10 | #ifndef _STRICTDICTINFO_H_ 11 | #define _STRICTDICTINFO_H_ 12 | 13 | #include 14 | #include 15 | 16 | struct StrictDictInfo 17 | { 18 | size_t paradigmsCount; 19 | size_t paradigmFormsCount; 20 | size_t wordFormsCount; 21 | size_t flexCount; 22 | size_t flexDistribCount; 23 | size_t maxFlexLength; 24 | size_t lexemesCount; 25 | size_t lexGramDescListLength; 26 | size_t lexStemsListLength; 27 | size_t lexOrthVarsListLength; 28 | size_t excludeChainsLength; 29 | time_t datasetBuildTime; 30 | 31 | public: 32 | enum Constants 33 | { 34 | infoFieldsCount = 12 35 | }; 36 | 37 | public: 38 | StrictDictInfo() : 39 | paradigmsCount( 0 ), 40 | paradigmFormsCount( 0 ), 41 | wordFormsCount( 0 ), 42 | flexCount( 0 ), 43 | flexDistribCount( 0 ), 44 | lexemesCount( 0 ), 45 | lexGramDescListLength( 0 ), 46 | lexStemsListLength( 0 ), 47 | lexOrthVarsListLength( 0 ), 48 | excludeChainsLength( 0 ), 49 | datasetBuildTime( 0 ) 50 | { } 51 | }; 52 | 53 | #endif /* _STRICTDICTINFO_H_ */ 54 | 55 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/StrictMorphGram/StrictLexOrthVariant.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file StrictLexOrthVariant.h 3 | * @author swizard 4 | * @date Thu Oct 22 03:12:10 2009 5 | * 6 | * @brief Orthographic variant of a strict lexeme. 7 | * 8 | * 9 | */ 10 | #ifndef _STRICTLEXORTHVARIANT_H_ 11 | #define _STRICTLEXORTHVARIANT_H_ 12 | 13 | #include 14 | 15 | #include "sm_dll.h" 16 | 17 | struct SM_DLL StrictLexOrthVariant 18 | { 19 | enum Type 20 | { 21 | MAIN_ONLY, 22 | MAIN_HAS_MORE, 23 | SUPPLEMENT, 24 | INVALID 25 | } type; 26 | 27 | enum UsageAttribs 28 | { 29 | USAGE_ATTR_NONE = 0, 30 | USAGE_ATTR_NEW = 1, 31 | USAGE_ATTR_OLD = 2, 32 | 33 | USAGE_ATTR_LAST = 3 34 | } usageAttribs; 35 | 36 | size_t lexNo; // Lexeme number of a current orth variant 37 | size_t orthVariant; 38 | 39 | static const char *getName( UsageAttribs attr ); 40 | 41 | StrictLexOrthVariant() : type(INVALID), usageAttribs(USAGE_ATTR_LAST), lexNo(0), orthVariant(0) { } 42 | }; 43 | 44 | #endif /* _STRICTLEXORTHVARIANT_H_ */ 45 | 46 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/StrictMorphGram/StrictTextBuffer.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file StrictTextBuffer.h 3 | * @author swizard 4 | * @date Tue Nov 3 14:22:52 2009 5 | * 6 | * @brief StrictLex::TextFunctor with buffering using avector. 7 | * 8 | * 9 | */ 10 | #ifndef _STRICTTEXTBUFFER_H_ 11 | #define _STRICTTEXTBUFFER_H_ 12 | 13 | #include 14 | 15 | #include "StrictLex.h" 16 | 17 | class StrictTextBuffer : public StrictLex::TextFunctor, public avector 18 | { 19 | public: 20 | char *allocateBuffer( size_t size ) 21 | { 22 | resize(size); 23 | if ( no_memory() ) 24 | return 0; 25 | return get_buffer(); 26 | } 27 | 28 | virtual StrictMorphErrors apply( const char *text ) { return STRICT_OK; } 29 | }; 30 | 31 | 32 | #endif /* _STRICTTEXTBUFFER_H_ */ 33 | 34 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/StrictMorphGram/StrictWordForm.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file StrictWordForm.h 3 | * @author swizard 4 | * @date Thu Oct 22 02:09:29 2009 5 | * 6 | * @brief Word form information. 7 | * 8 | * 9 | */ 10 | #ifndef _STRICTWORDFORM_H_ 11 | #define _STRICTWORDFORM_H_ 12 | 13 | #include "Shadowed.h" 14 | #include "FormGram.h" 15 | 16 | class StrictLex; 17 | class StrictMorph; 18 | class APStrictMorph; 19 | class SM_DLL StrictWordForm : public Shadowed 20 | { 21 | public: 22 | enum UsageAttribsValues 23 | { 24 | USAGE_ATTR_NONE = 0x00, 25 | USAGE_ATTR_RARE = 0x01, 26 | USAGE_ATTR_FORM2 = 0x02, 27 | USAGE_ATTR_CASE2 = 0x04, 28 | USAGE_ATTR_JO = 0x08, 29 | USAGE_ATTR_EXTRA = 0x10 30 | }; 31 | 32 | typedef unsigned char UsageAttribs; 33 | 34 | public: 35 | template const FormGram getFormGram( const MorphType &morphLink ) const; 36 | template const char *getParadigmName( const MorphType &morphLink ) const; 37 | 38 | size_t getFormNo() const; 39 | size_t getFormVariantNo() const; 40 | UsageAttribs getUsageAttribs() const; 41 | 42 | static const char *getName( UsageAttribs attr ); 43 | 44 | public: 45 | StrictWordForm() : Shadowed() { } 46 | ~StrictWordForm() { } 47 | }; 48 | 49 | #endif /* _STRICTWORDFORM_H_ */ 50 | 51 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/StrictMorphGram/StrictWordFormsSet.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file StrictWordFormsSet.h 3 | * @author swizard 4 | * @date Thu Oct 22 02:16:35 2009 5 | * 6 | * @brief A set of word forms for a lexeme. 7 | * 8 | * 9 | */ 10 | #ifndef _STRICTWORDFORMSSET_H_ 11 | #define _STRICTWORDFORMSSET_H_ 12 | 13 | #include "Functor.h" 14 | #include "Shadowed.h" 15 | #include "StrictWordForm.h" 16 | #include "StrictMorphErrors.h" 17 | 18 | class SM_DLL StrictWordFormsSet : public Shadowed 19 | { 20 | public: 21 | typedef Functor EnumerateFunctor; 22 | 23 | public: 24 | StrictMorphErrors enumerate( EnumerateFunctor &functor ) const; 25 | 26 | public: 27 | StrictWordFormsSet() : Shadowed() { } 28 | ~StrictWordFormsSet() { } 29 | }; 30 | 31 | #endif /* _WORDFORMSSET_H_ */ 32 | 33 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/StrictMorphGram/sm_dll.h: -------------------------------------------------------------------------------- 1 | #ifndef _SM_DLL_H_ 2 | #define _SM_DLL_H_ 3 | 4 | #ifdef _WIN32 5 | #ifdef SM_USE_DLL 6 | #ifdef SM_BUILD_DLL 7 | #define SM_DLL __declspec( dllexport ) 8 | #else 9 | #define SM_DLL __declspec( dllimport ) 10 | #endif 11 | #endif 12 | #endif 13 | 14 | #ifndef SM_DLL 15 | #define SM_DLL 16 | #endif 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/UCharSet/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.7 ) 2 | 3 | if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.12 ) 4 | cmake_policy( SET CMP0074 NEW ) 5 | endif( ${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.12 ) 6 | cmake_policy( SET CMP0054 NEW ) 7 | find_package( ICU COMPONENTS UC REQUIRED ) 8 | 9 | project( lpucharset ) 10 | file( GLOB SOURCES *.h ) 11 | add_library( ${PROJECT_NAME} ${SOURCES} UCharSet.cpp UCharSetFS.cpp ) 12 | target_include_directories( ${PROJECT_NAME} PUBLIC ${ICU_INCLUDE_DIRS} ${CMAKE_CURRENT_LIST_DIR}/../.. ) 13 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/UCharSet/UCharSetFS.h: -------------------------------------------------------------------------------- 1 | #ifndef _UCHARSETFS_H_ 2 | #define _UCHARSETFS_H_ 3 | 4 | #include 5 | 6 | #include "../LingProcErrors.h" 7 | 8 | #include "UCharSet.h" 9 | 10 | class UCharSetFS : public UCharSet 11 | { 12 | private: 13 | // copy prevention 14 | UCharSetFS( const UCharSetFS &src ) : UCharSet( src ) { } 15 | UCharSetFS &operator=( const UCharSetFS & ) { abort(); return *this; } 16 | 17 | public: 18 | UCharSetFS() : UCharSet() { } 19 | UCharSetFS( LangCodes _lang ) : UCharSet( _lang ) { } 20 | ~UCharSetFS() { } 21 | 22 | LingProcErrors Load( fstorage *fs, fstorage_section_id sec_id ); 23 | LingProcErrors Connect( fstorage *fs, fstorage_section_id sec_id ); 24 | LingProcErrors Save( fstorage *fs, fstorage_section_id sec_id, bool transport ); 25 | 26 | protected: 27 | LingProcErrors LoadHeader( fstorage *fs, fstorage_section_id sec_id ); 28 | LingProcErrors SaveHeader( fstorage *fs, fstorage_section_id sec_id ); 29 | }; 30 | 31 | #endif /* _UCHARSETFS_H_ */ 32 | 33 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/WordNormalizer/WordNormalizerEuro.h: -------------------------------------------------------------------------------- 1 | #ifndef _WORDNORMALIZEREURO_H_ 2 | #define _WORDNORMALIZEREURO_H_ 3 | 4 | #include "WordNormalizerGerman.h" 5 | 6 | typedef FuzzyGermanWordNormalizerPolicy FuzzyEuroWordNormalizerPolicy; 7 | typedef StrictGermanWordNormalizerPolicy StrictEuroWordNormalizerPolicy; 8 | 9 | #endif /* _WORDNORMALIZEREURO_H_ */ 10 | 11 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/WordNormalizer/WordNormalizerMorphFuzzy.h: -------------------------------------------------------------------------------- 1 | #ifndef _WORDNORMALIZERMORPHFUZZY_H_ 2 | #define _WORDNORMALIZERMORPHFUZZY_H_ 3 | 4 | #include <_include/_inttype.h> 5 | 6 | #include "WordNormalizerDefault.h" 7 | 8 | #include "../WordNormalizerInterface.h" 9 | 10 | class UCharSet; 11 | 12 | struct FuzzySymbolNativeChecker 13 | { 14 | WordNormalizerResult notNativeSymbol( uint32_t &ch, 15 | size_t wordIdx, 16 | const char* /* word */, 17 | size_t wordSize, 18 | const UCharSet* /* charset */, 19 | uint32_t /* flags */ ) 20 | { 21 | if ( ch == static_cast( '$' ) && wordIdx == wordSize ) 22 | return NORMALIZE_SUCCESS; 23 | return NORMALIZE_ERROR_NOT_NATIVE; 24 | } 25 | }; 26 | 27 | /* Default word normalizer */ 28 | 29 | struct FuzzyWordNormalizerPolicy 30 | { 31 | typedef DefaultWordPreProcessor WordPreProcessor; 32 | typedef FuzzySymbolNativeChecker SymbolNativeChecker; 33 | typedef DefaultSymbolPostProcessor SymbolPostProcessor; 34 | typedef DefaultSymbolCopier SymbolCopier; 35 | }; 36 | 37 | #endif /* _WORDNORMALIZERMORPHFUZZY_H_ */ 38 | 39 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/WordNormalizer/WordNormalizerMorphPunct.h: -------------------------------------------------------------------------------- 1 | #ifndef _WORDNORMALIZERMORPHPUNCT_H_ 2 | #define _WORDNORMALIZERMORPHPUNCT_H_ 3 | 4 | #include <_include/_inttype.h> 5 | 6 | #include "WordNormalizerDefault.h" 7 | 8 | #include "../WordNormalizerInterface.h" 9 | 10 | class UCharSet; 11 | 12 | struct PunctSymbolPostProcessor 13 | { 14 | WordNormalizerResult postProcessSymbol( uint32_t &ch, 15 | size_t /* wordIdx */, 16 | const char* /* word */, 17 | size_t /* wordSize */, 18 | const UCharSet* charset, 19 | uint32_t /* flags */ ) 20 | { 21 | if ( charset->IsPunct( ch ) ) 22 | return NORMALIZE_SUCCESS; 23 | return NORMALIZE_ERROR_NOT_NATIVE; 24 | } 25 | }; 26 | 27 | /* Default word normalizer */ 28 | 29 | struct PunctWordNormalizerPolicy 30 | { 31 | typedef DefaultWordPreProcessor WordPreProcessor; 32 | typedef DefaultSymbolNativeChecker SymbolNativeChecker; 33 | typedef PunctSymbolPostProcessor SymbolPostProcessor; 34 | typedef DefaultSymbolCopier SymbolCopier; 35 | }; 36 | 37 | #endif /* _WORDNORMALIZERMORPHPUNCT_H_ */ 38 | 39 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/WordNormalizer/WordNormalizerMorphStrict.h: -------------------------------------------------------------------------------- 1 | #ifndef _WORDNORMALIZERMORPHSTRICT_H_ 2 | #define _WORDNORMALIZERMORPHSTRICT_H_ 3 | 4 | #include <_include/_inttype.h> 5 | 6 | #include "WordNormalizerDefault.h" 7 | 8 | #include "../UCharSet/UCharSet.h" 9 | #include "../WordNormalizerInterface.h" 10 | 11 | struct StrictSymbolPostProcessor 12 | { 13 | WordNormalizerResult postProcessSymbol( uint32_t &ch, 14 | size_t /* wordIdx */, 15 | const char* /* word */, 16 | size_t /* wordSize */, 17 | const UCharSet *charset, 18 | uint32_t /* flags */ ) 19 | { 20 | /* Force lowercase for dictionary matching */ 21 | ch = charset->ToLower( ch ); 22 | return NORMALIZE_SUCCESS; 23 | } 24 | }; 25 | 26 | /* Default word normalizer */ 27 | 28 | struct StrictWordNormalizerPolicy 29 | { 30 | typedef DefaultWordPreProcessor WordPreProcessor; 31 | typedef DefaultSymbolNativeChecker SymbolNativeChecker; 32 | typedef StrictSymbolPostProcessor SymbolPostProcessor; 33 | typedef DefaultSymbolCopier SymbolCopier; 34 | }; 35 | 36 | #endif /* _WORDNORMALIZERMORPHSTRICT_H_ */ 37 | 38 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/WordNormalizer/WordNormalizerMorphTilde.h: -------------------------------------------------------------------------------- 1 | #ifndef _WORDNORMALIZERMORPHTILDE_H_ 2 | #define _WORDNORMALIZERMORPHTILDE_H_ 3 | 4 | #include <_include/_inttype.h> 5 | 6 | #include "WordNormalizerDefault.h" 7 | 8 | #include "../WordNormalizerInterface.h" 9 | 10 | class UCharSet; 11 | 12 | struct TildeSymbolNativeChecker 13 | { 14 | WordNormalizerResult notNativeSymbol( uint32_t &ch, 15 | size_t wordIdx, 16 | const char* /* word */, 17 | size_t wordSize, 18 | const UCharSet* /* charset */, 19 | uint32_t flags ) 20 | { 21 | if ( ch == static_cast('~') && 22 | wordIdx == wordSize && 23 | (flags & MORPH_FLAG_PROCESS_TILDE) ) 24 | return NORMALIZE_SUCCESS; 25 | return NORMALIZE_ERROR_NOT_NATIVE; 26 | } 27 | }; 28 | 29 | /* Default word normalizer */ 30 | 31 | struct TildeWordNormalizerPolicy 32 | { 33 | typedef DefaultWordPreProcessor WordPreProcessor; 34 | typedef TildeSymbolNativeChecker SymbolNativeChecker; 35 | typedef DefaultSymbolPostProcessor SymbolPostProcessor; 36 | typedef DefaultSymbolCopier SymbolCopier; 37 | }; 38 | 39 | #endif /* _WORDNORMALIZERMORPHTILDE_H_ */ 40 | 41 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_detect_deu.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* detect_table_deu[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_detect_eng.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* detect_table_eng[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_detect_esp.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* detect_table_esp[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_detect_eur.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* detect_table_eur[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_detect_fra.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* detect_table_fra[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_detect_rus.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* detect_table_rus[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_detect_ukr.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* detect_table_ukr[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_detect_vie.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* detect_table_vie[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_phrases_abbr_deu.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* phrases_table_abbr_deu[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_phrases_abbr_eng.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* phrases_table_abbr_eng[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_phrases_abbr_esp.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* phrases_table_abbr_esp[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_phrases_abbr_fra.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* phrases_table_abbr_fra[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_phrases_abbr_rus.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* phrases_table_abbr_rus[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_phrases_abbr_vie.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* phrases_table_abbr_vie[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_phrases_compend.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* phrases_table_compends[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_phrases_stop_deu.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* phrases_table_stopwords_deu[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_phrases_stop_eng.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* phrases_table_stopwords_eng[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_phrases_stop_esp.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* phrases_table_stopwords_esp[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_phrases_stop_fra.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* phrases_table_stopwords_fra[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_phrases_stop_rus.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* phrases_table_stopwords_rus[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_phrases_stop_vie.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* phrases_table_stopwords_vie[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_stop_cyr.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* morph_table_stop_cyr[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_stop_deu.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* morph_table_stop_deu[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_stop_eng.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* morph_table_stop_eng[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_stop_esp.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* morph_table_stop_esp[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_stop_eur.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* morph_table_stop_eur[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_stop_fra.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* morph_table_stop_fra[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_stop_rus.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* morph_table_stop_rus[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_stop_ukr.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* morph_table_stop_ukr[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_suff_cyr.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* morph_table_suff_cyr[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_suff_deu.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* morph_table_suff_deu[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_suff_eng.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* morph_table_suff_eng[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_suff_esp.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* morph_table_suff_esp[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_suff_eur.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* morph_table_suff_eur[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_suff_fra.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* morph_table_suff_fra[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_suff_rus.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* morph_table_suff_rus[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/_tmpl_suff_ukr.cpp: -------------------------------------------------------------------------------- 1 | // GENERATED FILE DO NOT EDIT 2 | const char* morph_table_suff_ukr[] = { 3 | /* TO_INSERT */ 4 | , 5 | 0 6 | }; 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/detect_tables.c: -------------------------------------------------------------------------------- 1 | // GENERATED FILE 2 | #include "detect_table_deu.cpp" 3 | #include "detect_table_eng.cpp" 4 | #include "detect_table_eur.cpp" 5 | #include "detect_table_esp.cpp" 6 | #include "detect_table_vie.cpp" 7 | #include "detect_table_fra.cpp" 8 | #include "detect_table_rus.cpp" 9 | #include "detect_table_ukr.cpp" 10 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/detect_tables.h: -------------------------------------------------------------------------------- 1 | #ifndef MORPH_TABLES_H_SENTRY 2 | #define MORPH_TABLES_H_SENTRY 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | extern const char* detect_table_deu[]; 9 | extern const char* detect_table_eng[]; 10 | extern const char* detect_table_esp[]; 11 | extern const char* detect_table_vie[]; 12 | extern const char* detect_table_fra[]; 13 | extern const char* detect_table_rus[]; 14 | extern const char* detect_table_ukr[]; 15 | extern const char* detect_table_eur[]; 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | 21 | #endif /* SENTRY */ 22 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/morph_tables.c: -------------------------------------------------------------------------------- 1 | // GENERATED FILE 2 | #include "table_suff_deu.cpp" 3 | #include "table_stop_deu.cpp" 4 | #include "table_suff_eng.cpp" 5 | #include "table_stop_eng.cpp" 6 | #include "table_suff_eur.cpp" 7 | #include "table_stop_eur.cpp" 8 | #include "table_suff_esp.cpp" 9 | #include "table_stop_esp.cpp" 10 | #include "table_suff_fra.cpp" 11 | #include "table_stop_fra.cpp" 12 | #include "table_suff_rus.cpp" 13 | #include "table_stop_rus.cpp" 14 | #include "table_suff_cyr.cpp" 15 | #include "table_stop_cyr.cpp" 16 | 17 | // These tables should be always empty! 18 | const char* morph_table_suff_vie[] = { 0 }; 19 | const char* morph_table_stop_vie[] = { 0 }; 20 | 21 | // These tables are empty for now 22 | const char* morph_table_suff_ara[] = { 0 }; 23 | const char* morph_table_stop_ara[] = { 0 }; 24 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/morph_tables.h: -------------------------------------------------------------------------------- 1 | #ifndef MORPH_TABLES_H_SENTRY 2 | #define MORPH_TABLES_H_SENTRY 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | extern const char* morph_table_stop_cyr[]; 9 | extern const char* morph_table_suff_cyr[]; 10 | extern const char* morph_table_stop_deu[]; 11 | extern const char* morph_table_suff_deu[]; 12 | extern const char* morph_table_stop_eng[]; 13 | extern const char* morph_table_suff_eng[]; 14 | extern const char* morph_table_stop_eur[]; 15 | extern const char* morph_table_suff_eur[]; 16 | extern const char* morph_table_stop_esp[]; 17 | extern const char* morph_table_suff_esp[]; 18 | extern const char* morph_table_stop_vie[]; // always empty 19 | extern const char* morph_table_suff_vie[]; // always empty 20 | extern const char* morph_table_stop_fra[]; 21 | extern const char* morph_table_suff_fra[]; 22 | extern const char* morph_table_stop_rus[]; 23 | extern const char* morph_table_suff_rus[]; 24 | extern const char* morph_table_stop_ara[]; // empty for now 25 | extern const char* morph_table_suff_ara[]; // empty for now 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | 31 | #endif /* SENTRY */ 32 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/phrases_tables.c: -------------------------------------------------------------------------------- 1 | // GENERATED FILE 2 | #include "phrases_table_abbr_deu.cpp" 3 | #include "phrases_table_abbr_eng.cpp" 4 | #include "phrases_table_abbr_esp.cpp" 5 | #include "phrases_table_abbr_vie.cpp" 6 | #include "phrases_table_abbr_fra.cpp" 7 | #include "phrases_table_abbr_rus.cpp" 8 | 9 | #include "phrases_table_compend.cpp" 10 | 11 | #include "phrases_table_stop_deu.cpp" 12 | #include "phrases_table_stop_eng.cpp" 13 | #include "phrases_table_stop_esp.cpp" 14 | #include "phrases_table_stop_vie.cpp" 15 | #include "phrases_table_stop_fra.cpp" 16 | #include "phrases_table_stop_rus.cpp" 17 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/phrases_tables.h: -------------------------------------------------------------------------------- 1 | #ifndef PHRASE_DETECT_TABLES 2 | #define PHRASE_DETECT_TABLES 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | extern const char* phrases_table_abbr_deu[]; 9 | extern const char* phrases_table_abbr_eng[]; 10 | extern const char* phrases_table_abbr_esp[]; 11 | extern const char* phrases_table_abbr_vie[]; 12 | extern const char* phrases_table_abbr_fra[]; 13 | extern const char* phrases_table_abbr_rus[]; 14 | 15 | extern const char* phrases_table_compends[]; 16 | 17 | extern const char* phrases_table_stopwords_deu[]; 18 | extern const char* phrases_table_stopwords_eng[]; 19 | extern const char* phrases_table_stopwords_esp[]; 20 | extern const char* phrases_table_stopwords_vie[]; 21 | extern const char* phrases_table_stopwords_fra[]; 22 | extern const char* phrases_table_stopwords_rus[]; 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | 28 | #endif /* SENTRY */ 29 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/source/DetectEu.utf: -------------------------------------------------------------------------------- 1 | xxxx 2 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/source/DeuList.utf: -------------------------------------------------------------------------------- 1 | // Окончания существительных 2 | s 3 | n 4 | e 5 | es 6 | en 7 | er 8 | ern 9 | s 10 | se 11 | sen 12 | ses 13 | n 14 | ns 15 | nen 16 | nnen 17 | ien 18 | 19 | // Окончания прилагательных 20 | e 21 | en 22 | em 23 | er 24 | es 25 | 26 | est 27 | st 28 | 29 | // "Вторичные" окончания существительных и прилагательных (возникающие, например, из-за окончаний глаголов) 30 | t 31 | te 32 | ten 33 | tem 34 | ter 35 | tes 36 | en 37 | ene 38 | enen 39 | enem 40 | ener 41 | enes 42 | end 43 | ende 44 | enden 45 | endem 46 | ender 47 | endes 48 | 49 | er 50 | ere 51 | eren 52 | erem 53 | erer 54 | eres 55 | st 56 | ste 57 | sten 58 | stem 59 | ster 60 | stes 61 | est 62 | este 63 | esten 64 | estem 65 | ester 66 | estes 67 | 68 | // Окончания глаголов 69 | en 70 | e 71 | st 72 | t 73 | e 74 | est 75 | et 76 | en 77 | te 78 | test 79 | tet 80 | ten 81 | ter 82 | ter 83 | tem 84 | ete 85 | etest 86 | etet 87 | eten 88 | eter 89 | eter 90 | etem 91 | end 92 | endst 93 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/source/DeuStop.utf: -------------------------------------------------------------------------------- 1 | // артикли 2 | //der //однобукв. основа 3 | die 4 | das 5 | //des //однобукв. основа 6 | //dem //однобукв. основа 7 | //den //однобукв. основа 8 | 9 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/source/EngList.utf: -------------------------------------------------------------------------------- 1 | // множественное число 2 | s // kid - kids 3 | es // address - addresses, pages 4 | e // page - pages (наведено предыдущим случаем + глаголы); 5 | // не требуется, если не включать -es 6 | 7 | y // story - stories 8 | ies 9 | 10 | 11 | // ??????????? 12 | ' 13 | 's 14 | es 15 | ed 16 | est 17 | iest 18 | ing 19 | s' 20 | 21 | 22 | // ly // непонятно, для чего было 23 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/source/EspStop.utf: -------------------------------------------------------------------------------- 1 | // неизменяемые слова 2 | ola 3 | nada 4 | para 5 | aqui 6 | cuyo 7 | quer 8 | que 9 | que 10 | qué 11 | sobre 12 | como 13 | 14 | // глаголы индивидуального спряжения 15 | // глагол "быть" 16 | soy 17 | eres 18 | //es // совп. с окончанием 19 | somos 20 | sois 21 | son 22 | 23 | // глагол "находиться" 24 | estoy 25 | estas 26 | esta 27 | estamos 28 | estais 29 | estan 30 | estuve 31 | estuviste 32 | estuvo 33 | estuvimos 34 | estuvisteis 35 | estuvieron 36 | este 37 | estes 38 | estemos 39 | esteis 40 | esten 41 | estuviera 42 | estuvieras 43 | estuvieramos 44 | estuvierais 45 | estuvieran 46 | esta 47 | estad 48 | 49 | //глагол "иметь" 50 | //he //однобукв. основа 51 | has 52 | //ha //однобукв. основа 53 | hemos 54 | habeis 55 | han 56 | habre 57 | habras 58 | habra 59 | habremos 60 | habreis 61 | habran 62 | hube 63 | hubiste 64 | hubo 65 | hubimos 66 | hubisteis 67 | hubieron 68 | haya 69 | hayas 70 | hayamos 71 | hayais 72 | hayan 73 | hubiera 74 | hubieras 75 | hubieramos 76 | hubierais 77 | hubieran 78 | habria 79 | habrias 80 | habriamos 81 | habrian 82 | 83 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/source/EurList.utf: -------------------------------------------------------------------------------- 1 | s 2 | es 3 | e 4 | y 5 | ies 6 | ys 7 | 8 | ' 9 | 's 10 | s' 11 | y’s 12 | ys’ 13 | 14 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/source/FuzzyRusAnalyzeThis.ini: -------------------------------------------------------------------------------- 1 | // AnalyzeThis.ru project 2 | 3 | RusSuffMain.utf 4 | RusStopMain.utf 5 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/source/FuzzyRusNovoteka.ini: -------------------------------------------------------------------------------- 1 | // General Search, Novoteka, Applikata, Autocontext, Digest 2 | 3 | RusSuffMain.utf 4 | RusSuffOvEv.utf 5 | RusStopMain.utf 6 | RusStopKhu.utf 7 | RusStopOvEv.utf 8 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/source/FuzzyRusRegnum.ini: -------------------------------------------------------------------------------- 1 | // Regnum Search, Anekdot Search 2 | 3 | RusSuffMain.utf 4 | RusSuffOvEv.utf 5 | RusStopMain.utf 6 | RusStopOvEv.utf 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/source/FuzzyRusSpamtest.ini: -------------------------------------------------------------------------------- 1 | // SpamTest 2 | 3 | RusSuffMain.utf 4 | RusSuffVerbs.utf 5 | RusStopMain.utf 6 | RusStopVerbs.utf 7 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/source/PhraseBreaker/PhraseBrAbbrEn.utf: -------------------------------------------------------------------------------- 1 | a 2 | anon 3 | approx 4 | assn 5 | assoc 6 | avg 7 | b 8 | c 9 | capt 10 | cc 11 | ch 12 | circ 13 | cm 14 | co 15 | col 16 | comdr 17 | cont 18 | contd 19 | cor 20 | corp 21 | cpl 22 | cu 23 | d 24 | dd 25 | dec 26 | def 27 | dep 28 | dist 29 | div 30 | dlr 31 | dpt 32 | dr 33 | e 34 | ed 35 | eg 36 | elev 37 | eq 38 | esq 39 | est 40 | exc 41 | exch 42 | exec 43 | exp 44 | ext 45 | f 46 | ff 47 | fig 48 | fl 49 | fld 50 | fr 51 | ft 52 | g 53 | ga 54 | gal 55 | gen 56 | gl 57 | gm 58 | gr 59 | h 60 | hrs 61 | //i //местоимение i в конце предл. дает ложное "слияние" предложений 62 | ib 63 | ibid 64 | id 65 | ii 66 | iii 67 | ill 68 | illus 69 | inc 70 | incl 71 | incog 72 | iv 73 | j 74 | jr 75 | k 76 | km 77 | l 78 | lat 79 | lb 80 | lg 81 | lge 82 | lt 83 | ltd 84 | m 85 | ma 86 | maj 87 | mi 88 | mil 89 | mo 90 | mr 91 | mrs 92 | ms 93 | n 94 | no 95 | o 96 | p 97 | pct 98 | pg 99 | pp 100 | prof 101 | pt 102 | q 103 | qt 104 | r 105 | re 106 | ref 107 | rep 108 | rev 109 | rf 110 | s 111 | sept 112 | sgt 113 | sp 114 | sq 115 | st 116 | sw 117 | t 118 | tn 119 | u 120 | v 121 | vi 122 | vii 123 | viii 124 | vol 125 | w 126 | wk 127 | x 128 | y 129 | yr 130 | z 131 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/source/PhraseBreaker/PhraseBrAbbrFr.utf: -------------------------------------------------------------------------------- 1 | aa 2 | acad 3 | ad 4 | admin 5 | al 6 | ann 7 | appt 8 | apr 9 | arch 10 | art 11 | auj 12 | av 13 | //bat омонимия со словарем compend 14 | bd 15 | boul 16 | ca 17 | cf 18 | ch 19 | chap 20 | cit 21 | cit 22 | cm 23 | contr 24 | cpdt 25 | dép 26 | dir 27 | dr 28 | dvt 29 | ed 30 | ee 31 | em 32 | env 33 | etc 34 | ex 35 | exc 36 | fasc 37 | fem 38 | ff 39 | fg 40 | fig 41 | gd 42 | hab 43 | ht 44 | ibid 45 | id 46 | ii 47 | inf 48 | jf 49 | jh 50 | jms 51 | jo 52 | kg 53 | km 54 | lib 55 | ll 56 | loc 57 | ma 58 | masc 59 | md 60 | min 61 | mm 62 | mol 63 | ms 64 | nat 65 | nn 66 | nr 67 | ns 68 | num 69 | op 70 | paragr 71 | pdt 72 | pharm 73 | pl 74 | pp 75 | qd 76 | qed 77 | qq 78 | qsp 79 | qte 80 | ref 81 | rr 82 | sec 83 | sect 84 | sing 85 | sqq 86 | ss 87 | suiv 88 | sup 89 | suppl 90 | tel 91 | tgv 92 | tjs 93 | tlm 94 | tq 95 | ts 96 | tt 97 | vb 98 | vol 99 | vs 100 | //xp опасения, что будет попадаться windows xp в конце предложения 101 | a 102 | à 103 | â 104 | b 105 | c 106 | ç 107 | d 108 | e 109 | é 110 | è 111 | f 112 | g 113 | h 114 | i 115 | î 116 | ï 117 | j 118 | k 119 | l 120 | m 121 | n 122 | o 123 | ô 124 | p 125 | q 126 | r 127 | s 128 | t 129 | u 130 | ù 131 | û 132 | ü 133 | v 134 | w 135 | x 136 | y 137 | z 138 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/source/PhraseBreaker/PhraseBrAbbrRu.utf: -------------------------------------------------------------------------------- 1 | см 2 | св 3 | ул 4 | кв 5 | к 6 | п 7 | пп 8 | г 9 | гг 10 | с 11 | ст 12 | пос 13 | тов 14 | е 15 | табл 16 | уч 17 | таб 18 | рис 19 | р 20 | гл 21 | рук 22 | д 23 | доц 24 | тел 25 | под 26 | проф 27 | эт 28 | о 29 | руб 30 | соц 31 | стр 32 | тыс 33 | млн 34 | млрд 35 | трлн 36 | фр 37 | ч 38 | шт 39 | спец 40 | корр 41 | им 42 | а 43 | б 44 | в 45 | е 46 | и 47 | л 48 | м 49 | н 50 | р 51 | с 52 | т 53 | у 54 | ф 55 | х 56 | ш 57 | э 58 | ю 59 | я 60 | зап 61 | сауд 62 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/source/PhraseBreaker/PhraseBrAbbrVi.utf: -------------------------------------------------------------------------------- 1 | a 2 | b 3 | c 4 | d 5 | g 6 | h 7 | i 8 | k 9 | m 10 | p 11 | s 12 | t 13 | đ 14 | am 15 | an 16 | v 17 | j 18 | q 19 | u 20 | y 21 | bhd 22 | bil 23 | bros 24 | bs 25 | bđs 26 | ch 27 | clb 28 | cm 29 | co 30 | corp 31 | cp 32 | cty 33 | da 34 | dn 35 | do 36 | đh 37 | e 38 | f 39 | etc 40 | r 41 | ft 42 | fun 43 | o 44 | gb 45 | gdp 46 | gdtd 47 | gi 48 | gia 49 | gr 50 | gram 51 | gs 52 | ql 53 | tl 54 | kđt 55 | th 56 | tr 57 | ha 58 | hcđ 59 | hd 60 | ii 61 | iii 62 | inc 63 | int 64 | it 65 | jr 66 | jsc 67 | kg 68 | kh 69 | km 70 | lan 71 | ltd 72 | x 73 | mil 74 | mm 75 | mr 76 | mt 77 | ng 78 | ngh 79 | nh 80 | ph 81 | pgs 82 | plc 83 | pte 84 | pv 85 | pvt 86 | qu 87 | sjc 88 | sp 89 | sq 90 | sr 91 | st 92 | tbn 93 | thpt 94 | ths 95 | tp 96 | ts 97 | tt 98 | tx 99 | us 100 | usd 101 | utd 102 | vs 103 | vtv 104 | vu 105 | vv 106 | w 107 | z 108 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/source/PhraseBreaker/PhraseBrCompend.utf: -------------------------------------------------------------------------------- 1 | ac 2 | cn 3 | co 4 | com 5 | cz 6 | de 7 | dll 8 | doc 9 | edu 10 | eu 11 | exe 12 | fi 13 | fm 14 | fr 15 | go 16 | gov 17 | html 18 | img 19 | info 20 | ir 21 | it 22 | jp 23 | js 24 | net 25 | nl 26 | org 27 | pdf 28 | php 29 | pl 30 | sg 31 | vn 32 | ru 33 | ру 34 | ком 35 | bat 36 | xls 37 | ppt 38 | su 39 | ua 40 | by 41 | uk 42 | us 43 | es 44 | biz 45 | jpg 46 | jpeg 47 | png 48 | avi 49 | mp3 50 | mp4 51 | wma 52 | wmv 53 | txt 54 | djvu 55 | wav 56 | bmp 57 | docx 58 | xlsx 59 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/source/PhraseBreaker/PhraseBrStopwordVi.utf: -------------------------------------------------------------------------------- 1 | ipad 2 | iphone 3 | imac 4 | imessage 5 | ifone 6 | igame 7 | igoogle 8 | imovie 9 | imusic 10 | ipod 11 | ios 12 | iphoto 13 | iradio 14 | irobot 15 | ishare 16 | ispace 17 | itunes 18 | itv 19 | iwatch 20 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/source/RusStopKhu.utf: -------------------------------------------------------------------------------- 1 | //******************************************** 2 | // Чтобы не путались при поиске с китайцем Ху 3 | //******************************************** 4 | хуй 5 | хуя 6 | хую 7 | хуем 8 | хуе 9 | 10 | хуи 11 | хуев 12 | хуям 13 | хуями 14 | хуях 15 | 16 | бля // ср. блях 17 | 18 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/source/RusSuffOvEv.utf: -------------------------------------------------------------------------------- 1 | // СУЩЕСТВИТЕЛЬНЫЕ - мужской род 2 | // ОКОНЧАНИЯ Р.МН. -ов, -ев 3 | 4 | ов // слон-ов - омономия с фамилией "Слонов"; самые частые фамилии в списке исключений 5 | ев // зайц-ев - омономия с фамилией "Зайцев"; самые частые фамилии в списке исключений 6 | аев // трамв-аев 7 | оев // гер-оев 8 | еев // муз-еев 9 | ьев // вороб-ьев 10 | иев // сценар-иев 11 | уев // хол-уев 12 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/source/VieList.utf: -------------------------------------------------------------------------------- 1 | // empty now 2 | 3 | con 4 | 5 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/data/source/VieStop.utf: -------------------------------------------------------------------------------- 1 | // empty now 2 | 3 | con 4 | 5 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/tools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory( UMakeCArray ) 2 | -------------------------------------------------------------------------------- /ext/aip/src/LingProc4/tools/UMakeCArray/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.7 ) 2 | 3 | if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.12 ) 4 | cmake_policy( SET CMP0074 NEW ) 5 | endif( ${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.12 ) 6 | cmake_policy( SET CMP0054 NEW ) 7 | find_package( ICU COMPONENTS UC DATA REQUIRED ) 8 | 9 | project( UMakeCArray ) 10 | add_executable( ${PROJECT_NAME} UMakeCArray.cpp ) 11 | 12 | target_link_libraries( ${PROJECT_NAME} ${CMAKE_DL_LIBS} ${ICU_UC_LIBRARIES} ${ICU_DATA_LIBRARIES} zutils lpucharset utf_canonizer ) 13 | target_include_directories( ${PROJECT_NAME} PUBLIC ${ICU_INCLUDE_DIRS} ) 14 | -------------------------------------------------------------------------------- /ext/aip/src/ZTools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory( ZUtils ) 2 | -------------------------------------------------------------------------------- /ext/aip/src/ZTools/ZUtils/Alpha.h: -------------------------------------------------------------------------------- 1 | #ifndef __alpha_h 2 | #define __alpha_h 3 | //---------------------------------------------------------------------// 4 | #define RUSALP_UPPERFIRST 192 5 | #define RUSALP_UPPERLAST 223 6 | #define RUSALP_LOWERFIRST 224 7 | #define RUSALP_LOWERLAST 255 8 | #define RUSALP_UPPERJO 168 9 | #define RUSALP_LOWERJO 184 10 | #define RUSALP_UPPERJE 197 11 | #define RUSALP_LOWERJE 229 12 | //---------------------------------------------------------------------// 13 | bool IsUpperAlpChar(unsigned char c); 14 | bool IsRusAlpChar(unsigned char c); 15 | 16 | unsigned char upperchar(unsigned char c); 17 | 18 | char* setupper(char* text); 19 | char* setlower(char* text); 20 | void checkjo(char* text); 21 | //---------------------------------------------------------------------// 22 | #endif 23 | -------------------------------------------------------------------------------- /ext/aip/src/ZTools/ZUtils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.7 ) 2 | 3 | project( zutils ) 4 | add_library( ${PROJECT_NAME} STATIC 5 | ScanPath.cpp 6 | Alpha.cpp 7 | CSParams.cpp 8 | EString.cpp 9 | StrUtils.cpp ) 10 | target_include_directories( ${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/../.. ) 11 | -------------------------------------------------------------------------------- /ext/aip/src/ZTools/ZUtils/CSParams.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sovaai/sova-engine/783b04072bb243891bc332fcb0f61e938e456f4f/ext/aip/src/ZTools/ZUtils/CSParams.cpp -------------------------------------------------------------------------------- /ext/aip/src/ZTools/ZUtils/CSParams.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sovaai/sova-engine/783b04072bb243891bc332fcb0f61e938e456f4f/ext/aip/src/ZTools/ZUtils/CSParams.h -------------------------------------------------------------------------------- /ext/aip/src/ZTools/ZUtils/EString.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sovaai/sova-engine/783b04072bb243891bc332fcb0f61e938e456f4f/ext/aip/src/ZTools/ZUtils/EString.cpp -------------------------------------------------------------------------------- /ext/aip/src/ZTools/ZUtils/ScanPath.h: -------------------------------------------------------------------------------- 1 | #ifndef __SCANPATH_H__ 2 | #define __SCANPATH_H__ 3 | 4 | int ScanPath(const char* path, bool subdirs, int (*filefunc)(const char*, const char*, const char*, void*), const char* relpath = NULL, void* extra = NULL); 5 | int ScanFileList(const char* filelist, int (*filefunc)(const char*, const char*, const char*, void*), void* extra); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /ext/aip/src/ZTools/ZUtils/StrUtils.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sovaai/sova-engine/783b04072bb243891bc332fcb0f61e938e456f4f/ext/aip/src/ZTools/ZUtils/StrUtils.cpp -------------------------------------------------------------------------------- /ext/aip/src/_include/_stdio_.h: -------------------------------------------------------------------------------- 1 | #if !defined( __STDIO_h__ ) 2 | #define __STDIO_h__ 3 | 4 | #include 5 | 6 | #ifdef _MSC_VER 7 | #define snprintf _snprintf 8 | #endif 9 | 10 | #ifdef OS_LINUX 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include <_include/_io.h> 16 | static FILE * ap_fopen(const char * path, const char * mode) 17 | { 18 | int flags = O_LARGEFILE; 19 | if (strchr(mode,'b')) flags |= O_BINARY; 20 | if (strchr(mode,'r')) { 21 | if (strchr(mode,'+')) flags |= O_RDWR; 22 | else flags |= O_RDONLY; 23 | } 24 | else if (strchr(mode,'w')) { 25 | flags |= O_CREAT | O_TRUNC; 26 | if (strchr(mode,'+')) flags |= O_RDWR; 27 | else flags |= O_WRONLY; 28 | } 29 | else if (strchr(mode,'a')) { 30 | flags |= O_CREAT | O_APPEND; 31 | if (strchr(mode,'+')) flags |= O_RDWR; 32 | else flags |= O_WRONLY; 33 | } 34 | int fd = open(path, flags, 0666); 35 | if (-1 == fd) return NULL; 36 | return fdopen(fd, mode); 37 | } 38 | #else 39 | # define ap_fopen fopen 40 | #endif 41 | 42 | #endif // __STDIO_h__ 43 | -------------------------------------------------------------------------------- /ext/aip/src/_include/_utf8.h: -------------------------------------------------------------------------------- 1 | #ifndef _INCLUDE_UTF8_H_ 2 | #define _INCLUDE_UTF8_H_ 3 | 4 | #include <_include/_inttype.h> 5 | #include 6 | 7 | inline size_t countUtf8( const char *string, size_t stringLen = static_cast(-1) ) 8 | { 9 | size_t count, offset; 10 | for ( count = offset = 0; offset < stringLen; count++ ) 11 | { 12 | uint32_t ch; 13 | U8_NEXT_UNSAFE( string, offset, ch ); 14 | if ( ch == 0 ) 15 | break; 16 | } 17 | 18 | return count; 19 | } 20 | 21 | #endif /* _INCLUDE_UTF8_H_ */ 22 | 23 | -------------------------------------------------------------------------------- /ext/aip/src/lib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory( fstorage ) 2 | add_subdirectory( libpts ) 3 | add_subdirectory( libpts2 ) 4 | add_subdirectory( mmfile ) 5 | add_subdirectory( pcommon ) 6 | add_subdirectory( md5a ) 7 | 8 | -------------------------------------------------------------------------------- /ext/aip/src/lib/aptl/FunctorBuffer.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file FunctorBuffer.h 3 | * @author swizard 4 | * @date Wed Nov 11 18:53:55 2009 5 | * 6 | * @brief An accumulating version of Functor class. 7 | * 8 | * 9 | */ 10 | #ifndef _FUNCTORBUFFER_H_ 11 | #define _FUNCTORBUFFER_H_ 12 | 13 | #include "avector.h" 14 | #include "Functor.h" 15 | 16 | /* The accumulating Functor version based on avector for common purposes */ 17 | template 18 | class FunctorBuffer : public Functor, public avector 19 | { 20 | public: 21 | FunctorBuffer() : Functor(), avector() { } 22 | ~FunctorBuffer() { } 23 | 24 | public: 25 | virtual int apply(FunctorValue value) 26 | { 27 | avector::push_back(value); 28 | if (avector::no_memory()) 29 | return 1; 30 | else 31 | return 0; 32 | } 33 | }; 34 | 35 | #endif /* _FUNCTORBUFFER_H_ */ 36 | 37 | -------------------------------------------------------------------------------- /ext/aip/src/lib/aptl/OpenAddressingDict/Preprocessor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: Preprocessor.h 3 | * Author: Fedor Zorky 4 | * 5 | * Created on April 1, 2009, 3:11 PM 6 | */ 7 | 8 | #ifndef __Preprocessor_h__ 9 | #define __Preprocessor_h__ 10 | 11 | #endif /* __Preprocessor_h__ */ 12 | 13 | -------------------------------------------------------------------------------- /ext/aip/src/lib/aptl/RAII.h: -------------------------------------------------------------------------------- 1 | #ifndef _RAII_H_ 2 | #define _RAII_H_ 3 | 4 | #include <_include/cc_compat.h> 5 | 6 | template< typename Type, int (*dispose)( Type *value ) > 7 | struct RAII 8 | { 9 | Type *value; 10 | 11 | RAII() : value( 0 ) { } 12 | 13 | RAII( Type *_value ) : value( _value ) { } 14 | 15 | ~RAII() 16 | { 17 | detach(); 18 | } 19 | 20 | Type* release() 21 | { 22 | Type* ret = value; 23 | value = 0; 24 | return ret; 25 | } 26 | 27 | void attach( Type *_value ) 28 | { 29 | detach(); 30 | value = _value; 31 | } 32 | 33 | void move( RAII< Type, dispose > &target ) 34 | { 35 | target.detach(); 36 | target.value = value; 37 | value = 0; 38 | } 39 | private: 40 | void detach() { 41 | if (likely(value != 0)) { 42 | dispose(value); 43 | } 44 | } 45 | }; 46 | 47 | template 48 | int defaultDispose(T* value) 49 | { 50 | delete value; 51 | return 0; 52 | } 53 | 54 | template 55 | class RAIIPtr { 56 | public: 57 | typedef RAII< T, defaultDispose > PtrGuard; 58 | }; 59 | 60 | #endif /* _RAII_H_ */ 61 | 62 | -------------------------------------------------------------------------------- /ext/aip/src/lib/aptl/localbuf.h: -------------------------------------------------------------------------------- 1 | #ifndef __aptl_localbuf_h__ 2 | #define __aptl_localbuf_h__ 3 | 4 | #include 5 | 6 | template 7 | class CAutoBuffer { 8 | T* p; 9 | size_t l; 10 | CAutoBuffer(const CAutoBuffer&); 11 | CAutoBuffer& operator=(const CAutoBuffer&); 12 | public: 13 | CAutoBuffer() : p(NULL), l(0) {} 14 | CAutoBuffer(size_t len) : p(new T[len]), l(len) {} 15 | ~CAutoBuffer() { if(p) delete[] p; } 16 | T* get_buffer(size_t len) { if (len > l) { if(p) delete[] p; p=new T[len]; l=len; } return p; } 17 | }; 18 | 19 | template 20 | class CLocalBuffer : private CAutoBuffer { 21 | typedef CAutoBuffer Parent; 22 | T local[N]; 23 | CLocalBuffer(const CLocalBuffer&); 24 | CLocalBuffer& operator=(const CLocalBuffer&); 25 | public: 26 | CLocalBuffer() {} 27 | ~CLocalBuffer() {} 28 | T* get_buffer(size_t len) { return len > N ? Parent::get_buffer(len) : local; } 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /ext/aip/src/lib/aptl/ptr_array.h: -------------------------------------------------------------------------------- 1 | #if !defined( __ptr_array_h__ ) 2 | #define __ptr_array_h__ 3 | #include "array.h" 4 | #include "RAII.h" 5 | 6 | template 7 | int defaultArrayOfPointersDispose(array* arrPtr) 8 | { 9 | if (NULL == arrPtr) { 10 | return 0; 11 | } 12 | 13 | array& arr(*arrPtr); 14 | for (int num = 0; num != arr.GetLen(); ++num) { 15 | delete arr[num]; 16 | arr[num] = NULL; 17 | } 18 | 19 | return 0; 20 | } 21 | 22 | template 23 | class TRAIIArrayOfPointer { 24 | public: 25 | typedef RAII< array, defaultArrayOfPointersDispose > TGuard; 26 | }; 27 | 28 | 29 | #endif //__ptr_array_h__ 30 | -------------------------------------------------------------------------------- /ext/aip/src/lib/aptl/root_file.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #ifdef LOG_SOURCE_ROOT 5 | # define SOURCE_ROOT_LEN strlen(LOG_SOURCE_ROOT) + 1 6 | #else 7 | # define SOURCE_ROOT_LEN 0 8 | #endif 9 | 10 | #define NORMALIZE_FILE_ADDITION__ (SOURCE_ROOT_LEN < strlen(__FILE__) ? SOURCE_ROOT_LEN : 0) 11 | 12 | #define NORMALIZED__FILE__ (__FILE__ + NORMALIZE_FILE_ADDITION__) 13 | -------------------------------------------------------------------------------- /ext/aip/src/lib/aptl/sizeof.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | template char (&ArraySizeHelper(T (&array)[N]))[N]; 4 | #define ARRAY_SIZE(array) (sizeof(ArraySizeHelper(array))) 5 | 6 | #define STR_SIZE(str) (sizeof(ArraySizeHelper(str)) - 1) 7 | -------------------------------------------------------------------------------- /ext/aip/src/lib/component_info/ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sovaai/sova-engine/783b04072bb243891bc332fcb0f61e938e456f4f/ext/aip/src/lib/component_info/ChangeLog -------------------------------------------------------------------------------- /ext/aip/src/lib/component_info/readme: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sovaai/sova-engine/783b04072bb243891bc332fcb0f61e938e456f4f/ext/aip/src/lib/component_info/readme -------------------------------------------------------------------------------- /ext/aip/src/lib/fstorage/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.7 ) 2 | 3 | project( fstorage ) 4 | add_library( ${PROJECT_NAME} STATIC fstorage.c ) 5 | target_link_libraries( ${PROJECT_NAME} PUBLIC mm_file ) 6 | target_include_directories( ${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/../.. ) 7 | -------------------------------------------------------------------------------- /ext/aip/src/lib/fstorage/ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sovaai/sova-engine/783b04072bb243891bc332fcb0f61e938e456f4f/ext/aip/src/lib/fstorage/ChangeLog -------------------------------------------------------------------------------- /ext/aip/src/lib/fstorage/readme: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sovaai/sova-engine/783b04072bb243891bc332fcb0f61e938e456f4f/ext/aip/src/lib/fstorage/readme -------------------------------------------------------------------------------- /ext/aip/src/lib/hash/hash_fnv_tmpl.h: -------------------------------------------------------------------------------- 1 | #ifndef _HASH_FNV_TMPL_H_ 2 | #define _HASH_FNV_TMPL_H_ 3 | 4 | // C++ template wrapper over hash_fnv 5 | 6 | #include 7 | #include "hash_fnv.h" 8 | 9 | // Dummy generic implementation (for sizeof(size_t) != 4, 8). 10 | template 11 | struct Fnv_hash 12 | { 13 | static std::size_t 14 | hash(const char* __first, std::size_t __length) 15 | { 16 | std::size_t __result = 0; 17 | for (; __length > 0; --__length) 18 | __result = (__result * 131) + *__first++; 19 | return __result; 20 | } 21 | }; 22 | 23 | template<> 24 | struct Fnv_hash<4> 25 | { 26 | static std::size_t 27 | hash(const char* __first, std::size_t __length) 28 | { return static_cast(fnv_hash_32(__first, __length)); } 29 | }; 30 | 31 | template<> 32 | struct Fnv_hash<8> 33 | { 34 | static std::size_t 35 | hash(const char* __first, std::size_t __length) 36 | { return static_cast(fnv_hash_64(__first, __length)); } 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /ext/aip/src/lib/libpts/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.7 ) 2 | 3 | project( pts ) 4 | add_library( ${PROJECT_NAME} STATIC 5 | pat_tree.c 6 | pts.c 7 | pat_imp.c 8 | pts_imp.c 9 | ptsfs.c ) 10 | target_include_directories( ${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/../.. ) -------------------------------------------------------------------------------- /ext/aip/src/lib/libpts/ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sovaai/sova-engine/783b04072bb243891bc332fcb0f61e938e456f4f/ext/aip/src/lib/libpts/ChangeLog -------------------------------------------------------------------------------- /ext/aip/src/lib/libpts/pts_imp.h: -------------------------------------------------------------------------------- 1 | #ifndef __alk_pts_imp_h__ 2 | #define __alk_pts_imp_h__ 3 | 4 | #include "pat_tree.h" 5 | 6 | struct __patricia_tree_storage { 7 | 8 | struct { 9 | pat_tree *pt; 10 | pat_id last_id; 11 | } common; 12 | 13 | struct { 14 | pat_tree *pt; 15 | } private; 16 | 17 | }; 18 | 19 | 20 | /* 21 | * XXX This is not used anymore. 22 | */ 23 | 24 | /* 25 | * Patricia Tree Storage header 26 | * 27 | * 4 bytes --- signature 28 | * 1 byte --- save format 29 | * 1 byte --- format version 30 | * 2 bytes --- padding 31 | * 4 bytes --- length of the header rest 32 | * -------------------- (fixed header finished ) 33 | * 4 bytes --- pat_tree data offset (from header) 34 | * 4 bytes --- length of pat_tree data 35 | * 10*4 bytes --- for future use (zero-filled now) 36 | */ 37 | 38 | #define PTS_HEADER_FIXED_SIZE (4 + 1 + 1 + 2 + 4) 39 | #define PTS_HEADER_SIZE (PTS_HEADER_FIXED_SIZE + 4 + 4 + 10*4) 40 | #define PTS_SIGNATURE "PTSM" 41 | #define PTS_FORMAT_VERSION 1 42 | 43 | struct pts_header { 44 | unsigned char format, format_version; 45 | size_t header_rest; 46 | size_t pat_tree_offset; 47 | size_t pat_tree_length; 48 | }; 49 | 50 | int pts_header_parse_fixed(struct pts_header *ptsh, void *data); 51 | 52 | int pts_header_parse_rest(struct pts_header *ptsh, void *data); 53 | 54 | 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /ext/aip/src/lib/libpts/readme: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sovaai/sova-engine/783b04072bb243891bc332fcb0f61e938e456f4f/ext/aip/src/lib/libpts/readme -------------------------------------------------------------------------------- /ext/aip/src/lib/libpts2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.7 ) 2 | 3 | project( pts2 ) 4 | add_library( ${PROJECT_NAME} STATIC 5 | PatriciaTree.cpp 6 | PatriciaTreeFS.cpp 7 | ReverseIndexMixin.cpp 8 | PatriciaTreeOverlay_Standard.cpp 9 | PatriciaTreeOverlay_Compact.cpp 10 | PatriciaTreeOverlay_StandardRaw.cpp 11 | PatriciaTreeOverlay_Generic.cpp 12 | CrossTree_Standard.cpp 13 | CrossTree_StandardRaw.cpp 14 | CrossTree_Compact.cpp ) 15 | target_link_libraries( ${PROJECT_NAME} PUBLIC fstorage ) 16 | -------------------------------------------------------------------------------- /ext/aip/src/lib/libpts2/CrossPathFunctor.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file CrossPathFunctor.h 3 | * @author swizard 4 | * @date Mon Apr 28 09:01:56 2008 5 | * 6 | * @brief A functor for tracking compound word parts. 7 | * 8 | * 9 | */ 10 | #ifndef _CROSSPATHFUNCTOR_H_ 11 | #define _CROSSPATHFUNCTOR_H_ 12 | 13 | struct CrossPathFunctor 14 | { 15 | CrossPathFunctor() { } 16 | virtual ~CrossPathFunctor() { } 17 | 18 | virtual int nextPart(const uint8_t *part, const uint8_t *data, size_t dataSize, bool isExactMatch) = 0; 19 | }; 20 | 21 | #endif /* _CROSSPATHFUNCTOR_H_ */ 22 | 23 | -------------------------------------------------------------------------------- /ext/aip/src/lib/libpts2/CrossTreeInterface.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file CrossTreeInterface.h 3 | * @author swizard 4 | * @date Wed Apr 29 15:04:31 2008 5 | * 6 | * @brief Patricia tree data storage with words cross-links interface -- common API. 7 | * 8 | * 9 | */ 10 | #ifndef _CROSSTREEINTERFACE_H_ 11 | #define _CROSSTREEINTERFACE_H_ 12 | 13 | #include <_include/_inttype.h> 14 | 15 | #include "CrossPathFunctor.h" 16 | #include "PatriciaTreeInterface.h" 17 | 18 | struct CrossTreeInterface : public virtual PatriciaTreeInterface 19 | { 20 | CrossTreeInterface() { } 21 | virtual ~CrossTreeInterface() { } 22 | 23 | virtual PatriciaTreeCore::ResultStatus lookupAll( const uint8_t *key, CrossPathFunctor &functor) const = 0; 24 | virtual PatriciaTreeCore::ResultStatus lookupBest(const uint8_t **key, 25 | const uint8_t **resultData, 26 | size_t *dataSize, 27 | bool *isExactMatch) const = 0; 28 | }; 29 | 30 | #endif /* _CROSSTREEINTERFACE_H_ */ 31 | 32 | -------------------------------------------------------------------------------- /ext/aip/src/lib/libpts2/CrossTree_Compact.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file CrossTree_Compact.cpp 3 | * @author swizard 4 | * @date Wed Dec 17 19:54:21 2008 5 | * 6 | * @brief Patricia tree data storage with words cross-links -- separate object file for Compact policy. 7 | * 8 | * 9 | */ 10 | 11 | #include "CrossTree.cpp" 12 | 13 | /* Force instantiation of the objects needed */ 14 | template class CrossTree >, 16 | CrossTable > >; 17 | template class CrossTree >, 19 | CrossTable > >; 20 | 21 | -------------------------------------------------------------------------------- /ext/aip/src/lib/libpts2/CrossTree_Standard.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file CrossTree_Standard.cpp 3 | * @author swizard 4 | * @date Wed Dec 17 19:54:21 2008 5 | * 6 | * @brief Patricia tree data storage with words cross-links -- separate object file for Standard policy. 7 | * 8 | * 9 | */ 10 | 11 | #include "CrossTree.cpp" 12 | 13 | /* Force instantiation of the objects needed */ 14 | template class CrossTree >, 16 | CrossTable > >; 17 | template class CrossTree >, 19 | CrossTable > >; 20 | 21 | -------------------------------------------------------------------------------- /ext/aip/src/lib/libpts2/CrossTree_StandardRaw.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file CrossTree_StandardRaw.cpp 3 | * @author swizard 4 | * @date Wed Dec 17 19:54:21 2008 5 | * 6 | * @brief Patricia tree data storage with words cross-links -- separate object file for StandardRaw policy. 7 | * 8 | * 9 | */ 10 | 11 | #include "CrossTree.cpp" 12 | 13 | /* Force instantiation of the objects needed */ 14 | template class CrossTree >, 16 | CrossTable > >; 17 | template class CrossTree >, 19 | CrossTable > >; 20 | 21 | -------------------------------------------------------------------------------- /ext/aip/src/lib/libpts2/PatriciaStorageHandler.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file PatriciaStorageHandler.h 3 | * @author swizard 4 | * @date Mon Apr 30 17:17:20 2008 5 | * 6 | * @brief The common patricia tree storage handler. 7 | * 8 | * 9 | */ 10 | #ifndef _PATRICIASTORAGEHANDLER_H_ 11 | #define _PATRICIASTORAGEHANDLER_H_ 12 | 13 | #include 14 | #include <_include/_inttype.h> 15 | #include <_include/_string.h> 16 | 17 | struct StorageChunk 18 | { 19 | size_t size; 20 | const uint8_t *buffer; 21 | }; 22 | 23 | enum PatriciaChuncks 24 | { 25 | PATRICIA_CHUNK_HEADER = 0, 26 | PATRICIA_CHUNK_DATA, 27 | PATRICIA_CHUNK_CROSSLINKS, 28 | PATRICIA_CHUNK_REVERSE_INDEX, 29 | 30 | PATRICIA_CHUNK_LAST 31 | }; 32 | 33 | struct PatriciaStorageHandler 34 | { 35 | StorageChunk chunks[PATRICIA_CHUNK_LAST]; 36 | 37 | PatriciaStorageHandler() 38 | { 39 | bzero(this, sizeof(PatriciaStorageHandler)); 40 | } 41 | }; 42 | 43 | #endif /* _PATRICIASTORAGEHANDLER_H_ */ 44 | 45 | -------------------------------------------------------------------------------- /ext/aip/src/lib/libpts2/PatriciaTreeOverlay_Compact.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file PatriciaTreeOverlay_Compact.cpp 3 | * @author swizard 4 | * @date Wed Dec 17 19:47:18 2008 5 | * 6 | * @brief Patricia tree data storage -- separate object file for Compact policy. 7 | * 8 | * 9 | */ 10 | 11 | #include "PatriciaTreeOverlay.cpp" 12 | 13 | /* Force instantiation of the objects needed */ 14 | template class PatriciaTreeOverlay > >; 15 | template class PatriciaTreeOverlay > >; 16 | 17 | -------------------------------------------------------------------------------- /ext/aip/src/lib/libpts2/PatriciaTreeOverlay_Generic.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file PatriciaTreeOverlay_Generic.cpp 3 | * @author swizard 4 | * @date Wed Dec 17 19:47:18 2008 5 | * 6 | * @brief Patricia tree data storage -- separate object file for Generic policy. 7 | * 8 | * 9 | */ 10 | 11 | #include "PatriciaTreeOverlay.cpp" 12 | 13 | /* Force instantiation of the objects needed */ 14 | template class PatriciaTreeOverlay > >; 15 | template class PatriciaTreeOverlay > >; 16 | 17 | -------------------------------------------------------------------------------- /ext/aip/src/lib/libpts2/PatriciaTreeOverlay_Standard.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file PatriciaTreeOverlay_Standard.cpp 3 | * @author swizard 4 | * @date Wed Dec 17 19:47:18 2008 5 | * 6 | * @brief Patricia tree data storage -- separate object file for Standard policy. 7 | * 8 | * 9 | */ 10 | 11 | #include "PatriciaTreeOverlay.cpp" 12 | 13 | /* Force instantiation of the objects needed */ 14 | template class PatriciaTreeOverlay > >; 15 | template class PatriciaTreeOverlay > >; 16 | 17 | -------------------------------------------------------------------------------- /ext/aip/src/lib/libpts2/PatriciaTreeOverlay_StandardRaw.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file PatriciaTreeOverlay_StandardRaw.cpp 3 | * @author swizard 4 | * @date Wed Dec 17 19:47:18 2008 5 | * 6 | * @brief Patricia tree data storage -- separate object file for StandardRaw policy. 7 | * 8 | * 9 | */ 10 | 11 | #include "PatriciaTreeOverlay.cpp" 12 | 13 | /* Force instantiation of the objects needed */ 14 | template class PatriciaTreeOverlay > >; 15 | template class PatriciaTreeOverlay > >; 16 | 17 | -------------------------------------------------------------------------------- /ext/aip/src/lib/libpts2/ReversedIndexTreeInterface.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file ReversedIndexTreeInterface.h 3 | * @author swizard 4 | * @date Tue Sep 2 22:53:10 2008 5 | * 6 | * @brief Patricia tree data storage with reversed index id->node interface -- common API. 7 | * 8 | * 9 | */ 10 | #ifndef _REVERSEDINDEXTREEINTERFACE_H_ 11 | #define _REVERSEDINDEXTREEINTERFACE_H_ 12 | 13 | #include <_include/_inttype.h> 14 | 15 | #include "PatriciaTreeCore.h" 16 | 17 | struct ReversedIndexTreeInterface 18 | { 19 | ReversedIndexTreeInterface() { } 20 | virtual ~ReversedIndexTreeInterface() { } 21 | 22 | virtual PatriciaTreeCore::ResultStatus indexedAppend( const uint8_t *key, uint32_t *id ) = 0; 23 | virtual PatriciaTreeCore::ResultStatus getFromIndex(uint32_t id, uint32_t *resultLink) const = 0; 24 | virtual size_t getIndexSize() = 0; 25 | }; 26 | 27 | #endif /* _REVERSEDINDEXTREEINTERFACE_H_ */ 28 | 29 | -------------------------------------------------------------------------------- /ext/aip/src/lib/libpts2/StorageInterface.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file StorageInterface.h 3 | * @author swizard 4 | * @date Mon Apr 30 15:18:33 2008 5 | * 6 | * @brief PatriciaTree storages common API. 7 | * 8 | * 9 | */ 10 | #ifndef _STORAGEINTERFACE_H_ 11 | #define _STORAGEINTERFACE_H_ 12 | 13 | #include 14 | 15 | #include "PatriciaStorageHandler.h" 16 | 17 | struct StorageInterface 18 | { 19 | StorageInterface() { } 20 | virtual ~StorageInterface() { } 21 | 22 | virtual size_t getMemoryUsage() const = 0; 23 | virtual size_t getAlignmentOverhead() const = 0; 24 | 25 | virtual void getMemoryChunk(StorageChunk &chunk) = 0; 26 | virtual int setMemoryChunk(StorageChunk &chunk) = 0; 27 | }; 28 | 29 | #endif /* _STORAGEINTERFACE_H_ */ 30 | 31 | -------------------------------------------------------------------------------- /ext/aip/src/lib/libpts2/TODO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sovaai/sova-engine/783b04072bb243891bc332fcb0f61e938e456f4f/ext/aip/src/lib/libpts2/TODO -------------------------------------------------------------------------------- /ext/aip/src/lib/md5a/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.7 ) 2 | 3 | project( md5a ) 4 | add_library( ${PROJECT_NAME} STATIC md5a.c ) 5 | -------------------------------------------------------------------------------- /ext/aip/src/lib/md5a/md5a.h: -------------------------------------------------------------------------------- 1 | #ifndef MD5A_H_SENTRY 2 | #define MD5A_H_SENTRY 3 | 4 | /* 5 | * MD5.h 6 | * 7 | */ 8 | 9 | #ifdef __cplusplus 10 | extern "C" 11 | { 12 | #endif 13 | 14 | typedef struct __MD5_hash_value { 15 | unsigned char v[16]; 16 | } MD5_hash_value; 17 | 18 | /* UINT4 defines a four byte word */ 19 | typedef unsigned int UINT4; 20 | 21 | /* MD5 context. */ 22 | typedef struct { 23 | UINT4 state[4]; /* state (ABCD) */ 24 | UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ 25 | unsigned char buffer[64]; /* input buffer */ 26 | } MD5_CTX; 27 | 28 | extern void MD5Init( MD5_CTX * context ); 29 | extern void MD5Update( MD5_CTX * context, const unsigned char * input, unsigned int inputLen ); 30 | extern void MD5Final( unsigned char digest[16], MD5_CTX * context ); 31 | 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /ext/aip/src/lib/mmfile/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.7 ) 2 | 3 | project( mm_file ) 4 | add_library( ${PROJECT_NAME} STATIC mm_file.cpp ) 5 | -------------------------------------------------------------------------------- /ext/aip/src/lib/mmfile/MemMapFile.h: -------------------------------------------------------------------------------- 1 | #ifndef __MemMapFile_h__ 2 | #define __MemMapFile_h__ 3 | 4 | #undef MMFILE_USE_OFS_64 5 | 6 | # ifdef WIN32 7 | # include 8 | # else 9 | # include 10 | # include 11 | # include 12 | # include 13 | #endif 14 | 15 | #include 16 | #include 17 | 18 | typedef long mm_off; 19 | 20 | class MemMapFile 21 | { 22 | private: 23 | #ifdef WIN32 24 | HANDLE handle; 25 | HANDLE mapped; 26 | #else 27 | int handle; 28 | size_t maplen; 29 | #endif 30 | void* lpdata; 31 | 32 | public: 33 | MemMapFile(); 34 | ~MemMapFile(); 35 | 36 | MemMapFile& operator = (MemMapFile& source); 37 | 38 | #ifndef WIN32 39 | int assign(int fd); 40 | #endif 41 | 42 | int open(const char* lpname, int flags, int mode = 0644); 43 | int close(); 44 | const void* map(); 45 | void unmap(); 46 | int read(void* buf, size_t nbytes); 47 | int write(const void* buf, size_t nbytes); 48 | int pread(mm_off offset, void* buf, size_t nbytes); 49 | int pwrite(mm_off offset, const void* buf, size_t nbytes); 50 | mm_off lseek(mm_off offset, int origin); 51 | int sync(); 52 | int truncate(mm_off offset); 53 | bool isopen() const; 54 | }; 55 | 56 | #ifdef WIN32 57 | #include "MemMapFileWin.h" 58 | #else 59 | #include "MemMapFileUnix.h" 60 | #endif 61 | 62 | #endif // __MemMapFile_h__ 63 | -------------------------------------------------------------------------------- /ext/aip/src/lib/pcommon/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.7 ) 2 | 3 | project( pcommon ) 4 | add_library( ${PROJECT_NAME} STATIC 5 | convert.cpp 6 | convert2UTF.cpp 7 | Dos2Uni.cpp 8 | Iso2Uni.cpp 9 | Koi2Uni.cpp 10 | Lat12Uni.cpp 11 | Lat12Uni_cyr.cpp 12 | Mac2Uni.cpp 13 | Win2Uni.cpp 14 | Viet2Uni.cpp 15 | EucJp2Uni.cpp 16 | Greek2Uni.cpp 17 | Arab2Uni.cpp 18 | koi8_ctype.c 19 | strptime.c 20 | string.c ) 21 | target_include_directories( ${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/../.. ${CMAKE_CURRENT_LIST_DIR}/../../_include ) 22 | -------------------------------------------------------------------------------- /ext/aip/src/lib/pcommon/koi8_ctype.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sovaai/sova-engine/783b04072bb243891bc332fcb0f61e938e456f4f/ext/aip/src/lib/pcommon/koi8_ctype.c -------------------------------------------------------------------------------- /ext/aip/src/lib/pcommon/readme: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sovaai/sova-engine/783b04072bb243891bc332fcb0f61e938e456f4f/ext/aip/src/lib/pcommon/readme -------------------------------------------------------------------------------- /ext/aip/src/lib/pcommon/string.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifdef _MSC_VER 4 | /* straightforward strcasestr implementation */ 5 | char *strcasestr(const char *haystack, const char *needle) 6 | { 7 | const char *p, *startn = 0, *np = 0; 8 | 9 | for (p = haystack; *p; p++) { 10 | if (np) { 11 | if (toupper(*p) == toupper(*np)) { 12 | if (!*++np) { 13 | return (char *)startn; 14 | } 15 | } else { 16 | np = 0; 17 | } 18 | } else if (toupper(*p) == toupper(*needle)) { 19 | np = needle + 1; 20 | startn = p; 21 | } 22 | } 23 | return 0; 24 | } 25 | #endif /* _MSC_VER */ 26 | 27 | /* straightforward strncasestr implementation */ 28 | char *strncasestr(const char *haystack, const char *needle, unsigned long long n) 29 | { 30 | const char *p, *startn = 0, *np = 0; 31 | 32 | for (p = haystack; *p && p < haystack + n; p++) { 33 | if (np) { 34 | if (toupper(*p) == toupper(*np)) { 35 | if (!*++np) { 36 | return (char *)startn; 37 | } 38 | } else { 39 | np = 0; 40 | } 41 | } else if (toupper(*p) == toupper(*needle)) { 42 | np = needle + 1; 43 | startn = p; 44 | } 45 | } 46 | return 0; 47 | } 48 | 49 | -------------------------------------------------------------------------------- /ext/clientlib/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | 3 | /CMakeLists.txt.user -------------------------------------------------------------------------------- /ext/clientlib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project( ClientLib ) 2 | cmake_minimum_required( VERSION 2.6 ) 3 | 4 | set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib ) 5 | 6 | add_subdirectory( nMemoryAllocator ) 7 | add_subdirectory( apcs ) 8 | add_subdirectory( ClientLib ) 9 | -------------------------------------------------------------------------------- /ext/clientlib/ClientLib/Allocator.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "csDataPack.h" 3 | 4 | /** Аллокатор памяти для обмена данными с сервером. */ 5 | nMemoryAllocator ClientLibAllocator; 6 | 7 | extern "C" csdata_data_t * AllocateCSData( unsigned int aAttrNumber ) 8 | { 9 | // Выделение памяти под структуру. 10 | nAllocateNewObject( ClientLibAllocator, csdata_data_t, CSData ); 11 | if( !CSData ) 12 | return NULL; 13 | 14 | // Выделение памяти под элементы структуры. 15 | if( aAttrNumber > 0 ) 16 | { 17 | CSData->attr_list = nAllocateObjects( ClientLibAllocator, csdata_attr_t, aAttrNumber ); 18 | if( !( CSData->attr_list ) ) 19 | return NULL; 20 | } 21 | else 22 | CSData->attr_list = NULL; 23 | 24 | CSData->attr_count = aAttrNumber; 25 | 26 | return CSData; 27 | } 28 | 29 | extern "C" void ClientLibAllocatorReset() 30 | { 31 | ClientLibAllocator.Reset(); 32 | } 33 | 34 | extern "C" unsigned int GetAllocatedMemorySize() 35 | { 36 | return ClientLibAllocator.GetAllocatedMemorySize(); 37 | } 38 | 39 | extern "C" csdata_data_t * ClientLibPackData( csdata_data_t * aSource, int aDataPackFlags ) 40 | { 41 | return csDataPack( aSource, ClientLibAllocator, aDataPackFlags ); 42 | } 43 | 44 | extern "C" csdata_data_t * ClientLibUnPackData( csdata_data_t * aSource ) 45 | { 46 | return csDataUnPack( aSource, ClientLibAllocator, false ); 47 | } 48 | -------------------------------------------------------------------------------- /ext/clientlib/ClientLib/Allocator.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Статический аллокатор для выделения памяти при передаче данных между клиентской библиотекой и сервером InfServer. 3 | */ 4 | 5 | #ifndef __Allocator_h__ 6 | #define __Allocator_h__ 7 | 8 | #include "csDataPack.h" 9 | 10 | #ifdef __cplusplus 11 | extern "C" 12 | { 13 | #endif 14 | 15 | /** 16 | * Выделение памяти под структуру обмена данных с помощью аллокатора памяти. 17 | * @param aAttrNumber - количество элементов в структуре. 18 | */ 19 | csdata_data_t * AllocateCSData( unsigned int aAttrNumber ); 20 | 21 | /** Сброс выделенной аллокатором памяти. */ 22 | void ClientLibAllocatorReset(); 23 | 24 | /** Получение размера выделенной аллокатором памяти. */ 25 | unsigned int GetAllocatedMemorySize(); 26 | 27 | /** 28 | * Упаковка данных для передачи серверу. 29 | * @param aSource - данные для упаковки. 30 | * @param aDataPackFlags - флаги упаковки. 31 | */ 32 | csdata_data_t * ClientLibPackData( csdata_data_t * aSource, int aDataPackFlags ); 33 | 34 | /** 35 | * Распаковка данных полученных от сервера. 36 | * @param aSource - данные полученные от сервера. 37 | */ 38 | csdata_data_t * ClientLibUnPackData( csdata_data_t * aSource ); 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif /** __Allocator_h__ */ 45 | -------------------------------------------------------------------------------- /ext/clientlib/ClientLib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project( ClientLib ) 2 | cmake_minimum_required( VERSION 2.6 ) 3 | 4 | set( CMAKE_C_STANDARD 90 ) 5 | 6 | file( GLOB SOURCES *.c *.cpp *.h *.hpp ) 7 | 8 | add_library( ${PROJECT_NAME} STATIC ${SOURCES} $ $ ) 9 | 10 | target_compile_options( ${PROJECT_NAME} PRIVATE -fPIC ) 11 | 12 | target_include_directories( ${PROJECT_NAME} PRIVATE .. ) 13 | 14 | target_include_directories( ${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/.. ) 15 | -------------------------------------------------------------------------------- /ext/clientlib/ClientLib/CSData.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file CSData.h 3 | * @author Fedor Zorky 4 | */ 5 | 6 | #ifndef __CSData_h__ 7 | #define __CSData_h__ 8 | 9 | #ifdef __cplusplus 10 | 11 | extern "C" 12 | { 13 | #include "../apcs/csdata.h" 14 | } 15 | 16 | #else 17 | 18 | #include "../apcs/csdata.h" 19 | 20 | #endif 21 | 22 | #endif /* __CSData_h__ */ 23 | -------------------------------------------------------------------------------- /ext/clientlib/ClientLib/InfData.h: -------------------------------------------------------------------------------- 1 | #ifndef __InfData_h__ 2 | #define __InfData_h__ 3 | 4 | #include "SessionData.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" 8 | { 9 | #endif 10 | 11 | /** Структура описывающая словарь. */ 12 | typedef struct 13 | { 14 | /** Имя словаря. */ 15 | const char * vName; 16 | 17 | /** Данные словаря. */ 18 | const char * vData; 19 | } __Dict; 20 | 21 | /** Структура описывающая данные инфа. */ 22 | struct __InfData 23 | { 24 | /** Идентификатор инфа. */ 25 | unsigned int vInfId; 26 | 27 | /** Шаблоны инфа. */ 28 | const char * vTemplates; 29 | 30 | /** Количество переменных инфа. */ 31 | unsigned int vVarsNumber; 32 | 33 | /** Переменные инфа. */ 34 | __Var * vVars; 35 | 36 | /** Количество словарей инфа. */ 37 | unsigned int vDictsNumber; 38 | 39 | /** Словари инфа. */ 40 | __Dict * vDicts; 41 | 42 | /** Буфер, выделенный под данные инфа. */ 43 | void * vMemory; 44 | 45 | /** Количество памяти, выделенной под данные инфа. Может превышать реальный размер данных. */ 46 | unsigned int vMemAvalible; 47 | }; 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif /** __InfData_h__ */ 54 | -------------------------------------------------------------------------------- /ext/clientlib/ClientLib/SessionData.h: -------------------------------------------------------------------------------- 1 | #ifndef __SessionData_h__ 2 | #define __SessionData_h__ 3 | 4 | #ifdef __cplusplus 5 | extern "C" 6 | { 7 | #endif 8 | 9 | /** Структура описывающая переменную. */ 10 | typedef struct 11 | { 12 | /** Имя переменной. */ 13 | const char * vName; 14 | 15 | /** Значение переменной. */ 16 | const char * vValue; 17 | } __Var; 18 | 19 | /** Структура описывающая сессию. */ 20 | struct __SessionData 21 | { 22 | /** Идентификатор инфа. */ 23 | unsigned int vInfId; 24 | 25 | /** Идентификатор сессии. */ 26 | unsigned int vSessionId; 27 | 28 | /** Количество переменных в сессии. */ 29 | unsigned int vVarsNumber; 30 | 31 | /** Количество выделенной под переменные памяти. */ 32 | unsigned int vVarsAvalible; 33 | 34 | /** Список переменных. */ 35 | __Var * vVars; 36 | }; 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif /** __SessionData_h__ */ 43 | -------------------------------------------------------------------------------- /ext/clientlib/apcs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project( apcs ) 2 | 3 | cmake_minimum_required( VERSION 2.6 ) 4 | 5 | add_definitions( -DCSDATA_EXTENDED ) 6 | 7 | set( CMAKE_C_FLAGS "-fPIC" ) 8 | set( CMAKE_CXX_FLAGS "-fPIC" ) 9 | 10 | file( GLOB SOURCES *.h *.c ) 11 | 12 | add_library( ${PROJECT_NAME}obj OBJECT ${SOURCES} ) 13 | add_library( ${PROJECT_NAME} STATIC ${SOURCES} ) 14 | target_include_directories( ${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/.. ) 15 | target_link_libraries( ${PROJECT_NAME} m ) 16 | -------------------------------------------------------------------------------- /ext/clientlib/nMemoryAllocator/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project( nMemoryAllocator ) 2 | cmake_minimum_required( VERSION 2.6 ) 3 | 4 | set( CMAKE_C_FLAGS "-fPIC" ) 5 | set( CMAKE_CXX_FLAGS "-fPIC" ) 6 | 7 | file( GLOB_RECURSE SOURCES nMemoryAllocator.h nMemoryAllocator.hpp nMemoryAllocator.cpp ) 8 | 9 | add_library( ${PROJECT_NAME} OBJECT ${SOURCES} ) 10 | target_compile_options( ${PROJECT_NAME} PRIVATE "--std=c++11" ) 11 | 12 | -------------------------------------------------------------------------------- /ext/clientlib/nMemoryAllocator/nMemoryAllocator.h: -------------------------------------------------------------------------------- 1 | #ifndef __nMemoryAllocator_h__ 2 | #define __nMemoryAllocator_h__ 3 | 4 | #ifdef __cplusplus 5 | extern "C" 6 | { 7 | #endif 8 | 9 | /** Определение структуры, которая будет исполнять роль аллокатора. */ 10 | typedef struct __ncMemoryAllocator ncMemoryAllocator; 11 | 12 | /** Создание нового аллокатора. */ 13 | ncMemoryAllocator* ncMemoryAllocatorCreate(); 14 | 15 | /** 16 | * Удаление существующего аллокатора. 17 | * @param aMemoryAllocator - существующий аллокатор. 18 | */ 19 | void ncMemoryAllocatorDestroy( ncMemoryAllocator* aMemoryAllocator ); 20 | 21 | /** 22 | * Выделение памяти с помощью аллокатора. 23 | * @param aMemoryAllocator - существующий аллокатор. 24 | * @param aTargetMemorySize - необходимый размер памяти. 25 | */ 26 | void* AllocatorAllocate( ncMemoryAllocator* aAllocator, size_t aTargetMemorySize ); 27 | 28 | /** 29 | * Очистка памяти, выделенной аллокатором. 30 | * @param aMemoryAllocator - существующий аллокатор. 31 | */ 32 | void ncMemoryAllocatorReset( ncMemoryAllocator* aMemoryAllocator ); 33 | 34 | /** 35 | * Освобождение памяти, выделенной аллокатором. 36 | * @param aMemoryAllocator - существующий аллокатор. 37 | */ 38 | void ncMemoryAllocatorFree( ncMemoryAllocator* aMemoryAllocator ); 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif /** __nMemoryAllocator_h__ */ 45 | -------------------------------------------------------------------------------- /scripts/build.sh: -------------------------------------------------------------------------------- 1 | # Вычисление корневой директории. 2 | ROOTDIR=`dirname $0` 3 | 4 | # Переход в корневую директорию. 5 | cd ${ROOTDIR}/.. 6 | 7 | # Сборка всех контейнеров. 8 | docker-compose build $@ -------------------------------------------------------------------------------- /scripts/dlupdate.sh: -------------------------------------------------------------------------------- 1 | # Сборка и обновление Базы Знаний 2 | docker-compose exec engine InfEngineManager.pl --dl-update /dldata -v && 3 | # Копирование собранной Базы Знаний 4 | docker-compose exec engine cp /engine/release/dldata/dldata.ie2 /dldata 5 | -------------------------------------------------------------------------------- /scripts/down.sh: -------------------------------------------------------------------------------- 1 | # Вычисление корневой директории. 2 | ROOTDIR=`dirname $0` 3 | 4 | # Переход в корневую директорию. 5 | cd ${ROOTDIR}/.. 6 | 7 | # Остановка и удаление контейнеров. 8 | docker-compose down $@ -------------------------------------------------------------------------------- /scripts/start.sh: -------------------------------------------------------------------------------- 1 | # Вычисление корневой директории. 2 | ROOTDIR=`dirname $0` 3 | 4 | # Переход в корневую директорию. 5 | cd ${ROOTDIR}/.. 6 | 7 | # Запуск контейнеров. 8 | docker-compose up -d $@ -------------------------------------------------------------------------------- /scripts/stop.sh: -------------------------------------------------------------------------------- 1 | # Вычисление корневой директории. 2 | ROOTDIR=`dirname $0` 3 | 4 | # Переход в корневую директорию. 5 | cd ${ROOTDIR}/.. 6 | 7 | # Отсановка всех контейнеров. 8 | docker-compose stop $@ -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set( ROOT ${CMAKE_CURRENT_LIST_DIR}/.. ) 2 | add_subdirectory( ap-process-server ) 3 | add_subdirectory( lib ) 4 | add_subdirectory( NanoLib ) 5 | add_subdirectory( InfEngine2 ) 6 | add_subdirectory( InfServer ) 7 | add_subdirectory( InfCompiler ) 8 | add_subdirectory( EllipsisCompiler ) 9 | add_subdirectory( Utils ) -------------------------------------------------------------------------------- /src/EllipsisCompiler/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.0 ) 2 | 3 | project( EllipsisCompiler ) 4 | 5 | add_executable( ${PROJECT_NAME} 6 | MainEllipsisCompiler.cpp 7 | EllipsisCompiler.cpp 8 | EllipsisCompiler.hpp ) 9 | 10 | target_link_libraries( ${PROJECT_NAME} PRIVATE InfEngine terms ${CMAKE_DL_LIBS} ) 11 | 12 | target_compile_definitions( ${PROJECT_NAME} PRIVATE 13 | -DPTS2_CROSS_HASHTABLE_SIZE=64 14 | -DPTS2_CROSS_HASHTABLE_INC=32 15 | -DUSE_INF_TERMS 16 | -DCSDATA_EXTENDED 17 | -D_STL=std 18 | ) -------------------------------------------------------------------------------- /src/EllipsisCompiler/EllipsisCompiler.conf: -------------------------------------------------------------------------------- 1 | // Конфигурация компилятора эллипсисов. 2 | 3 | [Main] 4 | // Корневая директория компиляции. В случае, если параметр не указан, используется текущий каталог. 5 | RootDir = /usr/local/InfEngine/data/estable/ 6 | 7 | // Кодировка исходных данных. Возможные значения: [ cp1251, utf8 ]. По умолчанию "utf8". 8 | Encoding = utf8 9 | 10 | 11 | [Ellipsis] 12 | // Путь к списку файлов с шаблонами эллипсисов. 13 | SourcesList = EllipsisSources.conf 14 | 15 | // Путь к файлу, в который будет сохранена скомпилированная база. 16 | TargetPath = ellipsis.ie2 17 | -------------------------------------------------------------------------------- /src/EllipsisCompiler/EllipsisSources.conf: -------------------------------------------------------------------------------- 1 | [Main] 2 | // Путь к данным эллипсисов. 3 | EllipsisPath = sources 4 | 5 | [Files] 6 | // Пути к файлам эллипсисов. 7 | file = 1. Povestvovatelnye.txt 8 | file = Rus_Zagotovki_2010_11_16.txt 9 | file = 2. Voprositelnye.txt 10 | file = 3. Smeshannye.txt 11 | file = 4. Neklassificiruemye.txt 12 | -------------------------------------------------------------------------------- /src/InfCompiler/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.0 ) 2 | 3 | project( InfCompiler ) 4 | 5 | add_executable( ${PROJECT_NAME} 6 | MainCompiler.cpp 7 | InfCompiler.hpp 8 | InfCompiler.cpp ) 9 | 10 | target_compile_definitions( ${PROJECT_NAME} PRIVATE 11 | -DPTS2_CROSS_HASHTABLE_SIZE=64 12 | -DPTS2_CROSS_HASHTABLE_INC=32 13 | -DUSE_INF_TERMS 14 | -DCSDATA_EXTENDED 15 | -D_STL=std 16 | ) 17 | 18 | target_link_libraries( ${PROJECT_NAME} PRIVATE InfEngine terms ${CMAKE_DL_LIBS} ) 19 | -------------------------------------------------------------------------------- /src/InfEngine2/Build.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Build configuration. 3 | */ 4 | 5 | 6 | /** Configuration */ 7 | 8 | /** InfEngine release information. */ 9 | #define InfEngineReleaseVersion "1.8.5s" 10 | 11 | #ifdef __FreeBSD__ 12 | 13 | #define BuildSystem "FreeBSD" 14 | 15 | #else 16 | 17 | #define BuildSystem "GNU/Linux" 18 | 19 | #endif 20 | 21 | #ifdef __LP64__ 22 | 23 | #define ServerType "x64" 24 | 25 | #else 26 | 27 | #define ServerType "x32" 28 | 29 | #endif 30 | 31 | #define ServerName "localhost" 32 | -------------------------------------------------------------------------------- /src/InfEngine2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory( InfEngine ) -------------------------------------------------------------------------------- /src/InfEngine2/Common.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INF_ENGINE_COMMON_HPP 2 | #define INF_ENGINE_COMMON_HPP 3 | 4 | /** Версия API DL-функций. */ 5 | static constexpr unsigned int DLFunctionInterfaceVersion { 6 }; 6 | 7 | /** Версия протокола упаковки данных при хранении. */ 8 | static constexpr unsigned int InfDataProtocolVersion { 1012 }; 9 | 10 | /** Версия сигнатуры. */ 11 | static constexpr unsigned int SignatureVersion { 1 }; 12 | 13 | /** Версия LingProc. */ 14 | static constexpr unsigned int LongProcVersion { 4 }; 15 | 16 | #endif /** INF_ENGINE_COMMON_HPP */ 17 | -------------------------------------------------------------------------------- /src/InfEngine2/Functions/FunctionLib.hpp: -------------------------------------------------------------------------------- 1 | ../../../src/lib/functions/FunctionLib.hpp -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfDict/InfDictInstrInclude.cpp: -------------------------------------------------------------------------------- 1 | #include "InfDictInstrInclude.hpp" 2 | 3 | #include 4 | 5 | unsigned int InfDictInstrInclude::GetNeedMemorySize() const 6 | { 7 | // Размер типа инструкции. 8 | unsigned int memory = sizeof(uint8_t); 9 | 10 | // Размер идентификатора словаря. 11 | memory += sizeof(uint32_t); 12 | 13 | return memory; 14 | } 15 | 16 | InfEngineErrors InfDictInstrInclude::Save( char* aBuffer, unsigned int aBufferSize, unsigned int& aResultMemory ) const 17 | { 18 | // Проверка аргументов. 19 | if( !aBuffer ) 20 | return INF_ENGINE_ERROR_INV_ARGS; 21 | 22 | // Проверка достаточности размера буфера. 23 | unsigned int memory = GetNeedMemorySize(); 24 | if( aBufferSize < memory ) 25 | return INF_ENGINE_ERROR_INV_DATA; 26 | 27 | // Сохранение типа инструкции. 28 | *reinterpret_cast( aBuffer ) = vType; 29 | 30 | // Сохранение идентификатора включаемого словаря. 31 | *reinterpret_cast( aBuffer + 1 ) = vDictID; 32 | 33 | aResultMemory = memory; 34 | 35 | return INF_ENGINE_SUCCESS; 36 | } 37 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfDict/InfDictSource.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INF_DICT_SOURCE_HPP 2 | #define INF_DICT_SOURCE_HPP 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | /** 10 | * Класс для считывания словаря для дальнейшей компиляции. 11 | */ 12 | class InfDictSource 13 | { 14 | public: 15 | /** Чтение словаря из файла. **/ 16 | InfEngineErrors ReadDictFromFile( const char * aDictPath ); 17 | 18 | public: 19 | /** Получение идентификатора словаря. **/ 20 | unsigned int GetId() { return vId; } 21 | 22 | /** Установка идентификатора словаря. **/ 23 | void SetId( unsigned int aDictId ) { vId = aDictId; } 24 | 25 | 26 | public: 27 | /** Получение имени словаря. **/ 28 | const char * GetName() const { return vName.ToConstChar(); } 29 | 30 | /** Установка имени словаря.**/ 31 | InfEngineErrors SetName( const char * aDictName, unsigned int aDictNameLen ); 32 | 33 | 34 | public: 35 | /** Очистка данных. **/ 36 | void Reset() { vId = 0; vBuffer.clear(); vName.clear(); vTmp.clear(); } 37 | 38 | 39 | private: 40 | /** Идентификатор словаря. **/ 41 | unsigned int vId { 0 }; 42 | 43 | /** Имя словаря. **/ 44 | aTextString vName; 45 | 46 | /** Буфер для хранения словаря. **/ 47 | aTextString vBuffer; 48 | 49 | /** Вспомогательная строка. **/ 50 | aTextString vTmp; 51 | }; 52 | 53 | #endif /** INF_DICT_SOURCE_HPP */ 54 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfDict/InfDictStringManipulator.cpp: -------------------------------------------------------------------------------- 1 | #include "InfDictStringManipulator.hpp" 2 | #include "../DLData.hpp" 3 | 4 | const PatternsStorage::Pattern InfDictStringManipulator::Get() const 5 | { 6 | if( !vDLDataRO ) 7 | return PatternsStorage::Pattern(); 8 | 9 | return vDLDataRO->GetPatternFromStorage( GetId() ); 10 | } 11 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/AliasRegistry.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __AliasRegistry_hpp__ 2 | #define __AliasRegistry_hpp__ 3 | 4 | #include "Alias.hpp" 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | 13 | // Реестр алиасов. 14 | class AliasRegistry 15 | { 16 | public: 17 | AliasRegistry() 18 | { vAliasIndex.Create(); } 19 | 20 | /** 21 | * Регистрация нового алиаса. 22 | * @param aAlias - указатель на готовый алиас. 23 | */ 24 | InfEngineErrors RegisterAlias( const Alias * aAlias ); 25 | 26 | /** 27 | * Возвращает указатель на заданный алиас. 28 | * @param aAliasName - имя алиаса. 29 | * @param aAliasNameLength - длина имени алиаса. 30 | */ 31 | const Alias * GetAlias( const char * aAliasName, unsigned int aAliasNameLength ) const; 32 | 33 | private: 34 | // Индекс имён алиасов. 35 | NanoLib::NameIndex vAliasIndex; 36 | 37 | // Список указателей на алиасы. 38 | avector vAliases; 39 | 40 | }; 41 | 42 | #endif // __AliasRegistry_hpp__ 43 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InfFunction.cpp: -------------------------------------------------------------------------------- 1 | #include "InfFunction.hpp" 2 | 3 | InfEngineErrors InfFunction::Save( char * aBuffer, unsigned int aBufferSize, unsigned int & aResultSize ) const 4 | { 5 | // Проверяем, был ли инициализирова объект. 6 | if( !vDLFunctionInfo ) 7 | ReturnWithError( INF_ENGINE_ERROR_DLF, INF_ENGINE_STRING_ERROR_DLF ); 8 | 9 | unsigned int memory = InfFunction::GetNeedMemorySize(); 10 | 11 | if( aBufferSize < memory ) 12 | ReturnWithError( INF_ENGINE_ERROR_DLF, INF_ENGINE_STRING_ERROR_DLF ); 13 | 14 | char * ptr = aBuffer; 15 | 16 | // Сохранить тип реализации функции. 17 | *ptr = (uint8_t)vDLFunctionType; 18 | ptr += sizeof( uint8_t ); 19 | 20 | // Сохранить дину имени функции. 21 | memcpy( ptr, &vNameLength, sizeof( uint32_t ) ); 22 | ptr += sizeof( uint32_t ); 23 | 24 | // Сохранить имя фукции с завершающим нулём. 25 | memcpy( ptr, vDLFunctionInfo->name, vNameLength ); 26 | ptr += vNameLength; 27 | *ptr = 0; 28 | ++ptr; 29 | 30 | aResultSize = ptr - aBuffer; 31 | if( memory != aResultSize ) 32 | ReturnWithError( INF_ENGINE_ERROR_CHECKSUMM, INF_ENGINE_STRING_ERROR_INCORRECT_SIZE_OF_SAVING_RESULT ); 33 | 34 | return INF_ENGINE_SUCCESS; 35 | } 36 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InfInternalFunction.cpp: -------------------------------------------------------------------------------- 1 | #include "InfInternalFunction.hpp" 2 | 3 | #include "InternalFunctions/InternalFunction.hpp" 4 | 5 | 6 | InfEngineErrors InternalInfFunctionManipulator::Load() 7 | { 8 | vDLFunctionInfo = InternalFunctions::GetFunctionInfo( GetName() ); 9 | if( !vDLFunctionInfo ) 10 | return INF_ENGINE_ERROR_DLF; 11 | 12 | vFunction = InternalFunctions::GetFunctionEntryPoint( GetName() ); 13 | if( !vFunction ) 14 | return INF_ENGINE_ERROR_ENTRY_POINT; 15 | 16 | return INF_ENGINE_SUCCESS; 17 | } 18 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/BelongsToExt.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __BelongsToExt_hpp__ 2 | #define __BelongsToExt_hpp__ 3 | 4 | #include 5 | 6 | namespace InternalFunctions 7 | { 8 | 9 | class BelongsToExt: public BelongsTo 10 | { 11 | public: 12 | static void Init( ExtICoreRO & aBase ) 13 | { vBase = &aBase; } 14 | 15 | static InfEngineErrors Apply( const char ** aArgs, 16 | const char *& aResult, 17 | unsigned int & aLength, 18 | nMemoryAllocator * aMemoryAllocator, 19 | FunctionContext * aFunctionContext ); 20 | 21 | public: 22 | 23 | static const DLFucntionArgInfo ARGS[]; 24 | 25 | static const DLFucntionArgInfo VAR_ARGS; 26 | 27 | static const DLFunctionInfo DLF_INFO; 28 | 29 | private: 30 | static ExtICoreRO * vBase; 31 | }; 32 | 33 | } 34 | 35 | #endif // __BelongsToExt_hpp__ 36 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/CalcTime.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __CalcTime_hpp__ 2 | #define __CalcTime_hpp__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace InternalFunctions 9 | { 10 | 11 | class CalcTime 12 | { 13 | public: 14 | static void Init( ExtICoreRO & aBase ) 15 | { vBase = &aBase; } 16 | 17 | static InfEngineErrors Apply( const char ** aArgs, 18 | const char *& aResult, 19 | unsigned int & aLength, 20 | nMemoryAllocator * aMemoryAllocator, 21 | FunctionContext * aFunctionContext ); 22 | 23 | public: 24 | 25 | static const DLFucntionArgInfo ARGS[]; 26 | 27 | static const DLFucntionArgInfo VAR_ARGS; 28 | 29 | static const DLFunctionInfo DLF_INFO; 30 | 31 | public: 32 | static ExtICoreRO * vBase; 33 | }; 34 | 35 | } 36 | 37 | #endif // __CalcTime_hpp__ 38 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/Capitalize.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __Capitalize_hpp__ 2 | #define __Capitalize_hpp__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "InternalFunction.hpp" 9 | 10 | #include 11 | 12 | namespace InternalFunctions 13 | { 14 | 15 | class Capitalize 16 | { 17 | public: 18 | static void Init( ExtICoreRO & aBase ) 19 | { vBase = &aBase; } 20 | 21 | static InfEngineErrors Apply( const char ** aArgs, 22 | const char *& aResult, 23 | unsigned int & aLength, 24 | nMemoryAllocator * aMemoryAllocator, 25 | FunctionContext * aFunctionContext ); 26 | 27 | public: 28 | 29 | static const DLFucntionArgInfo ARGS[]; 30 | 31 | static const DLFucntionArgInfo VAR_ARGS; 32 | 33 | static const DLFunctionInfo DLF_INFO; 34 | 35 | private: 36 | 37 | static void InitTable(); 38 | 39 | private: 40 | static ExtICoreRO * vBase; 41 | }; 42 | 43 | } 44 | 45 | #endif // __Capitalize_hpp__ 46 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/Date.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __Date_hpp__ 2 | #define __Date_hpp__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace InternalFunctions 9 | { 10 | class Date 11 | { 12 | public: 13 | static void Init( ExtICoreRO & aBase ) 14 | { vBase = &aBase; } 15 | 16 | static InfEngineErrors Apply( const char ** aArgs, const char *& aResult, unsigned int & aLength, 17 | nMemoryAllocator * aMemoryAllocator, FunctionContext * aFunctionContext ); 18 | 19 | public: 20 | static const DLFucntionArgInfo ARGS[]; 21 | static const DLFucntionArgInfo VAR_ARGS; 22 | static const DLFunctionInfo DLF_INFO; 23 | 24 | private: 25 | static ExtICoreRO * vBase; 26 | }; 27 | } 28 | 29 | #endif /** __Date_hpp__ */ 30 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/DayOfWeek.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FUNCTION_DAY_OF_WEEK 2 | #define FUNCTION_DAY_OF_WEEK 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace InternalFunctions { 9 | class DayOfWeek { 10 | public: 11 | static void Init( ExtICoreRO & aBase ) { vBase = &aBase; } 12 | 13 | static InfEngineErrors Apply( const char ** aArgs, const char *& aResult, unsigned int & aLength, nMemoryAllocator * aMemoryAllocator, 14 | FunctionContext * aFunctionContext ); 15 | 16 | public: 17 | static const DLFucntionArgInfo ARGS[]; 18 | static const DLFucntionArgInfo VAR_ARGS; 19 | static const DLFunctionInfo DLF_INFO; 20 | 21 | private: 22 | static ExtICoreRO * vBase; 23 | }; 24 | } 25 | 26 | #endif // FUNCTION_DAY_OF_WEEK 27 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/Dec.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __Dec_hpp__ 2 | #define __Dec_hpp__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace InternalFunctions 9 | { 10 | 11 | class Dec 12 | { 13 | public: 14 | static void Init( ExtICoreRO & aBase ) 15 | { vBase = &aBase; } 16 | 17 | static InfEngineErrors Apply( const char ** aArgs, 18 | const char *& aResult, 19 | unsigned int & aLength, 20 | nMemoryAllocator * aMemoryAllocator, 21 | FunctionContext* aFunctionContext ); 22 | 23 | public: 24 | 25 | static const DLFucntionArgInfo ARGS[]; 26 | 27 | static const DLFucntionArgInfo VAR_ARGS; 28 | 29 | static const DLFunctionInfo DLF_INFO; 30 | 31 | private: 32 | static ExtICoreRO * vBase; 33 | }; 34 | 35 | } 36 | 37 | #endif /** __Dec_hpp__ */ 38 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/DictsMatch.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __DictsMatch_hpp__ 2 | #define __DictsMatch_hpp__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace InternalFunctions 9 | { 10 | 11 | // Заглушка. Сама функция реализована в движке. 12 | class DictsMatch 13 | { 14 | public: 15 | static void Init( ExtICoreRO & aBase ) 16 | { vBase = &aBase; } 17 | 18 | static InfEngineErrors Apply( const char ** aArgs, 19 | const char *& aResult, 20 | unsigned int & aLength, 21 | nMemoryAllocator * aMemoryAllocator, 22 | FunctionContext * aFunctionContext ); 23 | 24 | public: 25 | 26 | static const DLFucntionArgInfo ARGS[]; 27 | 28 | static const DLFucntionArgInfo VAR_ARGS; 29 | 30 | static const DLFunctionInfo DLF_INFO; 31 | 32 | private: 33 | static ExtICoreRO * vBase; 34 | }; 35 | 36 | } 37 | 38 | #endif // __DictsMatch_hpp__ 39 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/DictsMatchExt.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __DictsMatchExt_hpp__ 2 | #define __DictsMatchExt_hpp__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | namespace InternalFunctions 10 | { 11 | 12 | class DictsMatchExt 13 | { 14 | public: 15 | static void Init( ExtICoreRO & aBase ) 16 | { vBase = &aBase; } 17 | 18 | static InfEngineErrors Apply( const char ** aArgs, 19 | const char *& aResult, 20 | unsigned int & aLength, 21 | nMemoryAllocator * aMemoryAllocator, 22 | FunctionContext * aFunctionContext ); 23 | 24 | public: 25 | 26 | static const DLFucntionArgInfo ARGS[]; 27 | 28 | static const DLFucntionArgInfo VAR_ARGS; 29 | 30 | static const DLFunctionInfo DLF_INFO; 31 | 32 | private: 33 | static ExtICoreRO * vBase; 34 | }; 35 | 36 | } 37 | 38 | #endif // __DictsMatchExt_hpp__ 39 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/DictsNotMatch.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __DictsNotMatch_hpp__ 2 | #define __DictsNotMatch_hpp__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | namespace InternalFunctions 10 | { 11 | // Заглушка. Сама функция реализована в движке. 12 | class DictsNotMatch 13 | { 14 | public: 15 | static void Init( ExtICoreRO & aBase ) 16 | { vBase = &aBase; } 17 | 18 | static InfEngineErrors Apply( const char ** aArgs, 19 | const char *& aResult, 20 | unsigned int & aLength, 21 | nMemoryAllocator * aMemoryAllocator, 22 | FunctionContext * aFunctionContext ); 23 | 24 | public: 25 | 26 | static const DLFucntionArgInfo ARGS[]; 27 | 28 | static const DLFucntionArgInfo VAR_ARGS; 29 | 30 | static const DLFunctionInfo DLF_INFO; 31 | 32 | private: 33 | static ExtICoreRO * vBase; 34 | }; 35 | 36 | } 37 | 38 | #endif /** __DictsNotMatch_hpp__ */ 39 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/DumpVar.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __DumpVar_hpp__ 2 | #define __DumpVar_hpp__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "InternalFunction.hpp" 9 | 10 | namespace InternalFunctions 11 | { 12 | class DumpVar 13 | { 14 | public: 15 | static void Init( ExtICoreRO & aBase ) 16 | { vBase = &aBase; } 17 | 18 | static InfEngineErrors Apply( const char ** aArgs, const char *& aResult, unsigned int & aLength, nMemoryAllocator * aMemoryAllocator, 19 | FunctionContext * aFunctionContext ); 20 | 21 | public: 22 | static const DLFucntionArgInfo ARGS[]; 23 | static const DLFucntionArgInfo VAR_ARGS; 24 | static const DLFunctionInfo DLF_INFO; 25 | 26 | private: 27 | static ExtICoreRO * vBase; 28 | }; 29 | 30 | } 31 | 32 | #endif /** __DumpVar_hpp__ */ 33 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/FindContacts/FindContacts.cpp: -------------------------------------------------------------------------------- 1 | #include "../InternalFunction.hpp" 2 | #include "InfEngine2/_Include/Errors.h" 3 | #include "FindContacts.hpp" 4 | 5 | using namespace InternalFunctions; 6 | 7 | const DLFucntionArgInfo FindContacts::ARGS[] = { { DLFAT_EXTENDED, "" } }; 8 | 9 | const DLFunctionInfo FindContacts::DLF_INFO = { 10 | "FindContacts", 11 | "", 12 | "Find contacts in given string", 13 | DLFRT_TEXT, 14 | 1, 15 | ARGS, 16 | { 1, 0, 0 }, 17 | { 1, 0, 0 }, 18 | DLFO_CACHE, 19 | DLFunctionInterfaceVersion, 20 | 5, 21 | InfDataProtocolVersion, 22 | nullptr 23 | }; 24 | 25 | ExtICoreRO * FindContacts::vBase = nullptr; 26 | 27 | InfEngineErrors FindContacts::Apply( const char ** aArgs, const char *& aResult, 28 | unsigned int & aLength, nMemoryAllocator * aMemoryAllocator, 29 | FunctionContext * /*aFunctionContext*/ ) 30 | { 31 | return INF_ENGINE_SUCCESS; 32 | } 33 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/FindContacts/FindContacts.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __FindContacts_hpp__ 2 | #define __FindContacts_hpp__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace InternalFunctions 9 | { 10 | class FindContacts 11 | { 12 | public: 13 | static void Init( ExtICoreRO & aBase ) 14 | { vBase = &aBase; } 15 | 16 | static InfEngineErrors Apply( const char ** aArgs, const char *& aResult, 17 | unsigned int & aLength, nMemoryAllocator * aMemoryAllocator, 18 | FunctionContext * /*aFunctionContext*/ ); 19 | 20 | public: 21 | static const DLFucntionArgInfo ARGS[]; 22 | static const DLFucntionArgInfo VAR_ARGS; 23 | static const DLFunctionInfo DLF_INFO; 24 | 25 | private: 26 | static ExtICoreRO * vBase; 27 | }; 28 | } 29 | 30 | #endif /** __FindContacts_hpp__ */ 31 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/FindContacts/FindEmail.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __FindEmail_hpp__ 2 | #define __FindEmail_hpp__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace InternalFunctions 9 | { 10 | class FindEmail 11 | { 12 | public: 13 | static void Init( ExtICoreRO & aBase ) 14 | { vBase = &aBase; } 15 | 16 | static InfEngineErrors Apply( const char ** aArgs, const char *& aResult, 17 | unsigned int & aLength, nMemoryAllocator * aMemoryAllocator, 18 | FunctionContext * /*aFunctionContext*/ ); 19 | 20 | public: 21 | static const DLFucntionArgInfo ARGS[]; 22 | static const DLFucntionArgInfo VAR_ARGS; 23 | static const DLFunctionInfo DLF_INFO; 24 | 25 | private: 26 | static ExtICoreRO * vBase; 27 | }; 28 | } 29 | 30 | #endif /** __FindEmail_hpp__ */ 31 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/FindContacts/FindPhone.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __FindPhone_hpp__ 2 | #define __FindPhone_hpp__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace InternalFunctions 9 | { 10 | class FindPhone 11 | { 12 | public: 13 | static void Init( ExtICoreRO & aBase ) 14 | { vBase = &aBase; } 15 | 16 | static InfEngineErrors Apply( const char ** aArgs, const char *& aResult, 17 | unsigned int & aLength, nMemoryAllocator * aMemoryAllocator, 18 | FunctionContext * /*aFunctionContext*/ ); 19 | 20 | public: 21 | static const DLFucntionArgInfo ARGS[]; 22 | static const DLFucntionArgInfo VAR_ARGS; 23 | static const DLFunctionInfo DLF_INFO; 24 | 25 | private: 26 | static ExtICoreRO * vBase; 27 | }; 28 | } 29 | 30 | #endif /** __FindPhone_hpp__ */ 31 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/FindContacts/contacts_finder.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __contacts_finder_hpp__ 2 | #define __contacts_finder_hpp__ 3 | 4 | #include 5 | 6 | class yy_buffer_state; 7 | 8 | class contacts_finder 9 | { 10 | public: 11 | contacts_finder( const std::string& request ); 12 | ~contacts_finder(); 13 | 14 | public: 15 | enum type 16 | { 17 | eof = 0, 18 | phone = 1, 19 | email = 2, 20 | error = 3, 21 | none = 4 22 | }; 23 | 24 | type search( std::string &result ); 25 | 26 | type last_type() const { return v_last_type; } 27 | 28 | private: 29 | yy_buffer_state* v_state; 30 | const std::string& v_request; 31 | type v_last_type; 32 | }; 33 | 34 | #endif /** __contacts_finder_hpp__ */ 35 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/In.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __In_hpp__ 2 | #define __In_hpp__ 3 | 4 | #include "InternalFunction.hpp" 5 | #include "InfEngine2/_Include/Errors.h" 6 | #include 7 | #include 8 | #include 9 | 10 | namespace InternalFunctions 11 | { 12 | 13 | class In 14 | { 15 | public: 16 | static void Init( ExtICoreRO & aBase ) 17 | { vBase = &aBase; } 18 | 19 | static InfEngineErrors Apply( const char ** aArgs, 20 | const char *& aResult, 21 | unsigned int & aLength, 22 | nMemoryAllocator * aMemoryAllocator, 23 | FunctionContext * aFunctionContext ); 24 | 25 | public: 26 | 27 | static const DLFucntionArgInfo ARGS[]; 28 | 29 | static const DLFucntionArgInfo VAR_ARGS; 30 | 31 | static const DLFunctionInfo DLF_INFO; 32 | 33 | protected: 34 | 35 | static bool _apply( const char * aSerializedVarId, const char ** aStrings, FunctionContext * aFunctionContext ); 36 | 37 | private: 38 | static ExtICoreRO * vBase; 39 | }; 40 | 41 | } 42 | 43 | #endif // __In_hpp__ 44 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/Inc.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __Inc_hpp__ 2 | #define __Inc_hpp__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace InternalFunctions 9 | { 10 | 11 | class Inc 12 | { 13 | public: 14 | static void Init( ExtICoreRO & aBase ) 15 | { vBase = &aBase; } 16 | 17 | static InfEngineErrors Apply( const char ** aArgs, 18 | const char *& aResult, 19 | unsigned int & aLength, 20 | nMemoryAllocator * aMemoryAllocator, 21 | FunctionContext* aFunctionContext ); 22 | 23 | public: 24 | 25 | static const DLFucntionArgInfo ARGS[]; 26 | 27 | static const DLFucntionArgInfo VAR_ARGS; 28 | 29 | static const DLFunctionInfo DLF_INFO; 30 | 31 | private: 32 | static ExtICoreRO * vBase; 33 | }; 34 | 35 | } 36 | 37 | #endif /** __Inc_hpp__ */ 38 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/InternalFunction.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __InternalFunction_hpp__ 2 | #define __InternalFunction_hpp__ 3 | 4 | #include 5 | #include 6 | #include "../../Session.hpp" 7 | 8 | namespace InternalFunctions 9 | { 10 | extern const DLFunctionInfo * FUNCTIONS[]; 11 | 12 | extern unsigned int FUNCTIONS_COUNT; 13 | 14 | void InitFunctions( ExtICoreRO & aBase ); 15 | 16 | FDLFucntion GetFunctionEntryPoint( const char * aFunctionName ); 17 | 18 | unsigned int GetFunctionsNumber(); 19 | 20 | const DLFunctionInfo *GetFunctionInfo( unsigned int aFunctionN ); 21 | 22 | const DLFunctionInfo * GetFunctionInfo( const char * aFunctionName ); 23 | } 24 | 25 | struct FunctionContext 26 | { 27 | FunctionContext( Session * aSession, iAnswer * aAnswer ) :vSession( aSession ) ,vAnswer( aAnswer ) {} 28 | 29 | Session * vSession; 30 | iAnswer * vAnswer; 31 | }; 32 | #endif /** __InternalFunction_hpp__ */ 33 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/IsEmpty.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __IsEmpty_hpp__ 2 | #define __IsEmpty_hpp__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace InternalFunctions 9 | { 10 | 11 | class IsEmpty 12 | { 13 | public: 14 | static void Init( ExtICoreRO & aBase ) 15 | { vBase = &aBase; } 16 | 17 | static InfEngineErrors Apply( const char ** aArgs, 18 | const char *& aResult, 19 | unsigned int & aLength, 20 | nMemoryAllocator * aMemoryAllocator, 21 | FunctionContext* aFunctionContext ); 22 | 23 | public: 24 | 25 | static const DLFucntionArgInfo ARGS[]; 26 | 27 | static const DLFucntionArgInfo VAR_ARGS; 28 | 29 | static const DLFunctionInfo DLF_INFO; 30 | 31 | private: 32 | static ExtICoreRO * vBase; 33 | }; 34 | 35 | } 36 | 37 | #endif /** __IsEmpty_hpp__ */ 38 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/IsEqual.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __IsEqual_hpp__ 2 | #define __IsEqual_hpp__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace InternalFunctions 9 | { 10 | 11 | class IsEqual 12 | { 13 | public: 14 | static void Init( ExtICoreRO & aBase ) 15 | { vBase = &aBase; } 16 | 17 | static InfEngineErrors Apply( const char ** aArgs, 18 | const char *& aResult, 19 | unsigned int & aLength, 20 | nMemoryAllocator * aMemoryAllocator, 21 | FunctionContext * aFunctionContext ); 22 | 23 | public: 24 | 25 | static const DLFucntionArgInfo ARGS[]; 26 | 27 | static const DLFucntionArgInfo VAR_ARGS; 28 | 29 | static const DLFunctionInfo DLF_INFO; 30 | 31 | private: 32 | static ExtICoreRO * vBase; 33 | }; 34 | 35 | } 36 | 37 | #endif // __IsEqual_hpp__ 38 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/IsNotEmpty.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __IsNotEmpty_hpp__ 2 | #define __IsNotEmpty_hpp__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace InternalFunctions 9 | { 10 | 11 | class IsNotEmpty 12 | { 13 | public: 14 | static void Init( ExtICoreRO & aBase ) 15 | { vBase = &aBase; } 16 | 17 | static InfEngineErrors Apply( const char ** aArgs, 18 | const char *& aResult, 19 | unsigned int & aLength, 20 | nMemoryAllocator * aMemoryAllocator, 21 | FunctionContext * aFunctionContext ); 22 | 23 | public: 24 | 25 | static const DLFucntionArgInfo ARGS[]; 26 | 27 | static const DLFucntionArgInfo VAR_ARGS; 28 | 29 | static const DLFunctionInfo DLF_INFO; 30 | 31 | private: 32 | static ExtICoreRO * vBase; 33 | }; 34 | 35 | } 36 | 37 | #endif // __IsNotEmpty_hpp__ 38 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/IsNotEqual.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __IsNotEqual_hpp__ 2 | #define __IsNotEqual_hpp__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace InternalFunctions 9 | { 10 | 11 | class IsNotEqual 12 | { 13 | public: 14 | 15 | static void Init( ExtICoreRO & aBase ) 16 | { vBase = &aBase; } 17 | 18 | static InfEngineErrors Apply( const char ** aArgs, 19 | const char *& aResult, 20 | unsigned int & aLength, 21 | nMemoryAllocator * aMemoryAllocator, 22 | FunctionContext * aFunctionContext ); 23 | 24 | public: 25 | 26 | static const DLFucntionArgInfo ARGS[]; 27 | 28 | static const DLFucntionArgInfo VAR_ARGS; 29 | 30 | static const DLFunctionInfo DLF_INFO; 31 | 32 | private: 33 | static ExtICoreRO * vBase; 34 | }; 35 | 36 | } 37 | 38 | #endif // __IsNotEqual_hpp__ 39 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/ListTree.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __ListTree_hpp__ 2 | #define __ListTree_hpp__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "InternalFunction.hpp" 9 | 10 | namespace InternalFunctions 11 | { 12 | 13 | class ListTree 14 | { 15 | public: 16 | static void Init( ExtICoreRO & aBase ) 17 | { vBase = &aBase; } 18 | 19 | static InfEngineErrors Apply( const char ** aArgs, 20 | const char *& aResult, 21 | unsigned int & aLength, 22 | nMemoryAllocator * aMemoryAllocator, 23 | FunctionContext * aFunctionContext ); 24 | 25 | protected: 26 | 27 | static InfEngineErrors AddLeafToAnswer( const Vars::Vector::VarStruct & aLeaf, iAnswer & aAnswer ); 28 | 29 | static InfEngineErrors AddTreeToAnswer( const Vars::Vector::VarStruct & aRoot, iAnswer & aAnswer ); 30 | 31 | public: 32 | 33 | static const DLFucntionArgInfo ARGS[]; 34 | 35 | static const DLFucntionArgInfo VAR_ARGS; 36 | 37 | static const DLFunctionInfo DLF_INFO; 38 | 39 | private: 40 | static ExtICoreRO * vBase; 41 | }; 42 | 43 | } 44 | 45 | #endif // __ListTree_hpp__ 46 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/NotBelongsTo.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __NotBelongsTo_hpp__ 2 | #define __NotBelongsTo_hpp__ 3 | 4 | #include "BelongsTo.hpp" 5 | 6 | namespace InternalFunctions 7 | { 8 | 9 | class NotBelongsTo: public BelongsTo 10 | { 11 | public: 12 | static void Init( ExtICoreRO & aBase ) 13 | { vBase = &aBase; } 14 | 15 | static InfEngineErrors Apply( const char ** aArgs, 16 | const char *& aResult, 17 | unsigned int & aLength, 18 | nMemoryAllocator * aMemoryAllocator, 19 | FunctionContext * aFunctionContext ); 20 | 21 | public: 22 | 23 | static const DLFucntionArgInfo ARGS[]; 24 | 25 | static const DLFucntionArgInfo VAR_ARGS; 26 | 27 | static const DLFunctionInfo DLF_INFO; 28 | 29 | private: 30 | static ExtICoreRO * vBase; 31 | }; 32 | 33 | } 34 | 35 | #endif /** __NotBelongsTo_hpp__ */ 36 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/NotIn.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __NotIn_hpp__ 2 | #define __NotIn_hpp__ 3 | 4 | #include "In.hpp" 5 | 6 | namespace InternalFunctions 7 | { 8 | 9 | class NotIn: public InternalFunctions::In 10 | { 11 | public: 12 | static void Init( ExtICoreRO & aBase ) 13 | { vBase = &aBase; } 14 | 15 | static InfEngineErrors Apply( const char ** aArgs, 16 | const char *& aResult, 17 | unsigned int & aLength, 18 | nMemoryAllocator * aMemoryAllocator, 19 | FunctionContext * aFunctionContext ); 20 | 21 | public: 22 | 23 | static const DLFucntionArgInfo ARGS[]; 24 | 25 | static const DLFucntionArgInfo VAR_ARGS; 26 | 27 | static const DLFunctionInfo DLF_INFO; 28 | 29 | private: 30 | static ExtICoreRO * vBase; 31 | }; 32 | 33 | } 34 | 35 | #endif // __NotIn_hpp__ 36 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/NumberToString.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __NumberToString_hpp__ 2 | #define __NumberToString_hpp__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "InternalFunction.hpp" 9 | 10 | #include 11 | 12 | namespace InternalFunctions 13 | { 14 | 15 | class NumberToString 16 | { 17 | public: 18 | static void Init( ExtICoreRO & aBase ) 19 | { vBase = &aBase; } 20 | 21 | static InfEngineErrors Apply( const char ** aArgs, 22 | const char *& aResult, 23 | unsigned int & aLength, 24 | nMemoryAllocator * aMemoryAllocator, 25 | FunctionContext * aFunctionContext ); 26 | 27 | public: 28 | 29 | static const DLFucntionArgInfo ARGS[]; 30 | 31 | static const DLFucntionArgInfo VAR_ARGS; 32 | 33 | static const DLFunctionInfo DLF_INFO; 34 | 35 | private: 36 | 37 | static void InitTable(); 38 | 39 | private: 40 | static ExtICoreRO * vBase; 41 | }; 42 | 43 | } 44 | 45 | #endif // __NumberToString_hpp__ 46 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/SetValue.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __SetValue_hpp__ 2 | #define __SetValue_hpp__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace InternalFunctions 9 | { 10 | 11 | class SetValue 12 | { 13 | public: 14 | static void Init( ExtICoreRO & aBase ) 15 | { vBase = &aBase; } 16 | 17 | static InfEngineErrors Apply( const char ** aArgs, 18 | const char *& aResult, 19 | unsigned int & aLength, 20 | nMemoryAllocator * aMemoryAllocator, 21 | FunctionContext* aFunctionContext ); 22 | 23 | public: 24 | 25 | static const DLFucntionArgInfo ARGS[]; 26 | 27 | static const DLFucntionArgInfo VAR_ARGS; 28 | 29 | static const DLFunctionInfo DLF_INFO; 30 | 31 | private: 32 | static ExtICoreRO * vBase; 33 | }; 34 | 35 | } 36 | 37 | #endif /** __SetValue_hpp__ */ 38 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/StringToNumber.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __StringToNumber_hpp__ 2 | #define __StringToNumber_hpp__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "InternalFunction.hpp" 9 | 10 | #include 11 | 12 | namespace InternalFunctions 13 | { 14 | class StringToNumber 15 | { 16 | public: 17 | static void Init( ExtICoreRO & aBase ) 18 | { vBase = &aBase; } 19 | 20 | static InfEngineErrors Apply( const char ** aArgs, const char *& aResult, unsigned int & aLength, nMemoryAllocator * aMemoryAllocator, 21 | FunctionContext * aFunctionContext ); 22 | 23 | public: 24 | static const DLFucntionArgInfo ARGS[]; 25 | static const DLFucntionArgInfo VAR_ARGS; 26 | static const DLFunctionInfo DLF_INFO; 27 | 28 | private: 29 | static void InitTable(); 30 | 31 | private: 32 | static ExtICoreRO * vBase; 33 | }; 34 | 35 | } 36 | 37 | #endif /** __StringToNumber_hpp__ */ 38 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/Time.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __Time_hpp__ 2 | #define __Time_hpp__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "InternalFunction.hpp" 9 | 10 | namespace InternalFunctions 11 | { 12 | class Time 13 | { 14 | public: 15 | static void Init( ExtICoreRO & aBase ) 16 | { vBase = &aBase; } 17 | 18 | static InfEngineErrors Apply( const char ** aArgs, const char *& aResult, unsigned int & aLength, 19 | nMemoryAllocator * aMemoryAllocator, FunctionContext * aFunctionContext ); 20 | 21 | public: 22 | static const DLFucntionArgInfo ARGS[]; 23 | static const DLFucntionArgInfo VAR_ARGS; 24 | static const DLFunctionInfo DLF_INFO; 25 | 26 | private: 27 | static ExtICoreRO * vBase; 28 | }; 29 | } 30 | 31 | #endif /** __Time_hpp__ */ 32 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/True.cpp: -------------------------------------------------------------------------------- 1 | #include "True.hpp" 2 | #include "InfEngine2/_Include/Errors.h" 3 | 4 | using namespace InternalFunctions; 5 | 6 | const DLFucntionArgInfo True::ARGS[] = { 7 | { DLFAT_EXTENDED, 0 } 8 | }; 9 | 10 | const DLFunctionInfo True::DLF_INFO = { 11 | "True", 12 | "", 13 | "Returns True.", 14 | DLFRT_BOOL, 15 | 0, 16 | nullptr, 17 | { 3, 0, 1 }, 18 | { 3, 0, 1 }, 19 | DLFO_CACHE, 20 | DLFunctionInterfaceVersion, 21 | 5, 22 | InfDataProtocolVersion, 23 | nullptr 24 | }; 25 | 26 | ExtICoreRO * True::vBase = nullptr; 27 | 28 | static const char gTRUE[] = "True"; 29 | static const unsigned int gTRUE_LEN = 4; 30 | 31 | static const char* gFALSE = ""; 32 | static const unsigned int gFALSE_LEN = 0; 33 | 34 | 35 | InfEngineErrors True::Apply( const char ** aArgs, 36 | const char *& aResult, 37 | unsigned int & aLength, 38 | nMemoryAllocator * /*aMemoryAllocaor*/, 39 | FunctionContext * aSession ) 40 | { 41 | aResult = gTRUE; 42 | aLength = gTRUE_LEN; 43 | 44 | return INF_ENGINE_SUCCESS; 45 | } 46 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/True.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __True_hpp__ 2 | #define __True_hpp__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace InternalFunctions 9 | { 10 | 11 | class True 12 | { 13 | public: 14 | static void Init( ExtICoreRO & aBase ) 15 | { vBase = &aBase; } 16 | 17 | static InfEngineErrors Apply( const char ** aArgs, 18 | const char *& aResult, 19 | unsigned int & aLength, 20 | nMemoryAllocator * aMemoryAllocaor, 21 | FunctionContext* aFunctionContext ); 22 | 23 | public: 24 | 25 | static const DLFucntionArgInfo ARGS[]; 26 | 27 | static const DLFucntionArgInfo VAR_ARGS; 28 | 29 | static const DLFunctionInfo DLF_INFO; 30 | 31 | private: 32 | static ExtICoreRO * vBase; 33 | }; 34 | 35 | } 36 | 37 | #endif /** __True_hpp__ */ 38 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/length.cpp: -------------------------------------------------------------------------------- 1 | #include "length.hpp" 2 | 3 | #include 4 | 5 | namespace InternalFunctions { 6 | const DLFucntionArgInfo Length::ARGS[] = { 7 | { DLFAT_EXTENDED, nullptr, DLFAA_NONE } 8 | }; 9 | 10 | const DLFunctionInfo Length::DLF_INFO = { 11 | "Length", 12 | "len", 13 | "Get length of first element.", 14 | DLFRT_TEXT, 15 | 1, 16 | Length::ARGS, 17 | { 0, 0, 0 }, 18 | { 0, 0, 0 }, 19 | DLFO_CACHE, 20 | DLFunctionInterfaceVersion, 21 | 5, 22 | InfDataProtocolVersion, 23 | nullptr 24 | }; 25 | 26 | InfEngineErrors Length::Apply( const char ** aArgs, const char* & aResult, unsigned int & aLength, nMemoryAllocator * aMemoryAllocator, 27 | FunctionContext * /*aFunctionContext*/ ) { 28 | if( !aArgs[0] ) 29 | return INF_ENGINE_ERROR_ARGC; 30 | 31 | std::uint32_t length{ 0 }; 32 | std::int32_t offset{ 0 }; 33 | while( static_cast( offset ) < std::strlen( aArgs[0] ) ) { 34 | if( length == std::numeric_limits::max() ) 35 | return INF_ENGINE_ERROR_OUT_OF_RANGE; 36 | 37 | length++; 38 | 39 | UChar32 ch; 40 | U8_NEXT_UNSAFE( aArgs[0], offset, ch ); 41 | } 42 | 43 | auto buffer = new (*aMemoryAllocator) char[std::numeric_limits::digits10+1]; 44 | aLength = sprintf( buffer, "%u", length ); 45 | buffer[aLength] = '\0'; 46 | aResult = buffer; 47 | 48 | return INF_ENGINE_SUCCESS; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfFunctions/InternalFunctions/length.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INF_ENGINE_FUNCTION_LENGTH_HPP 2 | #define INF_ENGINE_FUNCTION_LENGTH_HPP 3 | 4 | #include 5 | 6 | namespace InternalFunctions { 7 | class Length { 8 | public: 9 | static InfEngineErrors Apply( const char ** aArgs, const char* & aResult, unsigned int & aLength, nMemoryAllocator * aMemoryAllocator, 10 | FunctionContext * aFunctionContext ); 11 | 12 | public: 13 | static const DLFucntionArgInfo ARGS[]; 14 | static const DLFunctionInfo DLF_INFO; 15 | }; 16 | } 17 | 18 | #endif // INF_ENGINE_FUNCTION_LENGTH_HPP 19 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfOutput.h: -------------------------------------------------------------------------------- 1 | #ifndef __InfOutput_h__ 2 | #define __InfOutput_h__ 3 | 4 | typedef enum{ OutputFull = 4, OutputHigh = 3, OutputNormal = 2, OutputLow = 1, OutputNone = 0 } OutputModes; 5 | 6 | #endif // __InfOutput_h__ 7 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfPattern/Dict.cpp: -------------------------------------------------------------------------------- 1 | #include "Dict.hpp" 2 | 3 | InfPatternDict::InfPatternDict() 4 | { 5 | vID = 0; 6 | vName = nullptr; 7 | vHasEmptyString = false; 8 | vInlineDict = false; 9 | vStringsNumber = 0; 10 | vNeedMemorySize = 0; 11 | } 12 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfPattern/Dict.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __Dict_hpp__ 2 | #define __Dict_hpp__ 3 | 4 | #include 5 | 6 | /** 7 | * Представление словаря. 8 | */ 9 | class InfPatternDict 10 | { 11 | private: 12 | InfPatternDict(); 13 | 14 | 15 | public: 16 | // Вычисление объема памяти, необходимого для сохранения словаря. 17 | unsigned int GetNeedMemorySize(); 18 | 19 | // Сохранение словаря. 20 | InfEngineErrors Save( char* aBuffer, unsigned int aBufferSize, unsigned int& aResultSize ); 21 | 22 | 23 | private: 24 | // Идентификатор словаря. 25 | unsigned int vID; 26 | 27 | // Имя словаря. 28 | const char * vName; 29 | 30 | /** 31 | * Флаг, показывающий есть ли в словаре пустая строка. Такая строка не 32 | * отображена в списке строк словаря. 33 | */ 34 | bool vHasEmptyString; 35 | 36 | // Флаг, показывающий является ли данный словарь inline-словарем. 37 | bool vInlineDict; 38 | 39 | // Количество строк в словаре. 40 | unsigned int vStringsNumber; 41 | 42 | // Размер памяти, необходимой для сохранения словаря. 43 | unsigned int vNeedMemorySize; 44 | }; 45 | 46 | #endif /** __Dict_hpp__ */ 47 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfPattern/Items.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __InfPatternItems_hpp__ 2 | #define __InfPatternItems_hpp__ 3 | 4 | #include "Items/Text.hpp" 5 | #include "Items/TagDictInline.hpp" 6 | #include "Items/Br.hpp" 7 | #include "Items/TagInf.hpp" 8 | #include "Items/TagHref.hpp" 9 | #include "Items/TagDict.hpp" 10 | #include "Items/TagInstruct.hpp" 11 | #include "Items/TagVar.hpp" 12 | #include "Items/Star.hpp" 13 | #include "Items/EliStar.hpp" 14 | #include "Items/TagIf.hpp" 15 | #include "Items/TagSwitch.hpp" 16 | #include "Items/TagOpenWindow.hpp" 17 | #include "Items/Reference.hpp" 18 | #include "Items/EliReference.hpp" 19 | #include "Items/TagGetAnswer.hpp" 20 | #include "Items/TagFunction.hpp" 21 | #include "Items/TagRSS.hpp" 22 | #include "Items/Space.hpp" 23 | #include "Items/KeywordArgument.hpp" 24 | #include "Items/TagBreak.hpp" 25 | #include "Items/DictRef.hpp" 26 | #include "Items/TLCS.hpp" 27 | #include "Items/Nothing.hpp" 28 | #include "Items/Disableautovars.hpp" 29 | #include "Items/Lists.hpp" 30 | 31 | #endif /** __InfPatternItems_hpp__ */ 32 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfPattern/Items/Br.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __InfPatternItemsBr_hpp__ 2 | #define __InfPatternItemsBr_hpp__ 3 | 4 | #include "Base.hpp" 5 | 6 | namespace InfPatternItems 7 | { 8 | /** 9 | * Представление тэга переноса строки. 10 | */ 11 | class Br : public Base 12 | { 13 | public: 14 | /** Конструктор. */ 15 | Br( ) 16 | { vType = itBr; } 17 | 18 | public: 19 | unsigned int GetNeedMemorySize( ) const 20 | { return 0; } 21 | 22 | unsigned int Save( void * aBuffer ) const 23 | { return 0; } 24 | }; 25 | } 26 | 27 | #endif /** __InfPatternItemsBr_hpp__ */ 28 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfPattern/Items/Disableautovars.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __Disableautovars_hpp__ 2 | #define __Disableautovars_hpp__ 3 | 4 | #include "Base.hpp" 5 | 6 | namespace InfPatternItems 7 | { 8 | /** 9 | * Представление тэга отключения автоматического изменения переменных. 10 | */ 11 | class Disableautovars : public Base 12 | { 13 | public: 14 | /** Конструктор. */ 15 | Disableautovars( ) 16 | { vType = itDisableautovars; } 17 | 18 | public: 19 | unsigned int GetNeedMemorySize( ) const 20 | { return 0; } 21 | 22 | unsigned int Save( void * aBuffer ) const 23 | { return 0; } 24 | }; 25 | } 26 | 27 | 28 | #endif /** __Disabelautovars_hpp__ */ 29 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfPattern/Items/Empty.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INFPATTERN_ITEMS_EMPTY_HPP 2 | #define INFPATTERN_ITEMS_EMPTY_HPP 3 | 4 | #include "Base.hpp" 5 | 6 | namespace InfPatternItems 7 | { 8 | template 9 | class Empty : public Base 10 | { 11 | public: 12 | /** 13 | * Конструктор элемента DL без дополнительных данных. 14 | * @param aPos - позиция элемента в строке. 15 | */ 16 | Empty( size_t aPos ) : Base( T, aPos ) {} 17 | 18 | public: 19 | unsigned int GetNeedMemorySize() const { return 0; } 20 | 21 | unsigned int Save( void * aBuffer ) const { return 0; } 22 | }; 23 | } 24 | 25 | #endif // INFPATTERN_ITEMS_EMPTY_HPP 26 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfPattern/Items/Lists.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INFPATTERN_LIST_HPP 2 | #define INFPATTERN_LIST_HPP 3 | 4 | #include "Empty.hpp" 5 | 6 | namespace InfPatternItems 7 | { 8 | /** 9 | * Представление элемента языка DL: начало списка. 10 | */ 11 | using StartUList = Empty; 12 | using StartOList = Empty; 13 | 14 | /** 15 | * Представление элемента языка DL: элемент списка. 16 | */ 17 | using ListItem = Empty; 18 | 19 | /** 20 | * Представление элемента языка DL: конец списка. 21 | */ 22 | using EndList = Empty; 23 | } 24 | 25 | #endif // INFPATTERN_LIST_HPP 26 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfPattern/Items/Nothing.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __Nothing_hpp__ 2 | #define __Nothing_hpp__ 3 | 4 | #include "Base.hpp" 5 | 6 | namespace InfPatternItems 7 | { 8 | /** 9 | * Представление тэга nothing. 10 | */ 11 | class Nothing : public Base 12 | { 13 | public: 14 | Nothing( bool aSkipAuto = false ) { vType = itNothing; } 15 | 16 | public: 17 | unsigned int GetNeedMemorySize( ) const 18 | { return sizeof( uint32_t ); } 19 | 20 | unsigned int Save( void * /*aBuffer*/ ) const 21 | { return 0; } 22 | }; 23 | } 24 | 25 | #endif /** __Nothing_hpp__ */ 26 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfPattern/Items/Space.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __InfPatternItemsSpace_hpp__ 2 | #define __InfPatternItemsSpace_hpp__ 3 | 4 | #include 5 | 6 | namespace InfPatternItems 7 | { 8 | /** 9 | * Представление пробельного элемента. 10 | */ 11 | class Space : public Text 12 | { 13 | public: 14 | /** 15 | * Конструктор. 16 | * @param aBuffer - буфер с сохраненными пробеольными символами. 17 | */ 18 | Space( const void * aBuffer = nullptr ): Text( aBuffer ) {} 19 | }; 20 | }; 21 | 22 | #endif /** __InfPatternItemsSpace_hpp__ */ 23 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfPattern/Items/TagBreak.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __InfPatternItemsTagBreak_hpp__ 2 | #define __InfPatternItemsTagBreak_hpp__ 3 | 4 | #include "Base.hpp" 5 | 6 | namespace InfPatternItems 7 | { 8 | /** 9 | * Представление тэга отбрасывания ответа. 10 | */ 11 | class TagBreak: public Base 12 | { 13 | public: 14 | TagBreak() 15 | { Init(); } 16 | 17 | public: 18 | /** Инициализация. */ 19 | void Init() 20 | { vType = itBreak; } 21 | 22 | public: 23 | unsigned int GetNeedMemorySize() const 24 | { return 0; } 25 | 26 | unsigned int Save( void * aBuffer ) const 27 | { return 0; } 28 | }; 29 | 30 | /** 31 | * Манипулятор тэга отбрасывания ответа. 32 | */ 33 | class TagBreakManipulator 34 | { 35 | public: 36 | TagBreakManipulator( const void * aBuffer = nullptr ): 37 | vBuffer( static_cast( aBuffer ) ) {} 38 | 39 | public: 40 | /** Инициализация. */ 41 | void Init( const void * aBuffer ) 42 | { vBuffer = static_cast( aBuffer ); } 43 | 44 | private: 45 | /** Данные элемента. */ 46 | const char * vBuffer = nullptr; 47 | }; 48 | } 49 | 50 | #endif /** __InfPatternItemsTagBreak_hpp__ */ 51 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/InfPattern/Items/TagPre.cpp: -------------------------------------------------------------------------------- 1 | #include "TagPre.hpp" 2 | 3 | #include 4 | 5 | using namespace InfPatternItems; 6 | 7 | unsigned int TagPre::GetNeedMemorySize( ) const 8 | { 9 | unsigned int NeedMemorySize = sizeof(uint32_t) + vTextLen + 1; // Длина текста + сам текст + терминатор. 10 | 11 | // binary_data_alignment( NeedMemorySize ); 12 | return NeedMemorySize; 13 | } 14 | 15 | unsigned int TagPre::Save( void * aBuffer ) const 16 | { 17 | char * ptr = static_cast(aBuffer); 18 | 19 | // Сохранение длины текста. 20 | *reinterpret_cast(ptr) = vTextLen; 21 | ptr += sizeof(uint32_t); 22 | 23 | // Сохранение текста. 24 | memcpy( ptr, vText, vTextLen ); 25 | ptr += vTextLen; 26 | 27 | // Сохранение терминатора. 28 | *reinterpret_cast(ptr) = 0; 29 | ptr += sizeof(char); 30 | 31 | return static_cast( ptr ) - static_cast( aBuffer ); 32 | } 33 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/NDocImage.cpp: -------------------------------------------------------------------------------- 1 | #include "NDocImage.hpp" 2 | #include "InfEngine2/_Include/Errors.h" 3 | 4 | InfEngineErrors NDocImage::Init( const TermsDocImageIterator & aIterator ) 5 | { 6 | TermsDocImageIterator head( aIterator ); 7 | TermsDocImageIterator end( aIterator ); 8 | unsigned int size = 0; 9 | 10 | while( !head.IsHead() ) 11 | { 12 | --head; 13 | ++size; 14 | } 15 | while( !end.IsEnd() ) 16 | { 17 | ++end; 18 | ++size; 19 | } 20 | ++size; 21 | 22 | vImage.resize( size ); 23 | if( vImage.no_memory() ) 24 | return INF_ENGINE_ERROR_NOFREE_MEMORY; 25 | 26 | for( unsigned int pos = 0; pos < vImage.size(); ++pos ) 27 | { 28 | vImage[pos] = Iterator( head, pos ); 29 | ++head; 30 | } 31 | 32 | return INF_ENGINE_SUCCESS; 33 | } -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/Signature/Function.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __Signature_Function_hpp__ 2 | #define __Signature_Function_hpp__ 3 | 4 | #include "Signature.hpp" 5 | #include 6 | 7 | /** Структура с информацией о DL-функции. */ 8 | class Function: public Signature::Block 9 | { 10 | public: 11 | /** 12 | * Конструктор. 13 | * @param aFucntion - описание DL-функции. 14 | */ 15 | Function( const DLFunctionInfo * aFucntion ): 16 | vFucntion( aFucntion ) { } 17 | 18 | 19 | /** 20 | * Возвращает размер непрерывного участка памяти в байтах, необходимый для сохранения объекта. 21 | */ 22 | unsigned int GetNeedMemorySize() const; 23 | 24 | /** 25 | * Сохраняет объект в заданном непрерывном участке памяти. 26 | * @param aBuffer - указатель участок памяти. 27 | * @param aSize - размер участка памяти в байтах. 28 | * @param aUsed - размер фактически использованного участка памяти в байтах. 29 | */ 30 | InfEngineErrors Save( char * aBuffer, unsigned int aSize, unsigned int & aUsed ) const; 31 | 32 | protected: 33 | /** Описание DL-функции. */ 34 | const DLFunctionInfo * vFucntion; 35 | }; 36 | 37 | #endif // __Signature_Function_hpp__ 38 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/Symbolyms/SymbolymCommon.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SYMBOLYM_COMMON_HPP 2 | #define SYMBOLYM_COMMON_HPP 3 | 4 | namespace SymbolymCommon { 5 | struct Symbolym { 6 | const char * vMajor; 7 | const char ** vMinors; 8 | unsigned int vMinorsCount; 9 | }; 10 | } 11 | 12 | #endif //SYMBOLYM_COMMON_HPP 13 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/Symbolyms/SymbolymTables.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SYMBOLYM_TABLES_HPP 2 | #define SYMBOLYM_TABLES_HPP 3 | 4 | #include "../Synonyms/SynonymParser.hpp" 5 | 6 | class SymbolymTables { 7 | public: 8 | /** Возвращает количество прекомпилированных таблиц замены символов. */ 9 | unsigned int GetTablesCount(); 10 | 11 | /** Возвращает количество парвил замены в заданной таблице. */ 12 | unsigned int GetTableSize( unsigned int aTableN ); 13 | 14 | /** 15 | * Возвращает заданное правило замены из заданной таблицы. 16 | * @param aTableN - номер таблицы. 17 | * @param aGroupN - номер правила замены. 18 | * @param aGroup - в этом аргументе возвращается результат. 19 | */ 20 | InfEngineErrors GetSymbolymGroup( unsigned int aTableN, unsigned int aGroupN, SynonymParser::SynonymGroup & aGroup ); 21 | 22 | protected: 23 | // Менеджер памяти. 24 | nMemoryAllocator vMemoryAllocator; 25 | }; 26 | 27 | #endif //SYMBOLYM_TABLES_HPP 28 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/Symbolyms/tables/kyrgyz.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SYMBOLYM_TABLE_KYRGYZ_HPP 2 | #define SYMBOLYM_TABLE_KYRGYZ_HPP 3 | 4 | #include "../SymbolymCommon.hpp" 5 | 6 | namespace SymbolymCommon { 7 | namespace Tables { 8 | namespace Kyrgyz { 9 | static const char * group1[] = { "Ң", "ң" }; // => н 10 | static const char * group2[] = { "Ө", "ө" }; // => о 11 | static const char * group3[] = { "Ү", "ү" }; // => у 12 | 13 | static const Symbolym table[] = { 14 | { "н", group1, sizeof( group1 ) / sizeof( group1[0] ) }, 15 | { "о", group2, sizeof( group2 ) / sizeof( group2[0] ) }, 16 | { "у", group3, sizeof( group3 ) / sizeof( group3[0] ) }, 17 | }; 18 | 19 | unsigned int table_size = sizeof( table ) / sizeof( Symbolym ); 20 | } 21 | } 22 | } 23 | 24 | #endif //SYMBOLYM_TABLE_KYRGYZ_HPP 25 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/Symbolyms/tables/ukraine.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SYMBOLYM_TABLE_UKRAINIAN_HPP 2 | #define SYMBOLYM_TABLE_UKRAINIAN_HPP 3 | 4 | #include "../SymbolymCommon.hpp" 5 | 6 | namespace SymbolymCommon { 7 | namespace Tables { 8 | namespace Ukraine { 9 | static const char * group1[] = { "Ї", "ї", "І", "і" }; // => i 10 | static const char * group2[] = { "Ґ", "ґ" }; // => г 11 | static const char * group3[] = { "Є", "є" }; // => э 12 | 13 | static const Symbolym table[] = { 14 | { "i", group1, sizeof( group1 ) / sizeof( group1[0] ) }, 15 | { "г", group2, sizeof( group2 ) / sizeof( group2[0] ) }, 16 | { "э", group3, sizeof( group3 ) / sizeof( group3[0] ) }, 17 | }; 18 | 19 | unsigned int table_size = sizeof( table ) / sizeof( Symbolym ); 20 | } 21 | } 22 | } 23 | 24 | #endif //SYMBOLYM_TABLE_UKRAINIAN_HPP 25 | -------------------------------------------------------------------------------- /src/InfEngine2/InfEngine/Synonyms/SynonymMatcher.cpp: -------------------------------------------------------------------------------- 1 | #include "SynonymMatcher.hpp" 2 | #include "InfEngine2/_Include/Errors.h" 3 | 4 | enum FltTermsErrors SynonymMatcher::AddFound(const TERM* aTerm, const TermsDocImageIterator& aLastPos, 5 | TDATA_FLAGS_TYPE /*aWhere*/, bool /*aIsHomo*/) 6 | { 7 | // Получение аттрибутов. 8 | const cf_term_attrs * attrs = term_attrs(aTerm); 9 | if (!attrs) 10 | ReturnWithError( TERMS_ERROR_EFAULT, "Can't get synonym's attrs"); 11 | 12 | static TermsDocImageIterator PrevPos; 13 | 14 | if( vLastAddedTerm ) 15 | { 16 | if( term_id( vLastAddedTerm ) == term_id( aTerm ) && PrevPos == aLastPos ) 17 | return TERMS_OK; 18 | } 19 | PrevPos = aLastPos; 20 | vLastAddedTerm = aTerm; 21 | 22 | 23 | // Добавление атрибутов в список найденных. 24 | SynonymAttrsRO * synonym_attrs = vSynonyms.grow(); 25 | if (!synonym_attrs) 26 | return TERMS_ERROR_ENOMEM; 27 | 28 | synonym_attrs->SetBuffer(attrs); 29 | 30 | // Добавление позиций в список найденных. 31 | vPositions.push_back(aLastPos.GetWordPos()); 32 | if (vPositions.no_memory()) 33 | return TERMS_ERROR_ENOMEM; 34 | 35 | return TERMS_OK; 36 | } 37 | -------------------------------------------------------------------------------- /src/InfServer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.7 ) 2 | 3 | project( InfServer ) 4 | 5 | add_executable( ${PROJECT_NAME} 6 | InfEngineServer.hpp 7 | InfEngineServer.cpp 8 | MainServer.cpp ) 9 | 10 | target_link_libraries( ${PROJECT_NAME} PRIVATE InfEngine terms ClientLib ${CMAKE_DL_LIBS} ) 11 | -------------------------------------------------------------------------------- /src/NanoLib/Encoding.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ENCODING_HPP 2 | #define ENCODING_HPP 3 | 4 | #include <_include/CodePages.h> 5 | 6 | #include "aTextString.hpp" 7 | 8 | #include 9 | 10 | namespace NanoLib 11 | { 12 | enum class Encoding 13 | { 14 | UTF8, 15 | CP1251 16 | }; 17 | 18 | inline nlReturnCode ConvertEncoding( aTextString & astring, Encoding afrom, Encoding ato ) 19 | { 20 | if( afrom == ato ) 21 | return nlrcSuccess; 22 | else if( afrom == Encoding::CP1251 && ato == Encoding::UTF8 ) 23 | { 24 | // Выделение памяти для ковертации строки из cp1251 в utf8. 25 | unsigned int size = astring.size(); 26 | if( astring.resize( astring.size() * 6 + 1 ) != nlrcSuccess ) 27 | ReturnWithError( nlrcErrorNoFreeMemory, nlReturnCodeToString( nlrcErrorNoFreeMemory ) ); 28 | bzero( astring.str() + size, astring.size() - size ); 29 | 30 | // Преобразование из CP1251 в UTF-8. 31 | if( Convert2UTF_Ex( reinterpret_cast( astring.str() ), astring.size(), size, CP_CYRILLIC ) != (int)size ) 32 | ReturnWithWarn( nlrcErrorInvArgs, "Can't convert string From CP1251 to UTF-8: %s", astring.c_str() ); 33 | 34 | // Вычисление длины получившейся строки. 35 | astring.resize( std::strlen( astring.c_str() ) ); 36 | 37 | return nlrcSuccess; 38 | } else 39 | ReturnWithError( nlrcErrorInvArgs, INF_ENGINE_STRING_ERROR_INVALID_ARGUMENTS ); 40 | } 41 | } 42 | 43 | #endif // ENCODING_HPP 44 | 45 | -------------------------------------------------------------------------------- /src/NanoLib/KeyboardNumberParser.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __KeyboardNumberParser_hpp__ 2 | #define __KeyboardNumberParser_hpp__ 3 | 4 | #include "NumberParser.hpp" 5 | #include "LongFloat.hpp" 6 | 7 | class KeyboardNumberParser: public NumberParser::CommonParser 8 | { 9 | public: 10 | nlReturnCode Parse( LongFloat & aResult, const char * aStr, unsigned int aStrLen = 0 ); 11 | }; 12 | 13 | 14 | 15 | #endif // __KeyboardNumberParser_hpp__ -------------------------------------------------------------------------------- /src/NanoLib/NanoLib.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __NanoLib_hpp__ 2 | #define __NanoLib_hpp__ 3 | 4 | /** 5 | * Пространство имен библиотеки NanoLib. 6 | */ 7 | namespace NanoLib 8 | { 9 | 10 | } 11 | 12 | #endif /** __NanoLib_hpp__ */ 13 | -------------------------------------------------------------------------------- /src/NanoLib/VoiceNumberParser.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __VoiceNumberParser_hpp__ 2 | #define __VoiceNumberParser_hpp__ 3 | 4 | #include "NumberParser.hpp" 5 | #include "LongFloat.hpp" 6 | 7 | class VoiceNumberParser: public NumberParser::CommonParser 8 | { 9 | public: 10 | nlReturnCode Parse( LongFloat & aResult, const char * aStr, unsigned int aStrLen = 0 ); 11 | }; 12 | 13 | 14 | 15 | #endif // __VoiceNumberParser_hpp__ -------------------------------------------------------------------------------- /src/NanoLib/nMemoryAllocator.h: -------------------------------------------------------------------------------- 1 | #ifndef __nMemoryAllocator_h__ 2 | #define __nMemoryAllocator_h__ 3 | 4 | #ifdef __cplusplus 5 | extern "C" 6 | { 7 | #endif 8 | 9 | /** Определение структуры, которая будет исполнять роль аллокатора. */ 10 | typedef struct __ncMemoryAllocator ncMemoryAllocator; 11 | 12 | /** Создание нового аллокатора. */ 13 | ncMemoryAllocator* ncMemoryAllocatorCreate(); 14 | 15 | /** 16 | * Удаление существующего аллокатора. 17 | * @param aMemoryAllocator - существующий аллокатор. 18 | */ 19 | void ncMemoryAllocatorDestroy( ncMemoryAllocator* aMemoryAllocator ); 20 | 21 | /** 22 | * Выделение памяти с помощью аллокатора. 23 | * @param aMemoryAllocator - существующий аллокатор. 24 | * @param aTargetMemorySize - необходимый размер памяти. 25 | */ 26 | void* AllocatorAllocate( ncMemoryAllocator* aAllocator, size_t aTargetMemorySize ); 27 | 28 | /** 29 | * Очистка памяти, выделенной аллокатором. 30 | * @param aMemoryAllocator - существующий аллокатор. 31 | */ 32 | void ncMemoryAllocatorReset( ncMemoryAllocator* aMemoryAllocator ); 33 | 34 | /** 35 | * Освобождение памяти, выделенной аллокатором. 36 | * @param aMemoryAllocator - существующий аллокатор. 37 | */ 38 | void ncMemoryAllocatorFree( ncMemoryAllocator* aMemoryAllocator ); 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif /** __nMemoryAllocator_h__ */ 45 | -------------------------------------------------------------------------------- /src/Utils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.0 ) 2 | 3 | add_subdirectory( FuncMon ) 4 | add_subdirectory( Signature ) 5 | -------------------------------------------------------------------------------- /src/Utils/FuncMon/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.7 ) 2 | 3 | if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.12 ) 4 | cmake_policy( SET CMP0074 NEW ) 5 | endif( ${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.12 ) 6 | find_package( ICU COMPONENTS UC DATA REQUIRED ) 7 | 8 | project( FuncMon ) 9 | 10 | add_executable( ${PROJECT_NAME} FuncMon.cpp ) 11 | 12 | target_link_libraries( ${PROJECT_NAME} PRIVATE InfEngine ${ICU_UC_LIBRARIES} ${CMAKE_DL_LIBS} ) 13 | -------------------------------------------------------------------------------- /src/Utils/Signature/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.0 ) 2 | 3 | project( CheckSignature ) 4 | 5 | add_executable( ${PROJECT_NAME} CheckSignature.cpp ) 6 | 7 | target_link_libraries( ${PROJECT_NAME} PRIVATE InfEngine terms ${CMAKE_DL_LIBS} ) 8 | 9 | target_compile_definitions( ${PROJECT_NAME} PRIVATE 10 | -DPTS2_CROSS_HASHTABLE_SIZE=64 11 | -DPTS2_CROSS_HASHTABLE_INC=32 12 | -DUSE_INF_TERMS 13 | -DCSDATA_EXTENDED 14 | -D_STL=std 15 | ) 16 | -------------------------------------------------------------------------------- /src/ap-process-server/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.0 ) 2 | 3 | project( ap-process-server ) 4 | 5 | add_executable( ${PROJECT_NAME} ap-process-server.c ) 6 | 7 | target_link_libraries( ${PROJECT_NAME} PRIVATE apcs ) 8 | 9 | target_compile_definitions( ${PROJECT_NAME} PRIVATE 10 | -DDEFAULT_CONFIGFILE=\"/usr/local/InfEngine/conf/ap-process-server.conf\" 11 | -DDEFAULT_FILTER_PATH=\"/usr/local/InfEngine/bin/InfServer\" 12 | -DUSE_INF_TERMS 13 | -DCSDATA_EXTENDED 14 | ) 15 | -------------------------------------------------------------------------------- /src/lib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory( functions ) -------------------------------------------------------------------------------- /src/lib/functions/Common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 2.6 ) 2 | 3 | add_external_function( Common AllTrim AllTrim.cpp MemoryAllocator "" ) 4 | add_external_function( Common And And.cpp MemoryAllocator "" ) 5 | add_external_function( Common Concatenate Concatenate.cpp MemoryAllocator "" ) 6 | add_external_function( Common IsNum IsNum.cpp MemoryAllocator "" ) 7 | add_external_function( Common Not Not.cpp MemoryAllocator "" ) 8 | add_external_function( Common Or Or.cpp MemoryAllocator "" ) 9 | add_external_function( Common ProperName ProperName.cpp MemoryAllocator "" ) 10 | add_external_function( Common Replace Replace.cpp MemoryAllocator "" ) 11 | add_external_function( Common Shuffle Shuffle.cpp MemoryAllocator "" ) 12 | add_external_function( Common ToLower ToLower.cpp MemoryAllocator "" ) 13 | add_external_function( Common ToUpper ToUpper.cpp MemoryAllocator "" ) 14 | 15 | set( DL_FUNCTIONS ${DL_FUNCTIONS} PARENT_SCOPE ) 16 | -------------------------------------------------------------------------------- /src/lib/functions/Dates/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 2.6 ) 2 | 3 | add_external_function( Dates DateDist DateDist.cpp MemoryAllocator "" ) 4 | add_external_function( Dates DateGreater DateGreater.cpp MemoryAllocator "" ) 5 | add_external_function( Dates DateLess DateLess.cpp MemoryAllocator "" ) 6 | add_external_function( Dates Extract Extract.cpp MemoryAllocator "" ) 7 | add_external_function( Dates TimeGreater TimeGreater.cpp MemoryAllocator "" ) 8 | add_external_function( Dates TimeLess TimeLess.cpp MemoryAllocator "" ) 9 | 10 | set( DL_FUNCTIONS ${DL_FUNCTIONS} PARENT_SCOPE ) 11 | -------------------------------------------------------------------------------- /src/lib/functions/Math/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_external_function( Math BigGreater BigGreater.cpp MemoryAllocator "" ) 2 | add_external_function( Math BigLess BigLess.cpp MemoryAllocator "" ) 3 | add_external_function( Math Random Random.cpp MemoryAllocator "" ) 4 | 5 | add_external_function( Math Diff Diff.cpp "MemoryAllocator;NumberConvertor" Gmp ) 6 | add_external_function( Math Divide Divide.cpp "MemoryAllocator;NumberConvertor" Gmp ) 7 | add_external_function( Math Greater Greater.cpp "MemoryAllocator;NumberConvertor" Gmp ) 8 | add_external_function( Math Less Less.cpp "MemoryAllocator;NumberConvertor" Gmp ) 9 | add_external_function( Math Minus Minus.cpp "MemoryAllocator;NumberConvertor" Gmp ) 10 | add_external_function( Math Multiply Multiply.cpp "MemoryAllocator;NumberConvertor" Gmp ) 11 | add_external_function( Math Plus Plus.cpp "MemoryAllocator;NumberConvertor" Gmp ) 12 | add_external_function( Math Remainder Remainder.cpp "MemoryAllocator;NumberConvertor" Gmp ) 13 | 14 | set( DL_FUNCTIONS ${DL_FUNCTIONS} PARENT_SCOPE ) 15 | --------------------------------------------------------------------------------