File: tkdriv.c

package info (click to toggle)
pgplot5 5.2.2-19%2Bdeb8u1
  • links: PTS
  • area: non-free
  • in suites: jessie
  • size: 7,056 kB
  • ctags: 6,555
  • sloc: fortran: 39,792; ansic: 22,549; objc: 1,534; sh: 1,306; makefile: 386; perl: 234; pascal: 233; tcl: 190; awk: 51; csh: 25
file content (82 lines) | stat: -rw-r--r-- 2,221 bytes parent folder | download | duplicates (16)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <stdio.h>

#ifndef convex
#include <string.h>
#endif

/*
 * VAX VMS includes etc..
 */
#ifdef VMS
#include <descrip.h>
#include <ssdef.h>
typedef struct dsc$descriptor_s VMS_string;
#define VMS_STRING(dsc, string) \
  dsc.dsc$w_length = strlen(string); \
  dsc.dsc$b_dtype = DSC$K_DTYPE_T; \
  dsc.dsc$b_class = DSC$K_CLASS_S; \
  dsc.dsc$a_pointer = string;
#endif

/*
 * Allow tkdriv to be calleable by FORTRAN using the two commonest
 * calling conventions. Both conventions append length arguments for
 * each FORTRAN string at the end of the argument list, and convert the
 * name to lower-case, but one post-pends an underscore to the function
 * name (PG_PPU) while the other doesn't. Note the VMS is handled
 * separately below. For other calling conventions you must write a
 * C wrapper routine to call tkdriv() or tkdriv_().
 */
#ifdef PG_PPU
#define TKDRIV tkdriv_
#else
#define TKDRIV tkdriv
#endif

/*.......................................................................
 * This is a stub version of the Tk PGPLOT widget device driver to
 * be included in the main PGPLOT library. The real driver resides in a
 * dedicated library, which when cited before libpgplot on the link line,
 * overrides this stub. The rational behind this is that if the real
 * driver were included in the PGPLOT library all applications that are
 * currently linked with PGPLOT would have to be changed to link with the
 * Tcl/Tk libraries.
 */
#ifdef VMS
void tkdriv(ifunc, rbuf, nbuf, chrdsc, lchr)
     int *ifunc;
     float rbuf[];
     int *nbuf;
     struct dsc$descriptor_s *chrdsc; /* VMS FORTRAN string descriptor */
     int *lchr;
{
  int len = chrdsc->dsc$w_length;
  char *chr = chrdsc->dsc$a_pointer;
#else
void TKDRIV(ifunc, rbuf, nbuf, chr, lchr, len)
 int   *ifunc, *nbuf, *lchr;
 int   len;
 float rbuf[];
 char  *chr;
{
#endif
  int i;
/*
 * Branch on the specified PGPLOT opcode.
 */
  switch(*ifunc) {

/*--- IFUNC=1, Return device name ---------------------------------------*/

  case 1:
    for(i=0; i < len; i++)
      chr[i] = ' ';
    *lchr = 0;
    break;
  default:
    fprintf(stderr, "/XTK: Unexpected opcode=%d in stub driver.\n", *ifunc);
    *nbuf = -1;
    break;
  };
  return;
}