1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/tool/gperf.sed
nobu 7c4306e6e9 gperf.sed: static declarations
* tool/gperf.sed: comment out arguments part only, to keep the
  following declarations static.  [Feature #13883]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-15 14:42:43 +00:00

22 lines
516 B
Sed

/ANSI-C code/{
h
s/.*/ANSI:offset:/
x
}
/\/\*!ANSI{\*\//{
G
s/\/\*!ANSI{\*\/\(.*\)\/\*}!ANSI\*\/\(.*\)\nANSI:.*/\/\*\1\*\/\2/
}
s/(int)([a-z_]*)&((struct \([a-zA-Z_0-9][a-zA-Z_0-9]*\)_t *\*)0)->\1_str\([1-9][0-9]*\),/gperf_offsetof(\1, \2),/g
/^#line/{
G
x
s/:offset:/:/
x
s/\(.*\)\(\n\).*:offset:.*/#define gperf_offsetof(s, n) (short)offsetof(struct s##_t, s##_str##n)\2\1/
s/\n[^#].*//
}
/^[a-zA-Z_0-9]*hash/,/^}/{
s/ hval = / hval = (unsigned int)/
s/ return / return (unsigned int)/
}