@l1yp/file-viewer 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +134 -0
- package/dist/FileViewer.js +7 -0
- package/dist/FileViewer.vue.d.ts +37 -0
- package/dist/FileViewer.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/_virtual/_plugin-vue_export-helper.js +8 -0
- package/dist/components/AppxViewer.js +7 -0
- package/dist/components/AppxViewer.vue.d.ts +18 -0
- package/dist/components/AppxViewer.vue_vue_type_script_setup_true_lang.js +174 -0
- package/dist/components/ArchiveBrowser.js +7 -0
- package/dist/components/ArchiveBrowser.vue.d.ts +18 -0
- package/dist/components/ArchiveBrowser.vue_vue_type_script_setup_true_lang.js +279 -0
- package/dist/components/AudioViewer.js +7 -0
- package/dist/components/AudioViewer.vue.d.ts +21 -0
- package/dist/components/AudioViewer.vue_vue_type_script_setup_true_lang.js +201 -0
- package/dist/components/BinObjBrowser.js +7 -0
- package/dist/components/BinObjBrowser.vue.d.ts +19 -0
- package/dist/components/BinObjBrowser.vue_vue_type_script_setup_true_lang.js +141 -0
- package/dist/components/CertViewer.js +7 -0
- package/dist/components/CertViewer.vue.d.ts +17 -0
- package/dist/components/CertViewer.vue_vue_type_script_setup_true_lang.js +251 -0
- package/dist/components/ClassViewer.js +7 -0
- package/dist/components/ClassViewer.vue.d.ts +15 -0
- package/dist/components/ClassViewer.vue_vue_type_script_setup_true_lang.js +164 -0
- package/dist/components/CodeBlock.js +7 -0
- package/dist/components/CodeBlock.vue.d.ts +17 -0
- package/dist/components/CodeBlock.vue_vue_type_script_setup_true_lang.js +79 -0
- package/dist/components/CodeView.js +7 -0
- package/dist/components/CodeView.vue.d.ts +21 -0
- package/dist/components/CodeView.vue_vue_type_script_setup_true_lang.js +180 -0
- package/dist/components/CsvViewer.js +7 -0
- package/dist/components/CsvViewer.vue.d.ts +26 -0
- package/dist/components/CsvViewer.vue_vue_type_script_setup_true_lang.js +187 -0
- package/dist/components/DicomViewer.js +7 -0
- package/dist/components/DicomViewer.vue.d.ts +30 -0
- package/dist/components/DicomViewer.vue_vue_type_script_setup_true_lang.js +362 -0
- package/dist/components/DocxViewer.js +7 -0
- package/dist/components/DocxViewer.vue.d.ts +19 -0
- package/dist/components/DocxViewer.vue_vue_type_script_setup_true_lang.js +59 -0
- package/dist/components/DrawioViewer.js +7 -0
- package/dist/components/DrawioViewer.vue.d.ts +16 -0
- package/dist/components/DrawioViewer.vue_vue_type_script_setup_true_lang.js +38 -0
- package/dist/components/DxfViewer.js +7 -0
- package/dist/components/DxfViewer.vue.d.ts +14 -0
- package/dist/components/DxfViewer.vue_vue_type_script_setup_true_lang.js +239 -0
- package/dist/components/EbookViewer.js +7 -0
- package/dist/components/EbookViewer.vue.d.ts +22 -0
- package/dist/components/EbookViewer.vue_vue_type_script_setup_true_lang.js +170 -0
- package/dist/components/EmlViewer.js +7 -0
- package/dist/components/EmlViewer.vue.d.ts +21 -0
- package/dist/components/EmlViewer.vue_vue_type_script_setup_true_lang.js +193 -0
- package/dist/components/EplViewer.js +7 -0
- package/dist/components/EplViewer.vue.d.ts +19 -0
- package/dist/components/EplViewer.vue_vue_type_script_setup_true_lang.js +201 -0
- package/dist/components/FileViewerBody.js +7 -0
- package/dist/components/FileViewerBody.vue.d.ts +47 -0
- package/dist/components/FileViewerBody.vue_vue_type_script_setup_true_lang.js +599 -0
- package/dist/components/FileViewerPanel.js +7 -0
- package/dist/components/FileViewerPanel.vue.d.ts +3 -0
- package/dist/components/FileViewerPanel.vue_vue_type_script_setup_true_lang.js +207 -0
- package/dist/components/FontViewer.js +7 -0
- package/dist/components/FontViewer.vue.d.ts +17 -0
- package/dist/components/FontViewer.vue_vue_type_script_setup_true_lang.js +120 -0
- package/dist/components/FrontmatterCard.js +7 -0
- package/dist/components/FrontmatterCard.vue.d.ts +11 -0
- package/dist/components/FrontmatterCard.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/components/GeoViewer.js +7 -0
- package/dist/components/GeoViewer.vue.d.ts +17 -0
- package/dist/components/GeoViewer.vue_vue_type_script_setup_true_lang.js +255 -0
- package/dist/components/HarViewer.js +7 -0
- package/dist/components/HarViewer.vue.d.ts +20 -0
- package/dist/components/HarViewer.vue_vue_type_script_setup_true_lang.js +322 -0
- package/dist/components/HexViewer.js +7 -0
- package/dist/components/HexViewer.vue.d.ts +22 -0
- package/dist/components/HexViewer.vue_vue_type_script_setup_true_lang.js +121 -0
- package/dist/components/HprofViewer.js +7 -0
- package/dist/components/HprofViewer.vue.d.ts +27 -0
- package/dist/components/HprofViewer.vue_vue_type_script_setup_true_lang.js +561 -0
- package/dist/components/ImageLightbox.js +7 -0
- package/dist/components/ImageLightbox.vue.d.ts +3 -0
- package/dist/components/ImageLightbox.vue_vue_type_script_setup_true_lang.js +86 -0
- package/dist/components/InlineText.d.ts +29 -0
- package/dist/components/InlineText.js +21 -0
- package/dist/components/JksViewer.js +7 -0
- package/dist/components/JksViewer.vue.d.ts +22 -0
- package/dist/components/JksViewer.vue_vue_type_script_setup_true_lang.js +353 -0
- package/dist/components/JsonlViewer.js +7 -0
- package/dist/components/JsonlViewer.vue.d.ts +15 -0
- package/dist/components/JsonlViewer.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/components/LogViewer.js +7 -0
- package/dist/components/LogViewer.vue.d.ts +29 -0
- package/dist/components/LogViewer.vue_vue_type_script_setup_true_lang.js +670 -0
- package/dist/components/LrcViewer.js +7 -0
- package/dist/components/LrcViewer.vue.d.ts +17 -0
- package/dist/components/LrcViewer.vue_vue_type_script_setup_true_lang.js +106 -0
- package/dist/components/MarkdownTable.js +7 -0
- package/dist/components/MarkdownTable.vue.d.ts +19 -0
- package/dist/components/MarkdownTable.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/components/MarkdownText.d.ts +30 -0
- package/dist/components/MarkdownText.js +21 -0
- package/dist/components/MhtViewer.js +7 -0
- package/dist/components/MhtViewer.vue.d.ts +22 -0
- package/dist/components/MhtViewer.vue_vue_type_script_setup_true_lang.js +112 -0
- package/dist/components/MindMapView.js +7 -0
- package/dist/components/MindMapView.vue.d.ts +23 -0
- package/dist/components/MindMapView.vue_vue_type_script_setup_true_lang.js +337 -0
- package/dist/components/MissingDependency.js +7 -0
- package/dist/components/MissingDependency.vue.d.ts +17 -0
- package/dist/components/MissingDependency.vue_vue_type_script_setup_true_lang.js +37 -0
- package/dist/components/ModelViewer.js +7 -0
- package/dist/components/ModelViewer.vue.d.ts +18 -0
- package/dist/components/ModelViewer.vue_vue_type_script_setup_true_lang.js +157 -0
- package/dist/components/MsiViewer.js +7 -0
- package/dist/components/MsiViewer.vue.d.ts +19 -0
- package/dist/components/MsiViewer.vue_vue_type_script_setup_true_lang.js +136 -0
- package/dist/components/NotebookViewer.js +7 -0
- package/dist/components/NotebookViewer.vue.d.ts +20 -0
- package/dist/components/NotebookViewer.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/components/PdfViewer.js +7 -0
- package/dist/components/PdfViewer.vue.d.ts +19 -0
- package/dist/components/PdfViewer.vue_vue_type_script_setup_true_lang.js +114 -0
- package/dist/components/PptxViewer.js +7 -0
- package/dist/components/PptxViewer.vue.d.ts +20 -0
- package/dist/components/PptxViewer.vue_vue_type_script_setup_true_lang.js +73 -0
- package/dist/components/PsdViewer.js +7 -0
- package/dist/components/PsdViewer.vue.d.ts +15 -0
- package/dist/components/PsdViewer.vue_vue_type_script_setup_true_lang.js +218 -0
- package/dist/components/QmcAudioViewer.js +7 -0
- package/dist/components/QmcAudioViewer.vue.d.ts +18 -0
- package/dist/components/QmcAudioViewer.vue_vue_type_script_setup_true_lang.js +92 -0
- package/dist/components/RasterViewer.js +7 -0
- package/dist/components/RasterViewer.vue.d.ts +21 -0
- package/dist/components/RasterViewer.vue_vue_type_script_setup_true_lang.js +161 -0
- package/dist/components/RtfViewer.js +7 -0
- package/dist/components/RtfViewer.vue.d.ts +21 -0
- package/dist/components/RtfViewer.vue_vue_type_script_setup_true_lang.js +66 -0
- package/dist/components/SevenZipBrowser.js +7 -0
- package/dist/components/SevenZipBrowser.vue.d.ts +13 -0
- package/dist/components/SevenZipBrowser.vue_vue_type_script_setup_true_lang.js +366 -0
- package/dist/components/SqliteViewer.js +7 -0
- package/dist/components/SqliteViewer.vue.d.ts +18 -0
- package/dist/components/SqliteViewer.vue_vue_type_script_setup_true_lang.js +186 -0
- package/dist/components/SubtitleViewer.js +7 -0
- package/dist/components/SubtitleViewer.vue.d.ts +15 -0
- package/dist/components/SubtitleViewer.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/XlsxChart.js +7 -0
- package/dist/components/XlsxChart.vue.d.ts +14 -0
- package/dist/components/XlsxChart.vue_vue_type_script_setup_true_lang.js +240 -0
- package/dist/components/XlsxViewer.js +7 -0
- package/dist/components/XlsxViewer.vue.d.ts +22 -0
- package/dist/components/XlsxViewer.vue_vue_type_script_setup_true_lang.js +814 -0
- package/dist/components/XmindViewer.js +7 -0
- package/dist/components/XmindViewer.vue.d.ts +13 -0
- package/dist/components/XmindViewer.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/ZipBrowser.js +7 -0
- package/dist/components/ZipBrowser.vue.d.ts +14 -0
- package/dist/components/ZipBrowser.vue_vue_type_script_setup_true_lang.js +326 -0
- package/dist/components/ZoomImage.js +7 -0
- package/dist/components/ZoomImage.vue.d.ts +29 -0
- package/dist/components/ZoomImage.vue_vue_type_script_setup_true_lang.js +147 -0
- package/dist/components/epl/EplCodeBlock.js +7 -0
- package/dist/components/epl/EplCodeBlock.vue.d.ts +15 -0
- package/dist/components/epl/EplCodeBlock.vue_vue_type_script_setup_true_lang.js +72 -0
- package/dist/components/epl/EplDoc.js +7 -0
- package/dist/components/epl/EplDoc.vue.d.ts +19 -0
- package/dist/components/epl/EplDoc.vue_vue_type_script_setup_true_lang.js +327 -0
- package/dist/components/epl/EplMethod.js +7 -0
- package/dist/components/epl/EplMethod.vue.d.ts +14 -0
- package/dist/components/epl/EplMethod.vue_vue_type_script_setup_true_lang.js +100 -0
- package/dist/components/epl/EplResource.js +7 -0
- package/dist/components/epl/EplResource.vue.d.ts +15 -0
- package/dist/components/epl/EplResource.vue_vue_type_script_setup_true_lang.js +204 -0
- package/dist/components/epl/EplTree.js +7 -0
- package/dist/components/epl/EplTree.vue.d.ts +27 -0
- package/dist/components/epl/EplTree.vue_vue_type_script_setup_true_lang.js +123 -0
- package/dist/components/epl/EplVarTable.js +7 -0
- package/dist/components/epl/EplVarTable.vue.d.ts +21 -0
- package/dist/components/epl/EplVarTable.vue_vue_type_script_setup_true_lang.js +60 -0
- package/dist/components/epl/docTypes.d.ts +12 -0
- package/dist/components/epl/numbering.d.ts +21 -0
- package/dist/components/epl/numbering.js +14 -0
- package/dist/components/icons/Icon.js +7 -0
- package/dist/components/icons/Icon.vue.d.ts +14 -0
- package/dist/components/icons/Icon.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/components/icons/iconPaths.d.ts +60 -0
- package/dist/components/icons/iconPaths.js +54 -0
- package/dist/components/optionalViewer.d.ts +14 -0
- package/dist/components/optionalViewer.js +37 -0
- package/dist/components/ui/ClampBlock.d.ts +82 -0
- package/dist/components/ui/ClampBlock.js +63 -0
- package/dist/composables/useFileViewer.d.ts +428 -0
- package/dist/composables/useFileViewer.js +27 -0
- package/dist/composables/useLightbox.d.ts +33 -0
- package/dist/composables/useLightbox.js +17 -0
- package/dist/composables/useLogRules.d.ts +47 -0
- package/dist/composables/useLogRules.js +74 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +30 -0
- package/dist/lib/aes.d.ts +25 -0
- package/dist/lib/aes.js +99 -0
- package/dist/lib/appx.d.ts +66 -0
- package/dist/lib/appx.js +112 -0
- package/dist/lib/archive.d.ts +29 -0
- package/dist/lib/asn1.d.ts +47 -0
- package/dist/lib/asn1.js +122 -0
- package/dist/lib/binobj.d.ts +69 -0
- package/dist/lib/binobj.js +430 -0
- package/dist/lib/brotli.d.ts +14 -0
- package/dist/lib/brotli.js +16 -0
- package/dist/lib/bzip2.d.ts +14 -0
- package/dist/lib/bzip2.js +161 -0
- package/dist/lib/classfile.d.ts +72 -0
- package/dist/lib/classfile.js +210 -0
- package/dist/lib/codePreview.d.ts +22 -0
- package/dist/lib/codePreview.js +27 -0
- package/dist/lib/codefold.d.ts +14 -0
- package/dist/lib/codefold.js +30 -0
- package/dist/lib/codeformat.d.ts +21 -0
- package/dist/lib/codeformat.js +130 -0
- package/dist/lib/csv.d.ts +19 -0
- package/dist/lib/csv.js +74 -0
- package/dist/lib/des.d.ts +17 -0
- package/dist/lib/des.js +928 -0
- package/dist/lib/diagram.d.ts +5 -0
- package/dist/lib/diagram.js +479 -0
- package/dist/lib/dicom.d.ts +69 -0
- package/dist/lib/dicom.js +442 -0
- package/dist/lib/dicomCodecs.d.ts +28 -0
- package/dist/lib/dicomCodecs.js +156 -0
- package/dist/lib/dicomRender.d.ts +46 -0
- package/dist/lib/dicomRender.js +114 -0
- package/dist/lib/dxf.d.ts +86 -0
- package/dist/lib/dxf.js +399 -0
- package/dist/lib/eml.d.ts +40 -0
- package/dist/lib/eml.js +46 -0
- package/dist/lib/encoding.d.ts +28 -0
- package/dist/lib/encoding.js +44 -0
- package/dist/lib/epl/code/ast.d.ts +150 -0
- package/dist/lib/epl/code/codeDataParser.d.ts +3 -0
- package/dist/lib/epl/code/codeDataParser.js +330 -0
- package/dist/lib/epl/code/codeLines.d.ts +20 -0
- package/dist/lib/epl/code/codeLines.js +191 -0
- package/dist/lib/epl/code/structures.d.ts +86 -0
- package/dist/lib/epl/code/textCode.d.ts +29 -0
- package/dist/lib/epl/code/textCode.js +150 -0
- package/dist/lib/epl/code/variable.d.ts +25 -0
- package/dist/lib/epl/eplDocument.d.ts +21 -0
- package/dist/lib/epl/eplDocument.js +36 -0
- package/dist/lib/epl/imageList.d.ts +28 -0
- package/dist/lib/epl/imageList.js +66 -0
- package/dist/lib/epl/index.d.ts +53 -0
- package/dist/lib/epl/index.js +45 -0
- package/dist/lib/epl/io/binaryReader.d.ts +56 -0
- package/dist/lib/epl/io/binaryReader.js +119 -0
- package/dist/lib/epl/io/encoding.d.ts +16 -0
- package/dist/lib/epl/io/encoding.js +27 -0
- package/dist/lib/epl/model/eplSystemId.d.ts +64 -0
- package/dist/lib/epl/model/eplSystemId.js +16 -0
- package/dist/lib/epl/model/section.d.ts +46 -0
- package/dist/lib/epl/names/eplLibData.js +39 -0
- package/dist/lib/epl/names/idToNameMap.d.ts +33 -0
- package/dist/lib/epl/names/idToNameMap.js +130 -0
- package/dist/lib/epl/names/libNameProvider.d.ts +15 -0
- package/dist/lib/epl/names/libNameProvider.js +18 -0
- package/dist/lib/epl/program.d.ts +120 -0
- package/dist/lib/epl/program.js +134 -0
- package/dist/lib/epl/projectFileReader.d.ts +23 -0
- package/dist/lib/epl/projectFileReader.js +65 -0
- package/dist/lib/epl/sections/code.d.ts +20 -0
- package/dist/lib/epl/sections/esystemInfo.d.ts +14 -0
- package/dist/lib/epl/sections/losable.d.ts +11 -0
- package/dist/lib/epl/sections/projectConfig.d.ts +23 -0
- package/dist/lib/epl/sections/resource.d.ts +57 -0
- package/dist/lib/fb2.d.ts +14 -0
- package/dist/lib/fb2.js +62 -0
- package/dist/lib/fileType.d.ts +315 -0
- package/dist/lib/fileType.js +800 -0
- package/dist/lib/fonts.d.ts +8 -0
- package/dist/lib/fonts.js +4 -0
- package/dist/lib/format.d.ts +16 -0
- package/dist/lib/format.js +38 -0
- package/dist/lib/frontmatter.d.ts +13 -0
- package/dist/lib/frontmatter.js +23 -0
- package/dist/lib/geo.d.ts +30 -0
- package/dist/lib/geo.js +235 -0
- package/dist/lib/har.d.ts +171 -0
- package/dist/lib/har.js +397 -0
- package/dist/lib/highlight.d.ts +18 -0
- package/dist/lib/highlight.js +34 -0
- package/dist/lib/highlightLangs.d.ts +15 -0
- package/dist/lib/highlightLangs.js +93 -0
- package/dist/lib/hprof.d.ts +211 -0
- package/dist/lib/hprof.js +709 -0
- package/dist/lib/ipynb.d.ts +48 -0
- package/dist/lib/ipynb.js +130 -0
- package/dist/lib/jks.d.ts +86 -0
- package/dist/lib/jks.js +167 -0
- package/dist/lib/jsonl.d.ts +29 -0
- package/dist/lib/jsonl.js +24 -0
- package/dist/lib/lrc.d.ts +32 -0
- package/dist/lib/lrc.js +84 -0
- package/dist/lib/lzma.d.ts +70 -0
- package/dist/lib/lzma.js +204 -0
- package/dist/lib/markdown/blocks.d.ts +9 -0
- package/dist/lib/markdown/blocks.js +221 -0
- package/dist/lib/markdown/index.d.ts +3 -0
- package/dist/lib/markdown/inline.d.ts +33 -0
- package/dist/lib/markdown/inline.js +84 -0
- package/dist/lib/markdown/math.d.ts +5 -0
- package/dist/lib/markdown/math.js +25 -0
- package/dist/lib/markdown/segmentize.d.ts +11 -0
- package/dist/lib/markdown/segmentize.js +28 -0
- package/dist/lib/markdown/styles.d.ts +26 -0
- package/dist/lib/markdown/styles.js +135 -0
- package/dist/lib/mht.d.ts +51 -0
- package/dist/lib/mht.js +122 -0
- package/dist/lib/midi.d.ts +28 -0
- package/dist/lib/midi.js +84 -0
- package/dist/lib/mime.d.ts +82 -0
- package/dist/lib/mime.js +151 -0
- package/dist/lib/mindmap.d.ts +51 -0
- package/dist/lib/mindmap.js +113 -0
- package/dist/lib/mobi.d.ts +15 -0
- package/dist/lib/mobi.js +68 -0
- package/dist/lib/msi.d.ts +50 -0
- package/dist/lib/msi.js +332 -0
- package/dist/lib/optionalDep.d.ts +26 -0
- package/dist/lib/optionalDep.js +20 -0
- package/dist/lib/pkcs12.d.ts +56 -0
- package/dist/lib/pkcs12.js +356 -0
- package/dist/lib/qmc.d.ts +50 -0
- package/dist/lib/qmc.js +213 -0
- package/dist/lib/rar.d.ts +16 -0
- package/dist/lib/rar.js +40 -0
- package/dist/lib/rawPreview.d.ts +12 -0
- package/dist/lib/rawPreview.js +54 -0
- package/dist/lib/rc2.d.ts +12 -0
- package/dist/lib/rc2.js +298 -0
- package/dist/lib/resolveInput.d.ts +22 -0
- package/dist/lib/resolveInput.js +55 -0
- package/dist/lib/rtf.d.ts +53 -0
- package/dist/lib/rtf.js +413 -0
- package/dist/lib/sevenZip.d.ts +82 -0
- package/dist/lib/sevenZip.js +395 -0
- package/dist/lib/sha1.d.ts +24 -0
- package/dist/lib/sha1.js +53 -0
- package/dist/lib/sha256.d.ts +21 -0
- package/dist/lib/sha256.js +119 -0
- package/dist/lib/speechAudio.d.ts +36 -0
- package/dist/lib/speechAudio.js +85 -0
- package/dist/lib/sqlite.d.ts +38 -0
- package/dist/lib/sqlite.js +104 -0
- package/dist/lib/subtitle.d.ts +26 -0
- package/dist/lib/subtitle.js +99 -0
- package/dist/lib/tarball.d.ts +20 -0
- package/dist/lib/tarball.js +248 -0
- package/dist/lib/viewerFormats.d.ts +35 -0
- package/dist/lib/viewerFormats.js +83 -0
- package/dist/lib/viewerKind.d.ts +36 -0
- package/dist/lib/viewerKind.js +233 -0
- package/dist/lib/x509.d.ts +68 -0
- package/dist/lib/x509.js +267 -0
- package/dist/lib/xlsx.d.ts +55 -0
- package/dist/lib/xlsx.js +321 -0
- package/dist/lib/xlsxCharts.d.ts +34 -0
- package/dist/lib/xlsxCharts.js +152 -0
- package/dist/lib/xmind.d.ts +6 -0
- package/dist/lib/xmind.js +124 -0
- package/dist/lib/zip.d.ts +56 -0
- package/dist/lib/zip.js +169 -0
- package/dist/style.css +2 -0
- package/dist/types.d.ts +42 -0
- package/package.json +128 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { parseStatementBlock as e } from "./codeDataParser.js";
|
|
2
|
+
import { exprToText as t } from "./textCode.js";
|
|
3
|
+
//#region src/lib/epl/code/codeLines.ts
|
|
4
|
+
function n(e) {
|
|
5
|
+
return e ? "' " : "";
|
|
6
|
+
}
|
|
7
|
+
function r(e, n) {
|
|
8
|
+
return e ? t(e, n, 0) : "";
|
|
9
|
+
}
|
|
10
|
+
function i(e, t) {
|
|
11
|
+
let n = e.texts.length;
|
|
12
|
+
return e.texts.push(t), n;
|
|
13
|
+
}
|
|
14
|
+
function a(e, t, n) {
|
|
15
|
+
let r = i(e, t ? "' " + n : "");
|
|
16
|
+
return t || e.noNos.add(r), r;
|
|
17
|
+
}
|
|
18
|
+
function o(e, t, n, r) {
|
|
19
|
+
for (let i of e.statements) s(i, t, n, r);
|
|
20
|
+
}
|
|
21
|
+
function s(e, s, l, u) {
|
|
22
|
+
switch (e.kind) {
|
|
23
|
+
case "expression": {
|
|
24
|
+
let r = n(e.mask);
|
|
25
|
+
e.expr && (r += t(e.expr, s, 0)), e.comment != null && (r += (e.expr == null ? "' " : " ' ") + e.comment), i(u, r);
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
case "unexamined":
|
|
29
|
+
i(u, n(e.mask) + e.code);
|
|
30
|
+
break;
|
|
31
|
+
case "if": {
|
|
32
|
+
let t = n(e.mask);
|
|
33
|
+
t += e.unexaminedCode == null ? ".如果真 (" + r(e.condition, s) + ")" : "." + e.unexaminedCode, e.comment != null && (t += " ' " + e.comment);
|
|
34
|
+
let c = i(u, t);
|
|
35
|
+
o(e.block, s, l + 1, u);
|
|
36
|
+
let d = a(u, e.mask, ".如果真结束");
|
|
37
|
+
u.spans.push({
|
|
38
|
+
col: l,
|
|
39
|
+
start: c,
|
|
40
|
+
end: d,
|
|
41
|
+
tees: [],
|
|
42
|
+
masked: e.mask
|
|
43
|
+
});
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
case "ifElse": {
|
|
47
|
+
let t = n(e.mask);
|
|
48
|
+
t += e.unexaminedCode == null ? ".如果 (" + r(e.condition, s) + ")" : "." + e.unexaminedCode, e.comment != null && (t += " ' " + e.comment);
|
|
49
|
+
let c = i(u, t);
|
|
50
|
+
o(e.blockOnTrue, s, l + 1, u);
|
|
51
|
+
let d = i(u, n(e.mask) + ".否则");
|
|
52
|
+
o(e.blockOnFalse, s, l + 1, u);
|
|
53
|
+
let f = a(u, e.mask, ".如果结束");
|
|
54
|
+
u.spans.push({
|
|
55
|
+
col: l,
|
|
56
|
+
start: c,
|
|
57
|
+
end: f,
|
|
58
|
+
tees: [d],
|
|
59
|
+
masked: e.mask
|
|
60
|
+
});
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
case "while": {
|
|
64
|
+
let t = n(e.maskOnStart);
|
|
65
|
+
t += e.unexaminedCode == null ? ".判断循环首 (" + r(e.condition, s) + ")" : "." + e.unexaminedCode, e.commentOnStart != null && (t += " ' " + e.commentOnStart);
|
|
66
|
+
let a = i(u, t);
|
|
67
|
+
o(e.block, s, l + 1, u);
|
|
68
|
+
let c = n(e.maskOnEnd) + ".判断循环尾 ()";
|
|
69
|
+
e.commentOnEnd != null && (c += " ' " + e.commentOnEnd);
|
|
70
|
+
let d = i(u, c);
|
|
71
|
+
u.spans.push({
|
|
72
|
+
col: l,
|
|
73
|
+
start: a,
|
|
74
|
+
end: d,
|
|
75
|
+
tees: [],
|
|
76
|
+
masked: e.maskOnStart
|
|
77
|
+
});
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
case "doWhile": {
|
|
81
|
+
let t = n(e.maskOnStart) + ".循环判断首 ()";
|
|
82
|
+
e.commentOnStart != null && (t += " ' " + e.commentOnStart);
|
|
83
|
+
let a = i(u, t);
|
|
84
|
+
o(e.block, s, l + 1, u);
|
|
85
|
+
let c = n(e.maskOnEnd);
|
|
86
|
+
c += e.unexaminedCode == null ? ".循环判断尾 (" + r(e.condition, s) + ")" : "." + e.unexaminedCode, e.commentOnEnd != null && (c += " ' " + e.commentOnEnd);
|
|
87
|
+
let d = i(u, c);
|
|
88
|
+
u.spans.push({
|
|
89
|
+
col: l,
|
|
90
|
+
start: a,
|
|
91
|
+
end: d,
|
|
92
|
+
tees: [],
|
|
93
|
+
masked: e.maskOnStart
|
|
94
|
+
});
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
case "for": {
|
|
98
|
+
let t = n(e.maskOnStart);
|
|
99
|
+
e.unexaminedCode == null ? t += ".变量循环首 (" + r(e.start, s) + ", " + r(e.end, s) + ", " + r(e.step, s) + ", " + r(e.var, s) + ")" : t += "." + e.unexaminedCode, e.commentOnStart != null && (t += " ' " + e.commentOnStart);
|
|
100
|
+
let a = i(u, t);
|
|
101
|
+
o(e.block, s, l + 1, u);
|
|
102
|
+
let c = n(e.maskOnEnd) + ".变量循环尾 ()";
|
|
103
|
+
e.commentOnEnd != null && (c += " ' " + e.commentOnEnd);
|
|
104
|
+
let d = i(u, c);
|
|
105
|
+
u.spans.push({
|
|
106
|
+
col: l,
|
|
107
|
+
start: a,
|
|
108
|
+
end: d,
|
|
109
|
+
tees: [],
|
|
110
|
+
masked: e.maskOnStart
|
|
111
|
+
});
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
case "counter": {
|
|
115
|
+
let t = n(e.maskOnStart);
|
|
116
|
+
e.unexaminedCode == null ? t += ".计次循环首 (" + r(e.count, s) + ", " + r(e.var, s) + ")" : t += "." + e.unexaminedCode, e.commentOnStart != null && (t += " ' " + e.commentOnStart);
|
|
117
|
+
let a = i(u, t);
|
|
118
|
+
o(e.block, s, l + 1, u);
|
|
119
|
+
let c = n(e.maskOnEnd) + ".计次循环尾 ()";
|
|
120
|
+
e.commentOnEnd != null && (c += " ' " + e.commentOnEnd);
|
|
121
|
+
let d = i(u, c);
|
|
122
|
+
u.spans.push({
|
|
123
|
+
col: l,
|
|
124
|
+
start: a,
|
|
125
|
+
end: d,
|
|
126
|
+
tees: [],
|
|
127
|
+
masked: e.maskOnStart
|
|
128
|
+
});
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
case "switch":
|
|
132
|
+
c(e, s, l, u);
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function c(e, t, s, c) {
|
|
137
|
+
if (e.cases.length === 0) throw Error("CodeData: switch must have a case");
|
|
138
|
+
let l = e.cases[0], u = n(l.mask);
|
|
139
|
+
l.unexaminedCode == null ? u += ".判断 (" + r(l.condition, t) + ")" : u += "." + l.unexaminedCode.trimStart(), l.comment != null && (u += " ' " + l.comment);
|
|
140
|
+
let d = i(c, u);
|
|
141
|
+
o(l.block, t, s + 1, c);
|
|
142
|
+
let f = [];
|
|
143
|
+
for (let a = 1; a < e.cases.length; a++) {
|
|
144
|
+
let l = e.cases[a], u = n(l.mask);
|
|
145
|
+
u += l.unexaminedCode == null ? ".判断 (" + r(l.condition, t) + ")" : "." + l.unexaminedCode, l.comment != null && (u += " ' " + l.comment), f.push(i(c, u)), o(l.block, t, s + 1, c);
|
|
146
|
+
}
|
|
147
|
+
e.defaultBlock.statements.length > 0 && (f.push(i(c, n(l.mask) + ".默认")), o(e.defaultBlock, t, s + 1, c));
|
|
148
|
+
let p = a(c, l.mask, ".判断结束");
|
|
149
|
+
c.spans.push({
|
|
150
|
+
col: s,
|
|
151
|
+
start: d,
|
|
152
|
+
end: p,
|
|
153
|
+
tees: f,
|
|
154
|
+
masked: l.mask
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
function l(e) {
|
|
158
|
+
let t = e.texts.map(() => []), n = (e, n, r) => {
|
|
159
|
+
t[e][n] = r;
|
|
160
|
+
};
|
|
161
|
+
for (let r of e.spans) {
|
|
162
|
+
if (r.masked) {
|
|
163
|
+
for (let e = r.start; e <= r.end; e++) t[e][r.col] === void 0 && n(e, r.col, "blank");
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
n(r.start, r.col, "top"), n(r.end, r.col, "bottom");
|
|
167
|
+
for (let e of r.tees) n(e, r.col, "tee");
|
|
168
|
+
for (let e = r.start + 1; e < r.end; e++) t[e][r.col] === void 0 && n(e, r.col, "mid");
|
|
169
|
+
}
|
|
170
|
+
return t.map((e) => {
|
|
171
|
+
let t = [];
|
|
172
|
+
for (let n = 0; n < e.length; n++) t.push(e[n] ?? "mid");
|
|
173
|
+
return t;
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
function u(t, n, r) {
|
|
177
|
+
let i = e(t, r), a = {
|
|
178
|
+
texts: [],
|
|
179
|
+
spans: [],
|
|
180
|
+
noNos: /* @__PURE__ */ new Set()
|
|
181
|
+
};
|
|
182
|
+
o(i, n, 0, a);
|
|
183
|
+
let s = l(a);
|
|
184
|
+
return a.texts.map((e, t) => ({
|
|
185
|
+
text: e,
|
|
186
|
+
segs: s[t],
|
|
187
|
+
noNo: a.noNos.has(t)
|
|
188
|
+
}));
|
|
189
|
+
}
|
|
190
|
+
//#endregion
|
|
191
|
+
export { u as methodCodeLines };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code-section structures — ports of `ClassInfo.cs`, `MethodInfo.cs` (+ `MethodCodeData`), `StructInfo.cs`,
|
|
3
|
+
* `DllDeclareInfo.cs`, `LibraryRefInfo.cs`.
|
|
4
|
+
*
|
|
5
|
+
* Classes / methods / structs / DLL declares are read via the id+memory-address block table (no per-block
|
|
6
|
+
* length); their variable lists reuse {@link readVariables}. The reads run in C# source order — kept here as
|
|
7
|
+
* explicit statement sequences (not object literals) so the cursor advances identically.
|
|
8
|
+
*/
|
|
9
|
+
import type { BinaryReader } from '../io/binaryReader';
|
|
10
|
+
import { type EplVariable } from './variable';
|
|
11
|
+
export interface LibraryRefInfo {
|
|
12
|
+
fileName: string;
|
|
13
|
+
/** Raw GUID string, kept verbatim for faithful round-trip. */
|
|
14
|
+
guidString: string;
|
|
15
|
+
version: [number, number];
|
|
16
|
+
name: string;
|
|
17
|
+
/** Min command count for the支持库版本检查 (filled by {@link applyCompatibilityInfo}). */
|
|
18
|
+
minRequiredCmd: number;
|
|
19
|
+
minRequiredDataType: number;
|
|
20
|
+
minRequiredConstant: number;
|
|
21
|
+
}
|
|
22
|
+
/** Read the library list: MFC-count-prefixed strings, each `fileName\rguid\rmajor\rminor\rname`. */
|
|
23
|
+
export declare function readLibraries(r: BinaryReader): LibraryRefInfo[];
|
|
24
|
+
/** Attach the per-library min-required counts read separately in the code-section header. */
|
|
25
|
+
export declare function applyCompatibilityInfo(infos: LibraryRefInfo[], minRequiredCmds: number[] | null, minRequiredDataTypes: number[] | null, minRequiredConstants: number[] | null): void;
|
|
26
|
+
export interface ClassInfo {
|
|
27
|
+
id: number;
|
|
28
|
+
memoryAddress: number;
|
|
29
|
+
/** Associated form Id for a window class; 0 otherwise. */
|
|
30
|
+
form: number;
|
|
31
|
+
baseClass: number;
|
|
32
|
+
name: string;
|
|
33
|
+
comment: string;
|
|
34
|
+
/** Ids of the methods that belong to this class. */
|
|
35
|
+
methods: number[];
|
|
36
|
+
/** Class member variables. */
|
|
37
|
+
variables: EplVariable[];
|
|
38
|
+
}
|
|
39
|
+
export declare function readClasses(r: BinaryReader): ClassInfo[];
|
|
40
|
+
/** The six raw byte-blobs holding a method's compiled code (parsed by the code-data parser later). */
|
|
41
|
+
export interface MethodCodeData {
|
|
42
|
+
lineOffset: Uint8Array;
|
|
43
|
+
blockOffset: Uint8Array;
|
|
44
|
+
methodReference: Uint8Array;
|
|
45
|
+
variableReference: Uint8Array;
|
|
46
|
+
constantReference: Uint8Array;
|
|
47
|
+
/** The bytecode-like expression stream — decompiled to statements by CodeDataParser. */
|
|
48
|
+
expressionData: Uint8Array;
|
|
49
|
+
}
|
|
50
|
+
export interface MethodInfo {
|
|
51
|
+
id: number;
|
|
52
|
+
memoryAddress: number;
|
|
53
|
+
/** Owning class Id. */
|
|
54
|
+
classId: number;
|
|
55
|
+
flags: number;
|
|
56
|
+
returnDataType: number;
|
|
57
|
+
name: string;
|
|
58
|
+
comment: string;
|
|
59
|
+
/** Local variables. */
|
|
60
|
+
variables: EplVariable[];
|
|
61
|
+
/** Parameters. */
|
|
62
|
+
parameters: EplVariable[];
|
|
63
|
+
codeData: MethodCodeData;
|
|
64
|
+
}
|
|
65
|
+
export declare function readMethods(r: BinaryReader): MethodInfo[];
|
|
66
|
+
export interface StructInfo {
|
|
67
|
+
id: number;
|
|
68
|
+
memoryAddress: number;
|
|
69
|
+
flags: number;
|
|
70
|
+
name: string;
|
|
71
|
+
comment: string;
|
|
72
|
+
members: EplVariable[];
|
|
73
|
+
}
|
|
74
|
+
export declare function readStructs(r: BinaryReader): StructInfo[];
|
|
75
|
+
export interface DllDeclareInfo {
|
|
76
|
+
id: number;
|
|
77
|
+
memoryAddress: number;
|
|
78
|
+
flags: number;
|
|
79
|
+
returnDataType: number;
|
|
80
|
+
name: string;
|
|
81
|
+
comment: string;
|
|
82
|
+
entryPoint: string;
|
|
83
|
+
libraryName: string;
|
|
84
|
+
parameters: EplVariable[];
|
|
85
|
+
}
|
|
86
|
+
export declare function readDllDeclares(r: BinaryReader): DllDeclareInfo[];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text-code rendering — port of every `ToTextCode` across `Expressions/`, `Statements/`, the variable
|
|
3
|
+
* subtypes, ClassInfo / MethodInfo / StructInfo / DllDeclareInfo, and CodeSection.
|
|
4
|
+
*
|
|
5
|
+
* Produces the readable 易语言 source: definitions (`.程序集` / `.子程序` / `.局部变量` …), control flow
|
|
6
|
+
* (`.如果`/`.判断循环首`/`.判断开始` …) and expressions (operators with precedence-aware brackets, calls,
|
|
7
|
+
* member/array access, literals). Newlines are `\n` (the C# uses Environment.NewLine; callers comparing to a
|
|
8
|
+
* Windows oracle should normalize). Method bodies are decompiled on demand via {@link parseStatementBlock}.
|
|
9
|
+
*/
|
|
10
|
+
import { gbk } from '../io/encoding';
|
|
11
|
+
import { IdToNameMap } from '../names/idToNameMap';
|
|
12
|
+
import type { Expr, StatementBlock, Stmt } from './ast';
|
|
13
|
+
import type { EplVariable } from './variable';
|
|
14
|
+
import type { ClassInfo, DllDeclareInfo, MethodInfo, StructInfo } from './structures';
|
|
15
|
+
import type { CodeSection } from '../sections/code';
|
|
16
|
+
/** Render a single arbitrary expression. */
|
|
17
|
+
export declare function exprToText(e: Expr, nameMap: IdToNameMap, indent: number): string;
|
|
18
|
+
export declare function formatNumber(v: number): string;
|
|
19
|
+
export declare function formatOADate(oa: number): string;
|
|
20
|
+
export declare function blockToText(block: StatementBlock, nameMap: IdToNameMap, indent: number): string;
|
|
21
|
+
export declare function stmtToText(stmt: Stmt, nameMap: IdToNameMap, indent: number): string;
|
|
22
|
+
export declare function variableToText(v: EplVariable, nameMap: IdToNameMap, indent: number): string;
|
|
23
|
+
export declare function methodToText(m: MethodInfo, nameMap: IdToNameMap, indent: number, dec: TextDecoder, writeCode?: boolean): string;
|
|
24
|
+
export declare function structToText(st: StructInfo, nameMap: IdToNameMap, indent: number): string;
|
|
25
|
+
export declare function dllDeclareToText(d: DllDeclareInfo, nameMap: IdToNameMap, indent: number): string;
|
|
26
|
+
export declare function classToText(c: ClassInfo, nameMap: IdToNameMap, indent: number, codeSection: CodeSection | null, dec: TextDecoder, writeCode?: boolean): string;
|
|
27
|
+
/** Render the whole code section (global vars + classes [+ their methods] + DLL declares + structs). */
|
|
28
|
+
export declare function codeSectionToText(cs: CodeSection, nameMap: IdToNameMap, dec: TextDecoder, indent?: number, writeMethod?: boolean, writeCode?: boolean): string;
|
|
29
|
+
export { gbk };
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import "../io/encoding.js";
|
|
2
|
+
import { getType as e } from "../model/eplSystemId.js";
|
|
3
|
+
//#region src/lib/epl/code/textCode.ts
|
|
4
|
+
var t = new Map([
|
|
5
|
+
[15, {
|
|
6
|
+
op: "*",
|
|
7
|
+
precedence: 2,
|
|
8
|
+
type: "multi"
|
|
9
|
+
}],
|
|
10
|
+
[16, {
|
|
11
|
+
op: "/",
|
|
12
|
+
precedence: 2,
|
|
13
|
+
type: "multi"
|
|
14
|
+
}],
|
|
15
|
+
[17, {
|
|
16
|
+
op: "\\",
|
|
17
|
+
precedence: 3,
|
|
18
|
+
type: "multi"
|
|
19
|
+
}],
|
|
20
|
+
[18, {
|
|
21
|
+
op: "%",
|
|
22
|
+
precedence: 4,
|
|
23
|
+
type: "multi"
|
|
24
|
+
}],
|
|
25
|
+
[19, {
|
|
26
|
+
op: "+",
|
|
27
|
+
precedence: 5,
|
|
28
|
+
type: "multi"
|
|
29
|
+
}],
|
|
30
|
+
[20, {
|
|
31
|
+
op: "-",
|
|
32
|
+
precedence: 5,
|
|
33
|
+
type: "multi"
|
|
34
|
+
}],
|
|
35
|
+
[21, {
|
|
36
|
+
op: "-",
|
|
37
|
+
precedence: 1,
|
|
38
|
+
type: "unary"
|
|
39
|
+
}],
|
|
40
|
+
[38, {
|
|
41
|
+
op: "==",
|
|
42
|
+
precedence: 6,
|
|
43
|
+
type: "binary"
|
|
44
|
+
}],
|
|
45
|
+
[39, {
|
|
46
|
+
op: "!=",
|
|
47
|
+
precedence: 6,
|
|
48
|
+
type: "binary"
|
|
49
|
+
}],
|
|
50
|
+
[40, {
|
|
51
|
+
op: "<",
|
|
52
|
+
precedence: 6,
|
|
53
|
+
type: "binary"
|
|
54
|
+
}],
|
|
55
|
+
[41, {
|
|
56
|
+
op: ">",
|
|
57
|
+
precedence: 6,
|
|
58
|
+
type: "binary"
|
|
59
|
+
}],
|
|
60
|
+
[42, {
|
|
61
|
+
op: "<=",
|
|
62
|
+
precedence: 6,
|
|
63
|
+
type: "binary"
|
|
64
|
+
}],
|
|
65
|
+
[43, {
|
|
66
|
+
op: ">=",
|
|
67
|
+
precedence: 6,
|
|
68
|
+
type: "binary"
|
|
69
|
+
}],
|
|
70
|
+
[44, {
|
|
71
|
+
op: "?=",
|
|
72
|
+
precedence: 6,
|
|
73
|
+
type: "binary"
|
|
74
|
+
}],
|
|
75
|
+
[45, {
|
|
76
|
+
op: "&&",
|
|
77
|
+
precedence: 7,
|
|
78
|
+
type: "multi"
|
|
79
|
+
}],
|
|
80
|
+
[46, {
|
|
81
|
+
op: "||",
|
|
82
|
+
precedence: 8,
|
|
83
|
+
type: "multi"
|
|
84
|
+
}],
|
|
85
|
+
[52, {
|
|
86
|
+
op: "=",
|
|
87
|
+
precedence: 9,
|
|
88
|
+
type: "binary"
|
|
89
|
+
}]
|
|
90
|
+
]);
|
|
91
|
+
function n(e, t, n, r) {
|
|
92
|
+
return e.kind === "call" ? a(e, t, n, r) : o(e, t, n);
|
|
93
|
+
}
|
|
94
|
+
function r(e, t, r, i, a) {
|
|
95
|
+
let o = a.precedence > i, s = o ? "(" : "", c = e.paramList ?? [];
|
|
96
|
+
if (a.type === "unary") s += a.op, c.length > 0 && (s += n(c[0], t, r, a.precedence));
|
|
97
|
+
else if (c.length === 0) s += " " + a.op + " ";
|
|
98
|
+
else {
|
|
99
|
+
s += n(c[0], t, r, a.precedence), s += " " + a.op + " ";
|
|
100
|
+
for (let e = 1; e < c.length; e++) e > 1 && (s += " " + a.op + " "), s += n(c[e], t, r, a.precedence - 1);
|
|
101
|
+
}
|
|
102
|
+
return o && (s += ")"), s;
|
|
103
|
+
}
|
|
104
|
+
function i(e, t, n) {
|
|
105
|
+
return "(" + (e ?? []).map((e) => o(e, t, n)).join(", ") + ")";
|
|
106
|
+
}
|
|
107
|
+
function a(n, a, s, c) {
|
|
108
|
+
let l = n.target == null && n.libraryId === 0 ? t.get(n.methodId) : void 0;
|
|
109
|
+
if (l) return r(n, a, s, c, l);
|
|
110
|
+
let u = "";
|
|
111
|
+
if (n.target != null && (u += o(n.target, a, s) + "."), n.invokeSpecial && n.libraryId === -2) {
|
|
112
|
+
let t = a.methodIdToClassId.get(n.methodId);
|
|
113
|
+
t !== void 0 && e(t) === 1224736768 && (u += a.getUserDefinedName(t) + ".");
|
|
114
|
+
}
|
|
115
|
+
return u += n.libraryId === -2 || n.libraryId === -3 ? a.getUserDefinedName(n.methodId) : a.getLibCmdName(n.libraryId, n.methodId), u += " ", u += i(n.paramList, a, s), u;
|
|
116
|
+
}
|
|
117
|
+
function o(e, t, n) {
|
|
118
|
+
switch (e.kind) {
|
|
119
|
+
case "number": return c(e.value);
|
|
120
|
+
case "string": return "“" + e.value + "”";
|
|
121
|
+
case "bool": return e.value ? "真" : "假";
|
|
122
|
+
case "datetime": return "[" + u(e.oa) + "]";
|
|
123
|
+
case "constant": return "#" + (e.libraryId === -2 ? t.getUserDefinedName(e.constantId) : t.getLibConstantName(e.libraryId, e.constantId));
|
|
124
|
+
case "emnu": return "#" + t.getLibTypeName(e.libraryId, e.structId) + "." + t.getLibTypeMemberName(e.libraryId, e.structId, e.memberId);
|
|
125
|
+
case "variable": return t.getUserDefinedName(e.id);
|
|
126
|
+
case "methodPtr": return "&" + t.getUserDefinedName(e.methodId);
|
|
127
|
+
case "default": return "";
|
|
128
|
+
case "array": return "{" + e.items.map((e) => o(e, t, n)).join(", ") + "}";
|
|
129
|
+
case "accessMember": return s(e, t, n);
|
|
130
|
+
case "accessArray": return o(e.target, t, n) + "[" + o(e.index, t, n) + "]";
|
|
131
|
+
case "call": return a(e, t, n, 2 ** 53 - 1);
|
|
132
|
+
default: return "";
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function s(t, n, r) {
|
|
136
|
+
let i = "";
|
|
137
|
+
return t.target.kind === "variable" && e(t.target.id) === 100663296 || (i += o(t.target, n, r) + "."), t.libraryId === -2 ? e(t.structId) === 1375731712 && !(t.memberId & 4278190080) ? i += n.getLibTypeMemberName(0, 0, t.memberId - 1) : i += n.getUserDefinedName(t.memberId) : i += n.getLibTypeMemberName(t.libraryId, t.structId, t.memberId), i;
|
|
138
|
+
}
|
|
139
|
+
function c(e) {
|
|
140
|
+
return String(e);
|
|
141
|
+
}
|
|
142
|
+
function l(e, t = 2) {
|
|
143
|
+
return String(e).padStart(t, "0");
|
|
144
|
+
}
|
|
145
|
+
function u(e) {
|
|
146
|
+
let t = Math.round(e * 864e5) + Date.UTC(1899, 11, 30), n = new Date(t), r = `${l(n.getUTCFullYear(), 4)}年${l(n.getUTCMonth() + 1)}月${l(n.getUTCDate())}日`, i = n.getUTCHours(), a = n.getUTCMinutes(), o = n.getUTCSeconds();
|
|
147
|
+
return i === 0 && a === 0 && o === 0 ? r : `${r}${l(i)}时${l(a)}分${l(o)}秒`;
|
|
148
|
+
}
|
|
149
|
+
//#endregion
|
|
150
|
+
export { o as exprToText, c as formatNumber, u as formatOADate };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Variable info — port of `VariableInfo/AbstractVariableInfo.cs` (+ its subtypes Global/Local/Class/
|
|
3
|
+
* StructMember/MethodParameter/DllParameter).
|
|
4
|
+
*
|
|
5
|
+
* All variable kinds share ONE binary layout (read via the id+offset block table): dataType(int32),
|
|
6
|
+
* flags(int16), uBound(int32[readByte]), name(CString), comment(CString). The subtypes differ only in how
|
|
7
|
+
* their `flags` bits are interpreted and which keyword they emit as text — captured here by {@link EplVarKind}
|
|
8
|
+
* and resolved in the name/text layer, so the structural read stays uniform.
|
|
9
|
+
*/
|
|
10
|
+
import type { BinaryReader } from '../io/binaryReader';
|
|
11
|
+
/** Which variable list a row came from — drives the text keyword + flag-bit meaning later. */
|
|
12
|
+
export type EplVarKind = 'global' | 'local' | 'classMember' | 'structMember' | 'methodParameter' | 'dllParameter';
|
|
13
|
+
export interface EplVariable {
|
|
14
|
+
kind: EplVarKind;
|
|
15
|
+
id: number;
|
|
16
|
+
/** Data-type Id (a system DATATYPE_*, a struct/class Id, or a library data type). */
|
|
17
|
+
dataType: number;
|
|
18
|
+
flags: number;
|
|
19
|
+
/** Array dimensions (UBound): length 0 ⇒ scalar; `[0]` ⇒ dynamic array; otherwise fixed bounds. */
|
|
20
|
+
uBound: number[];
|
|
21
|
+
name: string;
|
|
22
|
+
comment: string;
|
|
23
|
+
}
|
|
24
|
+
/** Read a variable block table (C# AbstractVariableInfo.ReadVariables) tagging each row with `kind`. */
|
|
25
|
+
export declare function readVariables(r: BinaryReader, kind: EplVarKind): EplVariable[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { GeneralSection } from './model/section';
|
|
2
|
+
import { EplEncryptedError, NotEplFileError } from './projectFileReader';
|
|
3
|
+
import { type CodeSection } from './sections/code';
|
|
4
|
+
import { type ESystemInfoSection } from './sections/esystemInfo';
|
|
5
|
+
import { type ProjectConfigSection } from './sections/projectConfig';
|
|
6
|
+
import { type LosableSection } from './sections/losable';
|
|
7
|
+
import { type ResourceSection } from './sections/resource';
|
|
8
|
+
export type EplSection = ESystemInfoSection | ProjectConfigSection | CodeSection | ResourceSection | LosableSection | GeneralSection;
|
|
9
|
+
export interface EplDocument {
|
|
10
|
+
/** All parsed sections in file order (end-of-file section excluded). */
|
|
11
|
+
sections: EplSection[];
|
|
12
|
+
/** Convenience handles for the common sections (filled after parsing). */
|
|
13
|
+
systemInfo?: ESystemInfoSection;
|
|
14
|
+
projectConfig?: ProjectConfigSection;
|
|
15
|
+
code?: CodeSection;
|
|
16
|
+
resource?: ResourceSection;
|
|
17
|
+
losable?: LosableSection;
|
|
18
|
+
}
|
|
19
|
+
/** Parse a `.e`/`.ec` byte buffer into its sections. Throws {@link EplEncryptedError} / {@link NotEplFileError}. */
|
|
20
|
+
export declare function loadEpl(bytes: Uint8Array): EplDocument;
|
|
21
|
+
export { EplEncryptedError, NotEplFileError };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ProjectFileReader as e } from "./projectFileReader.js";
|
|
2
|
+
//#region src/lib/epl/eplDocument.ts
|
|
3
|
+
var t = 117469977, n = new Map([
|
|
4
|
+
[ESystemInfoKey.key, ESystemInfoKey],
|
|
5
|
+
[ProjectConfigKey.key, ProjectConfigKey],
|
|
6
|
+
[CodeSectionKey.key, CodeSectionKey],
|
|
7
|
+
[ResourceSectionKey.key, ResourceSectionKey],
|
|
8
|
+
[LosableSectionKey.key, LosableSectionKey]
|
|
9
|
+
]);
|
|
10
|
+
function r(r) {
|
|
11
|
+
let i = new e(r), a = gbk(), o = [];
|
|
12
|
+
for (; !i.isFinish;) {
|
|
13
|
+
let e = i.readSection();
|
|
14
|
+
if (e.key === t) break;
|
|
15
|
+
let r = n.get(e.key), s;
|
|
16
|
+
if (r) {
|
|
17
|
+
let t = {
|
|
18
|
+
dec: a,
|
|
19
|
+
cryptEC: i.cryptEC
|
|
20
|
+
};
|
|
21
|
+
s = r.parse(e.data, t);
|
|
22
|
+
} else s = {
|
|
23
|
+
kind: "general",
|
|
24
|
+
sectionKey: e.key,
|
|
25
|
+
sectionName: e.name,
|
|
26
|
+
isOptional: e.isOptional,
|
|
27
|
+
data: e.data
|
|
28
|
+
};
|
|
29
|
+
s.kind === "systemInfo" && (a = decoderForLanguage(s.language)), o.push(s);
|
|
30
|
+
}
|
|
31
|
+
let s = { sections: o };
|
|
32
|
+
for (let e of o) e.kind === "systemInfo" ? s.systemInfo = e : e.kind === "projectConfig" ? s.projectConfig = e : e.kind === "code" ? s.code = e : e.kind === "resource" ? s.resource = e : e.kind === "losable" && (s.losable = e);
|
|
33
|
+
return s;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { r as loadEpl };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 易语言 图片组 (picture group) decoder. A 图片组 image constant stores a Windows common-control ImageList
|
|
3
|
+
* stream (the same bytes `ImageList_Write` emits) wrapped in an 8-byte 易语言 header `"MITL" + 00 00 00 FF`:
|
|
4
|
+
*
|
|
5
|
+
* off 0 "MITL" + 4 bytes (易语言 wrapper)
|
|
6
|
+
* off 8 ILHEAD (28 bytes): u16 magic 'IL'(0x4C49) · u16 version · u16 cCurImage · u16 cMaxImage ·
|
|
7
|
+
* u16 cGrow · u16 cx · u16 cy · u32 bkColor · u16 flags · i16 overlays[4]
|
|
8
|
+
* off 36 color bitmap (BMP) — all frames packed left→right, top→bottom in a `cols = bmpW/cx` grid
|
|
9
|
+
* … mask bitmap (BMP, 1bpp) — unused here; the 32bpp color bitmap carries its own alpha
|
|
10
|
+
*
|
|
11
|
+
* We parse the header, decode the uncompressed color BMP to top-down RGBA, then slice it into the `cCurImage`
|
|
12
|
+
* frames of `cx × cy`. Pure logic (no DOM) so it stays testable; the component turns each frame's RGBA into a
|
|
13
|
+
* canvas. Returns null for anything that isn't a well-formed MITL ImageList so the caller falls back to treating
|
|
14
|
+
* the bytes as a single image.
|
|
15
|
+
*/
|
|
16
|
+
export interface EplImageFrame {
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
/** RGBA, top-down, length = width*height*4. */
|
|
20
|
+
rgba: Uint8ClampedArray;
|
|
21
|
+
}
|
|
22
|
+
export interface EplImageList {
|
|
23
|
+
cx: number;
|
|
24
|
+
cy: number;
|
|
25
|
+
frames: EplImageFrame[];
|
|
26
|
+
}
|
|
27
|
+
/** Parse a 图片组 (MITL ImageList) into its frames, or null if the bytes aren't one. */
|
|
28
|
+
export declare function parseEplImageList(bytes: Uint8Array): EplImageList | null;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
//#region src/lib/epl/imageList.ts
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
return e[t] | e[t + 1] << 8;
|
|
4
|
+
}
|
|
5
|
+
function t(e, t) {
|
|
6
|
+
return e[t] | e[t + 1] << 8 | e[t + 2] << 16 | e[t + 3] << 24;
|
|
7
|
+
}
|
|
8
|
+
function n(n, r) {
|
|
9
|
+
if (n[r] !== 66 || n[r + 1] !== 77) return null;
|
|
10
|
+
let i = t(n, r + 10) >>> 0, a = t(n, r + 18), o = t(n, r + 22), s = e(n, r + 28);
|
|
11
|
+
if (t(n, r + 30) >>> 0 || s !== 32 && s !== 24) return null;
|
|
12
|
+
let c = o < 0;
|
|
13
|
+
if (o = Math.abs(o), a <= 0 || o <= 0 || a > 8192 || o > 8192) return null;
|
|
14
|
+
let l = s >> 3, u = ((a * s + 31) / 32 | 0) * 4, d = r + i;
|
|
15
|
+
if (d + u * o > n.length) return null;
|
|
16
|
+
let f = new Uint8ClampedArray(a * o * 4), p = !1;
|
|
17
|
+
for (let e = 0; e < o; e++) {
|
|
18
|
+
let t = d + (c ? e : o - 1 - e) * u, r = e * a * 4;
|
|
19
|
+
for (let e = 0; e < a; e++) {
|
|
20
|
+
f[r] = n[t + 2], f[r + 1] = n[t + 1], f[r + 2] = n[t];
|
|
21
|
+
let e = s === 32 ? n[t + 3] : 255;
|
|
22
|
+
e !== 0 && (p = !0), f[r + 3] = e, t += l, r += 4;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (!p) for (let e = 3; e < f.length; e += 4) f[e] = 255;
|
|
26
|
+
return {
|
|
27
|
+
width: a,
|
|
28
|
+
height: o,
|
|
29
|
+
rgba: f
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function r(t) {
|
|
33
|
+
if (t.length < 64 || t[0] !== 77 || t[1] !== 73 || t[2] !== 84 || t[3] !== 76) return null;
|
|
34
|
+
let r = -1;
|
|
35
|
+
for (let e = 4; e < 24; e++) if (t[e] === 73 && t[e + 1] === 76) {
|
|
36
|
+
r = e;
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
if (r < 0) return null;
|
|
40
|
+
let i = e(t, r + 4), a = e(t, r + 10), o = e(t, r + 12);
|
|
41
|
+
if (i <= 0 || i > 4096 || a <= 0 || o <= 0 || a > 1024 || o > 1024) return null;
|
|
42
|
+
let s = n(t, r + 28);
|
|
43
|
+
if (!s) return null;
|
|
44
|
+
let c = Math.max(1, Math.floor(s.width / a)), l = [];
|
|
45
|
+
for (let e = 0; e < i; e++) {
|
|
46
|
+
let t = e % c * a, n = Math.floor(e / c) * o;
|
|
47
|
+
if (t + a > s.width || n + o > s.height) break;
|
|
48
|
+
let r = new Uint8ClampedArray(a * o * 4);
|
|
49
|
+
for (let e = 0; e < o; e++) {
|
|
50
|
+
let i = ((n + e) * s.width + t) * 4, o = e * a * 4;
|
|
51
|
+
for (let e = 0; e < a * 4; e++) r[o++] = s.rgba[i++];
|
|
52
|
+
}
|
|
53
|
+
l.push({
|
|
54
|
+
width: a,
|
|
55
|
+
height: o,
|
|
56
|
+
rgba: r
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return l.length > 0 ? {
|
|
60
|
+
cx: a,
|
|
61
|
+
cy: o,
|
|
62
|
+
frames: l
|
|
63
|
+
} : null;
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
export { r as parseEplImageList };
|