File: global_defines.sed

package info (click to toggle)
plplot 5.9.9-5
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 84,772 kB
  • sloc: ansic: 86,290; xml: 26,754; ada: 17,685; cpp: 15,530; php: 11,938; tcl: 11,125; ml: 6,825; perl: 6,736; f90: 6,709; python: 6,237; java: 6,215; sh: 2,042; makefile: 192; lisp: 75; fortran: 64; sed: 52
file content (45 lines) | stat: -rw-r--r-- 2,132 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# sed script specifically designed to parse the #define statements in
# bindings/swig-support/plplotcapi.i into a file that can be used for
# global variable definitions for f77.

# Insert text at the start:
1 i\
c     Do not edit this generated file.  Instead, check its consistency\
c     with the #defines in bindings/swig-support/plplotcapi.i using the\
c     (Unix) target "check_f77_parameters".  If that target reports an\
c     inconsistency (via a cmp message) between the generated\
c     plplot_parameters.fm4_compare file in the build tree and\
c     plplot_parameters.fm4 in the source tree, then copy\
c     plplot_parameters.fm4_compare on top of plplot_parameters.fm4 and\
c     check in that result.\

# Drop every line that is not a #define
/^#define/! d

# Drop specific #defines from the file that are not available
# because of specific #if statements.
/^#define ZEROW/ d
/^#define ONEW/ d
/OBJECT_DATA/ d
/^#define pltr_img/ d

# Translate trailing comment identifier into fortran 95 trailing comment.
/^#define/ s?//?!?
# Transform octal constants to Fortran (BOZ) form.
/^#define/ s? 0\([0-9][0-9]*\)? o'\1'?
# Transform hexadecimal constants to Fortran (BOZ) form.
/^#define/ s? 0[xX]\([0-9a-fA-F][0-9a-fA-F]*\)? z'\1'?
# Handle special case of z'80000000' which generates integer overflow
# for gfortran (and probably other Fortran 95 compilers).
/^#define/ s? z'80000000'? ishft(1,31)?

# Parse what is left while preserving trailing comments.  Watch out
# for parentheses around value as well.
# Treat PL_NOTSET as a floating value and append special parameter lines for
# PI and TWOPI in this case as well.

# N.B. These double-precision results are transformed later to single precision
# for the (uncommon) case where PLplot is a single-precision library.
/^#define/ s?^#define *\(PL_NOTSET\)[ (]*\([^ ]*\)[ )]*\(.*\)$?      real*8 \1 \3\n      parameter (\1 = \2.0d0)\n      real*8 PI\n      parameter (PI = 3.1415926535897932384d0)\n      real*8 TWOPI\n      parameter (TWOPI = 2.0d0*PI)?

/^#define/ s?^#define *\([^ ]*\)[ (]*\([^ ]*\)[ )]*\(.*\)$?      integer*4 \1 \3\n      parameter (\1 = \2)?