From 0756bf12d10cf1b7f78c571de0a9ad69cbaeb7ca Mon Sep 17 00:00:00 2001
From: curtis <curtis@i-mps.com>
Date: 星期一, 30 三月 2026 14:24:17 +0800
Subject: [PATCH] fix: 更新內部引用方法參照
---
scripts/scanimpl_annalysis_validate.js | 65 ++++++++++++++++++++++++++++++++
1 files changed, 65 insertions(+), 0 deletions(-)
diff --git a/scripts/scanimpl_annalysis_validate.js b/scripts/scanimpl_annalysis_validate.js
new file mode 100644
index 0000000..f337e5f
--- /dev/null
+++ b/scripts/scanimpl_annalysis_validate.js
@@ -0,0 +1,65 @@
+const fs = require('fs');
+const path = require('path');
+
+const sourceFile = 'CB_IMGPSScanImp.pas.bk';
+const base_path = 'doc/curtis/prompt/scanimpl_analysis';
+const remainingsFile = path.join(base_path, 'scanimpl_annalysis.remainings.txt');
+
+const modules = [
+ 'ScannerController',
+ 'BusinessLogic',
+ 'ImageProcessor',
+ 'TransportManager',
+ 'UIView'
+];
+
+function validate() {
+ const lines = fs.readFileSync(sourceFile, 'utf8').split('\n');
+ const totalLines = lines.length;
+ const allCapturedMethods = [];
+
+ modules.forEach(mod => {
+ const filePath = path.join(base_path, `scanimpl_annalysis.${mod}.json`);
+ if (fs.existsSync(filePath)) {
+ const methods = JSON.parse(fs.readFileSync(filePath, 'utf8'));
+ allCapturedMethods.push(...methods);
+ }
+ });
+
+ const coveredLines = new Uint8Array(totalLines + 1);
+
+ allCapturedMethods.forEach(m => {
+ const sourceLine = lines[m.lIndex - 1].trim();
+ if (sourceLine !== m.matcher) {
+ console.error(`Mismatch at line ${m.lIndex}: Expected "${m.matcher}", got "${sourceLine}"`);
+ }
+
+ for (let i = m.lIndex; i <= m.rIndex; i++) {
+ coveredLines[i] = 1;
+ }
+ });
+
+ let remainings = [];
+ let start = -1;
+ for (let i = 1; i <= totalLines; i++) {
+ if (!coveredLines[i]) {
+ if (start === -1) start = i;
+ } else {
+ if (start !== -1) {
+ remainings.push({lIndex: start, rIndex: i - 1});
+ start = -1;
+ }
+ }
+ }
+ if (start !== -1) remainings.push({lIndex: start, rIndex: totalLines});
+
+ const remainingsText = remainings.map(r => {
+ const content = lines.slice(r.lIndex - 1, r.rIndex).join('\n');
+ return `[Lines ${r.lIndex} - ${r.rIndex}]\n${content}\n----------------------------------------\n`;
+ }).join('\n');
+
+ fs.writeFileSync(remainingsFile, remainingsText, 'utf8');
+ console.log(`Validation complete. Remainings saved to ${remainingsFile}`);
+}
+
+validate();
--
Gitblit v1.8.0