Convert from dos
authornemo
Fri, 20 Aug 2010 11:52:08 -0400
changeset 3744 543412536b7b
parent 3743 234ce4da76d4
child 3746 f227a6b69618
Convert from dos
hedgewars/adler32.pas
misc/libopenalbridge/openalbridge_t.h
--- a/hedgewars/adler32.pas	Fri Aug 20 11:26:27 2010 -0400
+++ b/hedgewars/adler32.pas	Fri Aug 20 11:52:08 2010 -0400
@@ -1,152 +1,152 @@
-unit Adler32;
-
-{ZLib - Adler32 checksum function}
-
-
-interface
-
-(*************************************************************************
-
- DESCRIPTION     :  ZLib - Adler32 checksum function
-
- REQUIREMENTS    :  TP5-7, D1-D7/D9-D10/D12, FPC, VP
-
- EXTERNAL DATA   :  ---
-
- MEMORY USAGE    :  ---
-
- DISPLAY MODE    :  ---
-
- REFERENCES      :  RFC 1950 (http://tools.ietf.org/html/rfc1950)
-
-
- Version  Date      Author      Modification
- -------  --------  -------     ------------------------------------------
- 0.10     30.08.03  W.Ehrhardt  Initial version based on MD5 layout
- 2.10     30.08.03  we          Common vers., XL versions for Win32
- 2.20     27.09.03  we          FPC/go32v2
- 2.30     05.10.03  we          STD.INC, TP5.0
- 2.40     10.10.03  we          common version, english comments
- 3.00     01.12.03  we          Common version 3.0
- 3.01     22.05.05  we          Adler32UpdateXL (i,n: integer)
- 3.02     17.12.05  we          Force $I- in Adler32File
- 3.03     07.08.06  we          $ifdef BIT32: (const fname: shortstring...)
- 3.04     10.02.07  we          Adler32File: no eof, XL and filemode via $ifdef
- 3.05     04.07.07  we          BASM16: speed-up factor 15
- 3.06     12.11.08  we          uses BTypes, Ptr2Inc and/or Str255
- 3.07     25.04.09  we          updated RFC URL(s)
- 3.08     19.07.09  we          D12 fix: assign with typecast string(fname)
-**************************************************************************)
-
-(*-------------------------------------------------------------------------
- (C) Copyright 2002-2009 Wolfgang Ehrhardt
-
- This software is provided 'as-is', without any express or implied warranty.
- In no event will the authors be held liable for any damages arising from
- the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
-    claim that you wrote the original software. If you use this software in
-    a product, an acknowledgment in the product documentation would be
-    appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and must not be
-    misrepresented as being the original software.
-
- 3. This notice may not be removed or altered from any source distribution.
-----------------------------------------------------------------------------*)
-
-(*
-As per the license above, noting that this implementation of adler32 was stripped of everything we didn't need.
-That means no btypes, file loading, and the assembly version disabled.
-*)
-
-procedure Adler32Update(var adler: longint; Msg: pointer; Len: longint);
-
-implementation
-
-(*
-$ifdef BASM16
-
-procedure Adler32Update(var adler: longint; Msg: pointer; Len: longint);
-  //-update Adler32 with Msg data
-const
-  BASE = 65521; // max. prime < 65536
-  NMAX =  5552; // max. n with 255n(n+1)/2 + (n+1)(BASE-1) < 2^32
-type
-  LH    = packed record
-            L,H: word;
-          end;
-var
-  s1,s2: longint;
-  n: integer;
-begin
-  s1 := LH(adler).L;
-  s2 := LH(adler).H;
-  while Len > 0 do begin
-    if Len<NMAX then n := Len else n := NMAX;
-    //BASM increases speed from about 52 cyc/byte to about 3.7 cyc/byte
-    asm
-                    mov  cx,[n]
-            db $66; mov  ax,word ptr [s1]
-            db $66; mov  di,word ptr [s2]
-                    les  si,[msg]
-      @@1:  db $66, $26, $0f, $b6, $1c      // movzx ebx,es:[si]
-                    inc  si
-            db $66; add  ax,bx              // inc(s1, pByte(Msg)^)
-            db $66; add  di,ax              // inc(s2, s1
-                    dec  cx
-                    jnz  @@1
-            db $66; sub  cx,cx
-                    mov  cx,BASE
-            db $66; sub  dx,dx
-            db $66; div  cx
-            db $66; mov  word ptr [s1],dx   // s1 := s1 mod BASE
-            db $66; sub  dx,dx
-            db $66; mov  ax,di
-            db $66; div  cx
-            db $66; mov  word ptr [s2],dx   // s2 := s2 mod BASE
-                    mov  word ptr [msg],si  // save offset for next chunk
-    end;
-    dec(len, n);
-  end;
-  LH(adler).L := word(s1);
-  LH(adler).H := word(s2);
-end;
-*)
-
-procedure Adler32Update(var adler: longint; Msg: pointer; Len: longint);
-  {-update Adler32 with Msg data}
-const
-  BASE = 65521; {max. prime < 65536 }
-  NMAX =  3854; {max. n with 255n(n+1)/2 + (n+1)(BASE-1) < 2^31}
-type
-  LH    = packed record
-            L,H: word;
-          end;
-var
-  s1,s2: longint;
-  i,n: integer;
-begin
-  s1 := LH(adler).L;
-  s2 := LH(adler).H;
-  while Len > 0 do begin
-    if Len<NMAX then n := Len else n := NMAX;
-    for i:=1 to n do begin
-      inc(s1, pByte(Msg)^);
-      inc(Msg);
-      inc(s2, s1);
-    end;
-    s1 := s1 mod BASE;
-    s2 := s2 mod BASE;
-    dec(len, n);
-  end;
-  LH(adler).L := word(s1);
-  LH(adler).H := word(s2);
-end;
-
-end.
+unit Adler32;
+
+{ZLib - Adler32 checksum function}
+
+
+interface
+
+(*************************************************************************
+
+ DESCRIPTION     :  ZLib - Adler32 checksum function
+
+ REQUIREMENTS    :  TP5-7, D1-D7/D9-D10/D12, FPC, VP
+
+ EXTERNAL DATA   :  ---
+
+ MEMORY USAGE    :  ---
+
+ DISPLAY MODE    :  ---
+
+ REFERENCES      :  RFC 1950 (http://tools.ietf.org/html/rfc1950)
+
+
+ Version  Date      Author      Modification
+ -------  --------  -------     ------------------------------------------
+ 0.10     30.08.03  W.Ehrhardt  Initial version based on MD5 layout
+ 2.10     30.08.03  we          Common vers., XL versions for Win32
+ 2.20     27.09.03  we          FPC/go32v2
+ 2.30     05.10.03  we          STD.INC, TP5.0
+ 2.40     10.10.03  we          common version, english comments
+ 3.00     01.12.03  we          Common version 3.0
+ 3.01     22.05.05  we          Adler32UpdateXL (i,n: integer)
+ 3.02     17.12.05  we          Force $I- in Adler32File
+ 3.03     07.08.06  we          $ifdef BIT32: (const fname: shortstring...)
+ 3.04     10.02.07  we          Adler32File: no eof, XL and filemode via $ifdef
+ 3.05     04.07.07  we          BASM16: speed-up factor 15
+ 3.06     12.11.08  we          uses BTypes, Ptr2Inc and/or Str255
+ 3.07     25.04.09  we          updated RFC URL(s)
+ 3.08     19.07.09  we          D12 fix: assign with typecast string(fname)
+**************************************************************************)
+
+(*-------------------------------------------------------------------------
+ (C) Copyright 2002-2009 Wolfgang Ehrhardt
+
+ This software is provided 'as-is', without any express or implied warranty.
+ In no event will the authors be held liable for any damages arising from
+ the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+    claim that you wrote the original software. If you use this software in
+    a product, an acknowledgment in the product documentation would be
+    appreciated but is not required.
+
+ 2. Altered source versions must be plainly marked as such, and must not be
+    misrepresented as being the original software.
+
+ 3. This notice may not be removed or altered from any source distribution.
+----------------------------------------------------------------------------*)
+
+(*
+As per the license above, noting that this implementation of adler32 was stripped of everything we didn't need.
+That means no btypes, file loading, and the assembly version disabled.
+*)
+
+procedure Adler32Update(var adler: longint; Msg: pointer; Len: longint);
+
+implementation
+
+(*
+$ifdef BASM16
+
+procedure Adler32Update(var adler: longint; Msg: pointer; Len: longint);
+  //-update Adler32 with Msg data
+const
+  BASE = 65521; // max. prime < 65536
+  NMAX =  5552; // max. n with 255n(n+1)/2 + (n+1)(BASE-1) < 2^32
+type
+  LH    = packed record
+            L,H: word;
+          end;
+var
+  s1,s2: longint;
+  n: integer;
+begin
+  s1 := LH(adler).L;
+  s2 := LH(adler).H;
+  while Len > 0 do begin
+    if Len<NMAX then n := Len else n := NMAX;
+    //BASM increases speed from about 52 cyc/byte to about 3.7 cyc/byte
+    asm
+                    mov  cx,[n]
+            db $66; mov  ax,word ptr [s1]
+            db $66; mov  di,word ptr [s2]
+                    les  si,[msg]
+      @@1:  db $66, $26, $0f, $b6, $1c      // movzx ebx,es:[si]
+                    inc  si
+            db $66; add  ax,bx              // inc(s1, pByte(Msg)^)
+            db $66; add  di,ax              // inc(s2, s1
+                    dec  cx
+                    jnz  @@1
+            db $66; sub  cx,cx
+                    mov  cx,BASE
+            db $66; sub  dx,dx
+            db $66; div  cx
+            db $66; mov  word ptr [s1],dx   // s1 := s1 mod BASE
+            db $66; sub  dx,dx
+            db $66; mov  ax,di
+            db $66; div  cx
+            db $66; mov  word ptr [s2],dx   // s2 := s2 mod BASE
+                    mov  word ptr [msg],si  // save offset for next chunk
+    end;
+    dec(len, n);
+  end;
+  LH(adler).L := word(s1);
+  LH(adler).H := word(s2);
+end;
+*)
+
+procedure Adler32Update(var adler: longint; Msg: pointer; Len: longint);
+  {-update Adler32 with Msg data}
+const
+  BASE = 65521; {max. prime < 65536 }
+  NMAX =  3854; {max. n with 255n(n+1)/2 + (n+1)(BASE-1) < 2^31}
+type
+  LH    = packed record
+            L,H: word;
+          end;
+var
+  s1,s2: longint;
+  i,n: integer;
+begin
+  s1 := LH(adler).L;
+  s2 := LH(adler).H;
+  while Len > 0 do begin
+    if Len<NMAX then n := Len else n := NMAX;
+    for i:=1 to n do begin
+      inc(s1, pByte(Msg)^);
+      inc(Msg);
+      inc(s2, s1);
+    end;
+    s1 := s1 mod BASE;
+    s2 := s2 mod BASE;
+    dec(len, n);
+  end;
+  LH(adler).L := word(s1);
+  LH(adler).H := word(s2);
+end;
+
+end.
--- a/misc/libopenalbridge/openalbridge_t.h	Fri Aug 20 11:26:27 2010 -0400
+++ b/misc/libopenalbridge/openalbridge_t.h	Fri Aug 20 11:52:08 2010 -0400
@@ -1,74 +1,74 @@
-/*
- * OpenAL Bridge - a simple portable library for OpenAL interface
- * Copyright (c) 2009 Vittorio Giovara <vittorio.giovara@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#include <stdint.h>
-#include "al.h"
-
-#ifndef _OALB_INTERFACE_TYPES_H
-#define _OALB_INTERFACE_TYPES_H
-
-enum al_fade_enum {AL_FADE_IN, AL_FADE_OUT};
-typedef enum al_fade_enum al_fade_t;
-
-
-// data type to handle which source source is playing what
-#pragma pack(1)
-typedef struct _al_sound_t {
-    const char *filename;       // name of the sound file
-    ALuint buffer;              // actual sound content
-    uint32_t source_index;      // index of the associated source
-    ALboolean is_used;          // tells if the element can be overwritten
-} al_sound_t;
-#pragma pack()
-
-
-// data type for passing data between threads
-#pragma pack(1)
-typedef struct _fade_t {
-    uint32_t index;
-    uint16_t quantity;
-    al_fade_t type;
-} fade_t;
-#pragma pack()
-
-
-// data type for WAV header
-#pragma pack(1)
-typedef struct _WAV_header_t {
-    uint32_t ChunkID;
-    uint32_t ChunkSize;
-    uint32_t Format;
-    uint32_t Subchunk1ID;
-    uint32_t Subchunk1Size;
-    uint16_t AudioFormat;
-    uint16_t NumChannels;
-    uint32_t SampleRate;
-    uint32_t ByteRate;
-    uint16_t BlockAlign;
-    uint16_t BitsPerSample;
-    uint32_t Subchunk2ID;
-    uint32_t Subchunk2Size;
-} WAV_header_t;
-#pragma pack()
-
-
-#ifdef __CPLUSPLUS
-}
-#endif
-
-#endif /*_OALB_INTERFACE_TYPES_H*/
+/*
+ * OpenAL Bridge - a simple portable library for OpenAL interface
+ * Copyright (c) 2009 Vittorio Giovara <vittorio.giovara@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#include <stdint.h>
+#include "al.h"
+
+#ifndef _OALB_INTERFACE_TYPES_H
+#define _OALB_INTERFACE_TYPES_H
+
+enum al_fade_enum {AL_FADE_IN, AL_FADE_OUT};
+typedef enum al_fade_enum al_fade_t;
+
+
+// data type to handle which source source is playing what
+#pragma pack(1)
+typedef struct _al_sound_t {
+    const char *filename;       // name of the sound file
+    ALuint buffer;              // actual sound content
+    uint32_t source_index;      // index of the associated source
+    ALboolean is_used;          // tells if the element can be overwritten
+} al_sound_t;
+#pragma pack()
+
+
+// data type for passing data between threads
+#pragma pack(1)
+typedef struct _fade_t {
+    uint32_t index;
+    uint16_t quantity;
+    al_fade_t type;
+} fade_t;
+#pragma pack()
+
+
+// data type for WAV header
+#pragma pack(1)
+typedef struct _WAV_header_t {
+    uint32_t ChunkID;
+    uint32_t ChunkSize;
+    uint32_t Format;
+    uint32_t Subchunk1ID;
+    uint32_t Subchunk1Size;
+    uint16_t AudioFormat;
+    uint16_t NumChannels;
+    uint32_t SampleRate;
+    uint32_t ByteRate;
+    uint16_t BlockAlign;
+    uint16_t BitsPerSample;
+    uint32_t Subchunk2ID;
+    uint32_t Subchunk2Size;
+} WAV_header_t;
+#pragma pack()
+
+
+#ifdef __CPLUSPLUS
+}
+#endif
+
+#endif /*_OALB_INTERFACE_TYPES_H*/