Skip to content

Commit

Permalink
Remove deprecated (and mainly unused) "representation" concept.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.parrot.org/parrot/branches/strings@35349 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
simon committed Jan 10, 2009
1 parent e3175e5 commit 7fcd2ef
Show file tree
Hide file tree
Showing 16 changed files with 65 additions and 125 deletions.
4 changes: 0 additions & 4 deletions docs/pdds/pdd28_strings.pod
Original file line number Diff line number Diff line change
Expand Up @@ -564,10 +564,6 @@ the encoding by the number of characters requested.

The following string functions are slated to be deprecated.

=head3 string_primary_encoding_for_representation

Not useful, it only ever returned ASCII.

=head3 string_rep_compatible

Only useful on a very narrow set of string encodings/character sets.
Expand Down
78 changes: 39 additions & 39 deletions include/parrot/packfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,34 @@ INTVAL PackFile_add_segment(SHIM_INTERP,
__attribute__nonnull__(3)
FUNC_MODIFIES(*dir);

PARROT_EXPORT
void PackFile_Annotations_add_entry(PARROT_INTERP,
ARGMOD(struct PackFile_Annotations *self),
opcode_t offset,
opcode_t key,
opcode_t type,
opcode_t value)
__attribute__nonnull__(1)
__attribute__nonnull__(2)
FUNC_MODIFIES(*self);

PARROT_EXPORT
void PackFile_Annotations_add_group(PARROT_INTERP,
ARGMOD(struct PackFile_Annotations *self),
opcode_t offset)
__attribute__nonnull__(1)
__attribute__nonnull__(2)
FUNC_MODIFIES(*self);

PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
PackFile_Segment * PackFile_Annotations_new(PARROT_INTERP,
ARGIN(struct PackFile *pf),
SHIM(const char *name),
NULLOK(int add))
__attribute__nonnull__(1)
__attribute__nonnull__(2);

PARROT_EXPORT
void PackFile_Constant_destroy(SHIM_INTERP,
ARGMOD_NULLOK(PackFile_Constant *self))
Expand Down Expand Up @@ -686,25 +714,6 @@ void default_dump_header(PARROT_INTERP, ARGIN(const PackFile_Segment *self))
void mark_const_subs(PARROT_INTERP)
__attribute__nonnull__(1);

PARROT_EXPORT
void PackFile_Annotations_add_entry(PARROT_INTERP,
ARGMOD(struct PackFile_Annotations *self),
opcode_t offset,
opcode_t key,
opcode_t type,
opcode_t value)
__attribute__nonnull__(1)
__attribute__nonnull__(2)
FUNC_MODIFIES(*self);

PARROT_EXPORT
void PackFile_Annotations_add_group(PARROT_INTERP,
ARGMOD(struct PackFile_Annotations *self),
opcode_t offset)
__attribute__nonnull__(1)
__attribute__nonnull__(2)
FUNC_MODIFIES(*self);

void PackFile_Annotations_destroy(SHIM_INTERP,
ARGMOD(struct PackFile_Segment *seg))
__attribute__nonnull__(2)
Expand All @@ -723,15 +732,6 @@ PMC * PackFile_Annotations_lookup(PARROT_INTERP,
__attribute__nonnull__(1)
__attribute__nonnull__(2);

PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
PackFile_Segment * PackFile_Annotations_new(PARROT_INTERP,
ARGIN(struct PackFile *pf),
SHIM(const char *name),
NULLOK(int add))
__attribute__nonnull__(1)
__attribute__nonnull__(2);

PARROT_CANNOT_RETURN_NULL
opcode_t * PackFile_Annotations_pack(PARROT_INTERP,
ARGIN(struct PackFile_Segment *seg),
Expand Down Expand Up @@ -761,6 +761,17 @@ const opcode_t * PackFile_Annotations_unpack(PARROT_INTERP,
#define ASSERT_ARGS_PackFile_add_segment __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(dir) \
|| PARROT_ASSERT_ARG(seg)
#define ASSERT_ARGS_PackFile_Annotations_add_entry \
__attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp) \
|| PARROT_ASSERT_ARG(self)
#define ASSERT_ARGS_PackFile_Annotations_add_group \
__attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp) \
|| PARROT_ASSERT_ARG(self)
#define ASSERT_ARGS_PackFile_Annotations_new __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp) \
|| PARROT_ASSERT_ARG(pf)
#define ASSERT_ARGS_PackFile_Constant_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = 0
#define ASSERT_ARGS_PackFile_Constant_new __attribute__unused__ int _ASSERT_ARGS_CHECK = 0
#define ASSERT_ARGS_PackFile_Constant_pack_size __attribute__unused__ int _ASSERT_ARGS_CHECK = \
Expand Down Expand Up @@ -871,14 +882,6 @@ const opcode_t * PackFile_Annotations_unpack(PARROT_INTERP,
|| PARROT_ASSERT_ARG(self)
#define ASSERT_ARGS_mark_const_subs __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp)
#define ASSERT_ARGS_PackFile_Annotations_add_entry \
__attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp) \
|| PARROT_ASSERT_ARG(self)
#define ASSERT_ARGS_PackFile_Annotations_add_group \
__attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp) \
|| PARROT_ASSERT_ARG(self)
#define ASSERT_ARGS_PackFile_Annotations_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(seg)
#define ASSERT_ARGS_PackFile_Annotations_dump __attribute__unused__ int _ASSERT_ARGS_CHECK = \
Expand All @@ -887,9 +890,6 @@ const opcode_t * PackFile_Annotations_unpack(PARROT_INTERP,
#define ASSERT_ARGS_PackFile_Annotations_lookup __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp) \
|| PARROT_ASSERT_ARG(self)
#define ASSERT_ARGS_PackFile_Annotations_new __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp) \
|| PARROT_ASSERT_ARG(pf)
#define ASSERT_ARGS_PackFile_Annotations_pack __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp) \
|| PARROT_ASSERT_ARG(seg) \
Expand Down
8 changes: 0 additions & 8 deletions include/parrot/pobj.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,6 @@ typedef struct Buffer_alloc_unit {
# define PObj_bufrefcountptr(b) ((INTVAL *)PObj_bufallocstart(b))
#endif

typedef enum {
enum_stringrep_unknown = 0,
enum_stringrep_one = 1,
enum_stringrep_two = 2,
enum_stringrep_four = 4
} parrot_string_representation_t;

struct parrot_string_t {
UnionVal cache;
Parrot_UInt flags;
Expand All @@ -125,7 +118,6 @@ struct parrot_string_t {
UINTVAL strlen;
UINTVAL hashval; /* cached hash value computation */

/* parrot_string_representation_t representation;*/
const struct _encoding *encoding;
const struct _charset *charset;
};
Expand Down
13 changes: 1 addition & 12 deletions include/parrot/string_funcs.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,7 @@ STRING * string_make_direct(PARROT_INTERP,

PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
STRING * string_make_empty(PARROT_INTERP,
parrot_string_representation_t representation,
UINTVAL capacity)
STRING * string_make_empty(PARROT_INTERP, UINTVAL capacity)
__attribute__nonnull__(1);

PARROT_EXPORT
Expand All @@ -377,12 +375,6 @@ void string_pin(PARROT_INTERP, ARGMOD(STRING *s))
__attribute__nonnull__(2)
FUNC_MODIFIES(*s);

PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
const char* string_primary_encoding_for_representation(PARROT_INTERP,
parrot_string_representation_t representation)
__attribute__nonnull__(1);

PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
STRING * string_printf(PARROT_INTERP, ARGIN(const char *format), ...)
Expand Down Expand Up @@ -664,9 +656,6 @@ STRING* uint_to_str(PARROT_INTERP,
#define ASSERT_ARGS_string_pin __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp) \
|| PARROT_ASSERT_ARG(s)
#define ASSERT_ARGS_string_primary_encoding_for_representation \
__attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp)
#define ASSERT_ARGS_string_printf __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp) \
|| PARROT_ASSERT_ARG(format)
Expand Down
2 changes: 1 addition & 1 deletion languages/lua/src/pmc/luastring.pmc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Initializes the string.

*/
VTABLE void init() {
PMC_str_val(SELF) = string_make_empty(INTERP, enum_stringrep_one, 0);
PMC_str_val(SELF) = string_make_empty(INTERP, 0);
PObj_custom_mark_SET(SELF);
}

Expand Down
2 changes: 1 addition & 1 deletion src/io/filehandle.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Parrot_io_make_string(PARROT_INTERP, ARGMOD(STRING **buf), size_t len)
* when we get a NULL string, we read a default len
*/
if (*buf == NULL) {
*buf = string_make_empty(interp, enum_stringrep_one, len);
*buf = string_make_empty(interp, len);
return *buf;
}
else {
Expand Down
4 changes: 2 additions & 2 deletions src/io/socket_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,11 @@ Parrot_io_recv_unix(PARROT_INTERP, SHIM(PMC *socket),
case ECONNRESET:
/* XXX why close it on err return result is -1 anyway */
close(io->fd);
*s = string_make_empty(interp, enum_stringrep_one, 0);
*s = string_make_empty(interp, 0);
return -1;
default:
close(io->fd);
*s = string_make_empty(interp, enum_stringrep_one, 0);
*s = string_make_empty(interp, 0);
return -1;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/ops/string.ops
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,11 @@ Allocate a new empty string of length $2 (optional).
=cut

inline op new(out STR) :base_mem {
$1 = string_make_empty(interp, enum_stringrep_one, 0);
$1 = string_make_empty(interp, 0);
}

inline op new(out STR, in INT) :base_mem {
$1 = string_make_empty(interp, enum_stringrep_one, $2);
$1 = string_make_empty(interp, $2);
}


Expand Down
3 changes: 1 addition & 2 deletions src/pmc/eval.pmc
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,7 @@ for writing to disc and later loading via C<load_bytecode>.
* effect
*/
aligned_size = size + 15;
res = string_make_empty(INTERP, enum_stringrep_one,
aligned_size);
res = string_make_empty(INTERP, aligned_size);
res->strlen = res->bufused = size;

if ((size_t)(res->strstart) & 0xf) {
Expand Down
2 changes: 1 addition & 1 deletion src/pmc/filehandle.pmc
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ filehandle when finished.
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_PIO_ERROR,
"Cannot readall without a file name or open filehandle");
}
result = string_make_empty(INTERP, enum_stringrep_one, 0);
result = string_make_empty(INTERP, 0);

/* Do line buffering on the filehandle */
if (!(PARROT_FILEHANDLE(SELF)->flags & PIO_F_LINEBUF))
Expand Down
4 changes: 2 additions & 2 deletions src/pmc/hash.pmc
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ Return a representation of the hash contents.
* (--leo)
*/
if (!b)
return string_make_empty(INTERP, enum_stringrep_one, 0);
return string_make_empty(INTERP, 0);

return VTABLE_get_string(INTERP, (PMC*) b->value);
}
Expand Down Expand Up @@ -456,7 +456,7 @@ Returns the string value for the element at C<*key>.
* (--leo)
*/
if (!b)
return string_make_empty(INTERP, enum_stringrep_one, 0);
return string_make_empty(INTERP, 0);

nextkey = key_next(INTERP, key);
valpmc = (PMC *)b->value;
Expand Down
2 changes: 1 addition & 1 deletion src/pmc/string.pmc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Initializes the string.
*/

VTABLE void init() {
PMC_str_val(SELF) = string_make_empty(INTERP, enum_stringrep_one, 0);
PMC_str_val(SELF) = string_make_empty(INTERP, 0);
PObj_custom_mark_SET(SELF);
}

Expand Down
2 changes: 1 addition & 1 deletion src/pmc/undef.pmc
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Returns an empty string.
*/

VTABLE STRING *get_string() {
return string_make_empty(INTERP, enum_stringrep_one, 0);
return string_make_empty(INTERP, 0);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion src/pmc_freeze.c
Original file line number Diff line number Diff line change
Expand Up @@ -1793,7 +1793,7 @@ create_image(PARROT_INTERP, ARGIN_NULLOK(PMC *pmc), ARGMOD(visit_info *info))
else
len = FREEZE_BYTES_PER_ITEM;

info->image = string_make_empty(interp, enum_stringrep_one, len);
info->image = string_make_empty(interp, len);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion src/spf_render.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ Parrot_sprintf_format(PARROT_INTERP,
HUGEINTVAL num;

/* start with a buffer; double the pattern length to avoid realloc #1 */
STRING *targ = string_make_empty(interp, enum_stringrep_one, pat_len << 1);
STRING *targ = string_make_empty(interp, pat_len << 1);

/* ts is used almost universally as an intermediate target;
* tc is used as a temporary buffer by uint_to_string and
Expand Down
Loading

0 comments on commit 7fcd2ef

Please sign in to comment.