You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(16) |
Aug
(203) |
Sep
(142) |
Oct
(113) |
Nov
(73) |
Dec
(27) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(7) |
Feb
(38) |
Mar
(6) |
Apr
(1) |
May
(9) |
Jun
(104) |
Jul
(6) |
Aug
(11) |
Sep
(13) |
Oct
(6) |
Nov
(15) |
Dec
(37) |
2008 |
Jan
(17) |
Feb
(4) |
Mar
(6) |
Apr
(4) |
May
(2) |
Jun
(5) |
Jul
(1) |
Aug
(3) |
Sep
(21) |
Oct
(7) |
Nov
|
Dec
(3) |
2009 |
Jan
(4) |
Feb
(15) |
Mar
|
Apr
(34) |
May
(44) |
Jun
(12) |
Jul
(6) |
Aug
(15) |
Sep
(20) |
Oct
(10) |
Nov
(1) |
Dec
(20) |
2010 |
Jan
(19) |
Feb
(5) |
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ped...@us...> - 2007-06-24 22:53:27
|
Revision: 1002 http://svn.sourceforge.net/cegcc/?rev=1002&view=rev Author: pedroalves Date: 2007-06-24 15:53:21 -0700 (Sun, 24 Jun 2007) Log Message: ----------- Make PipeLib closer to desktop Windows Pipes. * PipeDev/Makefile (STRIP): New. (PipeDev.dll): Rename to ... (PipeDev_unstripped.dll): ... this. Add Makefile to dependencies. (PipeDev.dll): New rule for stripped version of PipeDev_unstripped.dll. (download): New rule. (.PHONY): Fix typo. Add download. * PipeDev/PipeDevice.cpp (LogMessage2): New. (LogMessage): Provide more info. Call LogMessage2. (LogScope::LogScope): Add MSG parameter. Change output to ">". (LogScope::~LogScope): Change output to "<". (LogScope::msg_): New field. (LOG): New macro. (LOGSCOPE): Pass __FUNCTION__ and __LINE__. Expect a char* as parameter. (GetDeviceHandle): Use new LOGSCOPE interface. (Init): Use new LOGSCOPE interface. Use LOG. (Deinit): Likewise. (Open): Likewise. (DeactivatorData): Delete. (Deactivator): Change void* parameter to HANDLE. Use new LOGSCOPE interface. Use LOG. Adapt to get the device HANDLE directly from the parameter. (DeactivatePipeDevice): Use new LOGSCOPE interface. Pass device->dev directly to CreateThread as start routine data. (Close): Use LOG. Add a comment explaining why we deactivate the device in a separate thread. (Read): Use new LOGSCOPE interface. Use LOG. Return success if the pipe is broken but the buffer still has data. Return success and don't block waiting for a Write if the read didn't fill the in buffer, but did get more than 0 bytes. Add a few comments explaing the code. (Write): Use new LOGSCOPE interface. Use LOG. Use IsBadWritePtr instead of IsBadReadPtr. Set ERROR_NO_DATA in case the pipe was broken. (Seek): Use new LOGSCOPE interface. (IOControl): Use new LOGSCOPE interface. Use LOG. Modified Paths: -------------- trunk/cegcc/tools/PipeLib/ChangeLog trunk/cegcc/tools/PipeLib/PipeDev/Makefile trunk/cegcc/tools/PipeLib/PipeDev/PipeDevice.cpp Modified: trunk/cegcc/tools/PipeLib/ChangeLog =================================================================== --- trunk/cegcc/tools/PipeLib/ChangeLog 2007-06-24 22:26:06 UTC (rev 1001) +++ trunk/cegcc/tools/PipeLib/ChangeLog 2007-06-24 22:53:21 UTC (rev 1002) @@ -1,11 +1,50 @@ 2007-06-24 Pedro Alves <ped...@po...> + Make PipeLib closer to desktop Windows Pipes. + * PipeDev/Makefile (STRIP): New. + (PipeDev.dll): Rename to ... + (PipeDev_unstripped.dll): ... this. Add Makefile to dependencies. + (PipeDev.dll): New rule for stripped version of PipeDev_unstripped.dll. + (download): New rule. + (.PHONY): Fix typo. Add download. + * PipeDev/PipeDevice.cpp (LogMessage2): New. + (LogMessage): Provide more info. Call LogMessage2. + (LogScope::LogScope): Add MSG parameter. Change output to ">". + (LogScope::~LogScope): Change output to "<". + (LogScope::msg_): New field. + (LOG): New macro. + (LOGSCOPE): Pass __FUNCTION__ and __LINE__. Expect a char* as + parameter. + (GetDeviceHandle): Use new LOGSCOPE interface. + (Init): Use new LOGSCOPE interface. Use LOG. + (Deinit): Likewise. + (Open): Likewise. + (DeactivatorData): Delete. + (Deactivator): Change void* parameter to HANDLE. Use new LOGSCOPE + interface. Use LOG. Adapt to get the device HANDLE directly from the + parameter. + (DeactivatePipeDevice): Use new LOGSCOPE interface. Pass + device->dev directly to CreateThread as start routine data. + (Close): Use LOG. Add a comment explaining why we deactivate the + device in a separate thread. + (Read): Use new LOGSCOPE interface. Use LOG. Return success if the + pipe is broken but the buffer still has data. Return success and + don't block waiting for a Write if the read didn't fill the in buffer, + but did get more than 0 bytes. Add a few comments explaing the code. + (Write): Use new LOGSCOPE interface. Use LOG. Use IsBadWritePtr + instead of IsBadReadPtr. Set ERROR_NO_DATA in case the pipe was + broken. + (Seek): Use new LOGSCOPE interface. + (IOControl): Use new LOGSCOPE interface. Use LOG. + +2007-06-24 Pedro Alves <ped...@po...> + * LICENSE, README, TODO: New files. 2007-06-09 Pedro Alves <ped...@po...> Initial import. - + * ChangeLog, PipeLib/Makefile, PipeLib/PipeLib.cpp, PipeLib/PipeLib.h, PipeDev/Makefile, PipeDev/PipeDevice.cpp, PipeDev/PipeDevice.h, PipeTest/Makefile, PipeTest/PipeTest.cpp, Modified: trunk/cegcc/tools/PipeLib/PipeDev/Makefile =================================================================== --- trunk/cegcc/tools/PipeLib/PipeDev/Makefile 2007-06-24 22:26:06 UTC (rev 1001) +++ trunk/cegcc/tools/PipeLib/PipeDev/Makefile 2007-06-24 22:53:21 UTC (rev 1002) @@ -2,6 +2,7 @@ CXX=$(TARGET)-g++ AR=$(TARGET)-ar +STRIP=$(TARGET)-strip WARNFLAGS=-Wall -Wextra @@ -11,10 +12,16 @@ all: PipeDev.dll -PipeDev.dll: PipeDevice.cpp +PipeDev_unstripped.dll: PipeDevice.cpp Makefile $(CXX) $< -shared -o $@ $(ALLFLAGS) +PipeDev.dll: PipeDev_unstripped.dll + $(STRIP) $< -o $@ + +download: PipeDev.dll + pcp PipeDev.dll ":/Windows/PipeDev.dll" + clean: rm -f PipeDev.dll -.PHONE: all clean +.PHONY: all clean download Modified: trunk/cegcc/tools/PipeLib/PipeDev/PipeDevice.cpp =================================================================== --- trunk/cegcc/tools/PipeLib/PipeDev/PipeDevice.cpp 2007-06-24 22:26:06 UTC (rev 1001) +++ trunk/cegcc/tools/PipeLib/PipeDev/PipeDevice.cpp 2007-06-24 22:53:21 UTC (rev 1002) @@ -219,18 +219,12 @@ #ifdef DEBUG_LOCKS LockGuard (int line, T &cs) : cs_(cs), lineno(line) { - WCHAR buf[100]; - wsprintf (buf, L"line : %d", line); - MessageBoxW(0, buf, L"lock", 0); - + LOG ("LockGuard: line : %d\n", line); cs_.Lock (); } ~LockGuard () { - WCHAR buf[100]; - wsprintf (buf, L"line : %d", lineno); - MessageBoxW(0, buf, L"unlock", 0); - + LOG ("~LockGuard: line : %d\n", lineno); cs_.Unlock (); } #else @@ -383,39 +377,59 @@ return TRUE; } +#ifdef DEBUG_MODE static void -LogMessage (const char* msg, ...) +LogMessage2 (const char* msg) { -#if 0 + FILE* log = fopen ("pipelog.txt", "a+"); + fprintf (log, "%s", msg); + fclose (log); +} + +static void +LogMessage (const char *file, int line, const char* msg, ...) +{ va_list ap; + char buf[1024]; + char *b = buf; va_start (ap, msg); - FILE* log = fopen ("log.txt", "a+"); - vfprintf (log, msg, ap); - fclose (log); + sprintf (b, "%08x: %s (%d): ", (unsigned) GetCurrentThreadId (), file, line); + b += strlen (b); + vsprintf (b, msg, ap); va_end (ap); -#else - (void)msg; -#endif + + LogMessage2 (buf); } struct LogScope { - explicit LogScope (const char* func) + explicit LogScope (const char *func, const char* msg) : func_(func) + , msg_(msg) { - LogMessage ("entering %s\n", func_); + char buf[512]; + sprintf (buf, "> %s", msg_); + LogMessage (func_, -1, buf); } ~LogScope () { - LogMessage ("leaving %s\n", func_); + char buf[512]; + sprintf (buf, "< %s", msg_); + LogMessage (func_, -1, buf); } const char* func_; + const char* msg_; }; -#define LOGSCOPE(MSG) LogScope scope ## __LINE__(#MSG) +# define LOG(MSG, ...) LogMessage (__FUNCTION__, __LINE__, MSG, ## __VA_ARGS__) +# define LOGSCOPE(MSG) LogScope scope ## __LINE__(__FUNCTION__, MSG) +#else +# define LOG(MSG, ...) do; while (0) +# define LOGSCOPE(MSG) do; while (0) +#endif -/* This is needed for MSVC. */ +/* This is needed for MSVC, but it makes no harm in gcc. */ struct ltwstr { bool operator () (const std::wstring& s1, const std::wstring& s2) const @@ -432,7 +446,7 @@ static HANDLE GetDeviceHandle (PipeDeviceContext* pDeviceContext) { - LOGSCOPE (GetDeviceHandle); + LOGSCOPE ("\n"); HKEY hActive; DWORD Type; HANDLE hDev = INVALID_HANDLE_VALUE; @@ -458,13 +472,11 @@ PIPEDEV_API DWORD Init (LPCTSTR pContext) { - LOGSCOPE ("Init"); + LOGSCOPE ("\n"); CSWrapper cs (&open_pipes_cs); LockGuard<CSWrapper> guard G(cs); -#ifdef DEBUG_MODE - MessageBoxW (0, pContext, L"Init", 0); -#endif + LOG ("%ls\n", pContext); /* TODO: The key here isn't exactly the best. Maybe we should use the device name instead, and get that from the registry - that would @@ -489,15 +501,14 @@ PIPEDEV_API BOOL Deinit (PipeDeviceContext* pDeviceContext) { - LOGSCOPE ("Deinit"); + LOGSCOPE ("\n"); /* All file handles must to be closed before deinitialising the driver. */ #ifdef DEBUG_MODE - WCHAR buf[100]; - wsprintf (buf, L"opencount %d : calls %d", pDeviceContext->OpenCount, - close_calls); - MessageBoxW (0, buf, L"Deinit", 0); + LOG ("oc %lu, wc: %lu, close_calls: %d\n", + dev->OpenCount, + dev->WROpenCount, close_calls); #endif if (pDeviceContext == NULL) @@ -510,9 +521,7 @@ return FALSE; } -#ifdef DEBUG_MODE - MessageBoxW (0, L"deactivate success", L"Deinit", 0); -#endif + LOG ("deactivate success\n"); /* Allow reuse. */ open_pipes.erase (pDeviceContext->ActivePath); @@ -527,105 +536,69 @@ PIPEDEV_API DWORD Open (PipeDeviceContext* pDeviceContext, DWORD AccessCode, DWORD ShareMode) { - LOGSCOPE ("Open"); + LOGSCOPE ("\n"); -#ifdef DEBUG_MODE - wchar_t buf[100]; - wsprintf (buf, L"opencount %d", pDeviceContext->OpenCount); - MessageBoxW (0, buf, L"open 1", 0); -#endif + LOG ("oc %lu, wc: %lu, AccessCode %x, ShareMode %x\n", + pDeviceContext->OpenCount, pDeviceContext->WROpenCount, + AccessCode, ShareMode); PipeOpenContext* pOpenContext = new PipeOpenContext (pDeviceContext, AccessCode, ShareMode); -#ifdef DEBUG_MODE - MessageBoxW (0, L"going to lock", L"open 2", 0); -#endif + LOG ("going to lock\n"); PipeDeviceContext::LockGuard guard G(*pOpenContext->DeviceContext); -#ifdef DEBUG_MODE - MessageBoxW (0, L"locked", L"open 3", 0); -#endif + LOG ("locked\n"); pDeviceContext->OpenCount++; if (AccessCode & GENERIC_WRITE) pDeviceContext->WROpenCount++; -#ifdef DEBUG_MODE - wsprintf (buf, L"opencount %d", pDeviceContext->OpenCount); - MessageBoxW (0, buf, L"open", 0); -#endif + LOG ("OpenCount: %lu, WROpenCount: %lu\n", + pDeviceContext->OpenCount, + pDeviceContext->WROpenCount); return (DWORD)pOpenContext; } -struct DeactivatorData -{ - HANDLE th; - HANDLE dev; -}; - static DWORD WINAPI -Deactivator (void* arg) +Deactivator (HANDLE dev) { - LOGSCOPE ("Deactivator"); + LOGSCOPE ("\n"); - DeactivatorData* data = (DeactivatorData*)arg; - -#ifdef DEBUG_MODE - wchar_t buf[100]; - wsprintf (buf, L"%x", data->dev); - MessageBoxW(0, buf, L"close: dev handle", 0); - if (!DeactivateDevice (data->dev)) - MessageBoxW(0, buf, L"deactivate failed", 0); + if (!DeactivateDevice (dev)) + LOG("deactivate failed\n"); else - MessageBoxW(0, buf, L"after deactivate", 0); -#else - DeactivateDevice (data->dev); -#endif + LOG("deactivate success\n"); - CloseHandle (data->th); - delete data; - return 0; } static void DeactivatePipeDevice (PipeDeviceContext* dev) { - LOGSCOPE ("DeactivatePipeDevice"); - + LOGSCOPE ("\n"); HANDLE hdev = GetDeviceHandle (dev); - DeactivatorData* data = new DeactivatorData (); - data->dev = hdev; - data->th = CreateThread (NULL, 0, Deactivator, data, - CREATE_SUSPENDED, NULL); - ResumeThread (data->th); + HANDLE h = CreateThread (NULL, 0, Deactivator, hdev, 0, NULL); + CloseHandle (h); } PIPEDEV_API BOOL Close (PipeOpenContext* pOpenContext) { - LOGSCOPE ("Close"); + LOGSCOPE ("\n"); #ifdef DEBUG_MODE close_calls++; +#endif - wchar_t buf[100]; if (pOpenContext) - { - wsprintf (buf, L"opencount %d : %p", - pOpenContext->DeviceContext->OpenCount, - pOpenContext); - MessageBoxW (0, buf, L"close", 0); - } + LOG ("oc %lu, wc: %lu\n", + pOpenContext->DeviceContext->OpenCount, + pOpenContext->DeviceContext->WROpenCount); else - { - wsprintf (buf, L"openctx %p", pOpenContext); - MessageBoxW (0, buf, L"close", 0); - } -#endif + LOG ("openctx %p\n", pOpenContext); if (pOpenContext == NULL) return FALSE; @@ -650,19 +623,15 @@ delete pOpenContext; -#ifdef DEBUG_MODE - wsprintf (buf, L"opencount %d", dev->OpenCount); - MessageBoxW (0, buf, L"close 2", 0); -#endif + LOG ("oc %lu, wc: %lu\n", + dev->OpenCount, dev->WROpenCount); if (dev->OpenCount == 0) { -#if 0 - HANDLE hdev = GetDeviceHandle (dev); - DeactivateDevice (hdev); -#else + /* Deactivating the device here seems to + corrupt the Device.exe, and sometimes hangs + the device. Do it in an auxilary thread. */ DeactivatePipeDevice (dev); -#endif } return TRUE; @@ -671,11 +640,12 @@ PIPEDEV_API DWORD Read (PipeOpenContext* pOpenContext, LPVOID pBuffer_, DWORD dwCount) { - LOGSCOPE ("Read"); + LOGSCOPE ("\n"); if (IsBadReadPtr (pBuffer_, dwCount)) { SetLastError (ERROR_INVALID_PARAMETER); + LOG ("\n"); return -1; } @@ -684,7 +654,10 @@ if (pOpenContext == NULL || (pOpenContext->dwAccessCode & GENERIC_READ) == 0) - return (DWORD)-1; + { + LOG ("Invalid access or no context\n"); + return (DWORD)-1; + } PipeDeviceContext* dev = pOpenContext->DeviceContext; @@ -699,18 +672,9 @@ Events[0] = dev->WriteEvent; Events[1] = dev->AbortEvent; - if (dev->Aborting) - /* this device is long gone */ - return (DWORD)-1; - - if (dev->WROpenCount == 0) - /* broken pipe */ - return (DWORD)-1; - - if (dev->OpenCount == 0) - /* weird */ - return (DWORD)-1; - + /* Read before checking for broken pipe, so + we get a chance to return valid data when that + happens. */ DWORD read = dev->readBytes (pBuffer, dwCount); pBuffer += read; dwCount -= read; @@ -718,53 +682,81 @@ if (read) SetEvent (dev->ReadEvent); - if (dwCount == 0) - break; + if (dev->Aborting /* this device is long gone, */ + || dev->WROpenCount == 0 /* or broken pipe */ + || dev->OpenCount == 0 /* or, ... weird */ + ) + { + SetLastError (ERROR_BROKEN_PIPE); + if (needed - dwCount) + { + /* I don't know a way to report error and 'valid + data' at the same time. Is there a way? Instead + we report 'valid' and the next Read call will error. */ + LOG ("Pipe broken, but with data\n"); + break; + } + LOG ("Pipe broken\n"); + return (DWORD) -1; + } + if (read || dwCount == 0) + { + /* We've either read something or pBuffer_ is full. */ + LOG ("read || dwCount == 0\n"); + break; + } + if (breaknext) break; } + /* The buffer was empty, wait for data. */ switch (WaitForMultipleObjects (2, Events, FALSE, INFINITE)) { case WAIT_OBJECT_0: + /* Data was written to the pipe. Do one more iteration + to fetch what we can and bail out. */ breaknext = TRUE; break; default: - // MessageBoxW (0, L"pipe aborted", L"Read", 0); /* With either wait error or AbortEvent signaled, return with error. */ - return (DWORD)-1; + LOG ("WaitForMultipleObjects default case\n"); + return (DWORD) -1; } } while (dwCount); + LOG ("Read: %u\n", needed - dwCount); return needed - dwCount; } PIPEDEV_API DWORD Write (PipeOpenContext* pOpenContext, LPCVOID pBuffer_, DWORD dwCount) { - LOGSCOPE ("Write"); + LOGSCOPE ("\n"); - if (IsBadReadPtr (pBuffer_, dwCount)) + if (IsBadWritePtr ((void*) pBuffer_, dwCount)) { SetLastError (ERROR_INVALID_PARAMETER); + LOG ("\n"); return -1; } const BYTE* pBuffer = (const BYTE*)pBuffer_; DWORD needed = dwCount; -#ifdef DEBUG_MODE - wchar_t buf[100]; - wsprintf (buf, L"opencount %d", pOpenContext->DeviceContext->OpenCount); - MessageBoxW (0, buf, L"write", 0); -#endif + LOG ("oc %lu, wc: %lu\n", + pOpenContext->DeviceContext->OpenCount, + pOpenContext->DeviceContext->WROpenCount); if (pOpenContext == NULL || (pOpenContext->dwAccessCode & GENERIC_WRITE) == 0) - return (DWORD)-1; + { + LOG ("Invalid access or no context\n"); + return (DWORD)-1; + } PipeDeviceContext* dev = pOpenContext->DeviceContext; @@ -776,24 +768,36 @@ { PipeDeviceContext::LockGuard guard G(*dev); -#ifdef DEBUG_MODE - MessageBoxW (0, L"lock acquired", L"write", 0); -#endif + LOG ("lock acquired\n"); Events[0] = dev->ReadEvent; Events[1] = dev->AbortEvent; if (dev->Aborting) - /* this device is long gone */ - return (DWORD)-1; + { + /* this device is long gone */ + SetLastError (ERROR_NO_DATA); + LOG ("Device is gone\n"); + return (DWORD)-1; + } if (dev->OpenCount == 0) - /* weird */ - return (DWORD)-1; + { + /* weird */ + SetLastError (ERROR_NO_DATA); + LOG ("Device is not open\n"); + return (DWORD)-1; + } - /* According to MSDN, attempting to read from a pipe without writers, - generates a broken pipe error, but the opposite isn't forbidden, so we - allow writing to a pipe without a reader. */ + if (dev->OpenCount == dev->WROpenCount) + { + /* no readers */ + SetLastError (ERROR_NO_DATA); + LOG ("No readers left: oc %lu, wc: %lu\n", + dev->OpenCount, + dev->WROpenCount); + return (DWORD)-1; + } DWORD wrote = dev->writeBytes (pBuffer, dwCount); pBuffer += wrote; @@ -816,21 +820,22 @@ breaknext = TRUE; break; default: - // MessageBoxW (0, L"pipe aborted", L"Write", 0); /* With either wait error or AbortEvent signaled, return with error. */ + LOG ("WaitForMultipleObjects default case\n"); return (DWORD) -1; } } while (dwCount); + LOG ("%u\n", needed - dwCount); return needed - dwCount; } PIPEDEV_API DWORD Seek (PipeOpenContext* /*pOpenContext*/, long /*Amount*/, WORD /*wType*/) { - LOGSCOPE ("Seek"); + LOGSCOPE ("\n"); /* Pipes don't support seeking. */ return (DWORD)-1; } @@ -840,7 +845,7 @@ PBYTE pBufIn, DWORD dwLenIn, PBYTE pBufOut, DWORD dwLenOut, PDWORD pdwActualOut) { - LOGSCOPE ("IOControl"); + LOGSCOPE ("\n"); /* Kill unused warnings. */ (void)pBufIn; @@ -858,9 +863,7 @@ PipeDeviceContext::LockGuard guard G(*dev); #ifdef DEBUG_MODE - wchar_t buf[100]; - wsprintf (buf, L"%x : %d", dwCode, dev->OpenCount); - MessageBoxW (0, buf, L"IOControl", 0); + LOG ("%x : %d\n", dwCode, dev->OpenCount); #endif if (dwCode == IOCTL_PSL_NOTIFY) @@ -870,11 +873,7 @@ if (pPslPacket->dwSize == sizeof (DEVICE_PSL_NOTIFY) && pPslPacket->dwFlags == DLL_PROCESS_EXITING) { -#ifdef DEBUG_MODE - WCHAR buf[100]; - wsprintf (buf, L"%p : %p", pPslPacket->hProc, pPslPacket->hThread); - MessageBoxW(0, buf, L"process dying", 0); -#endif + LOG ("Process dying: %p : %p\n", pPslPacket->hProc, pPslPacket->hThread); dev->Aborting = TRUE; /* Unlock all blocked threads. */ SetEvent (dev->AbortEvent); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ped...@us...> - 2007-06-24 22:26:08
|
Revision: 1001 http://svn.sourceforge.net/cegcc/?rev=1001&view=rev Author: pedroalves Date: 2007-06-24 15:26:06 -0700 (Sun, 24 Jun 2007) Log Message: ----------- * LICENSE, README, TODO: New files. Modified Paths: -------------- trunk/cegcc/tools/PipeLib/ChangeLog Added Paths: ----------- trunk/cegcc/tools/PipeLib/LICENSE trunk/cegcc/tools/PipeLib/README trunk/cegcc/tools/PipeLib/TODO Modified: trunk/cegcc/tools/PipeLib/ChangeLog =================================================================== --- trunk/cegcc/tools/PipeLib/ChangeLog 2007-06-24 22:25:10 UTC (rev 1000) +++ trunk/cegcc/tools/PipeLib/ChangeLog 2007-06-24 22:26:06 UTC (rev 1001) @@ -1,3 +1,7 @@ +2007-06-24 Pedro Alves <ped...@po...> + + * LICENSE, README, TODO: New files. + 2007-06-09 Pedro Alves <ped...@po...> Initial import. Added: trunk/cegcc/tools/PipeLib/LICENSE =================================================================== --- trunk/cegcc/tools/PipeLib/LICENSE (rev 0) +++ trunk/cegcc/tools/PipeLib/LICENSE 2007-06-24 22:26:06 UTC (rev 1001) @@ -0,0 +1,25 @@ +/* Copyright (c) 2007, Pedro Alves + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ Added: trunk/cegcc/tools/PipeLib/README =================================================================== --- trunk/cegcc/tools/PipeLib/README (rev 0) +++ trunk/cegcc/tools/PipeLib/README 2007-06-24 22:26:06 UTC (rev 1001) @@ -0,0 +1,45 @@ + README for PipeLib + +This directory contains the PipeLib enhancer for Windows CE. + +PipeLib implements a stream driver that is exposed in an interface +similar to unnamed pipes on desktop Windows. Namelly, pipes are +created with CreatePipe and the pipe ends are manipulated with the normal +ReadFileW/WriteFileW/CloseHandle coredll.dll functions. + +To build the lib and the driver you will need the arm-wince-mingw32ce +toolchain. An early version of PipeLib was also tested with MSVC2005, +but project files aren't presently included. + +To build, ensure you have arm-wince-mingw32ce-gcc in your $PATH, and +type: + +make + +If you have synce-tools installed, type: + +make download + +The previous command will copy the driver (PipeDev.dll) to \Windows on +the device. + +If you don't have synce-tools installed, then copy the newly built +PipeDev.dll file into the \Windows on the device. + +PipeLib comes with a sample tester, but the main testbed client is +currently the rshd server for Windows CE found at +http://cegcc.sourceforge.net. Both PipeLib and rshd share the same +repository, so be sure you have a checkout from the same date before +reporting bugs. + +Have fun! + +Pedro Alves + +-- + +See the file LICENSE in the various directories, for a description of +the license the software is license in. + +REPORTING BUGS: ceg...@so... +pe...@po... Property changes on: trunk/cegcc/tools/PipeLib/README ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/cegcc/tools/PipeLib/TODO =================================================================== --- trunk/cegcc/tools/PipeLib/TODO (rev 0) +++ trunk/cegcc/tools/PipeLib/TODO 2007-06-24 22:26:06 UTC (rev 1001) @@ -0,0 +1,4 @@ +- Add SetLastError in all the error code paths. + +- Add to libPipeLib.a some more pipe related calls, following the + interface exposed on desktop Windows. To be added on a need basis. Property changes on: trunk/cegcc/tools/PipeLib/TODO ___________________________________________________________________ Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ped...@us...> - 2007-06-24 22:25:13
|
Revision: 1000 http://svn.sourceforge.net/cegcc/?rev=1000&view=rev Author: pedroalves Date: 2007-06-24 15:25:10 -0700 (Sun, 24 Jun 2007) Log Message: ----------- ChangeLog is a file too. Modified Paths: -------------- trunk/cegcc/tools/PipeLib/ChangeLog Modified: trunk/cegcc/tools/PipeLib/ChangeLog =================================================================== --- trunk/cegcc/tools/PipeLib/ChangeLog 2007-06-24 22:23:12 UTC (rev 999) +++ trunk/cegcc/tools/PipeLib/ChangeLog 2007-06-24 22:25:10 UTC (rev 1000) @@ -2,10 +2,10 @@ Initial import. - * PipeLib/Makefile, PipeLib/PipeLib.cpp, PipeLib/PipeLib.h, - PipeDev/Makefile, PipeDev/PipeDevice.cpp, PipeDev/PipeDevice.h, - PipeTest/Makefile, PipeTest/PipeTest.cpp, TestClient/Makefile, - TestClient/TestClient.cpp: New files. + * ChangeLog, PipeLib/Makefile, PipeLib/PipeLib.cpp, + PipeLib/PipeLib.h, PipeDev/Makefile, PipeDev/PipeDevice.cpp, + PipeDev/PipeDevice.h, PipeTest/Makefile, PipeTest/PipeTest.cpp, + TestClient/Makefile, TestClient/TestClient.cpp: New files. Local Variables: mode: change-log This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ped...@us...> - 2007-06-24 22:23:14
|
Revision: 999 http://svn.sourceforge.net/cegcc/?rev=999&view=rev Author: pedroalves Date: 2007-06-24 15:23:12 -0700 (Sun, 24 Jun 2007) Log Message: ----------- Adding emacs modelines. Modified Paths: -------------- trunk/cegcc/tools/PipeLib/ChangeLog Modified: trunk/cegcc/tools/PipeLib/ChangeLog =================================================================== --- trunk/cegcc/tools/PipeLib/ChangeLog 2007-06-24 22:21:21 UTC (rev 998) +++ trunk/cegcc/tools/PipeLib/ChangeLog 2007-06-24 22:23:12 UTC (rev 999) @@ -6,3 +6,10 @@ PipeDev/Makefile, PipeDev/PipeDevice.cpp, PipeDev/PipeDevice.h, PipeTest/Makefile, PipeTest/PipeTest.cpp, TestClient/Makefile, TestClient/TestClient.cpp: New files. + +Local Variables: +mode: change-log +left-margin: 8 +fill-column: 74 +version-control: never +End: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ped...@us...> - 2007-06-24 22:21:22
|
Revision: 998 http://svn.sourceforge.net/cegcc/?rev=998&view=rev Author: pedroalves Date: 2007-06-24 15:21:21 -0700 (Sun, 24 Jun 2007) Log Message: ----------- Adding missing ChangeLog. Initial import. * PipeLib/Makefile, PipeLib/PipeLib.cpp, PipeLib/PipeLib.h, PipeDev/Makefile, PipeDev/PipeDevice.cpp, PipeDev/PipeDevice.h, PipeTest/Makefile, PipeTest/PipeTest.cpp, TestClient/Makefile, TestClient/TestClient.cpp: New files. Added Paths: ----------- trunk/cegcc/tools/PipeLib/ChangeLog Added: trunk/cegcc/tools/PipeLib/ChangeLog =================================================================== --- trunk/cegcc/tools/PipeLib/ChangeLog (rev 0) +++ trunk/cegcc/tools/PipeLib/ChangeLog 2007-06-24 22:21:21 UTC (rev 998) @@ -0,0 +1,8 @@ +2007-06-09 Pedro Alves <ped...@po...> + + Initial import. + + * PipeLib/Makefile, PipeLib/PipeLib.cpp, PipeLib/PipeLib.h, + PipeDev/Makefile, PipeDev/PipeDevice.cpp, PipeDev/PipeDevice.h, + PipeTest/Makefile, PipeTest/PipeTest.cpp, TestClient/Makefile, + TestClient/TestClient.cpp: New files. Property changes on: trunk/cegcc/tools/PipeLib/ChangeLog ___________________________________________________________________ Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ped...@us...> - 2007-06-24 21:49:21
|
Revision: 997 http://svn.sourceforge.net/cegcc/?rev=997&view=rev Author: pedroalves Date: 2007-06-24 14:49:20 -0700 (Sun, 24 Jun 2007) Log Message: ----------- * mingwex/Makefile.in (WINCE_OBJS): Add chsize.o, findfile.o, bsearch.o, access.o, mkdir.o and rmdir.o. (LIBOBJS): Also add $(POSIX_OBJS) for wince. Modified Paths: -------------- trunk/cegcc/src/mingw/ChangeLog.mingw32ce trunk/cegcc/src/mingw/mingwex/Makefile.in Modified: trunk/cegcc/src/mingw/ChangeLog.mingw32ce =================================================================== --- trunk/cegcc/src/mingw/ChangeLog.mingw32ce 2007-06-24 21:45:45 UTC (rev 996) +++ trunk/cegcc/src/mingw/ChangeLog.mingw32ce 2007-06-24 21:49:20 UTC (rev 997) @@ -1,5 +1,11 @@ 2007-06-24 Pedro Alves <ped...@po...> + * mingwex/Makefile.in (WINCE_OBJS): Add chsize.o, findfile.o, + bsearch.o, access.o, mkdir.o and rmdir.o. + (LIBOBJS): Also add $(POSIX_OBJS) for wince. + +2007-06-24 Pedro Alves <ped...@po...> + * winmain_ce.c (_argc, _argv): Rename to ... (__argc, __argv): ... this. (main): Declare. Modified: trunk/cegcc/src/mingw/mingwex/Makefile.in =================================================================== --- trunk/cegcc/src/mingw/mingwex/Makefile.in 2007-06-24 21:45:45 UTC (rev 996) +++ trunk/cegcc/src/mingw/mingwex/Makefile.in 2007-06-24 21:49:20 UTC (rev 997) @@ -217,7 +217,7 @@ close.o isalnum.o isalpha.o iscntrl.o isgraph.o islower.o isprint.o \ ispunct.o isspace.o isupper.o isxdigit.o _tolower.o _toupper.o \ mb_cur_max.o rename.o stat.o chmod.o utime.o futime.o timeutil.o \ - ctime.o + ctime.o chsize.o findfile.o bsearch.o access.o mkdir.o rmdir.o MATHCE_OBJS = \ e_acosf.o e_acosh.o e_acoshf.o e_asinf.o e_atan2f.o e_atanh.o e_coshf.o \ e_expf.o e_gamma_r.o e_gammaf_r.o e_lgamma_r.o e_lgammaf_r.o e_log10f.o \ @@ -241,7 +241,8 @@ MATHCE_FLAGS= ifneq (,$(findstring wince,$(target_alias))) -LIB_OBJS = $(WINCE_OBJS) $(MATHCE_OBJS) $(Q8_OBJS) $(STDIO_OBJS_CE) +LIB_OBJS = $(WINCE_OBJS) $(MATHCE_OBJS) $(Q8_OBJS) $(STDIO_OBJS_CE) \ + $(POSIX_OBJS) MATHCE_FLAGS=-D_IEEE_LIBM MATHDIR=mathce else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ped...@us...> - 2007-06-24 21:45:46
|
Revision: 996 http://svn.sourceforge.net/cegcc/?rev=996&view=rev Author: pedroalves Date: 2007-06-24 14:45:45 -0700 (Sun, 24 Jun 2007) Log Message: ----------- Fix typo. Modified Paths: -------------- trunk/cegcc/src/mingw/ChangeLog.mingw32ce Modified: trunk/cegcc/src/mingw/ChangeLog.mingw32ce =================================================================== --- trunk/cegcc/src/mingw/ChangeLog.mingw32ce 2007-06-24 21:45:10 UTC (rev 995) +++ trunk/cegcc/src/mingw/ChangeLog.mingw32ce 2007-06-24 21:45:45 UTC (rev 996) @@ -4,7 +4,7 @@ (__argc, __argv): ... this. (main): Declare. (WinMain): Convert C++ comments into C style comments. - Use __argc and __argv instead of _argc nad _argv. Pass NULL as third + Use __argc and __argv instead of _argc and _argv. Pass NULL as third parameter to main. 2007-06-24 Pedro Alves <ped...@po...> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ped...@us...> - 2007-06-24 21:45:16
|
Revision: 995 http://svn.sourceforge.net/cegcc/?rev=995&view=rev Author: pedroalves Date: 2007-06-24 14:45:10 -0700 (Sun, 24 Jun 2007) Log Message: ----------- * winmain_ce.c (_argc, _argv): Rename to ... (__argc, __argv): ... this. (main): Declare. (WinMain): Convert C++ comments into C style comments. Use __argc and __argv instead of _argc nad _argv. Pass NULL as third parameter to main. Modified Paths: -------------- trunk/cegcc/src/mingw/ChangeLog.mingw32ce trunk/cegcc/src/mingw/winmain_ce.c Modified: trunk/cegcc/src/mingw/ChangeLog.mingw32ce =================================================================== --- trunk/cegcc/src/mingw/ChangeLog.mingw32ce 2007-06-24 21:41:02 UTC (rev 994) +++ trunk/cegcc/src/mingw/ChangeLog.mingw32ce 2007-06-24 21:45:10 UTC (rev 995) @@ -1,5 +1,14 @@ 2007-06-24 Pedro Alves <ped...@po...> + * winmain_ce.c (_argc, _argv): Rename to ... + (__argc, __argv): ... this. + (main): Declare. + (WinMain): Convert C++ comments into C style comments. + Use __argc and __argv instead of _argc nad _argv. Pass NULL as third + parameter to main. + +2007-06-24 Pedro Alves <ped...@po...> + * include/getopt.h [__COREDLL__]: Expose contents. * include/io.h (_finddata_t, _wfinddata_t, _findfirst, _findnext) (_findclose, _rmdir, _mkdir, _chmod, chdir, getcwd, mkdir, mktemp) Modified: trunk/cegcc/src/mingw/winmain_ce.c =================================================================== --- trunk/cegcc/src/mingw/winmain_ce.c 2007-06-24 21:41:02 UTC (rev 994) +++ trunk/cegcc/src/mingw/winmain_ce.c 2007-06-24 21:45:10 UTC (rev 995) @@ -18,9 +18,11 @@ * Access to a standard 'main'-like argument count and list. Also included * is a table of environment variables. */ -int _argc = 0; -char **_argv = 0; +int __argc = 0; +char **__argv = 0; +extern int main (int, char **, char **); + static int _parse_tokens(char* string, char*** tokens, int length) { @@ -131,17 +133,20 @@ return; } -// Normally, the application will define a WinMain function. However, -// if the main application does not, this dummy WinMain will call a -// main() function instead. -extern int __cdecl -WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, - LPWSTR szCmdLine, int nShow) +/* Normally, the application will define a WinMain function. However, + * if the main application does not, this dummy WinMain will call a + * main() function instead. + */ +int +WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, + LPWSTR szCmdLine, int nShow) { /* * Set up __argc, __argv. */ - __mainArgs(&_argc, &_argv, szCmdLine); + __mainArgs(&__argc, &__argv, szCmdLine); - return main(_argc, _argv); + /* Pass in a NULL environ for those apps that expect it. Better + than stack garbage. */ + return main(__argc, __argv, NULL); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ped...@us...> - 2007-06-24 21:41:10
|
Revision: 994 http://svn.sourceforge.net/cegcc/?rev=994&view=rev Author: pedroalves Date: 2007-06-24 14:41:02 -0700 (Sun, 24 Jun 2007) Log Message: ----------- * include/getopt.h [__COREDLL__]: Expose contents. * include/io.h (_finddata_t, _wfinddata_t, _findfirst, _findnext) (_findclose, _rmdir, _mkdir, _chmod, chdir, getcwd, mkdir, mktemp) (rmdir, chmod, _wfindfirst, _wfindnext, access, chsize, isatty) [__COREDLL__]: Expose. * include/stdlib.h (__argc, __argv) [__COREDLL__]: Declare. (bsearch) [__COREDLL__]: Expose. * include/dirent.h [__COREDLL__]: Expose contents. * include/wchar.h (_wfindfirst, _wfindnext) [__COREDLL__]: Expose. * include/search.h (bsearch) [__COREDLL__]: Expose. * include/unistd.h (ftruncate) [__COREDLL__]: Expose. Modified Paths: -------------- trunk/cegcc/src/mingw/ChangeLog.mingw32ce trunk/cegcc/src/mingw/include/dirent.h trunk/cegcc/src/mingw/include/getopt.h trunk/cegcc/src/mingw/include/io.h trunk/cegcc/src/mingw/include/search.h trunk/cegcc/src/mingw/include/stdlib.h trunk/cegcc/src/mingw/include/unistd.h trunk/cegcc/src/mingw/include/wchar.h Modified: trunk/cegcc/src/mingw/ChangeLog.mingw32ce =================================================================== --- trunk/cegcc/src/mingw/ChangeLog.mingw32ce 2007-06-24 21:30:34 UTC (rev 993) +++ trunk/cegcc/src/mingw/ChangeLog.mingw32ce 2007-06-24 21:41:02 UTC (rev 994) @@ -1,5 +1,19 @@ 2007-06-24 Pedro Alves <ped...@po...> + * include/getopt.h [__COREDLL__]: Expose contents. + * include/io.h (_finddata_t, _wfinddata_t, _findfirst, _findnext) + (_findclose, _rmdir, _mkdir, _chmod, chdir, getcwd, mkdir, mktemp) + (rmdir, chmod, _wfindfirst, _wfindnext, access, chsize, isatty) + [__COREDLL__]: Expose. + * include/stdlib.h (__argc, __argv) [__COREDLL__]: Declare. + (bsearch) [__COREDLL__]: Expose. + * include/dirent.h [__COREDLL__]: Expose contents. + * include/wchar.h (_wfindfirst, _wfindnext) [__COREDLL__]: Expose. + * include/search.h (bsearch) [__COREDLL__]: Expose. + * include/unistd.h (ftruncate) [__COREDLL__]: Expose. + +2007-06-24 Pedro Alves <ped...@po...> + * mingwex/dirname.c (dirname) [__COREDLL__]: Don't handle drive names. * mingwex/basename.c (basename) [__COREDLL__]: Likewise. * mingwex/wdirent.c (UNICODE_DIRENT): New define. Modified: trunk/cegcc/src/mingw/include/dirent.h =================================================================== --- trunk/cegcc/src/mingw/include/dirent.h 2007-06-24 21:30:34 UTC (rev 993) +++ trunk/cegcc/src/mingw/include/dirent.h 2007-06-24 21:41:02 UTC (rev 994) @@ -19,8 +19,6 @@ extern "C" { #endif -#ifndef __COREDLL__ - struct dirent { long d_ino; /* Always zero. */ @@ -115,8 +113,6 @@ long __cdecl _wtelldir (_WDIR*); void __cdecl _wseekdir (_WDIR*, long); -#endif /* Not __COREDLL__ */ - #ifdef __cplusplus } #endif Modified: trunk/cegcc/src/mingw/include/getopt.h =================================================================== --- trunk/cegcc/src/mingw/include/getopt.h 2007-06-24 21:30:34 UTC (rev 993) +++ trunk/cegcc/src/mingw/include/getopt.h 2007-06-24 21:41:02 UTC (rev 994) @@ -34,8 +34,6 @@ #ifndef __GETOPT_H__ #define __GETOPT_H__ -#ifndef __COREDLL__ - #ifdef __cplusplus extern "C" { #endif @@ -83,7 +81,5 @@ } #endif -#endif /* __COREDLL__ */ - #endif /* __GETOPT_LONG_H__ */ #endif /* __UNISTD_GETOPT__ */ Modified: trunk/cegcc/src/mingw/include/io.h =================================================================== --- trunk/cegcc/src/mingw/include/io.h 2007-06-24 21:30:34 UTC (rev 993) +++ trunk/cegcc/src/mingw/include/io.h 2007-06-24 21:41:02 UTC (rev 994) @@ -20,8 +20,6 @@ #include <sys/types.h> /* To get time_t. */ #include <stdint.h> /* For intptr_t. */ -#ifndef __COREDLL__ - /* * Attributes of files as returned by _findfirst et al. */ @@ -64,6 +62,8 @@ char name[FILENAME_MAX]; /* may include spaces. */ }; +#ifndef __COREDLL__ + struct _finddatai64_t { unsigned attrib; time_t time_create; @@ -82,6 +82,8 @@ char name[FILENAME_MAX]; }; +#endif + #ifndef _WFINDDATA_T_DEFINED struct _wfinddata_t { unsigned attrib; @@ -92,6 +94,8 @@ wchar_t name[FILENAME_MAX]; /* may include spaces. */ }; +#ifndef __COREDLL__ + struct _wfinddatai64_t { unsigned attrib; time_t time_create; @@ -110,10 +114,11 @@ wchar_t name[FILENAME_MAX]; }; +#endif /* __COREDLL__ */ + #define _WFINDDATA_T_DEFINED #endif -#endif /* __COREDLL__ */ #ifdef __cplusplus extern "C" { @@ -127,8 +132,6 @@ */ /* FIXME: Should these all use intptr_t, as per recent MSDN docs? */ -#ifndef __COREDLL__ - _CRTIMP long __cdecl _findfirst (const char*, struct _finddata_t*); _CRTIMP int __cdecl _findnext (long, struct _finddata_t*); _CRTIMP int __cdecl _findclose (long); @@ -140,8 +143,6 @@ _CRTIMP int __cdecl _rmdir (const char*); _CRTIMP int __cdecl _chmod (const char*, int); -#endif /* __COREDLL__ */ - #ifdef __MSVCRT__ _CRTIMP __int64 __cdecl _filelengthi64(int); _CRTIMP long __cdecl _findfirsti64(const char*, struct _finddatai64_t*); @@ -165,14 +166,14 @@ #ifndef _NO_OLDNAMES -#if !defined (_UWIN) && !defined (__COREDLL__) +#if !defined (_UWIN) _CRTIMP int __cdecl chdir (const char*); _CRTIMP char* __cdecl getcwd (char*, int); _CRTIMP int __cdecl mkdir (const char*); _CRTIMP char* __cdecl mktemp (char*); _CRTIMP int __cdecl rmdir (const char*); _CRTIMP int __cdecl chmod (const char*, int); -#endif /* _UWIN && __COREDLL__ */ +#endif /* _UWIN */ #endif /* Not _NO_OLDNAMES */ @@ -201,12 +202,9 @@ extern "C" { #endif -#ifndef __COREDLL__ _CRTIMP int __cdecl _access (const char*, int); _CRTIMP int __cdecl _chsize (int, long); -#endif /* __COREDLL__ */ _CRTIMP int __cdecl _close (int); -#ifndef __COREDLL__ _CRTIMP int __cdecl _commit(int); /* NOTE: The only significant bit in unPermissions appears to be bit 7 (0x80), @@ -230,7 +228,6 @@ /* LK_... locking commands defined in sys/locking.h. */ _CRTIMP int __cdecl _locking (int, int, long); -#endif /* __COREDLL__ */ _CRTIMP long __cdecl _lseek (int, long, int); @@ -268,8 +265,12 @@ _CRTIMP int __cdecl _waccess(const wchar_t*, int); _CRTIMP int __cdecl _wchmod(const wchar_t*, int); _CRTIMP int __cdecl _wcreat(const wchar_t*, int); +#endif +#if defined (__MSVCRT__) || defined (__COREDLL__) _CRTIMP long __cdecl _wfindfirst(const wchar_t*, struct _wfinddata_t*); _CRTIMP int __cdecl _wfindnext(long, struct _wfinddata_t *); +#endif +#if defined (__MSVCRT__) _CRTIMP int __cdecl _wunlink(const wchar_t*); _CRTIMP int __cdecl _wopen(const wchar_t*, int, ...); _CRTIMP int __cdecl _wsopen(const wchar_t*, int, int, ...); @@ -291,10 +292,8 @@ */ #ifndef _UWIN -#ifndef __COREDLL__ _CRTIMP int __cdecl access (const char*, int); _CRTIMP int __cdecl chsize (int, long ); -#endif /* __COREDLL__ */ _CRTIMP int __cdecl close (int); #ifndef __COREDLL__ _CRTIMP int __cdecl creat (const char*, int); @@ -302,8 +301,8 @@ _CRTIMP int __cdecl dup2 (int, int); _CRTIMP int __cdecl eof (int); _CRTIMP long __cdecl filelength (int); -_CRTIMP int __cdecl isatty (int); #endif /* __COREDLL__ */ +_CRTIMP int __cdecl isatty (int); _CRTIMP long __cdecl lseek (int, long, int); _CRTIMP int __cdecl open (const char*, int, ...); _CRTIMP int __cdecl read (int, void*, unsigned int); Modified: trunk/cegcc/src/mingw/include/search.h =================================================================== --- trunk/cegcc/src/mingw/include/search.h 2007-06-24 21:30:34 UTC (rev 993) +++ trunk/cegcc/src/mingw/include/search.h 2007-06-24 21:41:02 UTC (rev 994) @@ -40,10 +40,10 @@ _CRTIMP void __cdecl qsort (void*, size_t, size_t, int (*)(const void*, const void*)); -#ifndef __COREDLL__ /* bsearch and qsort are also declared in stdlib.h */ _CRTIMP void* __cdecl bsearch (const void*, const void*, size_t, size_t, int (*)(const void*, const void*)); +#ifndef __COREDLL__ _CRTIMP void* __cdecl _lfind (const void*, const void*, unsigned int*, unsigned int, int (*)(const void*, const void*)); _CRTIMP void* __cdecl _lsearch (const void*, void*, unsigned int*, unsigned int, Modified: trunk/cegcc/src/mingw/include/stdlib.h =================================================================== --- trunk/cegcc/src/mingw/include/stdlib.h 2007-06-24 21:30:34 UTC (rev 993) +++ trunk/cegcc/src/mingw/include/stdlib.h 2007-06-24 21:41:02 UTC (rev 994) @@ -109,7 +109,12 @@ #endif /* __DECLSPEC_SUPPORTED */ -#endif /* __MSVCRT, __CRTDLL__ */ +#elif defined (__COREDLL__) + +extern int __argc; +extern char** __argv; + +#endif /* __MSVCRT, __CRTDLL__, __COREDLL__ */ #endif /* __STRICT_ANSI__ */ /* * Also defined in ctype.h. @@ -381,10 +386,8 @@ #endif /* bsearch and qsort are also in non-ANSI header search.h */ -#ifndef __COREDLL__ _CRTIMP void* __cdecl bsearch (const void*, const void*, size_t, size_t, int (*)(const void*, const void*)); -#endif _CRTIMP void __cdecl qsort (void*, size_t, size_t, int (*)(const void*, const void*)); Modified: trunk/cegcc/src/mingw/include/unistd.h =================================================================== --- trunk/cegcc/src/mingw/include/unistd.h 2007-06-24 21:30:34 UTC (rev 993) +++ trunk/cegcc/src/mingw/include/unistd.h 2007-06-24 21:41:02 UTC (rev 994) @@ -31,7 +31,6 @@ extern "C" { #endif -#ifndef __COREDLL__ /* This is defined as a real library function to allow autoconf to verify its existence. */ int ftruncate(int, off_t); @@ -39,7 +38,6 @@ { return _chsize (__fd, __length); } -#endif #ifdef __cplusplus } Modified: trunk/cegcc/src/mingw/include/wchar.h =================================================================== --- trunk/cegcc/src/mingw/include/wchar.h 2007-06-24 21:30:34 UTC (rev 993) +++ trunk/cegcc/src/mingw/include/wchar.h 2007-06-24 21:41:02 UTC (rev 994) @@ -361,8 +361,12 @@ _CRTIMP int __cdecl _waccess (const wchar_t*, int); _CRTIMP int __cdecl _wchmod (const wchar_t*, int); _CRTIMP int __cdecl _wcreat (const wchar_t*, int); +#endif +#if defined (__MSVCRT__) || defined (__COREDLL__) _CRTIMP long __cdecl _wfindfirst (const wchar_t*, struct _wfinddata_t *); _CRTIMP int __cdecl _wfindnext (long, struct _wfinddata_t *); +#endif +#if defined (__MSVCRT__) _CRTIMP int __cdecl _wunlink (const wchar_t*); _CRTIMP int __cdecl _wopen (const wchar_t*, int, ...); _CRTIMP int __cdecl _wsopen (const wchar_t*, int, int, ...); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ped...@us...> - 2007-06-24 21:30:38
|
Revision: 993 http://svn.sourceforge.net/cegcc/?rev=993&view=rev Author: pedroalves Date: 2007-06-24 14:30:34 -0700 (Sun, 24 Jun 2007) Log Message: ----------- * mingwex/dirname.c (dirname) [__COREDLL__]: Don't handle drive names. * mingwex/basename.c (basename) [__COREDLL__]: Likewise. * mingwex/wdirent.c (UNICODE_DIRENT): New define. * mingwex/dirent.c [__COREDLL__]: Don't include errno.h or direct.h. (__set_errno): New. (ENOTDIR, EFAULT, EINVAL): Define. (_TDIR, _TCHAR, _T, _topendir, _treaddir, _tclosedir, _trewinddir, _ttelldir, tseekdir, _tfindfirst, _tfindnext, _tcscat, _tcsncpy, _tcslen, _tcscpy, _tcsrchr, _tdirent) [!UNICODE_DIRENT]: Redefine to the non-wide counterparts. (_tGetFileAttributes) [__COREDLL__]: Reimplement for Windows CE. (_topendir): Use __set_errno. Avoid _tfullpath. (_treaddir, _closedir, _trewinddir, _ttelldir, _tseekdir): Use __set_errno. * mingwex/wcstold.c: Don't compile on WinCE. * mingwex/getopt.c [__COREDLL__]: Don't include errno.h. (IS_POSIXLY_CORRECT) [__MINGW32CE__]: Hardcode to 0. * mingwex/gettimeofday.c (gettimeofday) [__COREDLL__]: Replace the GetSystemTimeAsFileTime call with GetSystemTime and SystemTimeToFileTime. Modified Paths: -------------- trunk/cegcc/src/mingw/ChangeLog.mingw32ce trunk/cegcc/src/mingw/mingwex/basename.c trunk/cegcc/src/mingw/mingwex/dirent.c trunk/cegcc/src/mingw/mingwex/dirname.c trunk/cegcc/src/mingw/mingwex/getopt.c trunk/cegcc/src/mingw/mingwex/gettimeofday.c trunk/cegcc/src/mingw/mingwex/wcstold.c trunk/cegcc/src/mingw/mingwex/wdirent.c Modified: trunk/cegcc/src/mingw/ChangeLog.mingw32ce =================================================================== --- trunk/cegcc/src/mingw/ChangeLog.mingw32ce 2007-06-24 19:42:31 UTC (rev 992) +++ trunk/cegcc/src/mingw/ChangeLog.mingw32ce 2007-06-24 21:30:34 UTC (rev 993) @@ -1,5 +1,28 @@ 2007-06-24 Pedro Alves <ped...@po...> + * mingwex/dirname.c (dirname) [__COREDLL__]: Don't handle drive names. + * mingwex/basename.c (basename) [__COREDLL__]: Likewise. + * mingwex/wdirent.c (UNICODE_DIRENT): New define. + * mingwex/dirent.c [__COREDLL__]: Don't include errno.h or direct.h. + (__set_errno): New. + (ENOTDIR, EFAULT, EINVAL): Define. + (_TDIR, _TCHAR, _T, _topendir, _treaddir, _tclosedir, _trewinddir, + _ttelldir, tseekdir, _tfindfirst, _tfindnext, _tcscat, _tcsncpy, + _tcslen, _tcscpy, _tcsrchr, _tdirent) [!UNICODE_DIRENT]: Redefine to + the non-wide counterparts. + (_tGetFileAttributes) [__COREDLL__]: Reimplement for Windows CE. + (_topendir): Use __set_errno. Avoid _tfullpath. + (_treaddir, _closedir, _trewinddir, _ttelldir, _tseekdir): Use + __set_errno. + * mingwex/wcstold.c: Don't compile on WinCE. + * mingwex/getopt.c [__COREDLL__]: Don't include errno.h. + (IS_POSIXLY_CORRECT) [__MINGW32CE__]: Hardcode to 0. + * mingwex/gettimeofday.c (gettimeofday) [__COREDLL__]: Replace + the GetSystemTimeAsFileTime call with GetSystemTime and + SystemTimeToFileTime. + +2007-06-24 Pedro Alves <ped...@po...> + * mingwex/wince/findfile.c: New file. * mingwex/wince/chsize.c: New file. * mingwex/wince/access.c: New file. Modified: trunk/cegcc/src/mingw/mingwex/basename.c =================================================================== --- trunk/cegcc/src/mingw/mingwex/basename.c 2007-06-24 19:42:31 UTC (rev 992) +++ trunk/cegcc/src/mingw/mingwex/basename.c 2007-06-24 21:30:34 UTC (rev 993) @@ -37,9 +37,10 @@ /* step over the drive designator, if present ... * (FIXME: maybe should confirm *path is a valid drive designator). */ - +#ifndef __COREDLL__ if( path[1] == ':' ) path += 2; +#endif /* check again, just to ensure we still have a non-empty path name ... */ Modified: trunk/cegcc/src/mingw/mingwex/dirent.c =================================================================== --- trunk/cegcc/src/mingw/mingwex/dirent.c 2007-06-24 19:42:31 UTC (rev 992) +++ trunk/cegcc/src/mingw/mingwex/dirent.c 2007-06-24 21:30:34 UTC (rev 993) @@ -4,35 +4,106 @@ * This file is a part of the mingw-runtime package. * No warranty is given; refer to the file DISCLAIMER within the package. * - * Derived from DIRLIB.C by Matt J. Weinstein + * Derived from DIRLIB.C by Matt J. Weinstein * This note appears in the DIRLIB.H * DIRLIB.H by M. J. Weinstein Released to public domain 1-Jan-89 * * Updated by Jeremy Bettis <je...@hk...> * Significantly revised and rewinddir, seekdir and telldir added by Colin * Peters <co...@fu...> - * + * */ #include <stdlib.h> +#ifndef __COREDLL__ #include <errno.h> +#endif #include <string.h> #include <io.h> +#ifndef __COREDLL__ #include <direct.h> +#endif #include <dirent.h> #define WIN32_LEAN_AND_MEAN #include <windows.h> /* for GetFileAttributes */ #include <tchar.h> + #define SUFFIX _T("*") #define SLASH _T("\\") +#ifdef __COREDLL__ +/* Pretty safe in this file, since we are only setting errno, and never + reading it. */ +#define __set_errno(ERR) SetLastError (ERR) + +#define ENOTDIR ERROR_DIRECTORY +#define EFAULT ERROR_INVALID_ADDRESS +#define EINVAL ERROR_INVALID_PARAMETER + +#ifndef UNICODE_DIRENT + +/* Windows CE is always UNICODE - work around it. */ +#undef _TDIR +#undef _TCHAR + +#undef _T + +#undef _topendir +#undef _treaddir +#undef _tclosedir +#undef _trewinddir +#undef _ttelldir +#undef _tseekdir + +#undef _tfindfirst +#undef _tfindnext + +#undef _tcscat +#undef _tcsncpy +#undef _tcslen +#undef _tcscpy +#undef _tcsrchr + +#undef _tdirent + +#define _TDIR DIR +#define _TCHAR CHAR + +#define _T(S) S + +#define _topendir opendir +#define _treaddir readdir +#define _tclosedir closedir +#define _trewinddir rewinddir +#define _ttelldir telldir +#define _tseekdir seekdir + +#define _tfindfirst _findfirst +#define _tfindnext _findnext + +#define _tcscat strcat +#define _tcsncpy strncpy +#define _tcslen strlen +#define _tcscpy strcpy +#define _tcsrchr strrchr + +#define _tdirent dirent + +#endif + +#else +#define __set_errno(ERR) do { errno = (ERR); } while (0) +#endif + +#if !defined (__COREDLL__) + /* Helper for opendir(). */ static inline unsigned _tGetFileAttributes (const _TCHAR * tPath) { -#ifdef _UNICODE +#ifdef (_UNICODE) /* GetFileAttributesW does not work on W9x, so convert to ANSI */ if (_osver & 0x8000) { @@ -42,35 +113,51 @@ return GetFileAttributesA (aPath); } return GetFileAttributesW (tPath); -#else +#else /* _UNICODE */ return GetFileAttributesA (tPath); #endif } +#else /* __COREDLL__ */ + +/* Helper for opendir(). */ +static inline unsigned _tGetFileAttributes (const _TCHAR * tPath) +{ +#ifdef UNICODE_DIRENT + return GetFileAttributesW (tPath); +#else + WCHAR wpath[MAX_PATH]; + mbstowcs (wpath, tPath, MAX_PATH); + return GetFileAttributesW (wpath); +#endif +} + +#endif + /* * opendir * * Returns a pointer to a DIR structure appropriately filled in to begin * searching a directory. */ -_TDIR * +_TDIR * _topendir (const _TCHAR *szPath) { _TDIR *nd; unsigned int rc; _TCHAR szFullPath[MAX_PATH]; - - errno = 0; + __set_errno (0); + if (!szPath) { - errno = EFAULT; + __set_errno (EFAULT); return (_TDIR *) 0; } if (szPath[0] == _T('\0')) { - errno = ENOTDIR; + __set_errno (ENOTDIR); return (_TDIR *) 0; } @@ -79,18 +166,31 @@ if (rc == (unsigned int)-1) { /* call GetLastError for more error info */ +#ifdef __COREDLL__ + /* GetFileAttributes already sets LastError. */ +#else errno = ENOENT; +#endif return (_TDIR *) 0; } if (!(rc & FILE_ATTRIBUTE_DIRECTORY)) { /* Error, entry exists but not a directory. */ +#ifdef __COREDLL__ + /* GetFileAttributes already sets LastError. */ +#else errno = ENOTDIR; +#endif return (_TDIR *) 0; } +#ifdef __COREDLL__ + /* On Windows CE paths must always be absolute. */ + _tcsncpy (szFullPath, szPath, MAX_PATH); +#else /* Make an absolute pathname. */ _tfullpath (szFullPath, szPath, MAX_PATH); +#endif /* Allocate enough space to store DIR structure and the complete * directory path given. */ @@ -102,7 +202,9 @@ if (!nd) { /* Error, out of memory. */ +#ifndef __COREDLL__ errno = ENOMEM; +#endif return (_TDIR *) 0; } @@ -150,12 +252,12 @@ struct _tdirent * _treaddir (_TDIR * dirp) { - errno = 0; + __set_errno (0); /* Check for valid DIR struct. */ if (!dirp) { - errno = EFAULT; + __set_errno (EFAULT); return (struct _tdirent *) 0; } @@ -187,12 +289,12 @@ /* Get the next search entry. */ if (_tfindnext (dirp->dd_handle, &(dirp->dd_dta))) { - /* We are off the end or otherwise error. + /* We are off the end or otherwise error. _findnext sets errno to ENOENT if no more file - Undo this. */ + Undo this. */ DWORD winerr = GetLastError (); if (winerr == ERROR_NO_MORE_FILES) - errno = 0; + __set_errno (0); _findclose (dirp->dd_handle); dirp->dd_handle = -1; dirp->dd_stat = -1; @@ -229,12 +331,12 @@ { int rc; - errno = 0; + __set_errno (0); rc = 0; if (!dirp) { - errno = EFAULT; + __set_errno (EFAULT); return -1; } @@ -258,11 +360,11 @@ void _trewinddir (_TDIR * dirp) { - errno = 0; + __set_errno (0); if (!dirp) { - errno = EFAULT; + __set_errno (EFAULT); return; } @@ -284,11 +386,11 @@ long _ttelldir (_TDIR * dirp) { - errno = 0; + __set_errno (0); if (!dirp) { - errno = EFAULT; + __set_errno (EFAULT); return -1; } return dirp->dd_stat; @@ -306,18 +408,18 @@ void _tseekdir (_TDIR * dirp, long lPos) { - errno = 0; + __set_errno (0); if (!dirp) { - errno = EFAULT; + __set_errno (EFAULT); return; } if (lPos < -1) { /* Seeking to an invalid position. */ - errno = EINVAL; + __set_errno (EINVAL); return; } else if (lPos == -1) Modified: trunk/cegcc/src/mingw/mingwex/dirname.c =================================================================== --- trunk/cegcc/src/mingw/mingwex/dirname.c 2007-06-24 19:42:31 UTC (rev 992) +++ trunk/cegcc/src/mingw/mingwex/dirname.c 2007-06-24 21:30:34 UTC (rev 993) @@ -49,7 +49,7 @@ if( (path[1] == *retname) && (path[2] == '\0') ) return retname; } - +#ifndef __COREDLL__ /* For all other cases ... * step over the drive designator, if present, copying it to retfail ... * (FIXME: maybe should confirm *path is a valid drive designator). @@ -60,6 +60,7 @@ *copyptr++ = *path++; *copyptr++ = *path++; } +#endif if( *path ) { Modified: trunk/cegcc/src/mingw/mingwex/getopt.c =================================================================== --- trunk/cegcc/src/mingw/mingwex/getopt.c 2007-06-24 19:42:31 UTC (rev 992) +++ trunk/cegcc/src/mingw/mingwex/getopt.c 2007-06-24 21:30:34 UTC (rev 993) @@ -37,7 +37,9 @@ */ #include <assert.h> +#ifndef __COREDLL__ #include <errno.h> +#endif #include <stdlib.h> #include <string.h> #include <getopt.h> @@ -69,6 +71,10 @@ extern char __declspec(dllimport) *__progname; #endif +#ifdef __MINGW32CE__ +#define IS_POSIXLY_CORRECT 0 +#endif + #define IGNORE_FIRST (*options == '-' || *options == '+') #define PRINT_ERROR ((opterr) && ((*options != ':') \ || (IGNORE_FIRST && options[1] != ':'))) Modified: trunk/cegcc/src/mingw/mingwex/gettimeofday.c =================================================================== --- trunk/cegcc/src/mingw/mingwex/gettimeofday.c 2007-06-24 19:42:31 UTC (rev 992) +++ trunk/cegcc/src/mingw/mingwex/gettimeofday.c 2007-06-24 21:30:34 UTC (rev 993) @@ -38,7 +38,13 @@ if(tp) { +#ifndef __COREDLL__ GetSystemTimeAsFileTime (&_now.ft); +#else + SYSTEMTIME st; + GetSystemTime (&st); + SystemTimeToFileTime (&st, &_now.ft); +#endif tp->tv_usec=(long)((_now.ns100 / 10ULL) % 1000000ULL ); tp->tv_sec= (long)((_now.ns100 - _W32_FT_OFFSET) / 10000000ULL); } Modified: trunk/cegcc/src/mingw/mingwex/wcstold.c =================================================================== --- trunk/cegcc/src/mingw/mingwex/wcstold.c 2007-06-24 19:42:31 UTC (rev 992) +++ trunk/cegcc/src/mingw/mingwex/wcstold.c 2007-06-24 21:30:34 UTC (rev 993) @@ -8,11 +8,13 @@ /* This routine has been placed in the public domain.*/ +#ifdef __COREDLL__ +/* coredll.dll doesn't export strtold. */ +#else + #define WIN32_LEAN_AND_MEAN #include <windows.h> -#ifndef __COREDLL__ #include <locale.h> -#endif #include <wchar.h> #include <stdlib.h> #include <string.h> @@ -51,15 +53,15 @@ char * cse; unsigned int i; long double ret; - const unsigned int cp = get_codepage (); - + const unsigned int cp = get_codepage (); + /* Allocate enough room for (possibly) mb chars */ cs = (char *) malloc ((wcslen(wcs)+1) * MB_CUR_MAX); if (cp == 0) /* C locale */ { for (i = 0; (wcs[i] != 0) && wcs[i] <= 255; i++) - cs[i] = (char) wcs[i]; + cs[i] = (char) wcs[i]; cs[i] = '\0'; } else @@ -90,3 +92,5 @@ return ret; } + +#endif /* __COREDLL__ */ Modified: trunk/cegcc/src/mingw/mingwex/wdirent.c =================================================================== --- trunk/cegcc/src/mingw/mingwex/wdirent.c 2007-06-24 19:42:31 UTC (rev 992) +++ trunk/cegcc/src/mingw/mingwex/wdirent.c 2007-06-24 21:30:34 UTC (rev 993) @@ -1,5 +1,7 @@ #define _UNICODE 1 #define UNICODE 1 +#define UNICODE_DIRENT 1 + #include <wchar.h> #include "dirent.c" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ped...@us...> - 2007-06-24 19:42:32
|
Revision: 992 http://svn.sourceforge.net/cegcc/?rev=992&view=rev Author: pedroalves Date: 2007-06-24 12:42:31 -0700 (Sun, 24 Jun 2007) Log Message: ----------- * mingwex/wince/findfile.c: New file. * mingwex/wince/chsize.c: New file. * mingwex/wince/access.c: New file. * mingwex/wince/mkdir.c: New file. * mingwex/wince/rmdir.c: New file. Modified Paths: -------------- trunk/cegcc/src/mingw/ChangeLog.mingw32ce Added Paths: ----------- trunk/cegcc/src/mingw/mingwex/wince/access.c trunk/cegcc/src/mingw/mingwex/wince/chsize.c trunk/cegcc/src/mingw/mingwex/wince/findfile.c trunk/cegcc/src/mingw/mingwex/wince/mkdir.c trunk/cegcc/src/mingw/mingwex/wince/rmdir.c Modified: trunk/cegcc/src/mingw/ChangeLog.mingw32ce =================================================================== --- trunk/cegcc/src/mingw/ChangeLog.mingw32ce 2007-06-24 19:30:58 UTC (rev 991) +++ trunk/cegcc/src/mingw/ChangeLog.mingw32ce 2007-06-24 19:42:31 UTC (rev 992) @@ -1,5 +1,13 @@ 2007-06-24 Pedro Alves <ped...@po...> + * mingwex/wince/findfile.c: New file. + * mingwex/wince/chsize.c: New file. + * mingwex/wince/access.c: New file. + * mingwex/wince/mkdir.c: New file. + * mingwex/wince/rmdir.c: New file. + +2007-06-24 Pedro Alves <ped...@po...> + * mingwex/wince/bsearch.c: New file. 2007-06-24 Pedro Alves <ped...@po...> Added: trunk/cegcc/src/mingw/mingwex/wince/access.c =================================================================== --- trunk/cegcc/src/mingw/mingwex/wince/access.c (rev 0) +++ trunk/cegcc/src/mingw/mingwex/wince/access.c 2007-06-24 19:42:31 UTC (rev 992) @@ -0,0 +1,43 @@ +/* This is file ACCESS.C */ +/* + * Copyright (C) 1993 DJ Delorie + * All rights reserved. + * + * Redistribution and use in source and binary forms is permitted + * provided that the above copyright notice and following paragraph are + * duplicated in all such forms. + * + * This file is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + +/* PAlves: + Renamed access to _access, and made a new access + that calls _access. */ + +#include <fcntl.h> +#include <sys/stat.h> +#include <unistd.h> + +int +_access(const char *fn, int flags) +{ + struct stat s; + if (stat(fn, &s)) + return -1; + if (s.st_mode & S_IFDIR) + return 0; + if (flags & W_OK) + { + if (s.st_mode & S_IWRITE) + return 0; + return -1; + } + return 0; +} + +int +access(const char *fn, int flags) +{ + return _access(fn, flags); +} Property changes on: trunk/cegcc/src/mingw/mingwex/wince/access.c ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/cegcc/src/mingw/mingwex/wince/chsize.c =================================================================== --- trunk/cegcc/src/mingw/mingwex/wince/chsize.c (rev 0) +++ trunk/cegcc/src/mingw/mingwex/wince/chsize.c 2007-06-24 19:42:31 UTC (rev 992) @@ -0,0 +1,51 @@ +/* + * chsize.c: _chsize and chsize implementations for WinCE. + * + * This file has no copyright assigned and is placed in the Public + * Domain. This file is a part of the mingw32ce package. No + * warranty is given; refer to the file DISCLAIMER within the package. + * + * Written by Pedro Alves <ped...@po...> 24 Jun 2007 + * + */ + +#define WIN32_LEAN_AND_MEAN +#include <windows.h> + +int +_chsize (int fd, long size) +{ + DWORD cur; + DWORD new; + HANDLE h; + BOOL ret; + + h = (HANDLE) fd; + if (h == INVALID_HANDLE_VALUE) + { + SetLastError (ERROR_INVALID_PARAMETER); + return -1; + } + + cur = SetFilePointer (h, 0, NULL, FILE_CURRENT); + if (cur == 0xffffffff) + return -1; + + /* Move to where we want it. */ + new = SetFilePointer (h, size, NULL, FILE_BEGIN); + if (new == 0xffffffff) + return -1; + + /* And commit it as eof, effectivelly growing or shrinking. */ + ret = SetEndOfFile (h); + + SetFilePointer (h, cur, NULL, FILE_BEGIN); + + return ret ? 0 : -1; +} + +int +chsize (int fd, long size) +{ + return _chsize (fd, size); +} Property changes on: trunk/cegcc/src/mingw/mingwex/wince/chsize.c ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/cegcc/src/mingw/mingwex/wince/findfile.c =================================================================== --- trunk/cegcc/src/mingw/mingwex/wince/findfile.c (rev 0) +++ trunk/cegcc/src/mingw/mingwex/wince/findfile.c 2007-06-24 19:42:31 UTC (rev 992) @@ -0,0 +1,128 @@ +/* + * findfind.c: _findfirst, _findnext, _findclose and the wide + * counterparts implementations for WinCE. + * + * This file has no copyright assigned and is placed in the Public + * Domain. This file is a part of the mingw32ce package. No + * warranty is given; refer to the file DISCLAIMER within the package. + * + * Written by Pedro Alves <ped...@po...> 24 Jun 2007 + * + */ + +#include <stdarg.h> +#include <time.h> +#include <windows.h> +#include <io.h> +#include "timeutil.h" + +static void +wfd_to_fd (const WIN32_FIND_DATAW *wfd, struct _wfinddata_t *fd) +{ + /* Map win32 file attributes to _finddata_t types. The constants + are numerically equal, meaning we could also: + fd->attrib = wfd->dwFileAttributes; + But that would copy too much. + TODO: _A_VOLID isn't mapped. */ + + fd->attrib = 0; + if (wfd->dwFileAttributes & FILE_ATTRIBUTE_NORMAL) + fd->attrib |= _A_NORMAL; + if (wfd->dwFileAttributes & FILE_ATTRIBUTE_READONLY) + fd->attrib |= _A_RDONLY; + if (wfd->dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) + fd->attrib |= _A_HIDDEN; + if (wfd->dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) + fd->attrib |= _A_SYSTEM; + if (wfd->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + fd->attrib |= _A_SUBDIR; + if (wfd->dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE) + fd->attrib |= _A_ARCH; + + fd->size = wfd->nFileSizeLow; + wcscpy (fd->name, wfd->cFileName); + + fd->time_access = __FILETIME_to_time_t (&wfd->ftLastAccessTime); + fd->time_create = __FILETIME_to_time_t (&wfd->ftCreationTime); + fd->time_write = __FILETIME_to_time_t (&wfd->ftLastWriteTime); +} + +static void +tofinddataa (struct _finddata_t *fda, const struct _wfinddata_t *fdw) +{ +#define COPY_MEMBER(MEM) do { fda->MEM = fdw->MEM; } while (0) + COPY_MEMBER (attrib); + COPY_MEMBER (time_create); + COPY_MEMBER (time_access); + COPY_MEMBER (time_write); + COPY_MEMBER (size); +#undef COPY_MEMBER + wcstombs (fda->name, fdw->name, FILENAME_MAX); +}; + +int +_findclose (long h) +{ + if (!FindClose ((HANDLE) h)) + return -1; + return 0; +} + +long +_wfindfirst (const wchar_t *filespec, struct _wfinddata_t *f) +{ + WIN32_FIND_DATAW find_data; + HANDLE h; + + h = FindFirstFileW (filespec, &find_data); + if (h == INVALID_HANDLE_VALUE) + return -1; + + wfd_to_fd (&find_data, f); + return (long) h; +} + +long +_findfirst (const char *filespec, struct _finddata_t *f) +{ + wchar_t wfilespec[MAX_PATH]; + struct _wfinddata_t wf; + long h; + + mbstowcs (wfilespec, filespec, MAX_PATH); + + h = _wfindfirst (wfilespec, &wf); + + if (h == -1) + return -1; + + tofinddataa (f, &wf); + return h; +} + +int +_wfindnext (long h, struct _wfinddata_t *f) +{ + WIN32_FIND_DATAW find_data; + + if (!FindNextFileW ((HANDLE) h, &find_data)) + return -1; + + wfd_to_fd (&find_data, f); + return 0; +} + +int +_findnext (long h, struct _finddata_t * f) +{ + struct _wfinddata_t wf; + int ret; + + ret = _wfindnext (h, &wf); + + if (ret == -1) + return -1; + + tofinddataa (f, &wf); + return h; +} Property changes on: trunk/cegcc/src/mingw/mingwex/wince/findfile.c ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/cegcc/src/mingw/mingwex/wince/mkdir.c =================================================================== --- trunk/cegcc/src/mingw/mingwex/wince/mkdir.c (rev 0) +++ trunk/cegcc/src/mingw/mingwex/wince/mkdir.c 2007-06-24 19:42:31 UTC (rev 992) @@ -0,0 +1,29 @@ +/* + * mkdir.c: mkdir implementation for WinCE. + * + * This file has no copyright assigned and is placed in the Public + * Domain. This file is a part of the mingw32ce package. No + * warranty is given; refer to the file DISCLAIMER within the package. + * + * Written by Pedro Alves <ped...@po...> 24 Jun 2007 + * + */ + +#include <windows.h> +#include <io.h> + +int +_mkdir (const char *dirname) +{ + wchar_t dirnamew[MAX_PATH]; + mbstowcs (dirnamew, dirname, MAX_PATH); + if (!CreateDirectoryW (dirnamew, NULL)) + return -1; + return 0; +} + +int +mkdir (const char *dirname) +{ + return _mkdir (dirname); +} Property changes on: trunk/cegcc/src/mingw/mingwex/wince/mkdir.c ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/cegcc/src/mingw/mingwex/wince/rmdir.c =================================================================== --- trunk/cegcc/src/mingw/mingwex/wince/rmdir.c (rev 0) +++ trunk/cegcc/src/mingw/mingwex/wince/rmdir.c 2007-06-24 19:42:31 UTC (rev 992) @@ -0,0 +1,31 @@ +/* + * rmdir.c: rmdir implementation for WinCE. + * + * This file has no copyright assigned and is placed in the Public + * Domain. This file is a part of the mingw32ce package. No + * warranty is given; refer to the file DISCLAIMER within the package. + * + * Written by Pedro Alves <ped...@po...> 24 Jun 2007 + * + */ + +#include <windows.h> +#include <io.h> + +int +rmdir (const char *dirname) +{ + wchar_t dirnamew[MAX_PATH + 1]; + + if (dirname == NULL) + { + SetLastError (ERROR_INVALID_ADDRESS); + return -1; + } + + mbstowcs (dirnamew, dirname, MAX_PATH); + if (!RemoveDirectoryW (dirnamew)) + return -1; + + return 0; +} Property changes on: trunk/cegcc/src/mingw/mingwex/wince/rmdir.c ___________________________________________________________________ Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ped...@us...> - 2007-06-24 19:31:00
|
Revision: 991 http://svn.sourceforge.net/cegcc/?rev=991&view=rev Author: pedroalves Date: 2007-06-24 12:30:58 -0700 (Sun, 24 Jun 2007) Log Message: ----------- * mingwex/wince/bsearch.c: New file. Modified Paths: -------------- trunk/cegcc/src/mingw/ChangeLog.mingw32ce Added Paths: ----------- trunk/cegcc/src/mingw/mingwex/wince/bsearch.c Modified: trunk/cegcc/src/mingw/ChangeLog.mingw32ce =================================================================== --- trunk/cegcc/src/mingw/ChangeLog.mingw32ce 2007-06-24 19:19:17 UTC (rev 990) +++ trunk/cegcc/src/mingw/ChangeLog.mingw32ce 2007-06-24 19:30:58 UTC (rev 991) @@ -1,5 +1,9 @@ 2007-06-24 Pedro Alves <ped...@po...> + * mingwex/wince/bsearch.c: New file. + +2007-06-24 Pedro Alves <ped...@po...> + * mingwex/wince/stat.c (_stat_by_file_info): Change ST param type to struct _stat*. (fstat): Rename to ... Added: trunk/cegcc/src/mingw/mingwex/wince/bsearch.c =================================================================== --- trunk/cegcc/src/mingw/mingwex/wince/bsearch.c (rev 0) +++ trunk/cegcc/src/mingw/mingwex/wince/bsearch.c 2007-06-24 19:30:58 UTC (rev 991) @@ -0,0 +1,81 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* <wince> */ + +/* bsearch is in both stdlib.h and search.h. We include both + to catch possible differences. */ +#include <stdlib.h> +#include <search.h> +#include <stdint.h> + +/* </wince> */ + + +/* + * Perform a binary search. + * + * The code below is a bit sneaky. After a comparison fails, we + * divide the work in half by moving either left or right. If lim + * is odd, moving left simply involves halving lim: e.g., when lim + * is 5 we look at item 2, so we change lim to 2 so that we will + * look at items 0 & 1. If lim is even, the same applies. If lim + * is odd, moving right again involes halving lim, this time moving + * the base up one item past p: e.g., when lim is 5 we change base + * to item 3 and make lim 2 so that we will look at items 3 and 4. + * If lim is even, however, we have to shrink it by one before + * halving: e.g., when lim is 4, we still looked at item 2, so we + * have to make lim 3, then halve, obtaining 1, so that we will only + * look at item 3. + */ +void * +bsearch(key, base0, nmemb, size, compar) + const void *key; + const void *base0; + size_t nmemb; + size_t size; + int (*compar)(const void *, const void *); +{ + const char *base = base0; + size_t lim; + int cmp; + const void *p; + + for (lim = nmemb; lim != 0; lim >>= 1) { + p = base + (lim >> 1) * size; + cmp = (*compar)(key, p); + if (cmp == 0) + return ((void *)(uintptr_t)p); + if (cmp > 0) { /* key > p: move right */ + base = (const char *)p + size; + lim--; + } /* else move left */ + } + return (NULL); +} Property changes on: trunk/cegcc/src/mingw/mingwex/wince/bsearch.c ___________________________________________________________________ Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ped...@us...> - 2007-06-24 19:19:18
|
Revision: 990 http://svn.sourceforge.net/cegcc/?rev=990&view=rev Author: pedroalves Date: 2007-06-24 12:19:17 -0700 (Sun, 24 Jun 2007) Log Message: ----------- * mingwex/wince/stat.c (_stat_by_file_info): Change ST param type to struct _stat*. (fstat): Rename to ... (_fstat): ... this. (fstat): New as wrapper around _fstat. (_stat): Remove cast to struct stat*. Modified Paths: -------------- trunk/cegcc/src/mingw/ChangeLog.mingw32ce trunk/cegcc/src/mingw/mingwex/wince/stat.c Modified: trunk/cegcc/src/mingw/ChangeLog.mingw32ce =================================================================== --- trunk/cegcc/src/mingw/ChangeLog.mingw32ce 2007-06-22 17:15:42 UTC (rev 989) +++ trunk/cegcc/src/mingw/ChangeLog.mingw32ce 2007-06-24 19:19:17 UTC (rev 990) @@ -1,3 +1,12 @@ +2007-06-24 Pedro Alves <ped...@po...> + + * mingwex/wince/stat.c (_stat_by_file_info): Change ST param type to + struct _stat*. + (fstat): Rename to ... + (_fstat): ... this. + (fstat): New as wrapper around _fstat. + (_stat): Remove cast to struct stat*. + 2007-06-16 Pedro Alves <ped...@po...> * mingwex/wince/stat.c: Fix whitespacing and formatting throughout. Modified: trunk/cegcc/src/mingw/mingwex/wince/stat.c =================================================================== --- trunk/cegcc/src/mingw/mingwex/wince/stat.c 2007-06-22 17:15:42 UTC (rev 989) +++ trunk/cegcc/src/mingw/mingwex/wince/stat.c 2007-06-24 19:19:17 UTC (rev 990) @@ -42,7 +42,7 @@ } while (0) static int -__stat_by_file_info (struct stat_file_info_t *fi, struct stat *st, int exec) +__stat_by_file_info (struct stat_file_info_t *fi, struct _stat *st, int exec) { int permission = _S_IREAD; @@ -91,7 +91,7 @@ } int -fstat (int fd, struct stat *st) +_fstat (int fd, struct _stat *st) { BY_HANDLE_FILE_INFORMATION fi; struct stat_file_info_t sfi; @@ -102,6 +102,12 @@ } int +fstat (int fd, struct stat *st) +{ + return _fstat (fd, (struct _stat *)st); +} + +int _stat (const char *path, struct _stat *st) { WIN32_FIND_DATAW fd; @@ -127,7 +133,7 @@ len = strlen (path); exec = (len >= 4 && strcasecmp (path + len - 4, ".exe") == 0); - ret = __stat_by_file_info (&sfi, (struct stat*)st, exec); + ret = __stat_by_file_info (&sfi, st, exec); FindClose (h); return ret; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2007-06-22 17:15:54
|
Revision: 989 http://svn.sourceforge.net/cegcc/?rev=989&view=rev Author: dannybackx Date: 2007-06-22 10:15:42 -0700 (Fri, 22 Jun 2007) Log Message: ----------- remove Removed Paths: ------------- tags/cegcc-0.39test2/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2007-06-22 17:12:46
|
Revision: 988 http://svn.sourceforge.net/cegcc/?rev=988&view=rev Author: dannybackx Date: 2007-06-22 10:12:45 -0700 (Fri, 22 Jun 2007) Log Message: ----------- remove Removed Paths: ------------- tags/cegcc-0.39test2/src/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2007-06-22 17:12:22
|
Revision: 987 http://svn.sourceforge.net/cegcc/?rev=987&view=rev Author: dannybackx Date: 2007-06-22 10:12:19 -0700 (Fri, 22 Jun 2007) Log Message: ----------- remove Removed Paths: ------------- tags/cegcc-0.39test2/tools/ tags/cegcc-0.39test2/website/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2007-06-22 17:10:12
|
Revision: 986 http://svn.sourceforge.net/cegcc/?rev=986&view=rev Author: dannybackx Date: 2007-06-22 10:10:04 -0700 (Fri, 22 Jun 2007) Log Message: ----------- remove Removed Paths: ------------- tags/cegcc-0.39test2/test/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2007-06-22 17:09:53
|
Revision: 985 http://svn.sourceforge.net/cegcc/?rev=985&view=rev Author: dannybackx Date: 2007-06-22 10:09:52 -0700 (Fri, 22 Jun 2007) Log Message: ----------- remove Removed Paths: ------------- tags/cegcc-0.39test2/scripts/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2007-06-22 17:09:13
|
Revision: 984 http://svn.sourceforge.net/cegcc/?rev=984&view=rev Author: dannybackx Date: 2007-06-22 10:08:49 -0700 (Fri, 22 Jun 2007) Log Message: ----------- remove Removed Paths: ------------- tags/cegcc-0.39test2/src/w32api/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2007-06-22 17:08:56
|
Revision: 983 http://svn.sourceforge.net/cegcc/?rev=983&view=rev Author: dannybackx Date: 2007-06-22 10:08:43 -0700 (Fri, 22 Jun 2007) Log Message: ----------- remove Removed Paths: ------------- tags/cegcc-0.39test2/src/profile/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2007-06-22 17:08:56
|
Revision: 982 http://svn.sourceforge.net/cegcc/?rev=982&view=rev Author: dannybackx Date: 2007-06-22 10:08:35 -0700 (Fri, 22 Jun 2007) Log Message: ----------- remove Removed Paths: ------------- tags/cegcc-0.39test2/src/patches/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2007-06-22 17:08:43
|
Revision: 980 http://svn.sourceforge.net/cegcc/?rev=980&view=rev Author: dannybackx Date: 2007-06-22 10:08:02 -0700 (Fri, 22 Jun 2007) Log Message: ----------- remove Removed Paths: ------------- tags/cegcc-0.39test2/src/mingw/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2007-06-22 17:08:43
|
Revision: 981 http://svn.sourceforge.net/cegcc/?rev=981&view=rev Author: dannybackx Date: 2007-06-22 10:08:17 -0700 (Fri, 22 Jun 2007) Log Message: ----------- remove Removed Paths: ------------- tags/cegcc-0.39test2/src/newlib/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2007-06-22 17:06:28
|
Revision: 979 http://svn.sourceforge.net/cegcc/?rev=979&view=rev Author: dannybackx Date: 2007-06-22 10:05:37 -0700 (Fri, 22 Jun 2007) Log Message: ----------- remove Removed Paths: ------------- tags/cegcc-0.39test2/src/gcc/ tags/cegcc-0.39test2/src/gdb/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dan...@us...> - 2007-06-22 17:02:38
|
Revision: 978 http://svn.sourceforge.net/cegcc/?rev=978&view=rev Author: dannybackx Date: 2007-06-22 10:02:37 -0700 (Fri, 22 Jun 2007) Log Message: ----------- remove Removed Paths: ------------- tags/cegcc-0.39test2/src/binutils/ tags/cegcc-0.39test2/src/cegcc/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |