summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cr_cpri.h28
-rw-r--r--src/cr_epri.h18
-rw-r--r--src/cr_gpri.c20
-rw-r--r--src/cr_lex.l128
-rw-r--r--src/cr_main.c12
-rwxr-xr-xsrc/hlbin36120 -> 36120 bytes
6 files changed, 103 insertions, 103 deletions
diff --git a/src/cr_cpri.h b/src/cr_cpri.h
index 4768a62..a55dd71 100644
--- a/src/cr_cpri.h
+++ b/src/cr_cpri.h
@@ -22,7 +22,7 @@
*
* Fichier : cr_cpri.h
*
- * @(#) [MB] cr_cpri.h Version 1.18 du 15/07/27 -
+ * @(#) [MB] cr_cpri.h Version 1.19 du 15/07/28 -
*
* ============================================================================
*/
@@ -91,11 +91,11 @@
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
#define CR_SIZE (1024)
-#define CR_DISP_LEX(...) if (G.disp_lex) fprintf(stderr, __VA_ARGS__)
-#define CR_DEBUG(...) if (G.debug) { \
- fprintf(stderr, "%-15s (%4d) ", __func__, __LINE__); \
- fprintf(stderr, __VA_ARGS__); \
- }
+#define CR_DISP_LEX(...) if (G.disp_lex) fprintf(stderr, __VA_ARGS__)
+#define CR_DEBUG(...) if (G.debug) { \
+ fprintf(stderr, "%-15s (%4d) ", __func__, __LINE__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
/* Macros de definition et declaraction d'une fonction "new"
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
@@ -116,14 +116,14 @@ struct cr_##name *cr_new_##name(void) \
#if defined(CDD)
#define yylex CR_lex
-#define yyin CR_in
+#define yyin CR_in
#endif
/* Structures
~~~~~~~~~~ */
struct cr_color {
int col_num;
- int intensity;
+ int intensity;
int linux_code;
FILE *out;
};
@@ -132,8 +132,8 @@ struct cr_re_desc {
regex_t reg;
char *regex;
int cflags;
- struct cr_color col;
- struct cr_re_desc *next;
+ struct cr_color col;
+ struct cr_re_desc *next;
};
struct cr_col_desc {
@@ -193,14 +193,14 @@ struct cr_global {
bool debug,
verbose,
disp_regex,
- disp_lex,
- config_file_read;
+ disp_lex,
+ config_file_read;
FILE *out;
bool newline;
int intensity;
struct cr_configs configs;
- struct cr_re_desc *extract_RE,
- *insert_RE;
+ struct cr_re_desc *extract_RE,
+ *insert_RE;
};
#endif /* CR_CPRI_H */
diff --git a/src/cr_epri.h b/src/cr_epri.h
index cb663e4..cb4436f 100644
--- a/src/cr_epri.h
+++ b/src/cr_epri.h
@@ -22,7 +22,7 @@
*
* Fichier : cr_epri.h
*
- * @(#) [MB] cr_epri.h Version 1.14 du 15/07/26 -
+ * @(#) [MB] cr_epri.h Version 1.15 du 15/07/28 -
*
* ============================================================================
*/
@@ -34,26 +34,26 @@
extern struct cr_global G;
-extern FILE *yyin;
+extern FILE *yyin;
/* Error messages
~~~~~~~~~~~~~~ */
-extern char *cr_err_malloc;
+extern char *cr_err_malloc;
extern int cr_col_codes[8][3];
-extern char *cr_best_fg[8][3];
+extern char *cr_best_fg[8][3];
/* Fonctions
* ~~~~~~~~~ */
void cr_usage(bool);
-void cr_display_args(struct cr_config *);
-void cr_display_config(void);
+void cr_display_args(struct cr_config *);
+void cr_display_config(void);
void cr_init_list(void);
void cr_init_col_names(void);
CR_DECL_NEW(config);
CR_DECL_NEW(arg);
-void cr_add_config(struct cr_config *);
-void cr_add_arg(struct cr_arg *);
+void cr_add_config(struct cr_config *);
+void cr_add_arg(struct cr_arg *);
void cr_set_color(int, char *);
void cr_free_RE(void);
void cr_read_input(void);
@@ -64,6 +64,6 @@ void cr_init_desc(void);
void cr_set_desc(struct cr_color *, int, int, int);
void cr_disp_line(void);
-int yylex(void);
+int yylex(void);
#endif /* CR_EPRI_H */
diff --git a/src/cr_gpri.c b/src/cr_gpri.c
index 2146fb5..9e12da4 100644
--- a/src/cr_gpri.c
+++ b/src/cr_gpri.c
@@ -22,7 +22,7 @@
*
* Fichier : cr_gpri.c
*
- * @(#) cr_gpri.c 1.8 15/07/26 MB
+ * @(#) cr_gpri.c 1.9 15/07/28 MB
*
* ============================================================================
*/
@@ -46,14 +46,14 @@ int cr_col_codes[8][3] = {
{ 0, 0, 0 }
};
-char *cr_best_fg[8][3] = {
- { "1;37", "1;37", "1;37" },
- { "1;37", "1;37", "2;31" },
- { "1;37", "2;30", "2;30" },
- { "1;37", "1;37", "2;30" },
- { "1;37", "1;37", "1;37" },
- { "1;37", "1;37", "2;30" },
- { "1;37", "2;30", "2;30" },
- { 0, 0, 0 }
+char *cr_best_fg[8][3] = {
+ { "1;37", "1;37", "1;37" },
+ { "1;37", "1;37", "2;31" },
+ { "1;37", "2;30", "2;30" },
+ { "1;37", "1;37", "2;30" },
+ { "1;37", "1;37", "1;37" },
+ { "1;37", "1;37", "2;30" },
+ { "1;37", "2;30", "2;30" },
+ { 0, 0, 0 }
};
diff --git a/src/cr_lex.l b/src/cr_lex.l
index bc8f7f0..b0a6c65 100644
--- a/src/cr_lex.l
+++ b/src/cr_lex.l
@@ -1,105 +1,105 @@
%{
/* ============================================================================
- * (C) Copyright Martial Bornet, 2015.
+ * (C) Copyright Martial Bornet, 2015.
*
- * Auteur : Martial BORNET (MB) - 17 Juin 2015
+ * Auteur : Martial BORNET (MB) - 17 Juin 2015
*
- * Description : Analyseur lexical
+ * Description : Analyseur lexical
*
- * Fichier : cr_lex.l
+ * Fichier : cr_lex.l
*
- * @(#) cr_lex.l 1.3 15/07/27 MB
+ * @(#) cr_lex.l 1.4 15/07/28 MB
*
* ============================================================================
*/
-#include <string.h>
-#include "cr_epri.h"
+#include <string.h>
+#include "cr_epri.h"
%}
-config ([a-zA-Z][-._a-zA-Z0-9_]*)
-options (-[a-zA-Z0-9]+)
-args ('.*')
-space ([ \t]+)
-call_config (--[a-zA-Z][-.a-zA-Z0-9_]*)
-sep (:)
+config ([a-zA-Z][-._a-zA-Z0-9_]*)
+options (-[a-zA-Z0-9]+)
+args ('.*')
+space ([ \t]+)
+call_config (--[a-zA-Z][-.a-zA-Z0-9_]*)
+sep (:)
-%s CONFIG ARGS
+%s CONFIG ARGS
%%
-^#.* {
- CR_DISP_LEX("COMMENT : %s\n", yytext);
- }
+^#.* {
+ CR_DISP_LEX("COMMENT : %s\n", yytext);
+ }
-{config} {
- struct cr_config *_config;
+{config} {
+ struct cr_config *_config;
- BEGIN CONFIG;
- CR_DISP_LEX("CONFIG : %s\n", yytext);
+ BEGIN CONFIG;
+ CR_DISP_LEX("CONFIG : %s\n", yytext);
- _config = cr_new_config();
- _config->name = strdup(yytext);
+ _config = cr_new_config();
+ _config->name = strdup(yytext);
- cr_add_config(_config);
- }
+ cr_add_config(_config);
+ }
-<CONFIG>{sep}$ {
- BEGIN ARGS;
- CR_DISP_LEX("SEP\n");
- }
+<CONFIG>{sep}$ {
+ BEGIN ARGS;
+ CR_DISP_LEX("SEP\n");
+ }
-<CONFIG>{sep}{space}$ {
- BEGIN ARGS;
- CR_DISP_LEX("Espaces apres separateur !\n");
- }
+<CONFIG>{sep}{space}$ {
+ BEGIN ARGS;
+ CR_DISP_LEX("Espaces apres separateur !\n");
+ }
-<ARGS>{call_config} {
- struct cr_arg *_arg;
+<ARGS>{call_config} {
+ struct cr_arg *_arg;
- CR_DISP_LEX("CFG : [%s]\n", yytext);
- _arg = cr_new_arg();
- _arg->value = strdup(yytext);
+ CR_DISP_LEX("CFG : [%s]\n", yytext);
+ _arg = cr_new_arg();
+ _arg->value = strdup(yytext);
- cr_add_arg(_arg);
- }
+ cr_add_arg(_arg);
+ }
-<ARGS>{options} {
- struct cr_arg *_arg;
+<ARGS>{options} {
+ struct cr_arg *_arg;
- CR_DISP_LEX("OPTIONS : [%s]\n", yytext);
- _arg = cr_new_arg();
- _arg->value = strdup(yytext);
+ CR_DISP_LEX("OPTIONS : [%s]\n", yytext);
+ _arg = cr_new_arg();
+ _arg->value = strdup(yytext);
- cr_add_arg(_arg);
- }
+ cr_add_arg(_arg);
+ }
-<ARGS>{args} {
- struct cr_arg *_arg;
- int _l;
+<ARGS>{args} {
+ struct cr_arg *_arg;
+ int _l;
- CR_DISP_LEX("ARGS : [%s]\n", yytext);
- _l = strlen(yytext);
- yytext[_l - 1] = 0;
- _arg = cr_new_arg();
- _arg->value = strdup(yytext + 1);
+ CR_DISP_LEX("ARGS : [%s]\n", yytext);
+ _l = strlen(yytext);
+ yytext[_l - 1] = 0;
+ _arg = cr_new_arg();
+ _arg->value = strdup(yytext + 1);
- cr_add_arg(_arg);
- }
+ cr_add_arg(_arg);
+ }
-<ARGS>^[ \t]*\n {
- BEGIN 0;
- }
+<ARGS>^[ \t]*\n {
+ BEGIN 0;
+ }
-.|\n ;
+.|\n ;
%%
#if 0
/******************************************************************************
- MAIN
+ MAIN
******************************************************************************/
int main()
@@ -111,7 +111,7 @@ int main()
/******************************************************************************
- YYWRAP
+ YYWRAP
******************************************************************************/
int yywrap()
@@ -121,7 +121,7 @@ int yywrap()
/******************************************************************************
- YYERROR
+ YYERROR
******************************************************************************/
void yyerror(char *message)
diff --git a/src/cr_main.c b/src/cr_main.c
index 6677f27..435cb70 100644
--- a/src/cr_main.c
+++ b/src/cr_main.c
@@ -20,7 +20,7 @@
*
* Fichier : cr_main.c
*
- * @(#) [MB] cr_main.c Version 1.43 du 15/07/28 -
+ * @(#) [MB] cr_main.c Version 1.44 du 15/07/28 -
*
* Liste des fonctions de ce fichier :
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -591,7 +591,7 @@ int main(int argc, char *argv[])
break;
case 'V':
- fprintf(stderr, "%s: version %s\n", G.prgname, "1.43");
+ fprintf(stderr, "%s: version %s\n", G.prgname, "1.44");
exit(1);
break;
@@ -631,7 +631,7 @@ int main(int argc, char *argv[])
******************************************************************************/
void cr_usage(bool disp_config)
{
- fprintf(stderr, "%s: version %s\n", G.prgname, "1.43");
+ fprintf(stderr, "%s: version %s\n", G.prgname, "1.44");
fprintf(stderr, "Usage: %s [-h|-H|-V|-[eiuvdDEL1234][-[rgybmcwRGYBMCW] regexp ...][--config_name ...] ]\n",
G.prgname);
fprintf(stderr, " -h : help\n");
@@ -895,17 +895,17 @@ void cr_start_color(struct cr_color *col)
switch (col->intensity) {
case 1:
- fprintf(_out, "\033[%sm", cr_best_fg[_col_num - 9][0]);
+ fprintf(_out, "\033[%sm", cr_best_fg[_col_num - 9][0]);
fprintf(_out, "\033[48;5;%dm", cr_col_codes[_col_num - 9][0]);
break;
case 2:
- fprintf(_out, "\033[%sm", cr_best_fg[_col_num - 9][1]);
+ fprintf(_out, "\033[%sm", cr_best_fg[_col_num - 9][1]);
fprintf(_out, "\033[48;5;%dm", cr_col_codes[_col_num - 9][1]);
break;
case 3:
- fprintf(_out, "\033[%sm", cr_best_fg[_col_num - 9][2]);
+ fprintf(_out, "\033[%sm", cr_best_fg[_col_num - 9][2]);
fprintf(_out, "\033[48;5;%dm", cr_col_codes[_col_num - 9][2]);
break;
diff --git a/src/hl b/src/hl
index 470780b..5931528 100755
--- a/src/hl
+++ b/src/hl
Binary files differ