Category : C Source Code
Archive   : GHSTSCPT.ZIP
Filename : IDEBUG.C

 
Output of file : IDEBUG.C contained in archive : GHSTSCPT.ZIP
/* Copyright (C) 1989 Aladdin Enterprises. All rights reserved.
Distributed by Free Software Foundation, Inc.

This file is part of Ghostscript.

Ghostscript is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY. No author or distributor accepts responsibility
to anyone for the consequences of using it or for whether it serves any
particular purpose or works at all, unless he says so in writing. Refer
to the Ghostscript General Public License for full details.

Everyone is granted permission to copy, modify and redistribute
Ghostscript, but only under the conditions described in the Ghostscript
General Public License. A copy of this license is supposed to have been
given to you along with Ghostscript so you can know your rights and
responsibilities. It should be in a file named COPYING. Among other
things, the copyright notice and this notice must be preserved on all
copies. */

/* idebug.c */
/* Debugging support for GhostScript interpreter */
#include /* for stream.h */
#include "ghost.h"
#include "name.h"

/* Forward references */
void debug_print_string(P2(byte *, ushort));

/* Print a ref */
void
debug_print_ref(ref *pref)
{ unsigned size = pref->size;
printf("(%x)", pref->type_attrs);
switch ( r_type(pref) )
{
case t_array:
printf("array(%u)%lx", size, (ulong)pref->value.refs); break;
case t_boolean: printf("boolean %x", pref->value.index); break;
case t_dictionary:
printf("dict(%u)%lx", size, (ulong)pref->value.pdict); break;
case t_file: printf("file %u", pref->value.index); break;
case t_integer: printf("int %ld", pref->value.intval); break;
case t_mark: printf("mark"); break;
case t_name:
printf("name(%lx)", (ulong)pref->value.pname);
debug_print_string(pref->value.pname->string.value.bytes,
pref->value.pname->string.size);
break;
case t_null: printf("null"); break;
case t_operator:
printf("op(%u)%lx", size, (ulong)pref->value.opproc); break;
case t_packedarray:
printf("packedarray(%u)%lx", size, (ulong)pref->value.refs); break;
case t_real: printf("real %f", pref->value.realval); break;
case t_string:
printf("string(%u)%lx", size, (ulong)pref->value.bytes); break;
default: printf("type %x", r_type(pref));
}
}

/* Print a string */
void
debug_print_string(byte *chrs, ushort len)
{ ushort i;
for ( i = 0; i < len; i++ )
putchar(chrs[i]);
}


  3 Responses to “Category : C Source Code
Archive   : GHSTSCPT.ZIP
Filename : IDEBUG.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/