Home | History | Annotate | Download | only in avd
      1 /* Copyright (C) 2008 The Android Open Source Project
      2 **
      3 ** This software is licensed under the terms of the GNU General Public
      4 ** License version 2, as published by the Free Software Foundation, and
      5 ** may be copied, distributed, and modified under those terms.
      6 **
      7 ** This program is distributed in the hope that it will be useful,
      8 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
      9 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     10 ** GNU General Public License for more details.
     11 */
     12 #include "android/avd/hw-config.h"
     13 #include "android/utils/ini.h"
     14 #include <string.h>
     15 #include <stdlib.h>
     16 
     17 
     18 /* the global variable containing the hardware config for this device */
     19 AndroidHwConfig   android_hw[1];
     20 
     21 int
     22 androidHwConfig_read( AndroidHwConfig*  config,
     23                       IniFile*          ini )
     24 {
     25     if (ini == NULL)
     26         return -1;
     27 
     28     /* use the magic of macros to implement the hardware configuration loaded */
     29 
     30 #define   HWCFG_BOOL(n,s,d,a,t)       config->n = iniFile_getBoolean(ini, s, d);
     31 #define   HWCFG_INT(n,s,d,a,t)        config->n = iniFile_getInteger(ini, s, d);
     32 #define   HWCFG_STRING(n,s,d,a,t)     config->n = iniFile_getString(ini, s, d);
     33 #define   HWCFG_DOUBLE(n,s,d,a,t)     config->n = iniFile_getDouble(ini, s, d);
     34 #define   HWCFG_DISKSIZE(n,s,d,a,t)   config->n = iniFile_getDiskSize(ini, s, d);
     35 
     36 #include "android/avd/hw-config-defs.h"
     37 
     38     return 0;
     39 }
     40