[qwaq] Use TableView to show locals

This is much nicer (even though things aren't quite right yet)
This commit is contained in:
Bill Currie 2020-03-31 20:48:38 +09:00
parent 58acc483fd
commit 0da92e33f6
41 changed files with 824 additions and 184 deletions

View file

@ -27,9 +27,24 @@ SUFFIXES=.o .r
qwaq_app_dat_src= \
qwaq-app.r \
debugger/defview.r \
debugger/nameview.r \
debugger/basicview.r \
debugger/doubleview.r \
debugger/entityview.r \
debugger/fieldview.r \
debugger/floatview.r \
debugger/funcview.r \
debugger/intview.r \
debugger/pointerview.r \
debugger/quatview.r \
debugger/stringview.r \
debugger/uintview.r \
debugger/vectorview.r \
debugger/voidview.r \
debugger/debug.r \
debugger/debugger.r \
debugger/localsview.r \
debugger/localsdata.r \
debugger/typeencodings.r \
editor/editbuffer.r \
editor/editor.r \

View file

@ -0,0 +1,11 @@
#ifndef __qwaq_debugger_basicview_h
#define __qwaq_debugger_basicview_h
#include "debugger/defview.h"
@interface BasicView : DefView
// might return a NameView (which is also a DefView)
+(DefView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data;
@end
#endif//__qwaq_debugger_basicview_h

View file

@ -0,0 +1,48 @@
#include <string.h>
#include "debugger/basicview.h"
#include "debugger/nameview.h"
static string type_views[] = {
"VoidView",
"StringView",
"FloatView",
"VectorView",
"EntityView",
"FieldView",
"FuncView",
"PointerView",
"QuatView",
"IntView",
"UIntView", // uinteger
"IntView", // short
"DoubleView",
};
@implementation BasicView
-init
{
if (!(self = [super init])) {
return nil;
}
return self;
}
+(DefView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data
{
string typename = nil;
if (type.type == ty_alias) {
type = type.alias.aux_type;
}
if (type.type >= 0
&& type.type < sizeof(type_views) / sizeof (type_views[0])) {
typename = type_views[type.type];
}
id class = obj_lookup_class (typename);
if (class) {
return [class withType:type at:offset in:data];
}
return [NameView withName:"Invalid Meta"];
}
@end

View file

@ -5,26 +5,28 @@
#include <Object.h>
#include "debugger/debug.h"
#include "debugger/localsview.h"
#include "debugger/localsdata.h"
@class ProxyView;
@class Editor;
@class ScrollBar;
@class Window;
@class Array;
@class TableView;
@interface Debugger : Object
{
qdb_target_t target;
Window *source_window;
ScrollBar *source_scrollbar;
ProxyView *file_proxy;
Array *files;
Editor *current_file;
Window *locals_window;
ScrollBar *scrollbar;
LocalsView *locals_view;
LocalsData *locals_data;
TableView *locals_view;
}
+(Debugger *)withTarget:(qdb_target_t)target;
-initWithTarget:(qdb_target_t) target;

View file

@ -7,6 +7,7 @@
#include "ui/listener.h"
#include "ui/proxyview.h"
#include "ui/scrollbar.h"
#include "ui/tableview.h"
#include "ui/window.h"
#include "debugger/debugger.h"
#include "debugger/typeencodings.h"
@ -36,8 +37,8 @@
source_window = [Window withRect: {nil, s}];
[application addView:source_window];
scrollbar = [ScrollBar vertical:s.height - 2 at:{s.width - 1, 1}];
[source_window insert:scrollbar];
source_scrollbar = [ScrollBar vertical:s.height - 2 at:{s.width - 1, 1}];
[source_window insert:source_scrollbar];
return self;
}
@ -45,6 +46,7 @@
-(void)dealloc
{
[files release];
[locals_data release];
[super dealloc];
}
@ -73,7 +75,7 @@
file_proxy = [ProxyView withView: current_file];
[[current_file gotoLine:state.line - 1] highlightLine];
[[current_file onEvent] addListener: self :@selector(proxy_event::)];
[current_file setVerticalScrollBar:scrollbar];
[current_file setVerticalScrollBar:source_scrollbar];
//FIXME id<View>?
[source_window insertSelected: (View *) file_proxy];
[source_window setTitle: [current_file filename]];
@ -82,8 +84,15 @@
locals_window = [Window withRect:{{0, 0}, {40, 10}}];
[locals_window setBackground: color_palette[064]];
[locals_window setTitle: "Locals"];
locals_view = [LocalsView withRect:{{1, 1}, {38, 8}} target:target];
locals_data = [[LocalsData withTarget:target] retain];
locals_view = [TableView withRect:{{1, 1}, {38, 8}}];
[locals_view addColumn:[TableViewColumn named:"name" width:12]];
[locals_view addColumn:[TableViewColumn named:"value" width:26]];
ScrollBar *sb = [ScrollBar vertical:8 at:{39, 1}];
[locals_view setVerticalScrollBar:sb];
[locals_view setDataSource:locals_data];
[locals_window insertSelected: locals_view];
[locals_window insert: sb];
[application addView: locals_window];
[[locals_view onEvent] addListener:self :@selector(proxy_event::)];
@ -99,7 +108,7 @@
[[current_file onEvent] removeListener:self :@selector(proxy_event::)];
[file_proxy setView:file];
[[file onEvent] addListener:self :@selector(proxy_event::)];
[file setVerticalScrollBar:scrollbar];
[file setVerticalScrollBar:source_scrollbar];
[source_window setTitle: [file filename]];
current_file = file;
}
@ -110,7 +119,7 @@
-(void)update_watchvars
{
qdb_state_t state = qdb_get_state (target);
[locals_view setFunction:state.func];
[locals_data setFunction:state.func];
[locals_view redraw];
}

View file

@ -0,0 +1,15 @@
#ifndef __qwaq_debugger_defview_h
#define __qwaq_debugger_defview_h
#include <types.h>
#include "ui/view.h"
@interface DefView : View
{
qfot_type_t *type;
}
+(DefView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data;
-initWithType:(qfot_type_t *)type;
@end
#endif//__qwaq_debugger_defview_h

View file

@ -0,0 +1,52 @@
#include <string.h>
#include "debugger/defview.h"
#include "debugger/nameview.h"
static string meta_views[] = {
"BasicView",
"StructView",
"UnionView",
"EnumView",
"ArrayView",
"ClassView",
"AliasView", // shouldn't happen, but...
};
@implementation DefView
-init
{
if (!(self = [super init])) {
return nil;
}
return self;
}
-initWithType:(qfot_type_t *)type
{
if (!(self = [super init])) {
return nil;
}
self.type = type;
return self;
}
+(DefView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data
{
string metaname = nil;
//printf("%d %d %d %d\n", type.meta, type.size, type.encoding, type.type);
if (type.meta == ty_alias) {
type = type.alias.aux_type;
}
if (type.meta >= 0
&& type.meta < sizeof(meta_views) / sizeof (meta_views[0])) {
metaname = meta_views[type.meta];
}
id class = obj_lookup_class (metaname);
if (class) {
return [class withType:type at:offset in:data];
}
return [NameView withName:"Invalid Meta"];
}
@end

View file

@ -0,0 +1,13 @@
#ifndef __qwaq_debugger_doubleview_h
#define __qwaq_debugger_doubleview_h
#include "debugger/defview.h"
@interface DoubleView : DefView
{
double *data;
}
+(DoubleView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data;
@end
#endif//__qwaq_debugger_doubleview_h

View file

@ -0,0 +1,28 @@
#include <string.h>
#include "debugger/doubleview.h"
@implementation DoubleView
-initWithType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data
{
if (!(self = [super initWithType:type])) {
return nil;
}
self.data = (double *)(data + offset);
return self;
}
+(DoubleView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data
{
return [[[self alloc] initWithType:type at:offset in:data] autorelease];
}
-draw
{
[super draw];
string val = sprintf ("%.17g", data[0]);
[self mvaddstr:{0, 0}, str_mid (val, 0, xlen)];
return self;
}
@end

View file

@ -0,0 +1,13 @@
#ifndef __qwaq_debugger_entityview_h
#define __qwaq_debugger_entityview_h
#include "debugger/defview.h"
@interface EntityView : DefView
{
entity *data;
}
+(EntityView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data;
@end
#endif//__qwaq_debugger_entityview_h

View file

@ -0,0 +1,28 @@
#include <string.h>
#include "debugger/entityview.h"
@implementation EntityView
-initWithType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data
{
if (!(self = [super initWithType:type])) {
return nil;
}
self.data = (entity *)(data + offset);
return self;
}
+(EntityView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data
{
return [[[self alloc] initWithType:type at:offset in:data] autorelease];
}
-draw
{
[super draw];
string val = sprintf ("FIXME [%x]", data[0]);
[self mvaddstr:{0, 0}, str_mid (val, 0, xlen)];
return self;
}
@end

View file

@ -0,0 +1,13 @@
#ifndef __qwaq_debugger_fieldview_h
#define __qwaq_debugger_fieldview_h
#include "debugger/defview.h"
@interface FieldView : DefView
{
unsigned *data;
}
+(FieldView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data;
@end
#endif//__qwaq_debugger_fieldview_h

View file

@ -0,0 +1,28 @@
#include <string.h>
#include "debugger/fieldview.h"
@implementation FieldView
-initWithType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data
{
if (!(self = [super initWithType:type])) {
return nil;
}
self.data = (unsigned *)(data + offset);
return self;
}
+(FieldView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data
{
return [[[self alloc] initWithType:type at:offset in:data] autorelease];
}
-draw
{
[super draw];
string val = sprintf ("FIXME [%x]", data[0]);
[self mvaddstr:{0, 0}, str_mid (val, 0, xlen)];
return self;
}
@end

View file

@ -0,0 +1,13 @@
#ifndef __qwaq_debugger_floatview_h
#define __qwaq_debugger_floatview_h
#include "debugger/defview.h"
@interface FloatView : DefView
{
float *data;
}
+(FloatView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data;
@end
#endif//__qwaq_debugger_floatview_h

View file

@ -0,0 +1,28 @@
#include <string.h>
#include "debugger/floatview.h"
@implementation FloatView
-initWithType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data
{
if (!(self = [super initWithType:type])) {
return nil;
}
self.data = (float *)(data + offset);
return self;
}
+(FloatView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data
{
return [[[self alloc] initWithType:type at:offset in:data] autorelease];
}
-draw
{
[super draw];
string val = sprintf ("%.9", data[0]);
[self mvaddstr:{0, 0}, str_mid (val, 0, xlen)];
return self;
}
@end

View file

@ -0,0 +1,13 @@
#ifndef __qwaq_debugger_funcview_h
#define __qwaq_debugger_funcview_h
#include "debugger/defview.h"
@interface FuncView : DefView
{
unsigned *data;
}
+(FuncView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data;
@end
#endif//__qwaq_debugger_funcview_h

View file

@ -0,0 +1,28 @@
#include <string.h>
#include "debugger/funcview.h"
@implementation FuncView
-initWithType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data
{
if (!(self = [super initWithType:type])) {
return nil;
}
self.data = (unsigned *)(data + offset);
return self;
}
+(FuncView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data
{
return [[[self alloc] initWithType:type at:offset in:data] autorelease];
}
-draw
{
[super draw];
string val = sprintf ("FIXME [%x]", data[0]);
[self mvaddstr:{0, 0}, str_mid (val, 0, xlen)];
return self;
}
@end

View file

@ -0,0 +1,13 @@
#ifndef __qwaq_debugger_intview_h
#define __qwaq_debugger_intview_h
#include "debugger/defview.h"
@interface IntView : DefView
{
int *data;
}
+(IntView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data;
@end
#endif//__qwaq_debugger_intview_h

View file

@ -0,0 +1,28 @@
#include <string.h>
#include "debugger/intview.h"
@implementation IntView
-initWithType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data
{
if (!(self = [super initWithType:type])) {
return nil;
}
self.data = (int *)(data + offset);
return self;
}
+(IntView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data
{
return [[[self alloc] initWithType:type at:offset in:data] autorelease];
}
-draw
{
[super draw];
string val = sprintf ("%d", data[0]);
[self mvaddstr:{0, 0}, str_mid (val, 0, xlen)];
return self;
}
@end

View file

@ -2,10 +2,10 @@
#define __qwaq_debugger_localsview_h
#include <types.h>
#include "ui/view.h"
#include "ui/tableview.h"
#include "debugger/debug.h"
@interface LocalsView : View
@interface LocalsData : Object <TableViewDataSource>
{
qdb_target_t target;
qfot_type_encodings_t target_encodings;
@ -15,8 +15,7 @@
qdb_def_t *defs;
void *data;
}
+(LocalsView *)withRect:(Rect)rect target:(qdb_target_t)target;
-initWithRect:(Rect)rect target:(qdb_target_t)target;
+(LocalsData *)withTarget:(qdb_target_t)target;
-setFunction:(unsigned)fnum;
@end

View file

@ -0,0 +1,100 @@
#include <string.h>
#include <types.h>
#include "debugger/defview.h"
#include "debugger/nameview.h"
#include "debugger/localsdata.h"
#include "debugger/typeencodings.h"
@implementation LocalsData
-initWithTarget:(qdb_target_t) target
{
if (!(self = [super init])) {
return nil;
}
self.target = target;
qdb_def_t encodings_def = qdb_find_global (target, ".type_encodings");
qdb_get_data (target, encodings_def.offset, sizeof(target_encodings),
&target_encodings);
return self;
}
+(LocalsData *)withTarget:(qdb_target_t)target
{
return [[[self alloc] initWithTarget:target] autorelease];
}
-(void)dealloc
{
if (defs) {
obj_free (defs);
defs = nil;
}
if (data) {
obj_free (data);
data = nil;
}
}
-setFunction:(unsigned) fnum
{
if (current_fnum == fnum) {
return self;
}
current_fnum =fnum;
if (defs) {
obj_free (defs);
defs = nil;
}
if (data) {
obj_free (data);
data = nil;
}
func = qdb_get_function (target, fnum);
aux_func = qdb_get_auxfunction (target, fnum);
if (aux_func) {
defs = qdb_get_local_defs (target, fnum);
}
if (func) {
data = obj_malloc (func.local_size);
}
return self;
}
-(int)numberOfRows:(TableView *)tableview
{
if (aux_func) {
return aux_func.num_locals;
} else if (func) {
return (func.local_size + 3) / 4;
}
return 0;
}
-(qfot_type_t *)type:(qdb_def_t *)def
{
unsigned encoding = def.type_encoding + (unsigned) target_encodings.types;
return [TypeEncodings getType:encoding fromTarget:target];
}
-(View *)tableView:(TableView *)tableview
forColumn:(TableViewColumn *)column
row:(int)row
{
View *view;
if ([column name] == "name") {
view = [NameView withName:qdb_get_string (target, defs[row].name)];
} else {
qfot_type_t *type = [self type:&defs[row]];
unsigned offset = defs[row].offset;
view = [DefView withType:type at:offset in:data];
}
[view resizeTo:{[column width], 1}];
return view;
}
@end

View file

@ -1,156 +0,0 @@
#include <string.h>
#include <types.h>
#include "debugger/localsview.h"
#include "debugger/typeencodings.h"
@implementation LocalsView
+(LocalsView *)withRect:(Rect)rect target:(qdb_target_t)target
{
return [[[self alloc] initWithRect:rect target:target] autorelease];
}
-initWithRect:(Rect)rect target:(qdb_target_t) target
{
if (!(self = [super initWithRect:rect])) {
return nil;
}
options = ofCanFocus;
growMode = gfGrowHi;
self.target = target;
qdb_def_t encodings_def = qdb_find_global (target, ".type_encodings");
qdb_get_data (target, encodings_def.offset, sizeof(target_encodings),
&target_encodings);
return self;
}
-(void)dealloc
{
if (defs) {
obj_free (defs);
defs = nil;
}
if (data) {
obj_free (data);
data = nil;
}
}
-setFunction:(unsigned) fnum
{
if (current_fnum == fnum) {
return self;
}
current_fnum =fnum;
if (defs) {
obj_free (defs);
defs = nil;
}
if (data) {
obj_free (data);
data = nil;
}
func = qdb_get_function (target, fnum);
aux_func = qdb_get_auxfunction (target, fnum);
if (aux_func) {
defs = qdb_get_local_defs (target, fnum);
}
if (func) {
data = obj_malloc (func.local_size);
}
return self;
}
-draw
{
[super draw];
if (!data) {
return self;
}
qdb_get_data (target, func.local_data, func.local_size, data);
[self clear];
if (!defs) {
[self mvprintf:{0,0}, "%d", func.local_size];
for (int y = 1; y < ylen; y++) {
unsigned ind = (y - 1) * 4;
if (ind < func.local_size) {
[self mvprintf:{0, y}, "%02x", ind];
for (int x = 0; x < 4 && ind < func.local_size; x++, ind++) {
[self mvprintf:{x * 9 + 3, y}, "%08x",
data[ind]];
}
} else {
break;
}
}
} else {
for (int y = 0; y < ylen; y++) {
if (y >= aux_func.num_locals) {
break;
}
qdb_def_t *def = defs + y;
unsigned te = def.type_encoding + (int) target_encodings.types;
qfot_type_t *type;
type = [TypeEncodings getType:te fromTarget:target];
[self mvprintf:{0, y}, "%s",
qdb_get_string (target, def.name)];
@param value = nil;
string valstr = "--";
unsigned offset = func.local_data + def.offset;
qdb_get_data (target, offset, def.type_size >> 16, &value);
switch (def.type_size & 0xffff) {
case ev_void:
case ev_invalid:
case ev_type_count:
break;
case ev_string:
valstr = qdb_get_string (target, value.integer_val);
break;
case ev_float:
valstr = sprintf ("%.9g", value.float_val);
break;
case ev_vector:
valstr = sprintf ("%.9v", value.vector_val);
break;
case ev_entity:
valstr = sprintf ("%e", value.entity_val);
break;
case ev_field:
valstr = sprintf ("[%x]", value.field_val);
break;
case ev_func:
valstr = sprintf ("[%x]", value.func_val);
break;
case ev_pointer:
valstr = sprintf ("[%x]", value.pointer_val);
break;
case ev_quat:
valstr = sprintf ("[%q]", value.quaternion_val);
break;
case ev_integer:
valstr = sprintf ("%d", value.integer_val);
break;
case ev_uinteger:
valstr = sprintf ("%d", value.integer_val);
break;
case ev_short:
valstr = sprintf ("%d", value.integer_val);
break;
case ev_double:
valstr = sprintf ("%.17g", value.double_val);
break;
}
int x = xlen - strlen (valstr);
[self mvaddstr:{x, y}, valstr];
}
}
return self;
}
@end

View file

@ -0,0 +1,13 @@
#ifndef __qwaq_debugger_nameview_h
#define __qwaq_debugger_nameview_h
#include "debugger/defview.h"
@interface NameView : DefView
{
string name;
}
+(NameView *)withName:(string)name;
@end
#endif//__qwaq_debugger_nameview_h

View file

@ -0,0 +1,33 @@
#include <string.h>
#include "debugger/nameview.h"
@implementation NameView
-initWithName:(string)name
{
if (!(self = [super initWithType:type])) {
return nil;
}
self.name = name;
return self;
}
-(void)dealloc
{
str_free (name);
[super dealloc];
}
+(NameView *)withName:(string)name
{
return [[[self alloc] initWithName:name] autorelease];
}
-draw
{
[super draw];
[self mvaddstr:{0, 0}, str_mid (name, 0, xlen)];
return self;
}
@end

View file

@ -0,0 +1,13 @@
#ifndef __qwaq_debugger_pointerview_h
#define __qwaq_debugger_pointerview_h
#include "debugger/defview.h"
@interface PointerView : DefView
{
unsigned *data;
}
+(PointerView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data;
@end
#endif//__qwaq_debugger_pointerview_h

View file

@ -0,0 +1,28 @@
#include <string.h>
#include "debugger/pointerview.h"
@implementation PointerView
-initWithType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data
{
if (!(self = [super initWithType:type])) {
return nil;
}
self.data = (unsigned *)(data + offset);
return self;
}
+(PointerView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data
{
return [[[self alloc] initWithType:type at:offset in:data] autorelease];
}
-draw
{
[super draw];
string val = sprintf ("FIXME [%x]", data[0]);
[self mvaddstr:{0, 0}, str_mid (val, 0, xlen)];
return self;
}
@end

View file

@ -0,0 +1,13 @@
#ifndef __qwaq_debugger_quatview_h
#define __qwaq_debugger_quatview_h
#include "debugger/defview.h"
@interface QuatView : DefView
{
quaternion *data;
}
+(QuatView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data;
@end
#endif//__qwaq_debugger_quatview_h

View file

@ -0,0 +1,28 @@
#include <string.h>
#include "debugger/quatview.h"
@implementation QuatView
-initWithType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data
{
if (!(self = [super initWithType:type])) {
return nil;
}
self.data = (quaternion *)(data + offset);
return self;
}
+(QuatView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data
{
return [[[self alloc] initWithType:type at:offset in:data] autorelease];
}
-draw
{
[super draw];
string val = sprintf ("%.9q", data[0]);
[self mvaddstr:{0, 0}, str_mid (val, 0, xlen)];
return self;
}
@end

View file

@ -0,0 +1,13 @@
#ifndef __qwaq_debugger_stringview_h
#define __qwaq_debugger_stringview_h
#include "debugger/defview.h"
@interface StringView : DefView
{
string *data;
}
+(StringView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data;
@end
#endif//__qwaq_debugger_stringview_h

View file

@ -0,0 +1,28 @@
#include <string.h>
#include "debugger/stringview.h"
@implementation StringView
-initWithType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data
{
if (!(self = [super initWithType:type])) {
return nil;
}
self.data = (string *)(data + offset);
return self;
}
+(StringView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data
{
return [[[self alloc] initWithType:type at:offset in:data] autorelease];
}
-draw
{
[super draw];
string val = sprintf ("FIXME %s", data[0]);// quote string
[self mvaddstr:{0, 0}, str_mid (val, 0, xlen)];
return self;
}
@end

View file

@ -69,7 +69,6 @@ static void type_free (void *t, void *unused)
for (type = encodings.types;
((int *)type - (int *) encodings.types) < encodings.size;
type = next_type (type)) {
printf ("%s\n", type.encoding);
Hash_Add (static_encodings, type);
}
return self;

View file

@ -0,0 +1,13 @@
#ifndef __qwaq_debugger_uintview_h
#define __qwaq_debugger_uintview_h
#include "debugger/defview.h"
@interface UIntView : DefView
{
unsigned *data;
}
+(UIntView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data;
@end
#endif//__qwaq_debugger_uintview_h

View file

@ -0,0 +1,28 @@
#include <string.h>
#include "debugger/uintview.h"
@implementation UIntView
-initWithType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data
{
if (!(self = [super initWithType:type])) {
return nil;
}
self.data = (unsigned *)(data + offset);
return self;
}
+(UIntView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data
{
return [[[self alloc] initWithType:type at:offset in:data] autorelease];
}
-draw
{
[super draw];
string val = sprintf ("%u", data[0]);
[self mvaddstr:{0, 0}, str_mid (val, 0, xlen)];
return self;
}
@end

View file

@ -0,0 +1,13 @@
#ifndef __qwaq_debugger_vectorview_h
#define __qwaq_debugger_vectorview_h
#include "debugger/defview.h"
@interface VectorView : DefView
{
vector *data;
}
+(VectorView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data;
@end
#endif//__qwaq_debugger_vectorview_h

View file

@ -0,0 +1,28 @@
#include <string.h>
#include "debugger/vectorview.h"
@implementation VectorView
-initWithType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data
{
if (!(self = [super initWithType:type])) {
return nil;
}
self.data = (vector *)(data + offset);
return self;
}
+(VectorView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data
{
return [[[self alloc] initWithType:type at:offset in:data] autorelease];
}
-draw
{
[super draw];
string val = sprintf ("%.9v", data[0]);
[self mvaddstr:{0, 0}, str_mid (val, 0, xlen)];
return self;
}
@end

View file

@ -0,0 +1,13 @@
#ifndef __qwaq_debugger_voidview_h
#define __qwaq_debugger_voidview_h
#include "debugger/defview.h"
@interface VoidView : DefView
{
unsigned *data;
}
+(VoidView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data;
@end
#endif//__qwaq_debugger_voidview_h

View file

@ -0,0 +1,29 @@
#include <string.h>
#include "debugger/voidview.h"
@implementation VoidView
-initWithType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data
{
if (!(self = [super initWithType:type])) {
return nil;
}
self.data = (unsigned *) (data + offset);
return self;
}
+(VoidView *)withType:(qfot_type_t *)type at:(unsigned)offset in:(void *)data
{
return [[[self alloc] initWithType:type at:offset in:data] autorelease];
}
-draw
{
[super draw];
string val = sprintf ("%08x %08x %08x %08x",
data[0], data[1], data[2], data[3]);
[self mvaddstr:{0, 0}, str_mid (val, 0, xlen)];
return self;
}
@end

View file

@ -1,6 +1,7 @@
#include <Array.h>
#include "ui/listener.h"
#include "ui/curses.h"
@class Array;
@ -55,6 +56,12 @@
return self;
}
-(void)dealloc
{
[listeners release];
[super dealloc];
}
-addListener: (id) responder :(SEL)message
{
Listener *listener = [Listener listenerWithResponder:responder :message];

View file

@ -62,6 +62,7 @@
[objects release];
[buffer release];
[onScrollBarModified release];
[super dealloc];
}
+(ScrollBar *)horizontal:(unsigned)len at:(Point)pos

View file

@ -49,6 +49,7 @@
options = ofCanFocus | ofRelativeEvents;
columns = [[Array array] retain];
buffer = [[DrawBuffer buffer:size] retain];
[buffer bkgd:' '];
[onViewScrolled addListener:self :@selector(onScroll:)];
return self;
}
@ -58,6 +59,7 @@
[columns release];
[buffer release];
[dataSource release];
[super dealloc];
}
+(TableView *)withRect:(Rect)rect

View file

@ -60,9 +60,6 @@ static void view_init(View *self)
- (void) dealloc
{
if (owner) {
[owner remove:self];
}
[onReceiveFocus release];
[onReleaseFocus release];
[onEvent release];
@ -353,6 +350,16 @@ updateScreenCursor (View *view)
return self;
}
-(ListenerGroup *) onReceiveFocus
{
return onReceiveFocus;
}
-(ListenerGroup *) onReleaseFocus
{
return onReleaseFocus;
}
-(ListenerGroup *)onEvent
{
return onEvent;
@ -391,16 +398,6 @@ updateScreenCursor (View *view)
return self;
}
-(ListenerGroup *) onReceiveFocus
{
return onReceiveFocus;
}
-(ListenerGroup *) onReleaseFocus
{
return onReleaseFocus;
}
-raise
{
return self;