config

OpenBSD system configuration
git clone git://jacobedwards.org/config
Log | Files | Refs | README

cdec (386B)


      1 #!/usr/bin/sed -Ef
      2 # Copyright 2021 Jacob R. Edwards
      3 # License: GPLv3
      4 # Create C function declarations out of their definitions
      5 #
      6 # Function definitions of the form
      7 # 	^return type[ 	\n]func([^{]*{$
      8 # are output in the form
      9 # 	return type	func(param, ...);
     10 
     11 /^[a-zA-Z_]/ ! d
     12 
     13 : a
     14 /;/ d
     15 /{$/ ! {
     16 	N
     17 	b a
     18 }
     19 /\)/ ! d
     20 
     21 s/[ 	\n]+/ /g
     22 s/\) ?{.*$/);/
     23 s/\* /*/
     24 s/(.*) (\**[a-zA-Z_]+)\(/\1	\2(/