root/paper-tape-project/trunk/puncher/backend.dummy.c

Revision 25, 0.8 kB (checked in by sven, 3 years ago)

Clean up of repository before renaming the whole project
to

old media project

since we will shortly add punch card support to the whole
project.

-- sven @ workstation

Line 
1/**
2 * This is a dummy backend for debugging and testing purpose.
3 * It will print out all it's punched values to STDERR.
4 *
5 *
6 *
7 **/
8
9#include "backend.h"
10 
11#include <stdio.h>
12#include <stdlib.h>
13#ifdef __WIN32__
14        #define usleep(x) Sleep((x) / 1000)
15#else
16        #include <unistd.h>
17#endif
18
19PuncherBackend* puncher_backend_new(int debug_flag) {
20    PuncherBackend *c = malloc(sizeof(PuncherBackend));
21    fprintf(stderr, "[dummy backend] initialisation...\n");
22    return c;
23}
24
25int puncher_backend_write_byte(PuncherBackend* c, unsigned char byte) {
26    fprintf(stderr, "[dummy backend] punching 0x%x\n", byte);
27    usleep (20*1000); // 20ms
28    return 0;
29}
30
31int puncher_backend_destroy(PuncherBackend* c) {
32    fprintf(stderr, "[dummy backend] finishing backend...\n");
33    return 0;
34}
Note: See TracBrowser for help on using the browser.
© 2008 - 2010 Sven Köppel • Some rights reserved
Powered by Trac
Expect where otherwise noted, content on this site is licensed under a Creative Commons 3.0 License