diff -u -r --exclude=*.beam stdlib-1.11.4.1.orig/src/erl_compile.erl stdlib-1.11.4.1/src/erl_compile.erl --- stdlib-1.11.4.1.orig/src/erl_compile.erl Sat Apr 12 18:55:32 2003 +++ stdlib-1.11.4.1/src/erl_compile.erl Sat Apr 12 19:01:23 2003 @@ -19,8 +19,8 @@ %% -module(erl_compile). --include("erl_compile.hrl"). --include("file.hrl"). +-include_lib("stdlib/include/erl_compile.hrl"). +-include_lib("kernel/include/file.hrl"). -export([compile_cmdline/1]). diff -u -r --exclude=*.beam stdlib-1.11.4.1.orig/src/erl_lint.erl stdlib-1.11.4.1/src/erl_lint.erl --- stdlib-1.11.4.1.orig/src/erl_lint.erl Sat Apr 12 18:55:32 2003 +++ stdlib-1.11.4.1/src/erl_lint.erl Sat Apr 12 19:02:41 2003 @@ -59,9 +59,7 @@ %% lists are packed, and reversed, into a list of {FileName,ErrorDescList} %% pairs which are returned. --include("./erl_bits.hrl"). -%% FIXME. -%-include("../include/erl_bits.hrl"). +-include_lib("stdlib/include/erl_bits.hrl"). %% FIXME. %%-define(DEBUGF(X,Y), io:format(X, Y)). diff -u -r --exclude=*.beam stdlib-1.11.4.1.orig/src/math.erl stdlib-1.11.4.1/src/math.erl --- stdlib-1.11.4.1.orig/src/math.erl Sat Apr 12 18:55:32 2003 +++ stdlib-1.11.4.1/src/math.erl Sat Apr 12 21:14:58 2003 @@ -18,5 +18,43 @@ -module(math). -export([pi/0]). +-export([base/2]). pi() -> 3.1415926535897932. + +base(Base, Number) when is_integer(Number), Number >= 0 -> + base_format(Number, Base, []); +base(Base, Number) when is_integer(Number) -> + error; +base(Base, "") -> + empty; +base(Base, String) when is_list(String) -> + base_parse(ce_string:uc(String), Base, 0). + +base_format(0, Base, "") -> "0"; +base_format(0, Base, Acc) -> Acc; +base_format(Number, Base, Acc) -> + Digit = Number rem Base, + Char = digit_char(Digit), + base_format(Number div Base, Base, [Char | Acc]). + +digit_char(Digit) when Digit >= 0, Digit =< 9 -> Digit + $0; +digit_char(Digit) when Digit > 9 -> Digit - 10 + $A. + +base_parse([], Base, Acc) -> Acc; +base_parse([H | T], Base, Acc) -> + case char_digit(H) of + not_a_num -> + not_a_num; + Digit when Digit > (Base - 1) -> + not_a_num; + Digit -> + Acc0 = Acc * Base + Digit, + base_parse(T, Base, Acc0) + end. + +char_digit(Char) when Char >= $0, Char =< $9 -> Char - $0; +char_digit(Char) when Char >= $A, Char =< $F -> Char - $A + 10; +char_digit(Char) when Char >= $a, Char =< $f -> Char - $a + 10; +char_digit(Char) -> not_a_num. + diff -u -r --exclude=*.beam stdlib-1.11.4.1.orig/src/otp_internal.erl stdlib-1.11.4.1/src/otp_internal.erl --- stdlib-1.11.4.1.orig/src/otp_internal.erl Sat Apr 12 18:55:32 2003 +++ stdlib-1.11.4.1/src/otp_internal.erl Sat Apr 12 20:49:32 2003 @@ -175,5 +175,14 @@ obsolete(file, file_info, 1) -> {true, {file, read_file_info, 1}}; +obsolete(httpd_util, to_upper, 1) -> + {true, {string, to_upper, 1}}; +obsolete(httpd_util, to_lower, 1) -> + {true, {string, to_lower, 1}}; +obsolete(httpd_util, integer_to_hexlist, 1) -> + {true, {math, base, 2}}; +obsolete(httpd_util, hexlist_to_integer, 1) -> + {true, {math, base, 2}}; + obsolete(_, _, _) -> false. diff -u -r --exclude=*.beam stdlib-1.11.4.1.orig/src/regexp.erl stdlib-1.11.4.1/src/regexp.erl --- stdlib-1.11.4.1.orig/src/regexp.erl Sat Apr 12 18:55:32 2003 +++ stdlib-1.11.4.1/src/regexp.erl Fri Mar 28 00:00:47 2003 @@ -25,7 +25,7 @@ %% that. This method seems to go significantly faster. -export([sh_to_awk/1,parse/1,format_error/1,match/2,first_match/2,matches/2]). --export([sub/3,gsub/3,split/2]). +-export([sub/3,gsub/3,split/2,is_match/2]). -import(string, [substr/2,substr/3]). -import(lists, [reverse/1]). @@ -378,6 +378,22 @@ {St1,0} -> [{St1,0}|matches(substr(S, St1+2-St), RE, St1+1)]; {St1,L1} -> [{St1,L1}|matches(substr(S, St1+L1+1-St), RE, St1+L1)]; nomatch -> [] + end. + +%% -type is_match(String, RegExp) -> true | false | {error,E}. +%% Return a boolean indicating whether or not the RegExp matches String. +%% This is because there doesn't appear to be any other way to determine +%% if a RegExp (e.g. "^.*$") matches a null string (no chars to return!) + +is_match(String, RegExp) when list(RegExp) -> + case parse(RegExp) of + {ok,RE} -> is_match(String, RE); + {error,E} -> {error,E} + end; +is_match(String, RegExp) -> + case re_apply(String, 1, RegExp) of + {match,_,_} -> true; + nomatch -> false end. %% -type sub(String, RegExp, Replace) -> subsres(). diff -u -r --exclude=*.beam stdlib-1.11.4.1.orig/src/string.erl stdlib-1.11.4.1/src/string.erl --- stdlib-1.11.4.1.orig/src/string.erl Sat Apr 12 18:55:32 2003 +++ stdlib-1.11.4.1/src/string.erl Sat Apr 12 20:16:22 2003 @@ -23,6 +23,7 @@ sub_word/2,sub_word/3,left/2,left/3,right/2,right/3, sub_string/2,sub_string/3,centre/2,centre/3]). -export([re_sh_to_awk/1,re_parse/1,re_match/2,re_sub/3,re_gsub/3,re_split/2]). +-export([to_upper/1, to_lower/1]). -import(lists,[reverse/1,member/2]). @@ -317,3 +318,28 @@ end. re_split(String, RegExp) -> regexp:split(String, RegExp). + +%% to_upper (from httpd_util, made tail-recursive) + +to_upper(String) -> + to_upper(String, []). + +to_upper([C | Cs], Acc) when C >= $a, C =< $z -> + to_upper(Cs, [C - ($a - $A) | Acc]); +to_upper([C | Cs], Acc) -> + to_upper(Cs, [C | Acc]); +to_upper([], Acc) -> + lists:reverse(Acc). + +%% to_lower (from httpd_util, made tail-recursive) + +to_lower(String) -> + to_lower(String, []). + +to_lower([C | Cs], Acc) when C >= $A, C =< $Z -> + to_lower(Cs, [C + ($a - $A) | Acc]); +to_lower([C | Cs], Acc) -> + to_lower(Cs, [C | Acc]); +to_lower([], Acc) -> + lists:reverse(Acc). + diff -u -r --exclude=*.beam inets-3.0.3.orig/src/http.erl inets-3.0.3/src/http.erl --- inets-3.0.3.orig/src/http.erl Sat Apr 12 18:58:20 2003 +++ inets-3.0.3/src/http.erl Sat Apr 12 20:52:18 2003 @@ -216,7 +216,7 @@ create_headers([],Req) -> Req; create_headers([{Key,Val}|Rest],Req) -> - case httpd_util:to_lower(Key) of + case string:to_lower(Key) of "expect" -> create_headers(Rest,Req#req_headers{expect=Val}); OtherKey -> diff -u -r --exclude=*.beam inets-3.0.3.orig/src/http_lib.erl inets-3.0.3/src/http_lib.erl --- inets-3.0.3.orig/src/http_lib.erl Sat Apr 12 18:58:20 2003 +++ inets-3.0.3/src/http_lib.erl Sat Apr 12 20:52:52 2003 @@ -738,8 +738,8 @@ tagup_header([Line|Rest]) -> [tag(Line, [])|tagup_header(Rest)]. tag([], Tag) -> - {httpd_util:to_lower(lists:reverse(Tag)), ""}; + {string:to_lower(lists:reverse(Tag)), ""}; tag([$:|Rest], Tag) -> - {httpd_util:to_lower(lists:reverse(Tag)), httpd_util:strip(Rest)}; + {string:to_lower(lists:reverse(Tag)), httpd_util:strip(Rest)}; tag([Chr|Rest], Tag) -> tag(Rest, [Chr|Tag]). diff -u -r --exclude=*.beam inets-3.0.3.orig/src/httpc_handler.erl inets-3.0.3/src/httpc_handler.erl --- inets-3.0.3.orig/src/httpc_handler.erl Sat Apr 12 18:58:20 2003 +++ inets-3.0.3/src/httpc_handler.erl Sat Apr 12 20:53:21 2003 @@ -271,7 +271,7 @@ "TE: \r\n". method(Method) -> - httpd_util:to_upper(atom_to_list(Method)). + string:to_upper(atom_to_list(Method)). %%% ---------------------------------------------------------------------------- diff -u -r --exclude=*.beam inets-3.0.3.orig/src/httpd_parse.erl inets-3.0.3/src/httpd_parse.erl --- inets-3.0.3.orig/src/httpd_parse.erl Sat Apr 12 18:58:20 2003 +++ inets-3.0.3/src/httpd_parse.erl Sat Apr 12 20:51:52 2003 @@ -160,7 +160,7 @@ find_content_type([]) -> false; find_content_type([{Name,Value}|Tail]) -> - case httpd_util:to_lower(Name) of + case string:to_lower(Name) of "content-type" -> {ok, Value}; _ -> @@ -234,9 +234,9 @@ tagup_header([Line|Rest]) -> [tag(Line, [])|tagup_header(Rest)]. tag([], Tag) -> - {httpd_util:to_lower(lists:reverse(Tag)), ""}; + {string:to_lower(lists:reverse(Tag)), ""}; tag([$:|Rest], Tag) -> - {httpd_util:to_lower(lists:reverse(Tag)), httpd_util:strip(Rest)}; + {string:to_lower(lists:reverse(Tag)), httpd_util:strip(Rest)}; tag([Chr|Rest], Tag) -> tag(Rest, [Chr|Tag]). diff -u -r --exclude=*.beam inets-3.0.3.orig/src/httpd_request_handler.erl inets-3.0.3/src/httpd_request_handler.erl --- inets-3.0.3.orig/src/httpd_request_handler.erl Sat Apr 12 18:58:20 2003 +++ inets-3.0.3/src/httpd_request_handler.erl Sat Apr 12 20:54:44 2003 @@ -547,7 +547,7 @@ case httpd_util:split(remove_newline(BodyPart), "\r\n", 2) of {ok, [Size, Body]} -> ?DEBUG("parse_chunk_size()->Size: ~p ~n", [Size]), - {ok, httpd_util:hexlist_to_integer(Size), Body}; + {ok, math:base(16, Size), Body}; {ok, [Size]} -> ?DEBUG("parse_chunk_size()->Size: ~p ~n", [Size]), Sz = get_chunk_size(Info#mod.socket_type, @@ -714,7 +714,7 @@ case read_trailer(SocketType, Socket, Timeout, MaxHdrSz, [], [], string:tokens( - httpd_util:to_lower(Fields),",")) of + string:to_lower(Fields),",")) of {ok,[]} -> {ok,Body}; {ok,HeaderFields} -> @@ -740,7 +740,7 @@ ?DEBUG("get_chunk_size: ~p " ,[Size]), case httpd_socket:recv(SocketType,Socket,1,Timeout) of {ok,[Digit]} when Digit==$\n -> - httpd_util:hexlist_to_integer(lists:reverse(Size)); + math:base(16, lists:reverse(Size)); {ok,[Digit]} -> get_chunk_size(SocketType,Socket,Timeout-(t()-T),[Digit|Size]); {error,closed} -> @@ -839,8 +839,8 @@ 0-> {error,"badheaderfield"}; Number -> - {httpd_util:to_lower(string:substr(HeaderField,1,Number-1)), - httpd_util:to_lower(string:substr(HeaderField,Number+1))} + {string:to_lower(string:substr(HeaderField,1,Number-1)), + string:to_lower(string:substr(HeaderField,Number+1))} end. diff -u -r --exclude=*.beam inets-3.0.3.orig/src/mod_browser.erl inets-3.0.3/src/mod_browser.erl --- inets-3.0.3.orig/src/mod_browser.erl Sat Apr 12 18:58:20 2003 +++ inets-3.0.3/src/mod_browser.erl Sat Apr 12 20:57:01 2003 @@ -83,7 +83,7 @@ end. getBrowser(AgentString) -> - LAgentString = httpd_util:to_lower(AgentString), + LAgentString = string:to_lower(AgentString), case regexp:first_match(LAgentString,"^[^ ]*") of {match,Start,Length} -> Browser=lists:sublist(LAgentString,Start,Length), diff -u -r --exclude=*.beam inets-3.0.3.orig/src/mod_cgi.erl inets-3.0.3/src/mod_cgi.erl --- inets-3.0.3.orig/src/mod_cgi.erl Sat Apr 12 18:58:20 2003 +++ inets-3.0.3/src/mod_cgi.erl Sat Apr 12 20:56:36 2003 @@ -247,13 +247,13 @@ SoFar; parsed_header([{Name,[Value|R1]}|R2], SoFar) when list(Value)-> NewName=lists:map(fun(X) -> if X == $- -> $_; true -> X end end,Name), - Env = env("HTTP_"++httpd_util:to_upper(NewName), + Env = env("HTTP_"++string:to_upper(NewName), multi_value([Value|R1])), parsed_header(R2, [Env|SoFar]); parsed_header([{Name,Value}|Rest], SoFar) -> {ok,NewName,_} = regexp:gsub(Name, "-", "_"), - Env=env("HTTP_"++httpd_util:to_upper(NewName),Value), + Env=env("HTTP_"++string:to_upper(NewName),Value), parsed_header(Rest, [Env|SoFar]). @@ -511,13 +511,13 @@ {ok,[HeadPart,BodyPart]} -> [Header, removeStatus(HeadPart), "\r\n\r\n", - httpd_util:integer_to_hexlist(length(BodyPart)), + math:base(16, length(BodyPart)), "\r\n", BodyPart]; _WhatEver -> %% No response header field from the cgi-script, %% Just a body [Header, "Content-Type:text/html","\r\n\r\n", - httpd_util:integer_to_hexlist(length(Response)), + math:base(16, length(Response)), "\r\n", Response] end, httpd_socket:deliver(Info#mod.socket_type,Info#mod.socket, Response1). @@ -544,7 +544,7 @@ create_chunk(_Info, Response) -> - HEXSize = httpd_util:integer_to_hexlist(length(lists:flatten(Response))), + HEXSize = math:base(16, length(lists:flatten(Response))), HEXSize++"\r\n"++Response++"\r\n". diff -u -r --exclude=*.beam inets-3.0.3.orig/src/mod_esi.erl inets-3.0.3/src/mod_esi.erl --- inets-3.0.3.orig/src/mod_esi.erl Sat Apr 12 18:58:20 2003 +++ inets-3.0.3/src/mod_esi.erl Sat Apr 12 20:57:51 2003 @@ -248,11 +248,11 @@ []; parsed_header([{Name,[Value|R1]}|R2]) when list(Value) -> NewName=lists:map(fun(X) -> if X == $- -> $_; true -> X end end,Name), - [{list_to_atom("http_"++httpd_util:to_lower(NewName)), + [{list_to_atom("http_"++string:to_lower(NewName)), multi_value([Value|R1])}|parsed_header(R2)]; parsed_header([{Name,Value}|Rest]) when list(Value)-> {ok,NewName,_}=regexp:gsub(Name,"-","_"), - [{list_to_atom("http_"++httpd_util:to_lower(NewName)),Value}| + [{list_to_atom("http_"++string:to_lower(NewName)),Value}| parsed_header(Rest)]. multi_value([]) ->