Code indentation in src/viewer directory

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Slava Zanko 2010-11-10 20:41:28 +02:00 committed by Andrew Borodin
parent cb4bdfa00d
commit 96cb95cc95
16 changed files with 80 additions and 75 deletions

View File

@ -80,6 +80,7 @@
/*** file scope variables ************************************************************************/
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
/* Both views */
static void
@ -220,8 +221,7 @@ mcview_handle_editkey (mcview_t * view, int key)
return MSG_NOT_HANDLED;
}
if ((view->filename != NULL) && (view->filename[0] != '\0')
&& (view->change_list == NULL))
if ((view->filename != NULL) && (view->filename[0] != '\0') && (view->change_list == NULL))
view->locked = mcview_lock_file (view);
if (node == NULL)
@ -383,7 +383,8 @@ mcview_execute_cmd (mcview_t * view, unsigned long command)
return res;
}
/* Both views */
/* --------------------------------------------------------------------------------------------- */
/** Both views */
static cb_ret_t
mcview_handle_key (mcview_t * view, int key)
{
@ -441,9 +442,7 @@ mcview_adjust_size (Dlg_head * h)
/* --------------------------------------------------------------------------------------------- */
/*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
cb_ret_t

View File

@ -74,7 +74,6 @@ typedef gboolean (*cmp_func_t) (const coord_cache_entry_t * a, const coord_cache
/*** file scope variables ************************************************************************/
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
/* insert new cache entry into the cache */
@ -101,12 +100,16 @@ mcview_ccache_add_entry (coord_cache_t * cache, size_t pos, const coord_cache_en
cache->size++;
}
/* --------------------------------------------------------------------------------------------- */
static gboolean
mcview_coord_cache_entry_less_offset (const coord_cache_entry_t * a, const coord_cache_entry_t * b)
{
return (a->cc_offset < b->cc_offset);
}
/* --------------------------------------------------------------------------------------------- */
static gboolean
mcview_coord_cache_entry_less_plain (const coord_cache_entry_t * a, const coord_cache_entry_t * b)
{
@ -120,6 +123,8 @@ mcview_coord_cache_entry_less_plain (const coord_cache_entry_t * a, const coord_
}
/* --------------------------------------------------------------------------------------------- */
static gboolean
mcview_coord_cache_entry_less_nroff (const coord_cache_entry_t * a, const coord_cache_entry_t * b)
{
@ -133,8 +138,10 @@ mcview_coord_cache_entry_less_nroff (const coord_cache_entry_t * a, const coord_
}
/* Find and return the index of the last cache entry that is
/* --------------------------------------------------------------------------------------------- */
/** Find and return the index of the last cache entry that is
* smaller than ''coord'', according to the criterion ''sort_by''. */
static inline size_t
mcview_ccache_find (mcview_t * view, const coord_cache_entry_t * coord, cmp_func_t cmp_func)
{
@ -163,9 +170,7 @@ mcview_ccache_find (mcview_t * view, const coord_cache_entry_t * coord, cmp_func
}
/* --------------------------------------------------------------------------------------------- */
/*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
coord_cache_t *
@ -267,12 +272,11 @@ mcview_ccache_dump (mcview_t * view)
#endif
/* --------------------------------------------------------------------------------------------- */
/* Look up the missing components of ''coord'', which are given by
/** Look up the missing components of ''coord'', which are given by
* ''lookup_what''. The function returns the smallest value that
* matches the existing components of ''coord''.
*/
void
mcview_ccache_lookup (mcview_t * view, coord_cache_entry_t * coord, enum ccache_type lookup_what)
{

View File

@ -71,9 +71,10 @@
/*** file scope variables ************************************************************************/
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------------------------- */
/*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
static void

View File

@ -67,9 +67,10 @@ mcview_search_options_t mcview_search_options = {
/*** file scope variables ************************************************************************/
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------------------------- */
/*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
gboolean

View File

@ -70,10 +70,10 @@ static enum ruler_type
} ruler = RULER_NONE;
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
/* Define labels and handlers for functional keys */
/** Define labels and handlers for functional keys */
static void
mcview_set_buttonbar (mcview_t * view)
{
@ -124,7 +124,6 @@ mcview_set_buttonbar (mcview_t * view)
/* --------------------------------------------------------------------------------------------- */
static void
mcview_display_status (mcview_t * view)
{
@ -173,9 +172,7 @@ mcview_display_status (mcview_t * view)
}
/* --------------------------------------------------------------------------------------------- */
/*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
void
@ -222,8 +219,8 @@ mcview_update (mcview_t * view)
}
/* --------------------------------------------------------------------------------------------- */
/** Displays as much data from view->dpy_start as fits on the screen */
/* Displays as much data from view->dpy_start as fits on the screen */
void
mcview_display (mcview_t * view)
{

View File

@ -57,9 +57,10 @@
/*** file scope variables ************************************************************************/
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------------------------- */
/*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
void
@ -100,10 +101,11 @@ mcview_growbuf_filesize (mcview_t * view)
}
/* --------------------------------------------------------------------------------------------- */
/* Copies the output from the pipe to the growing buffer, until either
/** Copies the output from the pipe to the growing buffer, until either
* the end-of-pipe is reached or the interval [0..ofs) of the growing
* buffer is completely filled. */
* buffer is completely filled.
*/
void
mcview_growbuf_read_until (mcview_t * view, off_t ofs)
{

View File

@ -1,15 +1,15 @@
#ifndef MC_VIEWER_INLINES_H
#define MC_VIEWER_INLINES_H
#ifndef MC__VIEWER_INLINES_H
#define MC__VIEWER_INLINES_H
/*** typedefs(not structures) and defined constants ********************/
/*** typedefs(not structures) and defined constants **********************************************/
/*** enums *************************************************************/
/*** enums ***************************************************************************************/
/*** structures declarations (and typedefs of structures)***************/
/*** structures declarations (and typedefs of structures)*****************************************/
/*** global variables defined in .c file *******************************/
/*** global variables defined in .c file *********************************************************/
/*** declarations of public functions **********************************/
/*** declarations of public functions ************************************************************/
/*** inline functions ****************************************************************************/
@ -163,4 +163,4 @@ mcview_is_nroff_sequence (mcview_t * view, off_t offset)
/* --------------------------------------------------------------------------------------------- */
#endif
#endif /* MC__VIEWER_INLINES_H */

View File

@ -1,6 +1,5 @@
#ifndef MC_VIEWER_INTERNAL_H
#define MC_VIEWER_INTERNAL_H
#ifndef MC__VIEWER_INTERNAL_H
#define MC__VIEWER_INTERNAL_H
#include <stdlib.h>
#include <stdio.h>
@ -14,7 +13,7 @@
#include "src/widget.h"
#include "src/keybind.h" /* global_keymap_t */
/*** typedefs(not structures) and defined constants ********************/
/*** typedefs(not structures) and defined constants **********************************************/
typedef unsigned char byte;
@ -24,7 +23,7 @@ typedef unsigned int screen_dimen;
extern const off_t INVALID_OFFSET;
extern const off_t OFFSETTYPE_MAX;
/*** enums *************************************************************/
/*** enums ***************************************************************************************/
/* data sources of the view */
enum view_ds
@ -49,7 +48,7 @@ typedef enum
NROFF_TYPE_UNDERLINE = 2
} nroff_type_t;
/*** structures declarations (and typedefs of structures)***************/
/*** structures declarations (and typedefs of structures)*****************************************/
/* A node for building a change list on change_list */
struct hexedit_change_node
@ -210,11 +209,11 @@ typedef struct mcview_search_options_t
gboolean all_codepages;
} mcview_search_options_t;
/*** global variables defined in .c file *******************************/
/*** global variables defined in .c file *********************************************************/
extern mcview_search_options_t mcview_search_options;
/*** declarations of public functions **********************************/
/*** declarations of public functions ************************************************************/
/* actions_cmd.c: */
cb_ret_t mcview_callback (Widget * w, widget_msg_t msg, int parm);
@ -330,9 +329,8 @@ int mcview_search_cmd_callback (const void *user_data, gsize char_offset);
int mcview_search_update_cmd_callback (const void *, gsize);
void mcview_do_search (mcview_t * view);
/*** inline functions ****************************************************************************/
#include "inlines.h"
#endif /* MC_VIEWER_INTERNAL_H */
#endif /* MC__VIEWER_INTERNAL_H */

View File

@ -67,9 +67,10 @@ const off_t OFFSETTYPE_MAX = ((off_t) 1 << (OFF_T_BITWIDTH - 1)) - 1;
/*** file scope variables ************************************************************************/
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------------------------- */
/*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
void
@ -339,9 +340,10 @@ mcview_show_error (mcview_t * view, const char *msg)
}
/* --------------------------------------------------------------------------------------------- */
/** returns index of the first char in the line
* it is constant for all line characters
*/
/* returns index of the first char in the line */
/* it is constant for all line characters */
off_t
mcview_bol (mcview_t * view, off_t current, off_t limit)
{
@ -373,9 +375,10 @@ mcview_bol (mcview_t * view, off_t current, off_t limit)
}
/* --------------------------------------------------------------------------------------------- */
/** returns index of last char on line + width EOL
* mcview_eol of the current line == mcview_bol next line
*/
/* returns index of last char on line + width EOL */
/* mcview_eol of the current line == mcview_bol next line */
off_t
mcview_eol (mcview_t * view, off_t current, off_t limit)
{
@ -422,6 +425,7 @@ mcview_get_title (const Dlg_head * h, size_t len)
return g_strconcat (_("View: "), modified, file_label, (char *) NULL);
}
/* --------------------------------------------------------------------------------------------- */
gboolean

View File

@ -85,10 +85,10 @@ char *mcview_show_eof = NULL;
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
/* Both views */
/** Both views */
static int
mcview_event (mcview_t * view, Gpm_Event * event, int *result)
{
@ -172,8 +172,8 @@ mcview_event (mcview_t * view, Gpm_Event * event, int *result)
}
/* --------------------------------------------------------------------------------------------- */
/** Real view only */
/* Real view only */
static int
mcview_real_event (Gpm_Event * event, void *x)
{
@ -185,6 +185,8 @@ mcview_real_event (Gpm_Event * event, void *x)
return result;
}
/* --------------------------------------------------------------------------------------------- */
static void
mcview_set_keymap (mcview_t * view)
{
@ -198,9 +200,7 @@ mcview_set_keymap (mcview_t * view)
}
/* --------------------------------------------------------------------------------------------- */
/*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
mcview_t *
@ -238,8 +238,8 @@ mcview_new (int y, int x, int lines, int cols, gboolean is_panel)
}
/* --------------------------------------------------------------------------------------------- */
/** Real view only */
/* Real view only */
mcview_ret_t
mcview_viewer (const char *command, const char *file, int start_line)
{

View File

@ -2,12 +2,12 @@
* \brief Header: internal file viewer
*/
#ifndef MC_VIEWER_H
#define MC_VIEWER_H
#ifndef MC__VIEWER_H
#define MC__VIEWER_H
#include "lib/global.h"
/*** typedefs(not structures) and defined constants ********************/
/*** typedefs(not structures) and defined constants **********************************************/
struct mcview_struct;
@ -19,11 +19,11 @@ typedef enum
MCVIEW_WANT_PREV
} mcview_ret_t;
/*** enums *************************************************************/
/*** enums ***************************************************************************************/
/*** structures declarations (and typedefs of structures)***************/
/*** structures declarations (and typedefs of structures)*****************************************/
/*** global variables defined in .c file *******************************/
/*** global variables defined in .c file *********************************************************/
extern int mcview_default_hex_mode;
extern int mcview_default_nroff_flag;
@ -40,8 +40,7 @@ extern int mcview_max_dirt_limit;
extern int mcview_mouse_move_pages;
extern char *mcview_show_eof;
/*** declarations of public functions **********************************/
/*** declarations of public functions ************************************************************/
/* Creates a new mcview_t object with the given properties. Caveat: the
* origin is in y-x order, while the extent is in x-y order. */
@ -55,4 +54,5 @@ extern mcview_ret_t mcview_viewer (const char *command, const char *file, int st
extern gboolean mcview_load (struct mcview_struct *, const char *, const char *, int);
#endif
/*** inline functions ****************************************************************************/
#endif /* MC__VIEWER_H */

View File

@ -66,6 +66,7 @@
/*** file scope variables ************************************************************************/
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
static void
mcview_movement_fixups (mcview_t * view, gboolean reset_search)
@ -80,9 +81,7 @@ mcview_movement_fixups (mcview_t * view, gboolean reset_search)
}
/* --------------------------------------------------------------------------------------------- */
/*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
void
@ -478,10 +477,10 @@ mcview_place_cursor (mcview_t * view)
}
/* --------------------------------------------------------------------------------------------- */
/* we have set view->search_start and view->search_end and must set
/** we have set view->search_start and view->search_end and must set
* view->dpy_text_column and view->dpy_start
* try to display maximum of match */
void
mcview_moveto_match (mcview_t * view)
{

View File

@ -56,9 +56,10 @@
/*** file scope variables ************************************************************************/
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------------------------- */
/*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
void

View File

@ -58,9 +58,10 @@
/*** file scope variables ************************************************************************/
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------------------------- */
/*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
void

View File

@ -52,9 +52,8 @@
/*** file scope variables ************************************************************************/
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
static void
mcview_search_update_steps (mcview_t * view)
{
@ -143,9 +142,7 @@ mcview_search_show_result (mcview_t * view, Dlg_head ** d, size_t match_len)
}
/* --------------------------------------------------------------------------------------------- */
/*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
int
@ -277,7 +274,8 @@ mcview_do_search (mcview_t * view)
}
while (mcview_may_still_grow (view));
if (view->search_start != 0 && !isFound && need_search_again && !mcview_search_options.backwards)
if (view->search_start != 0 && !isFound && need_search_again
&& !mcview_search_options.backwards)
{
int result;
mcview_update (view);