--- description: 用於 CB_IMPSScan 檔案拆分 all_csv: "scripts/dist/deps.all.csv" script_path: "script" output_path: "reassemble" --- 定義: - 以下 @{{json}} 指的是 @scanimpl_annalysis_step_ver.md 需求 "0.1.3.3 階段三:模組分流實體化 (Module Disaggregation)" 所輸出的五個檔案。 ### 0.5 ScanImplScann 分類 @{{json}} 代表 @CB_IMGPSScanImp.pas 檔案中拆分前的每個方法,其分類是什麼(tags),其方法名(matcher) 對應的原始碼區段(lIndex, rIndex)在哪,及其引用相依(deps)為什麼,現欲使用 @{{json}} 對 @CB_IMGPSScanImp.pas 進行分類 #### 0.5.1 tags 與拆分檔案對應 ##### 0.5.1.1 tags:ScannerController 拆分檔案對應 - ScannerController.acquisitionHandler: {{output_path}}/scan/acquisition.pas - ScannerController.twainWrapper: {{output_path}}/scan/twain.pas ##### 0.5.1.2 tags:TransportManager 拆分檔案對應 - TransportManager.apiClient: {{output_path}}/transp/apiClient.pas - TransportManager.fileTransfer: {{output_path}}/transp/fileClient.pas - TransportManager.certificateManager: {{output_path}}/transp/certManager.pas - TransportManager.payloadArchiver: {{output_path}}/transp/payloadArchiver.pas ##### 0.5.1.3 tags:ImageProcessor 拆分檔案對應 - ImageProcessor.transformer: {{output_path}}/img/transformer.pas - ImageProcessor.converter: {{output_path}}/img/converter.pas - ImageProcessor.anchorAnalyzer: {{output_path}}/img/anchor.pas - ImageProcessor.payloadArchiver: {{output_path}}/img/imgArchiver.pas - ImageProcessor.annotation: {{output_path}}/img/annotation.pas - ImageProcessor.metadata: {{output_path}}/img/metadata.pas ##### 0.5.1.4 tags:BusinessLogic 拆分檔案對應 - BusinessLogic.systemInternal: {{output_path}}/bloc/sys.pas - BusinessLogic.configRepository: {{output_path}}/bloc/cfg.pas - BusinessLogic.ormRuleEngine: {{output_path}}/bloc/ormRuleEngine.pas - BusinessLogic.entityMapping: {{output_path}}/bloc/entityMapping.pas - BusinessLogic.fileManager: {{output_path}}/bloc/fileManager.pas - BusinessLogic.caseManager: {{output_path}}/bloc/caseManager.pas - BusinessLogic.entityModel: {{output_path}}/bloc/entityModel.pas - BusinessLogic.activeXWrapper: {{output_path}}/bloc/ocx.pas ##### 0.5.1.5 tags:UIView 拆分檔案對應 - UIView.statusMessenger: {{output_path}}/view/msger.pas, - UIView.events: {{output_path}}/view/events.pas, - UIView.i18n: {{output_path}}/view/i18n.pas, - UIView.inputHandler: {{output_path}}/view/input.pas, - UIView.configRepository: {{output_path}}/view/cfg.pas, - UIView.treeView: {{output_path}}/view/treeView.pas, - UIView.toolBar: {{output_path}}/view/toolBar.pas, - UIView.imageScrollBox: {{output_path}}/view/isb.pas, - UIView.popupMenu: {{output_path}}/view/popupMenu.pas, - UIView.listView: {{output_path}}/view/listView.pas, - UIView.scrollView: {{output_path}}/view/scrollView.pas, - UIView.misc: {{output_path}}/view/misc.pas ### 0.6 ScanImplScann 分類腳本生成 **目標**: 依據 @{{json}} 所提供的拆分資料及 需求 "0.5 ScanImplScann 分類" 規格寫一 javascript 腳本 並針對 @CB_IMGPSScanImp.pas, 檔案進行拆分 **輸入**:@{{json}} **目標產出腳本**:scripts/final_classify_scanImp_pas.js #### 0.6.1 拆分腳本原則 ##### 0.6.1.1 檔案拆分前先複制確保乾淨 **目標**: 拆分應不影響原始檔案內容 **處理邏輯**: - 拆分前將主檔案 @CB_IMGPSScanImp.pas.bk 複制一份並命名為 "CB_IMGPSScanImp.pas" 拆分作業請在 CB_IMGPSScanImp.pas 檔案中進行, 拆分時請透過 delphi include 語句將相應的檔案 include 至 CB_IMGPSScanImp.pas - 若 "0.6 ScanImplScann 分類腳本生成"所定義之拆分腳本已存在,應保留其結構再行修改,因此拆分 前請先行讀取 "0.6 ScanImplScann 分類腳本生成"所定義之拆分腳本,了解其結構 ##### 0.6.1.2 生成人工審核資料 **目標**: 拆分後可人工審核 **處理邏輯**:移除 @CB_IMGPSScanImp.pas 中於 @{{json}} 所標示之區段,並於腳本 結束時顯示移除後的內容,我想人工審核 **中介輸出**: `scripts/dist/scanimpl_annalysis.remainings.txt` #### 0.6.2 拆分腳請一併寫入相依及描述 **目標**: 依 @{{jsons}} 寫入 "0.5.1 tags 與拆分檔案對應" 時,需一併寫入相依(deps),及描述(description),描述需保持其可閱讀性 **處理邏輯**: - 見 "0.6.2.1 方法描述 template" - description: column 字元長為 60 字元,超過情加斷行符 - description: 若有標示 1., 2., 3., ... 等要點,請確保可閱讀性,也必須須一併斷行 ##### 0.6.2.1 方法描述 template **腳本-docstring-template** ```pascal { ============================================================================== 方法名稱:StatrTwainScan 引用相依:{{deps}} {{description}} ============================================================================== } ``` **example** 若 @{{jsons}} deps, description 分別為 - deps: Scanner (TEnScan), TTiffGraphic - ```pascal { ============================================================================== 方法名稱:StatrTwainScan 引用相依:Scanner (TEnScan), TTiffGraphic 方法描述:觸發實體掃描器進行取像的核心起點。將系統參數 (如解析度 ScanDpi、色彩格式 ScanColor、雙面掃描 ScanDuplex、亮度、對比等) 寫入 Scanner 物件,並宣告 TTiffGraphic 容器。最後呼叫 AcquireWithSourceOpen 開始掃描,並綁定 OnAcquire 作為非同步接收影像的回呼函式。 ============================================================================== } ``` ### 0.7 測試柝分正確性 撰寫 js 測試, 驗證拆分前後是否正確, 細項如下 #### 0.7.1 拆分代碼字串比對 透過 @{{json}} 中對應的 rIndex, lIndex 由原始檔案 @CB_IMGPSScanImp.pas 中取得對應的代碼,與下列 拆分後的檔案與原始檔案進行字串比對 - 0.6.2.1.1 比對 ScannerControl 相關檔案 相關檔案參照 0.5.1 - 0.6.2.1.2 比對 ImageProcessor 相關檔案 相關檔案參照 0.5.1 - 0.6.2.1.3 比對 TransportManager 相關檔案 相關檔案參照 0.5.1 - 0.6.2.1.4 比對 BusinessLogic 相關檔案 相關檔案參照 0.5.1 - 0.6.2.1.5 比對 UIView 相關檔案 相關檔案參照 0.5.1 > output: scripts/final_classify_scanImp_pas.test.js