mirror of
				https://github.com/johnwhitington/cpdf-source.git
				synced 2025-06-05 22:09:39 +02:00 
			
		
		
		
	Fixing up Unix dependency
This commit is contained in:
		| @@ -1,77 +1,77 @@ | ||||
| (* C-Style strftime *) | ||||
| open Pdfutil | ||||
|  | ||||
| let strf_A t = "" | ||||
|   (*match t.Unix.tm_wday with | ||||
| let strf_A t = | ||||
|   match t.Cpdfunix.tm_wday with | ||||
|   | 0 -> "Sunday" | 1 -> "Monday" | 2 -> "Tuesday" | ||||
|   | 3 -> "Wednesday" | 4 -> "Thursday" | 5 -> "Friday" | ||||
|   | 6 -> "Saturday" | ||||
|   | _ -> "strf_AFail" *) | ||||
|   | _ -> "strf_AFail" | ||||
|  | ||||
| let strf_a t = | ||||
|   String.sub (strf_A t) 0 3 | ||||
|  | ||||
| let strf_B t = "" | ||||
|   (*match t.Unix.tm_mon with | ||||
| let strf_B t = | ||||
|   match t.Cpdfunix.tm_mon with | ||||
|   | 0 -> "January" | 1 -> "February" | 2 -> "March" | 3 -> "April" | ||||
|   | 4 -> "May" | 5 -> "June" | 6 -> "July" | 7 -> "August" | ||||
|   | 8 -> "September" | 9 -> "October" | 10 -> "November" | ||||
|   | 11 -> "December" | _ -> "strf_Bfail"*) | ||||
|   | 11 -> "December" | _ -> "strf_Bfail" | ||||
|  | ||||
| let strf_b t = | ||||
|   String.sub (strf_B t) 0 3 | ||||
|  | ||||
| let strf_d t = "" | ||||
|   (*let s = string_of_int t.Unix.tm_mday in  | ||||
|     if String.length s = 1 then "0" ^ s else s *) | ||||
| let strf_d t = | ||||
|   let s = string_of_int t.Cpdfunix.tm_mday in  | ||||
|     if String.length s = 1 then "0" ^ s else s | ||||
|  | ||||
| let strf_e t = "" | ||||
|   (*let s = string_of_int t.Unix.tm_mday in | ||||
|     if String.length s = 1 then " " ^ s else s*) | ||||
| let strf_e t = | ||||
|   let s = string_of_int t.Cpdfunix.tm_mday in | ||||
|     if String.length s = 1 then " " ^ s else s | ||||
|  | ||||
| let strf_H t = "" | ||||
|   (*let s = string_of_int t.Unix.tm_hour in | ||||
|     if String.length s = 1 then "0" ^ s else s*) | ||||
| let strf_H t = | ||||
|   let s = string_of_int t.Cpdfunix.tm_hour in | ||||
|     if String.length s = 1 then "0" ^ s else s | ||||
|  | ||||
| let strf_I t = "" | ||||
|   (*let s = string_of_int (t.Unix.tm_hour mod 12) in | ||||
|     if String.length s = 1 then "0" ^ s else s *) | ||||
| let strf_I t = | ||||
|   let s = string_of_int (t.Cpdfunix.tm_hour mod 12) in | ||||
|     if String.length s = 1 then "0" ^ s else s | ||||
|  | ||||
| let strf_j t = "" | ||||
|   (*let s = string_of_int t.Unix.tm_yday in | ||||
| let strf_j t = | ||||
|   let s = string_of_int t.Cpdfunix.tm_yday in | ||||
|     match String.length s with | ||||
|     | 1 -> "00" ^ s | ||||
|     | 2 -> "0" ^ s | ||||
|     | _ -> s *) | ||||
|     | _ -> s | ||||
|  | ||||
| let strf_m t = "" | ||||
|   (*let s = string_of_int (t.Unix.tm_mon + 1) in | ||||
|     if String.length s = 1 then "0" ^ s else s *) | ||||
| let strf_m t = | ||||
|   let s = string_of_int (t.Cpdfunix.tm_mon + 1) in | ||||
|     if String.length s = 1 then "0" ^ s else s | ||||
|  | ||||
| let strf_M t = "" | ||||
|   (*let s = string_of_int t.Unix.tm_min in | ||||
|     if String.length s = 1 then "0" ^ s else s*) | ||||
| let strf_M t = | ||||
|   let s = string_of_int t.Cpdfunix.tm_min in | ||||
|     if String.length s = 1 then "0" ^ s else s | ||||
|  | ||||
| let strf_p t = "" | ||||
|   (*if t.Unix.tm_hour >= 12 then "p.m" else "a.m"*) | ||||
| let strf_p t = | ||||
|   if t.Cpdfunix.tm_hour >= 12 then "p.m" else "a.m" | ||||
|  | ||||
| let strf_S t = "" | ||||
|   (*let s = string_of_int t.Unix.tm_sec in | ||||
|     if String.length s = 1 then "0" ^ s else s*) | ||||
| let strf_S t = | ||||
|   let s = string_of_int t.Cpdfunix.tm_sec in | ||||
|     if String.length s = 1 then "0" ^ s else s | ||||
|  | ||||
| let strf_T t = | ||||
|   strf_H t ^ ":" ^ strf_M t ^ ":" ^ strf_S t | ||||
|  | ||||
| let strf_u t = "" | ||||
|   (*match t.Unix.tm_wday with | ||||
| let strf_u t = | ||||
|   match t.Cpdfunix.tm_wday with | ||||
|   | 0 -> "7" | ||||
|   | n -> string_of_int (n + 1)*) | ||||
|   | n -> string_of_int (n + 1) | ||||
|  | ||||
| let strf_w t = "" | ||||
|   (*string_of_int t.Unix.tm_wday *) | ||||
| let strf_w t = | ||||
|   string_of_int t.Cpdfunix.tm_wday | ||||
|  | ||||
| let strf_Y t = "" | ||||
|   (*string_of_int (t.Unix.tm_year + 1900) *) | ||||
| let strf_Y t = | ||||
|   string_of_int (t.Cpdfunix.tm_year + 1900) | ||||
|  | ||||
| let strf_percent _ = "%" | ||||
|  | ||||
| @@ -82,12 +82,12 @@ let strftime_pairs = | ||||
|    "%p", strf_p; "%S", strf_S; "%T", strf_T; "%u", strf_u; | ||||
|    "%w", strf_w; "%Y", strf_Y; "%%", strf_percent] | ||||
|  | ||||
| let strftime text = "" | ||||
|   (*let time = Unix.localtime (Unix.gettimeofday ()) in | ||||
| let strftime text = | ||||
|   let time = Cpdfunix.localtime (Cpdfunix.gettimeofday ()) in | ||||
|     let text = ref text in | ||||
|       iter | ||||
|         (fun (search, replace_fun) -> | ||||
|            text := string_replace_all search (replace_fun time) !text) | ||||
|         strftime_pairs; | ||||
|       !text*) | ||||
|       !text | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user