Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  
  3. This is adapded thunk for console.obj sys library
  4. Only for internal use in stdio.h
  5.  
  6. Adapted for tcc by Siemargl, 2016
  7.  
  8. */
  9. #ifndef _CONIO_H_
  10. #define _CONIO_H_
  11.  
  12. #define cdecl   __attribute__ ((cdecl))
  13. #define stdcall __attribute__ ((stdcall))
  14.  
  15.  void stdcall (*__con_write_asciiz)(const char* str);
  16. /*      Display ASCIIZ-string to the console at the current position, shifting
  17. the current position. */
  18.  
  19.  void stdcall (*__con_write_string)(const char* str, unsigned length);
  20. /*      Similar to __con_write_asciiz, but length of the string must be given as a
  21. separate parameter */
  22.  
  23.  int stdcall (*__con_getch)(void);
  24. /*      Get one character from the keyboard.
  25.  
  26. For normal characters function returns ASCII-code. For extended
  27. characters (eg, Fx, and arrows), first function call returns 0
  28. and second call returns the extended code (similar to the DOS-function
  29. input). Starting from version 7, after closing the console window,
  30. this function returns 0. */
  31.  
  32.  short stdcall (*__con_getch2)(void);
  33. /*      Reads a character from the keyboard. Low byte contains the ASCII-code
  34. (0 for extended characters), high byte - advanced code (like in BIOS
  35. input functions). Starting from version 7, after closing the console
  36. window, this function returns 0. */
  37.  
  38.  int stdcall (*__con_kbhit)(void);
  39. /*      Returns 1 if a key was pressed, 0 otherwise. To read pressed keys use
  40. __con_getch and __con_getch2. Starting from version 6, after closing
  41. the console window, this function returns 1. */
  42.  
  43.  char* stdcall (*__con_gets)(char* str, int n);
  44. /*      Reads a string from the keyboard. Reading is interrupted when got
  45. "new line" character, or after reading the (n-1) characters (depending on
  46. what comes first). In the first case the newline is also recorded in the
  47. str. The acquired line is complemented by a null character.
  48. Starting from version 6, the function returns a pointer to the entered
  49. line if reading was successful, and NULL if the console window was closed. */
  50.  
  51. typedef int (stdcall * __con_gets2_callback)(int keycode, char** pstr, int* pn,
  52.         int* ppos);
  53.  
  54.  char* stdcall (*__con_gets2)(__con_gets2_callback callback, char* str, int n);
  55. /*      Con_gets completely analogous, except that when the user
  56. press unrecognized key, it calls the specified callback-procedure
  57. (which may, for example, handle up / down for history and tab to enter
  58. autocompletion). You should pass to the procedure: key code and three pointers
  59. - to the string, to the maximum length and to the current position.
  60. function may change the contents of string and may change the string
  61. itself (for example, to reallocate memory for increase the limit),
  62. maximum length, and position of the line - pointers are passed for it.
  63. Return value: 0 = line wasn't changed 1 = line changed, you should
  64. remove old string and display new, 2 = line changed, it is necessary
  65. to display it; 3 = immediately exit the function.
  66. Starting from version 6, the function returns a pointer to the entered
  67. line with the successful reading, and NULL if the console window was closed. */
  68.  
  69.  int __con_is_load;
  70.  unsigned *__con_dll_ver;
  71.  
  72.  int __con_init(void);
  73.  int __con_init_opt(int wnd_width, int wnd_height, int scr_width, int scr_height, const char* title);
  74.  void stdcall (*__con_exit)(int status);
  75.  
  76. #endif
  77.