Something is better now...

This commit is contained in:
Ognjen Milan Robovic 2023-09-20 06:29:11 -04:00
parent ac1729326c
commit faeb775aeb
2 changed files with 12 additions and 15 deletions

View File

@ -2,26 +2,23 @@
I'm gonna update this, I swear... I'm gonna update this, I swear...
xighlight -- Program for highlighting C source code in terminal. xighlight -- Program for highlighting source code in terminal.
- Quickly written program to test out xtandard and xyntax, doesn't handle files, instead it records from standard input...
- For now, 'xighlight' only works on ANSI C source code, without 'typedef' keyword, both will change in the future, and CLA will be added...
- Everything related to my libraries is clean of all warning options on Clang, GCC and Valgrind. - Everything related to my libraries is clean of all warning options on Clang, GCC and Valgrind.
- I don't know what else to write here, program is being done in my free time, so expect more...
- It kinda looks more serious if I have very long 'README.md' file, almost like a valid project.
Compiling: Compile:
```bash ```bash
$ sh compile.sh $ sh compile.sh
``` ```
Installing: Install:
```bash ```bash
$ sudo sh install.sh $ sudo sh install.sh
``` ```
Using: Use:
```bash ```bash
$ cat my_c_program.ext | xighlight $ cat my_c_program.ext | xighlight
$ xighlight < my_c_program.ext $ xighlight < my_c_program.ext

View File

@ -144,9 +144,9 @@ static void highlight_cpp (void) {
highlighted = 1; highlighted = 1;
} }
/*
static void highlight_python (void) { static void highlight_python (void) {
char * separators = ".,:<=>+-*/%!&~^?|()[]'\" \t\r\n"; char * separators = ".,:<=>+*-/%!&~^?|()[]'\" \t\r\n";
char * keywords [35] = { char * keywords [35] = {
"False", "await", "else", "import", "pass", "None", "break", "except", "False", "await", "else", "import", "pass", "None", "break", "except",
@ -173,7 +173,7 @@ static void highlight_python (void) {
highlighted = 1; highlighted = 1;
} }
*/
int main (int argc, char * * argv) { int main (int argc, char * * argv) {
int offset = 0; int offset = 0;
int select = 0; int select = 0;
@ -215,14 +215,14 @@ int main (int argc, char * * argv) {
select = syntax_select (& buffer [offset], & length); select = syntax_select (& buffer [offset], & length);
if (select >= syntax_count) { if (select >= syntax_count) {
terminal_style (EFFECT_REVERSE, COLOUR_RED); terminal_colour (COLOUR_RED, EFFECT_REVERSE);
} else { } else {
terminal_style (syntax_effect [select], syntax_colour [select]); terminal_colour (syntax_colour [select], syntax_effect [select]);
} }
out (& buffer [offset], length); out (& buffer [offset], length);
terminal_style (-1, -1); terminal_cancel ();
} }
buffer = deallocate (buffer); buffer = deallocate (buffer);