mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 13:39:02 +00:00
Add breakpoint builtin
darcs-hash:20061111105400-ac50b-18b9165f8719efd45b46e3b3786f7079edd721e7.gz
This commit is contained in:
parent
83a3706099
commit
6616543991
4 changed files with 43 additions and 3 deletions
16
builtin.c
16
builtin.c
|
@ -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
|
||||
|
|
10
parser.c
10
parser.c
|
@ -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
|
||||
|
@ -330,6 +336,10 @@ const static struct block_lookup_entry block_lookup[]=
|
|||
EVENT, 0, EVENT_BLOCK
|
||||
}
|
||||
,
|
||||
{
|
||||
BREAKPOINT, L"breakpoint", BREAKPOINT_BLOCK
|
||||
}
|
||||
,
|
||||
{
|
||||
0, 0, 0
|
||||
}
|
||||
|
|
1
parser.h
1
parser.h
|
@ -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 */
|
||||
}
|
||||
;
|
||||
|
||||
|
|
15
reader.c
15
reader.c
|
@ -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 )
|
||||
{
|
||||
|
@ -1993,7 +2006,7 @@ static int read_i()
|
|||
}
|
||||
}
|
||||
|
||||
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" ));
|
||||
|
||||
|
|
Loading…
Reference in a new issue