Replace pfff with flitter

This commit is contained in:
Joey Yakimowich-Payne 2018-06-04 13:03:46 +09:00
commit c8efc2a088
27 changed files with 295 additions and 293 deletions

View file

@ -8,14 +8,14 @@ find_source.cmi : commons/common.cmi
main.cmo : lang_cpp/parsing/test_parsing_cpp.cmi \
lang_c/parsing/test_parsing_c.cmi external/jsonwheel/json_io.cmi \
external/jsonwheel/json_in.cmo generators/nim/generate_nim.cmi \
lang_cpp/parsing/flag_parsing_cpp.cmo globals/config_pfff.cmo \
lang_cpp/parsing/flag_parsing_cpp.cmo globals/config_flitter.cmo \
commons/common2.cmi commons/common.cmi
main.cmx : lang_cpp/parsing/test_parsing_cpp.cmx \
lang_c/parsing/test_parsing_c.cmx external/jsonwheel/json_io.cmx \
external/jsonwheel/json_in.cmx generators/nim/generate_nim.cmx \
lang_cpp/parsing/flag_parsing_cpp.cmx globals/config_pfff.cmx \
lang_cpp/parsing/flag_parsing_cpp.cmx globals/config_flitter.cmx \
commons/common2.cmx commons/common.cmx
main_test.cmo : generators/nim/unit_generate_nim.cmi commons/oUnit.cmi \
globals/config_pfff.cmo commons/common2.cmi commons/common.cmi
globals/config_flitter.cmo commons/common2.cmi commons/common.cmi
main_test.cmx : generators/nim/unit_generate_nim.cmx commons/oUnit.cmx \
globals/config_pfff.cmx commons/common2.cmx commons/common.cmx
globals/config_flitter.cmx commons/common2.cmx commons/common.cmx

4
.gitignore vendored
View file

@ -16,8 +16,8 @@ lang_cpp/parsing/parser_cpp.mli
lang_cpp/parsing/parser_cpp.output
h_program-lang/archi_code_lexer.ml
pfff
pfff_test
flitter
flitter_test
# ocamlbuild working directory
_build/

View file

@ -11,15 +11,15 @@ TOP:=$(shell pwd)
SRC=find_source.ml
TARGET=pfff
TARGET=flitter
#------------------------------------------------------------------------------
# Program related variables
#------------------------------------------------------------------------------
PROGS=pfff
PROGS=flitter
PROGS+=pfff_test
PROGS+=flitter_test
OPTPROGS= $(PROGS:=.opt)
@ -158,7 +158,7 @@ distclean:: clean
set -e; for i in $(MAKESUBDIRS); do $(MAKE) -C $$i $@; done
rm -f .depend
rm -f Makefile.config
rm -f globals/config_pfff.ml
rm -f globals/config_flitter.ml
rm -f TAGS
# find -name ".#*1.*" | xargs rm -f
@ -178,19 +178,19 @@ purebytecode:
# codegraph (was pm_depend)
#------------------------------------------------------------------------------
pfff_test: $(LIBS) $(OBJS) main_test.cmo
flitter_test: $(LIBS) $(OBJS) main_test.cmo
$(OCAMLC) $(CUSTOM) -o $@ $(SYSLIBS) $^
pfff_test.opt: $(LIBS:.cma=.cmxa) $(OPTOBJS) main_test.cmx
flitter_test.opt: $(LIBS:.cma=.cmxa) $(OPTOBJS) main_test.cmx
$(OCAMLOPT) $(STATIC) -o $@ $(SYSLIBS:.cma=.cmxa) $^
clean::
rm -f pfff_test
rm -f flitter_test
tests:
$(MAKE) rec && $(MAKE) pfff_test
./pfff_test -verbose all
$(MAKE) rec && $(MAKE) flitter_test
./flitter_test -verbose all
test:
$(MAKE) rec && $(MAKE) pfff_test
./pfff_test -verbose all
$(MAKE) rec && $(MAKE) flitter_test
./flitter_test -verbose all
##############################################################################
# Build documentation
@ -201,7 +201,7 @@ test:
# Install
##############################################################################
VERSION=$(shell cat globals/config_pfff.ml.in |grep version |perl -p -e 's/.*"(.*)".*/$$1/;')
VERSION=$(shell cat globals/config_flitter.ml.in |grep version |perl -p -e 's/.*"(.*)".*/$$1/;')
# note: don't remove DESTDIR, it can be set by package build system like ebuild
install: all
@ -210,7 +210,7 @@ install: all
cp -a $(PROGS) $(DESTDIR)$(BINDIR)
cp -a data $(DESTDIR)$(SHAREDIR)
@echo ""
@echo "You can also install pfff by copying the programs"
@echo "You can also install flitter by copying the programs"
@echo "available in this directory anywhere you want and"
@echo "give it the right options to find its configuration files."
@ -222,7 +222,7 @@ INSTALL_SUBDIRS= \
commons \
lang_cpp/parsing
LIBNAME=pfff
LIBNAME=flitter
install-findlib:: all all.opt
ocamlfind install $(LIBNAME) META
set -e; for i in $(INSTALL_SUBDIRS); do echo $$i; $(MAKE) -C $$i install-findlib; done
@ -235,7 +235,7 @@ version:
install-bin:
cp $(PROGS) ../pfff-binaries/mac
cp $(PROGS) ../flitter-binaries/mac
##############################################################################
# Package rules
@ -257,10 +257,10 @@ srctar:
#http://stackoverflow.com/questions/2689813/cross-compile-windows-64-bit-exe-from-linux
# making an OPAM package:
# - git push from pfff to github
# - make a new release on github: https://github.com/facebook/pfff/releases
# - git push from flitter to github
# - make a new release on github: https://github.com/facebook/flitter/releases
# - get md5sum of new archive
# - update opam file in opam-repository/pfff-xxx/
# - update opam file in opam-repository/flitter-xxx/
# - test locally?
# - commit, git push
# - do pull request on github

View file

@ -2,7 +2,7 @@
# Variables
##############################################################################
# if part of pfff/ or other programs with a Makefile.config
# if part of flitter/ or other programs with a Makefile.config
-include ../Makefile.config
LIBNAME=commons
@ -24,7 +24,7 @@ SYSLIBS=unix.cma str.cma
-include Makefile.common
# too many code in pfff assume commons/lib.cma
# too many code in flitter assume commons/lib.cma
all:: lib.cma
all.opt: lib.cmxa lib.a

View file

@ -5737,7 +5737,7 @@ let add_in_scope_h x (k,v) =
(* See console.ml *)
(*****************************************************************************)
(* Gc optimisation (pfff) *)
(* Gc optimisation (flitter) *)
(*****************************************************************************)
(* opti: to avoid stressing the GC with a huge graph, we sometimes
@ -6130,9 +6130,9 @@ let common_prefix_of_files_or_dirs xs =
(*
let _ =
example
(common_prefix_of_files_or_dirs ["/home/pad/pfff/visual";
"/home/pad/pfff/commons";]
=*= "/home/pad/pfff"
(common_prefix_of_files_or_dirs ["/home/pad/flitter/visual";
"/home/pad/flitter/commons";]
=*= "/home/pad/flitter"
)
*)

View file

@ -285,7 +285,7 @@ let file_type_of_file a =
let is_textual_file file =
match file_type_of_file file with
(* if this contains weird code then pfff_visual crash *)
(* if this contains weird code then flitter_visual crash *)
| PL (Web Sql) -> false
| PL _

View file

@ -8,11 +8,13 @@ generate_nim.cmx : ../../h_program-lang/parse_info.cmx \
../../lang_cpp/parsing/ast_cpp.cmx generate_nim.cmi
generate_nim.cmi : ../../commons/common.cmi
unit_generate_nim.cmo : ../../commons/oUnit.cmi generate_nim.cmi \
../../lang_cpp/parsing/flag_parsing_cpp.cmo ../../globals/config_pfff.cmo \
../../commons/common2.cmi ../../commons/common.cmi \
../../lang_cpp/parsing/ast_cpp.cmo unit_generate_nim.cmi
../../lang_cpp/parsing/flag_parsing_cpp.cmo \
../../globals/config_flitter.cmo ../../commons/common2.cmi \
../../commons/common.cmi ../../lang_cpp/parsing/ast_cpp.cmo \
unit_generate_nim.cmi
unit_generate_nim.cmx : ../../commons/oUnit.cmx generate_nim.cmx \
../../lang_cpp/parsing/flag_parsing_cpp.cmx ../../globals/config_pfff.cmx \
../../commons/common2.cmx ../../commons/common.cmx \
../../lang_cpp/parsing/ast_cpp.cmx unit_generate_nim.cmi
../../lang_cpp/parsing/flag_parsing_cpp.cmx \
../../globals/config_flitter.cmx ../../commons/common2.cmx \
../../commons/common.cmx ../../lang_cpp/parsing/ast_cpp.cmx \
unit_generate_nim.cmi
unit_generate_nim.cmi : ../../commons/oUnit.cmi

View file

@ -942,12 +942,12 @@ and process_fullType ((qualifier, typeC)) =
process_typeC typeC
and process_toplevel = function
| NotParsedCorrectly node -> ""
| NotParsedCorrectly node -> "# Error parsing: " ^ process_list ~delimiter:"" process_token node
| DeclElem node -> process_declaration node
| CppDirectiveDecl node -> process_cpp_directive node
| IfdefDecl node -> ""
| MacroTop ((v1, v2, v3)) -> ""
| MacroVarTop ((v1, v2)) -> ""
| MacroTop ((v1, v2, v3)) -> "# MacroTop"
| MacroVarTop ((v1, v2)) -> "# MacroVarTop"
let iter_ast ast =
List.map process_toplevel ast

View file

@ -21,13 +21,13 @@ let strip_string s =
let get_files glob =
try
let path = Filename.concat Config_pfff.path "/tests/generators/nim/" in
let path = Filename.concat Config_flitter.path "/tests/generators/nim/" in
sort (Common2.glob (spf "%s/%s" path glob))
with
Common2.CmdError (a, b) -> []
let basename fpath =
let fullpath = Filename.concat Config_pfff.path "/tests/generators/nim//" in
let fullpath = Filename.concat Config_flitter.path "/tests/generators/nim//" in
readable ~root:fullpath fpath
let get_code_pairs name =

View file

@ -1,2 +1,2 @@
config_pfff.cmo :
config_pfff.cmx :
config_flitter.cmo :
config_flitter.cmx :

View file

@ -6,7 +6,7 @@ TOP=..
##############################################################################
TARGET=lib
SRC= config_pfff.ml
SRC= config_flitter.ml
LIBS=
INCLUDEDIRS=../commons
@ -30,17 +30,17 @@ $(TARGET).cmxa: $(OPTOBJS) $(LIBS:.cma=.cmxa)
$(OCAMLOPT) -a -o $(TARGET).cmxa $(OPTOBJS)
config_pfff.ml:
@echo "config_pfff.ml is missing. Have you run ./configure?"
config_flitter.ml:
@echo "config_flitter.ml is missing. Have you run ./configure?"
@exit 1
distclean::
rm -f config_pfff.ml
rm -f config_flitter.ml
##############################################################################
# install
##############################################################################
LIBNAME=pfff-config
LIBNAME=flitter-config
EXPORTSRC=\
install-findlib: all all.opt

View file

@ -1,11 +1,11 @@
let version = "0.29"
let path =
try (Sys.getenv "PFFF_HOME")
try (Sys.getenv "FLITTER_HOME")
with Not_found->"./"
let std_xxx = ref (Filename.concat path "xxx.yyy")
let logger =
try Some (Sys.getenv "PFFF_LOGGER")
try Some (Sys.getenv "FLITTER_LOGGER")
with Not_found-> None

View file

@ -32,7 +32,7 @@ $(TARGET).cmxa: $(OPTOBJS) $(LIBS:.cma=.cmxa)
##############################################################################
# install
##############################################################################
LIBNAME=pfff-h_files-format
LIBNAME=flitter-h_files-format
EXPORTSRC=\
outline.mli

View file

@ -56,7 +56,7 @@ beforedepend:: archi_code_lexer.ml
##############################################################################
# install
##############################################################################
LIBNAME=pfff-h_program-lang
LIBNAME=flitter-h_program-lang
EXPORTSRC=\
ast_fuzzy.mli \
meta_ast_generic.mli \

View file

@ -28,7 +28,7 @@ open Common
* own code and facebook flib code.
*
* This is used by codemap to colorize files. This is also used
* mainly for its AutoGenerated category in pfff -test_loc to
* mainly for its AutoGenerated category in flitter -test_loc to
* not count auto generated code in the LOC of a project. This
* can also be used in the deadcode detector to not count auto
* generated files (e.g. visitor_xxx.ml) as real users of an entity.

View file

@ -185,7 +185,7 @@ let empty_database () = {
}
let default_db_name =
"PFFF_DB.marshall"
"FLITTER_DB.marshall"
(*****************************************************************************)

View file

@ -30,7 +30,7 @@ open Common
* A few design choices:
*
* - one could store such information directly into database_xxx.ml
* and have pfff_db compute such information (for instance each function
* and have flitter_db compute such information (for instance each function
* could have a set of properties like unit_test, or dead) but this
* would force people to build their own db to visualize the results.
* One could compute this information in database_light_xxx.ml, but this

View file

@ -18,7 +18,7 @@ open Common
(* Prelude *)
(*****************************************************************************)
(*
* Some helpers for the different lexers and parsers in pfff.
* Some helpers for the different lexers and parsers in flitter.
* The main types are:
* ('token_location' < 'token_origin' < 'token_mutable') * token_kind
*

View file

@ -54,7 +54,7 @@ open Common2.Infix
* the kencc extensions and does not allow to analyze cpp constructs.
* CIL has two pointer analysis but they were written with bug finding
* in mind I think, not code comprehension which we really care about
* in pfff.
* in flitter.
* In the end I thought generating datalog facts for plan9 using lang_c/
* was simpler that modifying CIL (moreover fixing lang_cpp/ and lang_c/
* to handle plan9 code was anyway needed for codemap).

View file

@ -2,8 +2,8 @@ ast_cpp.cmo : ../../h_program-lang/scope_code.cmi \
../../h_program-lang/parse_info.cmi ../../commons/common.cmi
ast_cpp.cmx : ../../h_program-lang/scope_code.cmx \
../../h_program-lang/parse_info.cmx ../../commons/common.cmx
flag_parsing_cpp.cmo : ../../globals/config_pfff.cmo
flag_parsing_cpp.cmx : ../../globals/config_pfff.cmx
flag_parsing_cpp.cmo : ../../globals/config_flitter.cmo
flag_parsing_cpp.cmx : ../../globals/config_flitter.cmx
lexer_cpp.cmo : parser_cpp.cmi ../../h_program-lang/parse_info.cmi \
flag_parsing_cpp.cmo ../../commons/common2.cmi ../../commons/common.cmi \
ast_cpp.cmo
@ -182,11 +182,11 @@ type_cpp.cmo : ast_cpp.cmo type_cpp.cmi
type_cpp.cmx : ast_cpp.cmx type_cpp.cmi
type_cpp.cmi : ast_cpp.cmo
unit_parsing_cpp.cmo : parse_cpp.cmi ../../commons/oUnit.cmi \
flag_parsing_cpp.cmo ../../globals/config_pfff.cmo \
flag_parsing_cpp.cmo ../../globals/config_flitter.cmo \
../../commons/common2.cmi ../../commons/common.cmi ast_cpp.cmo \
unit_parsing_cpp.cmi
unit_parsing_cpp.cmx : parse_cpp.cmx ../../commons/oUnit.cmx \
flag_parsing_cpp.cmx ../../globals/config_pfff.cmx \
flag_parsing_cpp.cmx ../../globals/config_flitter.cmx \
../../commons/common2.cmx ../../commons/common.cmx ast_cpp.cmx \
unit_parsing_cpp.cmi
unit_parsing_cpp.cmi : ../../commons/oUnit.cmi

View file

@ -89,7 +89,7 @@ token_views_context.cmo: token_views_context.ml
##############################################################################
# install
##############################################################################
LIBNAME=pfff-lang_cpp
LIBNAME=flitter-lang_cpp
EXPORTSRC=meta_ast_cpp.mli \
parser_cpp.mli parse_cpp.mli \
lib_parsing_cpp.mli visitor_cpp.mli \

View file

@ -31,7 +31,7 @@
* and because templates are also qualifiers, almost all types
* are now mutually recursive ...
*
* Like most other ASTs in pfff, it's actually more a Concrete Syntax Tree.
* Like most other ASTs in flitter, it's actually more a Concrete Syntax Tree.
* Some stuff are tagged 'semantic:' which means that they are computed
* after parsing.
*

View file

@ -12,7 +12,7 @@ type language =
(*****************************************************************************)
let macros_h =
ref (Filename.concat Config_pfff.path "/data/cpp_stdlib/macros.h")
ref (Filename.concat Config_flitter.path "/data/cpp_stdlib/macros.h")
let cmdline_flags_macrofile () = [
"-macros", Arg.Set_string macros_h,

View file

@ -255,7 +255,7 @@ let (_defs : (string, Pp_token.define_body) Hashtbl.t) =
*)
let add_defs file =
if not (Sys.file_exists file)
then failwith (spf "Could not find %s, have you set PFFF_HOME correctly?"
then failwith (spf "Could not find %s, have you set FLITTER_HOME correctly?"
file);
pr2 (spf "Using %s macro file" file);
let xs = extract_macros file in

View file

@ -33,7 +33,7 @@ let unittest =
(* Parsing *)
(*-----------------------------------------------------------------------*)
"regression files" >:: (fun () ->
let dir = Filename.concat Config_pfff.path "/tests/cpp/parsing" in
let dir = Filename.concat Config_flitter.path "/tests/cpp/parsing" in
let files =
Common2.glob (spf "%s/*.cpp" dir) @ Common2.glob (spf "%s/*.h" dir) in
files +> List.iter (fun file ->
@ -46,7 +46,7 @@ let unittest =
);
"rejecting bad code" >:: (fun () ->
let dir = Filename.concat Config_pfff.path "/tests/cpp/parsing_errors" in
let dir = Filename.concat Config_flitter.path "/tests/cpp/parsing_errors" in
let files = Common2.glob (spf "%s/*.cpp" dir) in
files +> List.iter (fun file ->
try
@ -61,7 +61,7 @@ let unittest =
(* parsing C files (and not C++ files) possibly containing C++ keywords *)
"C regression files" >:: (fun () ->
let dir = Filename.concat Config_pfff.path "/tests/c/parsing" in
let dir = Filename.concat Config_flitter.path "/tests/c/parsing" in
let files =
Common2.glob (spf "%s/*.c" dir)
(* @ Common2.glob (spf "%s/*.h" dir) *) in

View file

@ -8,7 +8,7 @@ open Common
(* Purpose *)
(*****************************************************************************)
(*
* A "driver" for the different parsers in pfff.
* A "driver" for the different parsers in flitter.
*)
(*****************************************************************************)
@ -52,7 +52,7 @@ let test_json_pretty_printer file =
(* ---------------------------------------------------------------------- *)
let pfff_extra_actions () = [
let flitter_extra_actions () = [
"-dump_json", " <file>",
Common.mk_action_1_arg test_json_pretty_printer;
"-json_pp", " <file>",
@ -64,7 +64,7 @@ let pfff_extra_actions () = [
(*****************************************************************************)
let all_actions () =
pfff_extra_actions() @
flitter_extra_actions() @
Test_parsing_c.actions()@
Test_parsing_cpp.actions()@
Generate_nim.actions()@
@ -96,7 +96,7 @@ let options () = [
Common2.cmdline_flags_other () @
[
"-version", Arg.Unit (fun () ->
pr2 (spf "pfff version: %s" Config_pfff.version);
pr2 (spf "flitter version: %s" Config_flitter.version);
exit 0;
), " guess what";
]

View file

@ -64,7 +64,7 @@ let options () = [
Common2.cmdline_flags_other () @
[
"-version", Arg.Unit (fun () ->
pr2 (spf "pfff (test) version: %s" Config_pfff.version);
pr2 (spf "flitter (test) version: %s" Config_flitter.version);
exit 0;
),
" guess what";