@@ -1,8 +1,6 @@ | |||||
# xighlight | # xighlight | ||||
I'm gonna update this, I swear... | |||||
xighlight -- Program for highlighting source code in terminal. | |||||
xighlight -- Program for highlighting program output, source code and various text files in terminal. | |||||
- 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... | - I don't know what else to write here, program is being done in my free time, so expect more... | ||||
@@ -18,13 +16,14 @@ Install: | |||||
$ sudo sh install.sh | $ sudo sh install.sh | ||||
``` | ``` | ||||
Testing: | |||||
```bash | |||||
$ sh example/testing.sh | |||||
``` | |||||
Use: | 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 | ||||
$ xighlight -i my_c_program.ext | $ xighlight -i my_c_program.ext | ||||
``` | ``` | ||||
This is what it prints to standard output, when standard input is C source code: | |||||
![screenshot](c_hello.png) |
@@ -0,0 +1,45 @@ | |||||
-- gnatmake -o example_ada example_ada.adb | |||||
with ada.text_io, ada.command_line; | |||||
use ada.text_io, ada.command_line; | |||||
procedure example_ada is | |||||
type colours is (RED, GREEN, YELLOW); | |||||
type structure is record | |||||
x : integer := -1; | |||||
y : natural := 1; | |||||
end record; | |||||
escape : constant character := character'val (27); | |||||
procedure put_colour (colour : colours) is | |||||
code : integer := colours'pos (colour) + 49; | |||||
begin | |||||
put (escape & "[0;3" & character'val (code) & "m"); | |||||
end put_colour; | |||||
procedure put_cancel is | |||||
begin | |||||
put (escape & "[0m"); | |||||
end put_cancel; | |||||
heyo : structure := (-103, 107); | |||||
begin | |||||
for colour in colours | |||||
loop | |||||
put_colour (colour); | |||||
put_line ("x = " & integer'image (heyo.x)); | |||||
put_line ("y = " & natural'image (heyo.y)); | |||||
heyo.x := heyo.x - 1; | |||||
heyo.y := heyo.y + 1; | |||||
put_cancel; | |||||
end loop; | |||||
end example_ada; |
@@ -0,0 +1,70 @@ | |||||
V "GNAT Lib v8" | |||||
M P W=b | |||||
P ZX | |||||
RN | |||||
RV NO_IO | |||||
RV NO_DYNAMIC_SIZED_OBJECTS | |||||
RV SPARK_05 | |||||
U example_ada%b example_ada.adb 1890a4f7 NE OO SU IL | |||||
W ada%s ada.ads ada.ali | |||||
W ada.command_line%s a-comlin.adb a-comlin.ali | |||||
Z ada.tags%s a-tags.adb a-tags.ali | |||||
W ada.text_io%s a-textio.adb a-textio.ali | |||||
Z system.concat_2%s s-conca2.adb s-conca2.ali | |||||
Z system.concat_3%s s-conca3.adb s-conca3.ali | |||||
Z system.img_int%s s-imgint.adb s-imgint.ali | |||||
D ada.ads 20170911084841 76789da1 ada%s | |||||
D a-comlin.ads 20180111085525 4aa66568 ada.command_line%s | |||||
D a-except.ads 20180111085525 291912d5 ada.exceptions%s | |||||
D a-ioexce.ads 20170908151217 e4a01f64 ada.io_exceptions%s | |||||
D a-stream.ads 20180111085525 119b8fb3 ada.streams%s | |||||
D a-tags.ads 20180111085525 491b781d ada.tags%s | |||||
D a-textio.ads 20180111085525 881db35a ada.text_io%s | |||||
D a-unccon.ads 20170908151217 0e9b276f ada.unchecked_conversion%s | |||||
D example_ada.adb 20231007080949 da2b72c5 example_ada%b | |||||
D interfac.ads 20180111085525 5ab55268 interfaces%s | |||||
D i-cstrea.ads 20180111085525 e53d8b8e interfaces.c_streams%s | |||||
D system.ads 20180111085525 4635ec04 system%s | |||||
D s-conca2.ads 20180111085525 02a0d7d0 system.concat_2%s | |||||
D s-conca3.ads 20180111085525 0b705ca5 system.concat_3%s | |||||
D s-crtl.ads 20180111085525 0ebbdb71 system.crtl%s | |||||
D s-exctab.ads 20180111085525 54135002 system.exception_table%s | |||||
D s-ficobl.ads 20180111085525 078245e4 system.file_control_block%s | |||||
D s-imgint.ads 20180111085525 02dbe0c2 system.img_int%s | |||||
D s-parame.ads 20180111085525 f896c45c system.parameters%s | |||||
D s-secsta.ads 20180111085525 283dec34 system.secondary_stack%s | |||||
D s-soflin.ads 20180111085525 a7318a92 system.soft_links%s | |||||
D s-stache.ads 20180111085525 a37c21ec system.stack_checking%s | |||||
D s-stalib.ads 20180111085525 09bd3940 system.standard_library%s | |||||
D s-stoele.ads 20180111085525 2dc34a04 system.storage_elements%s | |||||
D s-traent.ads 20180111085525 005bf670 system.traceback_entries%s | |||||
D s-unstyp.ads 20180111085525 34867c83 system.unsigned_types%s | |||||
D s-wchcon.ads 20180111085525 1b7d22d2 system.wch_con%s | |||||
X 1 ada.ads | |||||
16K9*Ada 20e8 9|3r6 3r19 4r6 4r19 | |||||
X 2 a-comlin.ads | |||||
36K13*Command_Line 144e21 9|3w23 4r23 | |||||
X 7 a-textio.ads | |||||
49K13*Text_IO 471e16 9|3w10 4r10 | |||||
242U14*Put 9|20s17 25s17 | |||||
263U14*Put_Line 9|36s17 37s17 | |||||
X 9 example_ada.adb | |||||
6U11*example_ada 6b11 45l5 45t16 | |||||
8E14 colours 8e45 17r40 18r35 32r23 | |||||
8n26 RED{8E14} | |||||
8n31 GREEN{8E14} | |||||
8n38 YELLOW{8E14} | |||||
10R14 structure 13e19 28r16 | |||||
11i17 x{integer} 36r56 39m22 39r32 | |||||
12i17 y{natural} 37r56 40m22 40r32 | |||||
15e9 escape{character} 20r22 25r22 | |||||
17U19 put_colour 17b19 17>31 21l13 21t23 34s17 | |||||
17e31 colour{8E14} 18r48 | |||||
18i17 code{integer} 20r55 | |||||
23U19 put_cancel 23b19 26l13 26t23 42s17 | |||||
28r9 heyo{10R14} 36r51 37r51 39m17 39r27 40m17 40r27 | |||||
32e13 colour{8E14} 34r29 | |||||
@@ -0,0 +1,28 @@ | |||||
/* gcc -o example_c example_c.c */ | |||||
#include <stdio.h> | |||||
static struct { | |||||
char * x; | |||||
int y; | |||||
int z; | |||||
} const data [3] = { | |||||
{ "-- 1", 2, 3 }, | |||||
{ "-- 4", 5, 6 }, | |||||
{ "-- 7", 8, 9 } | |||||
}; | |||||
int main (void) { | |||||
int i; | |||||
for (i = 0; i != 3; ++i) { | |||||
printf ("\033[%c;3%cm%s%i%i\033[0m\n", | |||||
i + '1', | |||||
i + '1', | |||||
data [i]. x, | |||||
data [i]. y, | |||||
data [i]. z); | |||||
} | |||||
return (0); | |||||
} |
@@ -0,0 +1 @@ | |||||
// I hate this language so much it's unreal... |
@@ -0,0 +1,49 @@ | |||||
; fasm example_flat_assembly.fasm example_flat_assembly && chmod +x example_flat_assembly | |||||
format ELF64 executable 3 | |||||
entry main | |||||
TERMINAL_INPUT = 0 | |||||
TERMINAL_OUTPUT = 1 | |||||
EXIT_SUCCESS = 0 | |||||
EXIT_FAILURE = 1 | |||||
macro write file, data, size { | |||||
mov rax, 1 | |||||
mov rdi, file | |||||
mov rsi, data | |||||
mov rdx, size | |||||
syscall | |||||
} | |||||
macro exit code { | |||||
mov rax, 60 | |||||
mov rdi, code | |||||
syscall | |||||
} | |||||
segment readable executable | |||||
colour: | |||||
write TERMINAL_OUTPUT, colour_red, 7 | |||||
ret | |||||
cancel: | |||||
write TERMINAL_OUTPUT, colour_end, 4 | |||||
ret | |||||
main: | |||||
call colour | |||||
write TERMINAL_OUTPUT, string, length | |||||
call cancel | |||||
exit EXIT_SUCCESS | |||||
segment readable writable | |||||
colour_red db 27, "[1;31m" | |||||
colour_end db 27, "[0m" | |||||
string db "Heyo world!", 10, 0 | |||||
length dq $ - string |
@@ -0,0 +1,10 @@ | |||||
#!/bin/bash | |||||
set -xe | |||||
xighlight -a -i ./example/example_ada.adb | |||||
xighlight -c -i ./example/example_c.c | |||||
xighlight -C -i ./example/example_cpp.cpp | |||||
xighlight -F -i ./example/example_flat_assembly.fasm | |||||
exit |
@@ -320,7 +320,7 @@ int main (int argc, char * * argv) { | |||||
argument_define ("-c", "--c", highlight_c); | argument_define ("-c", "--c", highlight_c); | ||||
argument_define ("-a", "--ada", highlight_ada); | argument_define ("-a", "--ada", highlight_ada); | ||||
argument_define ("-C", "--c++", highlight_cpp); | argument_define ("-C", "--c++", highlight_cpp); | ||||
/*argument_define ("-p", "--python", highlight_python);*/ | |||||
/*argument_define ("-p", "--python", highlight_python);*/ | |||||
argument_define ("-V", "--valgrind", highlight_valgrind); | argument_define ("-V", "--valgrind", highlight_valgrind); | ||||
argument_define ("-A", "--assembly", highlight_common_assembly); | argument_define ("-A", "--assembly", highlight_common_assembly); | ||||
argument_define ("-F", "--flat-assembly", highlight_flat_assembly); | argument_define ("-F", "--flat-assembly", highlight_flat_assembly); | ||||