Revert "Merge pull request #1317 from pullreq/cpp"

This reverts commit 74135c0600, reversing
changes made to 6d749789ce.

See discussion in #1317
This commit is contained in:
ridiculousfish 2014-02-28 02:15:24 -08:00
parent 858b6aa257
commit be33d3f2a4
60 changed files with 95 additions and 103 deletions

View file

@ -422,7 +422,7 @@ INPUT =
# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp
# *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm # *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm
FILE_PATTERNS = *.h *.cpp FILE_PATTERNS = *.h *.c
# The RECURSIVE tag can be used to turn specify whether or not subdirectories # The RECURSIVE tag can be used to turn specify whether or not subdirectories
# should be searched for input files as well. Possible values are YES and NO. # should be searched for input files as well. Possible values are YES and NO.

View file

@ -1,4 +1,4 @@
/** \file builtin.cpp /** \file builtin.c
Functions for executing builtin functions. Functions for executing builtin functions.
How to add a new builtin function: How to add a new builtin function:

View file

@ -1,4 +1,4 @@
/** \file builtin_commandline.cpp Functions defining the commandline builtin /** \file builtin_commandline.c Functions defining the commandline builtin
Functions used for implementing the commandline builtin. Functions used for implementing the commandline builtin.

View file

@ -1,4 +1,4 @@
/** \file builtin_complete.cpp Functions defining the complete builtin /** \file builtin_complete.c Functions defining the complete builtin
Functions used for implementing the complete builtin. Functions used for implementing the complete builtin.
@ -279,8 +279,8 @@ const wchar_t *builtin_complete_get_temporary_buffer()
/** /**
The complete builtin. Used for specifying programmable The complete builtin. Used for specifying programmable
tab-completions. Calls the functions in complete.cpp for any heavy tab-completions. Calls the functions in complete.c for any heavy
lifting. Defined in builtin_complete.cpp lifting. Defined in builtin_complete.c
*/ */
static int builtin_complete(parser_t &parser, wchar_t **argv) static int builtin_complete(parser_t &parser, wchar_t **argv)
{ {

View file

@ -1,4 +1,4 @@
/** \file builtin_jobs.cpp /** \file builtin_jobs.c
Functions for executing the jobs builtin. Functions for executing the jobs builtin.
*/ */
#include "config.h" #include "config.h"

View file

@ -1,6 +1,3 @@
/** \file builtin_printf.cpp
*/
/* printf - format and print data /* printf - format and print data
Copyright (C) 1990-2007 Free Software Foundation, Inc. Copyright (C) 1990-2007 Free Software Foundation, Inc.

View file

@ -1,4 +1,4 @@
/** \file builtin_set.cpp Functions defining the set builtin /** \file builtin_set.c Functions defining the set builtin
Functions used for implementing the set builtin. Functions used for implementing the set builtin.

View file

@ -646,11 +646,13 @@ expression *test_parser::parse_args(const wcstring_list_t &args, wcstring &err)
expression *result = parser.parse_expression(0, (unsigned int)args.size()); expression *result = parser.parse_expression(0, (unsigned int)args.size());
/* Handle errors */ /* Handle errors */
bool errored = false;
for (size_t i = 0; i < parser.errors.size(); i++) for (size_t i = 0; i < parser.errors.size(); i++)
{ {
err.append(L"test: "); err.append(L"test: ");
err.append(parser.errors.at(i)); err.append(parser.errors.at(i));
err.push_back(L'\n'); err.push_back(L'\n');
errored = true;
// For now we only show the first error // For now we only show the first error
break; break;
} }
@ -665,6 +667,7 @@ expression *test_parser::parse_args(const wcstring_list_t &args, wcstring &err)
{ {
append_format(err, L"test: unexpected argument at index %lu: '%ls'\n", (unsigned long)result->range.end, args.at(result->range.end).c_str()); append_format(err, L"test: unexpected argument at index %lu: '%ls'\n", (unsigned long)result->range.end, args.at(result->range.end).c_str());
} }
errored = true;
delete result; delete result;
result = NULL; result = NULL;

View file

@ -1,4 +1,4 @@
/** \file builtin_ulimit.cpp Functions defining the ulimit builtin /** \file builtin_ulimit.c Functions defining the ulimit builtin
Functions used for implementing the ulimit builtin. Functions used for implementing the ulimit builtin.

View file

@ -1,4 +1,4 @@
/** \file common.cpp /** \file common.c
Various functions, mostly string utilities, that are used by most Various functions, mostly string utilities, that are used by most
parts of fish. parts of fish.
@ -866,7 +866,11 @@ void write_screen(const wcstring &msg, wcstring &buff)
/* /*
If token is zero character long, we don't do anything If token is zero character long, we don't do anything
*/ */
if (overflow) if (pos == start)
{
start = pos = pos+1;
}
else if (overflow)
{ {
/* /*
In case of overflow, we print a newline, except if we already are at position 0 In case of overflow, we print a newline, except if we already are at position 0

View file

@ -1,4 +1,4 @@
/** \file complete.cpp Functions related to tab-completion. /** \file complete.c Functions related to tab-completion.
These functions are used for storing and retrieving tab-completion data, as well as for performing tab-completion. These functions are used for storing and retrieving tab-completion data, as well as for performing tab-completion.
*/ */

View file

@ -1,4 +1,4 @@
/** \file env.cpp /** \file env.c
Functions for setting and getting environment variables. Functions for setting and getting environment variables.
*/ */
#include "config.h" #include "config.h"

View file

@ -1,9 +1,3 @@
/** \file env_universal.cpp
Various functions, mostly string utilities, that are used by most
parts of fish.
*/
#include "config.h" #include "config.h"

View file

@ -1,4 +1,5 @@
/** \file env_universal_common.cpp /**
\file env_universal_common.c
The utility library for universal variables. Used both by the The utility library for universal variables. Used both by the
client library and by the daemon. client library and by the daemon.

View file

@ -1,4 +1,4 @@
/** \file event.cpp /** \file event.c
Functions for handling event triggers Functions for handling event triggers

View file

@ -1,4 +1,4 @@
/** \file exec.cpp /** \file exec.c
Functions for executing a program. Functions for executing a program.
Some of the code in this file is based on code from the Glibc Some of the code in this file is based on code from the Glibc

View file

@ -1,4 +1,4 @@
/**\file expand.cpp /**\file expand.c
String expansion functions. These functions perform several kinds of String expansion functions. These functions perform several kinds of
parameter expansion. parameter expansion.

View file

@ -1,5 +1,4 @@
/** \file fallback.cpp /**
This file only contains fallback implementations of functions which This file only contains fallback implementations of functions which
have been found to be missing or broken by the configuration have been found to be missing or broken by the configuration
scripts. scripts.

View file

@ -1,6 +1,3 @@
/** \file fish.cpp
The main loop of fish.
*/
/* /*
Copyright (C) 2005-2008 Axel Liljencrantz Copyright (C) 2005-2008 Axel Liljencrantz
@ -18,6 +15,11 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/** \file fish.c
The main loop of <tt>fish</tt>.
*/
#include "config.h" #include "config.h"
@ -211,6 +213,8 @@ static struct config_paths_t determine_config_directory_paths(const char *argv0)
paths.sysconf = L"" SYSCONFDIR "/fish"; paths.sysconf = L"" SYSCONFDIR "/fish";
paths.doc = L"" DOCDIR; paths.doc = L"" DOCDIR;
paths.bin = L"" BINDIR; paths.bin = L"" BINDIR;
done = true;
} }
return paths; return paths;

View file

@ -1,6 +1,3 @@
/** \file fish_indent.cpp
The fish_indent proegram.
*/
/* /*
Copyright (C) 2005-2008 Axel Liljencrantz Copyright (C) 2005-2008 Axel Liljencrantz
@ -18,6 +15,11 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/** \file fish_indent.cpp
The fish_indent proegram.
*/
#include "config.h" #include "config.h"
#include <stdlib.h> #include <stdlib.h>

View file

@ -1,7 +1,3 @@
/** \file fish_pager.cpp
*/
#include "config.h" #include "config.h"
#include <stdlib.h> #include <stdlib.h>
@ -443,6 +439,9 @@ static void completion_print_item(const wchar_t *prefix, comp_t *c, int width, b
writech(L' '); writech(L' ');
} }
set_color(get_color(HIGHLIGHT_PAGER_DESCRIPTION), bg); set_color(get_color(HIGHLIGHT_PAGER_DESCRIPTION), bg);
written += print_max(L"(", 1, 0);
written += print_max(c->desc.c_str(), desc_width, 0);
written += print_max(L")", 1, 0);
} }
else else
{ {

View file

@ -1,4 +1,4 @@
/** \file fish_tests.cpp /** \file fish_tests.c
Various bug and feature tests. Compiled and run by make test. Various bug and feature tests. Compiled and run by make test.
*/ */

View file

@ -1,4 +1,4 @@
/** \file fishd.cpp /** \file fishd.c
The universal variable server. fishd is automatically started by fish The universal variable server. fishd is automatically started by fish
if a fishd server isn't already running. fishd reads any saved if a fishd server isn't already running. fishd reads any saved

View file

@ -1,4 +1,4 @@
/** \file function.cpp /** \file function.c
Prototypes for functions for storing and retrieving function Prototypes for functions for storing and retrieving function
information. These functions also take care of autoloading information. These functions also take care of autoloading

View file

@ -1,4 +1,4 @@
/** \file highlight.cpp /** \file highlight.c
Functions for syntax highlighting Functions for syntax highlighting
*/ */
#include "config.h" #include "config.h"

View file

@ -1,4 +1,4 @@
/** \file input.cpp /** \file input.c
Functions for reading a character of input from stdin. Functions for reading a character of input from stdin.

View file

@ -1,4 +1,4 @@
/** \file input_common.cpp /** \file input_common.c
Implementation file for the low level input library Implementation file for the low level input library

View file

@ -1,4 +1,4 @@
/** \file intern.cpp /** \file intern.c
Library for pooling common strings Library for pooling common strings

2
io.cpp
View file

@ -1,4 +1,4 @@
/** \file io.cpp /** \file io.c
Utilities for io redirection. Utilities for io redirection.

View file

@ -1,6 +1,3 @@
/** \file iothread.cpp
*/
#include "config.h" #include "config.h"
#include "iothread.h" #include "iothread.h"
#include "common.h" #include "common.h"

View file

@ -1,5 +1,4 @@
/** \file key_reader.cpp /*
A small utility to print the resulting key codes from pressing a A small utility to print the resulting key codes from pressing a
key. Servers the same function as hitting ^V in bash, but I prefer key. Servers the same function as hitting ^V in bash, but I prefer
the way key_reader works. the way key_reader works.

View file

@ -1,4 +1,4 @@
/** \file kill.cpp /** \file kill.c
The killring. The killring.
Works like the killring in emacs and readline. The killring is cut Works like the killring in emacs and readline. The killring is cut

View file

@ -1,4 +1,4 @@
/** \file mimedb.cpp /** \file mimedb.c
mimedb is a program for checking the mimetype, description and mimedb is a program for checking the mimetype, description and
default action associated with a file or mimetype. It uses the default action associated with a file or mimetype. It uses the

View file

@ -1,4 +1,4 @@
/** \file output.cpp /** \file output.c
Generic output functions Generic output functions
*/ */

View file

@ -1,7 +1,3 @@
/** \file pager.cpp
*/
#include "config.h" #include "config.h"
#include "pager.h" #include "pager.h"
@ -149,6 +145,9 @@ line_t pager_t::completion_print_item(const wcstring &prefix, const comp_t *c, s
{ {
written += print_max(L" ", packed_color, 1, false, &line_data); written += print_max(L" ", packed_color, 1, false, &line_data);
} }
written += print_max(L"(", packed_color, 1, false, &line_data);
written += print_max(c->desc, packed_color, desc_width, false, &line_data);
written += print_max(L")", packed_color, 1, false, &line_data);
} }
else else
{ {
@ -632,6 +631,11 @@ bool pager_t::completion_try_print(size_t cols, const wcstring &prefix, const co
{ {
search_field_text.append(PAGER_SEARCH_FIELD_WIDTH - search_field_text.size(), L' '); search_field_text.append(PAGER_SEARCH_FIELD_WIDTH - search_field_text.size(), L' ');
} }
line_t *search_field = &rendering->screen_data.insert_line_at_index(0);
/* We limit the width to term_width - 1 */
int search_field_written = print_max(SEARCH_FIELD_PROMPT, highlight_spec_normal, term_width - 1, false, search_field);
search_field_written += print_max(search_field_text, highlight_modifier_force_underline, term_width - search_field_written - 1, false, search_field);
} }
} }
@ -743,7 +747,7 @@ bool pager_t::select_next_completion_in_direction(selection_direction_t directio
} }
/* Ok, we had something selected already. Select something different. */ /* Ok, we had something selected already. Select something different. */
size_t new_selected_completion_idx; size_t new_selected_completion_idx = selected_completion_idx;
if (! selection_direction_is_cardinal(direction)) if (! selection_direction_is_cardinal(direction))
{ {
/* Next, previous, or deselect, all easy */ /* Next, previous, or deselect, all easy */

View file

@ -506,6 +506,7 @@ parse_execution_result_t parse_execution_context_t::run_for_statement(const pars
parse_execution_result_t parse_execution_context_t::run_switch_statement(const parse_node_t &statement) parse_execution_result_t parse_execution_context_t::run_switch_statement(const parse_node_t &statement)
{ {
assert(statement.type == symbol_switch_statement); assert(statement.type == symbol_switch_statement);
parse_execution_result_t ret = parse_execution_success;
const parse_node_t *matching_case_item = NULL; const parse_node_t *matching_case_item = NULL;
parse_execution_result_t result = parse_execution_success; parse_execution_result_t result = parse_execution_success;
@ -531,6 +532,7 @@ parse_execution_result_t parse_execution_context_t::run_switch_statement(const p
{ {
/* Store the node that failed to expand */ /* Store the node that failed to expand */
report_error(switch_value_node, WILDCARD_ERR_MSG, switch_value.c_str()); report_error(switch_value_node, WILDCARD_ERR_MSG, switch_value.c_str());
ret = parse_execution_errored;
break; break;
} }

View file

@ -1,7 +1,3 @@
/** \file parse_productions.cpp
*/
#include "parse_productions.h" #include "parse_productions.h"
using namespace parse_productions; using namespace parse_productions;

View file

@ -1,6 +1,3 @@
/** \file parse_tree.cpp
*/
#include "parse_productions.h" #include "parse_productions.h"
#include "tokenizer.h" #include "tokenizer.h"
#include "fallback.h" #include "fallback.h"
@ -990,6 +987,7 @@ void parse_ll_t::accept_tokens(parse_token_t token1, parse_token_t token2)
{ {
fprintf(stderr, "Consumed token %ls\n", token1.describe().c_str()); fprintf(stderr, "Consumed token %ls\n", token1.describe().c_str());
} }
consumed = true;
break; break;
} }

View file

@ -1,4 +1,4 @@
/** \file parse_util.cpp /** \file parse_util.c
Various mostly unrelated utility functions related to parsing, Various mostly unrelated utility functions related to parsing,
loading and evaluating fish code. loading and evaluating fish code.

View file

@ -1,4 +1,4 @@
/** \file parser.cpp /** \file parser.c
The fish parser. Contains functions for parsing and evaluating code. The fish parser. Contains functions for parsing and evaluating code.
@ -2590,6 +2590,13 @@ int parser_t::eval_new_parser(const wcstring &cmd, const io_chain_t &io, enum bl
parse_execution_context_t *ctx = new parse_execution_context_t(tree, cmd, this, exec_eval_level); parse_execution_context_t *ctx = new parse_execution_context_t(tree, cmd, this, exec_eval_level);
execution_contexts.push_back(ctx); execution_contexts.push_back(ctx);
/* Execute the first node */
int result = 1;
if (! tree.empty())
{
result = this->eval_block_node(0, io, block_type);
}
/* Clean up the execution context stack */ /* Clean up the execution context stack */
assert(! execution_contexts.empty() && execution_contexts.back() == ctx); assert(! execution_contexts.empty() && execution_contexts.back() == ctx);
execution_contexts.pop_back(); execution_contexts.pop_back();

View file

@ -1,4 +1,4 @@
/** \file parser_keywords.cpp /** \file parser_keywords.c
Functions having to do with parser keywords, like testing if a function is a block command. Functions having to do with parser keywords, like testing if a function is a block command.
*/ */

View file

@ -1,7 +1,3 @@
/** \file path.cpp
*/
#include "config.h" #include "config.h"
#include <stdlib.h> #include <stdlib.h>

View file

@ -1,4 +1,5 @@
/** \file print_help.cpp
/** \file print_help.c
Print help message for the specified command Print help message for the specified command
*/ */

View file

@ -1,4 +1,4 @@
/** \file proc.cpp /** \file proc.c
Utilities for keeping track of jobs, processes and subshells, as Utilities for keeping track of jobs, processes and subshells, as
well as signal handling functions for tracking children. These well as signal handling functions for tracking children. These
@ -383,6 +383,8 @@ static void mark_process_status(const job_t *j, process_t *p, int status)
} }
else else
{ {
ssize_t ignore;
/* This should never be reached */ /* This should never be reached */
p->completed = 1; p->completed = 1;
@ -396,6 +398,7 @@ static void mark_process_status(const job_t *j, process_t *p, int status)
handler. If things aren't working properly, it's safer to handler. If things aren't working properly, it's safer to
give up. give up.
*/ */
ignore = write(2, mess, strlen(mess));
} }
} }

View file

@ -1,4 +1,4 @@
/** \file reader.cpp /** \file reader.c
Functions for reading data from stdin and passing to the Functions for reading data from stdin and passing to the
parser. If stdin is a keyboard, it supplies a killring, history, parser. If stdin is a keyboard, it supplies a killring, history,

View file

@ -1,4 +1,4 @@
/** \file sanity.cpp /** \file sanity.c
Functions for performing sanity checks on the program state Functions for performing sanity checks on the program state
*/ */
#include "config.h" #include "config.h"

View file

@ -1,4 +1,4 @@
/** \file screen.cpp High level library for handling the terminal screen /** \file screen.c High level library for handling the terminal screen
The screen library allows the interactive reader to write its The screen library allows the interactive reader to write its
output to screen efficiently by keeping an internal representation output to screen efficiently by keeping an internal representation
@ -298,6 +298,7 @@ size_t escape_code_length(const wchar_t *code)
if (code[1] >= L'@' && code[1] <= L'_') if (code[1] >= L'@' && code[1] <= L'_')
{ {
resulting_length = 2; resulting_length = 2;
found = true;
} }
} }

Binary file not shown.

View file

@ -1,4 +1,4 @@
/** \file signal.cpp /** \file signal.c
The library for various signal related issues The library for various signal related issues
@ -477,7 +477,7 @@ static void handle_int(int sig, siginfo_t *info, void *context)
} }
/** /**
sigchld handler. Does notification and calls the handler in proc.cpp sigchld handler. Does notification and calls the handler in proc.c
*/ */
static void handle_chld(int sig, siginfo_t *info, void *context) static void handle_chld(int sig, siginfo_t *info, void *context)
{ {

View file

@ -1,4 +1,4 @@
/** \file tokenizer.cpp /** \file tokenizer.c
A specialized tokenizer for tokenizing the fish language. In the A specialized tokenizer for tokenizing the fish language. In the
future, the tokenizer should be extended to support marks, future, the tokenizer should be extended to support marks,

View file

@ -1,4 +1,4 @@
/** \file util.cpp /** \file util.c
Generic utilities library. Generic utilities library.
Contains datastructures such as automatically growing array lists, priority queues, etc. Contains datastructures such as automatically growing array lists, priority queues, etc.

View file

@ -1,4 +1,4 @@
/** \file wgetopt.cpp /** \file wgetopt.c
A version of the getopt library for use with wide character strings. A version of the getopt library for use with wide character strings.
This is simply the gnu getopt library, but converted for use with This is simply the gnu getopt library, but converted for use with

View file

@ -1,4 +1,4 @@
/** \file wildcard.cpp /** \file wildcard.c
Fish needs it's own globbing implementation to support Fish needs it's own globbing implementation to support
tab-expansion of globbed parameters. Also provides recursive tab-expansion of globbed parameters. Also provides recursive

View file

@ -1,4 +1,4 @@
/** \file wutil.cpp /** \file wutil.c
Wide character equivalents of various standard unix Wide character equivalents of various standard unix
functions. functions.
*/ */

View file

@ -1,6 +1,3 @@
/** \file xdgmime.cpp
*/
/* -*- mode: C; c-file-style: "gnu" -*- */ /* -*- mode: C; c-file-style: "gnu" -*- */
/* xdgmime.c: XDG Mime Spec mime resolver. Based on version 0.11 of the spec. /* xdgmime.c: XDG Mime Spec mime resolver. Based on version 0.11 of the spec.
* *

View file

@ -1,7 +1,5 @@
/** \file xdgmimealias.cpp
*/
/* -*- mode: C; c-file-style: "gnu" -*- */ /* -*- mode: C; c-file-style: "gnu" -*- */
/* xdgmimealias.cpp: Private file. Datastructure for storing the aliases. /* xdgmimealias.c: Private file. Datastructure for storing the aliases.
* *
* More info can be found at http://www.freedesktop.org/standards/ * More info can be found at http://www.freedesktop.org/standards/
* *

View file

@ -1,7 +1,5 @@
/** \file xdgmimeglob.cpp
*/
/* -*- mode: C; c-file-style: "gnu" -*- */ /* -*- mode: C; c-file-style: "gnu" -*- */
/* xdgmimeglob.cpp: Private file. Datastructure for storing the globs. /* xdgmimeglob.c: Private file. Datastructure for storing the globs.
* *
* More info can be found at http://www.freedesktop.org/standards/ * More info can be found at http://www.freedesktop.org/standards/
* *

View file

@ -1,8 +1,5 @@
/** \file xdgmimeint.cpp
*/
/* -*- mode: C; c-file-style: "gnu" -*- */ /* -*- mode: C; c-file-style: "gnu" -*- */
/* xdgmimeint.cpp: Internal defines and functions. /* xdgmimeint.c: Internal defines and functions.
* *
* More info can be found at http://www.freedesktop.org/standards/ * More info can be found at http://www.freedesktop.org/standards/
* *

View file

@ -1,6 +1,3 @@
/** \file xdgmimemagic.cpp
*/
/* -*- mode: C; c-file-style: "gnu" -*- */ /* -*- mode: C; c-file-style: "gnu" -*- */
/* xdgmimemagic.: Private file. Datastructure for storing magic files. /* xdgmimemagic.: Private file. Datastructure for storing magic files.
* *

View file

@ -1,5 +1,3 @@
/** \file xdgmimeparent.cpp
*/
/* -*- mode: C; c-file-style: "gnu" -*- */ /* -*- mode: C; c-file-style: "gnu" -*- */
/* xdgmimealias.c: Private file. Datastructure for storing the hierarchy. /* xdgmimealias.c: Private file. Datastructure for storing the hierarchy.
* *