summaryrefslogtreecommitdiff
path: root/uisimulator/win32
diff options
context:
space:
mode:
authorHardeep Sidhu <dyp@pobox.com>2004-06-14 07:00:50 +0000
committerHardeep Sidhu <dyp@pobox.com>2004-06-14 07:00:50 +0000
commitfb26bfb662e7939b6646d290ad658fe1bdbffc8e (patch)
tree6db2aa5049259834333885891f7af6903625cbe2 /uisimulator/win32
parent2dafebfe1698ee32cce48b9cf4cb3b59a17b295d (diff)
downloadrockbox-fb26bfb662e7939b6646d290ad658fe1bdbffc8e.tar.gz
rockbox-fb26bfb662e7939b6646d290ad658fe1bdbffc8e.zip
Fixed VC++ build.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4739 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/win32')
-rw-r--r--uisimulator/win32/dir-win32.c91
-rw-r--r--uisimulator/win32/dir-win32.h47
-rw-r--r--uisimulator/win32/rockbox.dsp6
3 files changed, 141 insertions, 3 deletions
diff --git a/uisimulator/win32/dir-win32.c b/uisimulator/win32/dir-win32.c
new file mode 100644
index 0000000000..6f14e798be
--- /dev/null
+++ b/uisimulator/win32/dir-win32.c
@@ -0,0 +1,91 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Felix Arends
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include <io.h>
21#include <windows.h>
22#include <malloc.h>
23#include "dir-win32.h"
24
25// Directory operations
26//
27
28// opendir
29// open directory for scanning
30DIR *opendir (
31 const char *dirname // directory name
32 )
33{
34 DIR *p = (DIR*)malloc(sizeof(DIR));
35 struct _finddata_t fd;
36 unsigned int i;
37 char *s = (char*)malloc(strlen(dirname) + 5);
38 wsprintf (s, "%s", dirname);
39
40 for (i = 0; i < strlen(s); i++)
41 if (s[i] == '/')
42 s[i] = '\\';
43
44 if (s[i - 1] != '\\')
45 {
46 s[i] = '\\';
47 s[++i] = '\0';
48 }
49
50 OutputDebugString (s);
51
52 wsprintf (s, "%s*.*", s);
53
54 if ((p->handle = _findfirst (s, &fd)) == -1)
55 {
56 free (s);
57 free (p);
58 return 0;
59 }
60 free (s);
61 return p;
62}
63
64// closedir
65// close directory
66int closedir (
67 DIR *dir // previously opened dir search
68 )
69{
70 free(dir);
71 return 0;
72}
73
74// read dir
75// read next entry in directory
76struct dirent *readdir (
77 DIR *dir
78 )
79{
80 struct _finddata_t fd;
81 if (_findnext (dir->handle, &fd) == -1)
82 return 0;
83 memcpy (dir->fd.d_name, fd.name, 256);
84
85 dir->fd.attribute = fd.attrib & 0x3f;
86 dir->fd.size = fd.size;
87 dir->fd.startcluster = 0 ;
88
89
90 return &dir->fd;
91}
diff --git a/uisimulator/win32/dir-win32.h b/uisimulator/win32/dir-win32.h
new file mode 100644
index 0000000000..888a83767a
--- /dev/null
+++ b/uisimulator/win32/dir-win32.h
@@ -0,0 +1,47 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Björn Stenberg
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#ifndef _DIR_WIN32_H_
20#define _DIR_WIN32_H_
21
22#include <stdbool.h>
23#include "file.h"
24
25struct dirent {
26 unsigned char d_name[MAX_PATH];
27 int attribute;
28 int size;
29 int startcluster;
30};
31
32typedef struct
33{
34 struct dirent fd;
35 int handle;
36} DIR;
37
38extern DIR* opendir(const char* name);
39extern int closedir(DIR* dir);
40extern int mkdir(const char* name);
41extern int rmdir(const char* name);
42
43extern struct dirent* readdir(DIR* dir);
44
45#define S_ISDIR(x) (((x) & _S_IFDIR) == _S_IFDIR)
46
47#endif
diff --git a/uisimulator/win32/rockbox.dsp b/uisimulator/win32/rockbox.dsp
index 8e1a092c5c..4c54889c97 100644
--- a/uisimulator/win32/rockbox.dsp
+++ b/uisimulator/win32/rockbox.dsp
@@ -43,7 +43,7 @@ RSC=rc.exe
43# PROP Ignore_Export_Lib 0 43# PROP Ignore_Export_Lib 0
44# PROP Target_Dir "" 44# PROP Target_Dir ""
45# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c 45# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
46# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../firmware/export" /I "../../firmware/drivers" /I "../../firmware/common" /I "../common" /I "../win32" /I "../../apps" /I "../../apps/recorder" /D "HAVE_LCD_BITMAP" /D "HAVE_RECORDER_KEYPAD" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "HAVE_CONFIG_H" /D "GETTIMEOFDAY_TWO_ARGS" /D "SIMULATOR" /D "HAVE_RTC" /D APPSVERSION=\"WIN32SIM\" /FR /YX /FD /GZ /c 46# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../win32" /I "../../apps/recorder" /I "../../firmware/export" /I "../../firmware/drivers" /I "../../firmware/common" /I "../common" /I "../../apps" /D "HAVE_LCD_BITMAP" /D "HAVE_RECORDER_KEYPAD" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "HAVE_CONFIG_H" /D "GETTIMEOFDAY_TWO_ARGS" /D "SIMULATOR" /D "HAVE_RTC" /D APPSVERSION=\"WIN32SIM\" /FR /YX /FD /GZ /c
47# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 47# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
48# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 48# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
49# ADD BASE RSC /l 0x407 /d "_DEBUG" 49# ADD BASE RSC /l 0x407 /d "_DEBUG"
@@ -69,7 +69,7 @@ LINK32=link.exe
69# PROP Ignore_Export_Lib 0 69# PROP Ignore_Export_Lib 0
70# PROP Target_Dir "" 70# PROP Target_Dir ""
71# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c 71# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
72# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../firmware/export" /I "../../firmware/drivers" /I "../../firmware/common" /I "../common" /I "../win32" /I "../../apps" /I "../../apps/player" /D "HAVE_LCD_CHARCELLS" /D "HAVE_PLAYER_KEYPAD" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "HAVE_CONFIG_H" /D "GETTIMEOFDAY_TWO_ARGS" /D "SIMULATOR" /D APPSVERSION=\"WIN32SIM\" /FR /YX /FD /GZ /c 72# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../win32" /I "../../apps/player" /I "../../firmware/export" /I "../../firmware/drivers" /I "../../firmware/common" /I "../common" /I "../../apps" /D "HAVE_LCD_CHARCELLS" /D "HAVE_PLAYER_KEYPAD" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "HAVE_CONFIG_H" /D "GETTIMEOFDAY_TWO_ARGS" /D "SIMULATOR" /D APPSVERSION=\"WIN32SIM\" /FR /YX /FD /GZ /c
73# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 73# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
74# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 74# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
75# ADD BASE RSC /l 0x407 /d "_DEBUG" 75# ADD BASE RSC /l 0x407 /d "_DEBUG"
@@ -478,7 +478,7 @@ SOURCE="..\common\font-player.c"
478# End Source File 478# End Source File
479# Begin Source File 479# Begin Source File
480 480
481SOURCE=.\io.c 481SOURCE=..\common\io.c
482# End Source File 482# End Source File
483# Begin Source File 483# Begin Source File
484 484