Cosmetics

This commit is contained in:
malc 2018-05-20 06:42:52 +03:00
parent e388042c4d
commit 85d15ff3a0
3 changed files with 32 additions and 35 deletions

50
help.ml
View File

@ -1,28 +1,3 @@
open Utils;;
external fz_version : unit -> string = "ml_fz_version";;
external llpp_version : unit -> string = "ml_llpp_version";;
let gotourl launcher url =
let command = Str.global_replace percentsre url launcher in
try ignore @@ spawn command []
with exn -> dolog "failed to execute `%s': %s" command @@ exntos exn
;;
let gotouri launcher uri =
if emptystr launcher
then dolog "%s" uri
else
if nonemptystr @@ geturl uri
then gotourl launcher uri
else dolog "obtained empty url from uri %S" uri
;;
let version () =
Printf.sprintf "llpp version %s, fitz %s, ocaml %s/%d bit"
(llpp_version ()) (fz_version ()) Sys.ocaml_version Sys.word_size
;;
let keys =
{|-----Quitting-----
escape/q - quit
@ -200,6 +175,31 @@ selection command otherwise
o Text selection is limited to a single page
o Text searching is very naive|};;
open Utils;;
external fz_version : unit -> string = "ml_fz_version";;
external llpp_version : unit -> string = "ml_llpp_version";;
let gotourl launcher url =
let command = Str.global_replace percentsre url launcher in
try ignore @@ spawn command []
with exn -> dolog "failed to execute `%s': %s" command @@ exntos exn
;;
let gotouri launcher uri =
if emptystr launcher
then dolog "%s" uri
else
if nonemptystr @@ geturl uri
then gotourl launcher uri
else dolog "obtained empty url from uri %S" uri
;;
let version () =
Printf.sprintf "llpp version %s, fitz %s, ocaml %s/%d bit"
(llpp_version ()) (fz_version ()) Sys.ocaml_version Sys.word_size
;;
let makehelp launcher =
let strings =
fz_version ()

6
link.c
View File

@ -4113,6 +4113,12 @@ CAMLprim value ml_fz_version (void)
return caml_copy_string (FZ_VERSION);
}
CAMLprim value ml_llpp_version (void)
{
extern char llpp_version[];
return caml_copy_string (llpp_version);
}
CAMLprim void ml_init (value csock_v, value params_v)
{
CAMLparam2 (csock_v, params_v);

View File

@ -1,11 +1,2 @@
#define CAML_NAME_SPACE
#include <caml/alloc.h>
#include <caml/memory.h>
#define stringify(x) #x
#define ver stringify (LLPP_VERSION)
CAMLprim value ml_llpp_version (void)
{
return caml_copy_string (ver);
}
const char llpp_version[] = stringify (LLPP_VERSION);