| 1 | /* $Id$ |
|---|
| 2 | * $URL$ |
|---|
| 3 | * |
|---|
| 4 | * generic driver helper |
|---|
| 5 | * |
|---|
| 6 | * Copyright (C) 2006 Michael Reinelt <reinelt@eunet.at> |
|---|
| 7 | * Copyright (C) 2006 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net> |
|---|
| 8 | * |
|---|
| 9 | * This file is part of LCD4Linux. |
|---|
| 10 | * |
|---|
| 11 | * LCD4Linux is free software; you can redistribute it and/or modify |
|---|
| 12 | * it under the terms of the GNU General Public License as published by |
|---|
| 13 | * the Free Software Foundation; either version 2, or (at your option) |
|---|
| 14 | * any later version. |
|---|
| 15 | * |
|---|
| 16 | * LCD4Linux is distributed in the hope that it will be useful, |
|---|
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 19 | * GNU General Public License for more details. |
|---|
| 20 | * |
|---|
| 21 | * You should have received a copy of the GNU General Public License |
|---|
| 22 | * along with this program; if not, write to the Free Software |
|---|
| 23 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|---|
| 24 | * |
|---|
| 25 | */ |
|---|
| 26 | |
|---|
| 27 | /* |
|---|
| 28 | * |
|---|
| 29 | * exported functions: |
|---|
| 30 | * |
|---|
| 31 | * drv_generic_init (void) |
|---|
| 32 | * initializes generic stuff and registers plugins |
|---|
| 33 | * |
|---|
| 34 | */ |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | #include "config.h" |
|---|
| 38 | |
|---|
| 39 | #include <stdlib.h> |
|---|
| 40 | #include <stdio.h> |
|---|
| 41 | #include <string.h> |
|---|
| 42 | |
|---|
| 43 | #include "debug.h" |
|---|
| 44 | #include "plugin.h" |
|---|
| 45 | #include "drv_generic.h" |
|---|
| 46 | |
|---|
| 47 | #ifdef WITH_DMALLOC |
|---|
| 48 | #include <dmalloc.h> |
|---|
| 49 | #endif |
|---|
| 50 | |
|---|
| 51 | /* these values are chars (text displays) or pixels (graphic displays) */ |
|---|
| 52 | |
|---|
| 53 | int LROWS = 0; /* layout size: rows */ |
|---|
| 54 | int LCOLS = 0; /* layout size: columns */ |
|---|
| 55 | |
|---|
| 56 | int DROWS = 4; /* display size: rows */ |
|---|
| 57 | int DCOLS = 20; /* display size: columns */ |
|---|
| 58 | |
|---|
| 59 | int XRES = 6; /* pixel widtht of one char */ |
|---|
| 60 | int YRES = 8; /* pixel height of one char */ |
|---|
| 61 | |
|---|
| 62 | |
|---|
| 63 | void (*drv_generic_blit) () = NULL; |
|---|
| 64 | |
|---|
| 65 | |
|---|
| 66 | static void my_drows(RESULT * result) |
|---|
| 67 | { |
|---|
| 68 | double value = DROWS; |
|---|
| 69 | SetResult(&result, R_NUMBER, &value); |
|---|
| 70 | } |
|---|
| 71 | |
|---|
| 72 | static void my_dcols(RESULT * result) |
|---|
| 73 | { |
|---|
| 74 | double value = DCOLS; |
|---|
| 75 | SetResult(&result, R_NUMBER, &value); |
|---|
| 76 | } |
|---|
| 77 | |
|---|
| 78 | static void my_xres(RESULT * result) |
|---|
| 79 | { |
|---|
| 80 | double value = XRES; |
|---|
| 81 | SetResult(&result, R_NUMBER, &value); |
|---|
| 82 | } |
|---|
| 83 | |
|---|
| 84 | static void my_yres(RESULT * result) |
|---|
| 85 | { |
|---|
| 86 | double value = YRES; |
|---|
| 87 | SetResult(&result, R_NUMBER, &value); |
|---|
| 88 | } |
|---|
| 89 | |
|---|
| 90 | static void my_lrows(RESULT * result) |
|---|
| 91 | { |
|---|
| 92 | double value = LROWS; |
|---|
| 93 | SetResult(&result, R_NUMBER, &value); |
|---|
| 94 | } |
|---|
| 95 | |
|---|
| 96 | static void my_lcols(RESULT * result) |
|---|
| 97 | { |
|---|
| 98 | double value = LCOLS; |
|---|
| 99 | SetResult(&result, R_NUMBER, &value); |
|---|
| 100 | } |
|---|
| 101 | |
|---|
| 102 | int drv_generic_init(void) |
|---|
| 103 | { |
|---|
| 104 | |
|---|
| 105 | AddFunction("LCD::height", 0, my_drows); |
|---|
| 106 | AddFunction("LCD::width", 0, my_dcols); |
|---|
| 107 | |
|---|
| 108 | AddFunction("LCD::xres", 0, my_xres); |
|---|
| 109 | AddFunction("LCD::yres", 0, my_yres); |
|---|
| 110 | |
|---|
| 111 | AddFunction("Layout::height", 0, my_lrows); |
|---|
| 112 | AddFunction("Layout::width", 0, my_lcols); |
|---|
| 113 | |
|---|
| 114 | return 0; |
|---|
| 115 | } |
|---|