Skip to content

Commit

Permalink
Logo added for the docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjwelborn committed Jul 28, 2019
1 parent 648a003 commit 0badb51
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 84 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ tools/*.json
deleteme.*
callgrind.*
cachegrind.*
images/*.xcf
4 changes: 2 additions & 2 deletions Doxyfile_common
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ QUIET = YES
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = ColrC
PROJECT_NUMBER =
PROJECT_BRIEF = "C library for linux terminal colors/escape-codes."
PROJECT_LOGO =
PROJECT_BRIEF = "An easy to use C library for linux terminal colors/escape-codes."
PROJECT_LOGO = images/colrc-pixels.png
OUTPUT_DIRECTORY = docs
CREATE_SUBDIRS = NO
ALLOW_UNICODE_NAMES = NO
Expand Down
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,25 @@ You can also run the tests through `valgrind` with the `testmemcheck` target:
make testmemcheck
```

The 'everything test' builds the colr tool and unit tests, both debug and
release mode (some bugs only show up in release mode), and runs them through
`valgrind`.
The examples are built and ran through `valgrind`, including the examples found
in the source code (see `snippet.py --examples`).
The coverage target is built (with the html report).
Finally, the binaries may be rebuilt if they are in a different state than
when the process started (switch back to debug build for development).

If any of those things fail, the process is stopped and there
is probably a bug worth fixing. Errors are always reported, but the
noise from all of those steps can be silenced with `--quiet`.

Each of these steps has found one or more bugs in the code or documentation
while developing ColrC. I don't mind running this before committing my changes.

If you'd like to run every possible compile target, with tests and memcheck,
including the example code and source-file examples (the 'everything test'):
```bash
./test/run_tests.sh --all --quiet
```

25 changes: 22 additions & 3 deletions colr.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,19 +571,38 @@ TermSize colr_term_size(void) {
/*! Attempts to retrieve a `winsize` struct from an `ioctl` call.
\details
If the call fails, a default `winsize` struct is returned:
If the call fails, the environment variables `LINES` and `COLUMNS` are checked.
If that fails, a default `winsize` struct is returned:
\code
(struct winsize){.ws_row=35, .ws_col=80, .ws_xpixel=0, .ws_ypixel=0}
\endcode
\details
`man ioctl_tty` says that `.ws_xpixel` and `.ws_ypixel` are unused.
\return A `winsize` struct (`sys/ioctl.h`) with window size information.
*/
struct winsize colr_win_size(void) {
struct winsize ws;
struct winsize ws = {0, 0, 0, 0};
if (ioctl(0, TIOCGWINSZ, &ws) < 0) {
// No support?
dbug("No support for ioctl TIOCGWINSZ, using defaults.");
return (struct winsize){.ws_row=35, .ws_col=80, .ws_xpixel=0, .ws_ypixel=0};
char* env_rows = getenv("LINES");
unsigned short default_rows = 0;
if (sscanf(env_rows, "%hu", &default_rows) != 1) {
default_rows = 35;
}
char* env_cols = getenv("COLUMNS");
unsigned short default_cols = 0;
if (sscanf(env_cols, "%hu", &default_cols) != 1) {
default_cols = 80;
}
return (struct winsize){
.ws_row=default_rows,
.ws_col=default_cols,
.ws_xpixel=0,
.ws_ypixel=0
};
}
return ws;
}
Expand Down
Loading

0 comments on commit 0badb51

Please sign in to comment.