Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/make_tph.ml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ let main () =
let file_include = Sys.readdir "src/tph/include" in
List.iter (fun (dir, files) ->
Array.iter (fun file ->
let file = String.lowercase file in
let file = String.lowercase_ascii file in
let ext = Str.global_replace (Str.regexp ".*\\.") "" file in
if ext = "tpa" || ext = "tpp" then begin
let contents = load_file ("src/tph/" ^ dir ^ "/" ^ file) in
Expand All @@ -39,7 +39,7 @@ let main () =
output_string o "]\n";
Printf.fprintf o "let %s = [" includes_symbol ;
Array.iter (fun file ->
let file = Printf.sprintf "%s%s" namespace (String.lowercase file) in
let file = Printf.sprintf "%s%s" namespace (String.lowercase_ascii file) in
let ext = Str.global_replace (Str.regexp ".*\\.") "" file in
if ext = "tpa" || ext = "tpp" then Printf.fprintf o "\t\"%s\";\n" file) file_include;
output_string o "]\n";
Expand Down
2 changes: 1 addition & 1 deletion src/arch_mingw.ml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ let get_user_dir game_path =
get_user_personal_dir ()

let game_path_by_type name =
match String.lowercase name with
match String.lowercase_ascii name with
| "bg2" -> registry_path ()
| "bg1"
| "bg" -> bg_registry_path ()
Expand Down
2 changes: 1 addition & 1 deletion src/arch_unix.ml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ let handle_view_command s skip =
end) [Str.regexp_case_fold "^VIEW[ \t]*" ; Str.regexp_case_fold "^NOTEPAD[ \t]*" ;
Str.regexp_case_fold "^EXPLORER[ \t]*"];
if skip && (s <> !result) then result := "";
let s = String.lowercase !result in
let s = String.lowercase_ascii !result in
s

let glob str fn = failwith "no globbing support"
Expand Down
2 changes: 1 addition & 1 deletion src/automate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ let process file game min o =
end
in
let _,ext = split_resref file in
let ext = String.uppercase ext in
let ext = String.uppercase_ascii ext in
try begin
match ext with
| "SPL"
Expand Down
2 changes: 1 addition & 1 deletion src/baflexer.mll
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ let blank = [' ' '\012' '\r']
adj lexbuf ;
try Hashtbl.find lexicon (string_of lexbuf)
with _ -> begin
try Hashtbl.find lexicon (String.uppercase (string_of lexbuf))
try Hashtbl.find lexicon (String.uppercase_ascii (string_of lexbuf))
with _ -> SYMBOL(string_of lexbuf)
end }
| ['-']?("0x")?['0'-'9']+ { adj lexbuf ;
Expand Down
2 changes: 1 addition & 1 deletion src/bafparser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ let get_next_point argl =
| _ -> failwith "get_next_point"

let valid_var_area s =
let s = String.uppercase s in
let s = String.uppercase_ascii s in
if Modder.enabled "AREA_VARIABLES" then
let ans = (s = "GLOBAL" || s = "LOCALS" || s = "KAPUTZ" || s = "MYAREA" ||
s = "" || ( Str.string_match (Str.regexp "AR[0-9][0-9][0-9][0-9]") s 0) ||
Expand Down
28 changes: 14 additions & 14 deletions src/bcs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ let make_ids_map il =
(* log_and_print "IDS: %ld %s\n" ids.i_num ids.i_name ; *)
Hashtbl.add from_int ids.i_num ids ;
Hashtbl.add from_sym ids.i_name ids ;
Hashtbl.add from_uppercase_sym (String.uppercase ids.i_name) ids) il ;
Hashtbl.add from_uppercase_sym (String.uppercase_ascii ids.i_name) ids) il ;
{ from_int = from_int ;
from_sym = from_sym ;
from_uppercase_sym = from_uppercase_sym ; }
Expand All @@ -545,7 +545,7 @@ let clear_ids_map game =
*)

let get_ids_map game ids_filename =
let ids_filename = String.uppercase ids_filename in
let ids_filename = String.uppercase_ascii ids_filename in
try
let ids_state = Hashtbl.find all_games_ids_state game.Load.game_path in
Hashtbl.find ids_state ids_filename
Expand Down Expand Up @@ -592,38 +592,38 @@ let five_quotes_string s =
let five_quotes res = {res with i_name = five_quotes_string res.i_name}

let ids_of_int game ids_file i =
let ids_file = String.uppercase ids_file in
let ids_file = String.uppercase_ascii ids_file in
let ids_map : ids_map = get_ids_map game ids_file in
let res = (Hashtbl.find ids_map.from_int i) in
five_quotes res


let ids_of_sym game ids_file sym =
let ids_file = String.uppercase ids_file in
let ids_file = String.uppercase_ascii ids_file in
let ids_map : ids_map = get_ids_map game ids_file in
try
(Hashtbl.find ids_map.from_sym sym)
with Not_found ->
let a = (Hashtbl.find ids_map.from_uppercase_sym (String.uppercase sym)) in
let a = (Hashtbl.find ids_map.from_uppercase_sym (String.uppercase_ascii sym)) in
(* let msg = Printf.sprintf "[%s] should be [%s] (note case)\n"
sym a.i_name in
(try input_error "PARSE" msg with _ -> () ) ; *)
a

let every_ids_of_int game ids_file i =
let ids_file = String.uppercase ids_file in
let ids_file = String.uppercase_ascii ids_file in
let ids_map : ids_map = get_ids_map game ids_file in
List.map five_quotes (Hashtbl.find_all ids_map.from_int i)

let int_of_sym game ids_file sym =
let ids_file = String.uppercase ids_file in
let ids_file = String.uppercase_ascii ids_file in
let ids = ids_of_sym game ids_file sym in
ids.i_num

let sym_of_int game ids_file i =
let ids_file = String.uppercase ids_file in
let ids_file = String.uppercase_ascii ids_file in
try
let ids_map : ids_map = get_ids_map game (String.uppercase ids_file ) in
let ids_map : ids_map = get_ids_map game (String.uppercase_ascii ids_file ) in
five_quotes_string ((Hashtbl.find ids_map.from_int i).i_name)
with _ ->
(* log_or_print "WARNING: %d (0x%x) not found in %s.IDS\n" i i ids_file ; *)
Expand Down Expand Up @@ -909,7 +909,7 @@ let get_first_of_type argl tau =
failwith "cannot find an argument of the right type"

let formal_arg_is_strref arg =
let up = String.uppercase arg.arg_comment in
let up = String.uppercase_ascii arg.arg_comment in
up = "STRREF" || up = "STRINGREF"

let print_script_text game how what comments strhandle =
Expand Down Expand Up @@ -1118,9 +1118,9 @@ let print_script_text game how what comments strhandle =
bcs_printf "\n"
and print_trigger_list tr compiling_to_dlg or_count =
match tr with
| t :: [] when not compiling_to_dlg && String.lowercase ((best_ids_of_trigger game t).i_name) = "nexttriggerobject" ->
| t :: [] when not compiling_to_dlg && String.lowercase_ascii ((best_ids_of_trigger game t).i_name) = "nexttriggerobject" ->
failwith "NextTriggerObject() without a next trigger (broken TriggerOverride)"
| t :: t1 :: tl when not compiling_to_dlg && String.lowercase ((best_ids_of_trigger game t).i_name) = "nexttriggerobject" ->
| t :: t1 :: tl when not compiling_to_dlg && String.lowercase_ascii ((best_ids_of_trigger game t).i_name) = "nexttriggerobject" ->
let indent = 2 + if !or_count > 0 then (decr or_count ; 2) else 0 in
bcs_printf "%*s" indent " " ;
bcs_printf "%sTriggerOverride(" (if t1.negated then "!" else "");
Expand Down Expand Up @@ -1151,7 +1151,7 @@ let print_script_text game how what comments strhandle =
if comments then begin
print_trigger_comment game t ;
end ;
if String.uppercase ids.i_name = "OR" then
if String.uppercase_ascii ids.i_name = "OR" then
(Int32.to_int t.t_1)
else 0
and print_trigger_comment game t =
Expand Down Expand Up @@ -1399,7 +1399,7 @@ let is_invalid_for_ict1 action =
| _, 256 (* CreateItemGlobal(S:Global,S:Area,S:ResRef) *)
| _, 268 (* RealSetGlobalTimer(S:Name,S:Area,I:TimeGTimes) *)
| _, 335 (* SetTokenGlobal(S:GLOBAL,S:Area,S:Token) *)
-> let check s = String.uppercase (snd (split6 s)) = "LOCALS" in
-> let check s = String.uppercase_ascii (snd (split6 s)) = "LOCALS" in
List.exists check [action.a_8; action.a_9]
| _ -> false in
ans && action.a_1.o_name = ""
Expand Down
2 changes: 1 addition & 1 deletion src/biff.ml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ let save_biff key filename keyname components =
let a,b = split_resref (Case_ins.filename_basename file) in
try
let tau = key_of_ext false b in
[ (size,file,String.uppercase a,String.uppercase b,tau) ]
[ (size,file,String.uppercase_ascii a,String.uppercase_ascii b,tau) ]
with _ ->
log_only "WARNING: Not including [%s]: unknown resource type\n"
file ; []
Expand Down
4 changes: 2 additions & 2 deletions src/case_ins_linux.ml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let case_exact = ref false

let case_transform s =
if not !case_exact then
String.lowercase s
String.lowercase_ascii s
else s

(* Pervasives FS calls *)
Expand Down Expand Up @@ -45,4 +45,4 @@ let filename_chop_suffix s = Filename.chop_suffix (backslash_to_slash s) ;;
let filename_dirname s = Filename.dirname (backslash_to_slash s) ;;
let filename_is_implicit s = Filename.is_implicit (backslash_to_slash s) ;;

let fix_name s = String.lowercase (backslash_to_slash s);;
let fix_name s = String.lowercase_ascii (backslash_to_slash s);;
8 changes: 4 additions & 4 deletions src/changelog.ml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ let process_log log file_list game =
List.iter (fun line ->
let parts = split_log_line line in
let (src, dst) = match parts with
| s :: d :: _ -> (String.uppercase s, String.uppercase d)
| s :: [] -> (String.uppercase s, "")
| s :: d :: _ -> (String.uppercase_ascii s, String.uppercase_ascii d)
| s :: [] -> (String.uppercase_ascii s, "")
| [] -> failwith "Empty line in backup file" in
let src_file =
Str.global_replace (Str.regexp "^OVERRIDE[/\\]") "" src in
Expand Down Expand Up @@ -141,7 +141,7 @@ let prepare_result file_list backup_lists game =
Hashtbl.find backup_lists file
with Not_found -> [] in
List.map (fun file1 ->
let file1 = String.uppercase file1 in
let file1 = String.uppercase_ascii file1 in
let file = if Case_ins.filename_check_suffix file1 ".EXE" ||
Case_ins.filename_check_suffix file1 ".KEY" then file1
else "OVERRIDE/" ^ file1 in
Expand Down Expand Up @@ -175,7 +175,7 @@ let prepare_result file_list backup_lists game =

let changelog file_list game =
ignore (Parsewrappers.load_log ()) ;
let file_list = List.map String.uppercase file_list in
let file_list = List.map String.uppercase_ascii file_list in
let backup_lists = process_log !Tp.the_log file_list game in
let result = prepare_result file_list backup_lists game in
List.map (fun ((text: string), (files: (string * string) list)) ->
Expand Down
18 changes: 9 additions & 9 deletions src/cre.ml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ let cre_of_string buff =
let known_spells = ref [] in
for i = 0 to known_cnt - 1 do
let this_buff = String.sub buff (known_off + i * 0xc) 0xc in
let name = String.uppercase (get_string_of_size this_buff 0 8) in
let name = String.uppercase_ascii (get_string_of_size this_buff 0 8) in
let level = short_of_str_off this_buff 8 in
let spell_type = short_of_str_off this_buff 0xa in
known_spells := (name,level,spell_type) :: !known_spells ;
Expand All @@ -97,7 +97,7 @@ let cre_of_string buff =
while !mlist_i < mlist_cnt do
let this_buff = String.sub buff
(mlist_off + (mlist_idx + !mlist_i) * 0xc) 0xc in
let name = String.uppercase (get_string_of_size this_buff 0 8) in
let name = String.uppercase_ascii (get_string_of_size this_buff 0 8) in
let memorized = 0 <> (int_of_str_off this_buff 8) in
incr mlist_i ;
mlist := (name, memorized) :: !mlist
Expand All @@ -118,7 +118,7 @@ let cre_of_string buff =
for i = 0 to items_cnt - 1 do
let slots = ref [] in
let this_buff = String.sub buff (items_off +i * 0x14) 0x14 in
let name = String.uppercase (get_string_of_size this_buff 0 8) in
let name = String.uppercase_ascii (get_string_of_size this_buff 0 8) in
let unknown = short_of_str_off this_buff 0x8 in
let q1 = short_of_str_off this_buff 0xa in
let q2 = short_of_str_off this_buff 0xc in
Expand Down Expand Up @@ -308,7 +308,7 @@ let string_to_slots str =
| Load.BG2
| Load.IWD1
| Load.NONE ->
List.map (fun str -> match String.uppercase str with
List.map (fun str -> match String.uppercase_ascii str with
| "HELMET" -> 0
| "ARMOR" -> 1
| "SHIELD" -> 2
Expand Down Expand Up @@ -350,10 +350,10 @@ let string_to_slots str =
(try assert false with Assert_failure(file,line,col) ->
set_errors file line) ;
log_and_print "WARNING: ADD_CRE_ITEM: Unknown slot %s. Default to INV15 for placement.\n"
(String.uppercase str) ;
(String.uppercase_ascii str) ;
35) (Str.split many_whitespace_regexp item_slot)
| Load.IWD2 ->
List.map (fun str -> match String.uppercase str with
List.map (fun str -> match String.uppercase_ascii str with
| "HELMET" -> 0
| "ARMOR" -> 1
(* | "SHIELD" -> 2 *)
Expand Down Expand Up @@ -407,10 +407,10 @@ let string_to_slots str =
(try assert false with Assert_failure(file,line,col) ->
set_errors file line) ;
log_and_print "WARNING: ADD_CRE_ITEM: Unknown slot %s. Default to INV23 for placement.\n"
(String.uppercase str) ;
(String.uppercase_ascii str) ;
47) (Str.split many_whitespace_regexp item_slot)
| Load.PST ->
List.map (fun str -> match String.uppercase str with
List.map (fun str -> match String.uppercase_ascii str with
| "EARRING1" -> 0
| "ARMOR" -> 1
| "TATTOO1" -> 2
Expand Down Expand Up @@ -460,7 +460,7 @@ let string_to_slots str =
(try assert false with Assert_failure(file,line,col) ->
set_errors file line) ;
log_and_print "WARNING: ADD_CRE_ITEM: Unknown slot %s. Default to INV19 for placement.\n"
(String.uppercase str) ;
(String.uppercase_ascii str) ;
43) (Str.split many_whitespace_regexp item_slot)
in
possible_slots
14 changes: 7 additions & 7 deletions src/dc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ let preprocess_action2 game a = match a with
-> List.iter (fun n -> make_available (action_to_str a) game n false) nl
| Alter_Trans (n,_,_,l) ->
make_available (action_to_str a) game n false;
List.iter (fun (b,c) -> if String.uppercase b = "EPILOGUE" then begin
List.iter (fun (b,c) -> if String.uppercase_ascii b = "EPILOGUE" then begin
match c with
| Alter_Trans_String c -> begin
let parts = Str.split (Str.regexp " ") c in
Expand Down Expand Up @@ -655,7 +655,7 @@ let rec process_action game a = match a with
let regexp_list = List.map (fun n -> Str.regexp_case_fold n) nl in
let matches = Key.search_key_resources game.Load.key true
(fun poss ->
let b,e = split_resref (String.uppercase poss) in
let b,e = split_resref (String.uppercase_ascii poss) in
let ans = e = "DLG" &&
(List.exists (fun regexp -> Str.string_match regexp b 0)
regexp_list) in
Expand Down Expand Up @@ -691,7 +691,7 @@ let rec process_action game a = match a with
let regexp = Str.regexp_case_fold n in
let matches = Key.search_key_resources game.Load.key true
(fun poss ->
let b,e = split_resref (String.uppercase poss) in
let b,e = split_resref (String.uppercase_ascii poss) in
let ans = e = "DLG" &&
Str.string_match regexp b 0 in
if ans then make_available (action_to_str a) game b false;
Expand Down Expand Up @@ -883,16 +883,16 @@ let rec process_action game a = match a with
let get_next s =
let parts = Str.split (Str.regexp " ") s in
match parts with
| [a;b;c] -> Dlg.Symbolic(String.uppercase b,c,false)
| [a;b] -> Dlg.Symbolic(String.uppercase n,b,false)
| [a;b;c] -> Dlg.Symbolic(String.uppercase_ascii b,c,false)
| [a;b] -> Dlg.Symbolic(String.uppercase_ascii n,b,false)
| [a] -> Dlg.Exit
| _ -> failwith "unknown transition in ALTER_STRING"
in
let intos = match into with
| Alter_Trans_Lse s -> single_string_of_tlk_string game s
| Alter_Trans_String s -> s
in
match String.uppercase what with
match String.uppercase_ascii what with
| "TRIGGER" -> trans.Dlg.trans_trigger <- some_or_none intos intos
| "ACTION" -> trans.Dlg.action <- some_or_none intos intos
| "REPLY" -> trans.Dlg.trans_str <- some_or_none (get_lse(into)) intos
Expand Down Expand Up @@ -1043,7 +1043,7 @@ end
| Some(a1),Some(a2) ->
let aa1 = Str.global_replace (Str.regexp "[ \t\n\r]+") "" a1 in
let aa2 = Str.global_replace (Str.regexp "[ \t\n\r]+") "" a2 in
if String.uppercase aa1 = String.uppercase aa2 then None else begin try
if String.uppercase_ascii aa1 = String.uppercase_ascii aa2 then None else begin try
let a2_init = Str.string_before a2 (Str.search_forward one_newline_or_cr_regexp a2 0) in
let a2_after = Str.global_replace (Str.regexp "[ \t\n\r]+") "" (Str.string_after a2 (Str.search_forward one_newline_or_cr_regexp a2 0)) in
if Str.string_match (Str.regexp "SetGlobal(\"[^\"]*\",\"GLOBAL\",1)") a2_init 0 then begin
Expand Down
6 changes: 3 additions & 3 deletions src/dlg.ml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ let from_ht = Hashtbl.create 511

let load_dlg name buff = begin
let result = Stats.time "unmarshal DLG" (fun () ->
let name = let a,b = split_resref name in String.uppercase a in
let name = let a,b = split_resref name in String.uppercase_ascii a in
try
if String.sub buff 0 8 <> "DLG V1.0" then begin
failwith "not a valid DLG file (wrong sig)"
Expand Down Expand Up @@ -169,11 +169,11 @@ let load_dlg name buff = begin
then Some(dos2unix (get_action index_action)) else None ;
next = if flags land 8 <> 0 then Exit
else
let dest = String.uppercase next_dlg in
let dest = String.uppercase_ascii next_dlg in
(* create "from: " lists *)
if !emit_from then begin
Hashtbl.add from_ht (dest, index_state)
(String.uppercase name,i,t) ;
(String.uppercase_ascii name,i,t) ;
end ;
(Absolute(dest,index_state)) ;
} , off)
Expand Down
Loading