1 /*
2  *      lo_fns.h - Line operations, remove duplicate lines, empty lines,
3  *                 lines with only whitespace, sort lines.
4  *
5  *      Copyright 2015 Sylvan Mostert <smostert.dev@gmail.com>
6  *
7  *      This program is free software; you can redistribute it and/or modify
8  *      it under the terms of the GNU General Public License as published by
9  *      the Free Software Foundation; either version 2 of the License, or
10  *      (at your option) any later version.
11  *
12  *      This program is distributed in the hope that it will be useful,
13  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *      GNU General Public License for more details.
16  *
17  *      You should have received a copy of the GNU General Public License along
18  *      with this program; if not, write to the Free Software Foundation, Inc.,
19  *      51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 */
21 
22 
23 
24 #ifndef LO_FNS_H
25 #define LO_FNS_H
26 
27 #include <geanyplugin.h>
28 #include "Scintilla.h"
29 #include <stdlib.h>      /* qsort */
30 #include <string.h>
31 
32 
33 typedef gint (*lo_strcmpfns)(const gchar *str1, const gchar *str2);
34 
35 /* Get sort function based on user preferences */
36 lo_strcmpfns
37 getcmpfns(void);
38 
39 
40 /* Remove Duplicate Lines, sorted */
41 gint
42 rmdupst(gchar **lines, gint num_lines, gchar *new_file);
43 
44 
45 /* Remove Duplicate Lines, ordered */
46 gint
47 rmdupln(gchar **lines, gint num_lines, gchar *new_file);
48 
49 
50 /* Remove Unique Lines */
51 gint
52 rmunqln(gchar **lines, gint num_lines, gchar *new_file);
53 
54 
55 /* Keep Unique Lines */
56 gint
57 kpunqln(gchar **lines, gint num_lines, gchar *new_file);
58 
59 
60 /* Remove Empty Lines */
61 gint
62 rmemtyln(ScintillaObject *sci, gint line_num, gint end_line_num);
63 
64 
65 /* Remove Whitespace Lines */
66 gint
67 rmwhspln(ScintillaObject *sci, gint line_num, gint end_line_num);
68 
69 
70 /* Sort Lines Ascending */
71 gint
72 sortlnsasc(gchar **lines, gint num_lines, gchar *new_file);
73 
74 
75 /* Sort Lines Descending */
76 gint
77 sortlndesc(gchar **lines, gint num_lines, gchar *new_file);
78 
79 
80 /* Remove Every Nth Line */
81 gint
82 rmnthln(ScintillaObject *sci, gint line_num, gint end_line_num);
83 
84 #endif
85