00001 #include <stdlib.h>
00002 #include <string.h>
00003
00004 #include <moc.h>
00005 #include <internal/imoc.h>
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 error_strings_t error_strings[] =
00023 {
00024 { 0, "No Error" },
00025 { 1000, "Invalid buffer pointer" },
00026 { 2000, "Invalid count argument" },
00027 { 3000, "Invalid datatype argument" },
00028 { 4000, "Invalid tag argument" },
00029 { 5000, "Invalid communicator"},
00030 { 6000, "Invalid rank" },
00031 { 7000, "Invalid request (handle)" },
00032 { 8000, "Invalid root" },
00033 { 9000, "Invalid group" },
00034
00035 { 10000, "Invalid operation" },
00036 { 11000, "Invalid topology" },
00037 { 12000, "Invalid dimension argument" },
00038 { 13000, "Invalid argument of some other kind" },
00039 { 14000, "Unknown error" },
00040 { 15000, "Message truncated on receive" },
00041 { 16000, "Known error not in this list" },
00042 { 17000, "Internal MOC (implementation) error" },
00043 { 18000, "Error code is in status" },
00044 { 19000, "Pending request" },
00045
00046 { 20000, "Last error code" },
00047 { 17001, "Function not implemented" },
00048 { 17002, "Internal Buffer Overflow" },
00049 { 17003, "Insufficient Memory" },
00050 { 17004, "Insufficient Buffer-Space" },
00051 { 17005, "No further messages possible" },
00052 { 16001, "Base-Adress of Buffer isn't 16-byte aligned" },
00053 { 16002, "Bad Size (probably no multiple of 16)" }
00054 };
00055
00056
00057
00058
00059
00060
00061 #define ERROR_STRINGS_COUNT 28
00062
00063
00064
00065
00066
00067 int MOC_Error_string(int errorcode, char *string, int *resultlen)
00068 {
00069 int i;
00070 *resultlen = 0;
00071 if (errorcode < 0 || errorcode > MOC_ERR_LASTCODE)
00072 {
00073 return MOC_ERR_ARG;
00074 }
00075 for (i = 0; i < ERROR_STRINGS_COUNT; i++)
00076 {
00077 if (error_strings[i].error_code == errorcode)
00078 {
00079 strcpy(string, error_strings[i].text);
00080 *resultlen = strlen(string) + 1;
00081 return 0;
00082 }
00083 }
00084 strcpy(string, "No Error-String found");
00085 *resultlen = strlen(string) + 1;
00086 return 0;
00087 }
00088