aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/licentia/license/grant.lux
blob: 0f45f3592e6656fbca23a0270aeb3f406f3e73eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
(.module:
  [lux #*
   [data
    ["." text
     ["%" format (#+ format)]]]]
  [//
   [time (#+ Days)]
   ["_" term]
   ["." definition]
   [//
    ["$" document]]])

(def: grant-header
  (format "Subject to the terms and conditions of " _.license
          ", each " _.contributor
          " hereby grants to " _.recipient))

(def: #export grant-characteristics
  (List Text)
  (list "perpetual"
        "world-wide"
        "non-exclusive"
        "no-charge"
        "royalty-free"
        "irrevocable"))

(def: #export copyright-grant-rights
  (List Text)
  (list "use"
        "reproduce"
        "display"
        "perform"
        "modify"
        (format "create an " _.extension " of")
        "sublicense"
        "distribute"))

(def: #export copyright
  ($.sentence (format grant-header " a " ($.and ..grant-characteristics)
                      " copyright license to " ($.or ..copyright-grant-rights)
                      " " _.work
                      " and such an " _.extension
                      " in a " _.source-code-form
                      " or an " _.object-form)))

(def: #export (patent retaliation?)
  (-> Bit Text)
  (let [grant (format grant-header " a " ($.and ..grant-characteristics)
                      " patent license to " ($.or definition.patent-rights) " "
                      _.work
                      ", where such license applies only to any " _.patent-claim
                      " that is necessarily infringed by their " ($.plural _.contribution)
                      " alone or by combination of their " ($.plural _.contribution)
                      " with " _.work)
        retaliation-clause (format "If " _.recipient " institutes patent litigation against any " _.legal-entity
                                   " (including a cross-claim or counterclaim in a lawsuit) alleging that "
                                   _.work " or a " _.contribution
                                   " incorporated within " _.work " constitutes direct or contributory patent infringement"
                                   ", then any patent licenses granted to " _.recipient
                                   " under " _.license
                                   " for " _.work
                                   " shall terminate as of the date such litigation is filed")]
    ($.paragraph (list& grant
                        (if retaliation?
                          (list retaliation-clause)
                          (list))))))

(def: #export date
  ($.sentence (format "The licenses granted in " _.license
                      " with respect to any " _.contribution
                      " become effective for each " _.contribution
                      " on the date the " _.contributor
                      " first distributes such " _.contribution)))

(def: restoration-scope "an ongoing basis")

(def: #export (grant-restoration-clause termination-period)
  (-> Days Text)
  (let [restoration-condition (format _.recipient " becomes compliant")
        restored-grants (format "the rights granted under " _.license
                                " from a particular " _.contributor)
        invalidation-condition (format "such " _.contributor
                                       " explicitly and finally terminates the grants to " _.recipient)
        complaint-period-condition (format "such " _.contributor
                                           " fails to notify " _.recipient
                                           " of the non-compliance by some reasonable means prior to " (%.nat termination-period)
                                           " " ($.plural "day") " after " _.recipient
                                           " has come back into compliance")]
    (format "However, if " restoration-condition ", then " restored-grants " are reinstated provisionally"
            ", unless and until " invalidation-condition
            ", and on " ..restoration-scope ", if " complaint-period-condition)))

(def: #export (grace-period-clause grace-period)
  (-> Days Text)
  (let [the-grants (format "grants to " _.recipient " from a particular " _.contributor)
        automatic-restoration-conditions (let [notification (format "such " _.contributor
                                                                    " notifies " _.recipient
                                                                    " of the non-compliance by some reasonable means")
                                               first-offense (format "this is the first time " _.recipient
                                                                     " has received notice of non-compliance with " _.license
                                                                     " from such " _.contributor)
                                               prompt-compliance (format _.recipient
                                                                         " becomes compliant prior to " (%.nat grace-period)
                                                                         " " ($.plural "day") " after reception of the notice")]
                                           ($.and (list notification
                                                        first-offense
                                                        prompt-compliance)))]
    (format "Moreover, " the-grants
            " are reinstated on " ..restoration-scope
            " if " automatic-restoration-conditions)))

(def: #export (termination termination-period grace-period)
  (-> Days Days Text)
  (let [on-violation-of-terms (let [what (format "The rights granted under " _.license)
                                    when (format _.recipient " fails to comply with any of its terms")]
                                (format what " will terminate automatically if " when))]
    ($.paragraph (list on-violation-of-terms
                       (..grant-restoration-clause termination-period)
                       (..grace-period-clause grace-period)))))

(def: #export no-retroactive-termination
  (let [situation "In the event of termination"
        coverage "all end user license agreements"
        exclusions "(excluding licenses to distributors and resellers)"
        source (format "that have been validly granted by " _.recipient " or any distributor")
        scope "hereunder prior to termination"
        effect "shall survive termination"]
    ($.paragraph (list (format situation ", " coverage " " exclusions " " source " " scope " " effect)))))