Skip to content

Commit

Permalink
Initial revision
Browse files Browse the repository at this point in the history
  • Loading branch information
ddr committed Sep 1, 1998
1 parent af21b8c commit afcccc5
Show file tree
Hide file tree
Showing 83 changed files with 19,845 additions and 0 deletions.
58 changes: 58 additions & 0 deletions Makefile
@@ -0,0 +1,58 @@
# $Id: Makefile,v 1.1 1998-09-01 14:32:01 ddr Exp $

include tools/Makefile.inc

all:: out

out::
cd wserver; $(MAKE) all
cd src; $(MAKE) all
cd ged2gwb; $(MAKE) all
cd gwb2ged; $(MAKE) all

opt::
cd wserver; $(MAKE) opt
cd src; $(MAKE) opt
cd ged2gwb; $(MAKE) opt
cd gwb2ged; $(MAKE) opt

distrib:
$(RM) -rf distribution
mkdir distribution
cp CHANGES LICENCE distribution/.
cp src/gwc.opt distribution/gwc$(EXE)
cp src/consang.opt distribution/consang$(EXE)
cp src/lgwd distribution/gwd$(EXE)
cp src/gwu.opt distribution/gwu$(EXE)
cp ged2gwb/ged2gwb.opt distribution/ged2gwb$(EXE)
cp gwb2ged/gwb2ged.opt distribution/gwb2ged$(EXE)
cp etc/ALIRE.txt distribution/.
cp etc/README.txt distribution/.
mkdir distribution/doc
cp doc/index.htm distribution/doc/.
mkdir distribution/doc/fr distribution/doc/en
cp doc/fr/*.htm distribution/doc/fr/.
cp doc/en/*.htm distribution/doc/en/.
mkdir distribution/lang
cp etc/a.cnf distribution/.
cp hd/lang/*.txt distribution/lang/.
for dir in de en eo es fr it nl se; do \
mkdir distribution/lang/$$dir; \
cp hd/lang/$$dir/start.txt distribution/lang/$$dir/.; \
done
mkdir distribution/images
cp hd/images/up.gif distribution/images/.

clean::
cd wserver; $(MAKE) clean
cd src; $(MAKE) clean
cd ged2gwb; $(MAKE) clean
cd gwb2ged; $(MAKE) clean
$(RM) -rf distribution
$(RM) -f *~ .#*

depend:
cd wserver; $(MAKE) depend
cd src; $(MAKE) depend
cd ged2gwb; $(MAKE) depend
cd gwb2ged; $(MAKE) depend
20 changes: 20 additions & 0 deletions ged2gwb/Makefile
@@ -0,0 +1,20 @@
# $Id: Makefile,v 1.1 1998-09-01 14:32:12 ddr Exp $

include ../tools/Makefile.inc

OCAMLI=-I ../src
OBJS=../src/argl.cmo ../src/adef.cmo ../src/iovalue.cmo ../src/name.cmo ../src/gutil.cmo ../src/btree.cmo ../src/iobase.cmo aurejac.cmo ansel.cmo ged2gwb.cmo

all:: ged2gwb.out
opt:: ged2gwb.opt

ged2gwb.out: $(OBJS)
$(OCAMLC) -custom unix.cma $(LIBUNIX) $(CAMLP4D)/gramlib.cma $(OBJS) -o ged2gwb.out

ged2gwb.opt: $(OBJS:.cmo=.cmx)
$(OCAMLOPT) unix.cmxa $(LIBUNIX) $(CAMLP4D)/gramlib.cmxa $(OBJS:.cmo=.cmx) -o ged2gwb.opt

depend:
ocamldep $(OCAMLI) *.ml* > .depend

include .depend
73 changes: 73 additions & 0 deletions ged2gwb/ansel.ml
@@ -0,0 +1,73 @@
(* $Id: ansel.ml,v 1.1 1998-09-01 14:32:13 ddr Exp $ *)

value acute =
fun
[ 'a' -> 'á'
| 'e' -> 'é'
| 'i' -> 'í'
| 'E' -> 'É'
| x -> x ]
;

value grave =
fun
[ 'a' -> 'à'
| 'e' -> 'è'
| 'u' -> 'ù'
| x -> x ]
;

value circ =
fun
[ 'a' -> 'â'
| 'e' -> 'ê'
| 'i' -> 'î'
| 'o' -> 'ô'
| x -> x ]
;

value uml =
fun
[ 'a' -> 'ä'
| 'e' -> 'ë'
| 'i' -> 'ï'
| 'o' -> 'ö'
| 'O' -> 'Ö'
| x -> x ]
;

value cedil =
fun
[ 'c' -> 'ç'
| x -> x ]
;

value translate s =
let len =
loop 0 0 where rec loop i len =
if i == String.length s then len
else if i == String.length s - 1 then len + 1
else
match Char.code s.[i] with
[ 225 | 226 | 227 | 232 | 240 -> loop (i + 1) len
| _ -> loop (i + 1) (len + 1) ]
in
if len == String.length s then s
else
let s' = String.create len in
loop 0 0 where rec loop i i' =
if i == String.length s then s'
else if i == String.length s - 1 then
do s'.[i'] := s.[i]; return s'
else
let i =
match Char.code s.[i] with
[ 225 -> do s'.[i'] := grave s.[i+1]; return i + 1
| 226 -> do s'.[i'] := acute s.[i+1]; return i + 1
| 227 -> do s'.[i'] := circ s.[i+1]; return i + 1
| 232 -> do s'.[i'] := uml s.[i+1]; return i + 1
| 240 -> do s'.[i'] := cedil s.[i+1]; return i + 1
| _ -> do s'.[i'] := s.[i]; return i ]
in
loop (i + 1) (i' + 1)
;
146 changes: 146 additions & 0 deletions ged2gwb/aurejac.ml
@@ -0,0 +1,146 @@
(* $Id: aurejac.ml,v 1.1 1998-09-01 14:32:12 ddr Exp $ *)
(* Find titles had hoc for genealogy Aurejac *)

value trace = False;

value rec s_skip_spaces s i =
if i == String.length s then i
else if s.[i] = ' ' then s_skip_spaces s (i + 1)
else i
;
value string_sub_unless_dot s ibeg i =
if i > ibeg + 1 && s.[i - 1] = '.' then
(String.sub s ibeg (i - ibeg - 1), i - 1)
else (String.sub s ibeg (i - ibeg), i)
;

value rec s_ident s ibeg i =
if i == String.length s then
if i == ibeg then raise Not_found
else string_sub_unless_dot s ibeg i
else
match s.[i] with
[ 'a'..'z' | 'A'..'Z' | 'À'..'Ö' | 'Ø'..'ö' | 'ø'..'ÿ' | '-' | '.' ->
s_ident s ibeg (i + 1)
| ''' -> (String.sub s ibeg (i + 1 - ibeg), i + 1)
| _ ->
if i == ibeg then raise Not_found
else string_sub_unless_dot s ibeg i ]
;
value rec s_skip_opt_nth s ibeg i =
if i == String.length s then
if i == ibeg then i else raise Not_found
else
match s.[i] with
[ '0'..'9' -> s_skip_opt_nth s ibeg (i + 1)
| _ ->
if i == ibeg then i
else
let (id, i1) = s_ident s i i in
match id with
[ "er" | "ème" -> i1
| _ -> raise Not_found ] ]
;
value s_complement s i id =
match id with
[ "de" | "des" | "d'" | "en" | "du" ->
let i = s_skip_spaces s i in
let (id2, i) = s_ident s i i in
let (particle, complement, i) =
if id = "de" then
match id2 with
[ "la" | "La" | "l'" | "L'" ->
let i = s_skip_spaces s i in
let (complement, i) = s_ident s i i in
("de " ^ id2, complement, i)
| _ -> (id, id2, i) ]
else (id, id2, i)
in
match complement.[0] with
[ 'A'..'Z' | 'À'..'Ö' ->
let complement =
if particle.[String.length particle - 1] = ''' then
particle ^ complement
else particle ^ " " ^ complement
in
let (complement, i) =
if complement.[String.length complement - 1] = ''' then
let (id, i) = s_ident s i i in
(complement ^ id, i)
else (complement, i)
in
(complement, i)
| _ -> raise Not_found ]
| _ -> raise Not_found ]
;

value try_find_title s i =
let i = s_skip_spaces s i in
let i = s_skip_opt_nth s i i in
let i = s_skip_spaces s i in
let (title, i) =
let (title, i) = s_ident s i i in
if title = "premier" || title = "Premier" then
let i = s_skip_spaces s i in
s_ident s i i
else (title, i)
in
let i = s_skip_spaces s i in
let (title, id, i) =
let (cotitle, i) = s_ident s i i in
match cotitle with
[ "de" | "des" | "d'" | "en" | "du" -> (title, cotitle, i)
| _ ->
match cotitle.[0] with
[ 'A'..'Z' | 'À'..'Ö' ->
let i = s_skip_spaces s i in
let (id, i) = s_ident s i i in
(title ^ " " ^ cotitle, id, i)
| _ -> raise Not_found ] ]
in
let (place, i) = s_complement s i id in
let (place, i) =
try
let i = s_skip_spaces s i in
let (id, i) = s_ident s i i in
let (comp, i) = s_complement s i id in
(place ^ " " ^ comp, i)
with [ Not_found -> (place, i) ]
in
let title = String.uncapitalize title in
do if trace then
do Printf.printf "%s : %s\n" title place; flush stdout; return ()
else ();
return
(title, place)
;

value start_id =
["Profession"; "Abbesse"; "Châtelaine"; "Comtesse"; "Dame"; "Héritière";
"Reine"; "Vicomtesse"]
;

value find_titles s =
match try Some (s_ident s 0 0) with [ Not_found -> None ] with
[ Some (id, i) when List.mem id start_id ->
do if trace then do Printf.printf " %s\n" s; flush stdout; return ()
else ();
return
let i = s_skip_spaces s i in
let i =
if id = "Profession" then
if i < String.length s && s.[i] == ':' then s_skip_spaces s (i + 1)
else i
else 0
in
try [try_find_title s i] with
[ Not_found ->
try
let i = String.index s ',' + 1 in
[try_find_title s i]
with
[ Not_found ->
if trace then do Printf.printf "failed\n"; flush stdout; return []
else [] ] ]
| _ -> [] ]
;

0 comments on commit afcccc5

Please sign in to comment.