[script] Remove print object function which was unused

It was useful when the language was being constructed to make sure reference
counts were sane but only worked in text mode.
This commit is contained in:
Charlie Brej 2009-07-12 19:04:53 +01:00 committed by Ray Strode
parent fdfc7a5da7
commit f787ec7744
2 changed files with 0 additions and 83 deletions

View file

@ -36,7 +36,6 @@
#include "script.h"
#include "script-object.h"
char *script_obj_print (script_obj_t *obj);
void script_obj_reset (script_obj_t *obj);
void script_obj_free (script_obj_t *obj)
@ -143,87 +142,6 @@ void script_obj_deref (script_obj_t **obj_ptr)
*obj_ptr = obj;
}
static void foreach_print_vareable (void *key,
void *data,
void *user_data)
{
script_vareable_t *vareable = data;
char *string = script_obj_print (vareable->object);
char *reply;
char *prev = *(char **) user_data;
if (!prev) prev = strdup ("");
asprintf (&reply, "%s%s = %s\n", prev, vareable->name, string);
free (string);
free (prev);
*(char **) user_data = reply;
}
char *script_obj_print (script_obj_t *obj)
{
char *reply;
switch (obj->type)
{
case SCRIPT_OBJ_TYPE_REF:
{
char *subobj = script_obj_print (obj->data.obj);
asprintf (&reply, "->[%d]%s", obj->refcount, subobj);
free (subobj);
return reply;
}
case SCRIPT_OBJ_TYPE_INT:
{
asprintf (&reply, "%d[%d]", obj->data.integer, obj->refcount);
return reply;
}
case SCRIPT_OBJ_TYPE_FLOAT:
{
asprintf (&reply, "%f[%d]", obj->data.floatpoint, obj->refcount);
return reply;
}
case SCRIPT_OBJ_TYPE_STRING:
{
asprintf (&reply, "\"%s\"[%d]", obj->data.string, obj->refcount);
return reply;
}
case SCRIPT_OBJ_TYPE_NULL:
{
asprintf (&reply, "NULL[%d]", obj->refcount);
return reply;
}
case SCRIPT_OBJ_TYPE_HASH:
{
char *sub = NULL;
ply_hashtable_foreach (obj->data.hash, foreach_print_vareable, &sub);
asprintf (&reply, "HASH{\n%s}[%d]", sub, obj->refcount);
free (sub);
return reply;
}
case SCRIPT_OBJ_TYPE_FUNCTION:
{
asprintf (&reply, "function()[%d]", obj->refcount);
return reply;
}
case SCRIPT_OBJ_TYPE_NATIVE:
{
asprintf (&reply,
"(%s)[%d]",
obj->data.native.class->name,
obj->refcount);
return reply;
}
}
return NULL;
}
script_obj_t *script_obj_new_null (void)
{
script_obj_t *obj = malloc (sizeof (script_obj_t));

View file

@ -39,7 +39,6 @@ void script_obj_unref (script_obj_t *obj);
void script_obj_reset (script_obj_t *obj);
script_obj_t *script_obj_deref_direct (script_obj_t *obj);
void script_obj_deref (script_obj_t **obj_ptr);
char *script_obj_print (script_obj_t *obj);
script_obj_t *script_obj_new_int (int number);
script_obj_t *script_obj_new_float (float number);
script_obj_t *script_obj_new_string (const char *string);