|
gimme-alpha 0.1
|
00001 /* 00002 ** gimme_alpha_types.h 00003 ** 00004 ** Made by Johnny Q. Hacker 00005 ** Login <solarion@borkborkbork> 00006 ** 00007 00008 Copyright (C) 2008 Joseph Pingenot 00009 00010 This program is free software: you can redistribute it and/or modify 00011 it under the terms of the GNU Affero General Public License as published by 00012 the Free Software Foundation, either version 3 of the License, or 00013 (at your option) any later version. 00014 00015 This program is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU Affero General Public License for more details. 00019 00020 You should have received a copy of the GNU Affero General Public License 00021 along with this program. If not, see <http://www.gnu.org/licenses/>. 00022 00023 ** Started on Wed Oct 22 15:41:55 2008 Johnny Q. Hacker 00024 ** Last update Wed Oct 22 15:41:55 2008 Johnny Q. Hacker 00025 */ 00026 00027 #ifndef GIMME_ALPHA_TYPES_H_ 00028 # define GIMME_ALPHA_TYPES_H_ 00029 00030 #include <glib-2.0/glib.h> 00031 #include "gcc_hints.h" 00032 00033 #ifdef __cplusplus 00034 extern "C" { 00035 #endif 00036 00037 /*TYPE NOTES* 00038 * COMPLEX numbers are packed doubles, i.e. double[2]. 00039 */ 00040 enum data_types { 00041 INT_TYPE, 00042 LONG_INT_TYPE, 00043 FLOAT_TYPE, 00044 DOUBLE_TYPE, 00045 LONG_DOUBLE_TYPE, 00046 COMPLEX_TYPE, 00047 STRING_TYPE, 00048 BOOLEAN_TYPE 00049 }; 00050 00051 /*How the strings are formatted*/ 00052 enum data_type_string_format_type { 00053 STRING_FORMATTED_LIKE_C, 00054 STRING_FORMATTED_LIKE_FORTRAN 00055 }; 00056 00057 /*NOTE: COMPLEX always returns a NULL, because reading in/writing a 00058 complex requires two format characters. 00059 */ 00060 ___const char* format_string_for_type_print(enum data_types t); 00061 ___const char* format_string_for_type_scan(enum data_types t); 00062 00063 ___malloc void* string_to_data(char* s, enum data_types t); 00064 ___malloc void* string_to_data_x2(char* s1, char* s2, enum data_types t); 00065 ___malloc void* string_to_data_fortran(char* s, enum data_types t); 00066 ___malloc void* string_to_data_generic(char* s, enum data_types t, enum data_type_string_format_type fmt); 00067 /**Gets a contiguous block of N values 00068 *\param s GNOME string vector (http://library.gnome.org/devel/glib/stable/glib-String-Utility-Functions.html#g-strsplit) with the strings containing the numbers 00069 *\param t data type to be dealt with 00070 *\return contiguous block of N t's. 00071 */ 00072 ___malloc void* string_to_data_xN(gchar** s, enum data_types t); 00073 00074 #ifdef __cplusplus 00075 } 00076 #endif 00077 00078 #endif /* !GIMME_ALPHA_TYPES_H_ */