Пример #1
0
void wrenDumpValue(Value value)
{
#if WREN_NAN_TAGGING
  if (IS_NUM(value))
  {
    printf("%.14g", AS_NUM(value));
  }
  else if (IS_OBJ(value))
  {
    dumpObject(AS_OBJ(value));
  }
  else
  {
    switch (GET_TAG(value))
    {
      case TAG_FALSE:     printf("false"); break;
      case TAG_NAN:       printf("NaN"); break;
      case TAG_NULL:      printf("null"); break;
      case TAG_TRUE:      printf("true"); break;
      case TAG_UNDEFINED: UNREACHABLE();
    }
  }
#else
  switch (value.type)
  {
    case VAL_FALSE:     printf("false"); break;
    case VAL_NULL:      printf("null"); break;
    case VAL_NUM:       printf("%.14g", AS_NUM(value)); break;
    case VAL_TRUE:      printf("true"); break;
    case VAL_OBJ:       dumpObject(AS_OBJ(value)); break;
    case VAL_UNDEFINED: UNREACHABLE();
  }
#endif
}
void XMLSerializable::writeFragment(ostream & output, int iTabs)
{
	for(int i = 0; i < iTabs; i++)
	{
		output << "\t";
	}

	output << "<" << dumpObject() << ">";
	writeDataAsFragment(output, iTabs);
	output "</" << dumpObject() << ">";
}
Пример #3
0
void dumpObject(HTML_OBJECT *o, FILE *f, int indent) {
  HTML_OBJECT *c;
  int i;
  const char *s;
  HTML_PROPS *pr;
  HTML_FONT *fnt;

  s=HtmlObject_GetText(o);
  for (i=0; i<indent; i++) fprintf(f, " ");
  fprintf(stderr, "Object type: %d [%s] flags: %08x\n",
          HtmlObject_GetObjectType(o),
          s?s:"(empty)",
          HtmlObject_GetFlags(o));

  pr=HtmlObject_GetProperties(o);
  fnt=HtmlProps_GetFont(pr);

  for (i=0; i<indent+2; i++) fprintf(f, " ");
  fprintf(stderr, "fgcol=%06x, bgcol=%06x, fontsize=%d, fontflags=%08x, fontname=[%s]\n",
          HtmlProps_GetForegroundColor(pr),
          HtmlProps_GetBackgroundColor(pr),
          HtmlFont_GetFontSize(fnt),
          HtmlFont_GetFontFlags(fnt),
          HtmlFont_GetFontName(fnt));

  c=HtmlObject_Tree_GetFirstChild(o);
  while(c) {
    dumpObject(c, f, indent+2);
    c=HtmlObject_Tree_GetNext(c);
  }
}
Пример #4
0
void FOX16_HtmlCtx::dump() {
  HTML_OBJECT *o;

  o=HtmlCtx_GetRootObject(_context);
  if (o)
    dumpObject(o, stderr, 2);
}
Пример #5
0
int test1(int argc, char **argv) {
  GWEN_XML_CONTEXT *xmlCtx;
  GWEN_SYNCIO *sio;
  int rv;
  HTML_PROPS *pr;
  HTML_FONT *fnt;
  HTML_OBJECT_TREE *ot;

  if (argc<2) {
    fprintf(stderr, "Name of testfile needed.\n");
    return 1;
  }

  sio=GWEN_SyncIo_File_new(argv[1], GWEN_SyncIo_File_CreationMode_OpenExisting);
  GWEN_SyncIo_AddFlags(sio, GWEN_SYNCIO_FILE_FLAGS_READ);
  rv=GWEN_SyncIo_Connect(sio);
  if (rv<0) {
    DBG_ERROR(0, "here (%d)", rv);
    GWEN_SyncIo_free(sio);
    return 2;
  }

  xmlCtx=HtmlCtx_new(0);
  assert(xmlCtx);

  pr=HtmlProps_new();
  fnt=HtmlCtx_GetFont(xmlCtx, "times new roman", 12, 0);
  HtmlProps_SetFont(pr, fnt);
  HtmlFont_free(fnt);
  HtmlCtx_SetStandardProps(xmlCtx, pr);
  HtmlProps_free(pr);

  /* read OFX file into context */
  rv=GWEN_XMLContext_ReadFromIo(xmlCtx, sio);
  if (rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
    GWEN_SyncIo_Disconnect(sio);
    GWEN_SyncIo_free(sio);
    return rv;
  }

  ot=HtmlCtx_GetObjects(xmlCtx);
  if (ot) {
    HTML_OBJECT *o;

    o=HtmlObject_Tree_GetFirst(ot);
    dumpObject(o, stderr, 2);
  }

  GWEN_SyncIo_Disconnect(sio);
  GWEN_SyncIo_free(sio);
  GWEN_XmlCtx_free(xmlCtx);

  return 0;
}
Пример #6
0
void dumpPair( __bytefield__ *f, __WORD__ pos ) {
    __WORD__ addr = (__WORD__)f->field + pos;
    __pair__ *p = (__pair__*)addr;

    dumpPairHdr(f, pos);
    dumpPairState(f, pos + __WORDSIZE__);
    dumpBoxed(f, pos + (2 * __WORDSIZE__));
    dumpBoxed(f, pos + (2 * __WORDSIZE__) + __BWORDSIZE__);

    dumpObject(f, pos + __PAIRSIZE__);
}
Пример #7
0
void dumpByteField( __bytefield__ *f ) {
    __WORD__ root = (__WORD__)f->field;
    __WORD__ pos = 0;
    __WORD__ end = f->next;
    __WORD__ size = f->fieldsize;

    printf(dline);
    printf("Heap\n");
    printf("  start at: 0x");
    dumpWord(f, root);
    printf("\n");
    printf("  size: ");
    dumpIntWord(f, size);
    printf("\n");
    printf("  end: ");
    dumpIntWord(f, end);
    printf("\n");

    dumpObject(f, pos);

    printf(dline);
}
Пример #8
0
void dumpPtd( __bytefield__ *f, __WORD__ pos ) {
    __WORD__ addr = (__WORD__)f->field + pos;
    __BWORD__ bptd = __boxptd(_A1_, addr);
    __WORD__ nextpos = pos;
    __WORD__ slen;
    __WORD__ stail;
    __WORD__ spad;

    switch (__boxsubtype(_A1_, bptd)) {
    case __VEC_TYPE__:
        dumpVec(f, pos);

        nextpos += (__unboxint(_A1_, __vectorLength(_A1_, bptd)) * __WORDSIZE__) + sizeof(__vector__);
        break;

    case __STR_TYPE__:
        dumpStr(f, pos);

        slen = __unboxint(_A1_, __stringLength(_A1_, bptd)) + 1;
        stail = (slen % __WORDSIZE__);
        spad = 0;
        if (stail != 0)
            spad = __WORDSIZE__ - stail;
        nextpos +=  slen + spad + sizeof(__string__);
        break;

    case __CHAR_TYPE__:
        dumpChar(f, pos);

        nextpos += sizeof(__char__);
        break;

    default:
        printf("Unrecognized object type.");
        exit(__FAIL__);
    }

    dumpObject(f, nextpos);
}
Пример #9
0
bool baekwha(const char *pcArgv0)
{
	time_t t_start, t_end;
	double t_elapsed;
	bool ok;


	if( cfg_showHelp )
	{
		showHelp(pcArgv0);
		return true;
	} else if( cfg_showVersion ) {
		showVersion();
		return true;
	}

	/*
	 * Open Debug log if '-d' was set
	 */
	if( cfg_debug==true )
	{
		/* catch special filename "-" for stdout */
		if( strcmp(pcDebugLogName, "-")==0 )
		{
			/* set output file to stdout */
			debugLog = stdout;
		}
		else
		{
			debugLog = fopen(pcDebugLogName, "w");
			if( debugLog==NULL )
			{
				fprintf(stderr, "error opening debug log '%s' : %s\n", pcDebugLogName, strerror(errno));
				return false;
			}
		}
		fprintf(debugLog, "<html><head><title>DreamAss debug log</title></head><body>\n");
	}

	/*
	 * No Sourecfiles means nothing to do
	 */
	if( srcFileNames_count==0 )
	{
		printf("No sourcefiles - nothing to do.\n");
		return true;
	}

	if(
		filelist_init(16) &&
		macro_init(16) &&
		srcstack_init(16) &&
		termlist_init(1024) &&
		new_variable(1024) &&
		segment_init(16)
	  )
	{
		/* Stop assembly time from now on */
		t_start = time(NULL);

		ok = assembleAllFiles();
		if( ok )
		{
			if( cfg_verbose )
			{
				t_end = time(NULL);
				t_elapsed = difftime(t_end, t_start);
				printf("%f seconds used\n", t_elapsed);
			}

			if( warningcnt>=cfg_maxwarnings )
			{
				printf("further warnings suppressed.\n");
			}

			if( cfg_verbose )
			{
				if( warningcnt )
					printf("%u",warningcnt);
				else
					printf("no");
				printf(" warning%s, ",(warningcnt==1)?"":"s");
				if( errorcnt )
					printf("%u",errorcnt);
				else
					printf("no");
				printf(" error%s.\n",(errorcnt==1)?"":"s");
			}

			if( errorcnt==0 )
			{
				if( pcLabelLogName!=NULL )
					dumpLabels( pcLabelLogName );

				if( !allBytesResolved )
				{
					fprintf(stderr, "Some vars still undefined. Dump not yet supported, sorry!\n");
					pass_showUndefs(topLevelSrc);
				}
				else
					dumpObject(topLevelSrc, pcOutFileName);
			}
		}
		if( topLevelSrc!=NULL )
			delSourcefile(topLevelSrc);

		return ok;
	}

	return false;
}
Пример #10
0
void debugsupport_dumpObject(ObjectDesc * self, ObjectDesc * obj)
{
	dumpObject(obj);
}