forked from KolibriOS/kolibrios
Clib create_file, read_file, write_file: watcom-specific implementation
git-svn-id: svn://kolibrios.org@711 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
039660a246
commit
54786d007d
@ -42,8 +42,8 @@ WRect
|
||||
WFileName
|
||||
10
|
||||
clib_r.tgt
|
||||
0
|
||||
0
|
||||
21
|
||||
50
|
||||
11
|
||||
VComponent
|
||||
12
|
||||
@ -59,5 +59,5 @@ WFileName
|
||||
7
|
||||
crt.tgt
|
||||
0
|
||||
32
|
||||
12
|
||||
8
|
||||
|
@ -99,7 +99,28 @@ void _stdcall write_text(int x,int y,int color,char* text,int len);
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{ unsigned attr;
|
||||
unsigned flags;
|
||||
unsigned cr_time;
|
||||
unsigned cr_date;
|
||||
unsigned acc_time;
|
||||
unsigned acc_date;
|
||||
unsigned mod_time;
|
||||
unsigned mod_date;
|
||||
unsigned size;
|
||||
unsigned size_high;
|
||||
} FILEINFO;
|
||||
|
||||
|
||||
unsigned init_heap(void);
|
||||
void *user_alloc(unsigned size);
|
||||
unsigned user_free(void *);
|
||||
|
||||
int create_file(const char *name);
|
||||
int get_fileinfo(const char *name,FILEINFO* pinfo);
|
||||
int read_file (const char *name,void *buff, unsigned offset, unsigned count,unsigned *reads);
|
||||
int write_file(const char *name,const void *buff,unsigned offset,unsigned count,unsigned *writes);
|
||||
|
||||
#pragma aux init_heap = \
|
||||
"mov EAX, 68" \
|
||||
@ -108,10 +129,6 @@ unsigned init_heap(void);
|
||||
value [EAX] \
|
||||
modify [ EBX ];
|
||||
|
||||
void *user_alloc(unsigned size);
|
||||
|
||||
void *user_alloc(unsigned size);
|
||||
|
||||
#pragma aux user_alloc = \
|
||||
"mov EAX, 68" \
|
||||
"mov EBX, 12" \
|
||||
@ -119,8 +136,6 @@ void *user_alloc(unsigned size);
|
||||
parm [ ECX ] value [EAX] \
|
||||
modify [ EBX ];
|
||||
|
||||
unsigned user_free(void *);
|
||||
|
||||
#pragma aux user_free = \
|
||||
"mov EAX, 68" \
|
||||
"mov EBX, 13" \
|
||||
@ -128,6 +143,78 @@ unsigned user_free(void *);
|
||||
parm [ ECX ] value [EAX] \
|
||||
modify [ EBX ];
|
||||
|
||||
#pragma aux create_file = \
|
||||
"push 0" \
|
||||
"push 0" \
|
||||
"mov [esp+1], eax" \
|
||||
"push 0" \
|
||||
"push 0" \
|
||||
"push 0" \
|
||||
"push 0" \
|
||||
"push 2" \
|
||||
"mov ebx, esp" \
|
||||
"mov eax, 70" \
|
||||
"int 0x40" \
|
||||
"add esp, 28" \
|
||||
parm [EAX] value [EAX] \
|
||||
modify [ EBX ];
|
||||
|
||||
#pragma aux get_fileinfo = \
|
||||
"push 0" \
|
||||
"push 0" \
|
||||
"mov [esp+1], eax" \
|
||||
"push ebx" \
|
||||
"push 0" \
|
||||
"push 0" \
|
||||
"push 0" \
|
||||
"push 5" \
|
||||
"mov ebx, esp" \
|
||||
"mov eax, 70" \
|
||||
"int 0x40" \
|
||||
"add esp, 28" \
|
||||
parm [EAX] [ebx] value [EAX] \
|
||||
modify [ EBX ];
|
||||
|
||||
#pragma aux read_file = \
|
||||
"push 0" \
|
||||
"push 0" \
|
||||
"mov [esp+1], eax" \
|
||||
"push ebx" \
|
||||
"push edx" \
|
||||
"push 0" \
|
||||
"push ecx" \
|
||||
"push 0" \
|
||||
"mov ebx, esp" \
|
||||
"mov eax, 70" \
|
||||
"int 0x40" \
|
||||
"test esi, esi" \
|
||||
"jz skip" \
|
||||
"mov [esi], ebx" \
|
||||
"skip:" \
|
||||
"add esp, 28" \
|
||||
parm [EAX] [EBX] [ECX] [EDX] [ESI] value [EAX] \
|
||||
modify [ EBX ];
|
||||
|
||||
#pragma aux write_file = \
|
||||
"push 0" \
|
||||
"push 0" \
|
||||
"mov [esp+1], eax" \
|
||||
"push ebx" \
|
||||
"push edx" \
|
||||
"push 0" \
|
||||
"push ecx" \
|
||||
"push 3" \
|
||||
"mov ebx, esp" \
|
||||
"mov eax, 70" \
|
||||
"int 0x40" \
|
||||
"test esi, esi" \
|
||||
"jz skip" \
|
||||
"mov [esi], ebx" \
|
||||
"skip:" \
|
||||
"add esp, 28" \
|
||||
parm [EAX] [EBX] [ECX] [EDX] [ESI] value [EAX] \
|
||||
modify [ EBX ];
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
}
|
||||
|
@ -36,15 +36,7 @@
|
||||
#include "seterrno.h"
|
||||
#include "lseek.h"
|
||||
#include "handleio.h"
|
||||
|
||||
/*
|
||||
DWORD SetFilePointer(
|
||||
HANDLE hFile, // handle to file
|
||||
LONG lDistanceToMove, // bytes to move pointer
|
||||
PLONG lpDistanceToMoveHigh, // bytes to move pointer
|
||||
DWORD dwMoveMethod // starting point
|
||||
);
|
||||
*/
|
||||
#include "kolibri.h"
|
||||
|
||||
#ifndef INVALID_SET_FILE_POINTER
|
||||
#define INVALID_SET_FILE_POINTER 0xFFFFFFFF
|
||||
@ -56,21 +48,6 @@ typedef struct
|
||||
unsigned int offset;
|
||||
}__file_handle;
|
||||
|
||||
typedef struct
|
||||
{ DWORD attr;
|
||||
DWORD flags;
|
||||
DWORD cr_time;
|
||||
DWORD cr_date;
|
||||
DWORD acc_time;
|
||||
DWORD acc_date;
|
||||
DWORD mod_time;
|
||||
DWORD mod_date;
|
||||
DWORD size;
|
||||
DWORD size_high;
|
||||
} FILEINFO;
|
||||
|
||||
int _stdcall get_fileinfo(const char *name,FILEINFO* pinfo);
|
||||
|
||||
_WCRTLINK long __lseek( int hid, long offset, int origin )
|
||||
{
|
||||
__file_handle *fh;
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "openmode.h"
|
||||
#include "rtdata.h"
|
||||
#include "seterrno.h"
|
||||
#include "kolibri.h"
|
||||
|
||||
extern unsigned __NFiles;
|
||||
extern char *__appcwd;
|
||||
@ -53,23 +54,6 @@ extern int __appcwdlen;
|
||||
|
||||
#if (defined(__WINDOWS__) || defined(__NT__))
|
||||
|
||||
typedef struct
|
||||
{ DWORD attr;
|
||||
DWORD flags;
|
||||
DWORD cr_time;
|
||||
DWORD cr_date;
|
||||
DWORD acc_time;
|
||||
DWORD acc_date;
|
||||
DWORD mod_time;
|
||||
DWORD mod_date;
|
||||
DWORD size;
|
||||
DWORD size_high;
|
||||
} FILEINFO;
|
||||
|
||||
int _stdcall get_fileinfo(const char *name,FILEINFO* pinfo);
|
||||
int _stdcall create_file(const char *name);
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "seterrno.h"
|
||||
#include "qread.h"
|
||||
#include <stdio.h>
|
||||
#include "kolibri.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -43,9 +44,6 @@ typedef struct
|
||||
unsigned int offset;
|
||||
}__file_handle;
|
||||
|
||||
|
||||
int _stdcall read_file (const char *name,char *buff,unsigned offset, unsigned count,unsigned *reads);
|
||||
|
||||
int __qread( int handle, void *buffer, unsigned len )
|
||||
{
|
||||
__file_handle *fh;
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include "seterrno.h"
|
||||
#include "qwrite.h"
|
||||
#include "liballoc.h"
|
||||
|
||||
#include "kolibri.h"
|
||||
|
||||
/*
|
||||
Use caution when setting the file pointer in a multithreaded
|
||||
@ -51,27 +51,12 @@
|
||||
using a critical section object or a mutex object.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{ DWORD attr;
|
||||
DWORD flags;
|
||||
DWORD cr_time;
|
||||
DWORD cr_date;
|
||||
DWORD acc_time;
|
||||
DWORD acc_date;
|
||||
DWORD mod_time;
|
||||
DWORD mod_date;
|
||||
DWORD size;
|
||||
DWORD size_high;
|
||||
} FILEINFO;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
unsigned int offset;
|
||||
}__file_handle;
|
||||
|
||||
int _stdcall get_fileinfo(const char *name,FILEINFO* pinfo);
|
||||
int _stdcall write_file(const char *name,const void *buff,unsigned offset,unsigned count,unsigned *writes);
|
||||
char* getfullpath(const char* path);
|
||||
|
||||
int __qwrite( int handle, const void *buffer, unsigned len )
|
||||
@ -80,7 +65,6 @@ int __qwrite( int handle, const void *buffer, unsigned len )
|
||||
__file_handle *fh;
|
||||
unsigned len_written;
|
||||
|
||||
|
||||
__handle_check( handle, -1 );
|
||||
|
||||
fh = (__file_handle*) __getOSHandle( handle );
|
||||
|
29
programs/develop/open watcom/trunk/clib/math/cosf.asm
Normal file
29
programs/develop/open watcom/trunk/clib/math/cosf.asm
Normal file
@ -0,0 +1,29 @@
|
||||
|
||||
include mdef.inc
|
||||
|
||||
modstart cosf
|
||||
|
||||
xdefp _cosf
|
||||
|
||||
_cosf proc
|
||||
fcos
|
||||
fnstsw ax
|
||||
test eax, 0x400
|
||||
jnz L1
|
||||
ret
|
||||
|
||||
L1: fldpi
|
||||
fadd st,st
|
||||
fxch st(1)
|
||||
L2:
|
||||
fprem1
|
||||
fnstsw ax
|
||||
test eax,0x400
|
||||
jnz L2
|
||||
fstp st(1)
|
||||
fcos
|
||||
ret
|
||||
_cosf endp
|
||||
|
||||
endmod
|
||||
end
|
29
programs/develop/open watcom/trunk/clib/math/sinf.asm
Normal file
29
programs/develop/open watcom/trunk/clib/math/sinf.asm
Normal file
@ -0,0 +1,29 @@
|
||||
|
||||
include mdef.inc
|
||||
|
||||
modstart sinf
|
||||
|
||||
xdefp _sinf
|
||||
|
||||
_sinf proc
|
||||
fsin
|
||||
fnstsw ax
|
||||
test eax, 0x400
|
||||
jnz L1
|
||||
ret
|
||||
|
||||
L1: fldpi
|
||||
fadd st,st
|
||||
fxch st(1)
|
||||
L2:
|
||||
fprem1
|
||||
fnstsw ax
|
||||
test eax,0x400
|
||||
jnz L2
|
||||
fstp st(1)
|
||||
fsin
|
||||
ret
|
||||
_sinf endp
|
||||
|
||||
endmod
|
||||
end
|
31
programs/develop/open watcom/trunk/clib/math/tanf.asm
Normal file
31
programs/develop/open watcom/trunk/clib/math/tanf.asm
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
include mdef.inc
|
||||
|
||||
modstart tanf
|
||||
|
||||
xdefp _tanf
|
||||
|
||||
_tanf proc
|
||||
fptan
|
||||
fnstsw ax
|
||||
test eax, 0x400
|
||||
jnz L1
|
||||
fstp st(0)
|
||||
ret
|
||||
|
||||
L1: fldpi
|
||||
fadd st,st
|
||||
fxch st(1)
|
||||
L2:
|
||||
fprem1
|
||||
fnstsw ax
|
||||
test eax,0x400
|
||||
jnz L2
|
||||
fstp st(1)
|
||||
fptan
|
||||
fstp st(0)
|
||||
ret
|
||||
_tanf endp
|
||||
|
||||
endmod
|
||||
end
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user