/programs/develop/fp/rtl/buildrtl.pp |
---|
6,9 → 6,9 |
sysinitpas, {sysinitcyg, sysinitgprof,} |
ctypes, strings, |
lineinfo, lnfodwrf, heaptrc, matrix, |
{windows, winsock, winsock2, initc, cmem, dynlibs, signals,} |
{windows, winsock, winsock2, initc, cmem, }dynlibs, {signals,} |
dos, crt, objects{, messages, |
rtlconsts, sysconst}, sysutils{, math, types, |
rtlconsts, sysconst}, sysutils, math{, types, |
strutils, dateutils, varutils, variants, typinfo, fgl}, classes{, |
convutils, stdconvs, cpu, mmx, charset, ucomplex, getopts, |
winevent, sockets, printer, |
/programs/develop/fp/rtl/kos.inc |
---|
146,6 → 146,28 |
popl %ebx |
end; |
procedure kos_setkeyboardmode(mode: DWord); assembler; register; |
asm |
pushl %eax |
pushl %ebx |
movl $66, %ecx |
movl $1, %ebx |
xchgl %eax, %ecx |
int $0x40 |
xchgl %eax, %ecx |
popl %ebx |
popl %eax |
end; |
function kos_getkeyboardmode(): DWord; assembler; register; |
asm |
pushl %ebx |
movl $66, %eax |
movl $2, %ebx |
int $0x40 |
popl %ebx |
end; |
procedure kos_setcaption(caption: PChar); assembler; register; |
asm |
pushl %ecx |
/programs/develop/fp/rtl/kosh.inc |
---|
23,6 → 23,8 |
function kos_getmousewinpos(): TKosPoint; |
function kos_getmousebuttons(): DWord; |
procedure kos_maskevents(mask: DWord); |
procedure kos_setkeyboardmode(mode: DWord); |
function kos_getkeyboardmode(): DWord; |
procedure kos_setcaption(caption: PChar); |
{ Graphics } |
/programs/develop/fp/rtl/sysfile.inc |
---|
1,18 → 1,18 |
{cp866} |
{utf8} |
function DecodeErrNo(ErrNo: DWord): Word; |
{0 = ãá¯¥è® |
1 = ¥ ®¯à¥¤¥«¥ ¡ § ¨/¨«¨ à §¤¥« ¦ñá⪮£® ¤¨áª (¯®¤äãªæ¨ï¬¨ 7, 8 äãªæ¨¨ 21) |
2 = äãªæ¨ï ¥ ¯®¤¤¥à¦¨¢ ¥âáï ¤«ï ¤ ®© ä ©«®¢®© á¨á⥬ë |
3 = ¥¨§¢¥áâ ï ä ©«®¢ ï á¨á⥬ |
4 = § १¥à¢¨à®¢ ®, ¨ª®£¤ ¥ ¢®§¢à é ¥âáï ¢ ⥪ã饩 ॠ«¨§ 樨 |
5 = ä ©« ¥ ©¤¥ |
6 = ä ©« § ª®ç¨«áï |
7 = 㪠§ â¥«ì ¢¥ ¯ ¬ï⨠¯à¨«®¦¥¨ï |
8 = ¤¨áª § ¯®«¥ |
9 = â ¡«¨æ FAT à §àãè¥ |
10 = ¤®áâ㯠§ ¯à¥éñ |
11 = ®è¨¡ª ãáâனá⢠} |
{0 = успешно |
1 = не определена база и/или раздел жёсткого диска (подфункциями 7, 8 функции 21) |
2 = функция не поддерживается для данной файловой системы |
3 = неизвестная файловая система |
4 = зарезервировано, никогда не возвращается в текущей реализации |
5 = файл не найден |
6 = файл закончился |
7 = указатель вне памяти приложения |
8 = диск заполнен |
9 = таблица FAT разрушена |
10 = доступ запрещён |
11 = ошибка устройства} |
begin |
case ErrNo of |
0: Result := 0; |
24,7 → 24,7 |
6: Result := 0; |
8: Result := 101; |
else |
Result := 153; { Unknown command (¥¨§¢¥áâ ï ª®¬ ¤ ) } |
Result := 153; { Unknown command (неизвестная команда) } |
end; |
end; |
96,6 → 96,8 |
InOutRes := 211; |
end; |
{ FIXME: Поправить RTL, факт отсутствия файла не фиксируется при его открытии. } |
procedure do_open(var f; p: PChar; flags: Longint); |
var |
KosFile: PKosFile; |
104,6 → 106,7 |
RecSize: Longint; |
CurrDir: array[0..2048] of Char; |
CurrDirLen: Longint; |
Dummy: Longint; |
begin |
case flags and 3 of |
0: FileRec(f).Mode := fmInput; |
111,11 → 114,11 |
2: FileRec(f).Mode := fmInOut; |
end; |
{®à¬¨à®¢ ¨¥ ¨¬¥¨ ¡á®«î⮣® ¯ãâ¨} |
{Формирование имени абсолютного пути} |
FilePathLen := Length(p); |
if p^ <> DirectorySeparator then |
begin |
{XXX: à §¬¥à ¡ãä¥à CurrDir ¬®¦¥â ®ª § âìáï ¥¤®áâ â®çë¬} |
{XXX: размер буфера CurrDir может оказаться недостаточным} |
CurrDirLen := kos_getdir(@CurrDir, SizeOf(CurrDir) - FilePathLen - 1) - 1; |
FilePath := @CurrDir; |
129,7 → 132,7 |
end else |
FilePath := p; |
{®§¤ ¨¥ áâàãªâãàë TKosFile} |
{Создание структуры TKosFile} |
RecSize := SizeOf(TKosFile) + FilePathLen; |
KosFile := GetMem(RecSize); |
FillChar(KosFile^, RecSize, 0); |
138,8 → 141,16 |
if flags and $1000 <> 0 then |
begin |
{ ᮧ¤ âì ä ©« } |
{ создать файл } |
InOutRes := DecodeErrNo(kos_rewritefile(KosFile, RecSize)); |
end else |
InOutRes := 0; |
begin |
{ попытаться прочитать файл } |
KosFile^.Size := 1; |
KosFile^.Data := @Dummy; |
InOutRes := DecodeErrNo(kos_readfile(KosFile, Dummy)); |
end; |
if InOutRes <> 0 then |
FreeMem(KosFile); |
end; |
/programs/develop/fp/rtl/windows.pp |
---|
1,7 → 1,100 |
unit Windows; |
{$mode objfpc} |
interface |
type |
WinBool = LongBool; |
Bool = WinBool; |
Handle = System.THandle; |
THandle = Handle; |
OVERLAPPED = record |
Internal : DWORD; |
InternalHigh : DWORD; |
Offset : DWORD; |
OffsetHigh : DWORD; |
hEvent : HANDLE; |
end; |
LPOVERLAPPED = ^OVERLAPPED; |
_OVERLAPPED = OVERLAPPED; |
TOVERLAPPED = OVERLAPPED; |
POVERLAPPED = ^OVERLAPPED; |
function GetStdHandle(nStdHandle: DWord): Handle; |
{function SetStdHandle(nStdHandle:DWORD; hHandle:HANDLE): WinBool;} |
function WriteFile(hFile: THandle; const Buffer; nNumberOfBytesToWrite: DWord; var lpNumberOfBytesWritten: DWord; lpOverlapped: POverlapped): Bool; |
function Std_Input_Handle: DWord; |
function Std_Output_Handle: DWord; |
function Std_Error_Handle: DWord; |
function GetTickCount: DWord; |
function QueryPerformanceCounter(var lpPerformanceCount: Int64): WinBool; |
function QueryPerformanceFrequency(var lpFrequency: Int64): WinBool; |
function AllocConsole: WinBool; |
{function FreeConsole: WinBool;} |
implementation |
function GetStdHandle(nStdHandle: DWord): Handle; |
begin |
Result := 0; |
end; |
function Std_Input_Handle: DWord; |
begin |
Result := 0; |
end; |
function Std_Output_Handle: DWord; |
begin |
Result := 1; |
end; |
function Std_Error_Handle: DWord; |
begin |
Result := 2; |
end; |
function WriteFile(hFile: THandle; const Buffer; nNumberOfBytesToWrite: DWord; var lpNumberOfBytesWritten: DWord; lpOverlapped: POverlapped): Bool; |
begin |
Result := True; |
end; |
function GetTickCount: DWord; |
begin |
Result := kos_timecounter() * 10; |
end; |
function QueryPerformanceCounter(var lpPerformanceCount: Int64): WinBool; |
begin |
lpPerformanceCount := kos_timecounter(); |
Result := True |
end; |
function QueryPerformanceFrequency(var lpFrequency: Int64): WinBool; |
begin |
lpFrequency := 100; |
Result := True |
end; |
function AllocConsole: WinBool; |
begin |
Result := True; |
end; |
end. |