~ubuntu-branches/ubuntu/hardy/ghostscript/hardy

« back to all changes in this revision

Viewing changes to src/gdevcgml.c

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2007-11-22 12:17:43 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20071122121743-cd70s3ypq0r243mp
Tags: 8.61.dfsg.1-0ubtuntu1
* New upstream release
  o Final 8.61 release
* debian/patches/09_ijs_krgb_support.dpatch: Adapted to upstream changes.
* debian/rules: Updated CUPS-related variables for "make install" calls.
* debian/rules: Remove /usr/include/ghostscript from the ghostscript
  package, they go into lings-dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
   or contact Artifex Software, Inc.,  7 Mt. Lassen Drive - Suite A-134,
11
11
   San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.
12
12
*/
13
 
/* $Id: gdevcgml.c 8022 2007-06-05 22:23:38Z giles $ */
 
13
/* $Id: gdevcgml.c 8250 2007-09-25 13:31:24Z giles $ */
14
14
/* CGM-writing library */
15
15
#include "memory_.h"
16
16
#include "stdio_.h"
17
17
#include "gdevcgmx.h"
18
18
 
19
19
/* Forward references to command-writing procedures */
20
 
private void begin_command(cgm_state *, cgm_op_index);
 
20
static void begin_command(cgm_state *, cgm_op_index);
21
21
 
22
22
#define OP(op) begin_command(st, op)
23
 
private cgm_result end_command(cgm_state *);
 
23
static cgm_result end_command(cgm_state *);
24
24
 
25
25
#define END_OP (void)end_command(st)
26
26
#define DONE return end_command(st)
27
27
/* Parameters */
28
 
private void put_int(cgm_state *, cgm_int, int);
 
28
static void put_int(cgm_state *, cgm_int, int);
29
29
 
30
30
#define CI(ci) put_int(st, ci, st->metafile.color_index_precision)
31
31
#define I(i) put_int(st, i, st->metafile.integer_precision)
32
32
#define IX(ix) put_int(st, ix, st->metafile.index_precision)
33
33
#define E(e) put_int(st, (int)(e), 16)
34
 
private void put_real(cgm_state *, cgm_real, const cgm_precision *);
 
34
static void put_real(cgm_state *, cgm_real, const cgm_precision *);
35
35
 
36
36
#define R(r) put_real(st, r, &st->metafile.real_precision)
37
 
private void put_vdc(cgm_state *, const cgm_vdc *);
 
37
static void put_vdc(cgm_state *, const cgm_vdc *);
38
38
 
39
39
#define VDC(vdc) put_vdc(st, vdc)
40
40
#define VDC2(vdc1, vdc2) VDC(vdc1); VDC(vdc2)
41
41
#define VDC4(vdc1, vdc2, vdc3, vdc4) VDC2(vdc1, vdc2); VDC2(vdc3, vdc4)
42
 
private void put_vdc_r(cgm_state *, const cgm_line_marker_extent *, cgm_line_marker_specification_mode);
 
42
static void put_vdc_r(cgm_state *, const cgm_line_marker_extent *, cgm_line_marker_specification_mode);
43
43
 
44
44
#define VDC_R(vdcr, mode) put_vdc_r(st, vdcr, mode)
45
 
private void put_point(cgm_state *, const cgm_point *);
 
45
static void put_point(cgm_state *, const cgm_point *);
46
46
 
47
47
#define P(p) put_point(st, p)
48
 
private void put_points(cgm_state *, const cgm_point *, int);
 
48
static void put_points(cgm_state *, const cgm_point *, int);
49
49
 
50
50
#define nP(p, n) put_points(st, p, n)
51
 
private void put_string(cgm_state *, const char *, uint);
 
51
static void put_string(cgm_state *, const char *, uint);
52
52
 
53
53
#define S(s, l) put_string(st, s, l)
54
 
private void put_color(cgm_state *, const cgm_color *);
 
54
static void put_color(cgm_state *, const cgm_color *);
55
55
 
56
56
#define CO(co) put_color(st, co)
57
 
private void put_rgb(cgm_state *, const cgm_rgb *);
 
57
static void put_rgb(cgm_state *, const cgm_rgb *);
58
58
 
59
59
#define CD(cd) put_rgb(st, cd)
60
60
/* Other data types */
61
61
#define put_byte(st, b)\
62
62
  if ( st->command_count == command_max_count ) write_command(st, false);\
63
63
  st->command[st->command_count++] = (byte)(b)
64
 
private void put_bytes(cgm_state *, const byte *, uint);
65
 
private void write_command(cgm_state *, bool);
66
 
private void put_real_precision(cgm_state *, const cgm_precision *);
 
64
static void put_bytes(cgm_state *, const byte *, uint);
 
65
static void write_command(cgm_state *, bool);
 
66
static void put_real_precision(cgm_state *, const cgm_precision *);
67
67
 
68
68
/* ================ Public routines ================ */
69
69
 
943
943
/* ================ Internal routines ================ */
944
944
 
945
945
/* Begin a command. */
946
 
private void
 
946
static void
947
947
begin_command(cgm_state * st, cgm_op_index op)
948
948
{
949
949
    uint op_word = (uint) op << cgm_op_id_shift;
957
957
 
958
958
/* Write the buffer for a partial command. */
959
959
/* Note that we always write an even number of bytes. */
960
 
private void
 
960
static void
961
961
write_command(cgm_state * st, bool last)
962
962
{
963
963
    byte *command = st->command;
993
993
}
994
994
 
995
995
/* End a command. */
996
 
private cgm_result
 
996
static cgm_result
997
997
end_command(cgm_state * st)
998
998
{
999
999
    write_command(st, true);
1001
1001
}
1002
1002
 
1003
1003
/* Put an integer value. */
1004
 
private void
 
1004
static void
1005
1005
put_int(cgm_state * st, cgm_int value, int precision)
1006
1006
{
1007
1007
    switch (precision) {
1017
1017
}
1018
1018
 
1019
1019
/* Put a real value. */
1020
 
private void
 
1020
static void
1021
1021
put_real(cgm_state * st, cgm_real value, const cgm_precision * pr)
1022
1022
{
1023
1023
    if (pr->representation == cgm_representation_floating) {
1044
1044
}
1045
1045
 
1046
1046
/* Put a real precision. */
1047
 
private void
 
1047
static void
1048
1048
put_real_precision(cgm_state * st, const cgm_precision * precision)
1049
1049
{
1050
1050
    I((int)precision->representation);
1053
1053
}
1054
1054
 
1055
1055
/* Put a VDC. */
1056
 
private void
 
1056
static void
1057
1057
put_vdc(cgm_state * st, const cgm_vdc * pvdc)
1058
1058
{
1059
1059
    if (st->metafile.vdc_type == cgm_vdc_integer)
1063
1063
}
1064
1064
 
1065
1065
/* Put a VDC or a real. */
1066
 
private void
 
1066
static void
1067
1067
put_vdc_r(cgm_state * st, const cgm_line_marker_extent * extent,
1068
1068
          cgm_line_marker_specification_mode mode)
1069
1069
{
1074
1074
}
1075
1075
 
1076
1076
/* Put a point (pair of VDCs). */
1077
 
private void
 
1077
static void
1078
1078
put_point(cgm_state * st, const cgm_point * ppt)
1079
1079
{
1080
1080
    if (st->metafile.vdc_type == cgm_vdc_integer) {
1087
1087
}
1088
1088
 
1089
1089
/* Put a list of points. */
1090
 
private void
 
1090
static void
1091
1091
put_points(cgm_state * st, const cgm_point * ppt, int count)
1092
1092
{
1093
1093
    int i;
1097
1097
}
1098
1098
 
1099
1099
/* Put bytes. */
1100
 
private void
 
1100
static void
1101
1101
put_bytes(cgm_state * st, const byte * data, uint length)
1102
1102
{
1103
1103
    int count;
1114
1114
}
1115
1115
 
1116
1116
/* Put a string. */
1117
 
private void
 
1117
static void
1118
1118
put_string(cgm_state * st, const char *data, uint length)
1119
1119
{                               /* The CGM specification seems to imply that the continuation */
1120
1120
    /* mechanism for commands and the mechanism for strings */
1133
1133
}
1134
1134
 
1135
1135
/* Put a color. */
1136
 
private void
 
1136
static void
1137
1137
put_color(cgm_state * st, const cgm_color * color)
1138
1138
{
1139
1139
    if (st->picture.color_selection_mode == cgm_color_selection_indexed)
1143
1143
}
1144
1144
 
1145
1145
/* Put an RGB value. */
1146
 
private void
 
1146
static void
1147
1147
put_rgb(cgm_state * st, const cgm_rgb * rgb)
1148
1148
{
1149
1149
    put_int(st, rgb->r, st->metafile.color_precision);