FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
gnuplot/term/cgm.trm at master · gnuplot/gnuplot · GitHub
gnuplot
gnuplot
Repository navigation
Code
Pull requests
2
(2)
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
gnuplot
/
term
/
cgm.trm
Copy path
More file actions
More file actions
Latest commit
History
History
History
2055 lines (1863 loc) · 64.2 KB
Breadcrumbs
gnuplot
/
term
/
cgm.trm
Copy path
File metadata and controls
2055 lines (1863 loc) · 64.2 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
/* Hey Emacs this is -*- C -*- */
/* GNUPLOT - cgm.trm */
/*[
* Copyright 1998, 2004
*
* Permission to use, copy, and distribute this software and its
* documentation for any purpose with or without fee is hereby granted,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation.
*
* Permission to modify the software is granted, but not the right to
* distribute the complete modified source code. Modifications are to
* be distributed as patches to the released version. Permission to
* distribute binaries produced by compiling modified sources is granted,
* provided you
* 1. distribute the corresponding source modifications from the
* released version in the form of a patch file along with the binaries,
* 2. add special version identification to distinguish your version
* in addition to the base release version number,
* 3. provide your name and address as the primary contact for the
* support of your modified version, and
* 4. retain our contact information in regard to use of the base
* software.
* Permission to distribute the released version of the source code along
* with corresponding source modifications in the form of a patch file is
* granted with same provisions 2 through 4 for binary distributions.
*
* This software is provided "as is" without express or implied warranty
* to the extent permitted by applicable law.
]*/
/*
* This file is included by ../term.c and ../docs/termdoc.c.
*
* This terminal driver supports:
* Computer Graphics Metafile
*
* TODO
* better control over plot size (never cutting off labels, correct font
* sizes)
* REFERENCES
*
* ISO 8632-1:1992 Computer Graphics Metafile (CGM), Part 1,
* Functional Specification.
*
* ISO 8632-1:1992 Computer Graphics Metafile (CGM), Part 3,
* Binary Encoding.
*
* FIPS PUB 128 - Computer Graphics Metafile (CGM).
*
* MIL-STD-2301A Computer Graphics Metafile (CGM) Implementation
* Standard for the National Imagery Transmission Format Standard, 5
* June 1998, http://164.214.2.51/ntb/baseline/docs/2301a/. Only a
* subset of CGM version 1, but does include the binary format for
* that subset.
*
* MIL-D-28003A "Digital Representation for Communication of
* Illustration Data: CGM Application Profile", 15 November 1991,
* http://www-cals.itsi.disa.mil/core/standards/28003aa1.pdf.
*
* "The computer graphics metafile", Lofton R. Henderson and Anne
* M. Mumford, Butterworths, London, 1990, ISBN 0-408-02680-4.
*
* AUTHOR
* Jim Van Zandt <jrvz@comcast.net>
*
* send your comments or suggestions to the author or
* gnuplot-info@lists.sourceforge.net.
*/
#include
"driver.h"
#ifdef
TERM_REGISTER
register_term
(
cgm
)
#endif
#ifdef
TERM_PROTO
TERM_PUBLIC
void
CGM_options
(
void
);
TERM_PUBLIC
void
CGM_init
(
void
);
TERM_PUBLIC
void
CGM_reset
(
void
);
TERM_PUBLIC
void
CGM_text
(
void
);
TERM_PUBLIC
void
CGM_graphics
(
void
);
TERM_PUBLIC
void
CGM_move
(
unsigned
int
x
,
unsigned
int
y
);
TERM_PUBLIC
void
CGM_dashed_vector
(
unsigned
int
ux
,
unsigned
int
uy
);
TERM_PUBLIC
void
CGM_solid_vector
(
unsigned
int
ux
,
unsigned
int
uy
);
TERM_PUBLIC
void
CGM_linetype
(
int
linetype
);
TERM_PUBLIC
void
CGM_linecolor
(
int
color
);
TERM_PUBLIC
void
CGM_dashtype
(
int
dashtype
);
TERM_PUBLIC
void
CGM_linewidth
(
double
width
);
TERM_PUBLIC
void
CGM_put_text
(
unsigned
int
x
,
unsigned
int
y
,
const
char
*
str
);
TERM_PUBLIC
int
CGM_text_angle
(
float
ang
);
TERM_PUBLIC
int
CGM_justify_text
(
enum
JUSTIFY
mode
);
TERM_PUBLIC
int
CGM_set_font
(
const
char
*
font
);
TERM_PUBLIC
void
CGM_point
(
unsigned
int
x
,
unsigned
int
y
,
int
number
);
TERM_PUBLIC
void
CGM_fillbox
(
int
style
,
unsigned
int
x1
,
unsigned
int
y1
,
unsigned
int
width
,
unsigned
int
height
);
TERM_PUBLIC
int
CGM_make_palette
(
t_sm_palette
*
palette
);
TERM_PUBLIC
void
CGM_set_color
(
t_colorspec
*
);
TERM_PUBLIC
void
CGM_filled_polygon
(
int
points
,
gpiPoint
*
corner
);
TERM_PUBLIC
void
CGM_set_pointsize
(
double
size
);
#define
FATAL
(
msg
) { fprintf(stderr, "%s\nFile %s line %d\n", msg, __FILE__, __LINE__); exit(EXIT_FAILURE); }
#define
CGM_LARGE
32767
#define
CGM_SMALL
32767/18*13
/* aspect ratio 1:.7222 */
#define
CGM_MARGIN
(CGM_LARGE/180)
/* convert from plot units to pt */
#define
CGM_PT
((term->xmax + CGM_MARGIN)/cgm_plotwidth)
#define
CGM_LINE_TYPES
9
/* number of line types we support */
#define
CGM_COLORS
96
/* must not exceed size of pm3d_color_names_tbl[] */
#define
CGM_POINTS
13
/* number of markers we support */
#define
CGM_MAX_SEGMENTS
16382
/* maximum # polyline coordinates */
#define
CGM_VCHAR
(CGM_SMALL/360*12)
#define
CGM_HCHAR
(CGM_SMALL/360*12*5/9)
#define
CGM_VTIC
(CGM_LARGE/80)
#define
CGM_HTIC
(CGM_LARGE/80)
#endif
#ifndef
TERM_PROTO_ONLY
#ifdef
TERM_BODY
static
int
CGM_find_font
(
const
char
*
name
,
int
len
,
double
*
relwidth
);
static
int
CGM_find_nearest_color
(
t_colorspec
*
colorspec
);
#include
<ctype.h>
/* for isspace() */
/* uncomment the following to enable assertions for this module only,
regardless of compiler switches
#ifdef NDEBUG
#define DEFEAT_ASSERTIONS
#endif
#undef NDEBUG
#include <assert.h>
*/
#define
CGM_ADJ
(sizeof(int)/sizeof(short))
static
TBOOLEAN
cgm_initialized
=
FALSE;
static
unsigned
int
cgm_posx
;
static
unsigned
int
cgm_posy
;
static
unsigned
int
cgm_linetype
=
1
;
static
unsigned
int
cgm_linetypes
=
CGM_LINE_TYPES
+
3
;
static
unsigned
int
cgm_dashtype
=
0
;
static
unsigned
int
cgm_color
=
0
;
static
unsigned
int
cgm_background
=
0xffffff
;
static
int
*
cgm_polyline
;
/* stored polyline coordinates */
static
int
cgm_coords
=
0
;
/* # polyline coordinates saved */
static
int
cgm_doing_polygon
=
0
;
/* nonzero if creating polygon, else
* creating polyline */
/* static enum JUSTIFY cgm_justify = LEFT; */
/* unused */
static
int
cgm_step_sizes
[
8
];
/* array of currently used dash
lengths in plot units */
static
int
cgm_step_index
=
0
;
/* index into cgm_step_sizes[] */
static
int
cgm_step
=
0
;
/* amount of current dash not yet
drawn, in plot units */
static
int
cgm_tic
,
cgm_tic707
,
cgm_tic866
,
cgm_tic500
,
cgm_tic1241
,
cgm_tic1077
,
cgm_tic621
;
/* marker dimensions */
struct
cgm_properties
{
double
angle
;
/* angle of text baseline (radians
counter-clockwise from horizontal) */
int
font_index
;
/* font index */
int
char_height
;
/* character height in picture units */
enum
JUSTIFY
justify_mode
;
/* how text is justified */
int
edge_visibility
;
/* nonzero if edge is visible */
int
edge_color
;
int
fill_color
;
int
interior_style
;
int
hatch_index
;
};
static
struct
cgm_properties
cgm_current
=
{
-1
,
-1
,
-1
,(
enum
JUSTIFY
)
-1
,
-1
,
-1
,
-1
,
-1
,
-1
},
/* written to file */
cgm_next
=
{
0
,
-2
,
-2
,
LEFT
,
-2
,
-2
,
-2
,
-1
,
-1
},
/* needed for next text string/marker */
cgm_reset
=
{
-1
,
-1
,
-1
,(
enum
JUSTIFY
)
-1
,
-1
,
-1
,
-1
,
-1
,
-1
};
/* invalid entries */
static
int
cgm_user_color_count
=
0
;
static
int
cgm_user_color_max
=
0
;
static
int
cgm_smooth_colors
=
0
;
static
int
*
cgm_user_color_table
=
(
int
*
)
0
;
static
int
cgm_maximum_color_index
=
255
;
/* Size of color table we will write */
struct
fontdata
{
char
*
name
;
/* the name of the font */
double
width
;
/* the width of the font, relative to
Times Bold Italic. The width
adjustment can only be approximate.
Of the standard fonts, only the
four versions of "Courier" are
monospaced. Also, metrics of the
same font from different foundries
are sometimes different. */
};
static
struct
fontdata
cgm_basic_font_data
[]
=
{
/* these are WebCGM recommended fonts */
{
"Helvetica"
,
1.039
},
{
"Helvetica Oblique"
,
1.099
},
{
"Helvetica Bold"
,
1.083
},
{
"Helvetica Bold Oblique"
,
1.011
},
{
"Times Roman"
,
.981
},
{
"Times Bold"
,
.985
},
{
"Times Italic"
,
.959
},
{
"Times Bold Italic"
,
1.0
},
{
"Courier"
,
1.327
},
{
"Courier Bold"
,
1.327
},
{
"Courier Oblique"
,
1.218
},
{
"Courier Bold Oblique"
,
1.341
},
{
"Symbol"
,
.897
},
/* These are basic public domain fonts required by MIL-D-28003A */
{
"Hershey/Cartographic_Roman"
,
1.2404
},
{
"Hershey/Cartographic_Greek"
,
.9094
},
{
"Hershey/Simplex_Roman"
,
1.2369
},
{
"Hershey/Simplex_Greek"
,
.9129
},
{
"Hershey/Simplex_Script"
,
1.4181
},
{
"Hershey/Complex_Roman"
,
1.1150
},
{
"Hershey/Complex_Greek"
,
.9059
},
{
"Hershey/Complex_Script"
,
1.3868
},
{
"Hershey/Complex_Italic"
,
1.4146
},
{
"Hershey/Complex_Cyrillic"
,
1.2056
},
{
"Hershey/Duplex_Roman"
,
1.1707
},
{
"Hershey/Triplex_Roman"
,
1.3240
},
{
"Hershey/Triplex_Italic"
,
1.3310
},
{
"Hershey/Gothic_German"
,
1.2056
},
{
"Hershey/Gothic_English"
,
1.2021
},
{
"Hershey/Gothic_Italian"
,
1.2021
},
{
"Hershey/Symbol_Set_1"
,
.9059
},
{
"Hershey/Symbol_Set_2"
,
.9059
},
{
"Hershey/Symbol_Math"
,
.9059
},
/* These are available in the Microsoft Office import filter. By
default, the script font can apparently be accessed only via
the name "15". */
{
"ZapfDingbats"
,
1.583
},
{
"Script"
,
1.139
},
{
"15"
,
1.139
},
/* in the Microsoft Office and Corel Draw import filters, these
are pseudonyms for some of the above */
{
"Helvetica Italic"
,
1.099
},
{
"Helvetica Bold Italic"
,
1.011
},
{
"Courier Italic"
,
1.218
},
{
"Courier Bold Italic"
,
1.341
},
{
"Times Oblique"
,
.959
},
{
"Times Bold Oblique"
,
1.0
},
{
0
,
0
}
};
static
struct
fontdata
*
cgm_font_data
=
cgm_basic_font_data
;
#define
DEFAULT_CGMFONT
"Helvetica Bold"
static
char
CGM_default_font
[
MAX_ID_LEN
+
1
]
=
{
'\0'
};
/* variables to record the options */
static
char
cgm_font
[
32
]
=
DEFAULT_CGMFONT
;
static
unsigned
int
cgm_fontsize
=
12
;
static
unsigned
cgm_linewidth
;
/* line width in plot units */
static
unsigned
cgm_linewidth_pt
=
1
;
/* line width in pt */
static
TBOOLEAN
cgm_monochrome
=
FALSE;
/* colors enabled? */
static
int
cgm_plotwidth
=
432
;
/* assumed width of plot in pt. */
static
TBOOLEAN
cgm_portrait
=
FALSE;
/* portrait orientation? */
static
TBOOLEAN
cgm_rotate
=
TRUE;
/* text rotation enabled? */
static
TBOOLEAN
cgm_dashed
=
TRUE;
/* dashed linestyles enabled? */
static
TBOOLEAN
cgm_nofontlist_mode
=
FALSE;
/* omit font list? */
/* prototypes for static functions */
static
void
CGM_local_reset
(
void
);
static
void
CGM_flush_polyline
(
void
);
static
void
CGM_flush_polygon
(
void
);
static
void
CGM_write_char_record
(
int
class
,
int
cgm_id
,
int
length
,
char
*
data
);
static
void
CGM_write_code
(
int
class
,
int
cgm_id
,
int
length
);
static
void
CGM_write_int
(
int
value
);
static
void
CGM_write_int_record
(
int
class
,
int
cgm_id
,
int
length
,
int
*
data
);
static
void
CGM_write_mixed_record
(
int
class
,
int
cgm_id
,
int
numint
,
int
*
int_data
,
int
numchar
,
const
char
*
char_data
);
static
void
CGM_write_byte_record
(
int
class
,
int
cgm_id
,
int
length
,
char
*
data
);
enum
CGM_id
{
/* cgm mode */
CGM_PORTRAIT
,
CGM_LANDSCAPE
,
CGM_DEFAULT
,
/* color */
CGM_MONOCHROME
,
CGM_COLOR
,
/* rotation */
CGM_ROTATE
,
CGM_NOROTATE
,
CGM_DASHED
,
CGM_SOLID
,
CGM_LINEWIDTH
,
CGM_WIDTH
,
CGM_NOFONTLIST
,
CGM_BACKGROUND
,
CGM_OTHER
};
static
struct
gen_table
CGM_opts
[]
=
{
{
"p$ortrait"
,
CGM_PORTRAIT
},
{
"la$ndscape"
,
CGM_LANDSCAPE
},
{
"de$fault"
,
CGM_DEFAULT
},
{
"nof$ontlist"
,
CGM_NOFONTLIST
},
{
"win$word6"
,
CGM_NOFONTLIST
},
/* deprecated */
{
"m$onochrome"
,
CGM_MONOCHROME
},
{
"c$olor"
,
CGM_COLOR
},
{
"c$olour"
,
CGM_COLOR
},
{
"r$otate"
,
CGM_ROTATE
},
{
"nor$otate"
,
CGM_NOROTATE
},
{
"da$shed"
,
CGM_DASHED
},
{
"s$olid"
,
CGM_SOLID
},
{
"li$newidth"
,
CGM_LINEWIDTH
},
{
"lw"
,
CGM_LINEWIDTH
},
{
"wid$th"
,
CGM_WIDTH
},
{
"backg$round"
,
CGM_BACKGROUND
},
{
NULL
,
CGM_OTHER
}
};
TERM_PUBLIC
void
CGM_options
()
{
char
*
string
;
/* Annoying hack to handle the case of 'set termoption' after */
/* we have already initialized the terminal. */
if
(!
almost_equals
(
c_token
-
1
,
"termopt$ion"
))
CGM_local_reset
();
while
(!
END_OF_COMMAND
) {
switch
(
lookup_table
(
&
CGM_opts
[
0
],
c_token
)) {
case
CGM_PORTRAIT
:
cgm_portrait
=
TRUE;
c_token
++
;
break
;
case
CGM_LANDSCAPE
:
cgm_portrait
=
FALSE;
c_token
++
;
break
;
case
CGM_DEFAULT
:
CGM_local_reset
();
c_token
++
;
break
;
case
CGM_NOFONTLIST
:
cgm_nofontlist_mode
=
TRUE;
c_token
++
;
break
;
case
CGM_MONOCHROME
:
cgm_monochrome
=
TRUE;
term
->
flags
|=
TERM_MONOCHROME
;
c_token
++
;
break
;
case
CGM_COLOR
:
cgm_monochrome
=
FALSE;
term
->
flags
&= ~
TERM_MONOCHROME
;
c_token
++
;
break
;
case
CGM_ROTATE
:
cgm_rotate
=
TRUE;
c_token
++
;
break
;
case
CGM_NOROTATE
:
cgm_rotate
=
FALSE;
c_token
++
;
break
;
case
CGM_DASHED
:
cgm_dashed
=
TRUE;
c_token
++
;
break
;
case
CGM_SOLID
:
cgm_dashed
=
FALSE;
c_token
++
;
break
;
case
CGM_LINEWIDTH
:
c_token
++
;
if
(!
END_OF_COMMAND
) {
cgm_linewidth_pt
=
int_expression
();
if
(
cgm_linewidth_pt
==
0
||
cgm_linewidth_pt
>
10000
) {
int_warn
(
c_token
,
"linewidth out of range"
);
cgm_linewidth_pt
=
1
;
}
}
break
;
case
CGM_WIDTH
:
c_token
++
;
if
(!
END_OF_COMMAND
) {
cgm_plotwidth
=
int_expression
();
if
(
cgm_plotwidth
<
0
||
cgm_plotwidth
>
10000
) {
int_warn
(
c_token
,
"width out of range"
);
cgm_plotwidth
=
6
*
72
;
}
}
break
;
case
CGM_BACKGROUND
:
c_token
++
;
cgm_background
=
parse_color_name
();
if
(
cgm_user_color_count
==
0
) {
cgm_user_color_count
=
1
;
cgm_user_color_table
=
gp_alloc
(
4
*
sizeof
(
int
),
"CGM color table"
);
cgm_user_color_table
[
0
]
=
0
;
}
cgm_user_color_table
[
1
]
=
cgm_background
>>
16
&
0xff
;
cgm_user_color_table
[
2
]
=
cgm_background
>>
8
&
0xff
;
cgm_user_color_table
[
3
]
=
cgm_background
&
0xff
;
break
;
case
CGM_OTHER
:
default
:
string
=
gp_input_line
+
token
[
c_token
].
start_index
;
/* Silently ignore these, as they are not yet implemented */
if
(
equals
(
c_token
,
"dl"
)
||
almost_equals
(
c_token
,
"dashl$ength"
)) {
c_token
++
;
(
void
)
real_expression
();
break
;
}
if
(
string
[
0
]
==
'x'
) {
/* set color */
unsigned short
red
,
green
,
blue
;
if
(
sscanf
(
string
,
"x%2hx%2hx%2hx"
,
&
red
,
&
green
,
&
blue
)
!=
3
)
int_error
(
c_token
,
"invalid color spec, must be xRRGGBB"
);
if
(
cgm_user_color_count
>=
cgm_user_color_max
) {
cgm_user_color_max
=
cgm_user_color_max
*
2
+
4
;
cgm_user_color_table
=
gp_realloc
(
cgm_user_color_table
,
(
cgm_user_color_max
*
3
+
1
)
*
sizeof
(
int
),
"CGM color table"
);
/* 1st table entry is the minimum color index value */
cgm_user_color_table
[
0
]
=
0
;
}
cgm_user_color_table
[
1
+
3
*
cgm_user_color_count
]
=
red
;
cgm_user_color_table
[
2
+
3
*
cgm_user_color_count
]
=
green
;
cgm_user_color_table
[
3
+
3
*
cgm_user_color_count
]
=
blue
;
cgm_user_color_count
++
;
++
c_token
;
}
else
{
char
*
s
=
NULL
;
if
(
equals
(
c_token
,
"font"
))
c_token
++
;
if
(
isstringvalue
(
c_token
)
&&
(
s
=
try_to_get_string
())) {
double
relwidth
;
int
font_index
;
char
*
comma
=
strchr
(
s
,
','
);
if
(
comma
&&
(
1
==
sscanf
(
comma
+
1
,
"%d"
,
&
cgm_fontsize
)))
*
comma
=
'\0'
;
if
(
*
s
)
font_index
=
CGM_find_font
(
s
,
strlen
(
s
),
&
relwidth
);
else
font_index
=
CGM_find_font
(
cgm_font
,
strlen
(
cgm_font
),
&
relwidth
);
if
(
font_index
==
0
) {
/* insert the font in the font table */
struct
fontdata
*
new_font_data
;
int
i
,
n
;
for
(
n
=
0
;
cgm_font_data
[
n
].
name
;
n
++
)
;
new_font_data
=
gp_alloc
((
n
+
2
)
*
sizeof
(
struct
fontdata
),
"CGM font list"
);
new_font_data
->
name
=
s
;
/* punt, since we don't know the real font width */
new_font_data
->
width
=
1.0
;
for
(
i
=
0
;
i
<=
n
;
i
++
)
new_font_data
[
i
+
1
]
=
cgm_font_data
[
i
];
cgm_font_data
=
new_font_data
;
font_index
=
1
;
}
else
free
(
s
);
safe_strncpy
(
cgm_font
,
cgm_font_data
[
font_index
-
1
].
name
,
sizeof
(
cgm_font
));
}
else
{
/* the user is specifying the font size */
cgm_fontsize
=
int_expression
();
}
break
;
}
}
}
if
(
cgm_portrait
) {
term
->
xmax
=
CGM_SMALL
-
CGM_MARGIN
;
term
->
ymax
=
CGM_LARGE
-
CGM_MARGIN
;
}
else
{
term
->
xmax
=
CGM_LARGE
-
CGM_MARGIN
;
term
->
ymax
=
CGM_SMALL
-
CGM_MARGIN
;
}
{
/* cgm_font, cgm_fontsize, and/or term->v_char may have changed */
double
w
;
CGM_find_font
(
cgm_font
,
strlen
(
cgm_font
),
&
w
);
term
->
v_char
=
(
unsigned
int
) (
cgm_fontsize
*
CGM_PT
);
term
->
h_char
=
(
unsigned
int
) (
cgm_fontsize
*
CGM_PT
*
.527
*
w
);
}
sprintf
(
CGM_default_font
,
"%s,%d"
,
cgm_font
,
cgm_fontsize
);
/* CGM_default_font holds the font and size set at 'set term' */
sprintf
(
term_options
,
"%s %s %s %s %s width %d linewidth %d font \"%s, %d\""
,
cgm_portrait
?
"portrait"
:
"landscape"
,
cgm_monochrome
?
"monochrome"
:
"color"
,
cgm_rotate
?
"rotate"
:
"norotate"
,
cgm_dashed
?
"dashed"
:
"solid"
,
cgm_nofontlist_mode
?
"nofontlist"
:
""
,
cgm_plotwidth
,
cgm_linewidth_pt
,
cgm_font
,
cgm_fontsize
);
if
(
cgm_user_color_count
) {
int
i
,
red
,
green
,
blue
;
for
(
i
=
0
;
i
<
cgm_user_color_count
&&
(
strlen
(
term_options
)
+
9
<
MAX_LINE_LEN
);
i
++
) {
red
=
cgm_user_color_table
[
1
+
3
*
i
];
green
=
cgm_user_color_table
[
2
+
3
*
i
];
blue
=
cgm_user_color_table
[
3
+
3
*
i
];
sprintf
(
term_options
+
strlen
(
term_options
),
" x%02x%02x%02x"
,
red
,
green
,
blue
);
}
}
if
(
cgm_user_color_count
<
CGM_COLORS
) {
int
i
,
j
;
/* fill in colors not set by the user with the default colors */
/* 1st table entry is the minimum color index value */
cgm_user_color_table
=
gp_realloc
(
cgm_user_color_table
,
(
CGM_COLORS
*
3
+
1
)
*
sizeof
(
int
),
"CGM color table"
);
cgm_user_color_table
[
0
]
=
0
;
for
(
i
=
cgm_user_color_count
,
j
=
cgm_user_color_count
*
3
;
i
<
CGM_COLORS
;
i
++
,
j
+=
3
) {
cgm_user_color_table
[
j
+
1
]
=
(
pm3d_color_names_tbl
[
i
].
value
>>
16
)
&
0xff
;
cgm_user_color_table
[
j
+
2
]
=
(
pm3d_color_names_tbl
[
i
].
value
>>
8
)
&
0xff
;
cgm_user_color_table
[
j
+
3
]
=
(
pm3d_color_names_tbl
[
i
].
value
)
&
0xff
;
}
cgm_user_color_count
=
CGM_COLORS
;
}
/* not set if there is an error exit before we reach here */
cgm_initialized
=
TRUE;
}
static
void
CGM_local_reset
()
{
double
w
;
strcpy
(
cgm_font
,
DEFAULT_CGMFONT
);
CGM_find_font
(
cgm_font
,
strlen
(
cgm_font
),
&
w
);
cgm_fontsize
=
12
;
term
->
v_char
=
(
unsigned
int
) (
cgm_fontsize
*
CGM_PT
);
term
->
h_char
=
(
unsigned
int
) (
cgm_fontsize
*
CGM_PT
*
.527
*
w
);
cgm_linewidth_pt
=
1
;
cgm_monochrome
=
FALSE;
cgm_plotwidth
=
6
*
72
;
cgm_portrait
=
FALSE;
cgm_rotate
=
TRUE;
cgm_dashed
=
TRUE;
cgm_nofontlist_mode
=
FALSE;
cgm_current
=
cgm_reset
;
cgm_user_color_count
=
0
;
}
TERM_PUBLIC
void
CGM_init
()
{
cgm_posx
=
cgm_posy
=
0
;
cgm_linetype
=
0
;
cgm_next
.
angle
=
0
;
cgm_next
.
interior_style
=
1
;
cgm_next
.
hatch_index
=
1
;
cgm_polyline
=
gp_alloc
(
CGM_MAX_SEGMENTS
*
sizeof
(
int
),
"cgm polylines"
);
}
TERM_PUBLIC
void
CGM_graphics
()
{
register
struct
termentry
*
t
=
term
;
static
int
version_data
[]
=
{
1
};
static
int
vdc_type_data
[]
=
{
0
};
static
int
integer_precision_data
[]
=
{
16
};
static
int
real_precision_data
[]
=
{
1
,
16
,
16
};
static
int
index_precision_data
[]
=
{
16
};
static
int
color_precision_data
[]
=
{
16
};
static
int
color_index_precision_data
[]
=
{
16
};
static
int
scaling_mode_data
[]
=
{
0
,
0
,
0
};
static
int
color_value_extent_data
[]
=
{
0
,
0
,
0
,
255
,
255
,
255
};
static
int
color_selection_mode_data
[]
=
{
0
};
static
int
linewidth_specification_mode_data
[]
=
{
0
};
static
int
edge_width_specification_mode_data
[]
=
{
0
};
static
int
marker_size_specification_mode_data
[]
=
{
0
};
static
int
vdc_extent_data
[]
=
{
0
,
0
,
0
,
0
};
static
int
line_type_data
[]
=
{
1
};
static
int
interior_style_data
[]
=
{
1
};
/* 0=hollow 1=filled
* 2=pattern 3=hatch
* 4=empty */
static
int
hatch_index_data
[]
=
{
1
};
/* 1=horizontal 2=vertical
* 3=positive slope
* 4=negative slope
* 5=horizontal/vertical
* crosshatch
* 6=positive/negative
* slope crosshatch */
static
int
elements_list_data
[]
=
{
0
,
/* will be set to # elements in this list */
0
,
1
,
/* Begin Metafile */
0
,
2
,
/* End Metafile */
0
,
3
,
/* Begin Picture */
0
,
4
,
/* Begin Picture Body */
0
,
5
,
/* End Picture */
1
,
1
,
/* Metafile Version */
1
,
2
,
/* Metafile Description */
1
,
3
,
/* VDC Type */
1
,
4
,
/* Integer Precision */
1
,
5
,
/* Real Precision */
1
,
6
,
/* Index Precision */
1
,
7
,
/* Color Precision */
1
,
8
,
/* Color Index Precision */
1
,
9
,
/* Maximum Color Index */
1
,
10
,
/* Color Value Extent */
1
,
13
,
/* Font List */
2
,
1
,
/* Scaling Mode */
2
,
2
,
/* Color Selection Mode */
2
,
3
,
/* Line Width Specification Mode */
2
,
4
,
/* Marker Size Specification Mode */
2
,
5
,
/* Edge Width Specification Mode */
2
,
6
,
/* VDC Extent */
#ifdef
NEVER
/* disabled due to complaints from CGM import filters */
3
,
1
,
/* VDC Integer Precision */
3
,
4
,
/* Transparency */
3
,
6
,
/* Clip Indicator */
#endif
4
,
1
,
/* Polyline */
4
,
3
,
/* Polymarker */
4
,
4
,
/* Text */
4
,
7
,
/* Polygon */
4
,
11
,
/* Rectangle */
4
,
12
,
/* Circle */
4
,
15
,
/* Circular Arc Center */
4
,
16
,
/* Circular Arc Center Close */
4
,
17
,
/* Ellipse */
4
,
18
,
/* Elliptical Arc */
4
,
19
,
/* Elliptical Arc Close */
5
,
2
,
/* Line Type */
5
,
3
,
/* Line Width */
5
,
4
,
/* Line Color */
5
,
6
,
/* Marker Type */
5
,
7
,
/* Marker Size */
5
,
8
,
/* Marker Color */
5
,
10
,
/* Text Font Index */
5
,
14
,
/* Text Color */
5
,
15
,
/* Character Height */
5
,
16
,
/* Character Orientation */
5
,
18
,
/* Text Alignment */
5
,
22
,
/* Interior Style */
5
,
23
,
/* Fill Color */
5
,
24
,
/* Hatch Index */
5
,
27
,
/* Edge Type */
5
,
28
,
/* Edge Width */
5
,
29
,
/* Edge Color */
5
,
30
,
/* Edge Visibility */
5
,
34
,
/* Color Table */
6
,
1
,
/* Escape */
7
,
2
/* Application Data */
};
if
(!
cgm_initialized
)
int_error
(
NO_CARET
,
"cgm terminal initialization failed"
);
/* metafile description (class 1), including filename if available */
if
(!
outstr
)
CGM_write_char_record
(
0
,
1
,
1
,
outstr
);
else
CGM_write_char_record
(
0
,
1
,
strlen
(
outstr
)
+
1
,
outstr
);
CGM_write_int_record
(
1
,
1
,
2
,
version_data
);
{
char
description_data
[
256
];
sprintf
(
description_data
,
"\
Gnuplot version %s patchlevel %s,\
Computer Graphics Metafile version 1 per MIL-D-28003A/BASIC-1.%d"
,
gnuplot_version
,
gnuplot_patchlevel
,
cgm_monochrome
?
0
:
2
);
CGM_write_char_record
(
1
,
2
,
strlen
(
description_data
),
description_data
);
}
elements_list_data
[
0
]
=
(
sizeof
(
elements_list_data
) /
CGM_ADJ
-
2
) /
4
;
CGM_write_int_record
(
1
,
11
,
sizeof
(
elements_list_data
) /
CGM_ADJ
,
elements_list_data
);
CGM_write_int_record
(
1
,
3
,
2
,
vdc_type_data
);
CGM_write_int_record
(
1
,
4
,
2
,
integer_precision_data
);
CGM_write_int_record
(
1
,
5
,
6
,
real_precision_data
);
CGM_write_int_record
(
1
,
6
,
2
,
index_precision_data
);
CGM_write_int_record
(
1
,
7
,
2
,
color_precision_data
);
CGM_write_int_record
(
1
,
8
,
2
,
color_index_precision_data
);
CGM_write_int_record
(
1
,
9
,
2
,
&
cgm_maximum_color_index
);
CGM_write_int_record
(
1
,
10
,
sizeof
(
color_value_extent_data
) /
CGM_ADJ
,
color_value_extent_data
);
if
(
cgm_nofontlist_mode
==
FALSE)
{
char
*
buf
,
*
s
;
int
i
,
lgh
=
0
;
for
(
i
=
0
;
cgm_font_data
[
i
].
name
;
i
++
)
lgh
+=
strlen
(
cgm_font_data
[
i
].
name
)
+
1
;
buf
=
gp_alloc
(
lgh
+
1
,
"CGM font list"
);
for
(
s
=
buf
,
i
=
0
;
cgm_font_data
[
i
].
name
;
i
++
)
{
int
lgh
=
strlen
(
cgm_font_data
[
i
].
name
);
*
s
++
=
(
char
)
lgh
;
strcpy
(
s
,
cgm_font_data
[
i
].
name
);
s
+=
lgh
;
}
CGM_write_byte_record
(
1
,
13
,
lgh
,
buf
);
free
(
buf
);
}
/* picture description (classes 2 and 3) */
CGM_write_char_record
(
0
,
3
,
8
,
"PICTURE1"
);
CGM_write_int_record
(
2
,
1
,
6
,
scaling_mode_data
);
CGM_write_int_record
(
2
,
2
,
2
,
color_selection_mode_data
);
CGM_write_int_record
(
2
,
3
,
2
,
linewidth_specification_mode_data
);
CGM_write_int_record
(
2
,
4
,
2
,
marker_size_specification_mode_data
);
CGM_write_int_record
(
2
,
5
,
2
,
edge_width_specification_mode_data
);
vdc_extent_data
[
2
]
=
t
->
xmax
+
CGM_MARGIN
;
vdc_extent_data
[
3
]
=
t
->
ymax
+
CGM_MARGIN
;
CGM_write_int_record
(
2
,
6
,
8
,
vdc_extent_data
);
/* picture body (classes 4 and 5) */
CGM_write_int_record
(
0
,
4
,
0
,
NULL
);
#ifdef
NEVER
/* no need for these, since we accept the defaults */
{
static
int
vdc_integer_precision_data
[]
=
{
16
};
CGM_write_int_record
(
3
,
1
,
2
,
vdc_integer_precision_data
);
}
{
static
int
transparency_data
[]
=
{
1
};
/* text background:
0=auxiliary color
1=transparent */
CGM_write_int_record
(
3
,
4
,
sizeof
(
transparency_data
) /
CGM_ADJ
,
transparency_data
);
}
{
static
int
clip_indicator_data
[]
=
{
0
};
CGM_write_int_record
(
3
,
6
,
sizeof
(
clip_indicator_data
) /
CGM_ADJ
,
clip_indicator_data
);
}
#endif
if
(!
cgm_monochrome
)
CGM_write_int_record
(
5
,
34
, (
cgm_user_color_count
*
3
+
1
)
*
sizeof
(
cgm_user_color_table
[
0
])/
CGM_ADJ
,
cgm_user_color_table
);
CGM_write_int_record
(
5
,
2
,
sizeof
(
line_type_data
) /
CGM_ADJ
,
line_type_data
);
/* line type 1=SOLID */
cgm_linewidth
=
cgm_linewidth_pt
*
CGM_PT
;
CGM_write_int_record
(
5
,
3
,
sizeof
(
cgm_linewidth
) /
CGM_ADJ
,
(
int
*
)
&
cgm_linewidth
);
/* line width */
CGM_write_int_record
(
5
,
28
,
sizeof
(
cgm_linewidth
) /
CGM_ADJ
,
(
int
*
)
&
cgm_linewidth
);
/* edge width */
CGM_write_int_record
(
5
,
27
,
sizeof
(
line_type_data
) /
CGM_ADJ
,
line_type_data
);
/* edge type 1=SOLID */
CGM_linecolor
(
0
);
cgm_current
=
cgm_reset
;
cgm_next
.
char_height
=
t
->
v_char
;
CGM_write_int_record
(
5
,
22
,
2
,
interior_style_data
);
CGM_write_int_record
(
5
,
24
,
2
,
hatch_index_data
);
{
char
buf
[
45
];
sprintf
(
buf
,
"%.31s,%d"
,
cgm_font
,
cgm_fontsize
);
CGM_set_font
(
buf
);
}
CGM_set_pointsize
(
pointsize
);
/* Fill with background color if user has specified one */
if
(!
cgm_monochrome
&&
cgm_user_color_count
>
0
) {
CGM_linecolor
(
LT_BACKGROUND
);
CGM_fillbox
(
FS_SOLID
,
0
,
0
,
t
->
xmax
,
t
->
ymax
);
}
}
/* Return the index for the font with the name `name'. The index for
the first font is 1. Set relwidth to the width of the font,
relative to Times Bold Italic. If the font is not in the table,
set *relwidth to 1.0 and return 0. */
static
int
CGM_find_font
(
const
char
*
name
,
int
numchar
,
double
*
relwidth
)
{
int
i
;
*
relwidth
=
1.
;
for
(
i
=
0
;
cgm_font_data
[
i
].
name
;
i
++
)
/* strncasecmp is not standard, but defined by stdfn.c if not available */
if
(
strlen
(
cgm_font_data
[
i
].
name
)
==
numchar
&&
strncasecmp
(
name
,
cgm_font_data
[
i
].
name
,
numchar
)
==
0
)
{
*
relwidth
=
cgm_font_data
[
i
].
width
;
return
i
+
1
;
}
return
0
;
}
TERM_PUBLIC
int
CGM_set_font
(
const
char
*
font
)
{
register
struct
termentry
*
t
=
term
;
int
size
,
font_index
;
char
*
comma
=
strchr
(
font
,
','
);
int
len
;
double
width
;
/* Allow null string to indicaute default font */
if
(!
font
||
!(
*
font
))
font
=
CGM_default_font
;
/* find font in font table, or use 1st font */
if
(
comma
)
len
=
comma
-
font
;
else
len
=
strlen
(
font
);
font_index
=
CGM_find_font
(
font
,
len
,
&
width
);
if
(
font_index
==
0
)
font_index
=
1
;
cgm_next
.
font_index
=
font_index
;
{
char
*
s
=
cgm_font_data
[
font_index
-
1
].
name
;
safe_strncpy
(
cgm_font
,
s
,
sizeof
(
cgm_font
));
}
/* set font size */
size
=
cgm_fontsize
;
if
(
comma
)
sscanf
(
comma
+
1
,
"%d"
,
&
size
);
if
(
size
>
0
) {
t
->
v_char
=
size
*
CGM_PT
;
t
->
h_char
=
size
*
CGM_PT
*
.527
*
width
;
}
cgm_next
.
char_height
=
t
->
v_char
;
return
TRUE;
}
TERM_PUBLIC
void
CGM_text
()
{
CGM_flush_polyline
();
CGM_write_int_record
(
0
,
5
,
0
,
NULL
);
/* end picture */
CGM_write_int_record
(
0
,
2
,
0
,
NULL
);
/* end metafile */
}
TERM_PUBLIC
void
CGM_linetype
(
int
linetype
)
{
if
(
linetype
<
LT_NODRAW
)
linetype
=
LT_NODRAW
;
if
(
linetype
==
cgm_linetype
)
return
;
cgm_linetype
=
linetype
;
CGM_linecolor
(
linetype
);
if
(
cgm_dashed
) {
CGM_dashtype
(
linetype
);
/* DBT 10-8-98 use dashes */
}
else
{
/* dashes for gridlines, solid for everything else */
CGM_dashtype
(
linetype
==
-1
?
2
:
0
);
}
}
TERM_PUBLIC
void
CGM_linecolor
(
int
linecolor
)
{
if
(
linecolor
>=
0
) {
/* subtract 2 due to linetypes -2 / -1 */
if
(
cgm_linetypes
>
3
)
linecolor
%= (
cgm_linetypes
-
3
);
else
linecolor
=
0
;
}
else
if
(
linecolor
==
LT_BACKGROUND
&&
!
cgm_monochrome
) {
linecolor
=
-3
;
}
else
if
(
linecolor
<=
LT_NODRAW
)
return
;
linecolor
+=
3
;
if
(
cgm_monochrome
)
cgm_color
=
linecolor
=
1
;
if
(
linecolor
==
cgm_color
)
return
;
cgm_color
=
linecolor
;
cgm_next
.
fill_color
=
linecolor
;
CGM_flush_polyline
();
CGM_write_int_record
(
5
,
4
,
2
, (
int
*
)
&
cgm_color
);
/* line color */
CGM_write_int_record
(
5
,
14
,
2
, (
int
*
)
&
cgm_color
);
/* text color */
}
TERM_PUBLIC
void
CGM_fillbox
(
int
style
,
unsigned
int
x1
,
unsigned
int
y1
,
unsigned
int
width
,
unsigned
int
height
)
{
gpiPoint
corner
[
5
];
corner
[
0
].
x
=
x1
;
corner
[
0
].
y
=
y1
;
corner
[
1
].
x
=
x1
+
width
;
corner
[
1
].
y
=
y1
;
corner
[
2
].
x
=
x1
+
width
;
corner
[
2
].
y
=
y1
+
height
;
corner
[
3
].
x
=
x1
;
corner
[
3
].
y
=
y1
+
height
;
corner
[
4
].
x
=
x1
;
corner
[
4
].
y
=
y1
;
corner
->
style
=
style
;
CGM_filled_polygon
(
5
,
corner
);
}
TERM_PUBLIC
void
CGM_linewidth
(
double
width
)
{
int
new_linewidth
;
if
(
width
<=
0
)
width
=
0.5
;
new_linewidth
=
width
*
cgm_linewidth_pt
*
CGM_PT
;
if
(
new_linewidth
==
cgm_linewidth
)
return
;
CGM_flush_polyline
();
cgm_linewidth
=
new_linewidth
;
CGM_write_int_record
(
5
,
3
,
sizeof
(
cgm_linewidth
) /
CGM_ADJ
,
(
int
*
)
&
cgm_linewidth
);
CGM_dashtype
(
cgm_dashtype
);
/* have dash lengths recalculated */
}
TERM_PUBLIC
void
CGM_dashtype
(
int
dashtype
)
{
int
i
,
j
;
/* Each group of 8 entries in dot_length[] defines a dash
pattern. Entries in each group are alternately length of
whitespace and length of line, in units of 2/3 of the
linewidth. */
static
int
dot_length
[
CGM_LINE_TYPES
*
8
]
=
{
/* 0 - solid */
5
,
8
,
5
,
8
,
5
,
8
,
5
,
8
,
/* 1 - dashes */
5
,
3
,
5
,
3
,
5
,
3
,
5
,
3
,
/* 2 - short dashes */
4
,
1
,
4
,
1
,
4
,
1
,
4
,
1
,
/* 3 - dotted */
4
,
8
,
4
,
1
,
4
,
8
,
4
,
1
,
/* 4 - dash-dot */
4
,
9
,
4
,
1
,
4
,
1
,
0
,
0
,
/* 5 - dash-dot-dot */
4
,
10
,
4
,
1
,
4
,
1
,
4
,
1
,
/* 6 - dash-dot-dot-dot */
4
,
10
,
4
,
10
,
4
,
1
,
0
,
0
,
/* 7 - dash-dash-dot */
4
,
10
,
4
,
10
,
4
,
1
,
4
,
1
};
/* 8 - dash-dash-dot-dot */
if
(
dashtype
==
cgm_dashtype
)
return
;
cgm_dashtype
=
dashtype
;
CGM_flush_polyline
();
if
(
dashtype
>=
CGM_LINE_TYPES
)
dashtype
=
dashtype
%
CGM_LINE_TYPES
;
if
(
dashtype
<
1
) {
term
->
vector
=
CGM_solid_vector
;
return
;
}
term
->
vector
=
CGM_dashed_vector
;
/* set up dash dimensions */
j
=
(
dashtype
-
1
)
*
8
;
for
(
i
=
0
;
i
<
8
;
i
++
,
j
++
) {
if
(
dot_length
[
j
])
cgm_step_sizes
[
i
]
=
(
dot_length
[
j
]
*
cgm_linewidth
)
*
2
/
3
;
else
cgm_step_sizes
[
i
]
=
0
;
}
/* first thing drawn will be a line */
cgm_step
=
cgm_step_sizes
[
1
];
cgm_step_index
=
1
;
}
TERM_PUBLIC
void
CGM_move
(
unsigned
int
x
,
unsigned
int
y
)
{
if
(
x
>=
term
->
xmax
)
x
=
term
->
xmax
;
if
(
y
>=
term
->
ymax
)
y
=
term
->
ymax
;
if
(
x
==
cgm_posx
&&
y
==
cgm_posy
)
return
;
CGM_flush_polyline
();
cgm_posx
=
x
;
cgm_posy
=
y
;
}
TERM_PUBLIC
int
View remainder of file in raw view
Back
|
FazBrowse Home
|
New Git URL