mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-30 06:03:49 +08:00
Migrate builtin_string.cpp to its own object file
This keeps the architecture a little less surprising
This commit is contained in:
parent
d83ef07ca7
commit
b2e8967e94
|
@ -97,9 +97,9 @@ FISH_OBJS := obj/function.o obj/builtin.o obj/complete.o obj/env.o obj/exec.o \
|
|||
obj/env_universal_common.o obj/input_common.o obj/event.o obj/signal.o \
|
||||
obj/io.o obj/parse_util.o obj/common.o obj/screen.o obj/path.o \
|
||||
obj/autoload.o obj/parser_keywords.o obj/iothread.o obj/color.o \
|
||||
obj/postfork.o obj/builtin_test.o obj/parse_tree.o obj/parse_productions.o \
|
||||
obj/parse_execution.o obj/pager.o obj/utf8.o obj/fish_version.o \
|
||||
obj/wcstringutil.o
|
||||
obj/postfork.o obj/builtin_string.o obj/builtin_test.o obj/parse_tree.o \
|
||||
obj/parse_productions.o obj/parse_execution.o obj/pager.o obj/utf8.o \
|
||||
obj/fish_version.o obj/wcstringutil.o
|
||||
|
||||
FISH_INDENT_OBJS := obj/fish_indent.o obj/print_help.o $(FISH_OBJS)
|
||||
|
||||
|
@ -110,7 +110,7 @@ FISH_INDENT_OBJS := obj/fish_indent.o obj/print_help.o $(FISH_OBJS)
|
|||
BUILTIN_FILES := src/builtin_set.cpp src/builtin_commandline.cpp \
|
||||
src/builtin_ulimit.cpp src/builtin_complete.cpp \
|
||||
src/builtin_jobs.cpp src/builtin_set_color.cpp \
|
||||
src/builtin_printf.cpp src/builtin_string.cpp
|
||||
src/builtin_printf.cpp
|
||||
|
||||
|
||||
#
|
||||
|
|
|
@ -146,6 +146,8 @@
|
|||
D033781115DC6D4C00A634BA /* completions in CopyFiles */ = {isa = PBXBuildFile; fileRef = D025C02715D1FEA100B9DB63 /* completions */; };
|
||||
D033781215DC6D5200A634BA /* functions in CopyFiles */ = {isa = PBXBuildFile; fileRef = D025C02815D1FEA100B9DB63 /* functions */; };
|
||||
D033781315DC6D5400A634BA /* tools in CopyFiles */ = {isa = PBXBuildFile; fileRef = D025C02915D1FEA100B9DB63 /* tools */; };
|
||||
D04F7F7C1BA4BF4000B0F227 /* builtin_string.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D04F7F7B1BA4BF4000B0F227 /* builtin_string.cpp */; };
|
||||
D04F7F7D1BA4BF4000B0F227 /* builtin_string.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D04F7F7B1BA4BF4000B0F227 /* builtin_string.cpp */; };
|
||||
D052D80B1868F7FC003ABCBD /* parse_execution.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D052D8091868F7FC003ABCBD /* parse_execution.cpp */; };
|
||||
D07B247315BCC15700D4ADB4 /* add-shell in Resources */ = {isa = PBXBuildFile; fileRef = D07B247215BCC15700D4ADB4 /* add-shell */; };
|
||||
D07B247615BCC4BE00D4ADB4 /* install.sh in Resources */ = {isa = PBXBuildFile; fileRef = D07B247515BCC4BE00D4ADB4 /* install.sh */; };
|
||||
|
@ -372,6 +374,7 @@
|
|||
D03238891849D1980032CF2C /* pager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = pager.cpp; sourceTree = "<group>"; };
|
||||
D032388A1849D1980032CF2C /* pager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pager.h; sourceTree = "<group>"; };
|
||||
D03EE83814DF88B200FC7150 /* lru.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = lru.h; sourceTree = "<group>"; };
|
||||
D04F7F7B1BA4BF4000B0F227 /* builtin_string.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = builtin_string.cpp; sourceTree = "<group>"; };
|
||||
D052D8091868F7FC003ABCBD /* parse_execution.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = parse_execution.cpp; sourceTree = "<group>"; };
|
||||
D052D80A1868F7FC003ABCBD /* parse_execution.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = parse_execution.h; sourceTree = "<group>"; };
|
||||
D07B247215BCC15700D4ADB4 /* add-shell */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = "add-shell"; path = "build_tools/osx_package_scripts/add-shell"; sourceTree = "<group>"; };
|
||||
|
@ -583,6 +586,7 @@
|
|||
D0A0853413B3ACEE0099B651 /* builtin_ulimit.cpp */,
|
||||
D0F3373A1506DE3C00ECEFC0 /* builtin_test.cpp */,
|
||||
D0CA63F316FC275F00093BD4 /* builtin_printf.cpp */,
|
||||
D04F7F7B1BA4BF4000B0F227 /* builtin_string.cpp */,
|
||||
D0A0853513B3ACEE0099B651 /* builtin.cpp */,
|
||||
D0B6B0FF14E88BA400AD6C10 /* color.h */,
|
||||
D0B6B0FE14E88BA400AD6C10 /* color.cpp */,
|
||||
|
@ -1078,6 +1082,7 @@
|
|||
D00769321990137800CA4627 /* wgetopt.cpp in Sources */,
|
||||
D00769331990137800CA4627 /* wutil.cpp in Sources */,
|
||||
D00769341990137800CA4627 /* input.cpp in Sources */,
|
||||
D04F7F7D1BA4BF4000B0F227 /* builtin_string.cpp in Sources */,
|
||||
D00769351990137800CA4627 /* output.cpp in Sources */,
|
||||
D00769361990137800CA4627 /* intern.cpp in Sources */,
|
||||
D00769371990137800CA4627 /* env_universal_common.cpp in Sources */,
|
||||
|
@ -1179,6 +1184,7 @@
|
|||
D0D02A751598385E008E62BD /* wgetopt.cpp in Sources */,
|
||||
D0D02A7615983869008E62BD /* wutil.cpp in Sources */,
|
||||
D0D02A7715983875008E62BD /* input.cpp in Sources */,
|
||||
D04F7F7C1BA4BF4000B0F227 /* builtin_string.cpp in Sources */,
|
||||
D0D02A781598387E008E62BD /* output.cpp in Sources */,
|
||||
D0D02A7915983888008E62BD /* intern.cpp in Sources */,
|
||||
D0D02A7B15983928008E62BD /* env_universal_common.cpp in Sources */,
|
||||
|
|
|
@ -151,7 +151,7 @@ static std::stack<io_stack_elem_t, std::vector<io_stack_elem_t> > io_stack;
|
|||
The file from which builtin functions should attempt to read, use
|
||||
instead of stdin.
|
||||
*/
|
||||
static int builtin_stdin;
|
||||
int builtin_stdin;
|
||||
|
||||
/**
|
||||
The underlying IO redirections behind the current builtin. This
|
||||
|
@ -163,7 +163,7 @@ static const io_chain_t *real_io;
|
|||
/**
|
||||
Counts the number of non null pointers in the specified array
|
||||
*/
|
||||
static int builtin_count_args(const wchar_t * const * argv)
|
||||
int builtin_count_args(const wchar_t * const * argv)
|
||||
{
|
||||
int argc = 1;
|
||||
while (argv[argc] != NULL)
|
||||
|
@ -247,7 +247,7 @@ wcstring builtin_help_get(parser_t &parser, const wchar_t *name)
|
|||
|
||||
*/
|
||||
|
||||
static void builtin_print_help(parser_t &parser, const wchar_t *cmd, wcstring &b)
|
||||
void builtin_print_help(parser_t &parser, const wchar_t *cmd, wcstring &b)
|
||||
{
|
||||
if (&b == &stderr_buffer)
|
||||
{
|
||||
|
@ -399,11 +399,13 @@ static void builtin_missing_argument(parser_t &parser, const wchar_t *cmd, const
|
|||
#include "builtin_jobs.cpp"
|
||||
#include "builtin_set_color.cpp"
|
||||
#include "builtin_printf.cpp"
|
||||
#include "builtin_string.cpp"
|
||||
|
||||
/* builtin_test lives in builtin_test.cpp */
|
||||
int builtin_test(parser_t &parser, wchar_t **argv);
|
||||
|
||||
/* builtin_string lives in builtin_string.cpp */
|
||||
int builtin_string(parser_t &parser, wchar_t **argv);
|
||||
|
||||
/**
|
||||
List a single key binding.
|
||||
Returns false if no binding with that sequence and mode exists.
|
||||
|
|
|
@ -2,17 +2,33 @@
|
|||
Implementation of the string builtin.
|
||||
*/
|
||||
|
||||
#include "config.h" // IWYU pragma: keep
|
||||
|
||||
#define PCRE2_CODE_UNIT_WIDTH WCHAR_T_BITS
|
||||
#ifdef _WIN32
|
||||
#define PCRE2_STATIC
|
||||
#endif
|
||||
#include "pcre2.h"
|
||||
|
||||
#include "builtin.h"
|
||||
#include "common.h"
|
||||
#include "parser.h"
|
||||
#include "parse_util.h"
|
||||
#include "wgetopt.h"
|
||||
#include "wildcard.h"
|
||||
#include "wutil.h"
|
||||
#include <unistd.h>
|
||||
|
||||
#define MAX_REPLACE_SIZE size_t(1048576) // pcre2_substitute maximum output size in wchar_t
|
||||
#define STRING_ERR_MISSING _(L"%ls: Expected argument\n")
|
||||
|
||||
/* externs from builtin.cpp */
|
||||
extern int builtin_count_args(const wchar_t * const * argv);
|
||||
extern wcstring stdout_buffer, stderr_buffer;
|
||||
void builtin_print_help(parser_t &parser, const wchar_t *cmd, wcstring &b);
|
||||
extern int builtin_stdin;
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
BUILTIN_STRING_OK = 0,
|
||||
|
|
Loading…
Reference in New Issue
Block a user