Commit Graph

11283 Commits

Author SHA1 Message Date
Thiago de Arruda
974eade1a6 Improve map module: Change scopes
- Move `Map` structure definition to `map_defs.h`
- Use `KHASH_DECLARE` on map_defs.h to declare khash function prototypes.
- Redefine `map_foreach` into a macro
- Refactor server.c module to use the new `map_foreach` macro.
2014-05-19 10:52:04 -03:00
Thiago de Arruda
eb7513bbd2 Improve map module: Fix implementation of map_has 2014-05-19 10:51:56 -03:00
Thiago de Arruda
b87b1a3325 Improve map module: Add to clint and CONV_SRCS 2014-05-19 10:51:47 -03:00
Justin M. Keyes
93f9023b46 Merge klib upstream.
Silence -Wstrict-prototypes and static analyser warnings

Using "(void)" provides an explicit there-are-no-arguments prototype.
Using the exact type in "malloc(...sizeof)" is clearer and silences
warnings from clang's static analyzer. (John Marshall)
2014-05-19 09:17:27 -04:00
Justin M. Keyes
4fc6e06465 Fix comment typo. 2014-05-19 08:59:24 -04:00
Nicolas Hillegeer
9eb68075d8 api/helpers: implement C string to String helper
Use it in buffers.c
2014-05-18 06:45:39 -03:00
Nicolas Hillegeer
b591447f77 clint: disregard compound literal return
This allows lines like:

return (my_struct_type) {
  .my_int = 5,
  .my_str = ""
};

Thanks to @watk for finding and fixing it!
2014-05-18 06:45:39 -03:00
Thiago de Arruda
96a9b5eaee Fixed outdated comment in option.c 2014-05-17 08:14:54 -03:00
Thiago de Arruda
1f8534684e Removed lalloc prototype(again)
It was re-added by accident when resolving merge conflicts
2014-05-17 08:07:58 -03:00
Thiago de Arruda
83b59e3815 Fix xmemdup function signature 2014-05-17 08:05:44 -03:00
Thiago de Arruda
9920599e5d Replace unnecessary xcalloc call by xmalloc 2014-05-17 08:05:44 -03:00
Thiago de Arruda
45e5a18f3a Enable -Wconversion for API files and fix errors 2014-05-17 08:05:44 -03:00
Thiago de Arruda
76a2fb5667 Use more descriptive names for API primitive types
Instead of exposing native C types to a public API that can be consumed by other
platforms, we are now using the following translation:

int64_t -> Integer
double  -> Float
bool    -> Boolean
2014-05-17 08:05:44 -03:00
Thiago de Arruda
a8b0c9e576 Refactor API to use one integer type: int64_t
This should make the API simpler, and int64_t is enough to represent any integer
value we might need.

Range checks should be done inside the API functions, that way we can modify the
types of the actual fields/variables modified by the API without changes to the
API prototypes.
2014-05-17 08:05:44 -03:00
Thiago de Arruda
b7108002bb Use uintptr_t as the hashtable type in helpers.c 2014-05-17 08:05:44 -03:00
Thiago de Arruda
32b6122460 Remove hardcoded type names from msgpack-gen.lua
Except for the `Error *` type, all parameter types are valid identifiers, so
reuse that LPeg rule.
2014-05-17 08:05:44 -03:00
Felipe Oliveira Carvalho
bd2ab0d8a5 Replace if (ga->ga_len) with if (!GA_EMPTY(ga))
Used Coccinelle to perform the changes

```diff
@@
expression E;
statement S;
@@

(
- if (E.ga_len) S
+ if (!GA_EMPTY(&E)) S
|
- if (E->ga_len) S
+ if (!GA_EMPTY(E)) S
)
```
2014-05-17 07:02:44 -03:00
Felipe Oliveira Carvalho
5209d2271b Replace ga->ga_len == 0 checks with GA_EMPTY(ga)
Used Coccinelle to perform the changes

@@
expression E;
@@

<...
(
// E.ga_len == 0 is isomorphic to !E.ga_len
- E.ga_len == 0
+ GA_EMPTY(&E)
|
- E->ga_len == 0
+ GA_EMPTY(E)
)
...>
2014-05-17 07:02:44 -03:00
Felipe Oliveira Carvalho
b4efff6523 Replace ga->ga_len > 0 checks with !GA_EMPTY(ga)
Used Coccinelle to perform the changes

```diff
@@
expression E;
@@

<...
(
- E.ga_len > 0
+ !GA_EMPTY(&E)
|
- E->ga_len > 0
+ !GA_EMPTY(E)
)
...>
```

`spatch --in-place --sp-file ga_empty.cocci <C_FILE>`
2014-05-17 07:02:44 -03:00
Felipe Oliveira Carvalho
659cd0e99a s/GA_EMPTY/GA_EMPTY_INIT_VALUE/
I'm about to implement a `GA_EMPTY` macro that checks if the GA is empty or not.
2014-05-17 07:02:44 -03:00
Eliseo Martínez
5f795225dc Introduce nvim namespace: Fix define guards.
Change define guards from NEOVIM_XXX_H to NVIM_XXX_H:
- Change header files.
- Change clint correct guard name calculation.
2014-05-15 20:46:02 +02:00
Eliseo Martínez
71c79b5b70 Introduce nvim namespace: Fix contrib youcompleteme.
- Fix instructions to install youcompleteme configuration.
2014-05-15 20:46:02 +02:00
Eliseo Martínez
3b523ec699 Introduce nvim namespace: Fix localization.
- Fix executable path.
- Make po file title similar as others.
2014-05-15 20:46:02 +02:00
Eliseo Martínez
575deff66d Introduce nvim namespace: Fix clint.
- Fix path to clint-checked files.
- Fix mechanism to calculate define guard names.
2014-05-15 20:46:02 +02:00
Eliseo Martínez
2ababe5a99 Introduce nvim namespace: Fix functional tests.
Fix some paths to new locations:
- Makefile: Fix nvim binary path.
- test49  : 459: Fix nvim binary path.
- test89  :  62: Fix testdir root.
                 Fix corresponding expected result.
- test105 :  10: Testing fnamemodify to reduce path to use ~ prefix.
                 Fix faked home directory.
                 Fix corresponding expected result.
             26: Testing fnamemodify with r modifier.
                 Fix out-of-project prefix removal.
                 Fix corresponding expected result.
2014-05-15 20:46:02 +02:00
Eliseo Martínez
74b9396043 Introduce nvim namespace: Fix unit tests.
Point cimports to new locations.
2014-05-15 20:46:02 +02:00
Eliseo Martínez
762a8ad0f3 Introduce nvim namespace: Fix unmasked strings.h issue.
Problem:  Now that nvim/strings.h is correctly namespaced, an issue
          that had been masked until now arises:

          When compiling, we get a lot of errors because of everywhere
          the functions in nvim/strings.h are used, there's no include
          to import them.

          But, how could this compile and work previously, then? It
          turns out that:
          - In every such case, we are also including vim.h, which in
            turn includes os_unix_defs.h.
          - os_unix_defs.h includes <string.h> and also <strings.h> in
            some systems (e.g. OSX).
          - Build had been modified previously to (even when importing
            system headers), prefer equally-named local ones. That was
            in fact done as a previous attempt to solve the same issue
            we are trying to solve another way now.

          So, we were including our "strings.h" as a side-effect of
          including <strings.h> through "vim.h" --> "os_unix_defs.h".

Solution: Correctly include "nvim/strings.h" in every file needing it.
2014-05-15 20:46:02 +02:00
Eliseo Martínez
409cc138f2 Introduce nvim namespace: Fix project-local includes.
Prepend 'nvim/' in all project-local (non-system) includes.
2014-05-15 20:46:01 +02:00
Eliseo Martínez
e731a5edf8 Introduce nvim namespace: Fix relative includes.
Problem:  Some newly introduced files used includes relative to the
          current file, both of the form `include "../XXX.h"` and
          `include "XXX.h"`.
          Preferred form is relative to include root (src/ in our case).
Solution: Change includes to preferred form.
Note:     This is also done to ease next commit (prepend 'nvim/ to all
          project-local includes).
2014-05-15 20:46:01 +02:00
Eliseo Martínez
a6734844ca Introduce nvim namespace: Fix build process.
- Leave src as include dir (for includes to recognize 'nvim/' prefix).
- Change subdirectory from src to src/nvim.
- Fix msgpack generation.
- Fix some other paths to new locations.
2014-05-15 20:46:01 +02:00
Eliseo Martínez
da51dc9cf2 Introduce nvim namespace: Move files.
Move files from src/ to src/nvim/.
- src/nvim/ becomes the new root dir for nvim executable sources.
- src/libnvim/ is planned to become root dir of the neovim library.
2014-05-15 20:46:01 +02:00
Thiago de Arruda
ffe61e5ba1 Tell cmake to use -isystem third-party includes
This adds the `SYSTEM` parameter to `include_directories`, which will tell cmake
to use `-isystem` instead of `-I` for specifying include directories. One
advantage is that compilers won't emit warnings for included files that belong
to dependencies.
2014-05-15 08:21:13 -03:00
John Szakmeister
21bd990603 Don't allow undefined references under Linux.
Many other systems expect this already, but on Linux the default is to
allow them.  Let's turn that off.
2014-05-14 21:14:28 -04:00
Thiago de Arruda
0d1094d709 Add ${API_SOURCES} to nvim-test cmake target.
Fixes #720
2014-05-14 16:41:42 -03:00
Thiago de Arruda
f0f4ab5500 Use platform check for correct selection of khash type in helpers.c 2014-05-13 14:11:32 -03:00
Thiago de Arruda
f69b0a1dc7 API: Implement vim_get_vvar 2014-05-13 14:11:32 -03:00
Thiago de Arruda
5d0cb370f6 API: Refactor vim_{get,set}_var
- Change in dict_set_value: Passing 'nil' as value will delete the
  variable.
- Change in dict_get_value: Removed 'pop' parameter, now values can be popped
  by passing 'nil' to dict_set_value
- Update {buffer,window,tabpage}_get_var to reflect the changes
2014-05-13 14:11:32 -03:00
Thiago de Arruda
40c82ed7cd API: Implement tabpage_get_window_count 2014-05-13 14:11:32 -03:00
Thiago de Arruda
a6baf32a2c API: Implement tabpage_is_valid 2014-05-13 14:11:32 -03:00
Thiago de Arruda
14f2a3d533 API: Implement tabpage_get_window 2014-05-13 14:11:32 -03:00
Thiago de Arruda
e026be46af API: Implement tabpage_{get,set}_var 2014-05-13 14:11:32 -03:00
Thiago de Arruda
bfe3b6712e API: Implement window_is_valid 2014-05-13 14:11:32 -03:00
Thiago de Arruda
3ed2ddf726 API: Implement window_get_position 2014-05-13 14:11:32 -03:00
Thiago de Arruda
6226ac34fd API: Implement window_{get,set}_option 2014-05-13 14:11:32 -03:00
Thiago de Arruda
17053bbc39 API: Implement window_{get,set}_var 2014-05-13 14:11:32 -03:00
Thiago de Arruda
a132effd35 API: Implement window_{get,set}_{height,width} 2014-05-13 14:11:32 -03:00
Thiago de Arruda
b7c5d294c1 API: Implement window_{get,set}_cursor 2014-05-13 14:11:32 -03:00
Thiago de Arruda
6c850bd6b9 API: Implement window_get_buffer 2014-05-13 14:11:31 -03:00
Thiago de Arruda
9d18533ca3 Add new files to clint and fix reported errors 2014-05-13 14:11:31 -03:00
Thiago de Arruda
60043da29f API: Implement buffer_get_mark 2014-05-13 14:11:31 -03:00