mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-11-23 01:11:19 +03:00
Newlibc: Added wrapper for all console.obj functions.
git-svn-id: svn://kolibrios.org@9716 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
182f6ade61
commit
4633866c71
@ -1,21 +1,16 @@
|
||||
include '../proc32.inc'
|
||||
|
||||
format MS COFF
|
||||
|
||||
include '../proc32.inc'
|
||||
|
||||
public _load_libconsole
|
||||
|
||||
public _con_init@20
|
||||
public _con_exit@4
|
||||
public _con_get_flags
|
||||
public _con_set_flags@4
|
||||
public _con_cls
|
||||
public _con_write_string@8
|
||||
public _con_getch2@0
|
||||
public _con_gets
|
||||
public con_set_title as '_con_set_title_ptr'
|
||||
|
||||
section '.text' align 16
|
||||
macro public_jmp name, size
|
||||
{
|
||||
public _#name#@#size
|
||||
_#name#@#size: jmp [name]
|
||||
}
|
||||
|
||||
section '.text' align 16 code readable executable
|
||||
|
||||
;void* __fastcall getprocaddr(export, name)
|
||||
align 4
|
||||
@ -155,30 +150,6 @@ _load_libconsole:
|
||||
.fail:
|
||||
ret
|
||||
|
||||
align 4
|
||||
_con_init@20:
|
||||
jmp [con_init]
|
||||
|
||||
align 4
|
||||
_con_exit@4:
|
||||
jmp [con_exit]
|
||||
|
||||
align 4
|
||||
_con_write_string@8:
|
||||
jmp [con_write_string]
|
||||
|
||||
_con_getch2@0:
|
||||
jmp [con_getch2]
|
||||
|
||||
_con_gets:
|
||||
jmp [con_gets]
|
||||
|
||||
_con_get_flags:
|
||||
_con_set_flags@4:
|
||||
_con_cls:
|
||||
ret
|
||||
|
||||
|
||||
proc mem.Alloc, size
|
||||
push ebx ecx
|
||||
mov ecx, [size]
|
||||
@ -222,11 +193,25 @@ proc mem.Free, mptr
|
||||
ret
|
||||
endp
|
||||
|
||||
;section '.ctors' align 4
|
||||
;align 4
|
||||
;dd _load_libconsole
|
||||
public_jmp con_init, 20
|
||||
public_jmp con_exit, 4
|
||||
public_jmp con_gets, 8
|
||||
public_jmp con_gets2, 12
|
||||
public_jmp con_cls, 0
|
||||
public_jmp con_getch2, 0
|
||||
public_jmp con_getch, 0
|
||||
public_jmp con_set_cursor_pos, 8
|
||||
public_jmp con_get_cursor_pos, 8
|
||||
public_jmp con_write_string, 8
|
||||
public_jmp con_write_asciiz, 4
|
||||
public_jmp con_get_flags, 0
|
||||
public_jmp con_set_flags, 4
|
||||
public_jmp con_set_title, 4
|
||||
public_jmp con_get_font_height, 0
|
||||
public_jmp con_get_cursor_height, 0
|
||||
public_jmp con_set_cursor_height, 4
|
||||
|
||||
section '.data' align 16
|
||||
section '.data' align 16 readable writable
|
||||
|
||||
; -------------------------
|
||||
macro library [lname,fname]
|
||||
@ -268,13 +253,20 @@ import console, \
|
||||
con_init, 'con_init', \
|
||||
con_exit, 'con_exit', \
|
||||
con_gets, 'con_gets', \
|
||||
con_gets2, 'con_gets2', \
|
||||
con_cls, 'con_cls', \
|
||||
con_getch2, 'con_getch2', \
|
||||
con_getch, 'con_getch', \
|
||||
con_set_cursor_pos, 'con_set_cursor_pos',\
|
||||
con_get_cursor_pos, 'con_get_cursor_pos', \
|
||||
con_write_string, 'con_write_string',\
|
||||
con_write_asciiz, 'con_write_asciiz', \
|
||||
con_get_flags, 'con_get_flags', \
|
||||
con_set_flags, 'con_set_flags', \
|
||||
con_set_title, 'con_set_title'
|
||||
con_set_title, 'con_set_title', \
|
||||
con_get_font_height, 'con_get_font_height', \
|
||||
con_get_cursor_height, 'con_get_cursor_height', \
|
||||
con_set_cursor_height, 'con_set_cursor_height'
|
||||
|
||||
s_libdir:
|
||||
db '/sys/lib/'
|
||||
|
52
contrib/sdk/sources/newlib/libc/include/conio.h
Normal file
52
contrib/sdk/sources/newlib/libc/include/conio.h
Normal file
@ -0,0 +1,52 @@
|
||||
#ifndef _CONIO_H_
|
||||
#define _CONIO_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define CON_WINDOW_CLOSED 0x200
|
||||
#define CON_COLOR_BLUE 0x01
|
||||
#define CON_COLOR_GREEN 0x02
|
||||
#define CON_COLOR_RED 0x04
|
||||
#define CON_COLOR_BRIGHT 0x08
|
||||
/* background color */
|
||||
|
||||
#define CON_BGR_BLUE 0x10
|
||||
#define CON_BGR_GREEN 0x20
|
||||
#define CON_BGR_RED 0x40
|
||||
#define CON_BGR_BRIGHT 0x80
|
||||
/* output controls */
|
||||
|
||||
#define CON_IGNORE_SPECIALS 0x100
|
||||
|
||||
#define __con_api __attribute__((stdcall)) __attribute__((dllimport))
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
int __con_api con_init(uint32_t wnd_width, uint32_t wnd_height, uint32_t scr_width, uint32_t scr_height, const char* title);
|
||||
void __con_api con_exit(int bCloseWindow);
|
||||
void __con_api con_set_title(const char* title);
|
||||
void __con_api con_write_asciiz(const char* str);
|
||||
void __con_api con_write_string(const char* str, uint32_t length);
|
||||
uint32_t __con_api con_get_flags(void);
|
||||
uint32_t __con_api con_set_flags(uint32_t new_flags);
|
||||
int __con_api con_get_font_height(void);
|
||||
int __con_api con_get_cursor_height(void);
|
||||
int __con_api con_set_cursor_height(int new_height);
|
||||
int __con_api con_getch(void);
|
||||
uint16_t __con_api con_getch2(void);
|
||||
int __con_api con_kbhit(void);
|
||||
char* __con_api con_gets(char* str, int n);
|
||||
typedef int __con_api (*con_gets2_callback)(int keycode, char** pstr, int* pn, int* ppos);
|
||||
char* __con_api con_gets2(con_gets2_callback callback, char* str, int n);
|
||||
void __con_api con_cls(void);
|
||||
void __con_api con_get_cursor_pos(int* px, int* py);
|
||||
void __con_api con_set_cursor_pos(int x, int y);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
@ -4,25 +4,14 @@
|
||||
#include "io.h"
|
||||
#include <string.h>
|
||||
|
||||
|
||||
void load_libconsole();
|
||||
void __stdcall con_init(unsigned w_w, unsigned w_h, unsigned s_w, unsigned s_h, const char* t);
|
||||
void __stdcall con_exit(char bCloseWindow);
|
||||
unsigned __stdcall con_get_flags(void);
|
||||
unsigned __stdcall con_set_flags(unsigned new_flags);
|
||||
void __stdcall con_cls(void);
|
||||
void __stdcall con_write_string(const char* string, unsigned length);
|
||||
short __stdcall con_getch2(void);
|
||||
char* __stdcall con_gets(char*, unsigned);
|
||||
|
||||
extern void __stdcall (*con_set_title_ptr)(char*);
|
||||
extern void load_libconsole();
|
||||
extern void __stdcall con_init(unsigned w_w, unsigned w_h, unsigned s_w, unsigned s_h, const char* t);
|
||||
extern void __stdcall con_exit(char bCloseWindow);
|
||||
extern void __stdcall con_write_string(const char* string, unsigned length);
|
||||
extern char* __stdcall con_gets(char*, unsigned);
|
||||
|
||||
int __gui_mode;
|
||||
|
||||
void con_init_opt(unsigned w_w, unsigned w_h, unsigned s_w, unsigned s_h, const char* t){
|
||||
con_init(w_w, w_h, s_w, s_h, t);
|
||||
}
|
||||
|
||||
static int console_read(const char *path, void *buff,
|
||||
size_t offset, size_t count, size_t *done)
|
||||
{
|
||||
@ -81,8 +70,3 @@ void __fini_conio()
|
||||
{
|
||||
con_exit(0);
|
||||
}
|
||||
|
||||
void con_set_title(char *title)
|
||||
{
|
||||
con_set_title_ptr(title);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user