Commit graph

7957 commits

Author SHA1 Message Date
ridiculousfish
d5d3712220 Correct some more memory management in env.cpp 2017-12-22 17:38:25 -08:00
ridiculousfish
efeb8e43a2 Remove a bunch of unnecessary copying in env.cpp 2017-12-22 17:31:25 -08:00
ridiculousfish
2c5b49c3fe Clean up env_var_t interface 2017-12-22 16:54:15 -08:00
ridiculousfish
05b5e8e4f8 Stop copying strings in var_stack_t::var_changed
var_stack_t::var_changed was doing tons of unnecessary string copies.
Fix that and make its name clearer.
2017-12-22 16:28:15 -08:00
ridiculousfish
aa22c744d2 Mark parsed_source_ref_t as storing a const pointer 2017-12-22 15:44:14 -08:00
ridiculousfish
457213a768 Turn debug() into a macro
A large portion of time was spent constructing strings and passing
them to debug(). Turn debug into a macro so that the strings are only
constructed if they're going to be printed.
2017-12-22 15:19:08 -08:00
ridiculousfish
a99eecfad8 Wrap up source code and a parse tree into a new type parsed_source_ref_t
This will make it unnecessary to carry around the parse tree and source
separately, and enable some simplifications.
2017-12-22 14:40:15 -08:00
ridiculousfish
eeff32cde7 Disable MUPARSER_ATTR_WARN_UNUSED_RESULT on gcc
Fixes a warning when building with gcc.
2017-12-22 13:45:27 -08:00
ridiculousfish
d17b298a48 Factor out the code that executes a builtin from exec_job()
Very early work on untangling the exec_job spaghetti.
2017-12-22 13:41:29 -08:00
ridiculousfish
7db5d573c2 Document fish_color_selection
Fixes #4544
2017-12-22 12:41:35 -08:00
ridiculousfish
9907a8df4d Fix test hang when running under ninja
The psub tests create a fifo and launch a background job to write to it.
However fifos have this obnoxious behavior where opening the file blocks
until both sides are ready. In one of the tests we don't actually read
from the fifo we create, so the background job hangs, and the tests
never complete. Fix this by just reading from the fifo.
2017-12-21 15:48:48 -08:00
ridiculousfish
a2114233ac Fix some warnings 2017-12-21 15:48:48 -08:00
Fabian Homborg
4096a7fda9 Revert "Fix "Unknown argument -s" error in fish_vi_key_bindings"
Unfortunately this made tests on travis fail - for some reason I still need to figure out.

This reverts commit 5acbd32c2e.
2017-12-22 00:44:18 +01:00
ridiculousfish
f563262cfd Mark tests as USES_TERMINAL
This allows the Ninja build to show the test output live.
This requires bumping the min required CMake version to 3.2 (from 3.1)
2017-12-21 12:48:17 -08:00
ridiculousfish
0c55b79cfc [string] Instance the argument parsing
This adds a new class arg_iterator_t which encapsulates decisions about
whether to read arguments from stdin or argv. It also migrates the
unread bytes buffer from a static variable to an instance variable.
2017-12-21 12:42:57 -08:00
Yurizal Susanto
94ff789c4b Add eopkg completion support (#4600)
* Add eopkg support

Add support for eopkg in __fish_print_packages function, and
add new completion eopkg.fish in share/completions

* Sorry for the empty file

* Sorry for the empty file again

* Use builtin function for checking subcommand and options

* Fix description

* Use string function to replace grep and cut

* Add completion for search command
2017-12-21 16:43:21 +01:00
David Guyot
dcf9ce6fc5 Added completions/translations for zfs and zpool 2017-12-21 16:39:06 +01:00
Fabian Homborg
5acbd32c2e Fix "Unknown argument -s" error in fish_vi_key_bindings
This was caused by it prepending "-s" to argv always,
and later checking $argv[1].

As it turns out, that is kinda superfluous, so we can just add "-s" to
the `bind` calls.

Also adjust the tests so the vi-bindings are enabled via the function,
which would have caught this.

Fixes #4494.
2017-12-21 16:17:21 +01:00
Fabian Homborg
884092d13b CHANGELOG 4610 2017-12-20 14:36:13 +01:00
Fabian Homborg
f9d883dd74 Add and use str2wcstring(string, size_t)
This is just for convenience.
2017-12-20 14:31:29 +01:00
Fabian Homborg
2de38ef7bf [string] Chunk reads
Profiling with callgrind revealed that about 60% of the time in a `something | string match` call
was actually spent in `string_get_arg_stdin()`,
because it was calling `read` one byte at a time.

This makes it read in chunks similar to builtin read.

This increases performance for `getent hosts | string match -v '0.0.0.0*'` from about 300ms to about 30ms (i.e. 90%).
At that point it's _actually_ quicker than `grep`.

To improve performance even more, we'd have to cut down on str2wcstring.

Fixes #4604.
2017-12-20 14:30:41 +01:00
ridiculousfish
ec2b38053e
Merge pull request #4612 from ridiculousfish/muparser-no-except
Muparser Exceptectomy

This removes large pieces of muParser that fish does not use, such as its optimizer. It also switches muParser from throwing exceptions to propagating errors explicitly.
2017-12-19 09:34:32 -08:00
ridiculousfish
873ea0f0df [muparser] Remove OnDetectVar and Diff
These are unused and useless.
2017-12-18 23:01:18 -08:00
ridiculousfish
2c317a2585 [muparser] Remove muParserFixes.h
This appears to be random pragmas for ICC only.
2017-12-18 23:01:18 -08:00
ridiculousfish
886341fdea [muparser] Remove ParserCallback m_bAllowOpti flag
muParser can no longer optimize, so this is unused.
2017-12-18 23:01:18 -08:00
ridiculousfish
e728bf45de [muparser] Remove m_strFormula from the ParserError 2017-12-18 23:01:18 -08:00
ridiculousfish
409173e0f0 [muparser] Default ParserError's constructors
No need to define these explicitly when the defaults will do.
2017-12-18 23:01:18 -08:00
ridiculousfish
e9c106b881 [muparser] Delete ParserByteCode copy and assignment ctors
These are not used.
2017-12-18 23:01:18 -08:00
ridiculousfish
8b0d2ff641 [muparser] Remove muParserTemplateMagic.h
This header is now empty
2017-12-18 23:01:18 -08:00
ridiculousfish
1f456c71f7 [muparser] Remove MathImpl
This layer of indirection is silly.
2017-12-18 23:01:18 -08:00
ridiculousfish
f0de6e0852 [muparser] Remove struct TypeInfo
The STL's facilities are totally sufficient here.
2017-12-18 23:01:18 -08:00
ridiculousfish
364f58fcfa Remove some deleted muparser headers from Xcode build 2017-12-18 23:01:18 -08:00
ridiculousfish
fd60a7cff7 [muparser] Remove unused fields from SToken 2017-12-18 23:01:17 -08:00
ridiculousfish
732b32c8b4 [muparser] Clean up constructors and other miscellaneous 2017-12-18 23:01:17 -08:00
ridiculousfish
e675a66504 [muparser] Remove some unused "optimized" opcodes 2017-12-18 23:01:17 -08:00
ridiculousfish
3f21fb64de [muparser] Remove additional unused functions 2017-12-18 23:01:17 -08:00
ridiculousfish
ab95f94048 [muparser] Remove m_nIfElseCounter instance variable
No idea why this isn't just a local.
2017-12-18 23:01:17 -08:00
ridiculousfish
4452d9ce18 [muparser] Remove m_pParseFormula function pointer
This is a very strange design that determines whether initialization
needs to be performed by reassigning a function pointer. A misguided
optimization? Just check explicitly.
2017-12-18 23:01:17 -08:00
ridiculousfish
3ed9c851a3 [muparser] Remove some OpenMP / "bulk mode" detritus 2017-12-18 23:01:17 -08:00
ridiculousfish
fdefabdb1d [muparser] Remove fun_type overloads that have four or more parameters
Supporting these is rather excessive.
2017-12-18 23:01:17 -08:00
ridiculousfish
bb9e15675e [muparser] Remove muParserDLL.h and muParserDLL.cpp
This is a C interface (?) which fish does not use and is not needed.
2017-12-18 23:01:17 -08:00
ridiculousfish
128aacaf87 [muparser] Disable muparser shared lib build
fish does not use its shared library, only the static one
2017-12-18 23:01:17 -08:00
ridiculousfish
554382a286 [muparser] Remove 'AllowOpt' parameters
This parameter was used as a hint to optimize functions invoked
with constants, but is no longer used.
2017-12-18 23:01:17 -08:00
ridiculousfish
452211ebf5 Disable exception handling in autotools build
Now that muparser no longer relies on exceptions, we can disable them
again.
2017-12-18 23:01:17 -08:00
ridiculousfish
3099d46736 Disable exception handling in CMake build
Now that muparser no longer relies on exceptions, we can disable them
again.
2017-12-18 23:01:17 -08:00
ridiculousfish
8b16fccebf Disable exception handling in Xcode build
Now that muparser no longer relies on exceptions, we can disable them
again.
2017-12-18 23:01:17 -08:00
ridiculousfish
11e6cfeb82 [math] Remove exception handling in builtin_math
This handles errors explicitly instead of catching them.
2017-12-18 23:01:16 -08:00
ridiculousfish
5d2cf3f666 [muparser] Remove getOrThrow()
This is no longer used or needed
2017-12-18 23:01:16 -08:00
ridiculousfish
2f2f4b4287 [muparser] ParserBase::Eval to return an error instead of throwing 2017-12-18 23:01:16 -08:00
ridiculousfish
11d729d09c [muparser] DefineFun() to return an error instead of throwing 2017-12-18 23:01:16 -08:00