release 0.7.10
[ocurl.git] / errors.ml
blob82ece4e3c2c9add1a13038bc9d36d835d78b1792
1 #use "topfind";;
2 #require "extlib";;
4 open ExtLib
6 let all = {|
7 CURLE_OK
8 CURLE_UNSUPPORTED_PROTOCOL
9 CURLE_FAILED_INIT
10 CURLE_URL_MALFORMAT
11 CURLE_URL_MALFORMAT_USER
12 CURLE_COULDNT_RESOLVE_PROXY
13 CURLE_COULDNT_RESOLVE_HOST
14 CURLE_COULDNT_CONNECT
15 CURLE_FTP_WEIRD_SERVER_REPLY
16 CURLE_FTP_ACCESS_DENIED
17 CURLE_FTP_USER_PASSWORD_INCORRECT
18 CURLE_FTP_WEIRD_PASS_REPLY
19 CURLE_FTP_WEIRD_USER_REPLY
20 CURLE_FTP_WEIRD_PASV_REPLY
21 CURLE_FTP_WEIRD_227_FORMAT
22 CURLE_FTP_CANT_GET_HOST
23 CURLE_FTP_CANT_RECONNECT
24 CURLE_FTP_COULDNT_SET_BINARY
25 CURLE_PARTIAL_FILE
26 CURLE_FTP_COULDNT_RETR_FILE
27 CURLE_FTP_WRITE_ERROR
28 CURLE_FTP_QUOTE_ERROR
29 CURLE_HTTP_RETURNED_ERROR
30 CURLE_WRITE_ERROR
31 CURLE_MALFORMAT_USER
32 CURLE_FTP_COULDNT_STOR_FILE
33 CURLE_READ_ERROR
34 CURLE_OUT_OF_MEMORY
35 CURLE_OPERATION_TIMEOUTED
36 CURLE_FTP_COULDNT_SET_ASCII
37 CURLE_FTP_PORT_FAILED
38 CURLE_FTP_COULDNT_USE_REST
39 CURLE_FTP_COULDNT_GET_SIZE
40 CURLE_HTTP_RANGE_ERROR
41 CURLE_HTTP_POST_ERROR
42 CURLE_SSL_CONNECT_ERROR
43 CURLE_BAD_DOWNLOAD_RESUME
44 CURLE_FILE_COULDNT_READ_FILE
45 CURLE_LDAP_CANNOT_BIND
46 CURLE_LDAP_SEARCH_FAILED
47 CURLE_LIBRARY_NOT_FOUND
48 CURLE_FUNCTION_NOT_FOUND
49 CURLE_ABORTED_BY_CALLBACK
50 CURLE_BAD_FUNCTION_ARGUMENT
51 CURLE_BAD_CALLING_ORDER
52 CURLE_INTERFACE_FAILED
53 CURLE_BAD_PASSWORD_ENTERED
54 CURLE_TOO_MANY_REDIRECTS
55 CURLE_UNKNOWN_TELNET_OPTION
56 CURLE_TELNET_OPTION_SYNTAX
57 CURLE_SSL_PEER_CERTIFICATE
58 CURLE_GOT_NOTHING
59 CURLE_SSL_ENGINE_NOTFOUND
60 CURLE_SSL_ENGINE_SETFAILED
61 CURLE_SEND_ERROR
62 CURLE_RECV_ERROR
63 CURLE_SHARE_IN_USE
64 CURLE_SSL_CERTPROBLEM
65 CURLE_SSL_CIPHER
66 CURLE_SSL_CACERT
67 CURLE_BAD_CONTENT_ENCODING
68 CURLE_LDAP_INVALID_URL
69 CURLE_FILESIZE_EXCEEDED
70 CURLE_FTP_SSL_FAILED
71 CURLE_SEND_FAIL_REWIND
72 CURLE_SSL_ENGINE_INITFAILED
73 CURLE_LOGIN_DENIED
74 CURLE_TFTP_NOTFOUND
75 CURLE_TFTP_PERM
76 CURLE_REMOTE_DISK_FULL
77 CURLE_TFTP_ILLEGAL
78 CURLE_TFTP_UNKNOWNID
79 CURLE_REMOTE_FILE_EXISTS
80 CURLE_TFTP_NOSUCHUSER
81 CURLE_CONV_FAILED
82 CURLE_CONV_REQD
83 CURLE_SSL_CACERT_BADFILE
84 CURLE_REMOTE_FILE_NOT_FOUND
85 CURLE_SSH
86 CURLE_SSL_SHUTDOWN_FAILED
87 CURLE_AGAIN
90 let pr fmt = Printf.ksprintf print_endline fmt
92 let () =
93 let l = String.nsplit all "\n" |> List.map String.strip |> List.filter ((<>) "") in
94 match List.tl @@ Array.to_list @@ Sys.argv with
95 | [] | "c"::[] ->
96 l |> List.iteri begin fun i s ->
97 match s with
98 | "CURLE_OK" ->
99 pr " {\"%s\", %s}," s s
100 | _ ->
101 pr "#if HAVE_DECL_%s" s;
102 pr "#if %s != %d" s i;
103 pr "#warning error code mismatch: %s != %d" s i;
104 pr "#endif";
105 pr " {\"%s\", %s}," s s;
106 pr "#else";
107 pr " {\"%s\", -1}," s;
108 pr"#endif";
110 | "ml"::[] -> l |> List.iter (pr " | %s")
111 | "configure"::[] ->
112 Format.set_margin 80;
113 Format.open_box 0;
114 l |> List.iter (function "CURLE_OK" -> () | s -> Format.printf "%s,@ " s);
115 Format.close_box ();
116 | _ -> failwith "bad usage"