33 using namespace faudes;
42 std::cerr <<
"" << std::endl;
43 std::cerr <<
"flxinstall: " << rMessage <<
": ERROR." << std::endl;
44 std::cerr <<
"" << std::endl;
48 std::cerr <<
"" << std::endl;
49 std::cerr <<
"utility to create/install/remove faudes-lua-extension "<< std::endl;
50 std::cerr << std::endl <<
"usage: " << std::endl;
51 std::cerr <<
"flxinstall <other options> <mode> <input-file(s)> <output-file/path>" << std::endl;
52 std::cerr <<
"with <mode> as follows:" << std::endl;
53 std::cerr <<
" -c create extension (*.flx file) from input files" << std::endl;
54 std::cerr <<
" -i install extension (*.flx file) to libFAUDES installation" << std::endl;
55 std::cerr <<
" -r remove extensions from libFAUDES installation" << std::endl;
56 std::cerr <<
" -x extract extension (*.flx file) to output directory" << std::endl;
57 std::cerr <<
" -t extract and test extension (*.flx file) to output directory" << std::endl;
58 std::cerr << std::endl;
59 std::cerr <<
"note: <other options> address the default target layout" << std::endl;
69 std::string
mXmlSeparator =
"<!-- ================================================================================ -->";
110 std::string dir = rPath;
113 std::cerr <<
"flxinstall: creating dir \"" << dir <<
"\"" << std::endl;
114 int sysret=std::system(std::string(
"mkdir " + dir).c_str());
116 std::cerr <<
"flxinstall: error while creating directory \"" << dir <<
"\"" << std::endl;
124 std::set < std::string > res;
125 for(std::set < std::string >::iterator fit=src.begin(); fit!=src.end(); fit++) {
126 if(*fit==
"")
continue;
127 if((*fit).at(0)==
'.')
continue;
139 void Lua2ref(
const std::string& rLuaFile,
const std::string& rRefFile=
"") {
142 std::cerr <<
"flxinstall: ignoring lua script \"" << rLuaFile <<
"\"" << std::endl;
146 std::string dst=rRefFile;
153 std::cerr <<
"flxinstall: converting lua script \"" << rLuaFile <<
"\"" << std::endl;
154 int sysret=std::system(cmd.c_str());
156 std::cerr <<
"flxinstall: error while converting lua script \"" << rLuaFile <<
"\"" << std::endl;
166 void Gen2ref(
const std::string& rGenFile,
const std::string& rRefFile=
"") {
167 std::cerr <<
"flxinstall: converting generator file \"" << rGenFile <<
"\"" << std::endl;
170 std::string dst=rRefFile;
190 tw.
WriteCharacterData(
"<object type=\"image/svg+xml\" name=\"graph\" data=\""+bas+
".svg\">\n");
192 tw.
WriteCharacterData(
"<img src=\"$genfile.png\" title=\"Click on image to download SVG formated file.\" />\n");
205 std::cerr <<
"flxinstall: error while converting generator \"" << rGenFile <<
"\"" << std::endl;
254 rTr.
ReadBegin(
"LuaFunctionDefinition",btag);
259 rTw.
WriteEnd(
"LuaFunctionDefinition");
261 rTr.
ReadEnd(
"LuaFunctionDefinition");
274 while(rTr.
Peek(code)) {
292 rTr.
Streamp()->seekg(0, std::ios::end);
293 std::streampos last = rTr.
Streamp()->tellg();
294 rTr.
Streamp()->seekg(0, std::ios::beg);
295 std::streampos first = rTr.
Streamp()->tellg();
296 size=(
long int) last-first;
297 buffer =
new char[last-first];
298 rTr.
Streamp()->read(buffer, last-first);
300 }
catch (std::ios::failure&) {
301 std::cerr <<
"flxinstall: io error when reading \"" << rTr.
FileName() <<
"\": ERROR." << std::endl;
305 std::string bufferstr;
306 bufferstr.assign(buffer,size);
330 rTr.
Streamp()->seekg(0, std::ios::end);
331 std::streampos last = rTr.
Streamp()->tellg();
332 rTr.
Streamp()->seekg(0, std::ios::beg);
333 std::streampos first = rTr.
Streamp()->tellg();
334 size=(
long int) last-first;
335 buffer =
new char[last-first];
336 rTr.
Streamp()->read(buffer, last-first);
338 }
catch (std::ios::failure&) {
339 std::cerr <<
"flxinstall: io error when reading \"" << rTr.
FileName() <<
"\": ERROR." << std::endl;
366 rTr.
Streamp()->seekg(0, std::ios::end);
367 std::streampos last = rTr.
Streamp()->tellg();
368 rTr.
Streamp()->seekg(0, std::ios::beg);
369 std::streampos first = rTr.
Streamp()->tellg();
370 size=(
long int) last-first;
371 buffer =
new char[last-first];
372 rTr.
Streamp()->read(buffer, last-first);
374 }
catch (std::ios::failure&) {
375 std::cerr <<
"flxinstall: io error when reading \"" << rTr.
FileName() <<
"\": ERROR." << std::endl;
417 std::cerr <<
"flxinstall: scanning full generator image \"" << pbas <<
".*\"" << std::endl;
423 if(! ((ext==
"png") || (ext==
"svg") || (ext==
"jpeg") || (ext==
"jpg") ))
continue;
425 std::cerr <<
"flxinstall: scanning image file \"" << *fit <<
"\"" << std::endl;
435 std::cerr <<
"flxinstall: scanning luafunction \"" << *fit <<
"\"" << std::endl;
438 tr.
ReadBegin(
"LuaFunctionDefinition",btag);
440 std::cerr <<
"flxinstall: name not specified " << tr.
FileLine() <<
": ERROR." << std::endl;
447 size_t pos=name.find(
"::");
448 if(pos!=std::string::npos) {
449 space=name.substr(0,pos);
450 name=name.substr(pos+2);
454 std::cerr <<
"flxinstall: namespace must match extension name" << tr.
FileLine() <<
": ERROR." << std::endl;
459 tr.
ReadEnd(
"LuaFunctionDefinition");
469 std::cerr <<
"flxinstall: scanning reference page \"" << *fit <<
"\"" << std::endl;
474 std::cerr <<
"flxinstall: page not specified " << tr.
FileLine() <<
": ERROR." << std::endl;
478 std::cerr <<
"flxinstall: title not specified " << tr.
FileLine() << std::endl;
483 std::cerr <<
"flxinstall: chapter must be \"Reference\" " << tr.
FileLine() <<
": ERROR." << std::endl;
492 std::cerr <<
"flxinstall: section name \"" <<
mExtensionName <<
"\" expected "
493 << tr.
FileLine() <<
": ERROR." << std::endl;
497 std::transform(page.begin(), page.end(), page.begin(), tolower);
499 std::string ppage=page;
500 std::size_t upos = ppage.find_first_of(
"_");
501 std::size_t dpos = 0;
502 for(; dpos < ppage.size();dpos++)
503 if(!isdigit(ppage.at(dpos)))
break;
504 if(upos!=std::string::npos)
506 if(upos+1<ppage.size())
507 ppage=ppage.substr(upos+1,ppage.size()-upos-1);
510 std::cerr <<
"flxinstall: double page label \"" << ppage <<
"\" "
511 << tr.
FileLine() <<
": ERROR." << std::endl;
519 std::cerr <<
"flxinstall: missing index page, will be generated on installation." << std::endl;
550 std::cerr <<
"flxinstall: appending reference page from \"" << *fit <<
"\"" << std::endl;
551 *ptw <<
"\n" <<
"\n";
555 *ptw->
Streamp() <<
"<!-- reference page from source \"" << *fit <<
"\" -->" << std::endl;
556 *ptw <<
"\n" <<
"\n";
563 std::cerr <<
"flxinstall: appending lua function from \"" << *fit <<
"\"" << std::endl;
564 *ptw <<
"\n" <<
"\n";
568 *ptw->
Streamp() <<
"<!-- lua function from source \"" << *fit <<
"\" -->" << std::endl;
569 *ptw <<
"\n" <<
"\n";
576 std::cerr <<
"flxinstall: appending image/binary file from \"" << *fit <<
"\"" << std::endl;
577 *ptw <<
"\n" <<
"\n";
581 *ptw->
Streamp() <<
"<!-- binary file from source \"" << *fit <<
"\" -->" << std::endl;
582 *ptw <<
"\n" <<
"\n";
589 std::cerr <<
"flxinstall: appending full generator from \"" << pbas <<
".*\"" << std::endl;
590 *ptw <<
"\n" <<
"\n";
594 *ptw->
Streamp() <<
"<!-- full generator image from source \"" << pbas <<
".*\" -->" << std::endl;
595 *ptw <<
"\n" <<
"\n";
598 *ptw <<
"\n" <<
"\n";
601 *ptw <<
"\n" <<
"\n";
609 std::cerr <<
"flxinstall: appending tutorial from \"" << *fit <<
"\"" << std::endl;
610 *ptw <<
"\n" <<
"\n";
614 *ptw->
Streamp() <<
"<!-- tutorial from source \"" << *fit <<
"\" -->" << std::endl;
615 *ptw <<
"\n" <<
"\n";
621 if(ext==
"" && bas==
"data") {
624 if(datafiles.size()==0)
continue;
625 std::cerr <<
"flxinstall: appending data files \"" << *fit <<
"\"" << std::endl;
626 *ptw <<
"\n" <<
"\n";
630 *ptw->
Streamp() <<
"<!-- data from source \"" << *fit <<
"\" -->" << std::endl;
631 *ptw <<
"\n" <<
"\n";
632 std::set< std::string >::iterator dit;
633 for(dit=datafiles.begin();dit!=datafiles.end();dit++) {
641 *ptw <<
"\n" <<
"\n";
655 std::cerr <<
"flxinstall: cannot open libfaudes binary path \"" <<
mFaudesBin <<
"\": ERROR." << std::endl;
661 if(binfiles.find(
"luafaudes.exe")!= binfiles.end()) {
664 if(binfiles.find(
"luafaudes")!= binfiles.end()) {
668 std::cerr <<
"flxinstall: warning: cannot open luafaudes in \"" <<
mFaudesBin <<
"\"" << std::endl;
678 if(faudesfiles.empty()) {
679 std::cerr <<
"flxinstall: cannot open target directory \"" <<
mFaudesBase <<
"\": ERROR." << std::endl;
685 if(faudesfiles.find(
"bin")!= faudesfiles.end())
689 std::cerr <<
"flxinstall: cannot open libfaudes binary path in \"" <<
mFaudesBin <<
"\": ERROR." << std::endl;
695 if(binfiles.find(
"ref2html.exe")!= binfiles.end()) {
698 if(binfiles.find(
"ref2html")!= binfiles.end()) {
702 std::cerr <<
"flxinstall: cannot open ref2html tool in \"" <<
mFaudesBin <<
"\": ERROR." << std::endl;
714 if(faudesfiles.find(
"doc")!= faudesfiles.end()) {
716 }
else if(faudesfiles.find(
"Doc")!= faudesfiles.end()) {
718 }
else if(faudesfiles.find(
"Documentation")!= faudesfiles.end()) {
722 std::cerr <<
"flxinstall: cannot open libfaudes documentation path in \"" <<
mFaudesBase <<
"\": ERROR." << std::endl;
727 std::cerr <<
"flxinstall: cannot open libfaudes documentation path at \"" <<
mFaudesDoc <<
"\": ERROR." << std::endl;
736 if(docfiles.find(
"reference")!= docfiles.end()) {
738 }
else if(docfiles.find(
"Reference")!= faudesfiles.end()) {
742 std::cerr <<
"flxinstall: cannot open libfaudes reference path in \"" <<
mFaudesDoc <<
"\": ERROR." << std::endl;
748 if(docfiles.find(
"luafaudes")!= docfiles.end()) {
750 }
else if(docfiles.find(
"Luafaudes")!= docfiles.end()) {
769 if(docfiles.find(
"images")!= docfiles.end()) {
772 std::cerr <<
"flxinstall: cannot open images in \"" <<
mFaudesDoc <<
"\": ERROR." << std::endl;
777 if(docfiles.find(
"refsrc")!= docfiles.end()) {
780 std::cerr <<
"flxinstall: cannot open refsrc in \"" <<
mFaudesDoc <<
"\": ERROR." << std::endl;
787 std::cerr <<
"flxinstall: cannot open libfaudes.rti at \"" <<
mFaudesDocRti <<
"\": ERROR." << std::endl;
795 std::cerr <<
"flxinstall: cannot open navigation file \"" <<
mFaudesDocNav <<
"\": ERROR." << std::endl;
800 if(docfiles.find(
"tmp_flx")== docfiles.end()) {
801 std::cerr <<
"flxinstall: creating temp dir \"" <<
mFaudesDocTemp <<
"\"" << std::endl;
819 std::cerr <<
"flxinstall: lua-extension must have a name attribute " << rTr.
FileLine() <<
": ERROR." << std::endl;
824 while(!rTr.
Eos(
"LuaExtension")) {
838 std::string title=
"libFAUDES Reference";
841 std::string chapter=
"Reference";
844 std::string section=
"";
851 if(page==
"" || section==
"") {
852 std::cerr <<
"flxinstall: skipping undefined page at " << rTr.
FileLine() << std::endl;
858 std::transform(section.begin(), section.end(), section.begin(), tolower);
859 std::transform(page.begin(), page.end(), page.begin(), tolower);
861 std::string ppage=page;
862 std::size_t upos = ppage.find_first_of(
"_");
863 std::size_t dpos = 0;
864 for(; dpos < ppage.size();dpos++)
865 if(!isdigit(ppage.at(dpos)))
break;
866 if(upos!=std::string::npos)
868 if(upos+1<ppage.size())
869 ppage=ppage.substr(upos+1,ppage.size()-upos-1);
871 std::string basename= section +
"_" + ppage;
874 std::string dstfile=rDstDir +
faudes_pathsep() + basename +
".fref";
875 std::cerr <<
"flxinstall: extracting reference page to \"" << dstfile <<
"\"" << std::endl;
892 std::cerr <<
"flxinstall: lua-extension must have a name attribute " << rTr.
FileLine() <<
": ERROR." << std::endl;
897 while(!rTr.
Eos(
"LuaExtension")) {
914 std::cerr <<
"flxinstall: image file must specify name " << rTr.
FileLine() << std::endl;
920 if(ext!=
"png" && ext!=
"svg" && ext!=
"jpg" && ext!=
"jpeg") {
928 std::cerr <<
"flxinstall: skipping invalid image data " << rTr.
FileLine() << std::endl;
933 std::transform(name.begin(), name.end(), name.begin(), tolower);
935 std::cerr <<
"flxinstall: extracting image to \"" << dstfile <<
"\"" << std::endl;
940 fsout.exceptions(std::ios::badbit|std::ios::failbit);
942 fsout.open(dstfile.c_str(), std::ios::out | std::ios::binary);
946 catch (std::ios::failure&) {
947 std::cerr <<
"flxinstall: file io error when writing \"" << dstfile <<
"\"" << std::endl;
960 std::cerr <<
"flxinstall: lua-extension must have a name attribute " << rTr.
FileLine() <<
": ERROR." << std::endl;
965 while(!rTr.
Eos(
"LuaExtension")) {
982 std::cerr <<
"flxinstall: image file must specify name " << rTr.
FileLine() << std::endl;
996 std::cerr <<
"flxinstall: skipping invalid image data " << rTr.
FileLine() << std::endl;
1001 std::transform(name.begin(), name.end(), name.begin(), tolower);
1003 std::cerr <<
"flxinstall: extracting image to \"" << dstfile <<
"\"" << std::endl;
1008 fsout.exceptions(std::ios::badbit|std::ios::failbit);
1010 fsout.open(dstfile.c_str(), std::ios::out | std::ios::binary);
1014 catch (std::ios::failure&) {
1015 std::cerr <<
"flxinstall: file io error when writing \"" << dstfile <<
"\"" << std::endl;
1035 std::cerr <<
"flxinstall: lua-extension must have a name attribute " << rTr.
FileLine() <<
": ERROR." << std::endl;
1040 while(!rTr.
Eos(
"LuaExtension")) {
1058 size_t pos=name.find(
"::");
1059 if(pos!=std::string::npos) {
1060 space=name.substr(0,pos);
1061 name=name.substr(pos+2);
1066 std::cerr <<
"flxinstall: skipping undefined lua function at " << rTr.
FileLine() << std::endl;
1067 rTr.
ReadBegin(
"LuaFunctionDefinition",btag);
1068 rTr.
ReadEnd(
"LuafunctionDefinition");
1083 std::cerr <<
"flxinstall: extracting lua function \"" << name <<
"\"" << std::endl;
1086 *rTw.
Streamp() <<
"<!-- lua function from lua-extension " << rTr.
FileLine() <<
" -->" << std::endl;
1087 rTw <<
"\n" <<
"\n";
1102 std::cerr <<
"flxinstall: lua-extension must have a name attribute " << rTr.
FileLine() <<
": ERROR." << std::endl;
1107 while(!rTr.
Eos(
"LuaExtension")) {
1123 std::cerr <<
"flxinstall: lua tutorial must specify name " << rTr.
FileLine() << std::endl;
1128 std::transform(name.begin(), name.end(), name.begin(), tolower);
1130 std::cerr <<
"flxinstall: extracting lua tutorial to \"" << dstfile <<
"\"" << std::endl;
1143 std::transform(index.begin(), index.end(), index.begin(), tolower);
1146 std::cerr <<
"flxinstall: index page provided" << std::endl;
1151 std::cerr <<
"flxinstall: reference page missing: \"" << index <<
".fref\": ERROR" << std::endl;
1155 std::cerr <<
"flxinstall: generate index page" << std::endl;
1157 *tw.
Streamp() <<
"<!-- flxinstall " <<
VersionString() <<
": auto generated index -->" << std::endl;
1159 "\" page=\"0_Index\" title=\""<<
mExtensionName <<
" Index\" >" << std::endl;
1163 std::set< std::string >::iterator fit;
1165 *tw.
Streamp() <<
"<ffnct_reference name=\"" << *fit <<
"\" />" << std::endl;
1168 *tw.
Streamp() <<
"</ReferencePage>" << std::endl;
1186 for(std::set < std::string >::iterator fit=tmpfiles.begin(); fit!=tmpfiles.end(); fit++) {
1189 std::cerr <<
"flxinstall: failed to remove \"" << *fit <<
"\"" << std::endl;
1197 std::set< std::string > srcfiles;
1199 std::string sfile = *fit;
1201 srcfiles.insert(sfile);
1206 for(std::set < std::string >::iterator dit=sdir.begin();dit!=sdir.end();dit++) {
1208 srcfiles.insert(sfile);
1213 for(std::set < std::string >::iterator fit=srcfiles.begin(); fit!=srcfiles.end(); fit++) {
1219 std::cerr <<
"flxinstall: extracting lua-extension from \"" << *fit <<
"\"" << std::endl;
1242 std::cerr <<
"flxinstall: generating list of source files" << std::endl;
1245 std::set< std::string > tocsource;
1247 std::set< std::string > frefbase;
1251 std::set< std::string > docsource;
1253 for(std::set < std::string >::iterator fit=docrefsrc.begin(); fit!=docrefsrc.end(); fit++) {
1257 if(ext!=
"fref")
continue;
1258 if(frefbase.find(bas)!=frefbase.end()){
1259 std::cerr <<
"flxinstall: reference file doublet \"" << *fit <<
"\" from std dist: ERROR." << std::endl;
1262 docsource.insert(ffile);
1263 tocsource.insert(ffile);
1264 frefbase.insert(bas);
1268 std::set< std::string > docrefsource;
1270 for(std::set < std::string >::iterator fit=docrefsrcref.begin(); fit!=docrefsrcref.end(); fit++) {
1274 if(ext!=
"fref")
continue;
1275 if(frefbase.find(bas)!=frefbase.end()){
1276 std::cerr <<
"flxinstall: reference file doublet \"" << *fit <<
"\" from std dist: ERROR." << std::endl;
1279 docrefsource.insert(ffile);
1280 tocsource.insert(ffile);
1281 frefbase.insert(bas);
1284 for(std::set < std::string >::iterator fit=doctmpdir.begin(); fit!=doctmpdir.end(); fit++) {
1288 if(ext!=
"fref")
continue;
1289 if(frefbase.find(bas)!=frefbase.end()){
1290 std::cerr <<
"flxinstall: reference file doublet \"" << *fit <<
"\" from ext: ERROR." << std::endl;
1293 docrefsource.insert(ffile);
1294 tocsource.insert(ffile);
1295 frefbase.insert(bas);
1300 std::set< std::string > docluasource;
1302 for(std::set < std::string >::iterator fit=docrefsrclua.begin(); fit!=docrefsrclua.end(); fit++) {
1306 if(ext!=
"fref")
continue;
1307 if(frefbase.find(bas)!=frefbase.end()){
1308 std::cerr <<
"flxinstall: reference file doublet \"" << *fit <<
"\" from lua doc: ERROR." << std::endl;
1311 docluasource.insert(ffile);
1312 tocsource.insert(ffile);
1313 frefbase.insert(bas);
1316 for(std::set < std::string >::iterator fit=tmpfiles.begin(); fit!=tmpfiles.end(); fit++) {
1322 if(ext!=
"lua")
continue;
1325 if(tmpfiles.find(fref)!=tmpfiles.end())
continue;
1330 docluasource.insert(ffile);
1331 tocsource.insert(ffile);
1332 frefbase.insert(bas);
1337 std::set< std::string > docimgsource;
1339 for(std::set < std::string >::iterator fit=docrefsrcimg.begin(); fit!=docrefsrcimg.end(); fit++) {
1343 if(ext!=
"fref")
continue;
1344 docimgsource.insert(ffile);
1347 for(std::set < std::string >::iterator fit=imgfiles.begin(); fit!=imgfiles.end(); fit++) {
1353 if(ext!=
"gen")
continue;
1360 docimgsource.insert(ffile);
1366 for(std::set < std::string >::iterator fit=tocsource.begin(); fit!=tocsource.end(); fit++) {
1367 toccmd+=
" " + *fit;
1371 std::cerr <<
"flxinstall: creating toc" << std::endl;
1372 if(std::system(toccmd.c_str())!=0) {
1373 std::cerr <<
"flxinstall: processing" << std::endl << toccmd << std::endl;
1374 std::cerr <<
"flxinstall: error setting up toc: ERROR." << std::endl;
1377 std::cerr <<
"flxinstall: creating toc: done" << std::endl;
1382 for(std::set < std::string >::iterator fit=docsource.begin(); fit!=docsource.end(); fit++) {
1383 doccmd +=
" " + *fit;
1389 std::cerr <<
"flxinstall: processing doc base" << std::endl;
1390 if(std::system(doccmd.c_str())!=0) {
1391 std::cerr <<
"flxinstall: processing" << std::endl << doccmd << std::endl;
1392 std::cerr <<
"flxinstall: error while processing doc base: ERROR." << std::endl;
1395 std::cerr <<
"flxinstall: processing doc base: done" << std::endl;
1399 for(std::set < std::string >::iterator fit=docrefsource.begin(); fit!=docrefsource.end(); fit++) {
1400 refcmd +=
" " + *fit;
1404 +
" -css " +
mFaudesDocCss +
" -inc " + mFaudesDocToc +
" -rel ../ "
1406 std::cerr <<
"flxinstall: processing user reference" << std::endl;
1407 if(std::system(refcmd.c_str())!=0) {
1408 std::cerr <<
"flxinstall: processing" << std::endl << refcmd << std::endl;
1409 std::cerr <<
"flxinstall: error while processing user reference: ERROR." << std::endl;
1412 std::cerr <<
"flxinstall: processing user reference: done" << std::endl;
1417 for(std::set < std::string >::iterator fit=docluasource.begin(); fit!=docluasource.end(); fit++) {
1418 luacmd +=
" " + *fit;
1422 +
" -css " +
mFaudesDocCss +
" -inc " + mFaudesDocToc +
" -rel ../ "
1424 std::cerr <<
"flxinstall: processing lua tutorial" << std::endl;
1425 if(std::system(luacmd.c_str())!=0) {
1426 std::cerr <<
"flxinstall: processing" << std::endl << luacmd << std::endl;
1427 std::cerr <<
"flxinstall: error while processing lua tutorial: ERROR." << std::endl;
1430 std::cerr <<
"flxinstall: processing lua tutorial: done" << std::endl;
1436 for(std::set < std::string >::iterator fit=docimgsource.begin(); fit!=docimgsource.end(); fit++)
1437 imgcmd +=
" " + *fit;
1440 +
" -css " +
mFaudesDocCss +
" -inc " + mFaudesDocToc +
" -rel ../ "
1442 std::cerr <<
"flxinstall: processing image files" << std::endl;
1443 if(std::system(imgcmd.c_str())!=0) {
1444 std::cerr <<
"flxinstall: processing" << std::endl << imgcmd << std::endl;
1445 std::cerr <<
"flxinstall: error while processing image files: ERROR." << std::endl;
1448 std::cerr <<
"flxinstall: processing image files: done" << std::endl;
1457 +
" -css " +
mFaudesDocCss +
" -inc " + mFaudesDocToc +
" -rel ./ "
1459 std::cerr <<
"flxinstall: fix html index " << std::endl;
1460 if(std::system(proccmd.c_str())!=0) {
1461 std::cerr <<
"flxinstall: error when processing index.html: ERROR." <<std::endl;
1471 +
" -css " +
mFaudesDocCss +
" -inc " + mFaudesDocToc +
" -rel ../ "
1473 std::cerr <<
"flxinstall: fix html index " << std::endl;
1474 if(std::system(proccmd.c_str())!=0) {
1475 std::cerr <<
"flxinstall: error when processing index.html: ERROR." <<std::endl;
1485 +
" -css " +
mFaudesDocCss +
" -inc " + mFaudesDocToc +
" -rel ../ "
1487 std::cerr <<
"flxinstall: fix html index " << std::endl;
1488 if(std::system(proccmd.c_str())!=0) {
1489 std::cerr <<
"flxinstall: error when processing index.html: ERROR." <<std::endl;
1503 std::cerr <<
"flxinstall: done" << std::endl;
1521 usage_exit(
"extract must specify a *.flx source");
1527 std::cerr <<
"flxinstall: lua-extension must have a name attribute " << tr.
FileLine() <<
": ERROR." << std::endl;
1532 while(!tr.
Eos(
"LuaExtension")) {
1543 std::cerr <<
"flxinstall: skipping referencepage without page attribute" << std::endl;
1549 std::transform(page.begin(), page.end(), page.begin(), tolower);
1551 std::cerr <<
"flxinstall: extracting reference page to \"" << dstname <<
"\"" << std::endl;
1561 std::cerr <<
"flxinstall: skipping lua function without name attribute" << std::endl;
1567 size_t pos=name.find(
"::");
1568 if(pos!=std::string::npos) name=name.substr(pos+2);
1569 name = name +
".rti";
1570 std::transform(name.begin(), name.end(), name.begin(), tolower);
1572 std::cerr <<
"flxinstall: extracting lua function to \"" << dstname <<
"\"" << std::endl;
1582 std::cerr <<
"flxinstall: skipping image file without name attribute" << std::endl;
1588 std::transform(name.begin(), name.end(), name.begin(), tolower);
1590 std::cerr <<
"flxinstall: extracting image file to \"" << dstname <<
"\"" << std::endl;
1600 fsout.exceptions(std::ios::badbit|std::ios::failbit);
1602 fsout.open(dstname.c_str(), std::ios::out | std::ios::binary);
1606 catch (std::ios::failure&) {
1607 std::cerr <<
"flxinstall: file io error when writing \"" << dstname <<
"\"" << std::endl;
1617 std::cerr <<
"flxinstall: skipping data file without name attribute" << std::endl;
1623 std::transform(name.begin(), name.end(), name.begin(), tolower);
1625 std::cerr <<
"flxinstall: extracting data file to \"" << dstname <<
"\"" << std::endl;
1638 fsout.exceptions(std::ios::badbit|std::ios::failbit);
1640 fsout.open(dstname.c_str(), std::ios::out | std::ios::binary);
1643 }
catch (std::ios::failure&) {
1644 std::cerr <<
"flxinstall: file io error when writing \"" << dstname <<
"\"" << std::endl;
1654 std::cerr <<
"flxinstall: skipping invalid data " << tr.
FileLine() << std::endl;
1664 std::cerr <<
"flxinstall: skipping tutorial without name attribute" << std::endl;
1670 std::transform(name.begin(), name.end(), name.begin(), tolower);
1672 std::cerr <<
"flxinstall: extracting tutorial to \"" << dstname <<
"\"" << std::endl;
1695 std::cerr <<
"flxinstall: cannot execute luafaudes" << std::endl;
1700 std::set< std::string > luascripts;
1701 for(std::set < std::string >::iterator fit=allfiles.begin(); fit!=allfiles.end(); fit++)
1704 for(std::set < std::string >::iterator fit=luascripts.begin(); fit!=luascripts.end(); fit++) {
1708 std::cerr <<
"flxinstall: execute: " << cmd << std::endl;
1709 int sysret=std::system(cmd.c_str());
1711 std::cerr <<
"flxinstall: error while running lua script \"" << *fit <<
"\"" << std::endl;
1740 for(i=1; i<argc; i++) {
1741 std::string option(argv[i]);
1743 if(option==
"-tdoc") {
1749 if(option==
"-tbin") {
1755 if(option==
"-trti") {
1761 if(option==
"-tcnav") {
1767 if(option==
"-tcss") {
1773 if(option==
"-tapp") {
1803 if((option==
"-?") || (option==
"--help")) {
1809 if(option.at(0)==
'-') {
1814 usage_exit(
"must set either -c, -i, -r, -x or -t mode" );
1820 for(;i<argc-1;i++) {
1825 std::set< std::string > srcfiles =
ReadDirectory(std::string(argv[i-1]));
1827 if(srcfiles.size()>0) {
1829 for(std::set < std::string >::iterator fit=srcfiles.begin(); fit!=srcfiles.end(); fit++)
1835 usage_exit(
"target *.flx-file not specified");
1841 usage_exit(
"target *.flx-file not specified");
1851 usage_exit(
"source and target must be specified");
1853 for(;i<argc-1;i++) {
1858 std::set< std::string > srcfiles =
ReadDirectory(std::string(argv[i-1]));
1860 if(srcfiles.size()>0) {
1862 for(std::set < std::string >::iterator fit=srcfiles.begin(); fit!=srcfiles.end(); fit++)
1870 usage_exit(
"sources must be *.flx-files: "+ *fit);
1897 usage_exit(
"source and destination must be specified");
1903 mTarget=std::string(argv[i++]);
1917 usage_exit(
"source and temp dir must be specified");
1923 mTarget=std::string(argv[i++]);
1929 usage_exit(
"target must be \".\" or \"./\"");
1931 if(curdir.size()!=0)