Commit | Line | Data |
---|---|---|
9e8e5516 C |
1 | -- testdebug.py - support routine for pepy generated routines |
2 | ||
3 | -- $Header: /f/osi/pepy/RCS/testdebug.py,v 7.1 91/02/22 09:35:22 mrose Interim $ | |
4 | -- | |
5 | -- | |
6 | -- $Log: testdebug.py,v $ | |
7 | -- Revision 7.1 91/02/22 09:35:22 mrose | |
8 | -- Interim 6.8 | |
9 | -- | |
10 | -- Revision 7.0 89/11/23 22:12:07 mrose | |
11 | -- Release 6.0 | |
12 | -- | |
13 | ||
14 | -- | |
15 | -- NOTICE | |
16 | -- | |
17 | -- Acquisition, use, and distribution of this module and related | |
18 | -- materials are subject to the restrictions of a license agreement. | |
19 | -- Consult the Preface in the User's Manual for the full terms of | |
20 | -- this agreement. | |
21 | -- | |
22 | -- | |
23 | ||
24 | ||
25 | TESTDEBUG DEFINITIONS ::= | |
26 | ||
27 | %{ | |
28 | #ifndef lint | |
29 | static char *rcsid = "$Header: /f/osi/pepy/RCS/testdebug.py,v 7.1 91/02/22 09:35:22 mrose Interim $"; | |
30 | #endif | |
31 | ||
32 | /* LINTLIBRARY */ | |
33 | ||
34 | ||
35 | #include <stdio.h> | |
36 | ||
37 | %} | |
38 | ||
39 | BEGIN | |
40 | ||
41 | END | |
42 | ||
43 | %{ | |
44 | int testdebug (pe, s) | |
45 | register PE pe; | |
46 | register char *s; | |
47 | { | |
48 | char *cp; | |
49 | register PS ps; | |
50 | static int debug = OK; | |
51 | ||
52 | switch (debug) { | |
53 | case NOTOK: | |
54 | return; | |
55 | ||
56 | case OK: | |
57 | if ((debug = (cp = getenv ("PEPYDEBUG")) && *cp ? atoi (cp) | |
58 | : NOTOK) == NOTOK) | |
59 | return; | |
60 | (void) fflush (stdout); | |
61 | fprintf (stderr, "testdebug made with %s\n", pepyid); | |
62 | /* and fall... */ | |
63 | ||
64 | default: | |
65 | (void) fflush (stdout); | |
66 | fprintf (stderr, "%s\n", s); | |
67 | ||
68 | if ((ps = ps_alloc (std_open)) == NULLPS) | |
69 | break; | |
70 | if (std_setup (ps, stderr) != NOTOK) | |
71 | (void) pe2pl (ps, pe); | |
72 | fprintf (stderr, "--------\n"); | |
73 | ps_free (ps); | |
74 | break; | |
75 | } | |
76 | } | |
77 | ||
78 | %} |