From 83a22ab31b7dd8680c7d9115d8904ea58c59624a Mon Sep 17 00:00:00 2001 From: odanoburu Date: Fri, 19 Oct 2018 22:21:22 +0000 Subject: [PATCH 01/18] (Por) Extend: add lins - add PastPartAP, PastPartAgentAP - add PassVPSlash, PassAgentVPSlash lins from ExtraRomance - correct CompoundN --- src/portuguese/ExtendPor.gf | 45 +++++++++++++++++++---------- src/portuguese/MakeStructuralPor.gf | 3 +- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/portuguese/ExtendPor.gf b/src/portuguese/ExtendPor.gf index 6719ca65d..3ee18db8f 100644 --- a/src/portuguese/ExtendPor.gf +++ b/src/portuguese/ExtendPor.gf @@ -18,7 +18,9 @@ concrete ExtendPor of Extend = iFem_Pron, ListVPS, PassVPSlash, - PassVPSlash, + PassAgentVPSlash, + PastPartAP, + PastPartAgentAP, ProDrop, theyFem_Pron, VPS, @@ -94,31 +96,42 @@ concrete ExtendPor of Extend = PrepCN prep cn = {s = prep.s ++ prepCase prep.c ++ cn.s ! Sg} ; lin - PassVPSlash vps = - let auxvp = predV copula - in - insertComplement (\\a => let agr = complAgr a in vps.s.s ! VPart agr.g agr.n) { - s = auxvp.s ; - agr = auxvp.agr ; - neg = vps.neg ; - clit1 = vps.clit1 ; - clit2 = vps.clit2 ; - clit3 = vps.clit3 ; - isNeg = vps.isNeg ; - comp = vps.comp ; - ext = vps.ext + PastPartAP vps = pastPartAP vps [] ; + + PastPartAgentAP vps np = pastPartAP vps (let by = in by.s ++ (np.s ! by.c).ton) ; + + oper + pastPartAP : VPSlash -> Str -> AP ; + pastPartAP vps agent = lin AP { + s = \\af => vps.comp ! (aform2aagr af ** {p = P3}) ++ vps.s.s ! VPart (aform2gender af) (aform2number af) ++ agent ; + isPre = False } ; + lin + PassVPSlash vps = passVPSlash vps [] ; + + PassAgentVPSlash vps np = passVPSlash vps (let by = in by.s ++ (np.s ! by.c).ton) ; + ExistsNP np = mkClause [] True False np.a (insertComplement (\\_ => (np.s ! Nom).ton) (predV (mkV "existir"))) ; + oper + passVPSlash : VPSlash -> Str -> VP = \vps, agent -> + let auxvp = predV auxPassive + in + vps ** { + s = auxvp.s ; + agr = auxvp.agr ; + comp = \\a => vps.comp ! a ++ (let agr = complAgr a in vps.s.s ! VPart agr.g agr.n) ++ agent ; + } ; + lin CompoundN noun noun2 = { -- order is different because that's needed for correct translation from english s = \\n => noun2.s ! n - ++ variants {genNumForms "do" "da" "dos" "das" ! noun.g ! n; "de"} - ++ noun.s ! n ; + ++ variants {"de" ; genForms "do" "da" ! noun.g} + ++ noun.s ! Sg ; g = noun2.g } ; diff --git a/src/portuguese/MakeStructuralPor.gf b/src/portuguese/MakeStructuralPor.gf index d7f714587..87ab6dc31 100644 --- a/src/portuguese/MakeStructuralPor.gf +++ b/src/portuguese/MakeStructuralPor.gf @@ -19,5 +19,4 @@ oper a = if_then_else PAgr p (PAg Sg) PNoAg ---- e,g, "chacun de"; other possibilities? } ; - -} +} ; From 8990ee80a847c6eb8bd7a101d6aad1ec05f74b06 Mon Sep 17 00:00:00 2001 From: odanoburu Date: Mon, 22 Oct 2018 14:18:53 +0000 Subject: [PATCH 02/18] (Eng) change lincat of V2A - update V2A linref - add overloaded mkV2A with backwards-compatible signature - update lexicon V2A example - remove old comment with Verb lincat thanks to @inariksit for guidance! --- src/english/CatEng.gf | 10 +++++----- src/english/LexiconEng.gf | 2 +- src/english/ParadigmsEng.gf | 12 ++++++++++-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/english/CatEng.gf b/src/english/CatEng.gf index d57f7d8f5..3d5b19548 100644 --- a/src/english/CatEng.gf +++ b/src/english/CatEng.gf @@ -92,9 +92,9 @@ concrete CatEng of Cat = CommonX - [Pol,SC,CAdv] ** open ResEng, Prelude in { -- Open lexical classes, e.g. Lexicon - V, VS, VQ, VA = Verb ; -- = {s : VForm => Str} ; - V2, V2A, V2Q, V2S = Verb ** {c2 : Str} ; - V3 = Verb ** {c2, c3 : Str} ; + V, VS, VQ, VA = Verb ; + V2, V2Q, V2S = Verb ** {c2 : Str} ; + V2A,V3 = Verb ** {c2, c3 : Str} ; VV = {s : VVForm => Str ; p : Str ; typ : VVType} ; V2V = Verb ** {c2,c3 : Str ; typ : VVType} ; @@ -114,8 +114,8 @@ concrete CatEng of Cat = CommonX - [Pol,SC,CAdv] ** open ResEng, Prelude in { VPSlash = \s -> predV {s = \\_ => s; p = ""; isRefl = False} ** {c2 = ""; gapInMiddle = False; missingAdv = False } ; V, VS, VQ, VA = \s -> {s = \\_ => s; p = ""; isRefl = False} ; - V2, V2A, V2Q, V2S = \s -> {s = \\_ => s; p = ""; isRefl = False; c2=""} ; - V3 = \s -> {s = \\_ => s; p = ""; isRefl = False; c2,c3=""} ; + V2, V2Q, V2S = \s -> {s = \\_ => s; p = ""; isRefl = False; c2=""} ; + V3, V2A = \s -> {s = \\_ => s; p = ""; isRefl = False; c2,c3=""} ; VV = \s -> {s = \\_ => s; p = ""; isRefl = False; typ = VVInf} ; V2V = \s -> {s = \\_ => s; p = ""; isRefl = False; c2,c3="" ; typ = VVInf} ; diff --git a/src/english/LexiconEng.gf b/src/english/LexiconEng.gf index 7597a7a50..cd9d2a8b8 100644 --- a/src/english/LexiconEng.gf +++ b/src/english/LexiconEng.gf @@ -132,7 +132,7 @@ lin oil_N = regN "oil" ; old_A = regADeg "old" ; open_V2 = dirV2 (mkV "open" "opens" "opened" "opened" "opening") ; - paint_V2A = mkV2A (regV "paint") noPrep ; + paint_V2A = mkV2A (regV "paint") ; paper_N = regN "paper" ; paris_PN = mkPN (mkN nonhuman (mkN "Paris")) ; peace_N = regN "peace" ; diff --git a/src/english/ParadigmsEng.gf b/src/english/ParadigmsEng.gf index d88630e99..1a56707b4 100644 --- a/src/english/ParadigmsEng.gf +++ b/src/english/ParadigmsEng.gf @@ -321,7 +321,11 @@ oper } ; ingV2V : V -> Prep -> Prep -> V2V ; -- e.g. prevent (noPrep NP) (from VP-ing) mkVA : V -> VA ; -- e.g. become (AP) - mkV2A : V -> Prep -> V2A ; -- e.g. paint (NP) (AP) + mkV2A : overload { + mkV2A : V -> V2A ; -- e.g. paint (NP) (AP) + mkV2A : V -> Prep -> V2A ; -- backwards compatibility + mkV2A : V -> Prep -> Prep -> V2A ; -- e.g. strike (NP) as (AP) + } ; mkVQ : V -> VQ ; -- e.g. wonder (QS) mkV2Q : V -> Prep -> V2Q ; -- e.g. ask (NP) (QS) @@ -601,7 +605,11 @@ mkInterj : Str -> Interj ingV2V v p t = lin V2V (prepV2 v p ** {c3 = t.s ; typ = VVPresPart}) ; mkVA v = lin VA v ; - mkV2A v p = lin V2A (prepV2 v p) ; + mkV2A = overload { + mkV2A : V -> V2A = \v -> lin V2A (dirdirV3 v) ; + mkV2A : V -> Prep -> V2A = \v,p -> lin V2A (dirV3 v p) ; + mkV2A : V -> Prep -> Prep -> V2A = \v,p1,p2 -> lin V2A (prepPrepV3 v p1 p2) ; + } ; mkV2Q v p = lin V2Q (prepV2 v p) ; mkAS v = v ; From eb074e6bcd4626d1cfd127954f7f1f842ebfe407 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 22 Oct 2018 17:09:33 +0200 Subject: [PATCH 03/18] (Ara) Small cleanup and adding comments --- src/arabic/NounAra.gf | 59 +++++++++++++++++++++---------------------- src/arabic/ResAra.gf | 7 +---- 2 files changed, 30 insertions(+), 36 deletions(-) diff --git a/src/arabic/NounAra.gf b/src/arabic/NounAra.gf index a35572820..d20b3e787 100644 --- a/src/arabic/NounAra.gf +++ b/src/arabic/NounAra.gf @@ -5,26 +5,28 @@ flags optimize=noexpand ; lin DetCN det cn = let { - number = sizeToNumber det.n; - state = possState det.d; + cas : Case -> Case = if_then_else Case det.is1sg Bare ; + number = sizeToNumber det.n ; determiner : Case -> Str = \c -> - det.s ! cn.h ! (detGender cn.g det.n) ! c; - noun : Case -> NTable -> Str = \c,nt -> - let cas = if_then_else Case det.is1sg Bare c -- no case vowel with 1sg poss. suff. - in nt ! number - ! nounState det.d number - ! nounCase cas det.n det.d + det.s ! cn.h ! (detGender cn.g det.n) ! c ; + noun : Case -> Str = \c -> + cn.s ! number + ! nounState det.d number + ! nounCase c det.n det.d ; + adj : Case -> Str = \c -> + cn.adj ! number + ! (definite ! det.d) -- Indef remains Indef, rest become Def + ! c } in { s = \\c => case cnB4det det.isPron det.isNum det.n det.d of { False => determiner c - ++ noun c cn.s -- deal with poss. suffix - ++ cn.adj ! number ! state ! c -- normal case+state - ++ cn.np ! c ; - True => noun c cn.s -- deal with poss. suffix - -- ++ determiner c -- or this? - ++ det.s ! cn.h ! cn.g ! c - ++ cn.adj ! number ! state ! c -- normal case+state + ++ noun c + ++ adj c + ++ cn.np ! c ; + True => noun (cas c) -- deal with possessive suffix + ++ determiner c + ++ adj c ++ cn.np ! c }; a = { pgn = agrP3 cn.h cn.g number; @@ -45,23 +47,20 @@ lin }; a = np.a } ; - {- - --should compile.. not working :( wierd error message.. bug? + +{- PPartNP np v2 = let x = case np.a.pgn of { - Per3 g n => ( positAdj (v2.s ! VPPart) ) ! g ! n ! Indef ; - _ => \\_ => [] -- not occuring anyway - } in { - s = \\c => np.s ! c ++ x ! c ; - a = np.a - }; - -} + Per3 g n => positAdj (v2.s ! VPPart) ) ! g ! n ! Indef ; -- doesn't work because trying to glue runtime tokens + Per2 g n => \\_ => [] ; + _ => \\_ => [] + } in np ** { + s = \\c => np.s ! c ++ v2.s ! VPPart ---- TODO: agreement + }; +-} - -- FIXME try parsing something like "this house now" and you'll get - -- an internal compiler error, but it still works.. wierd.. - AdvNP np adv = { - s = \\c => np.s ! c ++ adv.s; - a = np.a + AdvNP np adv = np ** { + s = \\c => np.s ! c ++ adv.s }; {- DetSg quant ord = { @@ -104,7 +103,7 @@ lin PossPron p = { s = \\_,_,_,_ => p.s ! Gen; d = Poss; - is1sg = case p.a.pgn of { Per1 _ => True ; _ => False } ; + is1sg = case p.a.pgn of { Per1 Sing => True ; _ => False } ; isPron = True; isNum = False } ; diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index bf9a37941..c73158c7a 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -48,8 +48,6 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { --for roots with 2 consonants (works also for assimilated strs, like fc~, --because the function discards anything after the first two characters mkRoot2 : Str -> Root2 = \fcl -> - -- let { cl = drop 2 fcl} in --drop 1 fcl - -- {f = take 2 fcl; c = take 2 cl}; --take 1 case fcl of { f@? + c@? + _ => { f = f ; c = c } ; _ => error ("mkRoot2: too short root" ++ fcl) @@ -138,7 +136,7 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { VPerf Voice PerGenNum | VImpf Mood Voice PerGenNum | VImp Gender Number - | VPPart ; + | VPPart ; -- TODO: add gender and number (or check if easy to use BIND) PerGenNum = Per3 Gender Number @@ -1045,9 +1043,6 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> _ => Def --Lkitaabu }; - possState : State -> State = \s -> - case s of { Poss => Def ; - x => x } ; --FIXME needs testing nounCase : Case -> Size -> State -> Case = \c,size,s -> From 6b0094b22a4c6fe5b742f956c756710fe3cd31b4 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 22 Oct 2018 17:09:51 +0200 Subject: [PATCH 04/18] (Ara) Fixing possessive suffixes --- src/arabic/ParadigmsAra.gf | 4 ++-- src/arabic/ResAra.gf | 9 ++++++--- src/arabic/StructuralAra.gf | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index f84fc7add..9dea1146f 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -435,8 +435,8 @@ resource ParadigmsAra = open mkPron : (_,_,_ : Str) -> PerGenNum -> NP = \ana,nI,I,pgn -> { s = table { - Acc => nI; - Gen => I; + Acc => BIND ++ nI; -- object suffix + Gen => BIND ++ I; -- possessive suffix _ => ana }; a = {pgn = pgn; isPron = True }; diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index c73158c7a..d4f08f631 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -954,7 +954,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> --dual suffixes dl : State => Case => Str = table { - Const => + (Const|Poss) => table { Nom => "َا"; _ => "َيْ" @@ -970,7 +970,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> --sound masculine plural suffixes m_pl : State => Case => Str = table { - Const => + (Const|Poss) => table { Nom => "ُو"; _ => "ِي" @@ -1266,7 +1266,10 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> mkNum : Str -> Str -> Str -> {s : DForm => CardOrd => Gender => State => Case => Str} = \wAhid,awwal,Ula -> - let { wAhida = wAhid + "َة"} in + let wAhida : Str = case wAhid of { + x + "ة" => mkAt wAhid ; + _ => wAhid + "َة" } + in { s= table { unit => table { NCard => table { diff --git a/src/arabic/StructuralAra.gf b/src/arabic/StructuralAra.gf index 8160f2eff..7931b8132 100644 --- a/src/arabic/StructuralAra.gf +++ b/src/arabic/StructuralAra.gf @@ -43,9 +43,9 @@ concrete StructuralAra of Structural = CatAra ** -- how8many_IDet = mkDet "كَمْ" Pl Const ; -- IL: check (was ["هْو مَني"]) ; -- if_Subj = ss "ِف" ; in8front_Prep = ss "مُقَابِلَ" ; - i_Pron = mkPron "أَنَا" "نِي" "ِي" (Per1 Sing); + i_Pron = mkPron "أَنَا" "نِي" "ي" (Per1 Sing); in_Prep = ss "فِي" ; - it_Pron = mkPron "ِت" "ِت" "ِتس" (Per3 Masc Sg); -- IL: check + it_Pron = he_Pron ; -- was: it_Pron = mkPron "ِت" "ِت" "ِتس" (Per3 Masc Sg); -- less_CAdv = ss "لسّ" ; many_Det = mkDet "جَمِيع" Pl Const ; -- more_CAdv = ss "مْري" ; From e4d34bff3202ec28d9d23fe803109021bed2f92d Mon Sep 17 00:00:00 2001 From: odanoburu Date: Mon, 22 Oct 2018 18:27:20 +0000 Subject: [PATCH 05/18] (Eng) update SlashV2A with new V2A lincat --- src/english/VerbEng.gf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/english/VerbEng.gf b/src/english/VerbEng.gf index 20fd1863e..cf397e8c7 100644 --- a/src/english/VerbEng.gf +++ b/src/english/VerbEng.gf @@ -21,7 +21,7 @@ concrete VerbEng of Verb = CatEng ** open ResEng, Prelude in { SlashV2S v s = insertExtrac (conjThat ++ s.s) (predVc v) ; ---- insertExtra? --- SlashV2S v s = insertObjc (variants {\\_ => conjThat ++ s.s; \\_ => s.s}) (predVc v) ; SlashV2Q v q = insertExtrac (q.s ! QIndir) (predVc v) ; - SlashV2A v ap = insertObjc (\\a => ap.s ! a) (predVc v) ; ---- + SlashV2A v ap = insertObjc (\\a => v.c3 ++ ap.s ! a) (predVc v) ; ---- ComplSlash vp np = let vp' = case vp.gapInMiddle of { From aa4257efef4bb48ddc0081f9c9d344cf06391da2 Mon Sep 17 00:00:00 2001 From: Thomas Hallgren Date: Mon, 22 Oct 2018 21:43:41 +0200 Subject: [PATCH 06/18] Add a 'make doc' target in the main Makefile It first build the RGL, then calls doc/Makefile, with the corrent GF_LIB_PATH, to build the documentation. --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7fbc22f5a..7dd6b9157 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ RUNMAKE=runghc Make.hs -.PHONY: build copy install clean +.PHONY: build copy install doc clean default: build copy @@ -14,5 +14,8 @@ copy: install: build copy +doc: build + make -C doc GF_LIB_PATH=../dist + clean: $(RUNMAKE) clean From 881753ce3e5a11c23749159fd168bded11b9a54a Mon Sep 17 00:00:00 2001 From: Thomas Hallgren Date: Mon, 22 Oct 2018 23:38:56 +0200 Subject: [PATCH 07/18] doc/Makefile: incremental and parallel rebuild of the synopsis Enough dependencies have been added so that * If nothing has changed, MkSynopsis.hs will not be run, so synopisis.html will not be needlessly regenerated. * You can use 'make -j' to build examples for different languages in parallel. Hopefully 'make synopsis' produces the exact same result as before, but if it turns out that some dependencies are missing and something is not rebuilt despite of changes, 'make clean' can be used to force a full rebuild. --- doc/Makefile | 77 +++++++++++++++++++++-------------------------- doc/MkExxTable.hs | 4 +-- doc/MkSynopsis.hs | 6 ++-- 3 files changed, 40 insertions(+), 47 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index 4fee45382..e7f51b357 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,56 +1,49 @@ -.PHONY: abstract synopsis +.PHONY: abstract synopsis index status -all: exx synopsis +all: synopsis GF_alltenses=$(GF_LIB_PATH)/alltenses +GF=gf +GFDOC=gfdoc index: txt2tags -thtml index.txt status: txt2tags -thtml status.txt -synopsis: - runghc MkSynopsis.hs + +synopsis: synopsis.html + +S=../src + +# List of languages extracted from MkSynopsis.hs +LANGS=Afr Bul Cat Chi Dan Dut Eng Est Eus Fin Fre Ger Gre Hin Ice Ita Jpn Lav Mlt Mon Nep Nor Nno Pes Pnb Pol Ron Rus Snd Spa Swe Tha Urd + +# This list was constructed by observing what files MkSynopsis.hs reads +SRC_FILES=$S/abstract/Common.gf $S/abstract/Cat.gf $S/api/Constructors.gf $S/abstract/Structural.gf $(patsubst %,$S/*/Paradigms%.gf,$(LANGS)) + +EXAMPLES_OUT=$(patsubst %,api-examples-%.txt,$(LANGS)) + +synopsis.html: $(EXAMPLES_OUT) $(SRC_FILES) + runghc MkSynopsis.hs >out categories-imagemap.html: categories.dot dot -Tcmapx $^ > $@ abstract: - gfdoc -txthtml ../src/abstract/*.gf - mv ../src/abstract/*.html abstract + $(GFDOC) -txthtml $S/abstract/*.gf + mv $S/abstract/*.html abstract -exx-script: - runghc MkExx.hs api-examples.gfs -exx: exx-script - gf -retain -s $(GF_alltenses)/TryAfr.gfo api-examples-Afr.txt - gf -retain -s $(GF_alltenses)/TryBul.gfo api-examples-Bul.txt - gf -retain -s $(GF_alltenses)/TryCat.gfo api-examples-Cat.txt - gf -retain -s $(GF_alltenses)/TryChi.gfo api-examples-Chi.txt - gf -retain -s $(GF_alltenses)/TryDan.gfo api-examples-Dan.txt - gf -retain -s $(GF_alltenses)/TryDut.gfo api-examples-Dut.txt - gf -retain -s $(GF_alltenses)/TryEng.gfo api-examples-Eng.txt - gf -retain -s $(GF_alltenses)/TryEst.gfo api-examples-Est.txt - gf -retain -s $(GF_alltenses)/TryEus.gfo api-examples-Eus.txt - gf -retain -s $(GF_alltenses)/TryFin.gfo api-examples-Fin.txt - gf -retain -s $(GF_alltenses)/TryFre.gfo api-examples-Fre.txt - gf -retain -s $(GF_alltenses)/TryGer.gfo api-examples-Ger.txt - gf -retain -s $(GF_alltenses)/TryGre.gfo api-examples-Gre.txt - gf -retain -s $(GF_alltenses)/TryHin.gfo api-examples-Hin.txt - gf -retain -s $(GF_alltenses)/TryIce.gfo api-examples-Ice.txt - gf -retain -s $(GF_alltenses)/TryIta.gfo api-examples-Ita.txt - gf -retain -s $(GF_alltenses)/TryJpn.gfo api-examples-Jpn.txt - gf -retain -s $(GF_alltenses)/TryLav.gfo api-examples-Lav.txt - gf -retain -s $(GF_alltenses)/TryMlt.gfo api-examples-Mlt.txt - gf -retain -s $(GF_alltenses)/TryMon.gfo api-examples-Mon.txt - gf -retain -s $(GF_alltenses)/TryNep.gfo api-examples-Nep.txt - gf -retain -s $(GF_alltenses)/TryNor.gfo api-examples-Nor.txt - gf -retain -s $(GF_alltenses)/TryNno.gfo api-examples-Nno.txt - gf -retain -s $(GF_alltenses)/TryPes.gfo api-examples-Pes.txt - gf -retain -s $(GF_alltenses)/TryPnb.gfo api-examples-Pnb.txt - gf -retain -s $(GF_alltenses)/TryPol.gfo api-examples-Pol.txt - gf -retain -s $(GF_alltenses)/TryRon.gfo api-examples-Ron.txt - gf -retain -s $(GF_alltenses)/TryRus.gfo api-examples-Rus.txt - gf -retain -s $(GF_alltenses)/TrySnd.gfo api-examples-Snd.txt - gf -retain -s $(GF_alltenses)/TrySpa.gfo api-examples-Spa.txt - gf -retain -s $(GF_alltenses)/TrySwe.gfo api-examples-Swe.txt - gf -retain -s $(GF_alltenses)/TryTha.gfo api-examples-Tha.txt - gf -retain -s $(GF_alltenses)/TryUrd.gfo api-examples-Urd.txt + +api-examples.gfs: api-examples.txt + runghc MkExx.hs < $< > $@ + + +# Since .gfo files aren't self-contained, the dependencies given here are +# incomplete. But I am thinking that the Try%.gfo file will always be newer +# than any other files it depends on, so the rule will trigger when +# needed anyway. //TH 2018-10-22 +api-examples-%.txt: $(GF_alltenses)/Try%.gfo api-examples.gfs + GF_LIB_PATH=$(GF_LIB_PATH) $(GF) -retain -s $< $@ + +clean: + rm -rf out synopsis.txt api-examples.gfs $(EXAMPLES_OUT) diff --git a/doc/MkExxTable.hs b/doc/MkExxTable.hs index a7b8a47ca..7fff127af 100644 --- a/doc/MkExxTable.hs +++ b/doc/MkExxTable.hs @@ -1,7 +1,7 @@ module MkExxTable (getApiExx, ApiExx, prApiEx, mkEx) where -import System.Cmd -import System.Environment +--import System.Cmd +import System.Environment(getArgs) import qualified Data.Map as M import Data.Char diff --git a/doc/MkSynopsis.hs b/doc/MkSynopsis.hs index 709de13d9..859ac0678 100644 --- a/doc/MkSynopsis.hs +++ b/doc/MkSynopsis.hs @@ -1,6 +1,6 @@ import MkExxTable -import System.Cmd -import System.Environment +import System.Process(system) +import System.Environment(getArgs) import Data.Char import Data.List import qualified Data.ByteString.Char8 as BS @@ -16,7 +16,7 @@ synopsis = "synopsis.txt" -- the language in which revealed examples are shown revealedLang = "Eng" --- all languages shown +-- all languages shown (a copy of this list appears in Makefile) apiExxFiles = ["api-examples-" ++ lang ++ ".txt" | lang <- words -- "Eng Chi" "Afr Bul Cat Chi Dan Dut Eng Est Eus Fin Fre Ger Gre Hin Ice Ita Jpn Lav Mlt Mon Nep Nor Nno Pes Pnb Pol Ron Rus Snd Spa Swe Tha Urd" From 369d45709694ca8b273b708a983a55899b58135e Mon Sep 17 00:00:00 2001 From: Thomas Hallgren Date: Tue, 23 Oct 2018 16:20:00 +0200 Subject: [PATCH 08/18] doc/Makefile: add missing dependencies Dependencies on txt2tags includes and Haskell source files were missing. --- doc/Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index e7f51b357..3988d7a4d 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -22,9 +22,10 @@ LANGS=Afr Bul Cat Chi Dan Dut Eng Est Eus Fin Fre Ger Gre Hin Ice Ita Jpn Lav Ml SRC_FILES=$S/abstract/Common.gf $S/abstract/Cat.gf $S/api/Constructors.gf $S/abstract/Structural.gf $(patsubst %,$S/*/Paradigms%.gf,$(LANGS)) EXAMPLES_OUT=$(patsubst %,api-examples-%.txt,$(LANGS)) +INCLUDES=synopsis-intro.txt categories-intro.txt synopsis-additional.txt synopsis-browse.txt synopsis-example.txt -synopsis.html: $(EXAMPLES_OUT) $(SRC_FILES) - runghc MkSynopsis.hs >out +synopsis.html: MkSynopsis.hs MkExxTable.hs $(INCLUDES) $(EXAMPLES_OUT) $(SRC_FILES) + runghc MkSynopsis.hs categories-imagemap.html: categories.dot dot -Tcmapx $^ > $@ @@ -34,7 +35,7 @@ abstract: mv $S/abstract/*.html abstract -api-examples.gfs: api-examples.txt +api-examples.gfs: api-examples.txt MkExx.hs runghc MkExx.hs < $< > $@ @@ -46,4 +47,4 @@ api-examples-%.txt: $(GF_alltenses)/Try%.gfo api-examples.gfs GF_LIB_PATH=$(GF_LIB_PATH) $(GF) -retain -s $< $@ clean: - rm -rf out synopsis.txt api-examples.gfs $(EXAMPLES_OUT) + rm -rf synopsis.txt api-examples.gfs $(EXAMPLES_OUT) From 4e646d5c7b0a56e665b0fbf9ee2c4bc637c039c3 Mon Sep 17 00:00:00 2001 From: Thomas Hallgren Date: Tue, 23 Oct 2018 16:22:04 +0200 Subject: [PATCH 09/18] Add verbosity option in doc/MkExxTable.hs Don't need a lot of output on stdout when it is used from MkSynposis.hs --- doc/MkExxTable.hs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/doc/MkExxTable.hs b/doc/MkExxTable.hs index 7fff127af..a45effabc 100644 --- a/doc/MkExxTable.hs +++ b/doc/MkExxTable.hs @@ -2,28 +2,31 @@ module MkExxTable (getApiExx, ApiExx, prApiEx, mkEx) where --import System.Cmd import System.Environment(getArgs) +import Control.Monad(when) import qualified Data.Map as M import Data.Char main = do xx <- getArgs - aexx <- getApiExx xx + aexx <- getApiExx' True xx return () -- putStrLn $ prApiExx aexx getApiExx :: [FilePath] -> IO ApiExx -getApiExx xx = do +getApiExx = getApiExx' False + +getApiExx' verbose xx = do s <- readFile (head xx) let aet = getApiExxTrees $ filter validOutput $ mergeOutput $ lines s - aeos <- mapM readApiExxOne xx + aeos <- mapM (readApiExxOne verbose) xx let aexx = mkApiExx $ ("API",aet) : aeos -- putStrLn $ prApiExx aexx return aexx -readApiExxOne file = do +readApiExxOne verbose file = do s <- readFile file let lang = reverse (take 3 (drop 4 (reverse file))) -- api-exx-*Eng*.txt let api = getApiExxOne $ filter validOutput $ mergeOutput $ lines s - putStrLn $ unlines $ prApiEx api --- + when verbose $ putStrLn $ unlines $ prApiEx api --- return (lang,api) -- map function -> language -> example From 95bc1637afdb98b43571ceef973b5e497c349f11 Mon Sep 17 00:00:00 2001 From: odanoburu Date: Tue, 23 Oct 2018 21:27:03 -0300 Subject: [PATCH 10/18] - mv GF 3.9 synopsis - add link to GF 3.9 synopsis in nightly version --- doc/synopsis-intro.txt | 4 +--- doc/{synopsis.html => synopsis-v3.9.html} | 0 2 files changed, 1 insertion(+), 3 deletions(-) rename doc/{synopsis.html => synopsis-v3.9.html} (100%) diff --git a/doc/synopsis-intro.txt b/doc/synopsis-intro.txt index 055a0cecc..c2ba315cf 100644 --- a/doc/synopsis-intro.txt +++ b/doc/synopsis-intro.txt @@ -1,8 +1,6 @@ - - - +Versions: [3.9 ./synopsis-v3.9.html] | latest (this one) =Introduction= diff --git a/doc/synopsis.html b/doc/synopsis-v3.9.html similarity index 100% rename from doc/synopsis.html rename to doc/synopsis-v3.9.html From f55cc00457cd5839dd1b3e45800d7965988e0054 Mon Sep 17 00:00:00 2001 From: odanoburu Date: Tue, 23 Oct 2018 22:32:03 -0300 Subject: [PATCH 11/18] add Por and Ara to synopsis --- doc/Globes.hs | 3 ++- doc/Makefile | 2 +- doc/MkExx.hs | 1 + doc/MkSynopsis.hs | 4 +++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/Globes.hs b/doc/Globes.hs index 7be896b61..165d73421 100644 --- a/doc/Globes.hs +++ b/doc/Globes.hs @@ -21,7 +21,7 @@ interlingua = "Meaning" languages = [ "afrikaans", -- "አማርኛ", --- "العربية", + "العربية", "Български", "català", "中文", @@ -45,6 +45,7 @@ languages = [ "پeرسن", "polski", "پنجابی", + "português", "Русский", "ٻولي", "español", diff --git a/doc/Makefile b/doc/Makefile index 3988d7a4d..916f4c79a 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -16,7 +16,7 @@ synopsis: synopsis.html S=../src # List of languages extracted from MkSynopsis.hs -LANGS=Afr Bul Cat Chi Dan Dut Eng Est Eus Fin Fre Ger Gre Hin Ice Ita Jpn Lav Mlt Mon Nep Nor Nno Pes Pnb Pol Ron Rus Snd Spa Swe Tha Urd +LANGS=Afr Ara Bul Cat Chi Dan Dut Eng Est Eus Fin Fre Ger Gre Hin Ice Ita Jpn Lav Mlt Mon Nep Nor Nno Pes Pnb Pol Por Ron Rus Snd Spa Swe Tha Urd # This list was constructed by observing what files MkSynopsis.hs reads SRC_FILES=$S/abstract/Common.gf $S/abstract/Cat.gf $S/api/Constructors.gf $S/abstract/Structural.gf $(patsubst %,$S/*/Paradigms%.gf,$(LANGS)) diff --git a/doc/MkExx.hs b/doc/MkExx.hs index bb7551c60..16eb38bfd 100644 --- a/doc/MkExx.hs +++ b/doc/MkExx.hs @@ -52,6 +52,7 @@ langsCoding = [ (("norwegian","Nor"),"Scand"), (("polish", "Pol"),""), (("punjabi", "Pnb"),""), + (("portuguese", "Por"), "Romance"), (("romanian", "Ron"),""), (("russian", "Rus"),""), (("spanish", "Spa"),"Romance"), diff --git a/doc/MkSynopsis.hs b/doc/MkSynopsis.hs index 859ac0678..e2040fe49 100644 --- a/doc/MkSynopsis.hs +++ b/doc/MkSynopsis.hs @@ -19,7 +19,7 @@ revealedLang = "Eng" -- all languages shown (a copy of this list appears in Makefile) apiExxFiles = ["api-examples-" ++ lang ++ ".txt" | lang <- words -- "Eng Chi" - "Afr Bul Cat Chi Dan Dut Eng Est Eus Fin Fre Ger Gre Hin Ice Ita Jpn Lav Mlt Mon Nep Nor Nno Pes Pnb Pol Ron Rus Snd Spa Swe Tha Urd" + "Afr Ara Bul Cat Chi Dan Dut Eng Est Eus Fin Fre Ger Gre Hin Ice Ita Jpn Lav Mlt Mon Nep Nor Nno Pes Pnb Pol Por Ron Rus Snd Spa Swe Tha Urd" ] main = do @@ -244,6 +244,7 @@ syntaxAPI = srcPath "/api/Constructors.gf" structuralAPI = srcPath "/abstract/Structural.gf" paradigmFiles = [ ("Afrikaans", srcPath "/afrikaans/ParadigmsAfr.gf"), + ("Arabic", srcPath "/arabic/ParadigmsAra.gf"), ("Basque", srcPath "/basque/ParadigmsEus.gf"), ("Bulgarian", srcPath "/bulgarian/ParadigmsBul.gf"), ("Catalan", srcPath "/catalan/ParadigmsCat.gf"), @@ -269,6 +270,7 @@ paradigmFiles = [ ("Nynorsk", srcPath "/nynorsk/ParadigmsNno.gf"), ("Polish", srcPath "/polish/ParadigmsPol.gf"), ("Punjabi", srcPath "/punjabi/ParadigmsPnb.gf"), + ("Portuguese", srcPath "/portuguese/ParadigmsPor.gf"), ("Romanian", srcPath "/romanian/ParadigmsRon.gf"), ("Russian", srcPath "/russian/ParadigmsRus.gf"), ("Sindhi", srcPath "/sindhi/ParadigmsSnd.gf"), From 77a7b7e51cbba059d29c7765df53ee83fe3cca08 Mon Sep 17 00:00:00 2001 From: bruno cuconato Date: Wed, 24 Oct 2018 14:06:45 +0000 Subject: [PATCH 12/18] use copyFileWithMetadata instead of copyFile to preserve timestamps #43 ([but also preserves other stuff](http://hackage.haskell.org/package/directory-1.3.3.1/docs/System-Directory.html#v:copyFileWithMetadata)) --- Make.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Make.hs b/Make.hs index e97b7f9da..1e63bc87c 100644 --- a/Make.hs +++ b/Make.hs @@ -6,7 +6,7 @@ import System.Exit (ExitCode(..),die) import System.Environment (getArgs,lookupEnv) import System.Process (rawSystem) import System.FilePath (()) -- ,takeFileName,addExtension,dropExtension) -import System.Directory (createDirectoryIfMissing,copyFile,getDirectoryContents,removeDirectoryRecursive,findFile) +import System.Directory (createDirectoryIfMissing,copyFileWithMetadata,getDirectoryContents,removeDirectoryRecursive,findFile) import Control.Monad (when,unless) main :: IO () @@ -61,14 +61,14 @@ copyOne :: String -> FilePath -> FilePath -> IO () copyOne file from to = do putStrLn $ "Copying [" ++ file ++ "] " ++ to createDirectoryIfMissing True to - copyFile (from file) (to file) + copyFileWithMetadata (from file) (to file) -- | Copy all files between directories copyAll :: String -> FilePath -> FilePath -> IO () copyAll msg from to = do putStrLn $ "Copying [" ++ msg ++ "] " ++ to createDirectoryIfMissing True to - mapM_ (\file -> when (file /= "." && file /= "..") $ copyFile (from file) (to file)) =<< getDirectoryContents from + mapM_ (\file -> when (file /= "." && file /= "..") $ copyFileWithMetadata (from file) (to file)) =<< getDirectoryContents from -- | Remove dist directory clean :: IO () From 1862cb0559b55953f143b41876ce4f87420bf914 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Thu, 25 Oct 2018 08:28:29 +0200 Subject: [PATCH 13/18] Preserve metadata in copy (Make.sh) Addresses #43 but I'm not 100% convinced it makes any difference. --- Make.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Make.sh b/Make.sh index 97870d31d..ce73171c4 100755 --- a/Make.sh +++ b/Make.sh @@ -97,4 +97,4 @@ done # Copy echo "Copying to ${dest}" -cp -R "${dist}"/* "${dest}" +cp -R -p "${dist}"/* "${dest}" From 894c09d1b9c9fd8c51b116939425d3e24997c15e Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Thu, 25 Oct 2018 08:34:33 +0200 Subject: [PATCH 14/18] Only copy newer files (Make.bat) Addresses #43 but not tested. Reference: https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-xp/bb491035(v%3dtechnet.10) --- Make.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Make.bat b/Make.bat index 16ba98fa2..d7c77595b 100644 --- a/Make.bat +++ b/Make.bat @@ -99,4 +99,4 @@ for %%m in (%modules%) do ( REM Copy echo Copying to %dest% -copy %dist% %dest% +xcopy %dist% %dest% /d From d446af84791d846a60eaf38eb9f31331e82cfbc0 Mon Sep 17 00:00:00 2001 From: Thomas Hallgren Date: Thu, 25 Oct 2018 16:34:44 +0200 Subject: [PATCH 15/18] doc/Makefile: add a missing dependency --- doc/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/Makefile b/doc/Makefile index 916f4c79a..556973dd7 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -22,11 +22,14 @@ LANGS=Afr Ara Bul Cat Chi Dan Dut Eng Est Eus Fin Fre Ger Gre Hin Ice Ita Jpn La SRC_FILES=$S/abstract/Common.gf $S/abstract/Cat.gf $S/api/Constructors.gf $S/abstract/Structural.gf $(patsubst %,$S/*/Paradigms%.gf,$(LANGS)) EXAMPLES_OUT=$(patsubst %,api-examples-%.txt,$(LANGS)) -INCLUDES=synopsis-intro.txt categories-intro.txt synopsis-additional.txt synopsis-browse.txt synopsis-example.txt +INCLUDES=synopsis-intro.txt categories-intro.txt categories-imagemap.html synopsis-additional.txt synopsis-browse.txt synopsis-example.txt synopsis.html: MkSynopsis.hs MkExxTable.hs $(INCLUDES) $(EXAMPLES_OUT) $(SRC_FILES) runghc MkSynopsis.hs +categories.png: categories.dot + dot -Tpng $^ > $@ + categories-imagemap.html: categories.dot dot -Tcmapx $^ > $@ From 8b64ad4a9ed03c1c6dd32efa03c633ce2066ca53 Mon Sep 17 00:00:00 2001 From: Thomas Hallgren Date: Thu, 25 Oct 2018 16:49:38 +0200 Subject: [PATCH 16/18] doc/synopsis-intro.txt: fix language list and broken links --- doc/synopsis-intro.txt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/doc/synopsis-intro.txt b/doc/synopsis-intro.txt index c2ba315cf..3b95dea03 100644 --- a/doc/synopsis-intro.txt +++ b/doc/synopsis-intro.txt @@ -6,8 +6,9 @@ Versions: [3.9 ./synopsis-v3.9.html] | latest (this one) =Introduction= The GF Resource Grammar Library is the standard library for Grammatical Framework. -It covers the morphology and basic syntax of currently 32 languages: +It covers the morphology and basic syntax of currently 34 languages: Afrikaans, +Arabic, Bulgarian, Catalan, Chinese (simplified), @@ -31,6 +32,7 @@ Norwegian (bokmål), Norwegial (nynorsk), Persian, Polish, +Portuguese, Punjabi, Romanian, Russian, @@ -52,13 +54,13 @@ The main contents are: constructing trees in them. - [Chapter 2 #toc5]: syntactic construction functions, with cross-links and examples. -- [Chapter 3 #toc84]: morphological paradigms. -- [Chapter 4 #toc116]: additional libraries. -- [Chapter 5 #toc122]: how to "browse" the library by +- [Chapter 3 #toc85]: morphological paradigms. +- [Chapter 4 #toc120]: additional libraries. +- [Chapter 5 #toc126]: how to "browse" the library by loading the grammars into the ``gf`` command editor. -- [Chapter 6 #toc123]: a brief example of how application grammars can +- [Chapter 6 #toc127]: a brief example of how application grammars can use the resource modules. -- [Detailed table of contents #toc124]. +- [Detailed table of contents #toc128]. Other relevant documents: From 75e1c10250517c6ea9d02d3df489d43d637314b2 Mon Sep 17 00:00:00 2001 From: Thomas Hallgren Date: Thu, 25 Oct 2018 17:04:36 +0200 Subject: [PATCH 17/18] synopis: add header styles that match the GF home page --- doc/revealpopup.css | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/revealpopup.css b/doc/revealpopup.css index fe2dd4c1c..8f96c264f 100644 --- a/doc/revealpopup.css +++ b/doc/revealpopup.css @@ -24,6 +24,9 @@ table { border-collapse: collapse; } td, th { padding: 5px; } th { background: #9df; } td { background: white } +h1,h2,h3,h4 { font-family: sans-serif; color: #303030; + text-shadow: rgba(0,0,0,0.25) 2px 2px 5px; + } /* Quick links */ From 999cdb8e36a4047ef5a0b463c0f1a3f9fc3bd930 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Fri, 26 Oct 2018 09:10:32 +0200 Subject: [PATCH 18/18] Copy files with only modification time rather than all metadata --- Make.hs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Make.hs b/Make.hs index 1e63bc87c..2fccdaae0 100644 --- a/Make.hs +++ b/Make.hs @@ -1,3 +1,7 @@ +-- | Main build script for RGL +-- There is no associated cabal file, but these dependencies are known: +-- * directory >= 1.2.3.0 + import Data.List (find,isPrefixOf,isSuffixOf,(\\),unfoldr) import Data.Maybe (catMaybes) import System.IO (hPutStrLn,stderr) @@ -6,7 +10,7 @@ import System.Exit (ExitCode(..),die) import System.Environment (getArgs,lookupEnv) import System.Process (rawSystem) import System.FilePath (()) -- ,takeFileName,addExtension,dropExtension) -import System.Directory (createDirectoryIfMissing,copyFileWithMetadata,getDirectoryContents,removeDirectoryRecursive,findFile) +import System.Directory (createDirectoryIfMissing,copyFile,getModificationTime,setModificationTime,getDirectoryContents,removeDirectoryRecursive,findFile) import Control.Monad (when,unless) main :: IO () @@ -61,14 +65,20 @@ copyOne :: String -> FilePath -> FilePath -> IO () copyOne file from to = do putStrLn $ "Copying [" ++ file ++ "] " ++ to createDirectoryIfMissing True to - copyFileWithMetadata (from file) (to file) + copyFileWithModificationTime (from file) (to file) -- | Copy all files between directories copyAll :: String -> FilePath -> FilePath -> IO () copyAll msg from to = do putStrLn $ "Copying [" ++ msg ++ "] " ++ to createDirectoryIfMissing True to - mapM_ (\file -> when (file /= "." && file /= "..") $ copyFileWithMetadata (from file) (to file)) =<< getDirectoryContents from + mapM_ (\file -> when (file /= "." && file /= "..") $ copyFileWithModificationTime (from file) (to file)) =<< getDirectoryContents from + +-- | Copy a file together with its modification time but no other meta data +copyFileWithModificationTime :: FilePath -> FilePath -> IO () +copyFileWithModificationTime source destination = do + copyFile source destination + getModificationTime source >>= setModificationTime destination -- | Remove dist directory clean :: IO ()