mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-10-02 12:23:17 +08:00
[clean] remove old tool wiki_gen
This commit is contained in:
@@ -1,49 +0,0 @@
|
||||
|
||||
|
||||
all: wiki_gen
|
||||
cd ../../../conf/autopilot/subsystems/fixedwing; ls -1 > list_of_files.txt; ../../../../sw/tools/wiki_gen/wiki_gen list_of_files.txt > ../../../../sw/tools/wiki_gen/fixedwing.wiki; rm list_of_files.txt
|
||||
|
||||
wiki_gen:
|
||||
g++ wiki_gen.c -o wiki_gen
|
||||
|
||||
|
||||
|
||||
# Quiet compilation
|
||||
Q=@
|
||||
|
||||
OCAML=ocaml
|
||||
OCAMLC=ocamlc
|
||||
INCLUDES=-I ../../lib/ocaml $(shell ocamlfind query -r -i-format xml-light)
|
||||
OCAMLNETINCLUDES=$(shell ocamlfind query -r -i-format netstring) $(shell ocamlfind query -r -i-format netclient)
|
||||
OCAMLNETCMA=$(shell ocamlfind query -r -a-format -predicates byte netstring)
|
||||
|
||||
|
||||
%.out : %.ml Makefile
|
||||
@echo OC $<
|
||||
$(Q)$(OCAMLC) $(INCLUDES) -o $@ unix.cma str.cma ivy-ocaml.cma xml-light.cma lib-pprz.cma $<
|
||||
@cat ../../../pprz_src_test.sh > $@
|
||||
@echo '$(OCAML) $(shell ocamlfind query -r -i-format xml-light) $(OCAMLNETINCLUDES) -I $$PAPARAZZI_SRC/sw/lib/ocaml unix.cma str.cma ivy-ocaml.cma xml-light.cma $(OCAMLNETCMA) lib-pprz.cma $$PAPARAZZI_BIN/$< $$*' >> $@
|
||||
@chmod a+x $@
|
||||
|
||||
%.cmo : %.ml ../lib/ocaml/lib-pprz.cma
|
||||
@echo OC $<
|
||||
$(Q)$(OCAMLC) $(INCLUDES) -c $<
|
||||
|
||||
%.cmi : %.mli
|
||||
@echo OC $<
|
||||
$(Q)$(OCAMLC) $(INCLUDES) -c $<
|
||||
|
||||
%.ml : %.mll
|
||||
@echo OC $<
|
||||
$(Q)$(OCAMLLEX) $<
|
||||
|
||||
%.ml : %.mly
|
||||
@echo OC $<
|
||||
$(Q)$(OCAMLYACC) $<
|
||||
|
||||
%.mli : %.mly
|
||||
@echo OC $<
|
||||
$(Q)$(OCAMLYACC) $<
|
||||
|
||||
clean:
|
||||
$(Q)rm -f *.cm* *.out *~
|
||||
@@ -1 +0,0 @@
|
||||
This directory contains tools used to generate documentation on the wiki for modules and susbsystems
|
||||
@@ -1,126 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void parse_name(char* subs)
|
||||
{
|
||||
int status = 0;
|
||||
int i = 0;
|
||||
printf("\nThis block\n\n <subsystem name=\"");
|
||||
|
||||
for (i=0;i<256;i++)
|
||||
{
|
||||
if (subs[i] == '_')
|
||||
{
|
||||
status = 1;
|
||||
break;
|
||||
}
|
||||
if (subs[i] == '.')
|
||||
{
|
||||
status = 2;
|
||||
break;
|
||||
}
|
||||
printf("%c",subs[i]);
|
||||
}
|
||||
|
||||
if (status == 1)
|
||||
{
|
||||
printf("\" type=\"");
|
||||
for (i++;i<256;i++)
|
||||
{
|
||||
|
||||
if (subs[i] == '.')
|
||||
{
|
||||
break;
|
||||
}
|
||||
printf("%c",subs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
printf("\" >\n\nreplaces\n\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
int empty_line(char* line)
|
||||
{
|
||||
for (int i=0;i<256;i++)
|
||||
{
|
||||
if (
|
||||
(line[i] == ' ') ||
|
||||
(line[i] == '\t') ||
|
||||
(line[i] == '\n') ||
|
||||
(line[i] == '\r')
|
||||
)
|
||||
{
|
||||
}
|
||||
else if (line[i] == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void print_subsys(char* file)
|
||||
{
|
||||
char line[256];
|
||||
FILE* fp = 0;
|
||||
|
||||
parse_name(file);
|
||||
|
||||
fp = fopen(file , "r");
|
||||
if ( fp != NULL)
|
||||
{
|
||||
|
||||
while (fgets(line, sizeof(line), fp) != NULL)
|
||||
{
|
||||
if (empty_line(line) == 0)
|
||||
{
|
||||
printf(" ");
|
||||
fputs(line,stdout);
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Error opening '%s'\n",file);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
char buff[256];
|
||||
FILE* list_subs = 0;
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
printf("Need a file name\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
list_subs = fopen(argv[1] , "r");
|
||||
if ( list_subs != NULL)
|
||||
{
|
||||
|
||||
while (fgets(buff, sizeof(buff), list_subs) != NULL)
|
||||
{
|
||||
for (int i=0;i<256;i++)
|
||||
{
|
||||
if (buff[i] == '\n')
|
||||
buff[i] = 0;
|
||||
}
|
||||
print_subsys(buff);
|
||||
}
|
||||
fclose(list_subs);
|
||||
}
|
||||
|
||||
|
||||
printf("converting");
|
||||
return 0;
|
||||
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
open Printf
|
||||
module U = Unix
|
||||
|
||||
let (//) = Filename.concat
|
||||
|
||||
let print_params = fun outfile xml ->
|
||||
List.iter (fun tag ->
|
||||
if ExtXml.tag_is tag "param" then begin
|
||||
begin try
|
||||
fprintf outfile " param %s %s \n" (Xml.attrib tag "name") (Xml.attrib tag "values");
|
||||
with _ -> () end;
|
||||
end)
|
||||
(Xml.children xml)
|
||||
|
||||
let print_subsystems = fun outfile xml ->
|
||||
List.iter (fun tag ->
|
||||
if ExtXml.tag_is tag "subsystem" then begin
|
||||
fprintf outfile "\n";
|
||||
fprintf outfile " subsystem '%s' \n" (Xml.attrib tag "name");
|
||||
fprintf outfile " types: '%s'\n" (Xml.attrib tag "types");
|
||||
(** fprintf outfile "####################################################\n"; **)
|
||||
print_params outfile tag; (** subsystem parameters **)
|
||||
end)
|
||||
(Xml.children xml)
|
||||
|
||||
|
||||
let print_targets = fun outfile xml ->
|
||||
List.iter (fun tag ->
|
||||
if ExtXml.tag_is tag "target" then begin
|
||||
fprintf outfile "\n\n";
|
||||
fprintf outfile "===target '%s'===\n" (Xml.attrib tag "name");
|
||||
fprintf outfile " Description: '%s'\n" (Xml.attrib tag "description");
|
||||
print_params outfile tag; (** target parameters **)
|
||||
print_subsystems outfile tag; (** target subsystems **)
|
||||
end)
|
||||
(Xml.children xml)
|
||||
|
||||
|
||||
|
||||
|
||||
let parse_firmware_xml = fun firmware_xml firmware_wiki ->
|
||||
let xml = ExtXml.parse_file firmware_xml in
|
||||
let f = open_out firmware_wiki in
|
||||
fprintf f " This file has been generated from %s\n" firmware_xml;
|
||||
if ExtXml.tag_is xml "firmware" then begin
|
||||
begin try
|
||||
fprintf f "\n=Firmware=\n";
|
||||
fprintf f " This is the '%s' firmware\n" (Xml.attrib xml "name");
|
||||
fprintf f " Supported boards '%s'\n" (Xml.attrib xml "boards");
|
||||
fprintf f " Description: '%s'\n" (Xml.attrib xml "description");
|
||||
fprintf f "==Parameters==\n";
|
||||
print_params f xml; (** fimware parameters **)
|
||||
fprintf f "==Subsystems==\n";
|
||||
print_subsystems f xml; (** firmware subsystems **)
|
||||
fprintf f "==Targets==\n";
|
||||
print_targets f xml; (** targets **)
|
||||
with _ -> () end;
|
||||
end
|
||||
|
||||
|
||||
(******************************* MAIN ****************************************)
|
||||
(** call with wikigen firmware_desc.xml firmware_desc.wiki **)
|
||||
let () =
|
||||
try
|
||||
if Array.length Sys.argv <> 3 then
|
||||
failwith (sprintf "Usage: %s firmware_desc.xml firmware_desc.wiki" Sys.argv.(0));
|
||||
let firmware_xml = Sys.argv.(1) in
|
||||
let firmware_wiki = Sys.argv.(2) in
|
||||
parse_firmware_xml firmware_xml firmware_wiki
|
||||
with
|
||||
Failure f ->
|
||||
prerr_endline f;
|
||||
exit 1
|
||||
Reference in New Issue
Block a user