| 1 |
|
| 2 |
|
| 3 |
#include "pdcos2.h" |
| 4 |
|
| 5 |
RCSID("$Id: pdcgetsc.c,v 1.39 2008/07/14 04:24:51 wmcbrine Exp $") |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
int PDC_get_columns(void) |
| 10 |
{ |
| 11 |
#ifdef EMXVIDEO |
| 12 |
int rows = 0; |
| 13 |
#else |
| 14 |
VIOMODEINFO modeInfo = {0}; |
| 15 |
#endif |
| 16 |
int cols = 0; |
| 17 |
const char *env_cols; |
| 18 |
|
| 19 |
PDC_LOG(("PDC_get_columns() - called\n")); |
| 20 |
|
| 21 |
#ifdef EMXVIDEO |
| 22 |
v_dimen(&cols, &rows); |
| 23 |
#else |
| 24 |
modeInfo.cb = sizeof(modeInfo); |
| 25 |
VioGetMode(&modeInfo, 0); |
| 26 |
cols = modeInfo.col; |
| 27 |
#endif |
| 28 |
env_cols = getenv("COLS"); |
| 29 |
|
| 30 |
if (env_cols) |
| 31 |
cols = min(atoi(env_cols), cols); |
| 32 |
|
| 33 |
PDC_LOG(("PDC_get_columns() - returned: cols %d\n", cols)); |
| 34 |
|
| 35 |
return cols; |
| 36 |
} |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
int PDC_get_cursor_mode(void) |
| 41 |
{ |
| 42 |
#ifdef EMXVIDEO |
| 43 |
int curstart = 0, curend = 0; |
| 44 |
#else |
| 45 |
VIOCURSORINFO cursorInfo; |
| 46 |
#endif |
| 47 |
PDC_LOG(("PDC_get_cursor_mode() - called\n")); |
| 48 |
|
| 49 |
#ifdef EMXVIDEO |
| 50 |
v_getctype(&curstart, &curend); |
| 51 |
return (curstart << 8) | curend; |
| 52 |
#else |
| 53 |
VioGetCurType (&cursorInfo, 0); |
| 54 |
|
| 55 |
return (cursorInfo.yStart << 8) | cursorInfo.cEnd; |
| 56 |
#endif |
| 57 |
} |
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
int PDC_get_rows(void) |
| 62 |
{ |
| 63 |
#ifdef EMXVIDEO |
| 64 |
int cols = 0; |
| 65 |
#else |
| 66 |
VIOMODEINFO modeInfo = {0}; |
| 67 |
#endif |
| 68 |
int rows = 0; |
| 69 |
const char *env_rows; |
| 70 |
|
| 71 |
PDC_LOG(("PDC_get_rows() - called\n")); |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
#ifdef EMXVIDEO |
| 77 |
v_dimen(&cols, &rows); |
| 78 |
#else |
| 79 |
modeInfo.cb = sizeof(modeInfo); |
| 80 |
VioGetMode(&modeInfo, 0); |
| 81 |
rows = modeInfo.row; |
| 82 |
#endif |
| 83 |
env_rows = getenv("LINES"); |
| 84 |
|
| 85 |
if (env_rows) |
| 86 |
rows = min(atoi(env_rows), rows); |
| 87 |
|
| 88 |
PDC_LOG(("PDC_get_rows() - returned: rows %d\n", rows)); |
| 89 |
|
| 90 |
return rows; |
| 91 |
} |