Changeset 344


Ignore:
Timestamp:
Jan 13, 2004, 10:55:32 AM (16 years ago)
Author:
Sam Hocevar
Message:
  • configure.ac: + Check for sys/times.h and unistd.h. + Added calls to AC_C_CONST and AC_C_INLINE.
  • src/time.c src/graphics.c: + Fixes for MSVC compilation warnings. + Additional sanity checks in the Win32 driver.
  • src/caca.c: + Use raw()/noraw() in the curses driver instead of cbreak().
  • msvc/libcaca.sln: + Added an MSVC solution.
  • examples/aafire.c: + Slightly reduced the maximum cacafire framerate.
Location:
libcaca/trunk
Files:
11 added
7 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/Makefile.am

    r342 r344  
    22
    33SUBDIRS = src examples test doc
    4 DIST_SUBDIRS = $(SUBDIRS) autotools debian
     4DIST_SUBDIRS = $(SUBDIRS) autotools debian msvc
    55
    66EXTRA_DIST = BUGS NOTES bootstrap build-win32 caca-config.in libcaca.spec
  • libcaca/trunk/configure.ac

    r338 r344  
    1313AC_PROG_CPP
    1414AC_PROG_RANLIB
     15
     16AC_C_CONST
     17AC_C_INLINE
    1518
    1619dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
     
    2932  [  --enable-x11            X11 support (autodetected)])
    3033
    31 AC_CHECK_HEADERS(inttypes.h endian.h)
    32 AC_CHECK_FUNCS(vsnprintf getenv putenv strcasecmp usleep gettimeofday)
     34AC_CHECK_HEADERS(sys/time.h inttypes.h endian.h unistd.h)
     35AC_CHECK_FUNCS(vsnprintf _vsnprintf getenv putenv strcasecmp usleep gettimeofday)
    3336AC_MSG_CHECKING(for Sleep)
    3437AC_TRY_COMPILE([#include <windows.h>],[Sleep(42);],
     
    192195  autotools/Makefile
    193196  debian/Makefile
     197  msvc/Makefile
    194198])
    195199AC_CONFIG_FILES([caca-config], [chmod 0755 caca-config])
  • libcaca/trunk/examples/aafire.c

    r320 r344  
    101101      exit (1);
    102102    }
    103   caca_set_delay(0);
     103  caca_set_delay(10000);
    104104  XSIZ = caca_get_width() * 2;
    105105  YSIZ = caca_get_height() * 2 - 4;
  • libcaca/trunk/examples/cacaview.c

    r343 r344  
    2727#include <string.h>
    2828#include <stdlib.h>
    29 #include <unistd.h>
    3029
    3130#if defined(HAVE_IMLIB2_H)
  • libcaca/trunk/src/caca.c

    r336 r344  
    139139        keypad(stdscr, TRUE);
    140140        nonl();
    141         cbreak();
     141        raw();
    142142        noecho();
    143143        nodelay(stdscr, TRUE);
     
    173173    if(_caca_driver == CACA_DRIVER_WIN32)
    174174    {
     175        if(!AllocConsole())
     176            return -1;
     177
    175178        win32_hin = GetStdHandle(STD_INPUT_HANDLE);
    176179        win32_hout = CreateFile("CONOUT$", GENERIC_READ | GENERIC_WRITE,
     
    381384        mousemask(oldmask, NULL);
    382385        curs_set(1);
     386        noraw();
    383387        endwin();
    384388    }
  • libcaca/trunk/src/graphics.c

    r343 r344  
    6565#include <string.h>
    6666#include <stdlib.h>
    67 #include <unistd.h>
     67#if defined(HAVE_UNISTD_H)
     68#   include <unistd.h>
     69#endif
    6870#include <stdarg.h>
    6971
     
    819821                                                0, NULL,
    820822                                                CONSOLE_TEXTMODE_BUFFER, NULL);
    821         if(!win32_front)
     823        if(!win32_front || win32_front == INVALID_HANDLE_VALUE)
    822824            return -1;
    823825
     
    825827                                               0, NULL,
    826828                                               CONSOLE_TEXTMODE_BUFFER, NULL);
    827         if(!win32_back)
     829        if(!win32_back || win328back == INVALID_HANDLE_VALUE)
    828830            return -1;
    829831
    830832        if(!GetConsoleScreenBufferInfo(win32_hout, &csbi))
    831833            return -1;
     834
     835        /* Sample code to get the biggest possible window */
     836        //size = GetLargestConsoleWindowSize(win32_hout);
    832837
    833838        _caca_width = csbi.srWindow.Right - csbi.srWindow.Left + 1;
     
    843848
    844849        GetConsoleCursorInfo(win32_front, &cci);
     850        cci.dwSize = 0;
    845851        cci.bVisible = FALSE;
    846852        SetConsoleCursorInfo(win32_front, &cci);
     
    860866        }
    861867
    862 win32_buffer = malloc(sizeof(CHAR_INFO) * _caca_width * _caca_height);
     868        win32_buffer = malloc(_caca_width * _caca_height * sizeof(CHAR_INFO));
     869        if(win32_buffer == NULL)
     870        {
     871            free(win32_attr);
     872            free(win32_char);
     873            return -1;
     874        }
    863875
    864876        memset(win32_char, 0, _caca_width * _caca_height * sizeof(int));
  • libcaca/trunk/src/time.c

    r338 r344  
    3131
    3232#include <stdlib.h>
    33 #include <sys/time.h>
     33#if defined(HAVE_SYS_TIME_H)
     34#   include <sys/time.h>
     35#endif
    3436#include <time.h>
    3537
     
    3840#endif
    3941
    40 #include <unistd.h>
     42#if defined(HAVE_UNISTD_H)
     43#   include <unistd.h>
     44#endif
    4145
    4246#include "caca.h"
     
    5963    struct timeval tv;
    6064#elif defined(USE_WIN32)
    61     static long long int freq = -1;
    62     unsigned long long int usec;
     65    static __int64 freq = -1;
     66    unsigned __int64 usec;
    6367#endif
    6468    unsigned int ticks = 0;
     
    7781
    7882    QueryPerformanceCounter((LARGE_INTEGER *)&usec);
    79     new_sec = usec * 1000000 / freq / 1000000;
    80     new_usec = (usec * 1000000 / freq) % 1000000;
     83    new_sec = (int)(usec * 1000000 / freq / 1000000);
     84    new_usec = (int)((usec * 1000000 / freq) % 1000000);
    8185#endif
    8286
Note: See TracChangeset for help on using the changeset viewer.