| @@ -992,13 +992,12 @@ static void *export_tga(caca_canvas_t const *cv, size_t *bytes) | |||
| */ | |||
| static uint8_t _rgb_to_troff_index(uint32_t color) | |||
| { | |||
| int i; | |||
| uint8_t r = 0; | |||
| for(i = 0; i < 3; i++) | |||
| { | |||
| r += ((color >> (8*i+7))&1) << i; | |||
| } | |||
| return r; | |||
| int i; | |||
| uint8_t r = 0; | |||
| for(i = 0; i < 3; i++) | |||
| r += ((color >> (8 * i + 7)) & 1) << i; | |||
| return r; | |||
| } | |||
| /* Generate troff representation of current canvas. */ | |||
| @@ -1014,7 +1013,7 @@ static void *export_troff(caca_canvas_t const *cv, size_t *bytes) | |||
| uint32_t prevbg = 0; | |||
| int started = 0; | |||
| /* Each char is at most | |||
| /* Each char is at most | |||
| * 2x\mM (2x10) | |||
| * + \fB + \fI + \fR (9) | |||
| * + 4 bytes = 33 | |||
| @@ -1037,14 +1036,14 @@ static void *export_troff(caca_canvas_t const *cv, size_t *bytes) | |||
| for(x = 0; x < cv->width; x++) | |||
| { | |||
| uint32_t fg = _rgb_to_troff_index(_caca_attr_to_rgb24fg(lineattr[x])); | |||
| uint32_t bg = _rgb_to_troff_index(_caca_attr_to_rgb24bg(lineattr[x])); | |||
| uint32_t ch = linechar[x]; | |||
| if(fg != prevfg || !started) | |||
| cur += sprintf(cur, "\\m[%s]", colors[fg]); | |||
| if(bg != prevbg || !started) | |||
| cur += sprintf(cur, "\\M[%s]", colors[bg]); | |||
| uint32_t fg = _rgb_to_troff_index(_caca_attr_to_rgb24fg(lineattr[x])); | |||
| uint32_t bg = _rgb_to_troff_index(_caca_attr_to_rgb24bg(lineattr[x])); | |||
| uint32_t ch = linechar[x]; | |||
| if(fg != prevfg || !started) | |||
| cur += sprintf(cur, "\\m[%s]", colors[fg]); | |||
| if(bg != prevbg || !started) | |||
| cur += sprintf(cur, "\\M[%s]", colors[bg]); | |||
| if(lineattr[x] & CACA_BOLD) | |||
| cur += sprintf(cur, "\\fB"); | |||
| if(lineattr[x] & CACA_ITALICS) | |||
| @@ -1061,7 +1060,7 @@ static void *export_troff(caca_canvas_t const *cv, size_t *bytes) | |||
| prevfg = fg; | |||
| prevbg = bg; | |||
| started = 1; | |||
| } | |||
| } | |||
| /* Add unbreakable space at the end of lines, else spaces are dropped */ | |||
| if(x > 0 && linechar[x-1] == ' ') | |||
| @@ -20,3 +20,5 @@ clean: clean-local | |||
| clean-local: | |||
| rm -f bootsect.bin kern.bin kernel.map | |||
| echo-sources: ; echo $(SOURCES) | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcaca | |||
| * libcaca | |||
| * libcaca Colour ASCII-Art library | |||
| * Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | |||
| * 2009 Jean-Yves Lamoureux <jylam@lnxscene.org> | |||
| @@ -34,17 +34,17 @@ int kmain(void) | |||
| { | |||
| struct processor_info processor_info; | |||
| struct floppy_info floppy_info; | |||
| printf("_start at 0x%x\n", _start); | |||
| printf("kmain() at 0x%x\n", kmain); | |||
| printf("Types : char[%d] short[%d] int[%d] unsigned long long[%d]\n", sizeof(char), sizeof(short), sizeof(int), sizeof(unsigned long long)); | |||
| enable_interrupt(1); // Enable Keyboard Interrupt (IRQ1) | |||
| enable_interrupt(0); // Enable IRQ0 (timer) | |||
| enable_interrupt(13); | |||
| timer_phase(100); // Fire IRQ0 each 1/100s | |||
| processor_get_info(&processor_info); | |||
| processor_print_info(&processor_info); | |||
| @@ -53,7 +53,7 @@ int kmain(void) | |||
| /* Caca is delicious */ | |||
| printf("Filling memory with 0xCACA, starting from 0x%x\n", end); | |||
| char *ptr = end; | |||
| while (1) | |||
| { | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * libcaca | |||
| * libcaca | |||
| * libcaca Colour ASCII-Art library | |||
| * Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> | |||
| * 2009 Jean-Yves Lamoureux <jylam@lnxscene.org> | |||
| @@ -26,13 +26,11 @@ void dump_gdt(void); | |||
| void disable_interrupt(char i); | |||
| void enable_interrupt(char i); | |||
| #define cli __asm__("cli" : : ) | |||
| #define sti __asm__("sti" : : ) | |||
| #define cli __asm__("cli"::) | |||
| #define sti __asm__("sti"::) | |||
| #define rdtsc(low,high) \ | |||
| __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high)) | |||
| #define rdtsc(low, high) \ | |||
| __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high)) | |||
| /* The application's entry point */ | |||
| int main(int argc, char *argv[]); | |||
| @@ -1,16 +1,16 @@ | |||
| /* multiboot.h - the header for Multiboot */ | |||
| /* Copyright (C) 1999 Free Software Foundation, Inc. | |||
| 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| @@ -18,22 +18,22 @@ | |||
| /* Macros. */ | |||
| /* The magic number for the Multiboot header. */ | |||
| #define MULTIBOOT_HEADER_MAGIC 0x1BADB002 | |||
| #define MULTIBOOT_HEADER_MAGIC 0x1BADB002 | |||
| /* The flags for the Multiboot header. */ | |||
| #define MULTIBOOT_HEADER_FLAGS 0x00010003 | |||
| #define MULTIBOOT_HEADER_FLAGS 0x00010003 | |||
| /* The magic number passed by a Multiboot-compliant boot loader. */ | |||
| #define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002 | |||
| #define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002 | |||
| /* The size of our stack (16KB). */ | |||
| #define STACK_SIZE 0x4000 | |||
| #define STACK_SIZE 0x4000 | |||
| /* C symbol format. HAVE_ASM_USCORE is defined by configure. */ | |||
| #ifdef HAVE_ASM_USCORE | |||
| # define EXT_C(sym) _ ## sym | |||
| # define EXT_C(sym) _ ## sym | |||
| #else | |||
| # define EXT_C(sym) sym | |||
| # define EXT_C(sym) sym | |||
| #endif | |||
| #ifndef ASM | |||
| @@ -27,7 +27,7 @@ fi | |||
| # Check that we have no tabs or trailing spaces in the source code | |||
| # | |||
| failure=0 | |||
| for dir in caca src cxx examples ruby tools; do | |||
| for dir in caca kernel src cxx examples ruby tools; do | |||
| pushd ../$dir >/dev/null | |||
| for x in $(make -s echo-sources); do | |||
| case "$x" in | |||
| @@ -56,7 +56,8 @@ fi | |||
| # | |||
| warnings="$(grep -c Warning: ../doc/doxygen.log)" | |||
| if test "$warnings" != "0"; then | |||
| echo "error: $warnings warnings in Doxygen generation" | |||
| echo "error: $warnings warnings in Doxygen generation:" | |||
| grep Warning: ../doc/doxygen.log | sed 's/\(.\{75\}\)...*/\1 .../' | |||
| ret=1 | |||
| else | |||
| echo "0 errors in documentation" | |||
| @@ -25,6 +25,7 @@ | |||
| /* #undef HAVE_IMLIB2_H */ | |||
| /* #undef HAVE_INTTYPES_H */ | |||
| /* #undef HAVE_IOCTL */ | |||
| /* #undef HAVE_JNI_H */ | |||
| /* #undef HAVE_LOCALE_H */ | |||
| #define HAVE_MEMORY_H 1 | |||
| /* #undef HAVE_NCURSESW_NCURSES_H */ | |||