##############################################################################
#                                                                            #
# IAR ARM ANSI C/C++ Compiler V4.42A/W32 EVALUATION    14/Jan/2011  23:28:11 #
# Copyright 1999-2005 IAR Systems. All rights reserved.                      #
#                                                                            #
#    Cpu mode        =  interwork                                            #
#    Endian          =  little                                               #
#    Stack alignment =  4                                                    #
#    Source file     =  D:\pasha\elf\googlecode\MySMSYS\Mss3\File.cpp        #
#    Command line    =  D:\pasha\elf\googlecode\MySMSYS\Mss3\File.cpp -D     #
#                       NEWSGOLD -D ELKA -D LANG_EN -lcN                     #
#                       D:\pasha\elf\googlecode\MySMSYS\Mss3\Release_ELKA_EN #
#                       \List\ -o D:\pasha\elf\googlecode\MySMSYS\Mss3\Relea #
#                       se_ELKA_EN\Obj\ -s9 --no_unroll --cpu_mode arm       #
#                       --endian little --cpu ARM926EJ-S --stack_align 4     #
#                       --interwork -e --fpu None --eec++ --dlib_config      #
#                       "D:\pasha\Embedded Workbench 4.0                     #
#                       Evaluation2\ARM\LIB\dl5tpainl8n.h" -I                #
#                       "D:\pasha\Embedded Workbench 4.0                     #
#                       Evaluation2\ARM\INC\" --inline_threshold=2           #
#    List file       =  D:\pasha\elf\googlecode\MySMSYS\Mss3\Release_ELKA_EN #
#                       \List\File.lst                                       #
#    Object file     =  D:\pasha\elf\googlecode\MySMSYS\Mss3\Release_ELKA_EN #
#                       \Obj\File.r79                                        #
#                                                                            #
#                                                                            #
##############################################################################

D:\pasha\elf\googlecode\MySMSYS\Mss3\File.cpp
      1          #include "include.h"
      2          #include "File.h"
      3          
      4          int CFile::FOpen(const char * cFileName, unsigned int iFileFlags, unsigned int iFileMode)
      5          {
      6            return (fopen(cFileName, iFileFlags, iFileMode, &ferr));
      7          }
      8          
      9          int CFile::FRead(int FileHandler, void *cBuffer, int iByteCount)
     10          {
     11            return (fread(FileHandler, cBuffer, iByteCount, &ferr));
     12          }
     13          
     14          int CFile::FWrite(int FileHandler, void const * cBuffer, int iByteCount)
     15          {
     16            return (fwrite(FileHandler, cBuffer, iByteCount, &ferr));
     17          }
     18          
     19          void CFile::FClose(int FileHandler)
     20          {
     21            fclose(FileHandler, &ferr);
     22          }
     23          
     24          int CFile::LSeek(int FileHandler, unsigned int offset, unsigned int origin)
     25          {
     26            return (lseek(FileHandler, offset, origin, &ferr, &ferr));
     27          }
     28          
     29          int CFile::MkDir(const char * cFileName)
     30          {
     31            return (mkdir(cFileName, &ferr));
     32          }
     33          
     34          int CFile::IsDir(const char * cDirectory)
     35          {
     36            return (isdir(cDirectory, &ferr));
     37          }
     38          
     39          int CFile::FindFirstFile(DIR_ENTRY *DIRENTRY,char *mask)
     40          {
     41            return (::FindFirstFile(DIRENTRY, mask, &ferr));
     42          }
     43          
     44          int CFile::FindNextFile(DIR_ENTRY *DIRENTRY)
     45          {
     46            return (::FindNextFile(DIRENTRY, &ferr));
     47          }
     48          
     49          int CFile::FindClose(DIR_ENTRY *DIRENTRY)
     50          {
     51            return (::FindClose(DIRENTRY, &ferr));
     52          }
     53          
     54          int CFile::IsFileExist(const char *filepath)
     55          {
     56            FSTATS fst;
     57            if(GetFileStats(filepath, &fst, &ferr)==-1)
     58              return 0;
     59            else
     60              return 1;
     61          }
     62          
     63          int CFile::FDelete(const char * cFileName)
     64          {
     65            return (unlink(cFileName, &ferr));
     66          }
     67          
     68          int CFile::FMove(const char * SourceFileName, const char * DestFileName)
     69          {
     70            return (fmove(SourceFileName, DestFileName, &ferr));
     71          }
     72          
     73          
     74          #define MAX_CNT 40
     75          // -1:err, -2: >MAX_CNT
     76          int CFile::GetFileCountOfDir(const char *dirpath)
     77          {
     78            char folder[128];
     79            DIR_ENTRY de;
     80            int len;
     81            int c;
     82            int cnt=0;
     83            if(!dirpath
     84              || !IsDir(dirpath)
     85              )
     86              return -1;
     87            strcpy(folder, dirpath);
     88            if((len=strlen(folder))<3)
     89              return -1;
     90            c=folder[len-1];
     91            if(c!='\\'
     92              && c!='/'
     93              )
     94            {
     95              folder[len++]='\\';
     96              folder[len]='\0';
     97            }
     98            strcat(folder, "*.*");
     99            if(FindFirstFile(&de, folder))
    100            {
    101              do
    102              {
    103                if(cnt>=MAX_CNT)
    104                {
    105          	cnt=-2;
    106          	break;
    107                }
    108                cnt++;
    109              }while(FindNextFile(&de));
    110            }
    111            FindClose(&de);
    112            return cnt;
    113          }
    114          
    115          

   Maximum stack usage in bytes:

     Function                       CSTACK
     --------                       ------
     CFile::FClose(int)                 4
     CFile::FDelete(char const *)       4
     CFile::FMove(char const *, char const *)
                                        4
     CFile::FOpen(char const *, unsigned int, unsigned int)
                                        4
     CFile::FRead(int, void *, int)     4
     CFile::FWrite(int, void const *, int)
                                        4
     CFile::FindClose(DIR_ENTRY *)      4
     CFile::FindFirstFile(DIR_ENTRY *, char *)
                                        4
     CFile::FindNextFile(DIR_ENTRY *)
                                        4
     CFile::GetFileCountOfDir(char const *)
                                      980
     CFile::IsDir(char const *)         4
     CFile::IsFileExist(char const *)
                                       44
     CFile::LSeek(int, unsigned int, unsigned int)
                                        8
     CFile::MkDir(char const *)         4


   Segment part sizes:

     Function/Label                 Bytes
     --------------                 -----
     CFile::FOpen(char const *, unsigned int, unsigned int)
                                      32
     CFile::FRead(int, void *, int)   32
     CFile::FWrite(int, void const *, int)
                                      32
     CFile::FClose(int)               24
     CFile::LSeek(int, unsigned int, unsigned int)
                                      36
     CFile::MkDir(char const *)       24
     CFile::IsDir(char const *)       24
     CFile::FindFirstFile(DIR_ENTRY *, char *)
                                      28
     CFile::FindNextFile(DIR_ENTRY *)
                                      24
     CFile::FindClose(DIR_ENTRY *)    24
     CFile::IsFileExist(char const *)
                                      48
     CFile::FDelete(char const *)     24
     CFile::FMove(char const *, char const *)
                                      28
     CFile::GetFileCountOfDir(char const *)
                                     224
     ?<Constant "*.*">                 4
      Others                          56

 
 660 bytes in segment CODE
   4 bytes in segment DATA_C
 
 604 bytes of CODE  memory (+ 56 bytes shared)
   4 bytes of CONST memory

Errors: none
Warnings: none
