@@ -1562,6 +1562,19 @@ let apply_proof ~name ~poly env tac pf =
15621562[%% endif]
15631563
15641564
1565+ [%% if coq = " 9.0" ]
1566+ let section_close_section x =
1567+ let a,b,_,_ = Section. close_section x in
1568+ a, b
1569+ [%% elif coq = " 9.1" ]
1570+ let section_close_section x =
1571+ let a,b,_,_,_ = Section. close_section x in
1572+ a, b
1573+ [%% else ]
1574+ let section_close_section x =
1575+ let a,b,_,_ = Section. close_section x in
1576+ a, b
1577+ [%% endif]
15651578
15661579
15671580
@@ -2135,14 +2148,45 @@ Supported attributes:
21352148 !: (in_elpi_module_type (Environ. lookup_modtype mp env )))),
21362149 DocAbove);
21372150
2138- MLCode(Pred("coq.env.section" ,
2139- Out(list constant , "GlobalObjects " ,
2140- Read(unit_ctx , "lists the global objects that are marked as to be abstracted at the end of the enclosing sections" )),
2151+ MLCode(Pred("coq.env.section-variables " ,
2152+ Out(list constant , "ConstantsRepresentingVariables " ,
2153+ Read(unit_ctx , "lists all the section variables, i.e. the global objects that are marked as to be abstracted at the end of the enclosing sections" )),
21412154 (fun _ ~depth _ _ state ->
21422155 let { section } = mk_coq_context ~options :(default_options () ) state in
21432156 !: (section |> List. map (fun x -> Variable x )) )),
21442157 DocAbove);
21452158
2159+ MLCode(Pred("coq.env.section-contents" ,
2160+ Out(list (list gref ), "GlobalObjects" ,
2161+ Read(unit_ctx , "lists the global objects that are defined withing the open sections. Inner section first." )),
2162+ (fun _ ~depth _ _ state ->
2163+ let l =
2164+ let safe_env = Global. safe_env () in
2165+ let section = Safe_typing. sections_of_safe_env safe_env in
2166+ let rec aux section =
2167+ match section with
2168+ | None -> []
2169+ | Some s ->
2170+ let section ,l = section_close_section s in
2171+ List. concat_map (function
2172+ | Section. SecDefinition c -> [GlobRef. ConstRef c ]
2173+ | Section. SecInductive m ->
2174+ let { Declarations. mind_packets } = Environ. lookup_mind m (Safe_typing. env_of_safe_env safe_env ) in
2175+ List. init (Array. length mind_packets ) (fun i -> GlobRef. IndRef(m ,i ))
2176+ ) l :: aux section
2177+ in
2178+ aux section
2179+ in
2180+ !: l )),
2181+ DocAbove);
2182+
2183+ LPCode {|% Deprecated, use coq.env.section-variables
2184+ func coq.env.section -> list constant.
2185+ coq.env.section L :-
2186+ coq.warning "elpi.deprecated" "elpi.env.section" "use coq.env.section-variables in place of coq.env.section",
2187+ coq.env.section-variables L.
2188+ |} ;
2189+
21462190 MLCode(Pred("coq.env.dependencies" ,
21472191 In(gref , "GR" ,
21482192 In(B. unspec modpath , "MP" ,
0 commit comments