file_palmos.c
上传用户:wstnjxml
上传日期:2014-04-03
资源大小:7248k
文件大小:2k
源码类别:

Windows CE

开发平台:

C/C++

  1. /*****************************************************************************
  2.  *
  3.  * This program is free software ; you can redistribute it and/or modify
  4.  * it under the terms of the GNU General Public License as published by
  5.  * the Free Software Foundation; either version 2 of the License, or
  6.  * (at your option) any later version.
  7.  *
  8.  * This program is distributed in the hope that it will be useful,
  9.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11.  * GNU General Public License for more details.
  12.  *
  13.  * You should have received a copy of the GNU General Public License
  14.  * along with this program; if not, write to the Free Software
  15.  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  16.  *
  17.  * $Id: file_palmos.c 332 2005-11-06 14:31:57Z picard $
  18.  *
  19.  * The Core Pocket Media Player
  20.  * Copyright (c) 2004-2005 Gabor Kovacs
  21.  *
  22.  ****************************************************************************/
  23. #include "../common.h"
  24. // this is not a real file reader 
  25. // just directory listing for different storage places
  26. #if defined(TARGET_PALMOS)
  27. #include "pace.h"
  28. typedef struct file
  29. {
  30. stream Stream;
  31. bool_t FileDb;
  32. UInt32 Iter;
  33. } file;
  34. static int EnumDir(file* p,const tchar_t* URL,const tchar_t* Exts,bool_t ExtFilter,streamdir* Item)
  35. {
  36. UInt16 Ref;
  37. if (URL)
  38. {
  39. p->FileDb = 0;
  40. if (NodeEnumClass(NULL,VFS_ID))
  41. p->Iter = vfsIteratorStart;
  42. else
  43. p->Iter = vfsIteratorStop;
  44. }
  45. Item->FileName[0] = 0;
  46. Item->DisplayName[0] = 0;
  47. Item->Size = -1;
  48. Item->Date = -1;
  49. while (!Item->FileName[0] && p->Iter != vfsIteratorStop && VFSVolumeEnumerate(&Ref,&p->Iter)==errNone)
  50. VFSFromVol(Ref,NULL,Item->FileName,TSIZEOF(Item->FileName));
  51. if (!Item->FileName[0] && !p->FileDb)
  52. {
  53. p->FileDb = 1;
  54. tcscpy_s(Item->FileName,TSIZEOF(Item->FileName),T("mem://"));
  55. }
  56. return Item->FileName[0] ? ERR_NONE : ERR_END_OF_FILE;
  57. }
  58. static int Create(file* p)
  59. {
  60. p->Stream.EnumDir = (streamenumdir)EnumDir;
  61. p->Iter = vfsIteratorStart;
  62. return ERR_NONE;
  63. }
  64. static const nodedef File = 
  65. {
  66. sizeof(file),
  67. FILE_ID,
  68. STREAM_CLASS,
  69. PRI_MINIMUM,
  70. (nodecreate)Create,
  71. };
  72. void File_Init()
  73. {
  74. NodeRegisterClass(&File);
  75. }
  76. void File_Done()
  77. {
  78. NodeUnRegisterClass(FILE_ID);
  79. }
  80. stream* FileCreate(const tchar_t* Path)
  81. {
  82. //todo: for benchmark result saving
  83. return NULL;
  84. }
  85. void FileRelease(stream* p)
  86. {
  87. }
  88. #endif