*** empty log message ***

This commit is contained in:
hyung-hwan 2007-01-28 11:28:27 +00:00
parent b5a1de919c
commit 438430de23
7 changed files with 69 additions and 288 deletions

View File

@ -51,7 +51,7 @@ Package=<4>
###############################################################################
Project: "lsp"=.\lsp\lsp.dsp - Package Owner=<4>
Project: "lsp.lib"=.\lsp\lsp.dsp - Package Owner=<4>
Package=<5>
{{{

View File

@ -1,5 +1,5 @@
/*
* $Id: jni.c,v 1.58 2007-01-28 11:12:29 bacon Exp $
* $Id: jni.c,v 1.59 2007-01-28 11:28:26 bacon Exp $
*/
#include <stdio.h>
@ -269,13 +269,13 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_open (JNIEnv* env, jobject obj)
sysfns.dprintf = awk_dprintf;
sysfns.abort = awk_abort;
awk_data = (awk_data_t*)malloc (sizeof(awk_data_t));
awk_data = (awk_data_t*) malloc (sizeof(awk_data_t));
if (awk_data == NULL)
{
throw_exception (
env,
ase_awk_geterrstr(errnum),
errnum,
ase_awk_geterrstr(ASE_AWK_ENOMEM),
ASE_AWK_ENOMEM,
0);
return;
}

View File

@ -54,7 +54,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 aseawk.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"../release/win32/vs60/aseawk.dll" /implib:"release/win32/vs60/aseawk.lib" /libpath:"$(OutDir)"
# ADD LINK32 aseawk.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"../release/win32/vs60/aseawk_jni.dll" /implib:"release/win32/vs60/aseawk.lib" /libpath:"$(OutDir)"
!ELSEIF "$(CFG)" == "awk.jni - Win32 Debug"
@ -81,7 +81,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 aseawk.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"../debug/win32/vs60/aseawk.dll" /implib:"debug/win32/vs60/aseawk.lib" /pdbtype:sept /libpath:"$(OutDir)"
# ADD LINK32 aseawk.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"../debug/win32/vs60/aseawk_jni.dll" /implib:"debug/win32/vs60/aseawk.lib" /pdbtype:sept /libpath:"$(OutDir)"
!ENDIF

View File

@ -4,7 +4,7 @@
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=lsp - Win32 Debug
CFG=lsp.lib - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
@ -13,12 +13,12 @@ CFG=lsp - Win32 Debug
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "lsp.mak" CFG="lsp - Win32 Debug"
!MESSAGE NMAKE /f "lsp.mak" CFG="lsp.lib - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "lsp - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "lsp - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "lsp.lib - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "lsp.lib - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
@ -28,7 +28,7 @@ CFG=lsp - Win32 Debug
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "lsp - Win32 Release"
!IF "$(CFG)" == "lsp.lib - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
@ -52,7 +52,7 @@ LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"../release/win32/vs60/aselsp.lib"
!ELSEIF "$(CFG)" == "lsp - Win32 Debug"
!ELSEIF "$(CFG)" == "lsp.lib - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
@ -80,8 +80,8 @@ LIB32=link.exe -lib
# Begin Target
# Name "lsp - Win32 Release"
# Name "lsp - Win32 Debug"
# Name "lsp.lib - Win32 Release"
# Name "lsp.lib - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.c,v 1.155 2007-01-26 16:08:55 bacon Exp $
* $Id: awk.c,v 1.156 2007-01-28 11:28:27 bacon Exp $
*/
#include <ase/awk/awk.h>
@ -25,10 +25,11 @@
#include <wchar.h>
#include <wctype.h>
#include <locale.h>
#include "../../etc/printf.c"
#include "../../etc/main.c"
#endif
#include "../../etc/printf.c"
#include "../../etc/main.c"
#if defined(_WIN32) && defined(_MSC_VER) && defined(_DEBUG)
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
@ -65,21 +66,7 @@ static int awk_sprintf (
va_list ap;
va_start (ap, fmt);
#if defined(_WIN32)
n = _vsntprintf (buf, len, fmt, ap);
if (n < 0 || (ase_size_t)n >= len)
{
if (len > 0) buf[len-1] = ASE_T('\0');
n = -1;
}
#elif defined(__MSDOS__)
/* TODO: check buffer overflow */
n = vsprintf (buf, fmt, ap);
#elif defined(ASE_CHAR_IS_MCHAR)
n = vsnprintf (buf, len, fmt, ap);
#else
n = ase_vsprintf (buf, len, fmt, ap);
#endif
va_end (ap);
return n;
}
@ -104,8 +91,6 @@ static void awk_aprintf (const ase_char_t* fmt, ...)
MessageBox (NULL, buf,
ASE_T("\uB2DD\uAE30\uB9AC \uC870\uB610"), MB_OK|MB_ICONERROR);
#endif
#elif defined(ASE_CHAR_IS_MCHAR)
vprintf (fmt, ap);
#else
ase_vprintf (fmt, ap);
#endif
@ -116,15 +101,7 @@ static void awk_dprintf (const ase_char_t* fmt, ...)
{
va_list ap;
va_start (ap, fmt);
#if defined(_WIN32)
_vftprintf (stderr, fmt, ap);
#elif defined(ASE_CHAR_IS_MCHAR)
vfprintf (stderr, fmt, ap);
#else
ase_vfprintf (stderr, fmt, ap);
#endif
va_end (ap);
}
@ -132,14 +109,7 @@ static void awk_printf (const ase_char_t* fmt, ...)
{
va_list ap;
va_start (ap, fmt);
#if defined(_WIN32)
_vtprintf (fmt, ap);
#elif defined(ASE_CHAR_IS_MCHAR)
vprintf (fmt, ap);
#else
ase_vprintf (fmt, ap);
#endif
va_end (ap);
}
@ -171,9 +141,6 @@ static FILE* awk_popen (const ase_char_t* cmd, const ase_char_t* mode)
{
#if defined(_WIN32)
return _tpopen (cmd, mode);
#elif defined(__MSDOS__)
/* TODO: support this */
return NULL;
#elif defined(ASE_CHAR_IS_MCHAR)
return popen (cmd, mode);
#else
@ -949,177 +916,7 @@ static int __main (int argc, ase_char_t* argv[])
return 0;
}
#ifdef _WIN32
/*
NTSYSAPI PTEB NTAPI NtCurrentTeb();
Function NtCurrentTeb returns address of TEB (Thread Environment Block) for calling thread.
NtCurrentTeb isn't typical NT CALL realised via INT 2E, becouse TEB is accessable at address fs:[0018h].
Microsoft declare NtCurrentTeb as __cdecl, but ntdll.dll export it as __stdcall (it don't have metter, becouse function don't have any parameters), so you cannot use ntdll.dll export. In this case the better way is write NtCurrentTeb manually, declaring it as __cdecl.
typedef UCHAR BOOLEAN;
typedef struct _TEB {
NT_TIB Tib;
PVOID EnvironmentPointer;
CLIENT_ID Cid;
PVOID ActiveRpcInfo;
PVOID ThreadLocalStoragePointer;
PPEB Peb;
ULONG LastErrorValue;
ULONG CountOfOwnedCriticalSections;
PVOID CsrClientThread;
PVOID Win32ThreadInfo;
ULONG Win32ClientInfo[0x1F];
PVOID WOW32Reserved;
ULONG CurrentLocale;
ULONG FpSoftwareStatusRegister;
PVOID SystemReserved1[0x36];
PVOID Spare1;
ULONG ExceptionCode;
ULONG SpareBytes1[0x28];
PVOID SystemReserved2[0xA];
ULONG GdiRgn;
ULONG GdiPen;
ULONG GdiBrush;
CLIENT_ID RealClientId;
PVOID GdiCachedProcessHandle;
ULONG GdiClientPID;
ULONG GdiClientTID;
PVOID GdiThreadLocaleInfo;
PVOID UserReserved[5];
PVOID GlDispatchTable[0x118];
ULONG GlReserved1[0x1A];
PVOID GlReserved2;
PVOID GlSectionInfo;
PVOID GlSection;
PVOID GlTable;
PVOID GlCurrentRC;
PVOID GlContext;
NTSTATUS LastStatusValue;
UNICODE_STRING StaticUnicodeString;
WCHAR StaticUnicodeBuffer[0x105];
PVOID DeallocationStack;
PVOID TlsSlots[0x40];
LIST_ENTRY TlsLinks;
PVOID Vdm;
PVOID ReservedForNtRpc;
PVOID DbgSsReserved[0x2];
ULONG HardErrorDisabled;
PVOID Instrumentation[0x10];
PVOID WinSockData;
ULONG GdiBatchCount;
ULONG Spare2;
ULONG Spare3;
ULONG Spare4;
PVOID ReservedForOle;
ULONG WaitingOnLoaderLock;
PVOID StackCommit;
PVOID StackCommitMax;
PVOID StackReserved;
} TEB, *PTEB;
typedef struct _PEB {
BOOLEAN InheritedAddressSpace;
BOOLEAN ReadImageFileExecOptions;
BOOLEAN BeingDebugged;
BOOLEAN Spare;
HANDLE Mutant;
PVOID ImageBaseAddress;
PPEB_LDR_DATA LoaderData;
PRTL_USER_PROCESS_PARAMETERS ProcessParameters;
PVOID SubSystemData;
PVOID ProcessHeap;
PVOID FastPebLock;
PPEBLOCKROUTINE FastPebLockRoutine;
PPEBLOCKROUTINE FastPebUnlockRoutine;
ULONG EnvironmentUpdateCount;
PPVOID KernelCallbackTable;
PVOID EventLogSection;
PVOID EventLog;
PPEB_FREE_BLOCK FreeList;
ULONG TlsExpansionCounter;
PVOID TlsBitmap;
ULONG TlsBitmapBits[0x2];
PVOID ReadOnlySharedMemoryBase;
PVOID ReadOnlySharedMemoryHeap;
PPVOID ReadOnlyStaticServerData;
PVOID AnsiCodePageData;
PVOID OemCodePageData;
PVOID UnicodeCaseTableData;
ULONG NumberOfProcessors;
ULONG NtGlobalFlag;
BYTE Spare2[0x4];
LARGE_INTEGER CriticalSectionTimeout;
ULONG HeapSegmentReserve;
ULONG HeapSegmentCommit;
ULONG HeapDeCommitTotalFreeThreshold;
ULONG HeapDeCommitFreeBlockThreshold;
ULONG NumberOfHeaps;
ULONG MaximumNumberOfHeaps;
PPVOID *ProcessHeaps;
PVOID GdiSharedHandleTable;
PVOID ProcessStarterHelper;
PVOID GdiDCAttributeList;
PVOID LoaderLock;
ULONG OSMajorVersion;
ULONG OSMinorVersion;
ULONG OSBuildNumber;
ULONG OSPlatformId;
ULONG ImageSubSystem;
ULONG ImageSubSystemMajorVersion;
ULONG ImageSubSystemMinorVersion;
ULONG GdiHandleBuffer[0x22];
ULONG PostProcessInitRoutine;
ULONG TlsExpansionBitmap;
BYTE TlsExpansionBitmapBits[0x80];
ULONG SessionId;
} PEB, *PPEB;
*/
void* /*__declspec(naked)*/ get_current_teb (void)
{
_asm
{
mov eax, fs:[0x18]
}
}
void* get_current_peb (void)
{
void* teb = get_current_teb ();
return *(void**)((char*)teb + 0x30);
}
int is_debugger_present (void)
{
void *peb = get_current_peb ();
return *((char*)peb+0x02);
}
int /*__declspec(naked)*/ is_debugger_present2 (void)
{
_asm
{
mov eax, fs:[0x18]
mov ebx, [eax+0x30]
xor eax, eax
mov al, byte ptr[ebx+0x02]
}
}
#endif
#if defined(_WIN32)
int _tmain (int argc, ase_char_t* argv[])
#elif defined(__MSDOS__) || defined(ASE_CHAR_IS_MCHAR)
int main (int argc, ase_char_t* argv[])
#else
int ase_main (int argc, ase_char_t* argv[])
#endif
{
int n;
#if defined(__linux) && defined(_DEBUG)
@ -1129,21 +926,6 @@ int ase_main (int argc, ase_char_t* argv[])
_CrtSetDbgFlag (_CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF);
#endif*/
#if defined(_WIN32)
if (IsDebuggerPresent ())
{
_tprintf (_T("Running application in a debugger....\n"));
}
if (is_debugger_present ())
{
_tprintf (_T("Running application in a debugger by is_debugger_present...\n"));
}
if (is_debugger_present2 ())
{
_tprintf (_T("Running application in a debugger by is_debugger_present2...\n"));
}
#endif
n = __main (argc, argv);
#if defined(__linux) && defined(_DEBUG)

View File

@ -1,5 +1,5 @@
/*
* $Id: main.c,v 1.4 2007-01-26 16:10:32 bacon Exp $
* $Id: main.c,v 1.5 2007-01-28 11:28:26 bacon Exp $
*/
#include <ase/types.h>
@ -15,7 +15,11 @@
#include <tchar.h>
#define ase_main _tmain
#elif defined(ASE_CHAR_IS_WCHAR) && defined(__unix)
#elif defined(ASE_CHAR_IS_MCHAR)
#define ase_main main
#else /* ASE_CHAR_IS_WCHAR */
#ifdef __cplusplus
extern "C" { int ase_main (...); }

View File

@ -1,5 +1,5 @@
/*
* $Id: printf.c,v 1.6 2007-01-27 02:55:55 bacon Exp $
* $Id: printf.c,v 1.7 2007-01-28 11:28:27 bacon Exp $
*/
#include <stdarg.h>
@ -11,12 +11,12 @@
#include <wctype.h>
#if defined(_WIN32)
#include <tchar.h>
#define ase_printf _tprintf
#define ase_vprintf _vtprintf
#define ase_fprintf _ftprintf
#define ase_vfprintf _vftprintf
#include <tchar.h>
#define ase_printf _tprintf
#define ase_vprintf _vtprintf
#define ase_fprintf _ftprintf
#define ase_vfprintf _vftprintf
int ase_vsprintf (ase_char_t* buf, size_t size, const ase_char_t* fmt, va_list ap)
{
@ -45,50 +45,18 @@ int ase_sprintf (ase_char_t* buf, size_t size, const ase_char_t* fmt, ...)
#else
#if defined(ASE_CHAR_IS_MCHAR)
#define ase_tolower(x) tolower(x)
#define ase_isdigit(x) isdigit(x)
#elif defined(ASE_CHAR_IS_WCHAR)
#define ase_tolower(x) towlower(x)
#define ase_isdigit(x) iswdigit(x)
#else
#error define ASE_CHAR_IS_MCHAR or ASE_CHAR_IS_WCHAR
#endif
#if defined(ASE_CHAR_IS_MCHAR)
#define ase_tolower(x) tolower(x)
#define ase_isdigit(x) isdigit(x)
#elif defined(ASE_CHAR_IS_WCHAR)
#define ase_tolower(x) towlower(x)
#define ase_isdigit(x) iswdigit(x)
#else
#error define ASE_CHAR_IS_MCHAR or ASE_CHAR_IS_WCHAR
#endif
static ase_char_t* __adjust_format (const ase_char_t* format);
int ase_vprintf (const ase_char_t* fmt, va_list ap);
int ase_vfprintf (FILE *stream, const ase_char_t* fmt, va_list ap);
int ase_vsprintf (ase_char_t* buf, size_t size, const ase_char_t* fmt, va_list ap);
int ase_printf (const ase_char_t* fmt, ...)
{
int n;
va_list ap;
va_start (ap, fmt);
n = ase_vprintf (fmt, ap);
va_end (ap);
return n;
}
int ase_fprintf (FILE* file, const ase_char_t* fmt, ...)
{
int n;
va_list ap;
va_start (ap, fmt);
n = ase_vfprintf (file, fmt, ap);
va_end (ap);
return n;
}
int ase_vprintf (const ase_char_t* fmt, va_list ap)
{
return ase_vfprintf (stdout, fmt, ap);
}
int ase_vfprintf (FILE *stream, const ase_char_t* fmt, va_list ap)
{
int n;
@ -104,13 +72,29 @@ int ase_vfprintf (FILE *stream, const ase_char_t* fmt, va_list ap)
return n;
}
int ase_sprintf (ase_char_t* buf, size_t size, const ase_char_t* fmt, ...)
int ase_vprintf (const ase_char_t* fmt, va_list ap)
{
return ase_vfprintf (stdout, fmt, ap);
}
int ase_fprintf (FILE* file, const ase_char_t* fmt, ...)
{
int n;
va_list ap;
va_start (ap, fmt);
n = ase_vsprintf (buf, size, fmt, ap);
n = ase_vfprintf (file, fmt, ap);
va_end (ap);
return n;
}
int ase_printf (const ase_char_t* fmt, ...)
{
int n;
va_list ap;
va_start (ap, fmt);
n = ase_vprintf (fmt, ap);
va_end (ap);
return n;
}
@ -138,6 +122,17 @@ int ase_vsprintf (ase_char_t* buf, size_t size, const ase_char_t* fmt, va_list a
return n;
}
int ase_sprintf (ase_char_t* buf, size_t size, const ase_char_t* fmt, ...)
{
int n;
va_list ap;
va_start (ap, fmt);
n = ase_vsprintf (buf, size, fmt, ap);
va_end (ap);
return n;
}
#define MOD_SHORT 1
#define MOD_LONG 2
#define MOD_LONGLONG 3