Skip to content

Commit

Permalink
This is just for cotto to see
Browse files Browse the repository at this point in the history
  • Loading branch information
soh-cah-toa committed Jun 30, 2011
1 parent dd98cd2 commit e52afe3
Showing 1 changed file with 33 additions and 12 deletions.
45 changes: 33 additions & 12 deletions src/hbdb.c
Expand Up @@ -36,6 +36,9 @@ function.
#include "parrot/pobj.h"
#include "pmc/pmc_parrotinterpreter.h"

/* Number of commands */
#define NUM_CMDS 3

/* Size of command-line buffer */
#define HBDB_CMD_BUFFER_LENGTH 128

Expand Down Expand Up @@ -85,14 +88,14 @@ static const char * skip_whitespace(ARGIN(const char *cmd))
/* Contains information about the implementation of a particular command */
struct hbdb_cmd_t {
hbdb_cmd_func_t function; /* Points to the function the executes the command */
const char * const help; /* Help message associated with the command */
char *help; /* Help message associated with the command */
};

/* Contains general information about a particular command */
struct hbdb_cmd_table_t {
const char * const name; /* Command name */
const char * const short_name; /* Command name abbreviation */
const hbdb_cmd_t * const cmd; /* Command function and help message */
char *name; /* Command name */
char *short_name; /* Command name abbreviation */
hbdb_cmd_t *cmd; /* Command function and help message */
};

/* Help message displayed for each command */
Expand All @@ -106,11 +109,13 @@ const char * const cmd_help_help = "List of commands:\n\n"
"\nType \"help\" followed by a command name.";

/* Global command table */
const hbdb_cmd_table_t command_table[] = {
{ "break", "b", { &hbdb_cmd_break, cmd_break_help } },
{ "help", "h", { &hbdb_cmd_help, cmd_help_help } },
{ "quit", "q", { &hbdb_cmd_quit, cmd_quit_help } }
};
/*const hbdb_cmd_table_t command_table[] = {*/
/*{ "break", "b", { &hbdb_cmd_break, cmd_break_help } },*/
/*{ "help", "h", { &hbdb_cmd_help, cmd_help_help } },*/
/*{ "quit", "q", { &hbdb_cmd_quit, cmd_quit_help } }*/
/*};*/

hbdb_cmd_table_t command_table[NUM_CMDS];

/*
Expand Down Expand Up @@ -147,12 +152,12 @@ hbdb_cmd_break(PARROT_INTERP, ARGIN(const char * const cmd))
/* Do nothing thanks to IMCC */
}
else {
pos = interp->code->base.data;
/*pos = interp->code->base.data;*/
}

/* TODO Logic for parsing conditionals goes here */

bp->pc = pos;
/*bp->pc = pos;*/
/*bp->line = line->number;*/

/* Don't skip, yet */
Expand Down Expand Up @@ -384,10 +389,26 @@ hbdb_init(PARROT_INTERP)
hbdb->debugee = interp;
hbdb->debugger = debugger;

/* Allocate memory for command-line buffers, NUL terminated c strings */
/* Allocate memory for command-line buffers, NULL terminated c strings */
hbdb->current_command = mem_gc_allocate_n_typed(interp, HBDB_CMD_BUFFER_LENGTH + 1, char);
hbdb->last_command = mem_gc_allocate_n_typed(interp, HBDB_CMD_BUFFER_LENGTH + 1, char);
hbdb->file = mem_gc_allocate_zeroed_typed(interp, hbdb_file_t);

command_table[0].name = "break";
command_table[0].short_name = "b";
command_table[0].cmd->function = &hbdb_cmd_break;
command_table[0].cmd->help = &cmd_break_help;

command_table[1].name = "help";
command_table[1].short_name = "h";
command_table[1].cmd->function = &hbdb_cmd_help;
command_table[1].cmd->help = &cmd_help_help;

command_table[2].name = "quit";
command_table[2].short_name = "q";
command_table[2].cmd->function = &hbdb_cmd_quit;
/*command_table[2].cmd->help = &cmd_help_quit;*/
command_table[2].cmd->help = "FIXME";
}

/* Set HBDB_RUNNING and HBDB_ENTERED status flags */
Expand Down

0 comments on commit e52afe3

Please sign in to comment.