1{ Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements.  See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License.  You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 }
16
17{
18 * Structures and types used to implement opendir/readdir/closedir
19 * on Windows 95/NT.
20 }
21
22{$ifdef WINDOWS}
23
24{#include <io.h>
25#include <stdio.h>
26#include <stdlib.h>
27#include <sys/types.h>
28
29#ifndef API_EXPORT
30# define API_EXPORT(type)    __declspec(dllexport) type __stdcall
31#endif}
32
33{ struct dirent - same as Unix }
34
35const
36  _MAX_FNAME = 256;
37
38type
39  dirent = record
40    d_ino: clong;                         { inode (always 1 in WIN32) }
41    d_off: off_t;                         { offset to this dirent }
42    d_reclen: cushort;                    { length of d_name }
43    d_name: array[0.._MAX_FNAME] of Char;    { filename (null terminated) }
44  end;
45
46{ typedef DIR - not the same as Unix }
47  DIR = record
48    handle: clong;                 { _findfirst/_findnext handle }
49    offset: cshort;                { offset into directory }
50    finished: cshort;              { 1 if there are not more files }
51//    struct _finddata_t fileinfo; { from _findfirst/_findnext }
52    fileinfo: Pointer;             { from _findfirst/_findnext }
53    dir: PChar;                    { the dir we are reading }
54    dent: dirent;                  { the dirent to return }
55  end;
56
57  PDIR = ^DIR;
58
59{ Function prototypes }
60{API_EXPORT(DIR *) opendir(const char *);
61API_EXPORT(struct dirent *) readdir(DIR *);
62API_EXPORT(int) closedir(DIR *);}
63
64  va_list = Pointer;
65
66{
67 * Simplified declarations for other platforms
68 }
69
70{$else}
71
72  PDIR = Pointer;
73
74  va_list = Pointer;
75
76{$endif} { WINDOWS }
77
78