Debug code

This commit is contained in:
John Whitington 2018-03-20 10:19:50 +00:00
parent 35ea8bc111
commit 248ea494e4
1 changed files with 8 additions and 0 deletions

View File

@ -348,6 +348,7 @@ type args =
mutable no_hq_print : bool; mutable no_hq_print : bool;
mutable debug : bool; mutable debug : bool;
mutable debugcrypt : bool; mutable debugcrypt : bool;
mutable debugforce : bool;
mutable boxes : bool; mutable boxes : bool;
mutable encrypt_metadata : bool; mutable encrypt_metadata : bool;
mutable retain_numbering : bool; mutable retain_numbering : bool;
@ -433,6 +434,7 @@ let args =
no_hq_print = false; no_hq_print = false;
debug = false; debug = false;
debugcrypt = false; debugcrypt = false;
debugforce = false;
boxes = false; boxes = false;
encrypt_metadata = true; encrypt_metadata = true;
retain_numbering = false; retain_numbering = false;
@ -518,6 +520,7 @@ let reset_arguments () =
args.no_hq_print <- false; args.no_hq_print <- false;
args.debug <- false; args.debug <- false;
args.debugcrypt <- false; args.debugcrypt <- false;
args.debugforce <- false;
args.boxes <- false; args.boxes <- false;
args.encrypt_metadata <- true; args.encrypt_metadata <- true;
args.retain_numbering <- false; args.retain_numbering <- false;
@ -625,6 +628,7 @@ let banned banlist = function
mem Pdfcrypt.NoEdit banlist mem Pdfcrypt.NoEdit banlist
let operation_allowed pdf banlist op = let operation_allowed pdf banlist op =
args.debugforce ||
match op with match op with
| None -> | None ->
if args.debugcrypt then Printf.printf "operation is None, so allowed!\n"; if args.debugcrypt then Printf.printf "operation is None, so allowed!\n";
@ -1291,6 +1295,9 @@ let setdebug () =
let setdebugcrypt () = let setdebugcrypt () =
args.debugcrypt <- true args.debugcrypt <- true
let setdebugforce () =
args.debugforce <- true
let setboxes () = let setboxes () =
args.boxes <- true args.boxes <- true
@ -2091,6 +2098,7 @@ and specs =
("-gs", Arg.String setgspath, ""); ("-gs", Arg.String setgspath, "");
("-debug", Arg.Unit setdebug, ""); ("-debug", Arg.Unit setdebug, "");
("-debug-crypt", Arg.Unit setdebugcrypt, ""); ("-debug-crypt", Arg.Unit setdebugcrypt, "");
("-debug-force", Arg.Unit setdebugforce, "");
("-fix-prince", Arg.Unit (setop RemoveUnusedResources), ""); ("-fix-prince", Arg.Unit (setop RemoveUnusedResources), "");
("-extract-text", Arg.Unit (setop ExtractText), ""); ("-extract-text", Arg.Unit (setop ExtractText), "");
("-extract-text-font-size", Arg.Float setextracttextfontsize, ""); ("-extract-text-font-size", Arg.Float setextracttextfontsize, "");