Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 1763 → Rev 1764

/programs/other/graph/func.cpp
59,18 → 59,18
 
 
 
double fabs(double x)
double __cdecl fabs(double x)
{
__asm fld x
__asm fabs
}
#define M_PI 3.14159265358979323846
double cos(double x)
double __cdecl cos(double x)
{
__asm fld x
__asm fcos
}
double sin(double x)
double __cdecl sin(double x)
{
__asm fld x
__asm fsin
242,6 → 242,7
Str[j] = 0;
}
 
#ifndef AUTOBUILD
void *memcpy(void *dst, const void *src, unsigned size)
{
while (size--)
248,6 → 249,7
*((char*)dst+size) = *((char*)src+size);
return dst;
}
#endif
 
int strcmp(const char *s1, const char *s2)
{
/programs/other/graph/func.h
31,9 → 31,9
void DrawRegion(Dword x,Dword y,Dword width,Dword height,Dword color1);
int atoi(const char* string);
 
double fabs(double x);
double cos(double x);
double sin(double x);
double __cdecl fabs(double x);
double __cdecl cos(double x);
double __cdecl sin(double x);
int di(double x);
 
double id(int x);
/programs/other/graph/hello.cpp
55,7 → 55,12
 
//char fuck[64] = "$this is a fucking marker$";
// ïàðàìåòðû êîìàíäíîé ñòðîêè
#ifdef AUTOBUILD
extern char params[1024];
char params[1024];
#else
char params[1024] = "_FIND_ME_";
#endif
 
/*
 
/programs/other/graph/kosSyst.cpp
1,13 → 1,44
#include "kosSyst.h"
#include "func.h"
#include <stdarg.h>
 
#define atexitBufferSize 32
 
// Autobuild uses FASM method for exe->kos,
// MENUET01 header should be present in EXE.
#ifdef AUTOBUILD
char kosExePath[1024];
char exeStack[16384];
extern char params[1024];
// must be alphabetically first in the image
#pragma data_seg(".1seg")
extern "C" struct
{
char header[8];
int headerver;
void* entry;
void* i_end;
void* memsize;
void* stack;
void* params;
void* icon;
} header = {
{'M', 'E', 'N', 'U', 'E', 'T', '0', '1'},
1,
&crtStartUp,
0, // filled by doexe2.asm
0, // filled by doexe2.asm
exeStack + sizeof(exeStack),
params,
kosExePath
};
#pragma data_seg()
#else
char *kosExePath = NULL;
#endif
 
char pureCallMessage[] = "PURE function call!";
 
char *kosExePath = NULL;
 
//
void (__cdecl *atExitList[atexitBufferSize])();
int atExitFnNum = 0;
64,13 → 95,13
return RandomSeed;
}
 
#if _MSC_VER >= 1400
//
void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount )
#ifdef AUTOBUILD
// Well, not really related to auto-build, but some compilation issue
void memcpy( void *dst, const void *src, size_t bytesCount )
{
__asm{
mov edi, dst
mov eax, dst
// mov eax, dst
mov esi, src
mov ecx, bytesCount
rep movsb
90,6 → 121,7
}
#endif
 
 
//
Dword rtlInterlockedExchange( Dword *target, Dword value )
{
817,24 → 849,30
#pragma data_seg(".CRT$XCA")
#pragma data_seg(".CRT$XCZ")
typedef void (__cdecl *_PVFV)(void);
__declspec(allocate(".CRT$XCA")) _PVFV __xc_a[1] = { NULL };
__declspec(allocate(".CRT$XCZ")) _PVFV __xc_z[1] = { NULL };
//__declspec(allocate(".CRT$XCA")) _PVFV __xc_a[1] = { NULL };
//__declspec(allocate(".CRT$XCZ")) _PVFV __xc_z[1] = { NULL };
//
#pragma comment(linker, "/merge:.CRT=.rdata")
//
void crtStartUp()
{
#ifdef AUTOBUILD
// linker will try to remove unused variables; force header to be included
header.header;
#endif
// âûçûâàåì èíèöèàëèçàòîðû ïî ñïèñêó, NULL'û èãíîðèðóåì
for ( _PVFV *pbegin = __xc_a; pbegin < __xc_z; pbegin++ )
/*for ( _PVFV *pbegin = __xc_a; pbegin < __xc_z; pbegin++ )
{
//
if ( *pbegin != NULL )
(**pbegin)();
}
}*/
// èíèöèàëèçèðóåì ãåíåðàòîð ñëó÷àéíûõ ÷èñåë
rtlSrand( kos_GetSystemClock() );
#ifndef AUTOBUILD
// ïóòü ê ôàéëó ïðîöåññà
kosExePath = *((char **)0x20);
#endif
// âûçîâ ãëàâíîé ôóíêöèè ïðèëîæåíèÿ
kos_Main();
// âûõîä
/programs/other/graph/kosSyst.h
32,10 → 32,10
 
#define abs(a) (a<0?0-a:a)
 
extern "C" double acos(double x);
extern "C" double asin(double x);
extern "C" double floor(double x);
extern "C" double round(double x);
extern "C" double __cdecl acos(double x);
extern "C" double __cdecl asin(double x);
extern "C" double __cdecl floor(double x);
extern "C" double __cdecl round(double x);
#pragma function(acos,asin)
#if _MSC_VER > 1200
#pragma function(floor)
101,8 → 101,10
} processInfo;
};
 
#ifndef AUTOBUILD
//
extern char *kosExePath;
#endif
 
//
void crtStartUp();
119,9 → 121,12
char * __cdecl strrchr( const char * string, int c );
 
#if _MSC_VER < 1400
//extern "C" void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
//extern "C" void memset( Byte *dst, Byte filler, Dword count );
extern "C" void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
extern "C" void memset( Byte *dst, Byte filler, Dword count );
//#pragma intrinsic(memcpy,memset)
#elif defined AUTOBUILD
void memcpy( void *dst, const void *src, size_t bytesCount );
void memset( Byte *dst, Byte filler, Dword count );
#else
void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
void memset( Byte *dst, Byte filler, Dword count );
147,7 → 152,7
// ôóíêöèÿ 3 ïîëó÷èòü âðåìÿ
Dword kos_GetSystemClock();
// ôóíêöèÿ 4
void kos_WriteTextToWindow(
void __declspec(noinline) kos_WriteTextToWindow(
Word x, Word y,
Byte fontType,
Dword textColour,
157,7 → 162,7
// ôóíêöèÿ 7 íàðèñîâàòü èçîáðàæåíèå
void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
// ôóíêöèÿ 8 îïðåäåëèòü êíîïêó
void kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
void __declspec(noinline) kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
// ôóíêöèÿ 5 ïàóçà, â ñîòûõ äîëÿõ ñåêóíäû
void kos_Pause( Dword value );
// ôóíêöèÿ 9 - èíôîðìàöèÿ î ïðîöåññå
169,7 → 174,7
// ôóíêöèÿ 12
void kos_WindowRedrawStatus( Dword status );
// ôóíêöèÿ 13 íàðèñîâàòü ïîëîñó
void kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
void __declspec(noinline) kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
// ôóíêöèÿ 17
bool kos_GetButtonID( Dword &buttonID );
// ôóíêöèÿ 23
/programs/other/graph/math2.cpp
1,7 → 1,7
#include <math.h>
#include "kosSyst.h"
extern "C" int _fltused = 0;
double acos(double x)
double __cdecl acos(double x)
{
__asm {
fld qword ptr [esp+4]
15,7 → 15,7
fpatan
}
}
double asin(double x)
double __cdecl asin(double x)
{
__asm {
fld qword ptr [esp+4]
43,7 → 43,7
}
}
#endif
double ceil(double x)
double __cdecl ceil(double x)
{
__asm {
fld qword ptr [esp+4]
56,7 → 56,7
}
}
 
double floor(double x)
double __cdecl floor(double x)
{
__asm {
fld qword ptr [esp+4]
69,7 → 69,7
}
}
 
double round(double x)
double __cdecl round(double x)
{
__asm {
fld qword ptr [esp+4]
/programs/other/graph/parser.cpp
18,17 → 18,17
#define ERR_BADVARIABLE -5
#define ERR_OVERFLOW -6
 
double tg(double d)
double __cdecl tg(double d)
{
return sin(d) / cos(d);
}
 
double ctg(double d)
double __cdecl ctg(double d)
{
return cos(d) / sin(d);
}
 
double exp(double x)
double __cdecl exp(double x)
{
__asm {
fld x
49,7 → 49,7
}
 
double log(double x)
double __cdecl log(double x)
{
//return 0.0;
__asm {
61,7 → 61,7
}
}
 
double sqrt(double x)
double __cdecl sqrt(double x)
{
__asm {
fld x
69,7 → 69,7
}
}
 
double atan(double x)
double __cdecl atan(double x)
{
return 0.0; // â ëîì
}
81,7 → 81,7
 
 
// represents general mathematical function
typedef double(*matfunc)(double);
typedef double(__cdecl*matfunc)(double);
 
// used to link function name to the function
typedef struct
/programs/other/graph/string.c
1,6 → 1,7
 
#include "string.h"
 
#ifndef AUTOBUILD
void* memset(void *mem, int c, unsigned size)
{
unsigned i;
109,3 → 110,4
return (char*)0;
}
 
#endif
/programs/other/graph/string.h
1,12 → 1,14
 
#ifndef AUTOBUILD
#define NULL ((void*)0)
 
void* memset(void *mem, int c, unsigned size);
void* memcpy(void *dst, const void *src, unsigned size);
int strlen(const char* string);
#endif
 
void strcat(char strDest[], char strSource[]);
int strcmp(const char* string1, const char* string2);
//void strcpy(char strDest[], const char strSource[]);
char* strncpy(char *strDest, const char *strSource, unsigned n);
int strlen(const char* string);
char *strchr(const char* string, int c);