Initial import

This commit is contained in:
Martin Lund 2014-09-27 11:35:17 +02:00
commit a14d14d75b
19 changed files with 1604 additions and 0 deletions

49
src/include/gotty/print.h Normal file
View file

@ -0,0 +1,49 @@
/*
* Go TTY - The Really Simple Terminal Application
*
* Copyright (c) 2014 Martin Lund
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
#ifndef PRINT_H
#define PRINT_H
#define ANSI_COLOR_GRAY "\x1b[1;30m"
#define ANSI_COLOR_RED "\x1b[1;31m"
#define ANSI_COLOR_GREEN "\x1b[1;32m"
#define ANSI_COLOR_YELLOW "\x1b[1;33m"
#define ANSI_COLOR_BLUE "\x1b[1;34m"
#define ANSI_COLOR_PINK "\x1b[1;35m"
#define ANSI_COLOR_CYAN "\x1b[1;36m"
#define ANSI_COLOR_WHITE "\x1b[1;37m"
#define ANSI_COLOR_RESET "\x1b[0m"
#define gotty_printf(format, args...) \
fprintf (stdout, "\n\033[300D" ANSI_COLOR_YELLOW "[gotty] " format ANSI_COLOR_RESET "\033[300D\n", ## args); \
fflush(stdout);
#ifdef DEBUG
#define debug_printf(format, args...) \
fprintf (stdout, "[debug] " format, ## args)
#define debug_printf_raw(format, args...) \
fprintf (stdout, "" format, ## args)
#else
#define debug_printf(format, args...)
#define debug_printf_raw(format, args...)
#endif
#endif