~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/packages/base/pasjpeg/jinclude.pas

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Unit jinclude;
 
2
 
 
3
{ This file exists to provide a single place to fix any problems with
 
4
  including the wrong system include files.  (Common problems are taken
 
5
  care of by the standard jconfig symbols, but on really weird systems
 
6
  you may have to edit this file.)
 
7
 
 
8
  NOTE: this file is NOT intended to be included by applications using the
 
9
  JPEG library.  Most applications need only include jpeglib.h. }
 
10
 
 
11
{ Original: jinclude.h Copyright (C) 1991-1994, Thomas G. Lane. }
 
12
 
 
13
interface
 
14
 
 
15
{$I jconfig.inc}
 
16
 
 
17
{ Include auto-config file to find out which system include files we need. }
 
18
 
 
19
uses
 
20
{$ifdef Delphi_Stream}
 
21
  classes,
 
22
{$endif}
 
23
  jmorecfg;
 
24
 
 
25
{ Nomssi:
 
26
  To write a dest/source manager that handle streams rather than files,
 
27
  you can edit the FILEptr definition and the JFREAD() and JFWRITE()
 
28
  functions in this unit, you don't need to change the default managers
 
29
  JDATASRC and JDATADST. }
 
30
 
 
31
{$ifdef Delphi_Stream}
 
32
type
 
33
  FILEptr = ^TStream;
 
34
{$else}
 
35
  {$ifdef Delphi_Jpeg}
 
36
  type
 
37
    FILEptr = TCustomMemoryStream;
 
38
  {$else}
 
39
  type
 
40
    FILEptr = ^File;
 
41
  {$endif}
 
42
{$endif}
 
43
 
 
44
{ We need the NULL macro and size_t typedef.
 
45
  On an ANSI-conforming system it is sufficient to include <stddef.h>.
 
46
  Otherwise, we get them from <stdlib.h> or <stdio.h>; we may have to
 
47
  pull in <sys/types.h> as well.
 
48
  Note that the core JPEG library does not require <stdio.h>;
 
49
  only the default error handler and data source/destination modules do.
 
50
  But we must pull it in because of the references to FILE in jpeglib.h.
 
51
  You can remove those references if you want to compile without <stdio.h>.}
 
52
 
 
53
 
 
54
 
 
55
{ We need memory copying and zeroing functions, plus strncpy().
 
56
  ANSI and System V implementations declare these in <string.h>.
 
57
  BSD doesn't have the mem() functions, but it does have bcopy()/bzero().
 
58
  Some systems may declare memset and memcpy in <memory.h>.
 
59
 
 
60
  NOTE: we assume the size parameters to these functions are of type size_t.
 
61
  Change the casts in these macros if not! }
 
62
 
 
63
procedure MEMZERO(target : pointer; size : size_t);
 
64
 
 
65
procedure MEMCOPY(dest, src : pointer; size : size_t);
 
66
 
 
67
{function SIZEOF(object) : size_t;}
 
68
 
 
69
function JFREAD(fp : FILEptr; buf : pointer; sizeofbuf : size_t) : size_t;
 
70
 
 
71
function JFWRITE(fp : FILEptr; buf : pointer; sizeofbuf : size_t) : size_t;
 
72
 
 
73
implementation
 
74
 
 
75
procedure MEMZERO(target : pointer; size : size_t);
 
76
begin
 
77
  FillChar(target^, size, 0);
 
78
end;
 
79
 
 
80
procedure MEMCOPY(dest, src : pointer; size : size_t);
 
81
begin
 
82
  Move(src^, dest^, size);
 
83
end;
 
84
 
 
85
{ In ANSI C, and indeed any rational implementation, size_t is also the
 
86
  type returned by sizeof().  However, it seems there are some irrational
 
87
  implementations out there, in which sizeof() returns an int even though
 
88
  size_t is defined as long or unsigned long.  To ensure consistent results
 
89
  we always use this SIZEOF() macro in place of using sizeof() directly. }
 
90
 
 
91
 
 
92
{#define
 
93
  SIZEOF(object)  (size_t(sizeof(object))}
 
94
 
 
95
 
 
96
{ The modules that use fread() and fwrite() always invoke them through
 
97
  these macros.  On some systems you may need to twiddle the argument casts.
 
98
  CAUTION: argument order is different from underlying functions! }
 
99
 
 
100
 
 
101
function JFREAD(fp : FILEptr; buf : pointer; sizeofbuf : size_t) : size_t;
 
102
var
 
103
  count : uint;
 
104
begin
 
105
  {$ifdef Delphi_Stream}
 
106
  count := fp^.Read(buf^, sizeofbuf);
 
107
  {$else}
 
108
     blockread(fp^, buf^, sizeofbuf, count);
 
109
  {$endif}
 
110
  JFREAD := size_t(count);
 
111
end;
 
112
 
 
113
function JFWRITE(fp : FILEptr; buf : pointer; sizeofbuf : size_t) : size_t;
 
114
var
 
115
  count : uint;
 
116
begin
 
117
  {$ifdef Delphi_Stream}
 
118
  count := fp^.Write(buf^, sizeofbuf);
 
119
  {$else}
 
120
     blockwrite(fp^, buf^, sizeofbuf, count);
 
121
  {$endif}
 
122
  JFWRITE := size_t(count);
 
123
end;
 
124
 
 
125
 
 
126
end.