Browse Source

New stuff, compilation script and examples...

master
Ognjen Milan Robovic 7 months ago
parent
commit
fc78431d48
7 changed files with 86 additions and 2 deletions
  1. +19
    -1
      README.md
  2. +1
    -1
      compile.sh
  3. +14
    -0
      example/compile.sh
  4. BIN
      example/view
  5. +37
    -0
      example/view.c
  6. +15
    -0
      example/view.log
  7. BIN
      example/view.o

+ 19
- 1
README.md View File

@@ -1,3 +1,21 @@
# xurses

Xurses...
xurses -- Library for creation of simple programs in terminal.

- 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...

Compile:
```bash
$ sh compile.sh
```

Install:
```bash
$ sudo sh install.sh
```

Testing:
```bash
$ sh example/testing.sh
```

+ 1
- 1
compile.sh View File

@@ -2,6 +2,6 @@

set -xe

gcc -g -ansi -Wall -Wextra -Wpedantic -Werror -c -o xurses.o xurses.c
gcc -g -ansi -Wall -Wextra -Wpedantic -Werror -Ofast -c -o xurses.o xurses.c

exit

+ 14
- 0
example/compile.sh View File

@@ -0,0 +1,14 @@
#!/bin/bash

set -xe

#~gcc -g -ansi -Wall -Wextra -Wpedantic -Werror -o ./example/view ./example/view.c /usr/include/xolatile/xurses.o
gcc -g -ansi -Wall -Wextra -Wpedantic -Werror -o ./example/view ./example/view.c
#~gcc -g -ansi -Wall -Wextra -Wpedantic -Werror -c -o ./example/view.o ./example/view.c
#~gcc -o ./example/view ./example/view.o /usr/include/xolatile/xurses.o

valgrind --show-leak-kinds=all --leak-check=full --log-file=./example/view.log ./example/view

xighlight -V < ./example/view.log

exit

BIN
example/view View File


+ 37
- 0
example/view.c View File

@@ -0,0 +1,37 @@
#include <xolatile/xtandard.c>
#include <xolatile/xurses.c>

static int i_x = 0;
static int i_y = 0;

static void i_up (void) { --i_y; limit (& i_y, 0, curses_screen_height - 1); }
static void i_down (void) { ++i_y; limit (& i_y, 0, curses_screen_height - 1); }
static void i_left (void) { --i_x; limit (& i_x, 0, curses_screen_width - 1); }
static void i_right (void) { ++i_x; limit (& i_x, 0, curses_screen_width - 1); }

int main (void) {
curses_configure ();

curses_bind (SIGNAL_W, i_up);
curses_bind (SIGNAL_S, i_down);
curses_bind (SIGNAL_A, i_left);
curses_bind (SIGNAL_D, i_right);

while (curses_active != 0) {
curses_render_background ('.', COLOUR_GREY, EFFECT_BOLD);

curses_render_character ('A', COLOUR_GREEN, EFFECT_NORMAL, 0, 1);
curses_render_character ('B', COLOUR_YELLOW, EFFECT_REVERSE, 0, 2);
curses_render_character ('C', COLOUR_WHITE, EFFECT_BLINK, 1, 0);
curses_render_character ('D', COLOUR_BLUE, EFFECT_ITALIC, 2, 0);

curses_render_string ("Heyo world!", COLOUR_RED, EFFECT_BOLD, 3, 0);
curses_render_string ("Heyo world!", COLOUR_PINK, EFFECT_BOLD, 168, 0);

curses_render_character ('@', COLOUR_CYAN, EFFECT_ITALIC, i_x, i_y);

curses_synchronize ();
}

return (EXIT_SUCCESS);
}

+ 15
- 0
example/view.log View File

@@ -0,0 +1,15 @@
==29652== Memcheck, a memory error detector
==29652== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==29652== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
==29652== Command: ./example/view
==29652== Parent PID: 29646
==29652==
==29652==
==29652== HEAP SUMMARY:
==29652== in use at exit: 0 bytes in 0 blocks
==29652== total heap usage: 1 allocs, 1 frees, 88,766 bytes allocated
==29652==
==29652== All heap blocks were freed -- no leaks are possible
==29652==
==29652== For counts of detected and suppressed errors, rerun with: -v
==29652== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

BIN
example/view.o View File


Loading…
Cancel
Save