============ idVarDef::PrintInfo ============ */
| 743 | ============ |
| 744 | */ |
| 745 | void idVarDef::PrintInfo( idFile *file, int instructionPointer ) const { |
| 746 | statement_t *jumpst; |
| 747 | int jumpto; |
| 748 | etype_t etype; |
| 749 | int i; |
| 750 | int len; |
| 751 | const char *ch; |
| 752 | |
| 753 | if ( initialized == initializedConstant ) { |
| 754 | file->Printf( "const " ); |
| 755 | } |
| 756 | |
| 757 | etype = typeDef->Type(); |
| 758 | switch( etype ) { |
| 759 | case ev_jumpoffset : |
| 760 | jumpto = instructionPointer + value.jumpOffset; |
| 761 | jumpst = &gameLocal.program.GetStatement( jumpto ); |
| 762 | file->Printf( "address %d [%s(%d)]", jumpto, gameLocal.program.GetFilename( jumpst->file ), jumpst->linenumber ); |
| 763 | break; |
| 764 | |
| 765 | case ev_function : |
| 766 | if ( value.functionPtr->eventdef ) { |
| 767 | file->Printf( "event %s", GlobalName() ); |
| 768 | } else { |
| 769 | file->Printf( "function %s", GlobalName() ); |
| 770 | } |
| 771 | break; |
| 772 | |
| 773 | case ev_field : |
| 774 | file->Printf( "field %d", value.ptrOffset ); |
| 775 | break; |
| 776 | |
| 777 | case ev_argsize: |
| 778 | file->Printf( "args %d", value.argSize ); |
| 779 | break; |
| 780 | |
| 781 | default: |
| 782 | file->Printf( "%s ", typeDef->Name() ); |
| 783 | if ( initialized == initializedConstant ) { |
| 784 | switch( etype ) { |
| 785 | case ev_string : |
| 786 | file->Printf( "\"" ); |
| 787 | len = strlen( value.stringPtr ); |
| 788 | ch = value.stringPtr; |
| 789 | for( i = 0; i < len; i++, ch++ ) { |
| 790 | if ( idStr::CharIsPrintable( *ch ) ) { |
| 791 | file->Printf( "%c", *ch ); |
| 792 | } else if ( *ch == '\n' ) { |
| 793 | file->Printf( "\\n" ); |
| 794 | } else { |
| 795 | file->Printf( "\\x%.2x", static_cast<int>( *ch ) ); |
| 796 | } |
| 797 | } |
| 798 | file->Printf( "\"" ); |
| 799 | break; |
| 800 | |
| 801 | case ev_vector : |
| 802 | file->Printf( "'%s'", value.vectorPtr->ToString() ); |
no test coverage detected