summaryrefslogtreecommitdiff
path: root/gs/src/gsparams.c
diff options
context:
space:
mode:
authorHenry Stiles <henry.stiles@artifex.com>1999-05-24 20:03:13 +0000
committerHenry Stiles <henry.stiles@artifex.com>1999-05-24 20:03:13 +0000
commit5e99d00db40250c4aec92e2e7ecaf51f629540ae (patch)
treec59a16131c363a845609bb0786adc205d3f6fddc /gs/src/gsparams.c
parent7ddfba499458819bf0dbf297b084f8b5b51b8690 (diff)
downloadghostpdl-5e99d00db40250c4aec92e2e7ecaf51f629540ae.tar.gz
initial gs5.84 checkin with pcl and xl compiling.
git-svn-id: http://svn.ghostscript.com/ghostpcl/trunk/ghostpcl@857 06663e23-700e-0410-b217-a244a6096597
Diffstat (limited to 'gs/src/gsparams.c')
-rw-r--r--gs/src/gsparams.c104
1 files changed, 53 insertions, 51 deletions
diff --git a/gs/src/gsparams.c b/gs/src/gsparams.c
index 6e40f06d6..80fdbd6ad 100644
--- a/gs/src/gsparams.c
+++ b/gs/src/gsparams.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Aladdin Enterprises. All rights reserved.
+/* Copyright (C) 1998, 1999 Aladdin Enterprises. All rights reserved.
This file is part of Aladdin Ghostscript.
@@ -20,6 +20,8 @@
/* Generic parameter list serializer & expander */
/* Initial version 2/1/98 by John Desrosiers (soho@crl.com) */
+/* 11/16/98 L. Peter Deutsch (ghost@aladdin.com) edited to remove names
+ put_bytes, put_word which conflicted with other modules */
#include "gx.h"
#include "memory_.h"
@@ -35,32 +37,32 @@ typedef struct {
/* ---------- Forward refs ----------- */
private void
- align_to(P2(
- const byte ** src, /* pointer to align */
- unsigned alignment /* alignment, must be power of 2 */
- ));
+ptr_align_to(P2(
+ const byte ** src, /* pointer to align */
+ unsigned alignment /* alignment, must be power of 2 */
+ ));
private void
- put_word(P2(
- unsigned source, /* number to put to buffer */
- WriteBuffer * dest /* destination descriptor */
- ));
+wb_put_word(P2(
+ unsigned source, /* number to put to buffer */
+ WriteBuffer * dest /* destination descriptor */
+ ));
private void
- put_bytes(P3(
- const byte * source, /* bytes to put to buffer */
- unsigned source_sizeof, /* # bytes to put */
- WriteBuffer * dest /* destination descriptor */
- ));
+wb_put_bytes(P3(
+ const byte * source, /* bytes to put to buffer */
+ unsigned source_sizeof, /* # bytes to put */
+ WriteBuffer * dest /* destination descriptor */
+ ));
private void
- put_alignment(P2(
- unsigned alignment, /* alignment to match, must be power 2 */
- WriteBuffer * dest /* destination descriptor */
- ));
+wb_put_alignment(P2(
+ unsigned alignment, /* alignment to match, must be power 2 */
+ WriteBuffer * dest /* destination descriptor */
+ ));
-/* Get word compressed with put_word */
+/* Get word compressed with wb_put_word */
private unsigned /* decompressed word */
- get_word(P1(
- const byte ** src /* UPDATES: ptr to src buf ptr */
- ));
+buf_get_word(P1(
+ const byte ** src /* UPDATES: ptr to src buf ptr */
+ ));
/* ------------ Serializer ------------ */
@@ -131,9 +133,9 @@ gs_param_list_serialize(
code = code > 0 ? gs_note_error(gs_error_unknownerror) : code;
break;
}
- put_word((unsigned)key.size + 1, &write_buf);
- put_word((unsigned)value.type, &write_buf);
- put_bytes((byte *) string_key, key.size + 1, &write_buf);
+ wb_put_word((unsigned)key.size + 1, &write_buf);
+ wb_put_word((unsigned)value.type, &write_buf);
+ wb_put_bytes((byte *) string_key, key.size + 1, &write_buf);
/* Put value & its size to buffer */
value_top_sizeof = gs_param_type_sizes[value.type];
@@ -144,26 +146,26 @@ gs_param_list_serialize(
case gs_param_type_int:
case gs_param_type_long:
case gs_param_type_float:
- put_bytes((byte *) & value.value, value_top_sizeof, &write_buf);
+ wb_put_bytes((byte *) & value.value, value_top_sizeof, &write_buf);
break;
case gs_param_type_string:
case gs_param_type_name:
case gs_param_type_int_array:
case gs_param_type_float_array:
- put_bytes((byte *) & value.value, value_top_sizeof, &write_buf);
- put_alignment(value_base_sizeof, &write_buf);
+ wb_put_bytes((byte *) & value.value, value_top_sizeof, &write_buf);
+ wb_put_alignment(value_base_sizeof, &write_buf);
value_base_sizeof *= value.value.s.size;
- put_bytes(value.value.s.data, value_base_sizeof, &write_buf);
+ wb_put_bytes(value.value.s.data, value_base_sizeof, &write_buf);
break;
case gs_param_type_string_array:
case gs_param_type_name_array:
value_base_sizeof *= value.value.sa.size;
- put_bytes((const byte *)&value.value, value_top_sizeof, &write_buf);
- put_alignment(sizeof(void *), &write_buf);
+ wb_put_bytes((const byte *)&value.value, value_top_sizeof, &write_buf);
+ wb_put_alignment(sizeof(void *), &write_buf);
- put_bytes((const byte *)value.value.sa.data, value_base_sizeof,
+ wb_put_bytes((const byte *)value.value.sa.data, value_base_sizeof,
&write_buf);
{
int str_count;
@@ -171,14 +173,14 @@ gs_param_list_serialize(
for (str_count = value.value.sa.size,
sa = value.value.sa.data; str_count-- > 0; ++sa)
- put_bytes(sa->data, sa->size, &write_buf);
+ wb_put_bytes(sa->data, sa->size, &write_buf);
}
break;
case gs_param_type_dict:
case gs_param_type_dict_int_keys:
- put_word(value.value.d.size, &write_buf);
- put_alignment(sizeof(void *), &write_buf);
+ wb_put_word(value.value.d.size, &write_buf);
+ wb_put_alignment(sizeof(void *), &write_buf);
{
int bytes_written =
@@ -194,7 +196,7 @@ gs_param_list_serialize(
else {
code = temp_code;
if (bytes_written)
- put_bytes(write_buf.buf, bytes_written, &write_buf);
+ wb_put_bytes(write_buf.buf, bytes_written, &write_buf);
}
}
break;
@@ -209,7 +211,7 @@ gs_param_list_serialize(
/* Write end marker, which is an (illegal) 0 key length */
if (code >= 0) {
- put_word(0, &write_buf);
+ wb_put_word(0, &write_buf);
code = write_buf.total_sizeof;
}
return code;
@@ -238,12 +240,12 @@ gs_param_list_unserialize(
gs_param_type type;
/* key length, 0 indicates end of data */
- key_sizeof = get_word(&buf);
+ key_sizeof = buf_get_word(&buf);
if (key_sizeof == 0) /* end of data */
break;
/* data type */
- type = (gs_param_type) get_word(&buf);
+ type = (gs_param_type) buf_get_word(&buf);
/* key */
key = (gs_param_name) buf;
@@ -269,7 +271,7 @@ gs_param_list_unserialize(
case gs_param_type_name:
case gs_param_type_int_array:
case gs_param_type_float_array:
- align_to(&buf, value_base_sizeof);
+ ptr_align_to(&buf, value_base_sizeof);
typed.value.s.data = buf;
typed.value.s.persistent = false;
buf += typed.value.s.size * value_base_sizeof;
@@ -277,7 +279,7 @@ gs_param_list_unserialize(
case gs_param_type_string_array:
case gs_param_type_name_array:
- align_to(&buf, sizeof(void *));
+ ptr_align_to(&buf, sizeof(void *));
typed.value.sa.data = (const gs_param_string *)buf;
typed.value.sa.persistent = false;
@@ -298,12 +300,12 @@ gs_param_list_unserialize(
case gs_param_type_dict:
case gs_param_type_dict_int_keys:
- typed.value.d.size = get_word(&buf);
+ typed.value.d.size = buf_get_word(&buf);
code = param_begin_write_dict
(list, key, &typed.value.d, type == gs_param_type_dict_int_keys);
if (code < 0)
break;
- align_to(&buf, sizeof(void *));
+ ptr_align_to(&buf, sizeof(void *));
code = gs_param_list_unserialize(typed.value.d.list, buf);
temp_code = param_end_write_dict(list, key, &typed.value.d);
@@ -332,17 +334,17 @@ gs_param_list_unserialize(
/* Align a byte pointer on the next Nth byte */
private void
-align_to(
+ptr_align_to(
const byte ** src, /* pointer to align */
unsigned alignment /* alignment, must be power of 2 */
)
{
- *src += -(int)alignment_mod(*src, alignment) & (alignment - 1);
+ *src += -(int)ALIGNMENT_MOD(*src, alignment) & (alignment - 1);
}
/* Put compressed word repr to a buffer */
private void
-put_word(
+wb_put_word(
unsigned source, /* number to put to buffer */
WriteBuffer * dest /* destination descriptor */
)
@@ -362,7 +364,7 @@ put_word(
/* Put array of bytes to buffer */
private void
-put_bytes(
+wb_put_bytes(
const byte * source, /* bytes to put to buffer */
unsigned source_sizeof, /* # bytes to put */
WriteBuffer * dest /* destination descriptor */
@@ -378,7 +380,7 @@ put_bytes(
/* Pad destination out to req'd alignment w/zeros */
private void
-put_alignment(
+wb_put_alignment(
unsigned alignment, /* alignment to match, must be power 2 */
WriteBuffer * dest /* destination descriptor */
)
@@ -387,12 +389,12 @@ put_alignment(
{0};
while ((dest->total_sizeof & (alignment - 1)) != 0)
- put_bytes(&zero, 1, dest);
+ wb_put_bytes(&zero, 1, dest);
}
-/* Get word compressed with put_word */
+/* Get word compressed with wb_put_word */
private unsigned /* decompressed word */
-get_word(
+buf_get_word(
const byte ** src /* UPDATES: ptr to src buf ptr */
)
{