From 880957ad4e3fc0ff681025f5e29c5eccf797c564 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 10 May 2014 00:53:36 +0400 Subject: Move documentation from function declarations to definitions Uses a perl script to move it (scripts/movedocs.pl) --- src/nvim/os/time.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/nvim/os/time.c') diff --git a/src/nvim/os/time.c b/src/nvim/os/time.c index 2a607de36d..66f9405510 100644 --- a/src/nvim/os/time.c +++ b/src/nvim/os/time.c @@ -13,17 +13,26 @@ static uv_cond_t delay_cond; static void microdelay(uint64_t ms); +/// Initializes the time module void time_init() { uv_mutex_init(&delay_mutex); uv_cond_init(&delay_cond); } +/// Sleeps for a certain amount of milliseconds +/// +/// @param milliseconds Number of milliseconds to sleep +/// @param ignoreinput If true, allow a SIGINT to interrupt us void os_delay(uint64_t milliseconds, bool ignoreinput) { os_microdelay(milliseconds * 1000, ignoreinput); } +/// Sleeps for a certain amount of microseconds +/// +/// @param microseconds Number of microseconds to sleep +/// @param ignoreinput If true, allow a SIGINT to interrupt us void os_microdelay(uint64_t microseconds, bool ignoreinput) { int old_tmode; @@ -61,6 +70,9 @@ static void microdelay(uint64_t microseconds) uv_mutex_unlock(&delay_mutex); } +/// Portable version of POSIX localtime_r() +/// +/// @return NULL in case of error struct tm *os_localtime_r(const time_t *clock, struct tm *result) { #ifdef UNIX @@ -75,6 +87,11 @@ return result; #endif } +/// Obtains the current UNIX timestamp and adjusts it to local time +/// +/// @param result Pointer to a 'struct tm' where the result should be placed +/// @return A pointer to a 'struct tm' in the current time zone (the 'result' +/// argument) or NULL in case of error struct tm *os_get_localtime(struct tm *result) { struct timeval tv; -- cgit From 70929f7e1616bab2783cc5735c6061981cda8a0f Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 10 May 2014 17:24:13 +0400 Subject: Add automatic generation of headers - The 'stripdecls.py' script replaces declarations in all headers by includes to generated headers. `ag '#\s*if(?!ndef NEOVIM_).*((?!#\s*endif).*\n)*#ifdef INCLUDE_GENERATED'` was used for this. - Add and integrate gendeclarations.lua into the build system to generate the required includes. - Add -Wno-unused-function - Made a bunch of old-style definitions ANSI This adds a requirement: all type and structure definitions must be present before INCLUDE_GENERATED_DECLARATIONS-protected include. Warning: mch_expandpath (path.h.generated.h) was moved manually. So far it is the only exception. --- src/nvim/os/time.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/nvim/os/time.c') diff --git a/src/nvim/os/time.c b/src/nvim/os/time.c index 66f9405510..977a4f19c4 100644 --- a/src/nvim/os/time.c +++ b/src/nvim/os/time.c @@ -11,8 +11,10 @@ static uv_mutex_t delay_mutex; static uv_cond_t delay_cond; -static void microdelay(uint64_t ms); +#ifdef INCLUDE_GENERATED_DECLARATIONS +# include "os/time.c.generated.h" +#endif /// Initializes the time module void time_init() { -- cgit