From: admin Date: Thu, 30 Oct 2008 10:09:01 +0000 (+0000) Subject: This commit was generated by cvs2git to create branch 'BR_V5_IMP_P8'. X-Git-Tag: Phase8_Part1_16122008 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=986635c35e49d753648835895448260983fc6547;p=modules%2Fkernel.git This commit was generated by cvs2git to create branch 'BR_V5_IMP_P8'. Sprout from BR_V5_DEV 2008-10-30 10:09:00 UTC vsr 'Fix problem with 'make distcheck' step' Cherrypick from master 2008-03-07 07:43:41 UTC jfa 'Join modifications from BR_Dev_For_4_0 tag V4_1_1.': bin/runIDLparser.in resources/DEPRECATED/Plugin.in salome_adm/unix/Doxyfile salome_adm/unix/F77config.h.in salome_adm/unix/config_files/ac_cc_warnings.m4 salome_adm/unix/config_files/check_Salome.m4 salome_adm/unix/config_files/check_java.m4 salome_adm/unix/sstream.in src/Communication/Receiver.cxx src/Communication/libSALOME_Comm.i src/Launcher/BatchLight_BatchManager.cxx src/Launcher/BatchLight_BatchManager.hxx src/Launcher/BatchLight_BatchManager_PBS.cxx src/Launcher/BatchLight_BatchManager_PBS.hxx src/Launcher/BatchLight_BatchManager_SLURM.cxx src/Launcher/BatchLight_BatchManager_SLURM.hxx src/Launcher/BatchLight_Job.cxx src/Launcher/BatchLight_Job.hxx src/Launcher/MpiImpl.cxx src/Launcher/MpiImpl.hxx src/ModuleCatalog/SALOME_TestModuleCatalog.py src/SALOMEDS/README_attributes src/SALOMEDS/SALOMEDS_AttLong_i.cxx src/SALOMEDS/SALOMEDS_AttLong_i.hxx src/SALOMEDS/SALOMEDS_AttReal_i.cxx src/SALOMEDS/SALOMEDS_AttReal_i.hxx src/SALOMEDS/SALOMEDS_BasicAttributeFactory.cxx src/SALOMEDS/SALOMEDS_BasicAttributeFactory.hxx src/SALOMEDS/SALOMEDS_BasicAttribute_i.cxx src/SALOMEDS/SALOMEDS_BasicAttribute_i.hxx src/Utils/SalomeString.hxx src/Utils/Utils_SignalsHandler.h Cherrypick from IMPORT 2003-05-16 10:27:43 UTC admin 'Initialisation de la base KERNEL avec la version operationnelle de KERNEL_SRC issue de SalomePro1.1a.': resources/Tools_en.xml resources/Tools_fr.xml resources/config --- diff --git a/bin/runIDLparser.in b/bin/runIDLparser.in new file mode 100644 index 000000000..cb41a7488 --- /dev/null +++ b/bin/runIDLparser.in @@ -0,0 +1,37 @@ +#! /bin/sh + +# print the help message ==================================== + +# test $@="-h" -o -z $@ + +hh=0 + +if test "$#" = "0";then + hh=1 +else + for a in $@; do + if test "$a" = "-h"; then + hh=1 + fi + done +fi + +if test "$hh" = "1" ; then + echo "" + echo "Usage : " + echo "" + echo " to run IDLparser:" + echo "" + echo " $0 -Wbcatalog=[,icon=][,version=][,author=][,name=][,multistudy=][,remove=component_name] " + echo "" + echo " to have omniidl help:" + echo "" + echo " $0 -u " + echo "" + exit 1 +fi +#============================================================ + +# omiidl ==================================================== +omniidl -bIDLparser -I ${KERNEL_ROOT_DIR}/idl/salome $@ +#============================================================ diff --git a/resources/DEPRECATED/Plugin.in b/resources/DEPRECATED/Plugin.in new file mode 100755 index 000000000..3d4fad5e5 --- /dev/null +++ b/resources/DEPRECATED/Plugin.in @@ -0,0 +1,10 @@ +! Description of available plugins +! ******************************** +! +a148e300-5740-11d1-a904-080036aaa103.Location: FWOSPlugin +! +! standard attribute drivers plugin +! +ad696000-5b34-11d1-b5ba-00a0c9064368.Location: @CAS_STDPLUGIN@ +ad696001-5b34-11d1-b5ba-00a0c9064368.Location: @CAS_STDPLUGIN@ +ad696002-5b34-11d1-b5ba-00a0c9064368.Location: @CAS_STDPLUGIN@ diff --git a/resources/Tools_en.xml b/resources/Tools_en.xml new file mode 100644 index 000000000..7457ddc90 --- /dev/null +++ b/resources/Tools_en.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + diff --git a/resources/Tools_fr.xml b/resources/Tools_fr.xml new file mode 100644 index 000000000..7457ddc90 --- /dev/null +++ b/resources/Tools_fr.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + diff --git a/resources/config b/resources/config new file mode 100644 index 000000000..692539760 --- /dev/null +++ b/resources/config @@ -0,0 +1 @@ +language=en \ No newline at end of file diff --git a/salome_adm/unix/Doxyfile b/salome_adm/unix/Doxyfile new file mode 100644 index 000000000..df82af032 --- /dev/null +++ b/salome_adm/unix/Doxyfile @@ -0,0 +1,829 @@ +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +# + +# Doxyfile 1.2.8.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# General configuration options +#--------------------------------------------------------------------------- + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Brazilian, Chinese, Croatian, Czech, Danish, Dutch, Finnish, French, +# German, Hungarian, Italian, Japanese, Korean, Norwegian, Polish, +# Portuguese, Romanian, Russian, Slovak, Slovene, Spanish and Swedish. + +OUTPUT_LANGUAGE = English + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these class will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = NO + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. It is allowed to use relative paths in the argument list. + +STRIP_FROM_PATH = + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a class diagram (in Html and LaTeX) for classes with base or +# super classes. Setting the tag to NO turns the diagrams off. + +CLASS_DIAGRAMS = YES + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = YES + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower case letters. If set to YES upper case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# users are adviced to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like the Qt-style comments (thus requiring an +# explict @brief command for a brief description. + +JAVADOC_AUTOBRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# reimplements. + +INHERIT_DOCS = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consist of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. +# For instance some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. + +WARN_FORMAT = + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = /home01/prascle/devSalome/rootsrc + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +FILE_PATTERNS = *idl *.cxx *.hxx *.hh *.h *.c *.cc *.py + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. + +EXCLUDE_PATTERNS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. + +INPUT_FILTER = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse. + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = /home01/prascle/devSalome/doc/html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the Html help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript and frames is required (for instance Netscape 4.0+ +# or Internet explorer 4.0+). + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = YES + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = /home01/prascle/devSalome/doc/latex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimised for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assigments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_PREDEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES tag can be used to specify one or more tagfiles. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. + +DOT_PATH = + +# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_WIDTH = 1024 + +# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_HEIGHT = 1024 + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermedate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO + +# The CGI_NAME tag should be the name of the CGI script that +# starts the search engine (doxysearch) with the correct parameters. +# A script with this name will be generated by doxygen. + +CGI_NAME = + +# The CGI_URL tag should be the absolute URL to the directory where the +# cgi binaries are located. See the documentation of your http daemon for +# details. + +CGI_URL = + +# The DOC_URL tag should be the absolute URL to the directory where the +# documentation is located. If left blank the absolute path to the +# documentation, with file:// prepended to it, will be used. + +DOC_URL = + +# The DOC_ABSPATH tag should be the absolute path to the directory where the +# documentation is located. If left blank the directory on the local machine +# will be used. + +DOC_ABSPATH = + +# The BIN_ABSPATH tag must point to the directory where the doxysearch binary +# is installed. + +BIN_ABSPATH = + +# The EXT_DOC_PATHS tag can be used to specify one or more paths to +# documentation generated for other projects. This allows doxysearch to search +# the documentation for these projects as well. + +EXT_DOC_PATHS = diff --git a/salome_adm/unix/F77config.h.in b/salome_adm/unix/F77config.h.in new file mode 100644 index 000000000..670ac5756 --- /dev/null +++ b/salome_adm/unix/F77config.h.in @@ -0,0 +1,29 @@ +/*---------------------------------------------------------------------------------- + Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, + CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +------------------------------------------------------------------------------------*/ + + +#ifndef F77_FUNC + +#define F77_FUNC(name,NAME) @F77_FUNC_NAME@ +#define F77_FUNC_(name,NAME) @F77_FUNC_NAME_@ + +#endif + diff --git a/salome_adm/unix/config_files/ac_cc_warnings.m4 b/salome_adm/unix/config_files/ac_cc_warnings.m4 new file mode 100644 index 000000000..9f3aa1a7f --- /dev/null +++ b/salome_adm/unix/config_files/ac_cc_warnings.m4 @@ -0,0 +1,119 @@ +dnl Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +dnl +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License. +dnl +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +dnl +dnl See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +dnl +dnl +dnl +dnl Synopsis : AC_CC_WARNINGS([ANSI]) +dnl +dnl Version : 1.1 (2000/12/31) +dnl +dnl Author : Ville Laurikari +dnl +dnl Description : +dnl +dnl Enables a reasonable set of warnings for the C compiler. +dnl Optionally, if the first argument is nonempty, turns on +dnl flags which enforce and/or enable proper ANSI C if such +dnl flags are known to the compiler used. +dnl +dnl Currently this macro knows about GCC, Solaris C compiler, +dnl Digital Unix C compiler, C for AIX Compiler, HP-UX C +dnl compiler, and IRIX C compiler. + +AC_DEFUN([AC_CC_WARNINGS], [ + ansi=$1 + if test -z "$ansi"; then + msg="for C compiler warning flags" + else + msg="for C compiler warning and ANSI conformance flags" + fi + AC_CACHE_CHECK($msg, ac_cv_prog_cc_warnings, [ + if test -n "$CC"; then + cat > conftest.c <&1 | grep "Xc.*strict ANSI C" > /dev/null 2>&1 && + $CC -c -v -Xc conftest.c > /dev/null 2>&1 && + test -f conftest.o; then + if test -z "$ansi"; then + ac_cv_prog_cc_warnings="-v" + else + ac_cv_prog_cc_warnings="-v -Xc" + fi + + dnl HP-UX C compiler + elif $CC > /dev/null 2>&1 && + $CC -c -Aa +w1 conftest.c > /dev/null 2>&1 && + test -f conftest.o; then + if test -z "$ansi"; then + ac_cv_prog_cc_warnings="+w1" + else + ac_cv_prog_cc_warnings="+w1 -Aa" + fi + + dnl Digital Unix C compiler + elif ! $CC > /dev/null 2>&1 && + $CC -c -verbose -w0 -warnprotos -std1 conftest.c > /dev/null 2>&1 && + test -f conftest.o; then + if test -z "$ansi"; then + ac_cv_prog_cc_warnings="-verbose -w0 -warnprotos" + else + ac_cv_prog_cc_warnings="-verbose -w0 -warnprotos -std1" + fi + + dnl C for AIX Compiler + elif $CC > /dev/null 2>&1 | grep AIX > /dev/null 2>&1 && + $CC -c -qlanglvl=ansi -qinfo=all conftest.c > /dev/null 2>&1 && + test -f conftest.o; then + if test -z "$ansi"; then + ac_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" + else + ac_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd -qlanglvl=ansi" + fi + + dnl IRIX C compiler + elif $CC -fullwarn -ansi -ansiE > /dev/null 2>&1 && + test -f conftest.o; then + if test -z "$ansi"; then + ac_cv_prog_cc_warnings="-fullwarn" + else + ac_cv_prog_cc_warnings="-fullwarn -ansi -ansiE" + fi + + fi + rm -f conftest.* + fi + if test -n "$ac_cv_prog_cc_warnings"; then + CFLAGS="$CFLAGS $ac_cv_prog_cc_warnings" + CXXFLAGS="$CXXFLAGS $ac_cv_prog_cc_warnings" + else + ac_cv_prog_cc_warnings="unknown" + fi + ]) +]) diff --git a/salome_adm/unix/config_files/check_Salome.m4 b/salome_adm/unix/config_files/check_Salome.m4 new file mode 100644 index 000000000..ff12fd6c3 --- /dev/null +++ b/salome_adm/unix/config_files/check_Salome.m4 @@ -0,0 +1,78 @@ +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +#------------------------------------------------------------ +# Check availability of Salome binary distribution +# +# Author : Marc Tajchman (CEA, 2002) +#------------------------------------------------------------ + +AC_DEFUN([CHECK_SALOME],[ + +AC_CHECKING(for Salome) + +Salome_ok=no + +AC_ARG_WITH(salome, + --with-salome=DIR root directory path of SALOME installation, + SALOME_DIR="$withval",SALOME_DIR="") + +if test "x$SALOME_DIR" == "x" ; then + +# no --with-salome-dir option used + + if test "x$SALOME_ROOT_DIR" != "x" ; then + + # SALOME_ROOT_DIR environment variable defined + SALOME_DIR=$SALOME_ROOT_DIR + + else + + # search Salome binaries in PATH variable + AC_PATH_PROG(TEMP, libMEDMEM_Swig.py) + if test "x$TEMP" != "x" ; then + SALOME_BIN_DIR=`dirname $TEMP` + SALOME_DIR=`dirname $SALOME_BIN_DIR` + fi + + fi +# +fi + +if test -f ${SALOME_DIR}/bin/libMEDMEM_Swig.py ; then + Salome_ok=yes + AC_MSG_RESULT(Using Salome distribution in ${SALOME_DIR}) + + if test "x$SALOME_ROOT_DIR" == "x" ; then + SALOME_ROOT_DIR=${SALOME_DIR} + fi + if test "x$SALOME_SITE_DIR" == "x" ; then + SALOME_SITE_DIR=${SALOME_ROOT_DIR} + fi + AC_SUBST(SALOME_ROOT_DIR) + AC_SUBST(SALOME_SITE_DIR) + +else + AC_MSG_WARN("Cannot find compiled Salome distribution") +fi + +AC_MSG_RESULT(for Salome: $Salome_ok) + +])dnl + diff --git a/salome_adm/unix/config_files/check_java.m4 b/salome_adm/unix/config_files/check_java.m4 new file mode 100644 index 000000000..c03e9f7ff --- /dev/null +++ b/salome_adm/unix/config_files/check_java.m4 @@ -0,0 +1,111 @@ +dnl Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +dnl +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License. +dnl +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +dnl +dnl See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +dnl +dnl +dnl +AC_DEFUN([CHECK_JAVA],[ +dnl AC_REQUIRE([AC_CANONICAL_SYSTEM])dnl +dnl AC_REQUIRE([AC_PROG_CPP])dnl + +AC_CHECKING(for JAVA) + +JAVA_INCLUDES="" +JAVA_LIBS="" +JAVA_LDPATH="" + +java_ok=no + +if test -z $JAVAHOME +then + AC_MSG_WARN(define JAVAHOME variable to use Java) +else + java_ok=yes +fi + +if test "x$java_ok" = "xyes" +then + AC_EXEEXT + AC_CHECK_PROG(JAVA, java$EXEEXT,found) + if test "x$JAVA" = "x" + then + java_ok=no + fi + + AC_CHECK_PROG(JAVAC, javac$EXEEXT,found) + if test "x$JAVAC" = "x" + then + java_ok=no + fi +fi + +if test "x$java_ok" = "xyes" +then + version=`$JAVA -version 2>&1 | grep "java version"` + case "$version" in + *1.1.*) + AC_MSG_RESULT(using jdk1.1 version - jdk1.4 required) + java_ok=no;; + *1.2*) + AC_MSG_RESULT(using jdk1.2 version - jdk1.4 required) + java_ok=no;; + *1.3*) + AC_MSG_RESULT(using jdk1.3 version - jdk1.4 required) + java_ok=no;; + *1.4*) + AC_MSG_RESULT(using jdk1.4 version) ;; + esac +fi + +if test "x$java_ok" = "xyes" +then +dnl java headers + LOCAL_INCLUDES=" -I${JAVAHOME}/include -I${JAVAHOME}/include/linux" + CPPFLAGS_old="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $LOCAL_INCLUDES" + AC_CHECK_HEADER(jni.h,java_ok=yes ,java_ok=no) + + CPPFLAGS="$CPPFLAGS_old" +fi + +if test "x$java_ok" = "xyes" +then +dnl libjava library + LOCAL_LIBS="-L${JAVAHOME}/jre/lib/i386 -ljava -L${JAVAHOME}/jre/lib/i386/client -ljvm -lverify" + LIBS_old="$LIBS" + LIBS="$LIBS $LOCAL_LIBS" + + AC_CHECK_LIB(jvm,JNI_CreateJavaVM,java_ok=yes,java_ok=no) + + LIBS="$LIBS_old" +fi + +if test "x$java_ok" = "xyes" +then + JAVA_INCLUDES="$LOCAL_INCLUDES" + JAVA_LIBS="$LOCAL_LIBS" +fi + +AC_SUBST(JAVA_INCLUDES) +AC_SUBST(JAVA_LIBS) +AC_SUBST(JAVA_LDPATH) + +AC_MSG_RESULT(for java: $java_ok) + +])dnl +dnl diff --git a/salome_adm/unix/sstream.in b/salome_adm/unix/sstream.in new file mode 100644 index 000000000..323bbed45 --- /dev/null +++ b/salome_adm/unix/sstream.in @@ -0,0 +1,225 @@ +/* This is part of libio/iostream, providing -*- C++ -*- input/output. +Copyright (C) 2000 Free Software Foundation + +This file is part of the GNU IO Library. This library is free +software; you can redistribute it and/or modify it under the +terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) +any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this library; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +As a special exception, if you link this library with files +compiled with a GNU compiler to produce an executable, this does not cause +the resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why +the executable file might be covered by the GNU General Public License. */ + +/* Written by Magnus Fromreide (magfr@lysator.liu.se). */ + +#ifndef __SSTREAM__ +#define __SSTREAM__ + +#include +#include +#include + +namespace std +{ + class stringbuf : public streambuf + { + public: + typedef char char_type; + typedef int int_type; + typedef streampos pos_type; + typedef streamoff off_type; + + explicit stringbuf(int which=ios::in|ios::out) : + streambuf(which), buf(), mode(static_cast(which)), + rpos(0), bufsize(1) + { } + + explicit stringbuf(const std::string &s, int which=ios::in|ios::out) : + streambuf(which), buf(s), mode(static_cast(which)), + bufsize(1) + { + if(mode & ios::in) + { + setg(&defbuf, &defbuf + bufsize, &defbuf + bufsize); + } + if(mode & ios::out) + { + setp(&defbuf, &defbuf + bufsize); + } + rpos = (mode & ios::ate ? s.size() : 0); + } + + std::string str() const + { + const_cast(this)->sync(); // Sigh, really ugly hack + return buf; + }; + + void str(const std::string& s) + { + buf = s; + if(mode & ios::in) + { + gbump(egptr() - gptr()); + } + if(mode & ios::out) + { + pbump(pbase() - pptr()); + } + rpos = (mode & ios::ate ? s.size() : 0); + } + + protected: + inline virtual int sync(); + inline virtual int overflow(int = EOF); + inline virtual int underflow(); + private: + std::string buf; + ios::open_mode mode; + std::string::size_type rpos; + streamsize bufsize; + char defbuf; + }; + + class stringstreambase : virtual public ios { + protected: + stringbuf __my_sb; + public: + std::string str() const + { + return dynamic_cast(_strbuf)->str(); + } + void str(const std::string& s) + { + clear(); + dynamic_cast(_strbuf)->str(s); + } + + stringbuf* rdbuf() + { + return &__my_sb; + } + protected: + stringstreambase(int which) : + __my_sb(which) + { + init (&__my_sb); + } + + stringstreambase(const std::string& s, int which) : + __my_sb(s, which) + { + init (&__my_sb); + } + }; + + class istringstream : public stringstreambase, public istream { + public: + istringstream(int which=ios::in) : + stringstreambase(which) + { } + + istringstream(const std::string& s, int which=ios::in) : + stringstreambase(s, which) + { } + }; + + class ostringstream : public stringstreambase, public ostream { + public: + ostringstream(int which=ios::out) : + stringstreambase(which) + { } + + ostringstream(const std::string& s, int which=ios::out) : + stringstreambase(s, which) + { } + }; + + class stringstream : public stringstreambase, public iostream { + public: + stringstream(int which=ios::in|ios::out) : + stringstreambase(which) + { } + + stringstream(const std::string &s, int which=ios::in|ios::out) : + stringstreambase(s, which) + { } + }; +} + +inline int std::stringbuf::sync() +{ + if((mode & ios::out) == 0) + return EOF; + + streamsize n = pptr() - pbase(); + if(n) + { + buf.replace(rpos, std::string::npos, pbase(), n); + if(buf.size() - rpos != n) + return EOF; + rpos += n; + pbump(-n); + gbump(egptr() - gptr()); + } + return 0; +} + +inline int std::stringbuf::overflow(int ch) +{ + if((mode & ios::out) == 0) + return EOF; + + streamsize n = pptr() - pbase(); + + if(n && sync()) + return EOF; + + if(ch != EOF) + { + std::string::size_type oldSize = buf.size(); + + buf.replace(rpos, std::string::npos, ch); + if(buf.size() - oldSize != 1) + return EOF; + ++rpos; + } + return 0; +} + +inline int std::stringbuf::underflow() +{ + sync(); + if((mode & ios::in) == 0) + { + return EOF; + } + if(rpos >= buf.size()) + { + return EOF; + } + + std::string::size_type n = egptr() - eback(); + std::string::size_type s; + + s = buf.copy(eback(), n, rpos); + pbump(pbase() - pptr()); + gbump(eback() - gptr()); + int res = (0377 & buf[rpos]); + rpos += s; + return res; +} + +#endif /* not __STRSTREAM__ */ diff --git a/src/Communication/libSALOME_Comm.i b/src/Communication/libSALOME_Comm.i new file mode 100644 index 000000000..9a507209c --- /dev/null +++ b/src/Communication/libSALOME_Comm.i @@ -0,0 +1,136 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +%{ + #include "ReceiverFactory.hxx" + #include "SALOME_Comm_i.hxx" +%} + +%typemap(python,in) SALOME::SenderDouble_ptr +{ + PyObject* pdict = PyDict_New(); + PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins()); + PyRun_String("import CORBA", Py_single_input, pdict, pdict); + + PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input, + pdict, pdict); + + PyObject* orb = PyDict_GetItemString(pdict, "o"); + + // Ask omniORBpy to transform SUPPORT (python Corba) ptr to IOR string + + PyObject* iorSupport = PyObject_CallMethod(orb, "object_to_string", "O", $input); + + if (iorSupport == Py_None) + return NULL; + char * s = PyString_AsString(PyObject_Str(iorSupport)); + + // Ask omniORB to convert IOR string to SALOME::SenderDouble_ptr + + int argc = 0; + char *xargv = ""; + char **argv = &xargv; + CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv); + CORBA::Object_var O = ORB->string_to_object(s); + SALOME::SenderDouble_ptr t = SALOME::SenderDouble::_narrow(O); + $1 = t; +} + +%typemap(python,in) SALOME::SenderInt_ptr +{ + PyObject* pdict = PyDict_New(); + PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins()); + PyRun_String("import CORBA", Py_single_input, pdict, pdict); + + PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input, + pdict, pdict); + + PyObject* orb = PyDict_GetItemString(pdict, "o"); + + // Ask omniORBpy to transform SUPPORT (python Corba) ptr to IOR string + + PyObject* iorSupport = PyObject_CallMethod(orb, "object_to_string", "O", $input); + + if (iorSupport == Py_None) + return NULL; + char * s = PyString_AsString(PyObject_Str(iorSupport)); + + // Ask omniORB to convert IOR string to SALOME::SenderInt_ptr + + int argc = 0; + char *xargv = ""; + char **argv = &xargv; + CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv); + CORBA::Object_var O = ORB->string_to_object(s); + SALOME::SenderInt_ptr t = SALOME::SenderInt::_narrow(O); + $1 = t; +} + +PyObject * getValueForSenderDouble(SALOME::SenderDouble_ptr senderDouble); + +%{ +PyObject * getValueForSenderDouble(SALOME::SenderDouble_ptr senderDouble) +{ + PyObject *py_list; + long size; + double *ret=ReceiverFactory::getValue(senderDouble,size); + py_list = PyList_New(size); + for (int i=0; i < size; i++) + { + int err = PyList_SetItem(py_list, i, Py_BuildValue("d", (double) ret[i])); + if(err) + { + char * message = "Error in SUPPORT::getTypes"; + PyErr_SetString(PyExc_RuntimeError, message); + return NULL; + } + } + PyObject * result = Py_BuildValue("O", py_list); + delete [] ret; + Py_DECREF(py_list); + return result; +} +%} + + +PyObject * getValueForSenderInt(SALOME::SenderInt_ptr senderInt); + +%{ +PyObject * getValueForSenderInt(SALOME::SenderInt_ptr senderInt) +{ + PyObject *py_list; + long size; + int *ret=ReceiverFactory::getValue(senderInt,size); + py_list = PyList_New(size); + for (int i=0; i < size; i++) + { + int err = PyList_SetItem(py_list, i, Py_BuildValue("i", (int) ret[i])); + if(err) + { + char * message = "Error in SUPPORT::getTypes"; + PyErr_SetString(PyExc_RuntimeError, message); + return NULL; + } + } + PyObject * result = Py_BuildValue("O", py_list); + delete [] ret; + Py_DECREF(py_list); + return result; +} +%} diff --git a/src/Launcher/BatchLight_BatchManager.cxx b/src/Launcher/BatchLight_BatchManager.cxx new file mode 100644 index 000000000..37def271e --- /dev/null +++ b/src/Launcher/BatchLight_BatchManager.cxx @@ -0,0 +1,296 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +/* + * BatchManager.cxx : + * + * Auteur : Bernard SECHER - CEA/DEN + * Date : Juillet 2007 + * Projet : SALOME + * + */ + +#include +#include +#include +#include +#include "BatchLight_Job.hxx" +#include "BatchLight_BatchManager.hxx" +#include "Batch_Date.hxx" +using namespace std; + +namespace BatchLight { + + // Constructeur + BatchManager::BatchManager(const batchParams& p) throw(SALOME_Exception) : _params(p) + { + SCRUTE(_params.hostname); + SCRUTE(_params.protocol); + SCRUTE(_params.username); + // On verifie que le hostname est correct + if (!gethostbyname(_params.hostname.c_str())) { // hostname unknown from network + string msg = "hostname \""; + msg += _params.hostname; + msg += "\" unknown from the network"; + throw SALOME_Exception(msg.c_str()); + } + _mpiImpl = NULL; + } + + // Destructeur + BatchManager::~BatchManager() + { + MESSAGE("BatchManager destructor "<<_params.hostname); + std::map < int, const BatchLight::Job * >::const_iterator it; + for(it=_jobmap.begin();it!=_jobmap.end();it++) + delete it->second; + if(_mpiImpl) delete _mpiImpl; + } + + // Methode pour le controle des jobs : soumet un job au gestionnaire + const int BatchManager::submitJob(Job* job) + { + BEGIN_OF("BatchManager::submitJob"); + int id; + + // temporary directory on cluster to put input files for job + setDirForTmpFiles(job); + + // export input files on cluster + exportInputFiles(job); + + // build salome coupling script for job + buildSalomeCouplingScript(job); + + // build batch script for job + buildSalomeBatchScript(job); + + // submit job on cluster + id = submit(job); + + // register job on map + _jobmap[id] = job; + END_OF("BatchManager::submitJob"); + return id; + } + + void BatchManager::setDirForTmpFiles(BatchLight::Job* job) + { + std::string dirForTmpFiles; + std::string thedate; + + // Adding date to the directory name + Batch::Date date = Batch::Date(time(0)); + thedate = date.str(); + int lend = thedate.size() ; + int i = 0 ; + while ( i < lend ) { + if ( thedate[i] == '/' || thedate[i] == '-' || thedate[i] == ':' ) { + thedate[i] = '_' ; + } + i++ ; + } + + dirForTmpFiles += string("Batch/"); + dirForTmpFiles += thedate ; + job->setDirForTmpFiles(dirForTmpFiles); + } + + void BatchManager::exportInputFiles(BatchLight::Job* job) throw(SALOME_Exception) + { + BEGIN_OF("BatchManager::exportInFiles"); + int status; + const char * fileToExecute = job->getFileToExecute(); + const Engines::FilesList filesToExportList = job->getFilesToExportList(); + const std::string dirForTmpFiles = job->getDirForTmpFiles(); + std::string command; + std::string copy_command; + + // Test protocol + if( _params.protocol == "rsh" ) + copy_command = "rcp "; + else if( _params.protocol == "ssh" ) + copy_command = "scp "; + else + throw SALOME_Exception("Unknown protocol : only rsh and ssh are known !"); + + // First step : creating batch tmp files directory + command = _params.protocol; + command += " "; + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + command += _params.hostname; + command += " \"mkdir -p "; + command += dirForTmpFiles; + command += "\"" ; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status) { + std::ostringstream oss; + oss << status; + std::string ex_mess("Error of connection on remote host ! status = "); + ex_mess += oss.str(); + throw SALOME_Exception(ex_mess.c_str()); + } + + // Second step : copy fileToExecute into + // batch tmp files directory + command = copy_command; + command += fileToExecute; + command += " "; + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + command += _params.hostname; + command += ":"; + command += dirForTmpFiles; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status) { + std::ostringstream oss; + oss << status; + std::string ex_mess("Error of connection on remote host ! status = "); + ex_mess += oss.str(); + throw SALOME_Exception(ex_mess.c_str()); + } + + // Third step : copy filesToExportList into + // batch tmp files directory + for (int i = 0 ; i < filesToExportList.length() ; i++ ) { + command = copy_command; + command += filesToExportList[i] ; + command += " "; + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + command += _params.hostname; + command += ":"; + command += dirForTmpFiles ; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status) { + std::ostringstream oss; + oss << status; + std::string ex_mess("Error of connection on remote host ! status = "); + ex_mess += oss.str(); + throw SALOME_Exception(ex_mess.c_str()); + } + } + + END_OF("BatchManager::exportInFiles"); + } + + void BatchManager::importOutputFiles( const char *directory, const CORBA::Long jobId ) throw(SALOME_Exception) + { + BEGIN_OF("BatchManager::importOutputFiles"); + string command; + int status; + + const BatchLight::Job* myJob = _jobmap[jobId]; + Engines::FilesList filesToImportList = myJob->getFilesToImportList(); + + for ( int i = 0 ; i < filesToImportList.length() ; i++ ) { + if( _params.protocol == "rsh" ) + command = "rcp "; + else if( _params.protocol == "ssh" ) + command = "scp "; + else + throw SALOME_Exception("Unknown protocol"); + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + command += _params.hostname; + command += ":"; + command += filesToImportList[i] ; + command += " "; + command += directory; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status) + { + // Try to get what we can (logs files) + // throw SALOME_Exception("Error of connection on remote host"); + std::string mess("Copy command failed ! status is :"); + ostringstream status_str; + status_str << status; + mess += status_str.str(); + INFOS(mess); + } + } + + END_OF("BatchManager::importOutputFiles"); + } + + string BatchManager::BuildTemporaryFileName() const + { + //build more complex file name to support multiple salome session + char *temp = new char[19]; + strcpy(temp, "/tmp/command"); + strcat(temp, "XXXXXX"); +#ifndef WNT + mkstemp(temp); +#else + char aPID[80]; + itoa(getpid(), aPID, 10); + strcat(temp, aPID); +#endif + + string command(temp); + delete [] temp; + command += ".sh"; + return command; + } + + void BatchManager::RmTmpFile(std::string & TemporaryFileName) + { + string command = "rm "; + command += TemporaryFileName; + char *temp = strdup(command.c_str()); + int lgthTemp = strlen(temp); + temp[lgthTemp - 3] = '*'; + temp[lgthTemp - 2] = '\0'; + system(temp); + free(temp); + } + + MpiImpl *BatchManager::FactoryMpiImpl(string mpiImpl) throw(SALOME_Exception) + { + if(mpiImpl == "lam") + return new MpiImpl_LAM(); + else if(mpiImpl == "mpich1") + return new MpiImpl_MPICH1(); + else if(mpiImpl == "mpich2") + return new MpiImpl_MPICH2(); + else if(mpiImpl == "openmpi") + return new MpiImpl_OPENMPI(); + else if(mpiImpl == "indif") + throw SALOME_Exception("you must specify a mpi implementation in CatalogResources.xml file"); + else{ + ostringstream oss; + oss << mpiImpl << " : not yet implemented"; + throw SALOME_Exception(oss.str().c_str()); + } + } + +} diff --git a/src/Launcher/BatchLight_BatchManager.hxx b/src/Launcher/BatchLight_BatchManager.hxx new file mode 100644 index 000000000..7183c1d1b --- /dev/null +++ b/src/Launcher/BatchLight_BatchManager.hxx @@ -0,0 +1,89 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +/* + * BatchManager.hxx : + * + * Auteur : Bernard SECHER - CEA/DEN + * Date : Juillet 2007 + * Projet : SALOME + * + */ + +#ifndef _BL_BATCHMANAGER_H_ +#define _BL_BATCHMANAGER_H_ + +#include +#include +#include +#include "Utils_SALOME_Exception.hxx" +#include +#include +#include CORBA_CLIENT_HEADER(SALOME_ContainerManager) +#include "MpiImpl.hxx" + +namespace BatchLight { + + class Job; + + struct batchParams{ + std::string hostname; // serveur ou tourne le BatchManager + std::string protocol; // protocole d'acces au serveur: ssh ou rsh + std::string username; // username d'acces au serveur + std::string applipath; // path of apllication directory on server + std::vector modulesList; // list of Salome modules installed on server + unsigned int nbnodes; // number of nodes on cluster + unsigned int nbprocpernode; // number of processors on each node + std::string mpiImpl; // mpi implementation + }; + + class BatchManager + { + public: + // Constructeur et destructeur + BatchManager(const batchParams& p) throw(SALOME_Exception); // connexion a la machine host + virtual ~BatchManager(); + + // Methodes pour le controle des jobs : virtuelles pures + const int submitJob(BatchLight::Job* job); // soumet un job au gestionnaire + virtual void deleteJob(const int & jobid) = 0; // retire un job du gestionnaire + virtual std::string queryJob(const int & jobid) = 0; // renvoie l'etat du job + void importOutputFiles( const char *directory, const CORBA::Long jobId ) throw(SALOME_Exception); + + protected: + batchParams _params; + MpiImpl *_mpiImpl; + std::map _jobmap; + + virtual int submit(BatchLight::Job* job) throw(SALOME_Exception) = 0; + void setDirForTmpFiles(BatchLight::Job* job); + void exportInputFiles(BatchLight::Job* job) throw(SALOME_Exception); + virtual void buildSalomeCouplingScript(BatchLight::Job* job) throw(SALOME_Exception) = 0; + virtual void buildSalomeBatchScript(BatchLight::Job* job) throw(SALOME_Exception) = 0; + + std::string BuildTemporaryFileName() const; + void RmTmpFile(std::string & TemporaryFileName); + MpiImpl *FactoryMpiImpl(std::string mpiImpl) throw(SALOME_Exception); + private: + + }; + +} + +#endif diff --git a/src/Launcher/BatchLight_BatchManager_PBS.cxx b/src/Launcher/BatchLight_BatchManager_PBS.cxx new file mode 100644 index 000000000..eec063a02 --- /dev/null +++ b/src/Launcher/BatchLight_BatchManager_PBS.cxx @@ -0,0 +1,475 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +/* + * BatchManager.cxx : + * + * Auteur : Bernard SECHER - CEA/DEN + * Date : Juillet 2007 + * Projet : SALOME + * + */ + +#include "BatchLight_BatchManager_PBS.hxx" +#include "utilities.h" +#include "BatchLight_Job.hxx" +#include +#include +#include +#include + +using namespace std; + +namespace BatchLight { + + // Constructeur + BatchManager_PBS::BatchManager_PBS(const batchParams& p) throw(SALOME_Exception) : BatchManager(p) + { + // pbs batch system needs to know mpi implementation + _mpiImpl = FactoryMpiImpl(_params.mpiImpl); + } + + // Destructeur + BatchManager_PBS::~BatchManager_PBS() + { + MESSAGE("BatchManager_PBS destructor "<<_params.hostname); + } + + // Methode pour le controle des jobs : retire un job du gestionnaire + void BatchManager_PBS::deleteJob(const int & jobid) + { + BEGIN_OF("BatchManager_PBS::deleteJob"); + string command; + int status; + ostringstream oss; + oss << jobid; + + // define command to submit batch + if( _params.protocol == "rsh" ) + command = "rsh "; + else if( _params.protocol == "ssh" ) + command = "ssh "; + else + throw SALOME_Exception("Unknown protocol"); + + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + + command += _params.hostname; + command += " \"qdel " ; + command += oss.str(); + command += "\""; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status) + throw SALOME_Exception("Error of connection on remote host"); + + MESSAGE("jobId = " << jobid << "killed"); + END_OF("BatchManager_PBS::deleteJob"); + } + + // Methode pour le controle des jobs : renvoie l'etat du job + string BatchManager_PBS::queryJob(const int & jobid) + { + BEGIN_OF("BatchManager_PBS::queryJob"); + // define name of log file + string jstatus; + string logFile="/tmp/logs/"; + logFile += getenv("USER"); + logFile += "/batchSalome_"; + + //srand ( time(NULL) ); + //int ir = rand(); + ostringstream oss; + //oss << ir; + oss << this << "_" << jobid; + logFile += oss.str(); + logFile += ".log"; + + string command; + int status; + + // define command to submit batch + if( _params.protocol == "rsh" ) + command = "rsh "; + else if( _params.protocol == "ssh" ) + command = "ssh "; + else + throw SALOME_Exception("Unknown protocol"); + + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + + command += _params.hostname; + command += " \"qstat -f " ; + //ostringstream oss2; + //oss2 << jobid; + //command += oss2.str(); + command += _pbs_job_name[jobid]; + command += "\" > "; + command += logFile; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status && status != 153 && status != 256*153){ + MESSAGE("status="<> jstatus; + iss >> jstatus; + iss >> jstatus; + } + else + jstatus = "U"; + } + + MESSAGE("jobId = " << jobid << " " << jstatus); + END_OF("BatchManager_PBS::queryJob"); + return jstatus; + } + + void BatchManager_PBS::buildSalomeCouplingScript(BatchLight::Job* job) throw(SALOME_Exception) + { + BEGIN_OF("BatchManager_PBS::buildSalomeCouplingScript"); + int status; + const char *fileToExecute = job->getFileToExecute(); + const std::string dirForTmpFiles = job->getDirForTmpFiles(); + int idx = dirForTmpFiles.find("Batch/"); + std::string filelogtemp = dirForTmpFiles.substr(idx+6, dirForTmpFiles.length()); + + string::size_type p1 = string(fileToExecute).find_last_of("/"); + string::size_type p2 = string(fileToExecute).find_last_of("."); + std::string fileNameToExecute = string(fileToExecute).substr(p1+1,p2-p1-1); + std::string TmpFileName = BuildTemporaryFileName(); + + ofstream tempOutputFile; + tempOutputFile.open(TmpFileName.c_str(), ofstream::out ); + + // Begin + tempOutputFile << "#! /bin/sh -f" << endl ; + tempOutputFile << "cd " ; + tempOutputFile << _params.applipath << endl ; + tempOutputFile << "export SALOME_BATCH=1\n"; + tempOutputFile << "export PYTHONPATH=~/" ; + tempOutputFile << dirForTmpFiles ; + tempOutputFile << ":$PYTHONPATH" << endl ; + + // Test node rank + tempOutputFile << "if test " ; + tempOutputFile << _mpiImpl->rank() ; + tempOutputFile << " = 0; then" << endl ; + + // ----------------------------------------------- + // Code for rank 0 : launch runAppli and a container + // RunAppli + tempOutputFile << " ./runAppli --terminal --modules=" ; + for ( int i = 0 ; i < _params.modulesList.size() ; i++ ) { + tempOutputFile << _params.modulesList[i] ; + if ( i != _params.modulesList.size()-1 ) + tempOutputFile << "," ; + } + tempOutputFile << " --standalone=registry,study,moduleCatalog --ns-port-log=" + << filelogtemp + << " &\n"; + + // Wait NamingService + tempOutputFile << " current=0\n" + << " stop=20\n" + << " while ! test -f " << filelogtemp << "\n" + << " do\n" + << " sleep 2\n" + << " let current=current+1\n" + << " if [ \"$current\" -eq \"$stop\" ] ; then\n" + << " echo Error Naming Service failed ! >&2" + << " exit\n" + << " fi\n" + << " done\n" + << " port=`cat " << filelogtemp << "`\n"; + + // Launch a container + tempOutputFile << " ./runSession SALOME_Container 'YACS_Server_'" + << _mpiImpl->rank() + << " > ~/" << dirForTmpFiles << "/YACS_Server_" + << _mpiImpl->rank() << "_container_log." << filelogtemp + << " 2>&1 &\n"; + + // Wait other containers + tempOutputFile << " for ((ip=0; ip < "; + tempOutputFile << _mpiImpl->size(); + tempOutputFile << " ; ip++))" << endl; + tempOutputFile << " do" << endl ; + tempOutputFile << " arglist=\"$arglist YACS_Server_\"$ip" << endl ; + tempOutputFile << " done" << endl ; + tempOutputFile << " sleep 5" << endl ; + tempOutputFile << " ./runSession waitContainers.py $arglist" << endl ; + + // Launch user script + tempOutputFile << " ./runSession python ~/" << dirForTmpFiles << "/" << fileNameToExecute << ".py\n"; + + // Stop application + tempOutputFile << " rm " << filelogtemp << "\n" + << " ./runSession killSalomeWithPort.py $port\n"; + + // ------------------------------------- + // Other nodes launch a container + tempOutputFile << "else" << endl ; + + // Wait NamingService + tempOutputFile << " current=0\n" + << " stop=20\n" + << " while ! test -f " << filelogtemp << "\n" + << " do\n" + << " sleep 2\n" + << " let current=current+1\n" + << " if [ \"$current\" -eq \"$stop\" ] ; then\n" + << " echo Error Naming Service failed ! >&2" + << " exit\n" + << " fi\n" + << " done\n" + << " port=`cat " << filelogtemp << "`\n"; + + // Launching container + tempOutputFile << " ./runSession SALOME_Container 'YACS_Server_'"; + tempOutputFile << _mpiImpl->rank() + << " > ~/" << dirForTmpFiles << "/YACS_Server_" + << _mpiImpl->rank() << "_container_log." << filelogtemp + << " 2>&1\n"; + tempOutputFile << "fi" << endl; + tempOutputFile.flush(); + tempOutputFile.close(); + chmod(TmpFileName.c_str(), 0x1ED); + SCRUTE(TmpFileName.c_str()) ; + + string command; + if( _params.protocol == "rsh" ) + command = "rcp "; + else if( _params.protocol == "ssh" ) + command = "scp "; + else + throw SALOME_Exception("Unknown protocol"); + + command += TmpFileName; + command += " "; + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + command += _params.hostname; + command += ":"; + command += dirForTmpFiles ; + command += "/runSalome_" ; + command += fileNameToExecute ; + command += "_Batch.sh" ; + SCRUTE(fileNameToExecute) ; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status) + throw SALOME_Exception("Error of connection on remote host"); + RmTmpFile(TmpFileName); + + END_OF("BatchManager_PBS::buildSalomeCouplingScript"); + } + + void BatchManager_PBS::buildSalomeBatchScript(BatchLight::Job* job) throw(SALOME_Exception) + { + BEGIN_OF("BatchManager_PBS::buildSalomeBatchScript"); + int status; + const int nbproc = job->getNbProc(); + std::string edt = job->getExpectedDuringTime(); + std::string mem = job->getMemory(); + const std::string dirForTmpFiles = job->getDirForTmpFiles(); + const char *fileToExecute = job->getFileToExecute(); + string::size_type p1 = string(fileToExecute).find_last_of("/"); + string::size_type p2 = string(fileToExecute).find_last_of("."); + std::string fileNameToExecute = string(fileToExecute).substr(p1+1,p2-p1-1); + int idx = dirForTmpFiles.find("Batch/"); + std::string filelogtemp = dirForTmpFiles.substr(idx+6, dirForTmpFiles.length()); + + int nbmaxproc = _params.nbnodes * _params.nbprocpernode; + if( nbproc > nbmaxproc ){ + MESSAGE(nbproc << " processors asked on a cluster of " << nbmaxproc << " processors"); + throw SALOME_Exception("Too much processors asked for that cluster"); + } + + int nbnodes; + if( nbproc < _params.nbnodes ) + nbnodes = nbproc; + else + nbnodes = _params.nbnodes; + + std::string TmpFileName = BuildTemporaryFileName(); + ofstream tempOutputFile; + tempOutputFile.open(TmpFileName.c_str(), ofstream::out ); + + ostringstream filenameToExecute; + filenameToExecute << " ~/" << dirForTmpFiles << "/runSalome_" << fileNameToExecute << "_Batch.sh"; + + tempOutputFile << "#! /bin/sh -f" << endl ; + tempOutputFile << "#PBS -l nodes=" << nbnodes << endl ; + if (edt != "") + tempOutputFile << "#PBS -l walltime=" << edt << ":00" << endl ; + if (mem != "") + tempOutputFile << "#PBS -l mem=" << mem << endl ; + // In some systems qsub does not correctly expand env variables + // like PBS_O_HOME for #PBS directives.... + //tempOutputFile << "#PBS -o /$PBS_O_HOME/" << dirForTmpFiles << "/runSalome.output.log.${PBS_JOBID}" << endl ; + //tempOutputFile << "#PBS -e /$PBS_O_HOME/" << dirForTmpFiles << "/runSalome.error.log.${PBS_JOBID}" << endl ; + tempOutputFile << "#PBS -o runSalome.output.log." << filelogtemp << endl ; + tempOutputFile << "#PBS -e runSalome.error.log." << filelogtemp << endl ; + tempOutputFile << _mpiImpl->boot("${PBS_NODEFILE}",nbnodes); + tempOutputFile << _mpiImpl->run("${PBS_NODEFILE}",nbproc,filenameToExecute.str()); + tempOutputFile << _mpiImpl->halt(); + tempOutputFile.flush(); + tempOutputFile.close(); + chmod(TmpFileName.c_str(), 0x1ED); + SCRUTE(TmpFileName.c_str()) ; + + string command; + if( _params.protocol == "rsh" ) + command = "rcp "; + else if( _params.protocol == "ssh" ) + command = "scp "; + else + throw SALOME_Exception("Unknown protocol"); + command += TmpFileName; + command += " "; + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + command += _params.hostname; + command += ":"; + command += dirForTmpFiles ; + command += "/" ; + command += fileNameToExecute ; + command += "_Batch.sh" ; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status) + throw SALOME_Exception("Error of connection on remote host"); + + // Adding log files into import list files + ostringstream file_name_output; + file_name_output << "~/" << dirForTmpFiles << "/" << "runSalome.output.log*"; + ostringstream file_name_error; + file_name_error << "~/" << dirForTmpFiles << "/" << "runSalome.error.log*"; + ostringstream file_container_log; + file_container_log << "~/" << dirForTmpFiles << "/" << "YACS_Server*"; + job->addFileToImportList(file_name_output.str()); + job->addFileToImportList(file_name_error.str()); + job->addFileToImportList(file_container_log.str()); + RmTmpFile(TmpFileName); + END_OF("BatchManager_PBS::buildSalomeBatchScript"); + } + + int BatchManager_PBS::submit(BatchLight::Job* job) throw(SALOME_Exception) + { + BEGIN_OF("BatchManager_PBS::submit"); + const std::string dirForTmpFiles = job->getDirForTmpFiles(); + const char *fileToExecute = job->getFileToExecute(); + string::size_type p1 = string(fileToExecute).find_last_of("/"); + string::size_type p2 = string(fileToExecute).find_last_of("."); + std::string fileNameToExecute = string(fileToExecute).substr(p1+1,p2-p1-1); + + // define name of log file + string logFile="/tmp/logs/"; + logFile += getenv("USER"); + logFile += "/batchSalome_"; + + srand ( time(NULL) ); + int ir = rand(); + ostringstream oss; + oss << ir; + logFile += oss.str(); + logFile += ".log"; + + string command; + int status; + + // define command to submit batch + if( _params.protocol == "rsh" ) + command = "rsh "; + else if( _params.protocol == "ssh" ) + command = "ssh "; + else + throw SALOME_Exception("Unknown protocol"); + + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + + command += _params.hostname; + command += " \"cd " ; + command += dirForTmpFiles; + command += "; qsub " ; + command += fileNameToExecute ; + command += "_Batch.sh\" > "; + command += logFile; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status) + throw SALOME_Exception("Error of connection on remote host"); + + // read id of submitted job in log file + char line[128]; + FILE *fp = fopen(logFile.c_str(),"r"); + fgets( line, 128, fp); + fclose(fp); + + string sline(line); + int pos = sline.find("."); + string strjob; + if(pos == string::npos) + strjob = sline; + else + strjob = sline.substr(0,pos); + + int id; + istringstream iss(strjob); + iss >> id; + + // Ajout dans la map + _pbs_job_name[id] = sline; + END_OF("BatchManager_PBS::submit"); + return id; + } + +} diff --git a/src/Launcher/BatchLight_BatchManager_PBS.hxx b/src/Launcher/BatchLight_BatchManager_PBS.hxx new file mode 100644 index 000000000..e0c21651b --- /dev/null +++ b/src/Launcher/BatchLight_BatchManager_PBS.hxx @@ -0,0 +1,64 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +/* + * BatchManager.hxx : + * + * Auteur : Bernard SECHER - CEA/DEN + * Date : Juillet 2007 + * Projet : SALOME + * + */ + +#ifndef _BL_BATCHMANAGER_PBS_H_ +#define _BL_BATCHMANAGER_PBS_H_ + +#include +#include "Utils_SALOME_Exception.hxx" +#include "BatchLight_BatchManager.hxx" + +namespace BatchLight { + + class Job; + + class BatchManager_PBS : public BatchManager + { + public: + // Constructeur et destructeur + BatchManager_PBS(const batchParams& p) throw(SALOME_Exception); // connexion a la machine host + virtual ~BatchManager_PBS(); + + // Methodes pour le controle des jobs : virtuelles pures + void deleteJob(const int & jobid); // retire un job du gestionnaire + std::string queryJob(const int & jobid); // renvoie l'etat du job + + private: + void buildSalomeCouplingScript(BatchLight::Job* job) throw(SALOME_Exception); + void buildSalomeBatchScript(BatchLight::Job* job) throw(SALOME_Exception); + int submit(BatchLight::Job* job) throw(SALOME_Exception); + + // Permet d'avoir la chaîne complête pour demander + // le statut du job + typedef std::map _pbs_job_name_t; + _pbs_job_name_t _pbs_job_name; + }; + +} + +#endif diff --git a/src/Launcher/BatchLight_BatchManager_SLURM.cxx b/src/Launcher/BatchLight_BatchManager_SLURM.cxx new file mode 100644 index 000000000..d184ca6bb --- /dev/null +++ b/src/Launcher/BatchLight_BatchManager_SLURM.cxx @@ -0,0 +1,340 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +/* + * BatchManager.cxx : + * + * Auteur : Bernard SECHER - CEA/DEN + * Date : Juillet 2007 + * Projet : SALOME + * + */ + +#include "BatchLight_BatchManager_SLURM.hxx" +#include "utilities.h" +#include "BatchLight_Job.hxx" +#include +#include +#include +#include + +using namespace std; + +namespace BatchLight { + + // Constructeur + BatchManager_SLURM::BatchManager_SLURM(const batchParams& p) throw(SALOME_Exception) : BatchManager(p) + { + } + + // Destructeur + BatchManager_SLURM::~BatchManager_SLURM() + { + MESSAGE("BatchManager_SLURM destructor "<<_params.hostname); + } + + // Methode pour le controle des jobs : retire un job du gestionnaire + void BatchManager_SLURM::deleteJob(const int & jobid) + { + BEGIN_OF("BatchManager_SLURM::deleteJob"); + string command; + int status; + ostringstream oss; + oss << jobid; + + // define command to submit batch + if( _params.protocol == "rsh" ) + command = "rsh "; + else if( _params.protocol == "ssh" ) + command = "ssh "; + else + throw SALOME_Exception("Unknown protocol"); + + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + + command += _params.hostname; + command += " \"bkill " ; + command += oss.str(); + command += "\""; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status) + throw SALOME_Exception("Error of connection on remote host"); + + MESSAGE("jobId = " << jobid << "killed"); + END_OF("BatchManager_SLURM::deleteJob"); + } + + // Methode pour le controle des jobs : renvoie l'etat du job + string BatchManager_SLURM::queryJob(const int & jobid) + { + BEGIN_OF("BatchManager_SLURM::queryJob"); + // define name of log file + string logFile="/tmp/logs/"; + logFile += getenv("USER"); + logFile += "/batchSalome_"; + + srand ( time(NULL) ); + int ir = rand(); + ostringstream oss; + oss << ir; + logFile += oss.str(); + logFile += ".log"; + + string command; + int status; + + // define command to submit batch + if( _params.protocol == "rsh" ) + command = "rsh "; + else if( _params.protocol == "ssh" ) + command = "ssh "; + else + throw SALOME_Exception("Unknown protocol"); + + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + + command += _params.hostname; + command += " \"bjobs " ; + ostringstream oss2; + oss2 << jobid; + command += oss2.str(); + command += "\" > "; + command += logFile; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status) + throw SALOME_Exception("Error of connection on remote host"); + + // read staus of job in log file + char line[128]; + ifstream fp(logFile.c_str(),ios::in); + fp.getline(line,80,'\n'); + + string sjobid, username, jstatus; + fp >> sjobid; + fp >> username; + fp >> jstatus; + + MESSAGE("jobId = " << jobid << " " << jstatus); + END_OF("BatchManager_SLURM::queryJob"); + return jstatus; + } + + void BatchManager_SLURM::buildSalomeCouplingScript(BatchLight::Job* job) throw(SALOME_Exception) + { + BEGIN_OF("BatchManager_SLURM::buildSalomeCouplingScript"); + int status; + const char *fileToExecute = job->getFileToExecute(); + const std::string dirForTmpFiles = job->getDirForTmpFiles(); + + string::size_type p1 = string(fileToExecute).find_last_of("/"); + string::size_type p2 = string(fileToExecute).find_last_of("."); + std::string fileNameToExecute = string(fileToExecute).substr(p1+1,p2-p1-1); + + std::string TmpFileName = BuildTemporaryFileName(); + ofstream tempOutputFile; + tempOutputFile.open(TmpFileName.c_str(), ofstream::out ); + tempOutputFile << "#! /bin/sh -f" << endl ; + tempOutputFile << "cd " ; + tempOutputFile << _params.applipath << endl ; + tempOutputFile << "export PYTHONPATH=~/" ; + tempOutputFile << dirForTmpFiles ; + tempOutputFile << ":$PYTHONPATH" << endl ; + tempOutputFile << "if test $SLURM_PROCID = 0; then" << endl ; + tempOutputFile << " ./runAppli --terminal --modules=" ; + for ( int i = 0 ; i < _params.modulesList.size() ; i++ ) { + tempOutputFile << _params.modulesList[i] ; + if ( i != _params.modulesList.size()-1 ) + tempOutputFile << "," ; + } + tempOutputFile << " --standalone=registry,study,moduleCatalog --killall &" << endl ; + tempOutputFile << " for ((ip=1; ip < ${SLURM_NPROCS} ; ip++))" << endl; + tempOutputFile << " do" << endl ; + tempOutputFile << " arglist=\"$arglist YACS_Server_\"$ip" << endl ; + tempOutputFile << " done" << endl ; + tempOutputFile << " ./runSession waitNS.sh" << endl ; + tempOutputFile << " ./runSession waitContainers.py $arglist" << endl ; + tempOutputFile << " ./runSession python ~/" << dirForTmpFiles << "/" << fileNameToExecute << ".py" << endl; + tempOutputFile << " ./runSession killCurrentPort" << endl; + tempOutputFile << "else" << endl ; + tempOutputFile << " ./runSession waitNS.sh" << endl ; + tempOutputFile << " ./runSession SALOME_Container 'YACS_Server_'${SLURM_PROCID}" << endl ; + tempOutputFile << "fi" << endl ; + tempOutputFile.flush(); + tempOutputFile.close(); + chmod(TmpFileName.c_str(), 0x1ED); + SCRUTE(TmpFileName.c_str()) ; + + string command; + if( _params.protocol == "rsh" ) + command = "rcp "; + else if( _params.protocol == "ssh" ) + command = "scp "; + else + throw SALOME_Exception("Unknown protocol"); + + command += TmpFileName; + command += " "; + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + command += _params.hostname; + command += ":"; + command += dirForTmpFiles ; + command += "/runSalome_" ; + command += fileNameToExecute ; + command += "_Batch.sh" ; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status) + throw SALOME_Exception("Error of connection on remote host"); + RmTmpFile(TmpFileName); + + END_OF("BatchManager_SLURM::buildSalomeCouplingScript"); + } + + void BatchManager_SLURM::buildSalomeBatchScript(BatchLight::Job* job) throw(SALOME_Exception) + { + BEGIN_OF("BatchManager_SLURM::buildSalomeBatchScript"); + int status; + const int nbproc = job->getNbProc(); + const std::string dirForTmpFiles = job->getDirForTmpFiles(); + std::string TmpFileName = BuildTemporaryFileName(); + ofstream tempOutputFile; + tempOutputFile.open(TmpFileName.c_str(), ofstream::out ); + const char *fileToExecute = job->getFileToExecute(); + string::size_type p1 = string(fileToExecute).find_last_of("/"); + string::size_type p2 = string(fileToExecute).find_last_of("."); + std::string fileNameToExecute = string(fileToExecute).substr(p1+1,p2-p1-1); + + tempOutputFile << "#! /bin/sh -f" << endl ; + tempOutputFile << "#BSUB -n " << nbproc << endl ; + tempOutputFile << "#BSUB -o " << dirForTmpFiles << "/runSalome.log%J" << endl ; + tempOutputFile << "srun ~/" << dirForTmpFiles << "/runSalome_" << fileNameToExecute << "_Batch.sh" << endl ; + tempOutputFile.flush(); + tempOutputFile.close(); + chmod(TmpFileName.c_str(), 0x1ED); + SCRUTE(TmpFileName.c_str()) ; + + string command; + if( _params.protocol == "rsh" ) + command = "rcp "; + else if( _params.protocol == "ssh" ) + command = "scp "; + else + throw SALOME_Exception("Unknown protocol"); + command += TmpFileName; + command += " "; + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + command += _params.hostname; + command += ":"; + command += dirForTmpFiles ; + command += "/" ; + command += fileNameToExecute ; + command += "_Batch.sh" ; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status) + throw SALOME_Exception("Error of connection on remote host"); + + RmTmpFile(TmpFileName); + END_OF("BatchManager_SLURM::buildSalomeBatchScript"); + + } + + int BatchManager_SLURM::submit(BatchLight::Job* job) throw(SALOME_Exception) + { + BEGIN_OF("BatchManager_SLURM::submit"); + const std::string dirForTmpFiles = job->getDirForTmpFiles(); + const char *fileToExecute = job->getFileToExecute(); + string::size_type p1 = string(fileToExecute).find_last_of("/"); + string::size_type p2 = string(fileToExecute).find_last_of("."); + std::string fileNameToExecute = string(fileToExecute).substr(p1+1,p2-p1-1); + + // define name of log file + string logFile="/tmp/logs/"; + logFile += getenv("USER"); + logFile += "/batchSalome_"; + + srand ( time(NULL) ); + int ir = rand(); + ostringstream oss; + oss << ir; + logFile += oss.str(); + logFile += ".log"; + + string command; + int status; + + // define command to submit batch + if( _params.protocol == "rsh" ) + command = "rsh "; + else if( _params.protocol == "ssh" ) + command = "ssh "; + else + throw SALOME_Exception("Unknown protocol"); + + if (_params.username != ""){ + command += _params.username; + command += "@"; + } + + command += _params.hostname; + command += " \"bsub < " ; + command += dirForTmpFiles ; + command += "/" ; + command += fileNameToExecute ; + command += "_Batch.sh\" > "; + command += logFile; + SCRUTE(command.c_str()); + status = system(command.c_str()); + if(status) + throw SALOME_Exception("Error of connection on remote host"); + + // read id of submitted job in log file + char line[128]; + FILE *fp = fopen(logFile.c_str(),"r"); + fgets( line, 128, fp); + fclose(fp); + + string sline(line); + int p10 = sline.find("<"); + int p20 = sline.find(">"); + string strjob = sline.substr(p10+1,p20-p10-1); + + int id; + istringstream iss(strjob); + iss >> id; + + END_OF("BatchManager_SLURM::submit"); + return id; + } + +} diff --git a/src/Launcher/BatchLight_BatchManager_SLURM.hxx b/src/Launcher/BatchLight_BatchManager_SLURM.hxx new file mode 100644 index 000000000..6024b28de --- /dev/null +++ b/src/Launcher/BatchLight_BatchManager_SLURM.hxx @@ -0,0 +1,62 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +/* + * BatchManager.hxx : + * + * Auteur : Bernard SECHER - CEA/DEN + * Date : Juillet 2007 + * Projet : SALOME + * + */ + +#ifndef _BL_BATCHMANAGER_SLURM_H_ +#define _BL_BATCHMANAGER_SLURM_H_ + +#include +#include "Utils_SALOME_Exception.hxx" +#include "BatchLight_BatchManager.hxx" + +namespace BatchLight { + + class Job; + + class BatchManager_SLURM : public BatchManager + { + public: + // Constructeur et destructeur + BatchManager_SLURM(const batchParams& p) throw(SALOME_Exception); // connexion a la machine host + virtual ~BatchManager_SLURM(); + + // Methodes pour le controle des jobs : virtuelles pures + void deleteJob(const int & jobid); // retire un job du gestionnaire + std::string queryJob(const int & jobid); // renvoie l'etat du job + + protected: + void buildSalomeCouplingScript(BatchLight::Job* job) throw(SALOME_Exception); + void buildSalomeBatchScript(BatchLight::Job* job) throw(SALOME_Exception); + int submit(BatchLight::Job* job) throw(SALOME_Exception); + + private: + + }; + +} + +#endif diff --git a/src/Launcher/BatchLight_Job.cxx b/src/Launcher/BatchLight_Job.cxx new file mode 100644 index 000000000..1980054a9 --- /dev/null +++ b/src/Launcher/BatchLight_Job.cxx @@ -0,0 +1,160 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +/* + * Job.cxx : + * + * Auteur : Bernard SECHER - CEA/DEN + * Date : Juillet 2007 + * Projet : SALOME + * + */ + +#include "BatchLight_Job.hxx" +#include + +using namespace std; +using namespace BatchLight; + +Job::Job(const char *fileToExecute, + const Engines::FilesList& filesToExport, + const Engines::FilesList& filesToImport, + const Engines::BatchParameters& batch_params) : _fileToExecute(fileToExecute), + _filesToExport(filesToExport), + _filesToImport(filesToImport), + _batch_params(batch_params) +{ + _dirForTmpFiles = "/tmp/default_batch_tmp_directory"; + std::string _fileNameToExecute = ""; +} + +Job::~Job() +{ + MESSAGE("Job destructor"); +} + +void +Job::addFileToImportList(std::string file_name) +{ + CORBA::ULong lgth = _filesToImport.length(); + _filesToImport.length(lgth+1); + _filesToImport[lgth] = CORBA::string_dup(file_name.c_str()); +} + +const std::string +Job::getExpectedDuringTime() +{ + std::string str(_batch_params.expected_during_time); + return str; +} + +const std::string +Job::getMemory() +{ + std::string str(_batch_params.mem); + return str; +} + +bool +Job::check() { + bool rtn = true; + INFOS("Warning : batch_directory option is not currently implemented"); + INFOS("Warning : currently these informations are only in the PBS batch manager"); + INFOS("Job parameters are :"); + INFOS("Directory : $HOME/Batch/$date"); + + // check expected_during_time (check the format) + std::string edt_info; + std::string edt_value = _batch_params.expected_during_time.in(); + if (edt_value != "") { + std::string begin_edt_value = edt_value.substr(0, 2); + std::string mid_edt_value = edt_value.substr(2, 1); + std::string end_edt_value = edt_value.substr(3); + + long value; + std::istringstream iss(begin_edt_value); + if (!(iss >> value)) { + edt_info = "Error on definition ! : " + edt_value; + rtn = false; + } + else if (value < 0) { + edt_info = "Error on definition time is negative ! : " + value; + rtn = false; + } + std::istringstream iss_2(end_edt_value); + if (!(iss_2 >> value)) { + edt_info = "Error on definition ! : " + edt_value; + rtn = false; + } + else if (value < 0) { + edt_info = "Error on definition time is negative ! : " + value; + rtn = false; + } + if (mid_edt_value != ":") { + edt_info = "Error on definition ! :" + edt_value; + rtn = false; + } + } + else { + edt_info = "No value given"; + } + INFOS("Expected during time : " << edt_info); + + // check memory (check the format) + std::string mem_info; + std::string mem_value = _batch_params.mem.in(); + if (mem_value != "") { + std::string begin_mem_value = mem_value.substr(0, mem_value.length()-2); + long re_mem_value; + std::istringstream iss(begin_mem_value); + if (!(iss >> re_mem_value)) { + mem_info = "Error on definition ! : " + mem_value; + rtn = false; + } + else if (re_mem_value <= 0) { + mem_info = "Error on definition memory is negative ! : " + mem_value; + rtn = false; + } + std::string end_mem_value = mem_value.substr(mem_value.length()-2); + if (end_mem_value != "gb" and end_mem_value != "mb") { + mem_info = "Error on definition, type is bad ! " + mem_value; + rtn = false; + } + } + else { + mem_info = "No value given"; + } + INFOS("Memory : " << mem_info); + + // check nb_proc + std::string nb_proc_info; + ostringstream nb_proc_value; + nb_proc_value << _batch_params.nb_proc; + if(_batch_params.nb_proc <= 0) { + nb_proc_info = "Bad value ! nb_proc = "; + nb_proc_info += nb_proc_value.str(); + rtn = false; + } + else { + nb_proc_info = nb_proc_value.str(); + } + INFOS("Nb of processors : " << nb_proc_info); + + return rtn; +} diff --git a/src/Launcher/BatchLight_Job.hxx b/src/Launcher/BatchLight_Job.hxx new file mode 100644 index 000000000..e17e790b9 --- /dev/null +++ b/src/Launcher/BatchLight_Job.hxx @@ -0,0 +1,72 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +/* + * Job.hxx : + * + * Auteur : Bernard SECHER - CEA/DEN + * Date : Juillet 2007 + * Projet : SALOME + * + */ + +#ifndef _BL_JOB_H_ +#define _BL_JOB_H_ + +#include "utilities.h" +#include +#include CORBA_CLIENT_HEADER(SALOME_ContainerManager) + +namespace BatchLight { + + class Job + { + public: + // Constructeurs et destructeur + Job(const char *fileToExecute, + const Engines::FilesList& filesToExport, + const Engines::FilesList& filesToImport, + const Engines::BatchParameters& batch_params); + virtual ~Job(); + + const char *getFileToExecute() const { return _fileToExecute; } + const Engines::FilesList getFilesToExportList() const { return _filesToExport; } + const Engines::FilesList getFilesToImportList() const { return _filesToImport; } + void addFileToImportList(std::string file_name); + const CORBA::Long getNbProc() const { return _batch_params.nb_proc; } + const std::string getExpectedDuringTime(); + const std::string getMemory(); + + const std::string getDirForTmpFiles() const { return _dirForTmpFiles;} + void setDirForTmpFiles(std::string dirForTmpFiles) {_dirForTmpFiles = dirForTmpFiles; + SCRUTE(_dirForTmpFiles);} + bool check(); + protected: + const char* _fileToExecute; + const Engines::FilesList _filesToExport; + Engines::FilesList _filesToImport; + Engines::BatchParameters _batch_params; + std::string _dirForTmpFiles; // Tmp directory on the server + private: + + }; + +} + +#endif diff --git a/src/Launcher/MpiImpl.cxx b/src/Launcher/MpiImpl.cxx new file mode 100644 index 000000000..036018b1e --- /dev/null +++ b/src/Launcher/MpiImpl.cxx @@ -0,0 +1,212 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +/* + * BatchManager.cxx : + * + * Auteur : Bernard SECHER - CEA/DEN + * Date : Juillet 2007 + * Projet : SALOME + * + */ + +#include +#include +#include +#include "utilities.h" +#include "MpiImpl.hxx" + +using namespace std; + +// Constructor +MpiImpl::MpiImpl() +{ + MESSAGE("MpiImpl constructor"); +} + +// Destructor +MpiImpl::~MpiImpl() +{ + MESSAGE("MpiImpl destructor"); +} + +// lam implementation +// Constructor +MpiImpl_LAM::MpiImpl_LAM() : MpiImpl() +{ +} + +// Destructor +MpiImpl_LAM::~MpiImpl_LAM() +{ + MESSAGE("MpiImpl_LAM destructor"); +} + +string MpiImpl_LAM::size() +{ + return "${LAMWORLD}"; +} + +string MpiImpl_LAM::rank() +{ + return "${LAMRANK}"; +} + +string MpiImpl_LAM::boot(const string machinefile, const unsigned int nbnodes) +{ + ostringstream oss; + oss << "lamboot " << machinefile << endl; + return oss.str(); +} + +string MpiImpl_LAM::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute) +{ + ostringstream oss; + oss << "mpirun -np " << nbproc << " " << fileNameToExecute << endl; + return oss.str(); +} + +string MpiImpl_LAM::halt() +{ + ostringstream oss; + oss << "lamhalt" << endl; + return oss.str(); +} + +// mpich1 implementation +// Constructor +MpiImpl_MPICH1::MpiImpl_MPICH1() : MpiImpl() +{ +} + +// Destructor +MpiImpl_MPICH1::~MpiImpl_MPICH1() +{ + MESSAGE("MpiImpl_MPICH1 destructor"); +} + +string MpiImpl_MPICH1::size() +{ + throw SALOME_Exception("mpich1 doesn't work with this batch system to submit salome session"); +} + +string MpiImpl_MPICH1::rank() +{ + throw SALOME_Exception("mpich1 doesn't work with this batch system to submit salome session"); +} + +string MpiImpl_MPICH1::boot(const string machinefile, const unsigned int nbnodes) +{ + return ""; +} + +string MpiImpl_MPICH1::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute) +{ + ostringstream oss; + oss << "mpirun -machinefile " << machinefile << " -np " << nbproc << " " << fileNameToExecute << endl; + return oss.str(); +} + +string MpiImpl_MPICH1::halt() +{ + return ""; +} + +// mpich2 implementation +// Constructor +MpiImpl_MPICH2::MpiImpl_MPICH2() : MpiImpl() +{ +} + +// Destructor +MpiImpl_MPICH2::~MpiImpl_MPICH2() +{ + MESSAGE("MpiImpl_MPICH2 destructor"); +} + +string MpiImpl_MPICH2::size() +{ + return "${PMI_SIZE}"; +} + +string MpiImpl_MPICH2::rank() +{ + return "${PMI_RANK}"; +} + +string MpiImpl_MPICH2::boot(const string machinefile, const unsigned int nbnodes) +{ + ostringstream oss; + oss << "mpdboot -n " << nbnodes << " -f " << machinefile << endl; + return oss.str(); +} + +string MpiImpl_MPICH2::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute) +{ + ostringstream oss; + oss << "mpirun -np " << nbproc << " " << fileNameToExecute << endl; + return oss.str(); +} + +string MpiImpl_MPICH2::halt() +{ + ostringstream oss; + oss << "mpdallexit" << endl; + return oss.str(); +} + +// openmpi implementation +// Constructor +MpiImpl_OPENMPI::MpiImpl_OPENMPI() : MpiImpl() +{ +} + +// Destructor +MpiImpl_OPENMPI::~MpiImpl_OPENMPI() +{ + MESSAGE("MpiImpl_OPENMPI destructor"); +} + +string MpiImpl_OPENMPI::size() +{ + return "${OMPI_MCA_ns_nds_num_procs}"; +} + +string MpiImpl_OPENMPI::rank() +{ + return "${OMPI_MCA_ns_nds_vpid}"; +} + +string MpiImpl_OPENMPI::boot(const string machinefile, const unsigned int nbnodes) +{ + return ""; +} + +string MpiImpl_OPENMPI::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute) +{ + ostringstream oss; + oss << "mpirun -hostfile " << machinefile << " -np " << nbproc << " " << fileNameToExecute << endl; + return oss.str(); +} + +string MpiImpl_OPENMPI::halt() +{ + return ""; +} + diff --git a/src/Launcher/MpiImpl.hxx b/src/Launcher/MpiImpl.hxx new file mode 100644 index 000000000..beeac0301 --- /dev/null +++ b/src/Launcher/MpiImpl.hxx @@ -0,0 +1,131 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +/* + * BatchManager.hxx : + * + * Auteur : Bernard SECHER - CEA/DEN + * Date : Juillet 2007 + * Projet : SALOME + * + */ + +#ifndef _BL_MPIIMPL_H_ +#define _BL_MPIIMPL_H_ + +#include +#include "Utils_SALOME_Exception.hxx" +#include + +class MpiImpl +{ +public: + // Constructeur et destructeur + MpiImpl(); // constrcuctor + virtual ~MpiImpl(); //Destructor + + virtual std::string size() = 0; // get number of process of current job + virtual std::string rank() = 0; // get process number of current job + virtual std::string boot(const std::string machinefile, const unsigned int nbnodes) = 0; // get boot command + virtual std::string run(const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute) = 0; // get run command + virtual std::string halt() = 0; // get stop command + +protected: + +private: + +}; + +class MpiImpl_LAM : public MpiImpl +{ +public: + // Constructeur et destructeur + MpiImpl_LAM(); // constructor + virtual ~MpiImpl_LAM(); //Destructor + + std::string size(); // get number of process of current job + std::string rank(); // get process number of current job + std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command + std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command + std::string halt(); // get stop command + +protected: + +private: + +}; + +class MpiImpl_MPICH1 : public MpiImpl +{ +public: + // Constructeur et destructeur + MpiImpl_MPICH1(); // constructor + virtual ~MpiImpl_MPICH1(); //Destructor + + std::string size(); // get number of process of current job + std::string rank(); // get process number of current job + std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command + std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command + std::string halt(); // get stop command + +protected: + +private: + +}; + +class MpiImpl_MPICH2 : public MpiImpl +{ +public: + // Constructeur et destructeur + MpiImpl_MPICH2(); // constructor + virtual ~MpiImpl_MPICH2(); //Destructor + + std::string size(); // get number of process of current job + std::string rank(); // get process number of current job + std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command + std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command + std::string halt(); // get stop command + +protected: + +private: + +}; + +class MpiImpl_OPENMPI : public MpiImpl +{ +public: + // Constructeur et destructeur + MpiImpl_OPENMPI(); // constructor + virtual ~MpiImpl_OPENMPI(); //Destructor + + std::string size(); // get number of process of current job + std::string rank(); // get process number of current job + std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command + std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command + std::string halt(); // get stop command + +protected: + +private: + +}; + +#endif diff --git a/src/ModuleCatalog/SALOME_TestModuleCatalog.py b/src/ModuleCatalog/SALOME_TestModuleCatalog.py new file mode 100644 index 000000000..9f9245b0b --- /dev/null +++ b/src/ModuleCatalog/SALOME_TestModuleCatalog.py @@ -0,0 +1,82 @@ +# Copyright (C) 2005 OPEN CASCADE, CEA, EDF R&D, LEG +# PRINCIPIA R&D, EADS CCR, Lip6, BV, CEDRAT +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +import batchmode_salome +import SALOME_ModuleCatalog + +print +print "======================================================================" +print " XML Catalog file generation from idl file" +print "======================================================================" + +import os +os.system('runIDLparser -Wbcatalog=x \ + ${KERNEL_ROOT_DIR}/idl/salome/SALOME_TestModuleCatalog.idl') + +print "======================================================================" +print " Get Catalog " +print "======================================================================" +obj = batchmode_salome.naming_service.Resolve('Kernel/ModulCatalog') +catalog = obj._narrow(SALOME_ModuleCatalog.ModuleCatalog) +catalog.GetComponentList() + +print +print "======================================================================" +print " Import xml file " +print "======================================================================" +catalog.ImportXmlCatalogFile("x.xml") + +name = "AddComponent" +print +print "======================================================================" +print " Dump component <", name, "> " +print "======================================================================" +C = catalog.GetComponent(name) + +print "name : ", C._get_componentname() +print "username : ", C._get_componentusername() +print "type : ", C._get_component_type() +print "constraint : ", C._get_constraint() +print "icon : ", C._get_component_icone() + +for iL in C.GetInterfaceList(): + I = C.GetInterface(iL) + print "interface : ", I.interfacename + for S in I.interfaceservicelist: + print " service : ", S.ServiceName + print " ", len(S.ServiceinParameter), "in params : " + for iP in S.ServiceinParameter: + print ' ' + iP.Parametername + '(' + iP.Parametertype + ')' + pass + print " ", len(S.ServiceoutParameter), "out params : " + for iP in S.ServiceoutParameter: + print ' ' + iP.Parametername + '(' + iP.Parametertype + ')' + pass + print " ", len(S.ServiceinDataStreamParameter), "in datastream params : " + for iP in S.ServiceinDataStreamParameter: + print ' ' + iP.Parametername + '(' + str(iP.Parametertype) + ', ' + \ + str(iP.Parameterdependency) + ')' + pass + print " ", len(S.ServiceoutDataStreamParameter), "out datastream params : " + for iP in S.ServiceoutDataStreamParameter: + print ' ' + iP.Parametername + '(' + str(iP.Parametertype) + ', ' + \ + str(iP.Parameterdependency) + ')' + pass + pass + pass + diff --git a/src/Utils/SalomeString.hxx b/src/Utils/SalomeString.hxx new file mode 100644 index 000000000..eaee786cd --- /dev/null +++ b/src/Utils/SalomeString.hxx @@ -0,0 +1,63 @@ +// SALOME Utils : general SALOME's definitions and tools +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : SalomeString.hxx +// Module : SALOME + +# ifndef SALOME_STRING +# define SALOME_STRING + +#include "SALOME_Utils.hxx" + +# include +# include + +class UTILS_EXPORT SALOME_STRING : public string +{ +private : + ostringstream _s ; +public : + operator const char*() const + { + return _s.str().c_str() ; + } + SALOME_STRING() : _s() + { + } + template SALOME_STRING( const T &valeur ) : _s() + { + _s << valeur ; + } + template SALOME_STRING &operator<<( const T &valeur ) + { + _s << valeur ; + return *this ; + } +} ; + +// Exemple d'utilisation avec les exceptions SALOME +// SALOME_STRING msgErr; +// msgErr << "ESSAI::ESSAI() : This Object cannot be instanciated by now ! Try "<< 11 << "times just to see what happens "; +// throw SALOME_EXCEPTION (LOCALIZED(msgErr)) ; + +# endif diff --git a/src/Utils/Utils_SignalsHandler.h b/src/Utils/Utils_SignalsHandler.h new file mode 100644 index 000000000..a76ce46d8 --- /dev/null +++ b/src/Utils/Utils_SignalsHandler.h @@ -0,0 +1,50 @@ +// KERNEL Utils : common utils for KERNEL +// Copyright (C) 2003 CEA +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org + +#ifndef _UTILS_SIGNALSHANDLER_H_ +#define _UTILS_SIGNALSHANDLER_H_ + +#include "SALOME_Utils.hxx" + +#include +typedef void (*TSigHandler)(int); + + +class UTILS_EXPORT Utils_SignalsHandler{ + public: + Utils_SignalsHandler(); + ~Utils_SignalsHandler(); + + TSigHandler GetSigHandler(int theSigId); + TSigHandler SetSigHandler(int theSigId, TSigHandler theSigHandler); + typedef std::map TSigHandlerCont; + + private: + TSigHandlerCont mySigHandlerCont; +}; + + +class UTILS_EXPORT Utils_CASSignalsHandler: private Utils_SignalsHandler{ + public: + Utils_CASSignalsHandler(); +}; + + +#endif