File: fix-var-global-local.pl

package info (click to toggle)
clisp 1:2.41-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 49,804 kB
  • ctags: 16,291
  • sloc: lisp: 75,912; ansic: 49,247; xml: 24,289; asm: 21,993; sh: 11,234; fortran: 6,692; cpp: 2,660; objc: 2,481; makefile: 2,355; perl: 164; sed: 55
file content (20 lines) | stat: -rw-r--r-- 466 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl -w

use strict;

while (<>) {
  /\s*\#\s*(define|undef)\s+(var|local|global)\b/ and next;
  s/\bvar\s+local\b/static/g;
  s/\blocal\s+var\b/static/g;
  s/\binline\s+local\b/inline static/g;
  s/\bvar\s+(\w+)\b/$1/g;
  s/^(\s*)(global|var) /$1/;
  s/^(\s*)local\b/$1static/;
  s/({\s*)var /$1/;
  s/nonreturning_function\s*\(global,/nonreturning_function(,/g;
  s/nonreturning_function\s*\(local,/nonreturning_function(static,/g;
  print;
}

__END__