Kouhei Sutou
null+****@clear*****
Thu Jul 28 14:44:10 JST 2016
Kouhei Sutou 2016-07-28 14:44:10 +0900 (Thu, 28 Jul 2016) New Revision: 746a9ac5f8d4d4ca849b4777591f42fc18f9a9ff https://github.com/groonga/groonga/commit/746a9ac5f8d4d4ca849b4777591f42fc18f9a9ff Message: Add grn_rc_to_string() Added files: include/groonga/error.h Modified files: include/groonga.h include/groonga/Makefile.am lib/error.c Modified: include/groonga.h (+1 -0) =================================================================== --- include/groonga.h 2016-07-28 11:52:46 +0900 (bb9bee6) +++ include/groonga.h 2016-07-28 14:44:10 +0900 (b768f90) @@ -27,6 +27,7 @@ #include "groonga/dat.h" #include "groonga/db.h" #include "groonga/dump.h" +#include "groonga/error.h" #include "groonga/expr.h" #include "groonga/file_reader.h" #include "groonga/geo.h" Modified: include/groonga/Makefile.am (+1 -0) =================================================================== --- include/groonga/Makefile.am 2016-07-28 11:52:46 +0900 (222c267) +++ include/groonga/Makefile.am 2016-07-28 14:44:10 +0900 (ed31219) @@ -7,6 +7,7 @@ groonga_include_HEADERS = \ dat.h \ db.h \ dump.h \ + error.h \ expr.h \ file_reader.h \ hash.h \ Added: include/groonga/error.h (+29 -0) 100644 =================================================================== --- /dev/null +++ include/groonga/error.h 2016-07-28 14:44:10 +0900 (abf3aa2) @@ -0,0 +1,29 @@ +/* + Copyright(C) 2016 Brazil + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +GRN_API const char *grn_rc_to_string(grn_rc rc); + +#ifdef __cplusplus +} +#endif Modified: lib/error.c (+251 -0) =================================================================== --- lib/error.c 2016-07-28 11:52:46 +0900 (095331d) +++ lib/error.c 2016-07-28 14:44:10 +0900 (6c8db7a) @@ -194,3 +194,254 @@ grn_strerror(int error_code) return strerror(error_code); #endif /* WIN32 */ } + +const char * +grn_rc_to_string(grn_rc rc) +{ + const char *message = "invalid grn_rc"; + + switch (rc) { + case GRN_SUCCESS : + message = "success"; + break; + case GRN_END_OF_DATA : + message = "end of data"; + break; + case GRN_UNKNOWN_ERROR : + message = "unknown error"; + break; + case GRN_OPERATION_NOT_PERMITTED : + message = "operation not permitted"; + break; + case GRN_NO_SUCH_FILE_OR_DIRECTORY : + message = "no such file or directory"; + break; + case GRN_NO_SUCH_PROCESS : + message = "no such process"; + break; + case GRN_INTERRUPTED_FUNCTION_CALL : + message = "interrupted function call"; + break; + case GRN_INPUT_OUTPUT_ERROR : + message = "input output error"; + break; + case GRN_NO_SUCH_DEVICE_OR_ADDRESS : + message = "no such device or address"; + break; + case GRN_ARG_LIST_TOO_LONG : + message = "argument list is too long"; + break; + case GRN_EXEC_FORMAT_ERROR : + message = "exec format error"; + break; + case GRN_BAD_FILE_DESCRIPTOR : + message = "bad file descriptor"; + break; + case GRN_NO_CHILD_PROCESSES : + message = "no child processes"; + break; + case GRN_RESOURCE_TEMPORARILY_UNAVAILABLE : + message = "resource temporarily unavailable"; + break; + case GRN_NOT_ENOUGH_SPACE : + message = "not enough space"; + break; + case GRN_PERMISSION_DENIED : + message = "permission denied"; + break; + case GRN_BAD_ADDRESS : + message = "bad address"; + break; + case GRN_RESOURCE_BUSY : + message = "resource busy"; + break; + case GRN_FILE_EXISTS : + message = "file exists"; + break; + case GRN_IMPROPER_LINK : + message = "improper link"; + break; + case GRN_NO_SUCH_DEVICE : + message = "no such device"; + break; + case GRN_NOT_A_DIRECTORY : + message = "not a directory"; + break; + case GRN_IS_A_DIRECTORY : + message = "is a directory"; + break; + case GRN_INVALID_ARGUMENT : + message = "invalid argument"; + break; + case GRN_TOO_MANY_OPEN_FILES_IN_SYSTEM : + message = "too many open files in system"; + break; + case GRN_TOO_MANY_OPEN_FILES : + message = "too many open files"; + break; + case GRN_INAPPROPRIATE_I_O_CONTROL_OPERATION : + message = "inappropriate I/O control operation"; + break; + case GRN_FILE_TOO_LARGE : + message = "file too large"; + break; + case GRN_NO_SPACE_LEFT_ON_DEVICE : + message = "no space left on device"; + break; + case GRN_INVALID_SEEK : + message = "invalid seek"; + break; + case GRN_READ_ONLY_FILE_SYSTEM : + message = "read only file system"; + break; + case GRN_TOO_MANY_LINKS : + message = "too many links"; + break; + case GRN_BROKEN_PIPE : + message = "broken pipe"; + break; + case GRN_DOMAIN_ERROR : + message = "domain error"; + break; + case GRN_RESULT_TOO_LARGE : + message = "result too large"; + break; + case GRN_RESOURCE_DEADLOCK_AVOIDED : + message = "resource deadlock avoided"; + break; + case GRN_NO_MEMORY_AVAILABLE : + message = "no memory available"; + break; + case GRN_FILENAME_TOO_LONG : + message = "filename too long"; + break; + case GRN_NO_LOCKS_AVAILABLE : + message = "no locks available"; + break; + case GRN_FUNCTION_NOT_IMPLEMENTED : + message = "function not implemented"; + break; + case GRN_DIRECTORY_NOT_EMPTY : + message = "directory not empty"; + break; + case GRN_ILLEGAL_BYTE_SEQUENCE : + message = "illegal byte sequence"; + break; + case GRN_SOCKET_NOT_INITIALIZED : + message = "socket not initialized"; + break; + case GRN_OPERATION_WOULD_BLOCK : + message = "operation would block"; + break; + case GRN_ADDRESS_IS_NOT_AVAILABLE : + message = "address is not available"; + break; + case GRN_NETWORK_IS_DOWN : + message = "network is down"; + break; + case GRN_NO_BUFFER : + message = "no buffer"; + break; + case GRN_SOCKET_IS_ALREADY_CONNECTED : + message = "socket is already connected"; + break; + case GRN_SOCKET_IS_NOT_CONNECTED : + message = "socket is not connected"; + break; + case GRN_SOCKET_IS_ALREADY_SHUTDOWNED : + message = "socket is already shutdowned"; + break; + case GRN_OPERATION_TIMEOUT : + message = "operation timeout"; + break; + case GRN_CONNECTION_REFUSED : + message = "connection refused"; + break; + case GRN_RANGE_ERROR : + message = "range error"; + break; + case GRN_TOKENIZER_ERROR : + message = "tokenizer error"; + break; + case GRN_FILE_CORRUPT : + message = "file corrupt"; + break; + case GRN_INVALID_FORMAT : + message = "invalid format"; + break; + case GRN_OBJECT_CORRUPT : + message = "object corrupt"; + break; + case GRN_TOO_MANY_SYMBOLIC_LINKS : + message = "too many symbolic links"; + break; + case GRN_NOT_SOCKET : + message = "not socket"; + break; + case GRN_OPERATION_NOT_SUPPORTED : + message = "operation not supported"; + break; + case GRN_ADDRESS_IS_IN_USE : + message = "address is in use"; + break; + case GRN_ZLIB_ERROR : + message = "zlib error"; + break; + case GRN_LZ4_ERROR : + message = "LZ4 error"; + break; + case GRN_STACK_OVER_FLOW : + message = "stack over flow"; + break; + case GRN_SYNTAX_ERROR : + message = "syntax error"; + break; + case GRN_RETRY_MAX : + message = "retry max"; + break; + case GRN_INCOMPATIBLE_FILE_FORMAT : + message = "incompatible file format"; + break; + case GRN_UPDATE_NOT_ALLOWED : + message = "update not allowed"; + break; + case GRN_TOO_SMALL_OFFSET : + message = "too small offset"; + break; + case GRN_TOO_LARGE_OFFSET : + message = "too large offset"; + break; + case GRN_TOO_SMALL_LIMIT : + message = "too small limit"; + break; + case GRN_CAS_ERROR : + message = "cas error"; + break; + case GRN_UNSUPPORTED_COMMAND_VERSION : + message = "unsupported command version"; + break; + case GRN_NORMALIZER_ERROR : + message = "normalizer error"; + break; + case GRN_TOKEN_FILTER_ERROR : + message = "token filter error"; + break; + case GRN_COMMAND_ERROR : + message = "command error"; + break; + case GRN_PLUGIN_ERROR : + message = "plugin error"; + break; + case GRN_SCORER_ERROR : + message = "scorer error"; + break; + case GRN_CANCEL : + message = "cancel"; + break; + case GRN_WINDOW_FUNCTION_ERROR : + message = "window function error"; + break; + } + + return message; +} -------------- next part -------------- HTML����������������������������... 다운로드