00001 /* 00002 Copyright (C) 2011 Computer Sciences Department, 00003 University of Wisconsin -- Madison 00004 00005 ---------------------------------------------------------------------- 00006 00007 This file is part of Mnemosyne: Lightweight Persistent Memory, 00008 originally developed at the University of Wisconsin -- Madison. 00009 00010 Mnemosyne was originally developed primarily by Haris Volos 00011 with contributions from Andres Jaan Tack. 00012 00013 ---------------------------------------------------------------------- 00014 00015 Mnemosyne is free software; you can redistribute it and/or 00016 modify it under the terms of the GNU General Public License 00017 as published by the Free Software Foundation, version 2 00018 of the License. 00019 00020 Mnemosyne is distributed in the hope that it will be useful, 00021 but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 GNU General Public License for more details. 00024 00025 You should have received a copy of the GNU General Public License 00026 along with this program; if not, write to the Free Software 00027 Foundation, Inc., 51 Franklin Street, Fifth Floor, 00028 Boston, MA 02110-1301, USA. 00029 00030 ### END HEADER ### 00031 */ 00032 00041 #include "mtm_i.h" 00042 #include "mode/dtable.h" 00043 00044 extern mtm_dtable_t mtm_pwbnl_dtable; 00045 extern mtm_dtable_t mtm_pwbetl_dtable; 00046 00047 #define ACTION(mode) &mtm_##mode##_dtable, 00048 mtm_dtable_group_t normal_dtable_group = { FOREACH_MODE (ACTION) }; 00049 00050 #undef ACTION 00051 00052 #define ACTION(mode) #mode, 00053 char *mtm_mode_str[] = { 00054 FOREACH_MODE(ACTION) 00055 }; 00056 #undef ACTION 00057 00058 mtm_dtable_group_t *default_dtable_group = NULL; 00059 00060 00061 mtm_mode_t 00062 mtm_str2mode(char *str) 00063 { 00064 int i; 00065 00066 for (i=0; i<MTM_NUM_MODES; i++) { 00067 if (strcasecmp(str, mtm_mode_str[i]) == 0) { 00068 return (mtm_mode_t) i; 00069 } 00070 } 00071 } 00072 00073 00074 char * 00075 mtm_mode2str(mtm_mode_t mode) 00076 { 00077 if (mode > MTM_MODE_none && mode < (int) MTM_NUM_MODES) { 00078 return mtm_mode_str[mode]; 00079 } 00080 return NULL; 00081 }