c2asm.awk
来自「用PIC的看一看,用C仿真PIC 16F84的指令集.国外搜集而来.」· AWK 代码 · 共 39 行
AWK
39 行
#! /usr/bin/awk -f## C simulation source to Assembly source converter## Caution: This script crudely removes parentheses, braces# and semicolons from the original source. If any of these# characters are contained in comments or character literals# then they will also be affected. Check the output carefully.## Also, it is your responsibility to ensure that subroutines# have explicit 'return's as appropriate. The script cannot# assume that every subroutine needs one. For code space# reasons I sometimes replace 'call / return' pairs with# a 'goto'. Another possibility is that the subroutine# finishes with a 'retlw'.## This script assumes C++ style comments./[ ]*void[ ]*/ { gsub( "[ ]*void[ ]*", "" ) }/\(/ { sub( "\(", "" ) }/\)[ ]*;/ { sub( "\)[ ]*;", "" ) }/\)/ { sub( "\)", ":" ) }/;/ { sub( ";", "" ) }/\{/ { sub( "\{", "" ) }/\}/ { sub( "\}", "" ) }/\/\// { sub( "\/\/", ";" ) } { print }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?