Commit 39c57773 authored by Yann Garcia's avatar Yann Garcia
Browse files

Enhance LibCommon patch for TITAN

parent ff69ca9f
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -42,13 +42,12 @@ else
    git checkout devel
fi
cd ./ttcn/LibHttp
ln -sf module_its.mk module.mk
ln  module_its.mk module.mk

cd $BASE_PATH/ttcn/LibIts
git checkout devel

cd $BASE_PATH
cp ./ttcn/patch_lib_common_titan/module.mk ./ttcn/LibCommon/
cp ./ttcn/patch_lib_common_titan/ttcn/* ./ttcn/LibCommon/ttcn
ln ./ttcn/patch_lib_common_titan/module.mk ./ttcn/LibCommon/

exit 0
Compare 9087b6f1 to f77749f9
Original line number Diff line number Diff line
Subproject commit 9087b6f149ba8712c0d5ea2f90dfc87ddd9aafc4
Subproject commit f77749f9c72ea4111669f64b86fcc0971034e8ae
+4 −4
Original line number Diff line number Diff line
sources := \
    ttcn/LibCommon_AbstractData.ttcn \
    ttcn/LibCommon_BasicTypesAndValues.ttcn \
    ttcn/LibCommon_DataStrings.ttcn \
    ttcn/LibCommon_Sync.ttcn \
    ../patch_lib_common_titan/ttcn/LibCommon_AbstractData.ttcn \
    ../patch_lib_common_titan/ttcn/LibCommon_BasicTypesAndValues.ttcn \
    ../patch_lib_common_titan/ttcn/LibCommon_DataStrings.ttcn \
    ../patch_lib_common_titan/ttcn/LibCommon_Sync.ttcn \
    ttcn/LibCommon_TextStrings.ttcn \
    ttcn/LibCommon_Time.ttcn \
    ttcn/LibCommon_VerdictControl.ttcn 
+137 −0
Original line number Diff line number Diff line
/** 
 *  @author   ETSI
 *  @version  $URL$
 *            $Id$
 *  @desc     A collection of functions for abstract data types which may be
 *            useful in the implementation of any TTCN-3 test suite.
 *  @remark   End users should be aware that any changes made to the  in
 *            definitions this module may be overwritten in future releases.
 *            End users are encouraged to contact the distributers of this
 *            module regarding their modifications or additions so that future
 *            updates will include your changes.
 *  @copyright  ETSI Copyright Notification
 *                No part may be reproduced except as authorized by written permission.
 *                The copyright and the foregoing restriction extend to reproduction in all media.
 *                All rights reserved.
 *
 */
 module LibCommon_AbstractData {

  import from LibCommon_BasicTypesAndValues all;

  group stringStack {

    type record StringStack {
      UInt        stackSize,
      StringItems stringItems
    }

    type record of charstring StringItems;

    /**
     * @desc    Constant which can be used to initialize a
     *          string stack. A string stack can be intialized by
     *          assigning this value in the variable declariation.
     *          An alternative is to call the initlialization function.
     * @see     LibCommon_AbstractData.f_initStringStack
     * @remark  Note that an initlialized stack stack is not
     *          necessarily the same as an empty string stack.
     *          An empty tring stack as 0 zero elements but may
     *          have a non empty list of (empty) items.
     */
    const StringStack c_initStringStack := { 0, {} }

    /**
     * @desc    The invocation of this function will initialize
     *          a string stack to an empty string stack.
     *          An alternative is to initlialize a stack using a
     *          constant value.
     * @see     LibCommon_AbstractData.c_initStringStack
     * @param   p_stack String stack to be initialized.
     */
    function f_initStringStack ( inout StringStack p_stack ) {
      p_stack := c_initStringStack
    }

    /**
     * @desc    This function checks if a string stack is empty.
     * @param   p_stack String stack to be checked.
     * @return  true if empty, false if not empty
     */
    function f_isStringStackEmpty ( inout StringStack p_stack )
    return boolean {
      if ( p_stack.stackSize == 0 ) {return true}
      else {return false}
    }

    /**
     * @desc    This function checks if a given string is on the
     *          string stack.
     * @param   p_stack String stack where the string item
     *          is to be looked for.
     * @param   p_item  String to be checked for.
     * @return  true if found, false if not found
     */
    function f_isItemOnStringStack ( inout StringStack p_stack,
                       in    charstring  p_item )
    return boolean {
      var integer i;
      for (i := 0; i < p_stack.stackSize; i := i+1 ) {
        if ( p_stack.stringItems[i] == p_item ) {
          return true;
        }
      }
      return false;
    }

    /**
     * @desc    This function checks if a given string is on the
     *          string stack.
     * @param   p_stack String stack where the string item
     *          is to be looked for.
     * @param   p_item  String item on top of the stack.
     * @return  false if stack is empty, true otherwise
     */
    function f_peekStringStackTop ( inout StringStack p_stack,
                    out   charstring  p_item)
    return boolean {
      if (p_stack.stackSize == 0) {
        p_item := "f_peekTopStringStack: String stack is empty!";
        return false;
      }
      p_item := valueof(p_stack.stringItems[p_stack.stackSize-1]);
      return true;
    }


    /**
     * @desc    This function puts a string to the top of a
     *          string stack.
     * @param   p_stack String stack to which the string item
     *          is to be added.
     * @param   p_item  String to be added.
     */
    function f_pushStringStack ( inout StringStack p_stack,
                   in    charstring  p_item ) {
      p_stack.stringItems[p_stack.stackSize] := p_item;
      p_stack.stackSize := p_stack.stackSize + 1;
    }

    /**
     * @desc    This function removes the string from the top of a
     *          string stack. If the stack is empty nothing is done
     * @param   p_stack String stack from which the top string item
     *          is to be removed.
     */
    function f_popStringStack ( inout StringStack p_stack ) {
            if ( p_stack.stackSize > 0 ) {
        p_stack.stackSize := p_stack.stackSize-1;
        // "delete" top stack item to be safe
        // Note: due to record of index the "old top" is size-1!
        p_stack.stringItems[p_stack.stackSize] := "";
      }
    }

  } // end group stringStack

} // end module LibCommon_AbstractData
+1 −1
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@
module LibCommon_Sync {

  //Common
  import from LibCommon_BasicTypesAndValues { type UInt } ;
  import from LibCommon_BasicTypesAndValues all;
  import from LibCommon_AbstractData all;
  import from LibCommon_VerdictControl all;