Mercurial > octave-nkf
comparison src/mkoctfile.in.cc @ 19895:19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Try to wrap long lines to < 80 characters.
Use GNU style and don't indent first brace of function definition.
"case" statement is aligned flush left with brace of switch stmt.
Remove trailing '\' line continuation from the end of #define macros.
Use 2 spaces for indent.
* files-dock-widget.cc, history-dock-widget.cc, main-window.cc, octave-cmd.cc,
octave-dock-widget.cc, octave-gui.cc, resource-manager.cc, settings-dialog.cc,
shortcut-manager.cc, welcome-wizard.cc, workspace-view.cc, cellfun.cc, data.cc,
debug.cc, debug.h, dirfns.cc, error.h, file-io.cc, gl-render.cc, gl-render.h,
gl2ps-renderer.h, graphics.cc, graphics.in.h, help.cc, input.cc, load-path.cc,
load-path.h, lookup.cc, lu.cc, oct-stream.cc, octave-default-image.h,
ordschur.cc, pr-output.cc, qz.cc, strfns.cc, symtab.cc, symtab.h, sysdep.cc,
variables.cc, zfstream.h, __fltk_uigetfile__.cc, __init_fltk__.cc,
__magick_read__.cc, __osmesa_print__.cc, audiodevinfo.cc, ov-classdef.cc,
ov-classdef.h, ov-fcn.h, ov-float.cc, ov-flt-complex.cc, ov-java.cc,
ov-range.cc, ov-re-mat.cc, ov-usr-fcn.h, ov.cc, op-int.h, options-usage.h,
pt-eval.cc, Array-C.cc, Array-fC.cc, Array.cc, Array.h, PermMatrix.cc,
Sparse.cc, chMatrix.h, dSparse.cc, dim-vector.h, bsxfun-decl.h, bsxfun-defs.cc,
oct-norm.cc, Sparse-op-defs.h, oct-inttypes.cc, oct-inttypes.h, main.in.cc,
mkoctfile.in.cc: Cleanup C++ code to follow Octave coding conventions.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 25 Feb 2015 11:55:49 -0800 |
parents | b59aabc08e63 |
children | 0fdba3fdf40e |
comparison
equal
deleted
inserted
replaced
19894:e8ccfc5d892b | 19895:19755f4fc851 |
---|---|
165 vars["RANLIB"] = get_variable ("RANLIB", %OCTAVE_CONF_MKOCTFILE_RANLIB%); | 165 vars["RANLIB"] = get_variable ("RANLIB", %OCTAVE_CONF_MKOCTFILE_RANLIB%); |
166 | 166 |
167 vars["DEPEND_FLAGS"] = get_variable ("DEPEND_FLAGS", | 167 vars["DEPEND_FLAGS"] = get_variable ("DEPEND_FLAGS", |
168 %OCTAVE_CONF_DEPEND_FLAGS%); | 168 %OCTAVE_CONF_DEPEND_FLAGS%); |
169 vars["DEPEND_EXTRA_SED_PATTERN"] = get_variable ("DEPEND_EXTRA_SED_PATTERN", | 169 vars["DEPEND_EXTRA_SED_PATTERN"] = get_variable ("DEPEND_EXTRA_SED_PATTERN", |
170 %OCTAVE_CONF_DEPEND_EXTRA_SED_PATTERN%); | 170 %OCTAVE_CONF_DEPEND_EXTRA_SED_PATTERN%); |
171 | 171 |
172 vars["DL_LD"] = get_variable ("DL_LD", %OCTAVE_CONF_MKOCTFILE_DL_LD%); | 172 vars["DL_LD"] = get_variable ("DL_LD", %OCTAVE_CONF_MKOCTFILE_DL_LD%); |
173 vars["DL_LDFLAGS"] = get_variable ("DL_LDFLAGS", | 173 vars["DL_LDFLAGS"] = get_variable ("DL_LDFLAGS", |
174 %OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS%); | 174 %OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS%); |
175 | 175 |
591 for (it = cfiles.begin (); it != cfiles.end (); ++it) | 591 for (it = cfiles.begin (); it != cfiles.end (); ++it) |
592 { | 592 { |
593 std::string f = *it, dfile = basename (f, true) + ".d", line; | 593 std::string f = *it, dfile = basename (f, true) + ".d", line; |
594 | 594 |
595 gnulib::unlink (dfile.c_str ()); | 595 gnulib::unlink (dfile.c_str ()); |
596 std::string cmd = vars["CC"] + " " + vars["DEPEND_FLAGS"] + " " | 596 std::string cmd = vars["CC"] + " " |
597 + vars["CPPFLAGS"] + " " + vars["ALL_CFLAGS"] + " " | 597 + vars["DEPEND_FLAGS"] + " " |
598 + incflags + " " + defs + " " + quote_path (f); | 598 + vars["CPPFLAGS"] + " " |
599 + vars["ALL_CFLAGS"] + " " | |
600 + incflags + " " + defs + " " + quote_path (f); | |
599 | 601 |
600 FILE *fd = popen (cmd.c_str (), "r"); | 602 FILE *fd = popen (cmd.c_str (), "r"); |
601 std::ofstream fo (dfile.c_str ()); | 603 std::ofstream fo (dfile.c_str ()); |
602 size_t pos; | 604 size_t pos; |
603 while (!feof (fd)) | 605 while (!feof (fd)) |
605 line = get_line (fd); | 607 line = get_line (fd); |
606 if ((pos = line.rfind (".o:")) != std::string::npos) | 608 if ((pos = line.rfind (".o:")) != std::string::npos) |
607 { | 609 { |
608 size_t spos = line.rfind ('/', pos); | 610 size_t spos = line.rfind ('/', pos); |
609 std::string ofile = | 611 std::string ofile = |
610 (spos == std::string::npos ? line.substr (0, pos+2) | 612 (spos == std::string::npos |
611 : line.substr (spos+1, pos-spos+1)); | 613 ? line.substr (0, pos+2) |
614 : line.substr (spos+1, pos-spos+1)); | |
612 fo << "pic/" << ofile << " " << ofile << " " | 615 fo << "pic/" << ofile << " " << ofile << " " |
613 << dfile << line.substr (pos) << std::endl; | 616 << dfile << line.substr (pos) << std::endl; |
614 } | 617 } |
615 else | 618 else |
616 fo << line << std::endl; | 619 fo << line << std::endl; |
622 for (it = ccfiles.begin (); it != ccfiles.end (); ++it) | 625 for (it = ccfiles.begin (); it != ccfiles.end (); ++it) |
623 { | 626 { |
624 std::string f = *it, dfile = basename (f, true) + ".d", line; | 627 std::string f = *it, dfile = basename (f, true) + ".d", line; |
625 | 628 |
626 gnulib::unlink (dfile.c_str ()); | 629 gnulib::unlink (dfile.c_str ()); |
627 std::string cmd = vars["CC"] + " " + vars["DEPEND_FLAGS"] + " " | 630 std::string cmd = vars["CC"] + " " |
628 + vars["CPPFLAGS"] + " " + vars["ALL_CXXFLAGS"] + " " | 631 + vars["DEPEND_FLAGS"] + " " |
629 + incflags + " " + defs + " " + quote_path (f); | 632 + vars["CPPFLAGS"] + " " |
633 + vars["ALL_CXXFLAGS"] + " " | |
634 + incflags + " " + defs + " " + quote_path (f); | |
630 | 635 |
631 FILE *fd = popen (cmd.c_str (), "r"); | 636 FILE *fd = popen (cmd.c_str (), "r"); |
632 std::ofstream fo (dfile.c_str ()); | 637 std::ofstream fo (dfile.c_str ()); |
633 size_t pos; | 638 size_t pos; |
634 while (!feof (fd)) | 639 while (!feof (fd)) |
636 line = get_line (fd); | 641 line = get_line (fd); |
637 if ((pos = line.rfind (".o:")) != std::string::npos) | 642 if ((pos = line.rfind (".o:")) != std::string::npos) |
638 { | 643 { |
639 size_t spos = line.rfind ('/', pos); | 644 size_t spos = line.rfind ('/', pos); |
640 std::string ofile = | 645 std::string ofile = |
641 (spos == std::string::npos ? line.substr (0, pos+2) | 646 (spos == std::string::npos |
642 : line.substr (spos+1, pos-spos+1)); | 647 ? line.substr (0, pos+2) |
648 : line.substr (spos+1, pos-spos+1)); | |
643 fo << "pic/" << ofile << " " << ofile << " " | 649 fo << "pic/" << ofile << " " << ofile << " " |
644 << dfile << line.substr (pos+2) << std::endl; | 650 << dfile << line.substr (pos+2) << std::endl; |
645 } | 651 } |
646 else | 652 else |
647 fo << line << std::endl; | 653 fo << line << std::endl; |
667 o = outputfile; | 673 o = outputfile; |
668 } | 674 } |
669 else | 675 else |
670 o = b + ".o"; | 676 o = b + ".o"; |
671 objfiles += (" " + o); | 677 objfiles += (" " + o); |
672 std::string cmd = vars["F77"] + " -c " + vars["FPICFLAG"] + " " | 678 std::string cmd = vars["F77"] + " -c " |
673 + vars["ALL_FFLAGS"] + " " + incflags + " " + defs + " " | 679 + vars["FPICFLAG"] + " " |
674 + pass_on_options + " " + f + " -o " + o; | 680 + vars["ALL_FFLAGS"] + " " |
681 + incflags + " " + defs + " " + pass_on_options | |
682 + " " + f + " -o " + o; | |
675 result = run_command (cmd); | 683 result = run_command (cmd); |
676 } | 684 } |
677 else | 685 else |
678 { | 686 { |
679 std::cerr << "mkoctfile: no way to compile Fortran file " << f | 687 std::cerr << "mkoctfile: no way to compile Fortran file " << f |
696 o = outputfile; | 704 o = outputfile; |
697 } | 705 } |
698 else | 706 else |
699 o = b + ".o"; | 707 o = b + ".o"; |
700 objfiles += (" " + o); | 708 objfiles += (" " + o); |
701 std::string cmd = vars["CC"] + " -c " + vars["CPPFLAGS"] + " " | 709 std::string cmd = vars["CC"] + " -c " |
702 + vars["CPICFLAG"] + " " + vars["ALL_CFLAGS"] + " " | 710 + vars["CPPFLAGS"] + " " |
703 + pass_on_options + " " + incflags + " " + defs + " " | 711 + vars["CPICFLAG"] + " " + vars["ALL_CFLAGS"] + " " |
704 + quote_path (f) + " -o " + quote_path (o); | 712 + pass_on_options + " " |
713 + incflags + " " + defs + " " | |
714 + quote_path (f) + " -o " + quote_path (o); | |
705 result = run_command (cmd); | 715 result = run_command (cmd); |
706 } | 716 } |
707 else | 717 else |
708 { | 718 { |
709 std::cerr << "mkoctfile: no way to compile C file " << f | 719 std::cerr << "mkoctfile: no way to compile C file " << f |
726 o = outputfile; | 736 o = outputfile; |
727 } | 737 } |
728 else | 738 else |
729 o = b + ".o"; | 739 o = b + ".o"; |
730 objfiles += (" " + o); | 740 objfiles += (" " + o); |
731 std::string cmd = vars["CXX"] + " -c " + vars["CPPFLAGS"] + " " | 741 std::string cmd = vars["CXX"] + " -c " |
732 + vars["CXXPICFLAG"] + " " + vars["ALL_CXXFLAGS"] + " " | 742 + vars["CPPFLAGS"] + " " |
733 + pass_on_options + " " + incflags + " " + defs + " " | 743 + vars["CXXPICFLAG"] + " " |
734 + quote_path (f) + " -o " + quote_path (o); | 744 + vars["ALL_CXXFLAGS"] + " " |
745 + pass_on_options + " " | |
746 + incflags + " " + defs + " " | |
747 + quote_path (f) + " -o " + quote_path (o); | |
735 result = run_command (cmd); | 748 result = run_command (cmd); |
736 } | 749 } |
737 else | 750 else |
738 { | 751 { |
739 std::cerr << "mkoctfile: no way to compile C++ file " << f | 752 std::cerr << "mkoctfile: no way to compile C++ file " << f |
746 { | 759 { |
747 if (link_stand_alone) | 760 if (link_stand_alone) |
748 { | 761 { |
749 if (!vars["LD_CXX"].empty ()) | 762 if (!vars["LD_CXX"].empty ()) |
750 { | 763 { |
751 std::string cmd = vars["LD_CXX"] + " " + vars["CPPFLAGS"] + " " | 764 std::string cmd = vars["LD_CXX"] + " " |
752 + vars["ALL_CXXFLAGS"] + " " + vars["RDYNAMIC_FLAG"] | 765 + vars["CPPFLAGS"] + " " |
753 + " " + vars["ALL_LDFLAGS"] + " " | 766 + vars["ALL_CXXFLAGS"] + " " |
754 + pass_on_options + " " + output_option + " " | 767 + vars["RDYNAMIC_FLAG"] + " " |
755 + objfiles + " " + libfiles + " " | 768 + vars["ALL_LDFLAGS"] + " " |
756 + ldflags + " " + vars["LFLAGS"] | 769 + pass_on_options + " " + output_option + " " |
757 + " -loctinterp -loctave " | 770 + objfiles + " " + libfiles + " " |
758 + " " + vars["OCTAVE_LINK_OPTS"] | 771 + ldflags + " " + vars["LFLAGS"] |
759 + " " + vars["OCTAVE_LINK_DEPS"]; | 772 + " -loctinterp -loctave " |
773 + " " + vars["OCTAVE_LINK_OPTS"] | |
774 + " " + vars["OCTAVE_LINK_DEPS"]; | |
760 result = run_command (cmd); | 775 result = run_command (cmd); |
761 } | 776 } |
762 else | 777 else |
763 { | 778 { |
764 std::cerr | 779 std::cerr |
767 return 1; | 782 return 1; |
768 } | 783 } |
769 } | 784 } |
770 else | 785 else |
771 { | 786 { |
772 std::string cmd = vars["DL_LD"] + " " + vars["DL_LDFLAGS"] + " " | 787 std::string cmd = vars["DL_LD"] + " " |
773 + pass_on_options + " -o " + octfile + " " | 788 + vars["DL_LDFLAGS"] + " " |
774 + objfiles + " " + libfiles + " " + ldflags + " " | 789 + pass_on_options |
775 + vars["LFLAGS"] + " -loctinterp -loctave " | 790 + " -o " + octfile + " " |
776 + vars["OCT_LINK_OPTS"] + " " + vars["OCT_LINK_DEPS"]; | 791 + objfiles + " " + libfiles + " " |
792 + ldflags + " " | |
793 + vars["LFLAGS"] + " -loctinterp -loctave " | |
794 + vars["OCT_LINK_OPTS"] + " " | |
795 + vars["OCT_LINK_DEPS"]; | |
777 result = run_command (cmd); | 796 result = run_command (cmd); |
778 } | 797 } |
779 | 798 |
780 if (strip) | 799 if (strip) |
781 { | 800 { |