Add breakpoint builtin

darcs-hash:20061111105400-ac50b-18b9165f8719efd45b46e3b3786f7079edd721e7.gz
This commit is contained in:
axel 2006-11-11 20:54:00 +10:00
parent 83a3706099
commit 6616543991
4 changed files with 43 additions and 3 deletions

View file

@ -2843,6 +2843,18 @@ static int builtin_break_continue( wchar_t **argv )
return STATUS_BUILTIN_OK;
}
static int builtin_breakpoint( wchar_t **argv )
{
parser_push_block( BREAKPOINT );
reader_read( 0 );
parser_pop_block();
return proc_get_last_status();
}
/**
Function for handling the \c return builtin
*/
@ -3108,6 +3120,10 @@ const static builtin_data_t builtin_data[]=
L"begin", &builtin_begin, N_( L"Create a block of code" )
}
,
{
L"breakpoint", &builtin_breakpoint, N_( L"Temporarily halt execution and launch a new prompt" )
}
,
/*
Builtins that are handled directly by the parser. They are

View file

@ -188,6 +188,12 @@ The fish parser. Contains functions for parsing and evaluating code.
*/
#define FOR_BLOCK N_( L"'for' block" )
/**
Breakpoint block
*/
#define BREAKPOINT_BLOCK N_( L"Block created by breakpoint" )
/**
If block description
@ -331,7 +337,11 @@ const static struct block_lookup_entry block_lookup[]=
}
,
{
0,0,0
BREAKPOINT, L"breakpoint", BREAKPOINT_BLOCK
}
,
{
0, 0, 0
}
}
;

View file

@ -138,6 +138,7 @@ enum block_type
BEGIN, /**< Unconditional block */
SOURCE, /**< Block created by the . (source) builtin */
EVENT, /**< Block created on event notifier invocation */
BREAKPOINT, /**< Breakpoint block */
}
;

View file

@ -1983,6 +1983,19 @@ static int read_i()
{
job_t *j;
int has_job=0;
int is_breakpoint=0;
block_t *b;
for( b = current_block;
b;
b = b->outer )
{
if( b->type == BREAKPOINT )
{
is_breakpoint = 1;
break;
}
}
for( j=first_job; j; j=j->next )
{
@ -1992,8 +2005,8 @@ static int read_i()
break;
}
}
if( !reader_exit_forced() && !data->prev_end_loop && has_job )
if( !reader_exit_forced() && !data->prev_end_loop && has_job && !is_breakpoint )
{
writestr(_( L"There are stopped jobs\n" ));