File: apioldc.c

package info (click to toggle)
plotutils 2.6-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 13,156 kB
  • ctags: 7,141
  • sloc: ansic: 68,670; sh: 20,082; cpp: 12,382; yacc: 2,588; makefile: 889; lex: 137
file content (1020 lines) | stat: -rw-r--r-- 26,749 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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
/* This file is part of the GNU plotutils package.  Copyright (C) 1995,
   1996, 1997, 1998, 1999, 2000, 2005, 2008, Free Software Foundation, Inc.

   The GNU plotutils package is free software.  You may redistribute it
   and/or modify it under the terms of the GNU General Public License as
   published by the Free Software foundation; either version 2, or (at your
   option) any later version.

   The GNU plotutils package is distributed in the hope that it will be
   useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.

   You should have received a copy of the GNU General Public License along
   with the GNU plotutils package; see the file COPYING.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin St., Fifth Floor,
   Boston, MA 02110-1301, USA. */

/* This file is specific to libplot, rather than libplotter.  It defines
   the `old' (i.e. non-thread-safe) C API.  The old C API consists of
   wrappers around the methods that may be applied to any Plotter object.

   The old API also contains pl_newpl/pl_selectpl/pl_deletepl, which
   construct and destroy Plotter instances, and maintain the global
   variable `_old_api_plotter'.  This is a pointer to a `currently
   selected' Plotter instance.  It is positioned by calling pl_selectpl.
   
   Because of this global variable, the old C API is not thread-safe.  In
   the new C API, which is thread-safe, each function in the API is passed
   a pointer to a Plotter as first argument.  Even in the absence of
   multithreading, this is a cleaner approach.

   By convention, _old_api_plotter is initialized to point to a Plotter
   instance that sends output in metafile format to standard output.
   Initialization takes place when the first function in the old API is
   invoked.  This convention is for compatibility with pre-GNU versions of
   libplot, which did not support pl_newpl/pl_select/pl_deletepl.

   The old C API also contains the pl_parampl function.  This function is
   held in common with the old (non-thread-safe) C++ API, in which it is
   simply called parampl.  It is defined in apioldcc.c.

   pl_parampl sets parameters in a global PlotterParams struct, a pointer
   to which is kept in the global variable
   `_old_api_global_plotter_params'.  (See its definition and
   initialization in g_defplot.c.)  This PlotterParams is used when any
   Plotter is created by pl_newpl.  The presence of this global state is
   another reason why the old C API is not thread-safe.  */

#include "sys-defines.h"
#include "extern.h"
#include "plot.h"		/* header file for C API's */

/* Sparse array of pointers to the old API's Plotter instances, and the
   array size; also a distinguished Plotter pointer, through which the old
   API will act. */
static Plotter **_old_api_plotters = NULL;
static int _old_api_plotters_len = 0;
static Plotter *_old_api_plotter = NULL;

/* initial size of _old_api_plotters[] */
#define INITIAL_PLOTTERS_LEN 4

/* default Plotter type (see list of supported types in the file devoted to
   the new C API) */
#ifndef DEFAULT_PLOTTER_TYPE
#define DEFAULT_PLOTTER_TYPE "meta"
#endif

/* forward references */
static void _api_warning (const char *msg);
static void _create_and_select_default_plotter (void);

/* Expand the local array of Plotters to include a single Plotter, of
   default type; also, select that Plotter.  When this is invoked, the
   array has zero size.  */
static void
_create_and_select_default_plotter (void)
{
  int i;
  Plotter *default_plotter;

  /* create the default Plotter by invoking function in new API (make sure
     global PlotterParams struct, used by the old API, is set up first) */
  if (_old_api_global_plotter_params == NULL)
    _old_api_global_plotter_params = pl_newplparams();
  default_plotter = pl_newpl_r (DEFAULT_PLOTTER_TYPE, stdin, stdout, stderr,
				_old_api_global_plotter_params);

  /* initialize local array of Plotters */
  _old_api_plotters = (Plotter **)_pl_xmalloc (INITIAL_PLOTTERS_LEN * sizeof(Plotter *));
  for (i = 0; i < INITIAL_PLOTTERS_LEN; i++)
    _old_api_plotters[i] = (Plotter *)NULL;
  _old_api_plotters_len = INITIAL_PLOTTERS_LEN;

  /* place default Plotter in local array, and select it */
  _old_api_plotters[0] = default_plotter;
  _old_api_plotter = default_plotter;
}

/* These are the 3 user-callable functions that are specific to the old C
   binding: newpl, selectpl, deletepl. */

/* user-callable */
int 
pl_newpl (const char *type, FILE *infile, FILE *outfile, FILE *errfile)
{
  Plotter *new_plotter;
  bool open_slot;
  int i, j;

  if (_old_api_plotters_len == 0)
    /* initialize local array of Plotters, and install default Plotter as
       Plotter #0 */
    _create_and_select_default_plotter ();

  /* create the default Plotter by invoking function in new API (make sure
     global PlotterParams struct, used by the old API, is set up first) */
  if (_old_api_global_plotter_params == NULL)
    _old_api_global_plotter_params = pl_newplparams();
  new_plotter = pl_newpl_r (type, infile, outfile, errfile,
			    _old_api_global_plotter_params);

  /* ensure local array has an open slot (slot i) */
  open_slot = false;
  for (i = 0; i < _old_api_plotters_len; i++)
    if (_old_api_plotters[i] == NULL)
      {
	open_slot = true;
	break;
      }

  if (!open_slot)
    /* expand array, clearing upper half */
    {
      i = _old_api_plotters_len;
      _old_api_plotters = 
	(Plotter **)_pl_xrealloc (_old_api_plotters, 
				    2 * _old_api_plotters_len * sizeof (Plotter *));
      for (j = _old_api_plotters_len; j < 2 * _old_api_plotters_len; j++)
	_old_api_plotters[j] = (Plotter *)NULL;
      _old_api_plotters_len *= 2;
    }
  
  /* place newly created Plotter in open slot */
  _old_api_plotters[i] = new_plotter;

  /* return index of newly created Plotter */
  return i;
}

/* user-callable, alters selected Plotter and returns index of the one that
   was previously selected */
int
pl_selectpl (int handle)
{
  int i;

  if (handle < 0 || handle >= _old_api_plotters_len 
      || _old_api_plotters[handle] == NULL)
    {
      _api_warning ("ignoring request to select a nonexistent plotter");
      return -1;
    }

  /* determine index of currently selected Plotter in _old_api_plotters[] */
  for (i = 0; i < _old_api_plotters_len; i++)
    if (_old_api_plotters[i] == _old_api_plotter)
      break;

  /* select specified Plotter: alter value of the _old_api_plotter pointer */
  _old_api_plotter = _old_api_plotters[handle];

  /* return index of previously selected Plotter */
  return i;
}

/* user-callable */
int
pl_deletepl (int handle)
{
  if (handle < 0 || handle >= _old_api_plotters_len 
      || _old_api_plotters[handle] == NULL)
    {
      _api_warning ("ignoring request to delete a nonexistent plotter");
      return -1;
    }

  if (_old_api_plotters[handle] == _old_api_plotter)
    {
      _api_warning ("ignoring request to delete currently selected plotter");
      return -1;
    }

  /* delete Plotter by invoking function in new API */
  pl_deletepl_r (_old_api_plotters[handle]);

  /* remove now-invalid pointer from local array */
  _old_api_plotters[handle] = NULL;

  return 0;
}


/* function used in this file to print warning messages */
static void
_api_warning (const char *msg)
{
  if (pl_libplot_warning_handler != NULL)
    (*pl_libplot_warning_handler)(msg);
  else
    fprintf (stderr, "libplot: %s\n", msg);
}


/* The following are the C wrappers around the public functions in the
   Plotter class.  Together with the three functions above (pl_newpl,
   pl_selectpl, pl_deletepl), and pl_parampl, they make up the old
   (non-thread-safe) libplot C API.

   Each binding tests whether _old_api_plotter is non-NULL, which determines
   whether the array of Plotter instances has been initialized.  That is
   because it makes no sense to call these functions before the
   _old_api_plotter pointer points to a Plotter object.

   In fact, of the below functions, it really only makes sense to call
   openpl, havecap, or outfile [deprecated] before the Plotter array is
   initialized.  Calling any other of the below functions before the
   Plotter array is initialized will generate an error message because even
   though the call to _create_and_select_default_plotter will initialize
   the Plotter array and select a default Plotter instance, the Plotter
   will not be open.  No operation in the Plotter class, with the exception
   of the just-mentioned ones, may be invoked unless the Plotter that is
   being acted on is open. */

int 
pl_alabel (int x_justify, int y_justify, const char *s)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_alabel (_old_api_plotter, x_justify, y_justify, s);
}

int
pl_arc (int xc, int yc, int x0, int y0, int x1, int y1)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_arc (_old_api_plotter, xc, yc, x0, y0, x1, y1);
}

int
pl_arcrel (int xc, int yc, int x0, int y0, int x1, int y1)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_arcrel (_old_api_plotter, xc, yc, x0, y0, x1, y1);
}

int
pl_bezier2 (int xc, int yc, int x0, int y0, int x1, int y1)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_bezier2 (_old_api_plotter, xc, yc, x0, y0, x1, y1);
}

int
pl_bezier2rel (int xc, int yc, int x0, int y0, int x1, int y1)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_bezier2rel (_old_api_plotter, xc, yc, x0, y0, x1, y1);
}

int
pl_bezier3 (int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_bezier3 (_old_api_plotter, x0, y0, x1, y1, x2, y2, x3, y3);
}

int
pl_bezier3rel (int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_bezier3rel (_old_api_plotter, x0, y0, x1, y1, x2, y2, x3, y3);
}

int
pl_bgcolor (int red, int green, int blue)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_bgcolor (_old_api_plotter, red, green, blue);
}

int
pl_bgcolorname (const char *s)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_bgcolorname (_old_api_plotter, s);
}

int
pl_box (int x0, int y0, int x1, int y1)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_box (_old_api_plotter, x0, y0, x1, y1);
}

int
pl_boxrel (int x0, int y0, int x1, int y1)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_boxrel (_old_api_plotter, x0, y0, x1, y1);
}

int
pl_capmod (const char *s)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_capmod (_old_api_plotter, s);
}

int
pl_circle (int x, int y, int r)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_circle (_old_api_plotter, x, y, r);
}

int
pl_circlerel (int x, int y, int r)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_circlerel (_old_api_plotter, x, y, r);
}

int
pl_closepath (void)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_closepath (_old_api_plotter);
}

int
pl_closepl (void)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_closepl (_old_api_plotter);
}

int
pl_color (int red, int green, int blue)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_color (_old_api_plotter, red, green, blue);
}

int
pl_colorname (const char *s)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_colorname (_old_api_plotter, s);
}

int
pl_cont (int x, int y)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_cont (_old_api_plotter, x, y);
}

int
pl_contrel (int x, int y)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_contrel (_old_api_plotter, x, y);
}

int
pl_ellarc (int xc, int yc, int x0, int y0, int x1, int y1)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_ellarc (_old_api_plotter, xc, yc, x0, y0, x1, y1);
}

int
pl_ellarcrel (int xc, int yc, int x0, int y0, int x1, int y1)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_ellarcrel (_old_api_plotter, xc, yc, x0, y0, x1, y1);
}

int
pl_ellipse (int x, int y, int rx, int ry, int angle)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_ellipse (_old_api_plotter, x, y, rx, ry, angle);
}

int
pl_ellipserel (int x, int y, int rx, int ry, int angle)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_ellipserel (_old_api_plotter, x, y, rx, ry, angle);
}

int
pl_endpath (void)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_endpath (_old_api_plotter);
}

int
pl_endsubpath (void)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_endsubpath (_old_api_plotter);
}

int
pl_erase (void)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_erase (_old_api_plotter);
}

int
pl_farc (double xc, double yc, double x0, double y0, double x1, double y1)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_farc (_old_api_plotter, xc, yc, x0, y0, x1, y1);
}

int
pl_farcrel (double xc, double yc, double x0, double y0, double x1, double y1)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_farcrel (_old_api_plotter, xc, yc, x0, y0, x1, y1);
}

int
pl_fbezier2 (double xc, double yc, double x0, double y0, double x1, double y1)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fbezier2 (_old_api_plotter, xc, yc, x0, y0, x1, y1);
}

int
pl_fbezier2rel (double xc, double yc, double x0, double y0, double x1, double y1)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fbezier2rel (_old_api_plotter, xc, yc, x0, y0, x1, y1);
}

int
pl_fbezier3 (double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fbezier3 (_old_api_plotter, x0, y0, x1, y1, x2, y2, x3, y3);
}

int
pl_fbezier3rel (double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fbezier3rel (_old_api_plotter, x0, y0, x1, y1, x2, y2, x3, y3);
}

int
pl_fbox (double x0, double y0, double x1, double y1)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fbox (_old_api_plotter, x0, y0, x1, y1);
}

int
pl_fboxrel (double x0, double y0, double x1, double y1)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fboxrel (_old_api_plotter, x0, y0, x1, y1);
}

int
pl_fcircle (double x, double y, double r)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fcircle (_old_api_plotter, x, y, r);
}

int
pl_fcirclerel (double x, double y, double r)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fcirclerel (_old_api_plotter, x, y, r);
}

int
pl_fconcat (double m0, double m1, double m2, double m3, double m4, double m5)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fconcat (_old_api_plotter, m0, m1, m2, m3, m4, m5);
}

int
pl_fcont (double x, double y)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fcont (_old_api_plotter, x, y);
}

int
pl_fcontrel (double x, double y)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fcontrel (_old_api_plotter, x, y);
}

int
pl_fellarc (double xc, double yc, double x0, double y0, double x1, double y1)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fellarc (_old_api_plotter, xc, yc, x0, y0, x1, y1);
}

int
pl_fellarcrel (double xc, double yc, double x0, double y0, double x1, double y1)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fellarcrel (_old_api_plotter, xc, yc, x0, y0, x1, y1);
}

int
pl_fellipse (double x, double y, double rx, double ry, double angle)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fellipse (_old_api_plotter, x, y, rx, ry, angle);
}

int
pl_fellipserel (double x, double y, double rx, double ry, double angle)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fellipserel (_old_api_plotter, x, y, rx, ry, angle);
}

double
pl_ffontname (const char *s)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_ffontname (_old_api_plotter, s);
}

double
pl_ffontsize (double size)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_ffontsize (_old_api_plotter, size);
}

int
pl_fillcolor (int red, int green, int blue)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fillcolor (_old_api_plotter, red, green, blue);
}

int
pl_fillcolorname (const char *s)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fillcolorname (_old_api_plotter, s);
}

int
pl_fillmod (const char *s)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fillmod (_old_api_plotter, s);
}

int
pl_filltype (int level)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_filltype (_old_api_plotter, level);
}

double
pl_flabelwidth (const char *s)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_flabelwidth (_old_api_plotter, s);
}

int
pl_fline (double x0, double y0, double x1, double y1)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fline (_old_api_plotter, x0, y0, x1, y1);
}

int
pl_flinedash (int n, const double *dashes, double offset)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_flinedash (_old_api_plotter, n, dashes, offset);
}

int
pl_flinerel (double x0, double y0, double x1, double y1)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_flinerel (_old_api_plotter, x0, y0, x1, y1);
}

int
pl_flinewidth (double size)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_flinewidth (_old_api_plotter, size);
}

int
pl_flushpl (void)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_flushpl (_old_api_plotter);
}

int
pl_fmarker (double x, double y, int type, double size)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fmarker (_old_api_plotter, x, y, type, size);
}

int
pl_fmarkerrel (double x, double y, int type, double size)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fmarkerrel (_old_api_plotter, x, y, type, size);
}

int
pl_fmiterlimit (double limit)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fmiterlimit (_old_api_plotter, limit);
}

int
pl_fmove (double x, double y)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fmove (_old_api_plotter, x, y);
}

int
pl_fmoverel (double x, double y)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fmoverel (_old_api_plotter, x, y);
}

int
pl_fontname (const char *s)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fontname (_old_api_plotter, s);
}

int
pl_fontsize (int size)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fontsize (_old_api_plotter, size);
}

int
pl_fpoint (double x, double y)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fpoint (_old_api_plotter, x, y);
}

int
pl_fpointrel (double x, double y)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fpointrel (_old_api_plotter, x, y);
}

int
pl_frotate (double theta)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_frotate (_old_api_plotter, theta);
}

int
pl_fscale (double x, double y)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fscale (_old_api_plotter, x, y);
}

int
pl_fsetmatrix (double m0, double m1, double m2, double m3, double m4, double m5)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fsetmatrix (_old_api_plotter, m0, m1, m2, m3, m4, m5);
}

int
pl_fspace (double x0, double y0, double x1, double y1)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fspace (_old_api_plotter, x0, y0, x1, y1);
}

int
pl_fspace2 (double x0, double y0, double x1, double y1, double x2, double y2)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_fspace2 (_old_api_plotter, x0, y0, x1, y1, x2, y2);
}

double
pl_ftextangle (double angle)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_ftextangle (_old_api_plotter, angle);
}

int
pl_ftranslate (double x, double y)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_ftranslate (_old_api_plotter, x, y);
}

int
pl_havecap (const char *s)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_havecap (_old_api_plotter, s);
}

int
pl_joinmod (const char *s)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_joinmod (_old_api_plotter, s);
}

int
pl_label (const char *s)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_label (_old_api_plotter, s);
}

int
pl_labelwidth (const char *s)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_labelwidth (_old_api_plotter, s);
}

int
pl_line (int x0, int y0, int x1, int y1)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_line (_old_api_plotter, x0, y0, x1, y1);
}

int
pl_linerel (int x0, int y0, int x1, int y1)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_linerel (_old_api_plotter, x0, y0, x1, y1);
}

int
pl_linewidth (int size)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_linewidth (_old_api_plotter, size);
}

int
pl_linedash (int n, const int *dashes, int offset)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_linedash (_old_api_plotter, n, dashes, offset);
}

int
pl_linemod (const char *s)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_linemod (_old_api_plotter, s);
}

int
pl_marker (int x, int y, int type, int size)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_marker (_old_api_plotter, x, y, type, size);
}

int
pl_markerrel (int x, int y, int type, int size)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_markerrel (_old_api_plotter, x, y, type, size);
}

int
pl_move (int x, int y)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_move (_old_api_plotter, x, y);
}

int
pl_moverel (int x, int y)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_moverel (_old_api_plotter, x, y);
}

int
pl_openpl (void)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_openpl (_old_api_plotter);
}

int
pl_orientation (int direction)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_orientation (_old_api_plotter, direction);
}

FILE *
pl_outfile (FILE *outfile)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_outfile (_old_api_plotter, outfile);
}

int
pl_pencolor (int red, int green, int blue)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_pencolor (_old_api_plotter, red, green, blue);
}

int
pl_pencolorname (const char *s)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_pencolorname (_old_api_plotter, s);
}

int
pl_pentype (int level)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_pentype (_old_api_plotter, level);
}

int
pl_point (int x, int y)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_point (_old_api_plotter, x, y);
}

int
pl_pointrel (int x, int y)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_pointrel (_old_api_plotter, x, y);
}

int
pl_restorestate (void)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_restorestate (_old_api_plotter);
}

int
pl_savestate (void)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_savestate (_old_api_plotter);
}

int
pl_space (int x0, int y0, int x1, int y1)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_space (_old_api_plotter, x0, y0, x1, y1);
}

int
pl_space2 (int x0, int y0, int x1, int y1, int x2, int y2)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_space2 (_old_api_plotter, x0, y0, x1, y1, x2, y2);
}

int
pl_textangle (int angle)
{
  if (_old_api_plotters_len == 0)
    _create_and_select_default_plotter ();
  return _API_textangle (_old_api_plotter, angle);
}

/* END OF WRAPPERS */