##############################################################################
#                                                                            #
# IAR ARM ANSI C/C++ Compiler V4.42A/W32 EVALUATION    14/Jan/2011  23:28:15 #
# Copyright 1999-2005 IAR Systems. All rights reserved.                      #
#                                                                            #
#    Cpu mode        =  interwork                                            #
#    Endian          =  little                                               #
#    Stack alignment =  4                                                    #
#    Source file     =  D:\pasha\elf\googlecode\MySMSYS\Mss3\LangPack.cpp    #
#    Command line    =  D:\pasha\elf\googlecode\MySMSYS\Mss3\LangPack.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\LangPack.lst                                   #
#    Object file     =  D:\pasha\elf\googlecode\MySMSYS\Mss3\Release_ELKA_EN #
#                       \Obj\LangPack.r79                                    #
#                                                                            #
#                                                                            #
##############################################################################

D:\pasha\elf\googlecode\MySMSYS\Mss3\LangPack.cpp
      1          #include "include.h"
      2          #include "File.h"
      3          #include "LangPack.h"
      4          
      5          
      6          
      7          const char df_LGP_OK[]="OK";
      8          const char df_LGP_BACK[]="Back";
      9          const char df_LGP_ADRBK[]="AddressBook";
     10          const char df_LGP_ERR[]="Error!";
     11          const char df_LGP_SELECT[]="Select";
     12          const char df_LGP_QUIT[]="Quit";
     13          const char df_LGP_NEW[]="NewSMS";
     14          const char df_LGP_IN_R[]="InReaded";
     15          const char df_LGP_IN_N[]="InNew";
     16          const char df_LGP_IN_A[]="InBox";
     17          const char df_LGP_SENT[]="Sent";
     18          const char df_LGP_DRAFT[]="Draft";
     19          const char df_LGP_ALL[]="AllSMS";
     20          const char df_LGP_OPTIONS[]="Options";
     21          const char df_LGP_ERR_0NUM[]="No Number !";
     22          const char df_LGP_EXIT[]="Exit";
     23          const char df_LGP_CANCEL[]="Cancel";
     24          const char df_LGP_SEND[]="Send";
     25          const char df_LGP_DEL[]="Delete";
     26          const char df_LGP_SAVE_AS_FILE[]="Save As File";
     27          const char df_LGP_SAVE_AS_DRAFT[]="Save As Draft";
     28          const char df_LGP_INSERT_ADRNUM[]="Insert Number Form AddressBook";
     29          const char df_LGP_INSERT_BLANKNUM[]="Insert Blank Number";
     30          const char df_LGP_CHAR_COUNT[]="Count";
     31          const char df_LGP_VIEW[]="View";
     32          const char df_LGP_EDIT[]="Edit";
     33          const char df_LGP_REPLY[]="Reply";
     34          const char df_LGP_NEW_MSG[]="New Message!";
     35          const char df_LGP_FROM[]="From";
     36          const char df_LGP_CODESHOW[]="CodeShow";
     37          const char df_LGP_FETION[]="Fetion";
     38          const char df_LGP_SAVEALL[]="Save All As File";
     39          const char df_LGP_CONFIG_UPDATE[]="MySMSYS Config Updated!";
     40          const char df_LGP_CONFIG[]="Settings";
     41          const char df_LGP_SAVE_ALL_ONE[]="Export All To One TXT";
     42          const char df_LGP_PLS_INPUT_PATH[]="Please Input The File Path:";
     43          const char df_LGP_OTHERS[]="Others";
     44          const char df_LGP_FILE_FAILED[]="File Operate Failed!";
     45          const char df_LGP_FILE_EXIST[]="File Existed!";
     46          const char df_LGP_EXPORT_TXT[]="Export As Txt";
     47          const char df_LGP_MOVE_ARCHIVE[]="Move To Archive";
     48          const char df_LGP_MOVE_ALL_MSS[]="Move All MSS To Archive";
     49          const char df_LGP_OPEN_ARCHIVE[]="Open Archive";
     50          const char df_LGP_EXPORT_N[]="Export %d SMS Successfully!";
     51          const char df_LGP_MOVE_MSSARCHIVER_N[]="Move %d Mss File to Archive Successfully!";
     52          const char df_LGP_DEL_ALL_MSS[]="Delete All Mss Files?";
     53          const char df_LGP_ABOUT[]="About...";
     54          const char df_LGP_COV_DAT_TXT[]="Cov SMS.dat To Txt";
     55          const char df_LGP_SAVE_ALL_AS_FILE[]="Save All As Files";
     56          const char df_LGP_SAF_N[]="Save %d SMS Successfully!";
     57          const char df_LGP_DEL_ALL[]="Delete All?";
     58          const char df_LGP_DEL_ALL_MSG[]="Delete All Message";
     59          const char df_LGP_MOVE_ALL[]="Move All To Archive";
     60          const char df_LGP_DEL_ALL_MSG_MSS[]="Delete All Mss";
     61          const char df_LGP_SAVE[]="Save";
     62          const char df_LGP_MSG_REPORT[]="Message Report";
     63          const char df_LGP_MSG_REVEICED[]="Message received at"; //后加时间
     64          const char df_LGP_UNK_RP_STATUS[]="SMS Report: Unknow Status";
     65          const char df_LGP_TEMPLATE[]="Template";
     66          const char df_LGP_CALL_ADDRESSBOOK[]="Call Addressbook";
     67          const char df_LGP_STATISTICS[]="Statistics";
     68          const char df_LGP_IN_SMSDAT[]="in SMS.dat";
     69          const char df_LGP_IS_MSSFILE[]="is Mss File";
     70          const char df_LGP_DAT_FREE[]="Free";
     71          const char df_LGP_DISK_FREE[]="Free in Disk";
     72          const char df_LGP_MSS_MAINMENU[]="Mss MainMenu";
     73          const char df_LGP_TRANSLIT[]="Translit";
     74          const char df_LGP_TIME[]="Time";
     75          const char df_LGP_UNK_NUM[]="Unknow Number";
     76          const char df_LGP_NUMBER[]="Number";
     77          const char df_LGP_TEXT[]="Text";
     78          const char df_LGP_TO[]="To";
     79          const char df_LGP_UNK[]="Unknow";
     80          const char df_LGP_FILTER[]="Fliter";
     81          const char df_LGP_INSERT_NUM[]="Ins. Num";
     82          const char df_LGP_HELP[]="Help";
     83          const char df_LGP_DEL_N[]="%d SMS Deleted!";
     84          const char df_LGP_CALL[]="Call";
     85          
     86          const char *df_LGPS[]=
     87          {
     88            df_LGP_OK,
     89            df_LGP_BACK,
     90            df_LGP_ADRBK,
     91            df_LGP_ERR,
     92            df_LGP_SELECT,
     93            df_LGP_QUIT,
     94            df_LGP_NEW,
     95            df_LGP_IN_R,
     96            df_LGP_IN_N,
     97            df_LGP_IN_A,
     98            df_LGP_SENT,
     99            df_LGP_DRAFT,
    100            df_LGP_ALL,
    101            df_LGP_OPTIONS,
    102            df_LGP_ERR_0NUM,
    103            df_LGP_EXIT,
    104            df_LGP_CANCEL,
    105            df_LGP_SEND,
    106            df_LGP_DEL,
    107            df_LGP_SAVE_AS_FILE,
    108            df_LGP_SAVE_AS_DRAFT,
    109            df_LGP_INSERT_ADRNUM,
    110            df_LGP_INSERT_BLANKNUM,
    111            df_LGP_CHAR_COUNT,
    112            df_LGP_VIEW,
    113            df_LGP_EDIT,
    114            df_LGP_REPLY,
    115            df_LGP_NEW_MSG,
    116            df_LGP_FROM,
    117            df_LGP_CODESHOW,
    118            df_LGP_FETION,
    119            df_LGP_SAVEALL,
    120            df_LGP_CONFIG_UPDATE,
    121            df_LGP_CONFIG,
    122            df_LGP_SAVE_ALL_ONE,
    123            df_LGP_PLS_INPUT_PATH,
    124            df_LGP_OTHERS,
    125            df_LGP_FILE_FAILED,
    126            df_LGP_FILE_EXIST,
    127            df_LGP_EXPORT_TXT,
    128            df_LGP_MOVE_ARCHIVE,
    129            df_LGP_MOVE_ALL_MSS,
    130            df_LGP_OPEN_ARCHIVE,
    131            df_LGP_EXPORT_N,
    132            df_LGP_MOVE_MSSARCHIVER_N,
    133            df_LGP_DEL_ALL_MSS,
    134            df_LGP_ABOUT,
    135            df_LGP_COV_DAT_TXT,
    136            df_LGP_SAVE_ALL_AS_FILE,
    137            df_LGP_SAF_N,
    138            df_LGP_DEL_ALL,
    139            df_LGP_DEL_ALL_MSG,
    140            df_LGP_MOVE_ALL,
    141            df_LGP_DEL_ALL_MSG_MSS,
    142            df_LGP_SAVE,
    143            df_LGP_MSG_REPORT,
    144            df_LGP_MSG_REVEICED, //后加时间
    145            df_LGP_UNK_RP_STATUS,
    146            df_LGP_TEMPLATE,
    147            df_LGP_CALL_ADDRESSBOOK,
    148            df_LGP_STATISTICS,
    149            df_LGP_IN_SMSDAT,
    150            df_LGP_IS_MSSFILE,
    151            df_LGP_DAT_FREE,
    152            df_LGP_DISK_FREE,
    153            df_LGP_MSS_MAINMENU,
    154            df_LGP_TRANSLIT,
    155            df_LGP_TIME,
    156            df_LGP_UNK_NUM,
    157            df_LGP_NUMBER,
    158            df_LGP_TEXT,
    159            df_LGP_TO,
    160            df_LGP_UNK,
    161            df_LGP_FILTER,
    162            df_LGP_INSERT_NUM,
    163            df_LGP_HELP,
    164            df_LGP_DEL_N,
    165            df_LGP_CALL,
    166            0,
    167          };
    168          
    169          void LangPack::FreeLangPack(void)
    170          {
    171            LoadLgpDefault();
    172            if(this->lang_buf)
    173            {
    174              delete this->lang_buf;
    175              this->lang_buf=NULL;
    176            }
    177          }
    178          
    179          void LangPack::LoadLangPack(void)
    180          {
    181            LoadLgpDefault();
    182            LoadLangFile();
    183            InitLgp();
    184          }
    185          
    186          void LangPack::LoadLangFile(void)
    187          {
    188            char fpath[128], *p, **lp, *pp;
    189            int /*len, c,*/ fin, size, mn, i;
    190            strcpy(fpath, main_folder);
    191            //len=strlen(fpath);
    192            //c=fpath[len-1];
    193            //if(c!='\\' && c!='/')
    194            //{
    195            //  fpath[len]='\\';
    196            //  fpath[len+1]=0;
    197            //}
    198            if(!IsDir(fpath))
    199              return;
    200            strcat(fpath, "lang.txt");
    201            if((fin=FOpen(fpath, A_BIN+A_ReadOnly, P_READ))==-1)
    202              return;
    203            size=LSeek(fin, 0, S_END);
    204            if(!size)
    205            {
    206              FClose(fin);
    207              return;
    208            }
    209            this->lang_buf=new char[(size+3)&(~3)];
    210            LSeek(fin, 0, S_SET);
    211            if(FRead(fin, lang_buf, size)!=size)
    212            {
    213              FClose(fin);
    214              return;
    215            }
    216            FClose(fin);
    217            this->lang_buf[size]=0;
    218            p=this->lang_buf;
    219            lp=(char **)(&lgp);
    220            mn=sizeof(LGPACK)/sizeof(char *);
    221            for(i=0;i<mn;i++)
    222            {
    223              if(!(pp=GotoLangLineStart(p)))
    224                break;
    225              lp[i]=pp;
    226              if(!(pp=GotoLangLineEnd(pp)))
    227                break;
    228              *pp++=0;
    229              p=pp;
    230            }
    231          }
    232          
    233          void LangPack::LoadLgpDefault(void)
    234          {
    235            memcpy(&this->lgp, df_LGPS, sizeof(LGPACK));
    236          }
    237          
    238          char *LangPack::GotoLangLineEnd(char *buf)
    239          {
    240            int c;
    241            char *p=buf;
    242            while((c=*p))
    243            {
    244              if(c=='\r' || c=='\n')
    245                return p;
    246              p++;
    247            }
    248            return 0;
    249          }
    250          
    251          char *LangPack::GotoLangLineStart(char *buf)
    252          {
    253            int c;
    254            char *p=buf;
    255            while((c=*p))
    256            {
    257              if(c>=0x1F)
    258                return p; 
    259              p++;
    260            }
    261            return 0;
    262          }
    263            
    264          
    265          void LangPack::InitLgp(void)
    266          {
    267            //mainmenu.cpp
    268            extern SOFTKEY_DESC main_menu_sk[]; 
    269            extern HEADER_DESC main_menuhdr;
    270            extern int MM_ITEM_LGPS[];
    271            main_menu_sk[0].lgp_id=(int)lgp.LGP_SELECT;
    272            main_menu_sk[1].lgp_id=(int)lgp.LGP_QUIT;
    273            main_menuhdr.lgp_id=(int)lgp.LGP_MSS_MAINMENU;
    274            MM_ITEM_LGPS[0]=(int)lgp.LGP_NEW;
    275            MM_ITEM_LGPS[1]=(int)lgp.LGP_IN_N;
    276            MM_ITEM_LGPS[2]=(int)lgp.LGP_IN_A;
    277            MM_ITEM_LGPS[3]=(int)lgp.LGP_SENT;
    278            MM_ITEM_LGPS[4]=(int)lgp.LGP_DRAFT;
    279            MM_ITEM_LGPS[5]=(int)lgp.LGP_OTHERS;
    280          
    281            //SmsListMenu.cpp
    282            extern SOFTKEY_DESC sms_menu_sk[];
    283            extern int SLM_HDR_LGPS[];
    284            extern int SOP_ITEM_LGPS[];
    285            sms_menu_sk[0].lgp_id=(int)lgp.LGP_OPTIONS;
    286            sms_menu_sk[1].lgp_id=(int)lgp.LGP_BACK;
    287            SLM_HDR_LGPS[0]=(int)lgp.LGP_FILTER;
    288            SLM_HDR_LGPS[1]=(int)lgp.LGP_SENT;
    289            SLM_HDR_LGPS[2]=(int)lgp.LGP_IN_R;
    290            SLM_HDR_LGPS[3]=(int)lgp.LGP_IN_N;
    291            SLM_HDR_LGPS[4]=(int)lgp.LGP_DRAFT;
    292            SLM_HDR_LGPS[5]=(int)lgp.LGP_IN_A;
    293            
    294            SOP_ITEM_LGPS[0]=(int)lgp.LGP_REPLY;
    295            SOP_ITEM_LGPS[1]=(int)lgp.LGP_EDIT;
    296            SOP_ITEM_LGPS[2]=(int)lgp.LGP_DEL;
    297            SOP_ITEM_LGPS[4]=(int)lgp.LGP_CALL;
    298            SOP_ITEM_LGPS[5]=(int)lgp.LGP_MOVE_ARCHIVE;
    299            SOP_ITEM_LGPS[6]=(int)lgp.LGP_EXIT;
    300          
    301            //EditGUI.cpp
    302            extern SOFTKEY_DESC SK_OPTIONS;
    303            extern SOFTKEY_DESC SK_ADRBK;
    304            extern SOFTKEY_DESC SK_CANCEL;
    305            extern SOFTKEY_DESC SK_INSNM;
    306            extern int EDO_ITEM_LGPS[];
    307            SK_OPTIONS.lgp_id=(int)lgp.LGP_OPTIONS;
    308            SK_CANCEL.lgp_id=(int)lgp.LGP_CANCEL;
    309            SK_ADRBK.lgp_id=(int)lgp.LGP_ADRBK;
    310            SK_INSNM.lgp_id=(int)lgp.LGP_INSERT_NUM;
    311            EDO_ITEM_LGPS[0]=(int)lgp.LGP_REPLY;
    312            EDO_ITEM_LGPS[1]=(int)lgp.LGP_EDIT;
    313            EDO_ITEM_LGPS[2]=(int)lgp.LGP_DEL;
    314            EDO_ITEM_LGPS[4]=(int)lgp.LGP_CALL;
    315            EDO_ITEM_LGPS[5]=(int)lgp.LGP_MOVE_ARCHIVE;
    316            EDO_ITEM_LGPS[6]=(int)lgp.LGP_EXIT;
    317            
    318            //popupgui.cpp
    319            extern SOFTKEY_DESC pni_sk[];
    320            pni_sk[0].lgp_id=(int)lgp.LGP_VIEW;
    321            pni_sk[1].lgp_id=(int)lgp.LGP_BACK;
    322          
    323            //template.cpp
    324            //extern SOFTKEY_DESC tpl_menu_sk[];
    325            //tpl_menu_sk[0].lgp_id=(int)lgp.LGP_SELECT;
    326            //tpl_menu_sk[1].lgp_id=(int)lgp.LGP_BACK;
    327          
    328            //GlobalVariable.cpp
    329            extern SOFTKEY_DESC sel_menu_sk[];
    330            sel_menu_sk[0].lgp_id=(int)lgp.LGP_SELECT;
    331            sel_menu_sk[1].lgp_id=(int)lgp.LGP_BACK;
    332          
    333            //othersmenu.cpp
    334            extern int OTH_ITEM_LGPS[];
    335            OTH_ITEM_LGPS[0]=(int)lgp.LGP_CONFIG;
    336            OTH_ITEM_LGPS[1]=(int)lgp.LGP_OPEN_ARCHIVE;
    337            OTH_ITEM_LGPS[2]=(int)lgp.LGP_MOVE_ALL_MSS;
    338            OTH_ITEM_LGPS[3]=(int)lgp.LGP_EXPORT_TXT;
    339            OTH_ITEM_LGPS[4]=(int)lgp.LGP_DEL_ALL_MSG_MSS;
    340            OTH_ITEM_LGPS[5]=(int)lgp.LGP_HELP;
    341            OTH_ITEM_LGPS[6]=(int)lgp.LGP_ABOUT;
    342          
    343            //TViewGUI.cpp
    344            extern SOFTKEY_DESC tview_sk[];
    345            tview_sk[0].lgp_id=(int)lgp.LGP_OK;
    346            tview_sk[1].lgp_id=(int)lgp.LGP_BACK;
    347          }
    348          
    349          LangPack::LangPack()
    350          {
    351            this->lang_buf=NULL;
    352            LoadLgpDefault();
    353            LoadLangFile();
    354            InitLgp();
    355          }
    356          
    357          LangPack::~LangPack()
    358          {
    359            LoadLgpDefault();
    360            if(this->lang_buf)
    361            {
    362              delete this->lang_buf;
    363              this->lang_buf=NULL;
    364            }
    365          }
    366          
    367          LangPack *LGP=NULL;

   Maximum stack usage in bytes:

     Function                       CSTACK
     --------                       ------
     LangPack::FreeLangPack()           8
     LangPack::GotoLangLineEnd(char *)
                                        0
     LangPack::GotoLangLineStart(char *)
                                        0
     LangPack::InitLgp()               76
     LangPack::LangPack()               8
     LangPack::LoadLangFile()         148
     LangPack::LoadLangPack()           8
     LangPack::LoadLgpDefault()         4
     LangPack::delete ~LangPack(LangPack *)
                                        8
     LangPack::new LangPack()           4
     LangPack::~LangPack()              8


   Segment part sizes:

     Function/Label                 Bytes
     --------------                 -----
     df_LGP_OK                         3
     df_LGP_BACK                       8
     df_LGP_ADRBK                     12
     df_LGP_ERR                        8
     df_LGP_SELECT                     8
     df_LGP_QUIT                       8
     df_LGP_NEW                        8
     df_LGP_IN_R                      12
     df_LGP_IN_N                       8
     df_LGP_IN_A                       8
     df_LGP_SENT                       8
     df_LGP_DRAFT                      8
     df_LGP_ALL                        8
     df_LGP_OPTIONS                    8
     df_LGP_ERR_0NUM                  12
     df_LGP_EXIT                       8
     df_LGP_CANCEL                     8
     df_LGP_SEND                       8
     df_LGP_DEL                        8
     df_LGP_SAVE_AS_FILE              16
     df_LGP_SAVE_AS_DRAFT             16
     df_LGP_INSERT_ADRNUM             32
     df_LGP_INSERT_BLANKNUM           20
     df_LGP_CHAR_COUNT                 8
     df_LGP_VIEW                       8
     df_LGP_EDIT                       8
     df_LGP_REPLY                      8
     df_LGP_NEW_MSG                   16
     df_LGP_FROM                       8
     df_LGP_CODESHOW                  12
     df_LGP_FETION                     8
     df_LGP_SAVEALL                   20
     df_LGP_CONFIG_UPDATE             24
     df_LGP_CONFIG                    12
     df_LGP_SAVE_ALL_ONE              24
     df_LGP_PLS_INPUT_PATH            28
     df_LGP_OTHERS                     8
     df_LGP_FILE_FAILED               24
     df_LGP_FILE_EXIST                16
     df_LGP_EXPORT_TXT                16
     df_LGP_MOVE_ARCHIVE              16
     df_LGP_MOVE_ALL_MSS              24
     df_LGP_OPEN_ARCHIVE              16
     df_LGP_EXPORT_N                  28
     df_LGP_MOVE_MSSARCHIVER_N        44
     df_LGP_DEL_ALL_MSS               24
     df_LGP_ABOUT                     12
     df_LGP_COV_DAT_TXT               20
     df_LGP_SAVE_ALL_AS_FILE          20
     df_LGP_SAF_N                     28
     df_LGP_DEL_ALL                   12
     df_LGP_DEL_ALL_MSG               20
     df_LGP_MOVE_ALL                  20
     df_LGP_DEL_ALL_MSG_MSS           16
     df_LGP_SAVE                       8
     df_LGP_MSG_REPORT                16
     df_LGP_MSG_REVEICED              20
     df_LGP_UNK_RP_STATUS             28
     df_LGP_TEMPLATE                  12
     df_LGP_CALL_ADDRESSBOOK          20
     df_LGP_STATISTICS                12
     df_LGP_IN_SMSDAT                 12
     df_LGP_IS_MSSFILE                12
     df_LGP_DAT_FREE                   8
     df_LGP_DISK_FREE                 16
     df_LGP_MSS_MAINMENU              16
     df_LGP_TRANSLIT                  12
     df_LGP_TIME                       8
     df_LGP_UNK_NUM                   16
     df_LGP_NUMBER                     8
     df_LGP_TEXT                       8
     df_LGP_TO                         3
     df_LGP_UNK                        8
     df_LGP_FILTER                     8
     df_LGP_INSERT_NUM                12
     df_LGP_HELP                       8
     df_LGP_DEL_N                     16
     df_LGP_CALL                       8
     df_LGPS                         316
     LangPack::FreeLangPack()         40
     LangPack::LoadLangPack()         32
     LangPack::LoadLangFile()        312
     LangPack::LoadLgpDefault()       28
     LangPack::GotoLangLineEnd(char *)
                                      52
     LangPack::GotoLangLineStart(char *)
                                      44
     LangPack::InitLgp()             440
     LangPack::LangPack()             48
     LangPack::~LangPack()            40
     LGP                               4
     ?<Initializer for df_LGPS>      316
     ?<Constant "lang.txt">           12
     LangPack::new LangPack()         28
     LangPack::delete ~LangPack(LangPack *)
                                      28
      Others                         164

 
 1 232 bytes in segment CODE
 1 098 bytes in segment DATA_C
   316 bytes in segment DATA_I
   316 bytes in segment DATA_ID
     4 bytes in segment DATA_Z
    24 bytes in segment INITTAB
 
 1 092 bytes of CODE  memory (+ 164 bytes shared)
 1 414 bytes of CONST memory
   320 bytes of DATA  memory

Errors: none
Warnings: none
