SpectraRust/.claude/skills/fortran-analyzer/references/advanced_usage.md

48 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 高级用法
## 重构策略
### 优先级规则
1. **传递未实现=0**: 可立即开始,无依赖
2. **传递未实现=1~3**: 需先完成少数依赖
3. **传递未实现>3**: 依赖链长,最后处理
4. **有IO**: 最后处理(可能需要 I/O 抽象层)
### 筛选命令
```bash
# 最佳候选无IO + 无未实现依赖
python3 .claude/skills/fortran-analyzer/scripts/analyze_fortran.py --priority | grep "○$" | head -10
# 查看特定函数依赖树
python3 .claude/skills/fortran-analyzer/scripts/analyze_fortran.py --tree ALIFR1
# 统计进度
echo "已完成: $(awk -F, '$11=="done"' fortran_analysis.csv | wc -l)"
echo "待处理: $(awk -F, '$11=="pending"' fortran_analysis.csv | wc -l)"
# 生成完整 CSV含传递依赖
python3 .claude/skills/fortran-analyzer/scripts/analyze_fortran.py --full > fortran_analysis.csv
```
## SPECIAL_MAPPINGS
一个 Rust 文件实现多个 Fortran 函数时,需更新 `.claude/skills/fortran-analyzer/scripts/analyze_fortran.py`:
```python
SPECIAL_MAPPINGS = {
'gfree': ['gfree0', 'gfreed', 'gfree1'],
'interpolate': ['yint', 'lagran'],
'sgmer': ['sgmer0', 'sgmer1', 'sgmerd'],
# 添加新映射...
}
```
## 脚本内部函数
- `extract_calls()`: 提取 CALL 和 FUNCTION 调用
- `get_transitive_deps()`: 计算传递依赖
- `get_pending_deps()`: 获取未实现依赖
- `print_dependency_tree()`: 打印依赖树