Use private use area for internal non-unicode characters

darcs-hash:20051020112754-ac50b-a640e5eb3c72c44671bfd5d0e4d6805018da5b48.gz
This commit is contained in:
axel 2005-10-20 21:27:54 +10:00
parent 83fcc29305
commit ce27f08a44
4 changed files with 55 additions and 32 deletions

View File

@ -51,23 +51,32 @@
#define DIRECTORIES_ONLY 32
/** Character represeting a home directory */
#define HOME_DIRECTORY 0xfffffffc
/*
Use unencoded private-use keycodes for internal characters
*/
#define EXPAND_RESERVED 0xf000
/** Character represeting process expantion */
#define PROCESS_EXPAND 0xfffffffb
enum
{
/** Character represeting a home directory */
HOME_DIRECTORY = EXPAND_RESERVED,
/** Character representing variable expantion */
#define VARIABLE_EXPAND 0xfffffffa
/** Character represeting process expantion */
PROCESS_EXPAND,
/** Character representing variable expantion */
VARIABLE_EXPAND,
/** Character representing the start of a bracket expantion */
#define BRACKET_BEGIN 0xfffffff9
/** Character representing the start of a bracket expantion */
BRACKET_BEGIN,
/** Character representing the end of a bracket expantion */
#define BRACKET_END 0xfffffff8
/** Character representing the end of a bracket expantion */
BRACKET_END,
/** Character representing separation between two bracket elements */
#define BRACKET_SEP 0xfffffff7
/** Character representing separation between two bracket elements */
BRACKET_SEP,
}
;
/** Character for separating two array elements. We use 30, i.e. the ascii record separator since that seems logical. */
#define ARRAY_SEP 0x1e

View File

@ -8,15 +8,19 @@ Header file for the low level input library
#include <wchar.h>
#ifndef WCHAR_MAX
#define WCHAR_MAX 0x80000000
#endif
#define WCHAR_END (WCHAR_MAX + (unsigned long)1)
/*
Use unencoded private-use keycodes for internal characters
*/
#define INPUT_COMMON_RESERVED 0xe000
enum
{
R_NULL = WCHAR_END + (unsigned long)1
/**
R_NULL is sometimes returned by the input when a character was
requested but none could be delivered, or when an exception
happened.
*/
R_NULL = INPUT_COMMON_RESERVED
}
;

View File

@ -2392,7 +2392,14 @@ static int can_read( int fd )
return 0;
}
/**
Test if the specified character is in the private use area that fish uses to store internal characters
*/
static int wchar_private( wchar_t c )
{
return ( (c >= 0xe000) && (c <= 0xf8ff ) );
}
wchar_t *reader_readline()
{
@ -2442,7 +2449,7 @@ wchar_t *reader_readline()
while( 1 )
{
c=input_readch();
if( (c< WCHAR_END) && (c>31) && (c != 127) )
if( ( (!wchar_private(c))) && (c>31) && (c != 127) )
{
if( can_read(0) )
{
@ -2462,7 +2469,7 @@ wchar_t *reader_readline()
break;
}
c = input_readch();
if( (c< WCHAR_END) && (c>31) && (c != 127) )
if( (!wchar_private(c)) && (c>31) && (c != 127) )
{
arr[i]=c;
c=0;
@ -2835,7 +2842,7 @@ wchar_t *reader_readline()
/* Other, if a normal character, we add it to the command */
default:
{
if( (c< WCHAR_END) && (c>31) && (c != 127) )
if( (!wchar_private(c)) && (c>31) && (c != 127) )
insert_char( c );
else
debug( 0, L"Unknown keybinding %d", c );

View File

@ -15,20 +15,23 @@
#include "util.h"
/*
These constants are outside the 31 bit character space of USC4,
thogh they may clash with WEOF. I need to use characters outside of
the regular character space to represent wildcards and such,
in order to do backslash removal before wildcard matching.
Use unencoded private-use keycodes for internal characters
*/
/** Character representing any character except '/' */
#define ANY_CHAR 0xfffffffe
#define WILDCARD_RESERVED 0xf400
/** Character representing any character string not containing '/' (A slash) */
#define ANY_STRING 0xfffffffd
enum
{
/** Character representing any character except '/' */
ANY_CHAR = WILDCARD_RESERVED,
/** Character representing any character string */
#define ANY_STRING_RECURSIVE 0xfffffff6
/** Character representing any character string not containing '/' (A slash) */
ANY_STRING,
/** Character representing any character string */
ANY_STRING_RECURSIVE,
}
;
/**
Expand the wildcard by matching against the filesystem.