Index: trunk/src/lz32/lz32.cpp
===================================================================
--- trunk/src/lz32/lz32.cpp	(revision 471)
+++ trunk/src/lz32/lz32.cpp	(revision 474)
@@ -1,3 +1,3 @@
-/* $Id: lz32.cpp,v 1.1 1999-08-10 12:37:33 phaller Exp $ */
+/* $Id: lz32.cpp,v 1.2 1999-08-11 12:49:21 phaller Exp $ */
 
 /*
@@ -15,4 +15,5 @@
 #include <ctype.h>
 #include <odincrt.h>
+#include <odinwrap.h>
 #include <windef.h>
 #include <winbase.h>
@@ -28,4 +29,6 @@
 LPWSTR WINAPI lstrcpyAtoW    (LPWSTR unicode, LPSTR ascii);
 #define SystemHeap GetProcessHeap()
+#define dprintf(a)
+
 
 /****************************************************************************
@@ -86,9 +89,33 @@
 
 /****************************************************************************
+ * Internal Prototypes                                                      *
+ ****************************************************************************/
+
+#define ODIN_INTERNAL _Optlink
+
+// internal interface
+VOID        ODIN_INTERNAL LZDone(void);
+LONG        ODIN_INTERNAL CopyLZFile(HFILE,HFILE);
+HFILE       ODIN_INTERNAL LZOpenFileA(LPCSTR,LPOFSTRUCT,UINT);
+HFILE       ODIN_INTERNAL LZOpenFileW(LPCWSTR,LPOFSTRUCT,UINT);
+INT         ODIN_INTERNAL LZRead(HFILE,LPVOID,UINT);
+INT         ODIN_INTERNAL LZStart(void);
+void        ODIN_INTERNAL LZClose(HFILE);
+LONG        ODIN_INTERNAL LZCopy(HFILE,HFILE);
+HFILE       ODIN_INTERNAL LZInit(HFILE);
+LONG        ODIN_INTERNAL LZSeek(HFILE,LONG,INT);
+INT         ODIN_INTERNAL GetExpandedNameA(LPCSTR,LPSTR);
+INT         ODIN_INTERNAL GetExpandedNameW(LPCWSTR,LPWSTR);
+
+static int _lzget(struct lzstate *lzs,BYTE *b);
+static INT read_header(HFILE fd,struct lzfileheader *head);
+
+
+/****************************************************************************
  * Implementation                                                           *
  ****************************************************************************/
 
-static int
-_lzget(struct lzstate *lzs,BYTE *b) {
+static int _lzget(struct lzstate *lzs,BYTE *b)
+{
    if (lzs->getcur<lzs->getlen) {
       *b    = lzs->get[lzs->getcur++];
@@ -106,4 +133,6 @@
    }
 }
+
+
 /* internal function, reads lzheader
  * returns BADINHANDLE for non filedescriptors
@@ -139,24 +168,12 @@
 
 
-/*****************************************************************************
- * Name      :
- * Purpose   :
- * Parameters:
- * Variables :
- * Result    :
- * Remark    :
- * Status    :
- *
- * Author    : Patrick Haller [Tue, 1999/08/10 21:55]
- *****************************************************************************/
-
-
 /***********************************************************************
  *           LZStart32   (LZ32.6)
  */
-INT WINAPI LZStart(void)
-{
-    TRACE("(void)\n");
-    return 1;
+
+ODINFUNCTION0(INT,LZStart)
+{
+  dprintf(("LZ32: LZStart32()\n"));
+  return 1;
 }
 
@@ -173,7 +190,6 @@
  *  libc
  */
-HFILE WINAPI LZInit( HFILE hfSrc )
-{
-
+ODINFUNCTION1(HFILE,LZInit,HFILE,hfSrc)
+{
    struct   lzfileheader                 head;
    struct   lzstate                         *lzs;
@@ -181,5 +197,7 @@
         int i;
 
-   TRACE("(%d)\n",hfSrc);
+   dprintf(("LZ32: LZInit(%08xh)\n",
+            hfSrc));
+
    ret=read_header(hfSrc,&head);
    if (ret<=0) {
@@ -212,5 +230,5 @@
  *           LZDone   (LZEXPAND.9) (LZ32.8)
  */
-void WINAPI LZDone(void)
+ODINPROCEDURE0(LZDone)
 {
     TRACE("(void)\n");
@@ -228,5 +246,5 @@
  */
 
-INT WINAPI GetExpandedNameA( LPCSTR in, LPSTR out )
+ODINFUNCTION2(INT,GetExpandedNameA,LPCSTR,in,LPSTR,out)
 {
    struct lzfileheader                   head;
@@ -236,5 +254,8 @@
    LPSTR    s,t;
 
-   TRACE("(%s)\n",in);
+   dprintf(("LZ32: GetExpandedNameA(%s,%08xh)\n",
+            in,
+            out));
+
    fd=OpenFile(in,&ofs,OF_READ);
    if (fd==HFILE_ERROR)
@@ -298,8 +319,12 @@
  *           GetExpandedName32W   (LZ32.11)
  */
-INT WINAPI GetExpandedNameW( LPCWSTR in, LPWSTR out )
+ODINFUNCTION2(INT,GetExpandedNameW,LPCWSTR,in,LPWSTR,out)
 {
    char  *xin,*xout;
    INT   ret;
+
+   dprintf(("LZ32: GetExpandedNameW(%08xh,%08xh)\n",
+            in,
+            out));
 
    xout  = (char*)HeapAlloc( GetProcessHeap(), 0, lstrlenW(in)+3 );
@@ -316,5 +341,5 @@
  *           LZRead32   (LZ32.4)
  */
-INT WINAPI LZRead( HFILE fd, LPVOID vbuf, UINT toread )
+ODINFUNCTION3(INT,LZRead,HFILE,fd,LPVOID,vbuf,UINT,toread)
 {
    int   howmuch;
@@ -322,6 +347,10 @@
    struct   lzstate                      *lzs;
 
+   dprintf(("LZ32: LZRead(%08xh,%08xh,%08h)\n",
+            fd,
+            vbuf,
+            toread));
+
    buf=(LPBYTE)vbuf;
-   TRACE("(%d,%p,%d)\n",fd,buf,toread);
    howmuch=toread;
    if (!(lzs = GET_LZ_STATE(fd))) return _lread(fd,buf,toread);
@@ -407,10 +436,15 @@
  *           LZSeek32   (LZ32.3)
  */
-LONG WINAPI LZSeek( HFILE fd, LONG off, INT type )
+
+ODINFUNCTION3(LONG,LZSeek,HFILE,fd,LONG,off,INT,type)
 {
    struct   lzstate                      *lzs;
    LONG  newwanted;
 
-   TRACE("(%d,%ld,%d)\n",fd,off,type);
+   dprintf(("LZ32: LZSeek(%08xh,%08xh,%08xh)\n",
+            fd,
+            off,
+            type));
+
    /* not compressed? just use normal _llseek() */
         if (!(lzs = GET_LZ_STATE(fd))) return _llseek(fd,off,type);
@@ -446,5 +480,5 @@
 typedef  UINT (WINAPI *_readfun)(HFILE,LPVOID,UINT);
 
-LONG WINAPI LZCopy( HFILE src, HFILE dest )
+ODINFUNCTION2(LONG,LZCopy,HFILE,src,HFILE,dest)
 {
    int   usedlzinit=0,ret,wret;
@@ -459,5 +493,8 @@
    _readfun xread;
 
-   TRACE("(%d,%d)\n",src,dest);
+   dprintf(("LZ32: LZCopy(%08x,h%08xh)\n",
+            src,
+            dest));
+
    if (!IS_LZ_HANDLE(src)) {
       src = LZInit(src);
@@ -516,9 +553,14 @@
  * Opens a file. If not compressed, open it as a normal file.
  */
-HFILE WINAPI LZOpenFileA( LPCSTR fn, LPOFSTRUCT ofs, UINT mode )
+
+ODINFUNCTION3(HFILE,LZOpenFileA,LPCSTR,fn,LPOFSTRUCT,ofs,UINT,mode)
 {
    HFILE fd,cfd;
 
-   TRACE("(%s,%p,%d)\n",fn,ofs,mode);
+   dprintf(("LZ32: LZOpenFileA(%s,%08xh,%08xh)\n",
+            fn,
+            ofs,
+            mode));
+
    /* 0x70 represents all OF_SHARE_* flags, ignore them for the check */
    fd=OpenFile(fn,ofs,mode);
@@ -542,9 +584,14 @@
  *           LZOpenFile32W   (LZ32.10)
  */
-HFILE WINAPI LZOpenFileW( LPCWSTR fn, LPOFSTRUCT ofs, UINT mode )
+ODINFUNCTION3(HFILE,LZOpenFileW,LPCWSTR,fn,LPOFSTRUCT,ofs,UINT,mode)
 {
    LPSTR xfn;
    LPWSTR   yfn;
    HFILE ret;
+
+   dprintf(("LZ32: LZOpenFileW(%08xh,%08xh,%08xh)\n",
+            fn,
+            ofs,
+            mode));
 
    xfn   = HEAP_strdupWtoA( GetProcessHeap(), 0, fn);
@@ -564,9 +611,12 @@
  *           LZClose32   (LZ32.5)
  */
-void WINAPI LZClose( HFILE fd )
+
+ODINPROCEDURE1(LZClose,HFILE,fd)
 {
    struct lzstate *lzs;
 
-   TRACE("(%d)\n",fd);
+   dprintf(("LZ32: LZClose(%08xh)\n",
+            fd));
+
         if (!(lzs = GET_LZ_STATE(fd))) _lclose(fd);
         else
@@ -586,7 +636,11 @@
  * NOTE: Yes. This is exactly the same function as LZCopy.
  */
-LONG WINAPI CopyLZFile( HFILE src, HFILE dest )
-{
-    TRACE("(%d,%d)\n",src,dest);
-    return LZCopy(src,dest);
-}
+
+ODINFUNCTION2(LONG,CopyLZFile,HFILE,src,HFILE,dest)
+{
+  dprintf(("LZ32: CopyLZFile(%08xh,%08xh)\n",
+           src,
+           dest));
+
+  return LZCopy(src,dest);
+}
Index: trunk/src/lz32/lz32.def
===================================================================
--- trunk/src/lz32/lz32.def	(revision 471)
+++ trunk/src/lz32/lz32.def	(revision 474)
@@ -12,15 +12,15 @@
 
 EXPORTS
-       LZCopy                = _LZCopy@8           @0
-       LZOpenFileA           = _LZOpenFileA@12     @1
-       LZInit                = _LZInit@4           @2
-       LZSeek                = _LZSeek@12          @3
-       LZRead                = _LZRead@12          @4
-       LZClose               = _LZClose@4          @5
-       LZStart               = _LZStart@0          @6
-       CopyLZFile            = _CopyLZFile@8       @7
-       LZDone                = _LZDone@0           @8
-       GetExpandedNameA      = _GetExpandedNameA@8 @9
-       LZOpenFileW           = _LZOpenFileW@12     @10
-       GetExpandedNameW      = _GetExpandedNameW@8 @11
+       LZCopy                = _ODIN_LZCopy@8           @0
+       LZOpenFileA           = _ODIN_LZOpenFileA@12     @1
+       LZInit                = _ODIN_LZInit@4           @2
+       LZSeek                = _ODIN_LZSeek@12          @3
+       LZRead                = _ODIN_LZRead@12          @4
+       LZClose               = _ODIN_LZClose@4          @5
+       LZStart               = _ODIN_LZStart@0          @6
+       CopyLZFile            = _ODIN_CopyLZFile@8       @7
+       LZDone                = _ODIN_LZDone@0           @8
+       GetExpandedNameA      = _ODIN_GetExpandedNameA@8 @9
+       LZOpenFileW           = _ODIN_LZOpenFileW@12     @10
+       GetExpandedNameW      = _ODIN_GetExpandedNameW@8 @11
 
Index: trunk/src/lz32/lz32.h
===================================================================
--- trunk/src/lz32/lz32.h	(revision 471)
+++ trunk/src/lz32/lz32.h	(revision 474)
@@ -1,3 +1,3 @@
-/* $Id: lz32.h,v 1.1 1999-08-10 12:37:33 phaller Exp $ */
+/* $Id: lz32.h,v 1.2 1999-08-11 12:49:22 phaller Exp $ */
 
 /*
@@ -55,16 +55,17 @@
  ****************************************************************************/
 
-VOID        WINAPI LZDone(void);
-LONG        WINAPI CopyLZFile(HFILE,HFILE);
-HFILE       WINAPI LZOpenFileA(LPCSTR,LPOFSTRUCT,UINT);
-HFILE       WINAPI LZOpenFileW(LPCWSTR,LPOFSTRUCT,UINT);
-INT         WINAPI LZRead(HFILE,LPVOID,UINT);
-INT         WINAPI LZStart(void);
-void        WINAPI LZClose(HFILE);
-LONG        WINAPI LZCopy(HFILE,HFILE);
-HFILE       WINAPI LZInit(HFILE);
-LONG        WINAPI LZSeek(HFILE,LONG,INT);
-INT         WINAPI GetExpandedNameA(LPCSTR,LPSTR);
-INT         WINAPI GetExpandedNameW(LPCWSTR,LPWSTR);
+// external interface
+VOID        WINAPI ODIN_LZDone(void);
+LONG        WINAPI ODIN_CopyLZFile(HFILE,HFILE);
+HFILE       WINAPI ODIN_LZOpenFileA(LPCSTR,LPOFSTRUCT,UINT);
+HFILE       WINAPI ODIN_LZOpenFileW(LPCWSTR,LPOFSTRUCT,UINT);
+INT         WINAPI ODIN_LZRead(HFILE,LPVOID,UINT);
+INT         WINAPI ODIN_LZStart(void);
+void        WINAPI ODIN_LZClose(HFILE);
+LONG        WINAPI ODIN_LZCopy(HFILE,HFILE);
+HFILE       WINAPI ODIN_LZInit(HFILE);
+LONG        WINAPI ODIN_LZSeek(HFILE,LONG,INT);
+INT         WINAPI ODIN_GetExpandedNameA(LPCSTR,LPSTR);
+INT         WINAPI ODIN_GetExpandedNameW(LPCWSTR,LPWSTR);
 
 
