<commit_before>// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/common/chrome_constants.h"

namespace chrome {
// The following should not be used for UI strings; they are meant
// for system strings only. UI changes should be made in the GRD.
const wchar_t kBrowserProcessExecutableName[] = L"chrome.exe";
#if defined(GOOGLE_CHROME_BUILD)
const wchar_t kBrowserAppName[] = L"Chrome";
const char    kStatsFilename[] = "ChromeStats";
#else
const wchar_t kBrowserAppName[] = L"Chromium";
const char    kStatsFilename[] = "ChromiumStats";
#endif
const wchar_t kExternalTabWindowClass[] = L"Chrome_ExternalTabContainer";
const wchar_t kMessageWindowClass[] = L"Chrome_MessageWindow";
const wchar_t kCrashReportLog[] = L"Reported Crashes.txt";
const wchar_t kTestingInterfaceDLL[] = L"testing_interface.dll";
const wchar_t kNotSignedInProfile[] = L"Default";
const wchar_t kNotSignedInID[] = L"not-signed-in";
const wchar_t kBrowserResourcesDll[] = L"chrome.dll";

// filenames
const wchar_t kArchivedHistoryFilename[] = L"Archived History";
const wchar_t kCacheDirname[] = L"Cache";
const wchar_t kChromePluginDataDirname[] = L"Plugin Data";
const wchar_t kCookieFilename[] = L"Cookies";
const wchar_t kHistoryFilename[] = L"History";
const wchar_t kLocalStateFilename[] = L"Local State";
const wchar_t kPreferencesFilename[] = L"Preferences";
const wchar_t kSafeBrowsingFilename[] = L"Safe Browsing";
const wchar_t kThumbnailsFilename[] = L"Thumbnails";
const wchar_t kUserDataDirname[] = L"User Data";
const wchar_t kWebDataFilename[] = L"Web Data";
const wchar_t kBookmarksFileName[] = L"Bookmarks";
const wchar_t kHistoryBookmarksFileName[] = L"Bookmarks From History";
const wchar_t kCustomDictionaryFileName[] = L"Custom Dictionary.txt";

// Note, this shouldn't go above 64.  See bug 535234.
const unsigned int kMaxRendererProcessCount = 20;
const int kStatsMaxThreads = 32;
const int kStatsMaxCounters = 300;

// We don't enable record mode in the released product because users could
// potentially be tricked into running a product in record mode without
// knowing it.  Enable in debug builds.  Playback mode is allowed always,
// because it is useful for testing and not hazardous by itself.
#ifndef NDEBUG
const bool kRecordModeEnabled = true;
#else
const bool kRecordModeEnabled = false;
#endif
}

<commit_msg>Rev stats file name to handle backwards incompatibility<commit_after>// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/common/chrome_constants.h"

namespace chrome {
// The following should not be used for UI strings; they are meant
// for system strings only. UI changes should be made in the GRD.
const wchar_t kBrowserProcessExecutableName[] = L"chrome.exe";
#if defined(GOOGLE_CHROME_BUILD)
const wchar_t kBrowserAppName[] = L"Chrome";
const char    kStatsFilename[] = "ChromeStats2";
#else
const wchar_t kBrowserAppName[] = L"Chromium";
const char    kStatsFilename[] = "ChromiumStats2";
#endif
const wchar_t kExternalTabWindowClass[] = L"Chrome_ExternalTabContainer";
const wchar_t kMessageWindowClass[] = L"Chrome_MessageWindow";
const wchar_t kCrashReportLog[] = L"Reported Crashes.txt";
const wchar_t kTestingInterfaceDLL[] = L"testing_interface.dll";
const wchar_t kNotSignedInProfile[] = L"Default";
const wchar_t kNotSignedInID[] = L"not-signed-in";
const wchar_t kBrowserResourcesDll[] = L"chrome.dll";

// filenames
const wchar_t kArchivedHistoryFilename[] = L"Archived History";
const wchar_t kCacheDirname[] = L"Cache";
const wchar_t kChromePluginDataDirname[] = L"Plugin Data";
const wchar_t kCookieFilename[] = L"Cookies";
const wchar_t kHistoryFilename[] = L"History";
const wchar_t kLocalStateFilename[] = L"Local State";
const wchar_t kPreferencesFilename[] = L"Preferences";
const wchar_t kSafeBrowsingFilename[] = L"Safe Browsing";
const wchar_t kThumbnailsFilename[] = L"Thumbnails";
const wchar_t kUserDataDirname[] = L"User Data";
const wchar_t kWebDataFilename[] = L"Web Data";
const wchar_t kBookmarksFileName[] = L"Bookmarks";
const wchar_t kHistoryBookmarksFileName[] = L"Bookmarks From History";
const wchar_t kCustomDictionaryFileName[] = L"Custom Dictionary.txt";

// Note, this shouldn't go above 64.  See bug 535234.
const unsigned int kMaxRendererProcessCount = 20;
const int kStatsMaxThreads = 32;
const int kStatsMaxCounters = 300;

// We don't enable record mode in the released product because users could
// potentially be tricked into running a product in record mode without
// knowing it.  Enable in debug builds.  Playback mode is allowed always,
// because it is useful for testing and not hazardous by itself.
#ifndef NDEBUG
const bool kRecordModeEnabled = true;
#else
const bool kRecordModeEnabled = false;
#endif
}

<|endoftext|>


<commit_before>/*
 *    _aaaa,  _aa.  sa,  aaa              _aaaa,_  ac  .aa.   .aa.  .aa,  _a, sa
 *  .wWV!!!T  |Wm;  dQ[  $WF            _mWT!"?Y  ]QE  :Q#:   ]QW[  :WWk. ]Q[ dW
 * .jWf       :WW: .dQ[  dQ[           .mW(       )WE  :Q#:  .mSQh. :mWQa.]W[ dQ
 * |QW:       :Wm;  mQ[  dQ[           ]Qk        )Qmi_aQW:  <B:$Qc :WBWQ()W[ dQ
 * |W#:  .ww  ;WW;  dQ[  dQ[  .......  ]Qk        )QB?YYW#:  jf ]Qp.:mE)Qm]Q[ )W
 * +WQ;  :Wm  |Wm; .mQ[  dQ[ :qgggggga ]Qm.       ]WE  :Q# :=QasuQm;:Wk 3QQW[ )Y
 *  ]Wmi.:Wm  +$Q; .mW(  dQ[  !"!!"!!^ dQk,  ._   ]WE  :Q# :3D"!!$Qc.Wk -$WQ[
 *   "?????? ` "?!=m?!   ??'            -??????!  -?!  -?? -?'   "?"-?"  "??' "?
 *
 * Copyright (c) 2004 darkbits                              Js_./
 * Per Larsson a.k.a finalman                          _RqZ{a<^_aa
 * Olof Naessn a.k.a jansem/yakslem                _asww7!uY`>  )\a//
 *                                                 _Qhm`] _f "'c  1!5m
 * Visit: http://guichan.darkbits.org             )Qk<P ` _: :+' .'  "{[
 *                                               .)j(] .d_/ '-(  P .   S
 * License: (BSD)                                <Td/Z <fP"5(\"??"\a.  .L
 * Redistribution and use in source and          _dV>ws?a-?'      ._/L  #'
 * binary forms, with or without                 )4d[#7r, .   '     )d`)[
 * modification, are permitted provided         _Q-5'5W..j/?'   -?!\)cam'
 * that the following conditions are met:       j<<WP+k/);.        _W=j f
 * 1. Redistributions of source code must       .$%w\/]Q  . ."'  .  mj$
 *    retain the above copyright notice,        ]E.pYY(Q]>.   a     J@\
 *    this list of conditions and the           j(]1u<sE"L,. .   ./^ ]{a
 *    following disclaimer.                     4'_uomm\.  )L);-4     (3=
 * 2. Redistributions in binary form must        )_]X{Z('a_"a7'<a"a,  ]"[
 *    reproduce the above copyright notice,       #}<]m7`Za??4,P-"'7. ).m
 *    this list of conditions and the            ]d2e)Q(<Q(  ?94   b-  LQ/
 *    following disclaimer in the                <B!</]C)d_, '(<' .f. =C+m
 *    documentation and/or other materials      .Z!=J ]e []('-4f _ ) -.)m]'
 *    provided with the distribution.          .w[5]' _[ /.)_-"+?   _/ <W"
 * 3. Neither the name of darkbits nor the     :$we` _! + _/ .        j?
 *    names of its contributors may be used     =3)= _f  (_yQmWW$#(    "
 *    to endorse or promote products derived     -   W,  sQQQQmZQ#Wwa]..
 *    from this software without specific        (js, \[QQW$QWW#?!V"".
 *    prior written permission.                    ]y:.<\..          .
 *                                                 -]n w/ '         [.
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT       )/ )/           !
 * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY         <  (; sac    ,    '
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING,               ]^ .-  %
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF            c <   r
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR            aga<  <La
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE          5%  )P'-3L
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR        _bQf` y`..)a
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,          ,J?4P'.P"_(\?d'.,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES               _Pa,)!f/<[]/  ?"
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT      _2-..:. .r+_,.. .
 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,     ?a.<%"'  " -'.a_ _,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION)                     ^
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef GCN_BASICCONTAINER_HPP
#define GCN_BASICCONTAINER_HPP

#include <list>
#include "guichan/graphics.hpp"
#include "guichan/widget.hpp"

namespace gcn
{
  /**
   * This is the container base class. Every container should
   * impement this class.
   *
   * @see Container
   */
  class BasicContainer: public Widget
  {
  public:

    virtual ~BasicContainer() { }

    /**
     * Move a widget to the top of the basic container. The effect
     * of this function is that the widget will be drawn above all
     * other widgets in the basic container.
     *
     * @param widget the widget to move.
     */
    virtual void moveToTop(Widget* widget) = 0;

    /**
     * Move a widget to the bottom of the basic container. The effect
     * of this function is that the widget will be drawn below all
     * other widgets in the basic container.
     *
     * @param widget the widget to move.
     */
    virtual void moveToBottom(Widget* widget) = 0;

    /**
     * Used to check how much space a widget gets to draw itself which is
     * not necessarily the same as the widgets width and height.
     *
     * NOTE: This function does not check the size recursively all the way
     *       back to the top widget. If the container itself is clipped,
     *       the size may be inaccurate.
     *
     * @param width the width the widget draw space has
     * @param height the height the widget draw space has
     * @param widget a pointer to the widget calling the function
     */
    virtual void getDrawSize(int& width, int& height, Widget* widget) = 0;

  }; // end BasicContainer

} // end gcn

#endif // end GCN_BASICCONTAINER_HPP
<commit_msg>Added _announseDeath<commit_after>/*
 *    _aaaa,  _aa.  sa,  aaa              _aaaa,_  ac  .aa.   .aa.  .aa,  _a, sa
 *  .wWV!!!T  |Wm;  dQ[  $WF            _mWT!"?Y  ]QE  :Q#:   ]QW[  :WWk. ]Q[ dW
 * .jWf       :WW: .dQ[  dQ[           .mW(       )WE  :Q#:  .mSQh. :mWQa.]W[ dQ
 * |QW:       :Wm;  mQ[  dQ[           ]Qk        )Qmi_aQW:  <B:$Qc :WBWQ()W[ dQ
 * |W#:  .ww  ;WW;  dQ[  dQ[  .......  ]Qk        )QB?YYW#:  jf ]Qp.:mE)Qm]Q[ )W
 * +WQ;  :Wm  |Wm; .mQ[  dQ[ :qgggggga ]Qm.       ]WE  :Q# :=QasuQm;:Wk 3QQW[ )Y
 *  ]Wmi.:Wm  +$Q; .mW(  dQ[  !"!!"!!^ dQk,  ._   ]WE  :Q# :3D"!!$Qc.Wk -$WQ[
 *   "?????? ` "?!=m?!   ??'            -??????!  -?!  -?? -?'   "?"-?"  "??' "?
 *
 * Copyright (c) 2004 darkbits                              Js_./
 * Per Larsson a.k.a finalman                          _RqZ{a<^_aa
 * Olof Naessn a.k.a jansem/yakslem                _asww7!uY`>  )\a//
 *                                                 _Qhm`] _f "'c  1!5m
 * Visit: http://guichan.darkbits.org             )Qk<P ` _: :+' .'  "{[
 *                                               .)j(] .d_/ '-(  P .   S
 * License: (BSD)                                <Td/Z <fP"5(\"??"\a.  .L
 * Redistribution and use in source and          _dV>ws?a-?'      ._/L  #'
 * binary forms, with or without                 )4d[#7r, .   '     )d`)[
 * modification, are permitted provided         _Q-5'5W..j/?'   -?!\)cam'
 * that the following conditions are met:       j<<WP+k/);.        _W=j f
 * 1. Redistributions of source code must       .$%w\/]Q  . ."'  .  mj$
 *    retain the above copyright notice,        ]E.pYY(Q]>.   a     J@\
 *    this list of conditions and the           j(]1u<sE"L,. .   ./^ ]{a
 *    following disclaimer.                     4'_uomm\.  )L);-4     (3=
 * 2. Redistributions in binary form must        )_]X{Z('a_"a7'<a"a,  ]"[
 *    reproduce the above copyright notice,       #}<]m7`Za??4,P-"'7. ).m
 *    this list of conditions and the            ]d2e)Q(<Q(  ?94   b-  LQ/
 *    following disclaimer in the                <B!</]C)d_, '(<' .f. =C+m
 *    documentation and/or other materials      .Z!=J ]e []('-4f _ ) -.)m]'
 *    provided with the distribution.          .w[5]' _[ /.)_-"+?   _/ <W"
 * 3. Neither the name of darkbits nor the     :$we` _! + _/ .        j?
 *    names of its contributors may be used     =3)= _f  (_yQmWW$#(    "
 *    to endorse or promote products derived     -   W,  sQQQQmZQ#Wwa]..
 *    from this software without specific        (js, \[QQW$QWW#?!V"".
 *    prior written permission.                    ]y:.<\..          .
 *                                                 -]n w/ '         [.
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT       )/ )/           !
 * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY         <  (; sac    ,    '
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING,               ]^ .-  %
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF            c <   r
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR            aga<  <La
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE          5%  )P'-3L
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR        _bQf` y`..)a
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,          ,J?4P'.P"_(\?d'.,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES               _Pa,)!f/<[]/  ?"
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT      _2-..:. .r+_,.. .
 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,     ?a.<%"'  " -'.a_ _,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION)                     ^
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef GCN_BASICCONTAINER_HPP
#define GCN_BASICCONTAINER_HPP

#include <list>
#include "guichan/graphics.hpp"
#include "guichan/widget.hpp"

namespace gcn
{
  /**
   * This is the container base class. Every container should
   * impement this class.
   *
   * @see Container
   */
  class BasicContainer: public Widget
  {
  public:

    virtual ~BasicContainer() { }

    /**
     * Move a widget to the top of the basic container. The effect
     * of this function is that the widget will be drawn above all
     * other widgets in the basic container.
     *
     * @param widget the widget to move.
     */
    virtual void moveToTop(Widget* widget) = 0;

    /**
     * Move a widget to the bottom of the basic container. The effect
     * of this function is that the widget will be drawn below all
     * other widgets in the basic container.
     *
     * @param widget the widget to move.
     */
    virtual void moveToBottom(Widget* widget) = 0;

    /**
     * Used to check how much space a widget gets to draw itself which is
     * not necessarily the same as the widgets width and height.
     *
     * NOTE: This function does not check the size recursively all the way
     *       back to the top widget. If the container itself is clipped,
     *       the size may be inaccurate.
     *
     * @param width the width the widget draw space has
     * @param height the height the widget draw space has
     * @param widget a pointer to the widget calling the function
     */
    virtual void getDrawSize(int& width, int& height, Widget* widget) = 0;

	  /**
	   * This function is automatically called by the containers children
	   * when they get destroyed.
	   *
	   * @param widget the destroyed widget
	   */
	  virtual void _announceDeath(Widget *widget) = 0;

  }; // end BasicContainer

} // end gcn

#endif // end GCN_BASICCONTAINER_HPP
<|endoftext|>


<commit_before>#include <iostream>
using namespace std;

//============implete a int Stack.==========
class intStack{
    private:
        int num[100];
        int length;
    public:
        void push(int i);
        int pop();
        intStack();
};

intStack::intStack(void){
    length=0;
}

void intStack::push(int i){
    if(length==100){
        cout << "intStack is full.\n";
    }else{
        num[length]=i;
        length++;
    }
}
int intStack::pop (){
    if(length==0){
        cout << "intStack is empty.\n";
        return -1;
    }
    return num[--length];
}

//============implete a int Stack.==========

//============MyString=========
class MyString{
    private:
        int length;
        char C[100];
    public:
        MyString();
        void debug();
        char* varC();
        void dump();
        void set(char *CC);
        void push(char CC);
        int getLength();
        char* getString();
        int find(MyString subject , int Start);

};
MyString::MyString(void){
    length=0;
}
void MyString::debug(){
    printf("length:%d\n" ,length);
    dump();
}
char* MyString::varC(){
    return C;
}
void MyString::dump(){
    for(int i=0; i<length; i++){
        printf("%c",C[i]);
    }
    printf("\n");
}

void MyString::push(char CC){
    C[length]=CC;
    length++;
}
int MyString::getLength(){
    return length;
}
char* MyString::getString(){
    char *tmp;
    tmp=C;
    tmp[length]='\n';
    return tmp;
}
int MyString::find(MyString subject ,int start) { // return found index , -1 means not found.
    int subi=0; //substring index
    bool found=false;
    char *subjectC=subject.varC();

    for(int stri=start; stri< this->getLength(); stri++){
        //scan every entry of C;
        if(found==true && subi==subject.getLength()){
            return stri-subject.getLength();
            // intStack.push(stri-subject.getLength());
        }else{
            if(C[stri]==subjectC[subi]){
                found=true;
                subi++;
            }else{
                found=false;
                subi=0;
            }
        }
    }
    return -1;
}
//==========MyString========
int main() {

    MyString S;
    cout << "Hello! Please input string S first>>";
    char tmp;
    while(scanf("%c" , &tmp)){
        if(tmp=='\n'){
            break;
        }else{
            S.push(tmp);
        }
    }

    cout << "(1) Frequency , (2) CharacterDelete , (3) Replacement , (other) for Break >>";

    char tmp2;
    scanf("%c" , &tmp);
    scanf("%c" , &tmp2);
    if (tmp=='1'){
        cout << "Please input string str which will find in S>>";
        MyString str;
        while(scanf("%c" , &tmp)){
            if(tmp=='\n'){
                break;
            }else{
                str.push(tmp);
            }
        }

        int start , retr , count;
        start = 0;
        count = -1;
        retr = 0;
        while(retr != -1){
            retr = S.find(str,start);
            start = retr+1;
            count++;
        }

        printf("Total occurrences : %d\n" , count);
    }else if(tmp=='2'){

    }else if(tmp=='3'){

    }

    return 0;
}

<commit_msg>2 done<commit_after>#include <iostream>
using namespace std;

//============implete a int Stack.==========
class intStack{
    private:
        int num[100];
        int length;
    public:
        void push(int i);
        int pop();
        intStack();
};

intStack::intStack(void){
    length=0;
}

void intStack::push(int i){
    if(length==100){
        cout << "intStack is full.\n";
    }else{
        num[length]=i;
        length++;
    }
}
int intStack::pop (){
    if(length==0){
        cout << "intStack is empty.\n";
        return -1;
    }
    return num[--length];
}

//============implete a int Stack.==========

//============MyString=========
class MyString{
    private:
        int length;
        char C[100];
    public:
        MyString();
        void debug();
        void clean();
        char* varC();
        void dump();
        void set(char *CC);
        void push(char CC);
        int getLength();
        char* getString();
        int find(MyString subject , int Start);
        void removeAt(int index , int length);
};
MyString::MyString(void){
    length=0;
}
void MyString::debug(){
    printf("length:%d\n" ,length);
    dump();
}
char* MyString::varC(){
    return C;
}
void MyString::dump(){
    for(int i=0; i<length; i++){
        printf("%c",C[i]);
    }
    printf("\n");
}
void MyString::clean(){
    for (int i = 0; i < 100; ++i){
        C[i]='\0';
    }
    length=0;
}
void MyString::push(char CC){
    C[length]=CC;
    length++;
}
int MyString::getLength(){
    return length;
}
char* MyString::getString(){
    char *tmp;
    tmp=C;
    tmp[length]='\n';
    return tmp;
}
int MyString::find(MyString subject ,int start) { // return found index , -1 means not found.
    int subi=0; //substring index
    bool found=false;
    char *subjectC=subject.varC();

    for(int stri=start; stri< this->getLength(); stri++){
        //scan every entry of C;
        if(found==true && subi==subject.getLength()){
            return stri-subject.getLength();
            // intStack.push(stri-subject.getLength());
        }else{
            if(C[stri]==subjectC[subi]){
                found=true;
                subi++;
            }else{
                found=false;
                subi=0;
            }
        }
    }
    return -1;
}
void MyString::removeAt(int index , int replength){
    char newS[100];
    int newLength;
    newLength = 0;
    for(int i=0 ; i<index ; i++){
        newS[newLength] = C[i];
        newLength ++;
    }
    for(int i=index+replength ; i<length ; i++){
        newS[newLength] = C[i];
        newLength ++;
    }
    this->clean();
    for (int i = 0; i < newLength; i++)
    {

        this->push(newS[i]);
    }
}

//==========MyString========
int main() {

    MyString S;
    cout << "Hello! Please input string S first>>";
    char tmp;
    while(scanf("%c" , &tmp)){
        if(tmp=='\n'){
            bre;
        }else{
            S.push(tmp);
        }
    }

    cout << "(1) Frequency , (2) CharacterDelete , (3) Replacement , (other) for Bre >>";

    char tmp2;
    scanf("%c" , &tmp);
    scanf("%c" , &tmp2);
    if (tmp=='1'){
        cout << "Please input string str which will find in S>>";
        MyString str;
        while(scanf("%c" , &tmp)){
            if(tmp=='\n'){
                bre;
            }else{
                str.push(tmp);
            }
        }

        int start , retr , count;
        start = 0;
        count = -1;
        retr = 0;
        while(retr != -1){
            retr = S.find(str,start);
            start = retr+1;
            count++;
        }

        printf("Total occurrences : %d\n" , count);
    }else if(tmp=='2'){

        cout << "Please input string str which will find in S>>";
        MyString str;
        while(scanf("%c" , &tmp)){
            if(tmp=='\n'){
                bre;
            }else{
                str.push(tmp);
            }
        }

        int start , retr , count;
        start = 0;
        retr = 0;
        count = 0;
        intStack intStack;
        while(retr != -1){
            retr = S.find(str,start);
            start = retr+1;
            if (retr != -1){
                intStack.push(retr);
                count++;
            }
        }

        for (int i = 0; i < count; i++){
            S.removeAt(intStack.pop() , str.getLength());
        }
        cout << S.getString();
        cout << "\n";
    }else if(tmp=='3'){

    }

    return 0;
}

<|endoftext|>


<commit_before>#include "singleapplication.h"
#include <cstdlib>

/**
 * @brief Constructor. Checks and fires up LocalServer or closes the
program
 * if another instance already exists
 * @param argc
 * @param argv
 */
SingleApplication::SingleApplication(int argc, char *argv[])
    : QApplication(argc, argv)
{
    QString serverName = QApplication::organizationName() +
QApplication::applicationName();
    serverName.replace(QRegExp("\\s"), "");

    // Attempt to connect to the LocalServer
    socket = new QLocalSocket();
    socket->connectToServer(serverName);
    if(socket->waitForConnected(1000)){
        socket->close();
        ::exit(EXIT_SUCCESS); // Terminate the program using STDLib's
exit function
    } else {
        // If the connection is insuccessful, this is the main process
        // So we create a Local Server
        server = new QLocalServer();
        server->removeServer(serverName);
        server->listen(serverName);
        QObject::connect(server, SIGNAL(newConnection()), this,
SLOT(slotConnectionEstablished()));
    }
}

/**
 * @brief Destructor
 */
SingleApplication::~SingleApplication()
{
    server->close();
}

/**
 * @brief Executed when the showUp command is sent to LocalServer
 */
void SingleApplication::slotConnectionEstablished()
{
    server->nextPendingConnection();
    emit showUp();
}

<commit_msg>Using Regex to remove invalid Filename Charecters<commit_after>#include "singleapplication.h"
#include <cstdlib>

/**
 * @brief Constructor. Checks and fires up LocalServer or closes the
program
 * if another instance already exists
 * @param argc
 * @param argv
 */
SingleApplication::SingleApplication(int argc, char *argv[])
    : QApplication(argc, argv)
{
    QString serverName = QApplication::organizationName() +
QApplication::applicationName();
    serverName.replace(QRegExp("[^\\w\\-. ]"), "");

    // Attempt to connect to the LocalServer
    socket = new QLocalSocket();
    socket->connectToServer(serverName);
    if(socket->waitForConnected(1000)){
        socket->close();
        ::exit(EXIT_SUCCESS); // Terminate the program using STDLib's
exit function
    } else {
        // If the connection is insuccessful, this is the main process
        // So we create a Local Server
        server = new QLocalServer();
        server->removeServer(serverName);
        server->listen(serverName);
        QObject::connect(server, SIGNAL(newConnection()), this,
SLOT(slotConnectionEstablished()));
    }
}

/**
 * @brief Destructor
 */
SingleApplication::~SingleApplication()
{
    server->close();
}

/**
 * @brief Executed when the showUp command is sent to LocalServer
 */
void SingleApplication::slotConnectionEstablished()
{
    server->nextPendingConnection();
    emit showUp();
}

<|endoftext|>


<commit_before>// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/common/chrome_constants.h"

#include "base/file_path.h"

#define FPL FILE_PATH_LITERAL

namespace chrome {

// The following should not be used for UI strings; they are meant
// for system strings only. UI changes should be made in the GRD.
#if defined(OS_WIN)
const wchar_t kBrowserProcessExecutableName[] = L"chrome.exe";
#elif defined(OS_LINUX)
const wchar_t kBrowserProcessExecutableName[] = L"chrome";
#elif defined(OS_MACOSX)
const wchar_t kBrowserProcessExecutableName[] =
#if defined(GOOGLE_CHROME_BUILD)
    L"Chrome";
#else
    L"Chromium";
#endif  // GOOGLE_CHROME_BUILD
#endif  // OS_*
#if defined(OS_WIN)
const wchar_t kBrowserProcessExecutablePath[] = L"chrome.exe";
#elif defined(OS_LINUX)
const wchar_t kBrowserProcessExecutablePath[] = L"chrome";
#elif defined(OS_MACOSX)
const wchar_t kBrowserProcessExecutablePath[] =
#if defined(GOOGLE_CHROME_BUILD)
    L"Chrome.app/Contents/MacOS/Chrome";
#else
    L"Chromium.app/Contents/MacOS/Chromium";
#endif  // GOOGLE_CHROME_BUILD
#endif  // OS_*
#if defined(GOOGLE_CHROME_BUILD)
const wchar_t kBrowserAppName[] = L"Chrome";
const char    kStatsFilename[] = "ChromeStats2";
#else
const wchar_t kBrowserAppName[] = L"Chromium";
const char    kStatsFilename[] = "ChromiumStats2";
#endif
const wchar_t kExternalTabWindowClass[] = L"Chrome_ExternalTabContainer";
const wchar_t kMessageWindowClass[] = L"Chrome_MessageWindow";
const wchar_t kCrashReportLog[] = L"Reported Crashes.txt";
const wchar_t kTestingInterfaceDLL[] = L"testing_interface.dll";
const wchar_t kNotSignedInProfile[] = L"Default";
const wchar_t kNotSignedInID[] = L"not-signed-in";
const wchar_t kBrowserResourcesDll[] = L"chrome.dll";
const FilePath::CharType kExtensionFileExtension[] = FPL("crx");

// filenames
const FilePath::CharType kArchivedHistoryFilename[] = FPL("Archived History");
const FilePath::CharType kCacheDirname[] = FPL("Cache");
const FilePath::CharType kMediaCacheDirname[] = FPL("Media Cache");
const FilePath::CharType kOffTheRecordMediaCacheDirname[] =
    FPL("Incognito Media Cache");
const wchar_t kChromePluginDataDirname[] = L"Plugin Data";
const FilePath::CharType kCookieFilename[] = FPL("Cookies");
const FilePath::CharType kExtensionsCookieFilename[] = FPL("Extension Cookies");
const FilePath::CharType kHistoryFilename[] = FPL("History");
const FilePath::CharType kLocalStateFilename[] = FPL("Local State");
const FilePath::CharType kPreferencesFilename[] = FPL("Preferences");
const FilePath::CharType kSafeBrowsingFilename[] = FPL("Safe Browsing");
// WARNING: SingletonSocket can't contain spaces, because otherwise
// chrome_process_util_linux would be broken.
const FilePath::CharType kSingletonSocketFilename[] = FPL("SingletonSocket");
const FilePath::CharType kThumbnailsFilename[] = FPL("Thumbnails");
const wchar_t kUserDataDirname[] = L"User Data";
const FilePath::CharType kUserScriptsDirname[] = FPL("User Scripts");
const FilePath::CharType kWebDataFilename[] = FPL("Web Data");
const FilePath::CharType kBookmarksFileName[] = FPL("Bookmarks");
const FilePath::CharType kHistoryBookmarksFileName[] =
    FPL("Bookmarks From History");
const FilePath::CharType kCustomDictionaryFileName[] =
    FPL("Custom Dictionary.txt");

// This number used to be limited to 32 in the past (see b/535234).
const unsigned int kMaxRendererProcessCount = 42;
const int kStatsMaxThreads = 32;
const int kStatsMaxCounters = 300;

// We don't enable record mode in the released product because users could
// potentially be tricked into running a product in record mode without
// knowing it.  Enable in debug builds.  Playback mode is allowed always,
// because it is useful for testing and not hazardous by itself.
#ifndef NDEBUG
const bool kRecordModeEnabled = true;
#else
const bool kRecordModeEnabled = false;
#endif

}  // namespace chrome
<commit_msg>Fixed on official app name used for unittests that I missed before. Review URL: http://codereview.chromium.org/115637<commit_after>// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/common/chrome_constants.h"

#include "base/file_path.h"

#define FPL FILE_PATH_LITERAL

namespace chrome {

// The following should not be used for UI strings; they are meant
// for system strings only. UI changes should be made in the GRD.
#if defined(OS_WIN)
const wchar_t kBrowserProcessExecutableName[] = L"chrome.exe";
#elif defined(OS_LINUX)
const wchar_t kBrowserProcessExecutableName[] = L"chrome";
#elif defined(OS_MACOSX)
const wchar_t kBrowserProcessExecutableName[] =
#if defined(GOOGLE_CHROME_BUILD)
    L"Chrome";
#else
    L"Chromium";
#endif  // GOOGLE_CHROME_BUILD
#endif  // OS_*
#if defined(OS_WIN)
const wchar_t kBrowserProcessExecutablePath[] = L"chrome.exe";
#elif defined(OS_LINUX)
const wchar_t kBrowserProcessExecutablePath[] = L"chrome";
#elif defined(OS_MACOSX)
const wchar_t kBrowserProcessExecutablePath[] =
#if defined(GOOGLE_CHROME_BUILD)
    L"Google Chrome.app/Contents/MacOS/Google Chrome";
#else
    L"Chromium.app/Contents/MacOS/Chromium";
#endif  // GOOGLE_CHROME_BUILD
#endif  // OS_*
#if defined(GOOGLE_CHROME_BUILD)
const wchar_t kBrowserAppName[] = L"Chrome";
const char    kStatsFilename[] = "ChromeStats2";
#else
const wchar_t kBrowserAppName[] = L"Chromium";
const char    kStatsFilename[] = "ChromiumStats2";
#endif
const wchar_t kExternalTabWindowClass[] = L"Chrome_ExternalTabContainer";
const wchar_t kMessageWindowClass[] = L"Chrome_MessageWindow";
const wchar_t kCrashReportLog[] = L"Reported Crashes.txt";
const wchar_t kTestingInterfaceDLL[] = L"testing_interface.dll";
const wchar_t kNotSignedInProfile[] = L"Default";
const wchar_t kNotSignedInID[] = L"not-signed-in";
const wchar_t kBrowserResourcesDll[] = L"chrome.dll";
const FilePath::CharType kExtensionFileExtension[] = FPL("crx");

// filenames
const FilePath::CharType kArchivedHistoryFilename[] = FPL("Archived History");
const FilePath::CharType kCacheDirname[] = FPL("Cache");
const FilePath::CharType kMediaCacheDirname[] = FPL("Media Cache");
const FilePath::CharType kOffTheRecordMediaCacheDirname[] =
    FPL("Incognito Media Cache");
const wchar_t kChromePluginDataDirname[] = L"Plugin Data";
const FilePath::CharType kCookieFilename[] = FPL("Cookies");
const FilePath::CharType kExtensionsCookieFilename[] = FPL("Extension Cookies");
const FilePath::CharType kHistoryFilename[] = FPL("History");
const FilePath::CharType kLocalStateFilename[] = FPL("Local State");
const FilePath::CharType kPreferencesFilename[] = FPL("Preferences");
const FilePath::CharType kSafeBrowsingFilename[] = FPL("Safe Browsing");
// WARNING: SingletonSocket can't contain spaces, because otherwise
// chrome_process_util_linux would be broken.
const FilePath::CharType kSingletonSocketFilename[] = FPL("SingletonSocket");
const FilePath::CharType kThumbnailsFilename[] = FPL("Thumbnails");
const wchar_t kUserDataDirname[] = L"User Data";
const FilePath::CharType kUserScriptsDirname[] = FPL("User Scripts");
const FilePath::CharType kWebDataFilename[] = FPL("Web Data");
const FilePath::CharType kBookmarksFileName[] = FPL("Bookmarks");
const FilePath::CharType kHistoryBookmarksFileName[] =
    FPL("Bookmarks From History");
const FilePath::CharType kCustomDictionaryFileName[] =
    FPL("Custom Dictionary.txt");

// This number used to be limited to 32 in the past (see b/535234).
const unsigned int kMaxRendererProcessCount = 42;
const int kStatsMaxThreads = 32;
const int kStatsMaxCounters = 300;

// We don't enable record mode in the released product because users could
// potentially be tricked into running a product in record mode without
// knowing it.  Enable in debug builds.  Playback mode is allowed always,
// because it is useful for testing and not hazardous by itself.
#ifndef NDEBUG
const bool kRecordModeEnabled = true;
#else
const bool kRecordModeEnabled = false;
#endif

}  // namespace chrome
<|endoftext|>


<commit_before>/*=========================================================================

  Program:   Visualization Toolkit
  Module:    TestGLUTRenderWindow.cxx

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
// This example tests the vtkRenderingExternal module by drawing a GLUT window
// and rendering a VTK sphere in it. The test also demonstrates the use of
// PreserveColorBuffer and PreserveDepthBuffer flags on the
// vtkExternalOpenGLRenderer by drawing a GL_TRIANGLE in the scene before
// drawing the vtk sphere.

// OpenGL includes
#include <GL/glut.h>

// STD includes
#include <iostream>

#include <vtkActor.h>
#include <vtkCamera.h>
#include <vtkExternalOpenGLRenderer.h>
#include <vtkExternalOpenGLRenderWindow.h>
#include <vtkNew.h>
#include <vtkPolyDataMapper.h>
#include <vtkSphereSource.h>
#include <vtkTesting.h>

// Global variables used by the glutDisplayFunc and glutIdleFunc
vtkNew<vtkExternalOpenGLRenderer> ren;
vtkNew<vtkExternalOpenGLRenderWindow> renWin;
bool initilaized = false;
int NumArgs;
char** ArgV;

/* Handler for window-repaint event. Call back when the window first appears and
   whenever the window needs to be re-painted. */
void display()
{
  if (!initilaized)
    {
    renWin->SetSize(400,400);
    renWin->AddRenderer(ren.GetPointer());
    vtkNew<vtkPolyDataMapper> mapper;
    vtkNew<vtkActor> actor;
    actor->SetMapper(mapper.GetPointer());
    ren->AddActor(actor.GetPointer());
    vtkNew<vtkSphereSource> ss;
    ss->SetRadius(0.1);
    mapper->SetInputConnection(ss->GetOutputPort());
    initilaized = true;
    }

  glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // Set background color to black and opaque
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear the color buffer

  glBegin(GL_TRIANGLES);
    glVertex3f(-1.5,-1.5,0.0);
    glVertex3f(1.5,0.0,0.0);
    glVertex3f(0.0,1.5,1.0);
  glEnd();
  glutSwapBuffers();
  glFlush();  // Render now

  GLdouble mv[16],p[16];
  glGetDoublev(GL_MODELVIEW_MATRIX,mv);
  glGetDoublev(GL_PROJECTION_MATRIX,p);
  renWin->SetSize(glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT));
  renWin->Render();
}

void test()
{
  vtkTesting* t = vtkTesting::New();
  for(int cc = 1; cc < NumArgs; cc++)
    {
    t->AddArgument(ArgV[cc]);
    }
  t->SetRenderWindow(renWin.GetPointer());
  int retVal = t->RegressionTest(0);
  t->Delete();
  // Exit out of the infinitely running loop
  exit(!retVal);
}

/* Main function: GLUT runs as a console application starting at main()  */
int TestGLUTRenderWindow(int argc, char** argv)
{
  NumArgs = argc;
  ArgV = argv;
  glutInit(&argc, argv);                 // Initialize GLUT
  glutInitWindowSize(400, 400);   // Set the window's initial width & height
  glutInitWindowPosition(0, 0); // Position the window's initial top-left corner
  glutCreateWindow("VTK External Window Test"); // Create a window with the given title
  glutDisplayFunc(display); // Register display callback handler for window re-paint
  glutIdleFunc(test); // Register test callback handler for vtkTesting
  glutMainLoop();           // Enter the infinitely event-processing loop
  return 0;
}
<commit_msg>Fix GLUT API include header for Mac OSX and Windows<commit_after>/*=========================================================================

  Program:   Visualization Toolkit
  Module:    TestGLUTRenderWindow.cxx

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
// This example tests the vtkRenderingExternal module by drawing a GLUT window
// and rendering a VTK sphere in it. The test also demonstrates the use of
// PreserveColorBuffer and PreserveDepthBuffer flags on the
// vtkExternalOpenGLRenderer by drawing a GL_TRIANGLE in the scene before
// drawing the vtk sphere.

// GLUT includes
#if defined(__APPLE__)
# include <GLUT/glut.h> // Include GLUT API.
#else
# include "vtkWindows.h" // Needed to include OpenGL header on Windows.
# include <GL/glut.h> // Include GLUT API.
#endif

// STD includes
#include <iostream>

#include <vtkActor.h>
#include <vtkCamera.h>
#include <vtkExternalOpenGLRenderer.h>
#include <vtkExternalOpenGLRenderWindow.h>
#include <vtkNew.h>
#include <vtkPolyDataMapper.h>
#include <vtkSphereSource.h>
#include <vtkTesting.h>

// Global variables used by the glutDisplayFunc and glutIdleFunc
vtkNew<vtkExternalOpenGLRenderer> ren;
vtkNew<vtkExternalOpenGLRenderWindow> renWin;
bool initilaized = false;
int NumArgs;
char** ArgV;

/* Handler for window-repaint event. Call back when the window first appears and
   whenever the window needs to be re-painted. */
void display()
{
  if (!initilaized)
    {
    renWin->SetSize(400,400);
    renWin->AddRenderer(ren.GetPointer());
    vtkNew<vtkPolyDataMapper> mapper;
    vtkNew<vtkActor> actor;
    actor->SetMapper(mapper.GetPointer());
    ren->AddActor(actor.GetPointer());
    vtkNew<vtkSphereSource> ss;
    ss->SetRadius(0.1);
    mapper->SetInputConnection(ss->GetOutputPort());
    initilaized = true;
    }

  glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // Set background color to black and opaque
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear the color buffer

  glBegin(GL_TRIANGLES);
    glVertex3f(-1.5,-1.5,0.0);
    glVertex3f(1.5,0.0,0.0);
    glVertex3f(0.0,1.5,1.0);
  glEnd();
  glutSwapBuffers();
  glFlush();  // Render now

  GLdouble mv[16],p[16];
  glGetDoublev(GL_MODELVIEW_MATRIX,mv);
  glGetDoublev(GL_PROJECTION_MATRIX,p);
  renWin->SetSize(glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT));
  renWin->Render();
}

void test()
{
  vtkTesting* t = vtkTesting::New();
  for(int cc = 1; cc < NumArgs; cc++)
    {
    t->AddArgument(ArgV[cc]);
    }
  t->SetRenderWindow(renWin.GetPointer());
  int retVal = t->RegressionTest(0);
  t->Delete();
  // Exit out of the infinitely running loop
  exit(!retVal);
}

/* Main function: GLUT runs as a console application starting at main()  */
int TestGLUTRenderWindow(int argc, char** argv)
{
  NumArgs = argc;
  ArgV = argv;
  glutInit(&argc, argv);                 // Initialize GLUT
  glutInitWindowSize(400, 400);   // Set the window's initial width & height
  glutInitWindowPosition(0, 0); // Position the window's initial top-left corner
  glutCreateWindow("VTK External Window Test"); // Create a window with the given title
  glutDisplayFunc(display); // Register display callback handler for window re-paint
  glutIdleFunc(test); // Register test callback handler for vtkTesting
  glutMainLoop();           // Enter the infinitely event-processing loop
  return 0;
}
<|endoftext|>


<commit_before>/*
For more information, please see: http://software.sci.utah.edu

The MIT License

Copyright (c) 2012 Scientific Computing and Imaging Institute,
University of Utah.

License for the specific language governing rights and limitations under
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/

#include <Modules/Factory/ModuleDescriptionLookup.h>
#include <Modules/Basic/ReceiveScalar.h>
#include <Modules/Basic/SendScalar.h>
#include <Modules/Basic/ReceiveTestMatrix.h>
#include <Modules/Basic/SendTestMatrix.h>
#include <Modules/Basic/DynamicPortTester.h>
#include <Modules/Legacy/Bundle/GetFieldsFromBundle.h>
#include <Modules/Legacy/Bundle/GetMatricesFromBundle.h>
#include <Modules/Legacy/Bundle/InsertFieldsIntoBundle.h>
#include <Modules/Legacy/Bundle/InsertMatricesIntoBundle.h>
#include <Modules/Legacy/Fields/SplitFieldByDomain.h>
#include <Modules/Basic/PrintDatatype.h>
#include <Modules/Math/EvaluateLinearAlgebraUnary.h>
#include <Modules/Math/EvaluateLinearAlgebraBinary.h>
#include <Modules/Math/ReportMatrixInfo.h>
#include <Modules/Math/AppendMatrix.h>
#include <Modules/Math/CreateMatrix.h>
#include <Modules/Math/GetMatrixSlice.h>
#include <Modules/Math/SolveLinearSystem.h>
#include <Modules/Fields/ReportFieldInfo.h>
#include <Modules/Fields/EditMeshBoundingBox.h>
#include <Modules/Legacy/Fields/CreateLatVol.h>
#include <Modules/Legacy/Fields/GetFieldBoundary.h>
#include <Modules/Legacy/Fields/CalculateSignedDistanceToField.h>
#include <Modules/Legacy/Fields/CalculateGradients.h>
#include <Modules/Legacy/Fields/ConvertQuadSurfToTriSurf.h>
#include <Modules/Legacy/Fields/AlignMeshBoundingBoxes.h>
#include <Modules/Legacy/Fields/GetFieldNodes.h>
#include <Modules/Legacy/Fields/SetFieldNodes.h>
#include <Modules/Legacy/Fields/GetDomainBoundary.h>
#include <Modules/Legacy/Fields/JoinFields.h>
#include <Modules/Legacy/Fields/SplitFieldByDomain.h>
#include <Modules/Legacy/Fields/CreateFieldData.h>
#include <Modules/Legacy/Fields/CalculateFieldData5.h>
#include <Modules/Legacy/Fields/SplitFieldByDomain.h>
#include <Modules/Legacy/Fields/GetFieldData.h>
#include <Modules/Legacy/Fields/SetFieldData.h>
#include <Modules/Legacy/Fields/ResampleRegularMesh.h>
#include <Modules/Legacy/Fields/FairMesh.h>
#ifdef WITH_TETGEN
#include <Modules/Legacy/Fields/InterfaceWithTetGen.h>
#endif
#include <Modules/Legacy/Fields/BuildMappingMatrix.h>
#include <Modules/Legacy/Fields/ConvertFieldBasis.h>
#include <Modules/Legacy/Fields/ScaleFieldMeshAndData.h>
#include <Modules/Legacy/Fields/ProjectPointsOntoMesh.h>
#include <Modules/Legacy/Fields/CalculateDistanceToField.h>
#include <Modules/Legacy/Fields/CalculateDistanceToFieldBoundary.h>
#include <Modules/Legacy/Fields/MapFieldDataOntoElems.h>
#include <Modules/Legacy/Fields/MapFieldDataOntoNodes.h>
#include <Modules/Legacy/Fields/ClipFieldByFunction3.h>
#include <Modules/Legacy/Fields/MapFieldDataFromSourceToDestination.h>
#include <Modules/Legacy/Fields/RefineMesh.h>
#include <Modules/Legacy/Fields/SetFieldDataToConstantValue.h>
#include <Modules/Legacy/Fields/FlipSurfaceNormals.h>
#include <Modules/Legacy/Fields/SwapFieldDataWithMatrixEntries.h>
#include <Modules/Legacy/Fields/BuildMatrixOfSurfaceNormals.h>
#include <Modules/Legacy/Fields/ConvertIndicesToFieldData.h>
#include <Modules/Legacy/Math/SolveMinNormLeastSqSystem.h>
#include <Modules/Legacy/Math/BuildNoiseColumnMatrix.h>
#include <Modules/Legacy/Matlab/DataIO/ImportDatatypesFromMatlab.h>
#include <Modules/Legacy/FiniteElements/ApplyFEMCurrentSource.h>
#include <Modules/Legacy/Forward/BuildBEMatrix.h>
#include <Modules/Legacy/Inverse/SolveInverseProblemWithTikhonov.h>
#include <Modules/Legacy/Inverse/BuildSurfaceLaplacianMatrix.h>
#include <Modules/DataIO/ReadMatrix.h>
#include <Modules/DataIO/ReadMatrixClassic.h>
#include <Modules/DataIO/WriteMatrix.h>
#include <Modules/DataIO/ReadField.h>
#include <Modules/DataIO/WriteField.h>
#include <Modules/String/CreateString.h>
#include <Modules/String/NetworkNotes.h>
#include <Modules/Visualization/ShowString.h>
#include <Modules/Visualization/ShowField.h>
#include <Modules/Visualization/CreateBasicColorMap.h>
#include <Modules/FiniteElements/TDCSSimulator.h>
#include <Modules/Render/ViewScene.h>
#include <Modules/Legacy/FiniteElements/BuildFEMatrix.h>
#include <Modules/Basic/AsyncPortTestModule.h>
#include <Modules/Basic/NeedToExecuteTester.h>
//#include <Modules/Fields/@ModuleName@.h>

using namespace SCIRun::Dataflow::Networks;
using namespace SCIRun::Modules::Factory;
using namespace SCIRun::Modules::Bundles;
using namespace SCIRun::Modules::Fields;
using namespace SCIRun::Modules::Basic;
using namespace SCIRun::Modules::Math;
using namespace SCIRun::Modules::FiniteElements;
using namespace SCIRun::Modules::Forward;
using namespace SCIRun::Modules::Inverse;
using namespace SCIRun::Modules::DataIO;
using namespace SCIRun::Modules::Matlab::DataIO;
using namespace SCIRun::Modules::StringProcessing;
using namespace SCIRun::Modules::Visualization;
using namespace SCIRun::Modules::Render;

void ModuleDescriptionLookup::addEssentialModules()
{
  //addModuleDesc<ReadMatrixModule>("ReadMatrix", "DataIO", "SCIRun", "Functional, needs GUI and algorithm work.", "...");
  addModuleDesc<ReadMatrix>("ReadMatrix", "DataIO", "SCIRun", "Redo of ReadMatrix", "...");
  addModuleDesc<WriteMatrixModule>("WriteMatrix", "DataIO", "SCIRun", "Functional, outputs text files or binary .mat only.", "...");
  addModuleDesc<ReadFieldModule>("ReadField", "DataIO", "SCIRun", "Functional, needs GUI and algorithm work.", "...");
  addModuleDesc<WriteFieldModule>("WriteField", "DataIO", "SCIRun", "Functional, outputs binary .fld only.", "...");
  addModuleDesc<PrintDatatypeModule>("PrintDatatype", "String", "SCIRun", "...", "...");
  addModuleDesc<ReportMatrixInfoModule>("ReportMatrixInfo", "Math", "SCIRun", "Functional, needs GUI work.", "...");
  addModuleDesc<ReportFieldInfoModule>("ReportFieldInfo", "MiscField", "SCIRun", "Same as v4", "...");
  addModuleDesc<AppendMatrixModule>("AppendMatrix", "Math", "SCIRun", "Fully functional.", "...");
  addModuleDesc<EvaluateLinearAlgebraUnaryModule>("EvaluateLinearAlgebraUnary", "Math", "SCIRun", "Partially functional, needs GUI work.", "...");
  addModuleDesc<EvaluateLinearAlgebraBinaryModule>("EvaluateLinearAlgebraBinary", "Math", "SCIRun", "Partially functional, needs GUI work.", "...");
  addModuleDesc<CreateMatrixModule>("CreateMatrix", "Math", "SCIRun", "Functional, needs GUI work.", "...");
  addModuleDesc<SolveLinearSystemModule>("SolveLinearSystem", "Math", "SCIRun", "Four multi-threaded algorithms available.", "...");
  addModuleDesc<CreateStringModule>("CreateString", "String", "SCIRun", "Functional, needs GUI work.", "...");
	addModuleDesc<NetworkNotesModule>("NetworkNotes", "String", "SCIRun", "Functional, needs GUI work.", "...");
  //addModuleDesc<ShowStringModule>("ShowString", "String", "SCIRun", "...", "...");
  addModuleDesc<ShowFieldModule>("Some basic options available, still work in progress.", "...");
  addModuleDesc<CreateLatVol>("CreateLatVol", "NewField", "SCIRun", "Official ported v4 module.", "...");
  addModuleDesc<ViewScene>("Can display meshes and fields, pan/rotate/zoom.", "...");

  addModuleDesc<GetFieldBoundary>("GetFieldBoundary", "NewField", "SCIRun", "First real ported module", "...");
  addModuleDesc<CalculateSignedDistanceToField>("CalculateSignedDistanceToField", "ChangeFieldData", "SCIRun", "Second real ported module", "...");
  addModuleDesc<CalculateGradients>("CalculateGradients", "ChangeFieldData", "SCIRun", "Real ported module", "...");
  addModuleDesc<ConvertQuadSurfToTriSurf>("ConvertQuadSurfToTriSurf", "ChangeMesh", "SCIRun", "Real ported module", "...");
	addModuleDesc<AlignMeshBoundingBoxes>("AlignMeshBoundingBoxes", "ChangeMesh", "SCIRun", "Real ported module", "...");
  addModuleDesc<GetFieldNodes>("GetFieldNodes", "ChangeMesh", "SCIRun", "Real ported module", "...");
  addModuleDesc<SetFieldNodes>("SetFieldNodes", "ChangeMesh", "SCIRun", "Real ported module", "...");
  //addModuleDesc<TDCSSimulatorModule>("tDCSSimulator", "FiniteElements", "SCIRun", "Dummy module for design purposes", "...");
  addModuleDesc<SolveMinNormLeastSqSystem>("SolveMinNormLeastSqSystem", "Math", "SCIRun", "Real ported module", "...");
  addModuleDesc<CreateBasicColorMap>("CreateStandardColorMap", "Visualization", "SCIRun", "In progress: two color maps available", "...");
  addModuleDesc<GetDomainBoundary>("Real ported module: Many bugs and UI logic issues", "...");
  addModuleDesc<JoinFields>("Real ported module: Many bugs and UI logic issues", "...");
  addModuleDesc<CreateFieldData>("Real ported module", "...");
  addModuleDesc<CalculateFieldData>("Real ported module", "...");
	addModuleDesc<SwapFieldDataWithMatrixEntries>("SwapFieldDataWithMatrixEntires","...");
  addModuleDesc<BuildFEMatrix>("BuildFEMatrix", "FiniteElements", "SCIRun", "In progress: main path through code works", "Generates stiffness matrix ");
  addModuleDesc<BuildBEMatrix>("Real ported module", "...");
  addModuleDesc<ResampleRegularMesh>("Real ported module", "...");
  addModuleDesc<FairMesh>("Real ported module", "...");
  //TODO: incomplete impl
  //addModuleDesc<ConvertFieldBasis>("NOT WORKING YET--Real ported module", "...");
  //addModuleDesc<ScaleFieldMeshAndData>("NOT WORKING YET--Real ported module", "...");
  addModuleDesc<ProjectPointsOntoMesh>("Real ported module", "...");
  addModuleDesc<ApplyFEMCurrentSource>("Real ported module", "...");
  #ifdef WITH_TETGEN
  addModuleDesc<InterfaceWithTetGen>("Real ported module", "...");
  #endif
  addModuleDesc<CalculateDistanceToField>("Real ported module", "...");
  addModuleDesc<CalculateDistanceToFieldBoundary>("Real ported module", "...");
  addModuleDesc<MapFieldDataOntoNodes>("Real ported module", "...");
  addModuleDesc<MapFieldDataOntoElements>("Real ported module", "...");
  addModuleDesc<ClipFieldByFunction>("In progress", "...");
  addModuleDesc<MapFieldDataFromSourceToDestination>("Real ported module", "...");
  addModuleDesc<GetMatrixSlice>("New module based on GetRowOrColumnFromMatrix", "...");
	addModuleDesc<RefineMesh>("RefineMesh","ChangeMesh", "SCIRun", "Real ported module", "...");
  addModuleDesc<SetFieldDataToConstantValue>("Real ported module", "...");
	addModuleDesc<BuildMatrixOfSurfaceNormals>("Real ported module", "...");
  addModuleDesc<BuildMappingMatrix>("Real ported module", "...");
  //addModuleDesc<ImportDatatypesFromMatlab>("Improved version of Matlab importer", "work in progress"); //not ready yet
  addModuleDesc<FlipSurfaceNormals>("FlipSurfaceNormals","ChangeMesh","SCIRun","...","...");
  addModuleDesc<BuildNoiseColumnMatrix>("BuildNoiseColumnMatrix", "Math", "SCIRun", "...", "...");
  addModuleDesc<EditMeshBoundingBox>("Rewrite", "...");
  addModuleDesc<ConvertIndicesToFieldData>("Real ported module", "...");
  addModuleDesc<SolveInverseProblemWithTikhonov>("...", "...");
  addModuleDesc<BuildSurfaceLaplacianMatrix>("BuildSurfaceLaplacianMatrix","Inverse","BioPSE","...","...");

  // insert module desc here
}

void ModuleDescriptionLookup::addBundleModules()
{
  //addModuleDesc<GetMatricesFromBundle>("Real ported module: improved UI", "...");
  //addModuleDesc<InsertMatricesIntoBundle>("Real ported module: improved UI", "...");
  //TODO: incomplete impl
  //addModuleDesc<GetFieldsFromBundle>("Real ported module: improved UI", "...");
  //addModuleDesc<InsertFieldsIntoBundle>("Real ported module: improved UI", "...");
  addModuleDesc<SplitFieldByDomain>("Real ported module", "...");
}

void ModuleDescriptionLookup::addTestingModules()
{
  addModuleDesc<SendScalarModule>("SendScalar", "Testing", "SCIRun", "Functional, needs GUI and algorithm work.", "...");
  addModuleDesc<ReceiveScalarModule>("ReceiveScalar", "Testing", "SCIRun", "...", "...");
  addModuleDesc<SendTestMatrixModule>("SendTestMatrix", "Testing", "SCIRun", "...", "...");
  addModuleDesc<ReceiveTestMatrixModule>("ReceiveTestMatrix", "Testing", "SCIRun", "...", "...");
  addModuleDesc<DynamicPortTester>("DynamicPortTester", "Testing", "SCIRun", "...", "...");
  addModuleDesc<AsyncPortTestModule>("...", "ViewScene clone");
  addModuleDesc<NeedToExecuteTester>("...", "...");
}
<commit_msg>Changing ModuleFacotyImpl1.cc so it matches with upstream/master.<commit_after>/*
For more information, please see: http://software.sci.utah.edu
The MIT License
Copyright (c) 2012 Scientific Computing and Imaging Institute,
University of Utah.
License for the specific language governing rights and limitations under
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/

#include <Modules/Factory/ModuleDescriptionLookup.h>
#include <Modules/Basic/ReceiveScalar.h>
#include <Modules/Basic/SendScalar.h>
#include <Modules/Basic/ReceiveTestMatrix.h>
#include <Modules/Basic/SendTestMatrix.h>
#include <Modules/Basic/DynamicPortTester.h>
#include <Modules/Legacy/Bundle/GetFieldsFromBundle.h>
#include <Modules/Legacy/Bundle/GetMatricesFromBundle.h>
#include <Modules/Legacy/Bundle/InsertFieldsIntoBundle.h>
#include <Modules/Legacy/Bundle/InsertMatricesIntoBundle.h>
#include <Modules/Legacy/Fields/SplitFieldByDomain.h>
#include <Modules/Basic/PrintDatatype.h>
#include <Modules/Math/EvaluateLinearAlgebraUnary.h>
#include <Modules/Math/EvaluateLinearAlgebraBinary.h>
#include <Modules/Math/ReportMatrixInfo.h>
#include <Modules/Math/AppendMatrix.h>
#include <Modules/Math/CreateMatrix.h>
#include <Modules/Math/GetMatrixSlice.h>
#include <Modules/Math/SolveLinearSystem.h>
#include <Modules/Fields/ReportFieldInfo.h>
#include <Modules/Fields/EditMeshBoundingBox.h>
#include <Modules/Legacy/Fields/CreateLatVol.h>
#include <Modules/Legacy/Fields/GetFieldBoundary.h>
#include <Modules/Legacy/Fields/CalculateSignedDistanceToField.h>
#include <Modules/Legacy/Fields/CalculateGradients.h>
#include <Modules/Legacy/Fields/ConvertQuadSurfToTriSurf.h>
#include <Modules/Legacy/Fields/AlignMeshBoundingBoxes.h>
#include <Modules/Legacy/Fields/GetFieldNodes.h>
#include <Modules/Legacy/Fields/SetFieldNodes.h>
#include <Modules/Legacy/Fields/GetDomainBoundary.h>
#include <Modules/Legacy/Fields/JoinFields.h>
#include <Modules/Legacy/Fields/SplitFieldByDomain.h>
#include <Modules/Legacy/Fields/CreateFieldData.h>
#include <Modules/Legacy/Fields/CalculateFieldData5.h>
#include <Modules/Legacy/Fields/SplitFieldByDomain.h>
#include <Modules/Legacy/Fields/GetFieldData.h>
#include <Modules/Legacy/Fields/SetFieldData.h>
#include <Modules/Legacy/Fields/ResampleRegularMesh.h>
#include <Modules/Legacy/Fields/FairMesh.h>
#ifdef WITH_TETGEN
#include <Modules/Legacy/Fields/InterfaceWithTetGen.h>
#endif
#include <Modules/Legacy/Fields/BuildMappingMatrix.h>
#include <Modules/Legacy/Fields/ConvertFieldBasis.h>
#include <Modules/Legacy/Fields/ScaleFieldMeshAndData.h>
#include <Modules/Legacy/Fields/ProjectPointsOntoMesh.h>
#include <Modules/Legacy/Fields/CalculateDistanceToField.h>
#include <Modules/Legacy/Fields/CalculateDistanceToFieldBoundary.h>
#include <Modules/Legacy/Fields/MapFieldDataOntoElems.h>
#include <Modules/Legacy/Fields/MapFieldDataOntoNodes.h>
#include <Modules/Legacy/Fields/ClipFieldByFunction3.h>
#include <Modules/Legacy/Fields/MapFieldDataFromSourceToDestination.h>
#include <Modules/Legacy/Fields/RefineMesh.h>
#include <Modules/Legacy/Fields/SetFieldDataToConstantValue.h>
#include <Modules/Legacy/Fields/FlipSurfaceNormals.h>
#include <Modules/Legacy/Fields/SwapFieldDataWithMatrixEntries.h>
#include <Modules/Legacy/Fields/BuildMatrixOfSurfaceNormals.h>
#include <Modules/Legacy/Fields/ConvertIndicesToFieldData.h>
#include <Modules/Legacy/Math/SolveMinNormLeastSqSystem.h>
#include <Modules/Legacy/Math/BuildNoiseColumnMatrix.h>
#include <Modules/Legacy/Math/ComputeSVD.h>
#include <Modules/Legacy/Matlab/DataIO/ImportDatatypesFromMatlab.h>
#include <Modules/Legacy/FiniteElements/ApplyFEMCurrentSource.h>
#include <Modules/Legacy/Forward/BuildBEMatrix.h>
#include <Modules/Legacy/Inverse/SolveInverseProblemWithTikhonov.h>
#include <Modules/DataIO/ReadMatrix.h>
#include <Modules/DataIO/ReadMatrixClassic.h>
#include <Modules/DataIO/WriteMatrix.h>
#include <Modules/DataIO/ReadField.h>
#include <Modules/DataIO/WriteField.h>
#include <Modules/String/CreateString.h>
#include <Modules/String/NetworkNotes.h>
#include <Modules/Visualization/ShowString.h>
#include <Modules/Visualization/ShowField.h>
#include <Modules/Visualization/CreateBasicColorMap.h>
#include <Modules/Visualization/ShowColorMapModule.h>
#include <Modules/FiniteElements/TDCSSimulator.h>
#include <Modules/Render/ViewScene.h>
#include <Modules/Legacy/FiniteElements/BuildFEMatrix.h>
#include <Modules/Basic/AsyncPortTestModule.h>
#include <Modules/Basic/NeedToExecuteTester.h>
#include <Modules/Legacy/Converters/ConvertMatrixToString.h>
//#include <Modules/Fields/@ModuleName@.h>

using namespace SCIRun::Dataflow::Networks;
using namespace SCIRun::Modules::Factory;
using namespace SCIRun::Modules::Bundles;
using namespace SCIRun::Modules::Fields;
using namespace SCIRun::Modules::Basic;
using namespace SCIRun::Modules::Math;
using namespace SCIRun::Modules::FiniteElements;
using namespace SCIRun::Modules::Forward;
using namespace SCIRun::Modules::Inverse;
using namespace SCIRun::Modules::DataIO;
using namespace SCIRun::Modules::Matlab::DataIO;
using namespace SCIRun::Modules::StringProcessing;
using namespace SCIRun::Modules::Visualization;
using namespace SCIRun::Modules::Render;
using namespace SCIRun::Modules::Converters;

void ModuleDescriptionLookup::addEssentialModules()
{
  //addModuleDesc<ReadMatrixModule>("ReadMatrix", "DataIO", "SCIRun", "Functional, needs GUI and algorithm work.", "...");
  addModuleDesc<ReadMatrix>("ReadMatrix", "DataIO", "SCIRun", "Redo of ReadMatrix", "...");
  addModuleDesc<WriteMatrixModule>("WriteMatrix", "DataIO", "SCIRun", "Functional, outputs text files or binary .mat only.", "...");
  addModuleDesc<ReadFieldModule>("ReadField", "DataIO", "SCIRun", "Functional, needs GUI and algorithm work.", "...");
  addModuleDesc<WriteFieldModule>("WriteField", "DataIO", "SCIRun", "Functional, outputs binary .fld only.", "...");
  addModuleDesc<PrintDatatypeModule>("PrintDatatype", "String", "SCIRun", "...", "...");
  addModuleDesc<ReportMatrixInfoModule>("ReportMatrixInfo", "Math", "SCIRun", "Functional, needs GUI work.", "...");
  addModuleDesc<ReportFieldInfoModule>("ReportFieldInfo", "MiscField", "SCIRun", "Same as v4", "...");
  addModuleDesc<AppendMatrixModule>("AppendMatrix", "Math", "SCIRun", "Fully functional.", "...");
  addModuleDesc<EvaluateLinearAlgebraUnaryModule>("EvaluateLinearAlgebraUnary", "Math", "SCIRun", "Partially functional, needs GUI work.", "...");
  addModuleDesc<EvaluateLinearAlgebraBinaryModule>("EvaluateLinearAlgebraBinary", "Math", "SCIRun", "Partially functional, needs GUI work.", "...");
  addModuleDesc<CreateMatrixModule>("CreateMatrix", "Math", "SCIRun", "Functional, needs GUI work.", "...");
  addModuleDesc<SolveLinearSystemModule>("SolveLinearSystem", "Math", "SCIRun", "Four multi-threaded algorithms available.", "...");
  addModuleDesc<CreateStringModule>("CreateString", "String", "SCIRun", "Functional, needs GUI work.", "...");
	addModuleDesc<NetworkNotesModule>("NetworkNotes", "String", "SCIRun", "Functional, needs GUI work.", "...");
  //addModuleDesc<ShowStringModule>("ShowString", "String", "SCIRun", "...", "...");
  addModuleDesc<ShowFieldModule>("Some basic options available, still work in progress.", "...");
  addModuleDesc<CreateLatVol>("CreateLatVol", "NewField", "SCIRun", "Official ported v4 module.", "...");
  addModuleDesc<ViewScene>("Can display meshes and fields, pan/rotate/zoom.", "...");

  addModuleDesc<GetFieldBoundary>("GetFieldBoundary", "NewField", "SCIRun", "First real ported module", "...");
  addModuleDesc<CalculateSignedDistanceToField>("CalculateSignedDistanceToField", "ChangeFieldData", "SCIRun", "Second real ported module", "...");
  addModuleDesc<CalculateGradients>("CalculateGradients", "ChangeFieldData", "SCIRun", "Real ported module", "...");
  addModuleDesc<ConvertQuadSurfToTriSurf>("ConvertQuadSurfToTriSurf", "ChangeMesh", "SCIRun", "Real ported module", "...");
	addModuleDesc<AlignMeshBoundingBoxes>("AlignMeshBoundingBoxes", "ChangeMesh", "SCIRun", "Real ported module", "...");
  addModuleDesc<GetFieldNodes>("GetFieldNodes", "ChangeMesh", "SCIRun", "Real ported module", "...");
  addModuleDesc<SetFieldNodes>("SetFieldNodes", "ChangeMesh", "SCIRun", "Real ported module", "...");
  //addModuleDesc<TDCSSimulatorModule>("tDCSSimulator", "FiniteElements", "SCIRun", "Dummy module for design purposes", "...");
  addModuleDesc<SolveMinNormLeastSqSystem>("SolveMinNormLeastSqSystem", "Math", "SCIRun", "Real ported module", "...");
  addModuleDesc<CreateBasicColorMap>("CreateStandardColorMap", "Visualization", "SCIRun", "In progress: two color maps available", "...");
  addModuleDesc<GetDomainBoundary>("Real ported module: Many bugs and UI logic issues", "...");
  addModuleDesc<JoinFields>("Real ported module: Many bugs and UI logic issues", "...");
  addModuleDesc<CreateFieldData>("Real ported module", "...");
  addModuleDesc<CalculateFieldData>("Real ported module", "...");
	addModuleDesc<SwapFieldDataWithMatrixEntries>("SwapFieldDataWithMatrixEntires","...");
  addModuleDesc<BuildFEMatrix>("BuildFEMatrix", "FiniteElements", "SCIRun", "In progress: main path through code works", "Generates stiffness matrix ");
  addModuleDesc<BuildBEMatrix>("Real ported module", "...");
  addModuleDesc<ResampleRegularMesh>("Real ported module", "...");
  addModuleDesc<FairMesh>("Real ported module", "...");
  //TODO: incomplete impl
  //addModuleDesc<ConvertFieldBasis>("NOT WORKING YET--Real ported module", "...");
  //addModuleDesc<ScaleFieldMeshAndData>("NOT WORKING YET--Real ported module", "...");
  addModuleDesc<ProjectPointsOntoMesh>("Real ported module", "...");
  addModuleDesc<ApplyFEMCurrentSource>("Real ported module", "...");
  #ifdef WITH_TETGEN
  addModuleDesc<InterfaceWithTetGen>("Real ported module", "...");
  #endif
  addModuleDesc<CalculateDistanceToField>("Real ported module", "...");
  addModuleDesc<CalculateDistanceToFieldBoundary>("Real ported module", "...");
  addModuleDesc<MapFieldDataOntoNodes>("Real ported module", "...");
  addModuleDesc<MapFieldDataOntoElements>("Real ported module", "...");
  addModuleDesc<ClipFieldByFunction>("In progress", "...");
  addModuleDesc<MapFieldDataFromSourceToDestination>("Real ported module", "...");
  addModuleDesc<GetMatrixSlice>("New module based on GetRowOrColumnFromMatrix", "...");
	addModuleDesc<RefineMesh>("RefineMesh","ChangeMesh", "SCIRun", "Real ported module", "...");
  addModuleDesc<SetFieldDataToConstantValue>("Real ported module", "...");
	addModuleDesc<BuildMatrixOfSurfaceNormals>("Real ported module", "...");
  addModuleDesc<BuildMappingMatrix>("Real ported module", "...");
  //addModuleDesc<ImportDatatypesFromMatlab>("Improved version of Matlab importer", "work in progress"); //not ready yet
  addModuleDesc<FlipSurfaceNormals>("FlipSurfaceNormals","ChangeMesh","SCIRun","...","...");
  addModuleDesc<BuildNoiseColumnMatrix>("BuildNoiseColumnMatrix","Math","SCIRun","...","...");
  addModuleDesc<ComputeSVD>("ComputeSVD","Math","SCIRun","...","...");

  addModuleDesc<EditMeshBoundingBox>("Rewrite", "...");
  addModuleDesc<ConvertIndicesToFieldData>("Real ported module", "...");
  addModuleDesc<SolveInverseProblemWithTikhonov>("...", "...");
  addModuleDesc<ShowColorMapModule>("ShowColorMap", "Visualization", "SCIRun", "Real ported module", "...");
  addModuleDesc<ConvertMatrixToString>("ConvertMatrixToString","Converters","SCIRun","...","...");

  // insert module desc here
}

void ModuleDescriptionLookup::addBundleModules()
{
  //addModuleDesc<GetMatricesFromBundle>("Real ported module: improved UI", "...");
  //addModuleDesc<InsertMatricesIntoBundle>("Real ported module: improved UI", "...");
  //TODO: incomplete impl
  //addModuleDesc<GetFieldsFromBundle>("Real ported module: improved UI", "...");
  //addModuleDesc<InsertFieldsIntoBundle>("Real ported module: improved UI", "...");
  addModuleDesc<SplitFieldByDomain>("Real ported module", "...");
}

void ModuleDescriptionLookup::addTestingModules()
{
  addModuleDesc<SendScalarModule>("SendScalar", "Testing", "SCIRun", "Functional, needs GUI and algorithm work.", "...");
  addModuleDesc<ReceiveScalarModule>("ReceiveScalar", "Testing", "SCIRun", "...", "...");
  addModuleDesc<SendTestMatrixModule>("SendTestMatrix", "Testing", "SCIRun", "...", "...");
  addModuleDesc<ReceiveTestMatrixModule>("ReceiveTestMatrix", "Testing", "SCIRun", "...", "...");
  addModuleDesc<DynamicPortTester>("DynamicPortTester", "Testing", "SCIRun", "...", "...");
  addModuleDesc<AsyncPortTestModule>("...", "ViewScene clone");
  addModuleDesc<NeedToExecuteTester>("...", "...");
}<|endoftext|>


<commit_before>// Copyright (c) 2014-2017 Dr. Colin Hirsch and Daniel Frey
// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/

#ifndef TAOCPP_PEGTL_INCLUDE_MEMORY_INPUT_HPP
#define TAOCPP_PEGTL_INCLUDE_MEMORY_INPUT_HPP

#include <cstddef>
#include <cstring>
#include <string>
#include <utility>

#include "config.hpp"
#include "eol.hpp"
#include "position.hpp"
#include "tracking_mode.hpp"

#include "internal/action_input.hpp"
#include "internal/bump_impl.hpp"
#include "internal/iterator.hpp"
#include "internal/marker.hpp"

namespace tao
{
   namespace TAOCPP_PEGTL_NAMESPACE
   {
      namespace internal
      {
         template< tracking_mode, typename Eol, typename Source >
         class memory_input_base;

         template< typename Eol, typename Source >
         class memory_input_base< tracking_mode::IMMEDIATE, Eol, Source >
         {
         public:
            using iterator_t = internal::iterator;

            memory_input_base( const iterator_t& in_begin, const char* in_end, Source in_source ) noexcept
               : m_current( in_begin ),
                 m_end( in_end ),
                 m_source( std::move( in_source ) )
            {
            }

            template< typename T >
            memory_input_base( const char* in_begin, const char* in_end, T&& in_source ) noexcept
               : memory_input_base( iterator_t( in_begin ), in_end, std::forward< T >( in_source ) )
            {
            }

            template< typename T >
            memory_input_base( const char* in_begin, const char* in_end, T&& in_source, const std::size_t in_byte, const std::size_t in_line, const std::size_t in_byte_in_line ) noexcept
               : memory_input_base( { in_byte, in_line, in_byte_in_line, in_begin }, in_end, std::forward< T >( in_source ) )
            {
            }

            memory_input_base( const memory_input_base& ) = delete;
            memory_input_base operator=( const memory_input_base& ) = delete;

            const char* current() const noexcept
            {
               return m_current.data;
            }

            const char* end( const std::size_t = 0 ) const noexcept
            {
               return m_end;
            }

            std::size_t byte() const noexcept
            {
               return m_current.byte;
            }

            std::size_t line() const noexcept
            {
               return m_current.line;
            }

            std::size_t byte_in_line() const noexcept
            {
               return m_current.byte_in_line;
            }

            void bump( const std::size_t in_count = 1 ) noexcept
            {
               internal::bump( m_current, in_count, Eol::ch );
            }

            void bump_in_this_line( const std::size_t in_count = 1 ) noexcept
            {
               internal::bump_in_this_line( m_current, in_count );
            }

            void bump_to_next_line( const std::size_t in_count = 1 ) noexcept
            {
               internal::bump_to_next_line( m_current, in_count );
            }

            TAOCPP_PEGTL_NAMESPACE::position position( const iterator_t& it ) const noexcept
            {
               return TAOCPP_PEGTL_NAMESPACE::position( it, m_source );
            }

         protected:
            iterator_t m_current;
            const char* const m_end;
            const Source m_source;
         };

         template< typename Eol, typename Source >
         class memory_input_base< tracking_mode::LAZY, Eol, Source >
         {
         public:
            using iterator_t = const char*;

            memory_input_base( const char* in_begin, const char* in_end, Source in_source ) noexcept
               : m_begin( in_begin ),
                 m_current( in_begin ),
                 m_end( in_end ),
                 m_source( std::move( in_source ) )
            {
            }

            memory_input_base( const char* in_begin, const char* in_end, Source in_source, const std::size_t in_byte, const std::size_t in_line, const std::size_t in_byte_in_line ) noexcept
               : m_begin( in_byte, in_line, in_byte_in_line, in_begin ),
                 m_current( in_begin ),
                 m_end( in_end ),
                 m_source( std::move( in_source ) )
            {
            }

            memory_input_base( const memory_input_base& ) = delete;
            memory_input_base operator=( const memory_input_base& ) = delete;

            const char* current() const noexcept
            {
               return m_current;
            }

            const char* end( const std::size_t = 0 ) const noexcept
            {
               return m_end;
            }

            std::size_t byte() const noexcept
            {
               return std::size_t( current() - m_begin.data );
            }

            void bump( const std::size_t in_count = 1 ) noexcept
            {
               m_current += in_count;
            }

            void bump_in_this_line( const std::size_t in_count = 1 ) noexcept
            {
               m_current += in_count;
            }

            void bump_to_next_line( const std::size_t in_count = 1 ) noexcept
            {
               m_current += in_count;
            }

            TAOCPP_PEGTL_NAMESPACE::position position( const iterator_t it ) const noexcept
            {
               internal::iterator c( m_begin );
               internal::bump( c, std::size_t( it - m_begin.data ), Eol::ch );
               return TAOCPP_PEGTL_NAMESPACE::position( c, m_source );
            }

         protected:
            const internal::iterator m_begin;
            iterator_t m_current;
            const char* const m_end;
            const Source m_source;
         };

      }  // namespace internal

      template< tracking_mode P = tracking_mode::IMMEDIATE, typename Eol = lf_crlf_eol, typename Source = std::string >
      class memory_input
         : public internal::memory_input_base< P, Eol, Source >
      {
      public:
         static constexpr tracking_mode tracking_mode_v = P;

         using eol_t = Eol;
         using source_t = Source;

         using typename internal::memory_input_base< P, Eol, Source >::iterator_t;

         using memory_t = memory_input;
         using action_t = internal::action_input< memory_input, P >;

         using internal::memory_input_base< P, Eol, Source >::memory_input_base;

         template< typename T >
         memory_input( const char* in_begin, const std::size_t in_size, T&& in_source ) noexcept
            : memory_input( in_begin, in_begin + in_size, std::forward< T >( in_source ) )
         {
         }

         template< typename T >
         memory_input( const std::string& in_string, T&& in_source ) noexcept
            : memory_input( in_string.data(), in_string.size(), std::forward< T >( in_source ) )
         {
         }

         template< typename T >
         memory_input( const char* in_begin, T&& in_source ) noexcept
            : memory_input( in_begin, std::strlen( in_begin ), std::forward< T >( in_source ) )
         {
         }

         memory_input( const memory_input& ) = delete;
         memory_input operator=( const memory_input& ) = delete;

         const Source& source() const noexcept
         {
            return this->m_source;
         }

         bool empty() const noexcept
         {
            return this->current() == this->end();
         }

         std::size_t size( const std::size_t = 0 ) const noexcept
         {
            return std::size_t( this->end() - this->current() );
         }

         char peek_char( const std::size_t offset = 0 ) const noexcept
         {
            return this->current()[ offset ];
         }

         unsigned char peek_byte( const std::size_t offset = 0 ) const noexcept
         {
            return static_cast< unsigned char >( peek_char( offset ) );
         }

         iterator_t& iterator() noexcept
         {
            return this->m_current;
         }

         const iterator_t& iterator() const noexcept
         {
            return this->m_current;
         }

         using internal::memory_input_base< P, Eol, Source >::position;

         TAOCPP_PEGTL_NAMESPACE::position position() const noexcept
         {
            return this->position( this->iterator() );
         }

         void discard() const noexcept
         {
         }

         void require( const std::size_t ) const noexcept
         {
         }

         template< rewind_mode M >
         internal::marker< iterator_t, M > mark() noexcept
         {
            return internal::marker< iterator_t, M >( this->iterator() );
         }
      };

   }  // namespace TAOCPP_PEGTL_NAMESPACE

}  // namespace tao

#endif
<commit_msg>Simplify<commit_after>// Copyright (c) 2014-2017 Dr. Colin Hirsch and Daniel Frey
// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/

#ifndef TAOCPP_PEGTL_INCLUDE_MEMORY_INPUT_HPP
#define TAOCPP_PEGTL_INCLUDE_MEMORY_INPUT_HPP

#include <cstddef>
#include <cstring>
#include <string>
#include <utility>

#include "config.hpp"
#include "eol.hpp"
#include "position.hpp"
#include "tracking_mode.hpp"

#include "internal/action_input.hpp"
#include "internal/bump_impl.hpp"
#include "internal/iterator.hpp"
#include "internal/marker.hpp"

namespace tao
{
   namespace TAOCPP_PEGTL_NAMESPACE
   {
      namespace internal
      {
         template< tracking_mode, typename Eol, typename Source >
         class memory_input_base;

         template< typename Eol, typename Source >
         class memory_input_base< tracking_mode::IMMEDIATE, Eol, Source >
         {
         public:
            using iterator_t = internal::iterator;

            memory_input_base( const iterator_t& in_begin, const char* in_end, Source in_source ) noexcept
               : m_current( in_begin ),
                 m_end( in_end ),
                 m_source( std::move( in_source ) )
            {
            }

            template< typename T >
            memory_input_base( const char* in_begin, const char* in_end, T&& in_source ) noexcept
               : memory_input_base( iterator_t( in_begin ), in_end, std::forward< T >( in_source ) )
            {
            }

            template< typename T >
            memory_input_base( const char* in_begin, const char* in_end, T&& in_source, const std::size_t in_byte, const std::size_t in_line, const std::size_t in_byte_in_line ) noexcept
               : memory_input_base( { in_byte, in_line, in_byte_in_line, in_begin }, in_end, std::forward< T >( in_source ) )
            {
            }

            memory_input_base( const memory_input_base& ) = delete;
            memory_input_base operator=( const memory_input_base& ) = delete;

            const char* current() const noexcept
            {
               return m_current.data;
            }

            const char* end( const std::size_t = 0 ) const noexcept
            {
               return m_end;
            }

            std::size_t byte() const noexcept
            {
               return m_current.byte;
            }

            std::size_t line() const noexcept
            {
               return m_current.line;
            }

            std::size_t byte_in_line() const noexcept
            {
               return m_current.byte_in_line;
            }

            void bump( const std::size_t in_count = 1 ) noexcept
            {
               internal::bump( m_current, in_count, Eol::ch );
            }

            void bump_in_this_line( const std::size_t in_count = 1 ) noexcept
            {
               internal::bump_in_this_line( m_current, in_count );
            }

            void bump_to_next_line( const std::size_t in_count = 1 ) noexcept
            {
               internal::bump_to_next_line( m_current, in_count );
            }

            TAOCPP_PEGTL_NAMESPACE::position position( const iterator_t& it ) const noexcept
            {
               return TAOCPP_PEGTL_NAMESPACE::position( it, m_source );
            }

         protected:
            iterator_t m_current;
            const char* const m_end;
            const Source m_source;
         };

         template< typename Eol, typename Source >
         class memory_input_base< tracking_mode::LAZY, Eol, Source >
         {
         public:
            using iterator_t = const char*;

            memory_input_base( const char* in_begin, const char* in_end, Source in_source ) noexcept
               : m_begin( in_begin ),
                 m_current( in_begin ),
                 m_end( in_end ),
                 m_source( std::move( in_source ) )
            {
            }

            memory_input_base( const char* in_begin, const char* in_end, Source in_source, const std::size_t in_byte, const std::size_t in_line, const std::size_t in_byte_in_line ) noexcept
               : m_begin( in_byte, in_line, in_byte_in_line, in_begin ),
                 m_current( in_begin ),
                 m_end( in_end ),
                 m_source( std::move( in_source ) )
            {
            }

            memory_input_base( const memory_input_base& ) = delete;
            memory_input_base operator=( const memory_input_base& ) = delete;

            const char* current() const noexcept
            {
               return m_current;
            }

            const char* end( const std::size_t = 0 ) const noexcept
            {
               return m_end;
            }

            std::size_t byte() const noexcept
            {
               return std::size_t( current() - m_begin.data );
            }

            void bump( const std::size_t in_count = 1 ) noexcept
            {
               m_current += in_count;
            }

            void bump_in_this_line( const std::size_t in_count = 1 ) noexcept
            {
               m_current += in_count;
            }

            void bump_to_next_line( const std::size_t in_count = 1 ) noexcept
            {
               m_current += in_count;
            }

            TAOCPP_PEGTL_NAMESPACE::position position( const iterator_t it ) const noexcept
            {
               internal::iterator c( m_begin );
               internal::bump( c, std::size_t( it - m_begin.data ), Eol::ch );
               return TAOCPP_PEGTL_NAMESPACE::position( c, m_source );
            }

         protected:
            const internal::iterator m_begin;
            iterator_t m_current;
            const char* const m_end;
            const Source m_source;
         };

      }  // namespace internal

      template< tracking_mode P = tracking_mode::IMMEDIATE, typename Eol = lf_crlf_eol, typename Source = std::string >
      class memory_input
         : public internal::memory_input_base< P, Eol, Source >
      {
      public:
         static constexpr tracking_mode tracking_mode_v = P;

         using eol_t = Eol;
         using source_t = Source;

         using typename internal::memory_input_base< P, Eol, Source >::iterator_t;

         using memory_t = memory_input;
         using action_t = internal::action_input< memory_input, P >;

         using internal::memory_input_base< P, Eol, Source >::memory_input_base;

         template< typename T >
         memory_input( const char* in_begin, const std::size_t in_size, T&& in_source ) noexcept
            : memory_input( in_begin, in_begin + in_size, std::forward< T >( in_source ) )
         {
         }

         template< typename T >
         memory_input( const std::string& in_string, T&& in_source ) noexcept
            : memory_input( in_string.data(), in_string.size(), std::forward< T >( in_source ) )
         {
         }

         template< typename T >
         memory_input( const char* in_begin, T&& in_source ) noexcept
            : memory_input( in_begin, std::strlen( in_begin ), std::forward< T >( in_source ) )
         {
         }

         memory_input( const memory_input& ) = delete;
         memory_input operator=( const memory_input& ) = delete;

         const Source& source() const noexcept
         {
            return this->m_source;
         }

         bool empty() const noexcept
         {
            return this->current() == this->end();
         }

         std::size_t size( const std::size_t = 0 ) const noexcept
         {
            return std::size_t( this->end() - this->current() );
         }

         char peek_char( const std::size_t offset = 0 ) const noexcept
         {
            return this->current()[ offset ];
         }

         unsigned char peek_byte( const std::size_t offset = 0 ) const noexcept
         {
            return static_cast< unsigned char >( peek_char( offset ) );
         }

         iterator_t& iterator() noexcept
         {
            return this->m_current;
         }

         const iterator_t& iterator() const noexcept
         {
            return this->m_current;
         }

         using internal::memory_input_base< P, Eol, Source >::position;

         TAOCPP_PEGTL_NAMESPACE::position position() const noexcept
         {
            return this->position( iterator() );
         }

         void discard() const noexcept
         {
         }

         void require( const std::size_t ) const noexcept
         {
         }

         template< rewind_mode M >
         internal::marker< iterator_t, M > mark() noexcept
         {
            return internal::marker< iterator_t, M >( iterator() );
         }
      };

   }  // namespace TAOCPP_PEGTL_NAMESPACE

}  // namespace tao

#endif
<|endoftext|>


<commit_before>#include <bits/stdc++.h>

using namespace std;

struct Semaphore {
    mutex mtx;
    volatile int val;
    Semaphore(int val=0) :val(val) {}
    void signal(int dval = 1) {
        mtx.lock();
        val += dval;
        mtx.unlock();
    }
    void wait() {
        while(1) {
            mtx.lock();
            if( val > 0 ) {
                --val;
                mtx.unlock();
                break;
            }
            mtx.unlock();
        }
    }
};

struct Fifo {
    Semaphore mtx;
    deque<Semaphore*> qfifo;
    Semaphore qsize;
    Fifo(): mtx(1), qsize(0) {}
    void wait() {
        mtx.wait();
            Semaphore* my = new Semaphore(0);
            qfifo.push_back(my);
        mtx.signal();
        qsize.signal();
            my->wait();
            delete my;
    }
    void signal() {
        qsize.wait();
        mtx.wait();
            Semaphore* to_up = qfifo.front();
            qfifo.pop_front();
        mtx.signal();
            to_up->signal();
            //WRONG! delete to_up;
    }
} fifo;

const int N = 10;

mutex io;

void f(int id) {
    if(id<=N/2) {
        io.lock();cout << "wait " << id << '\n';io.unlock();
        fifo.wait();
        io.lock();cout << "raised " << id << '\n';io.unlock();
    } else {
        io.lock();cout << "alarm by " << id << '\n';io.unlock();
        fifo.signal();
        io.lock();cout << "alarmed " << id << '\n';io.unlock();
    }
}

int main() {
    vector<thread> v;
    for(int i=1; i<=N; ++i)
        v.push_back(thread(f, i));
    for(auto& th: v) th.join();
    return 0;
}
<commit_msg>Noticed about wrong solution of 3.22(page 59) The Little Book of Semaphores<commit_after>#include <bits/stdc++.h>

using namespace std;

struct Semaphore {
    mutex mtx;
    volatile int val;
    Semaphore(int val=0) :val(val) {}
    void signal(int dval = 1) {
        mtx.lock();
        val += dval;
        mtx.unlock();
    }
    void wait() {
        while(1) {
            mtx.lock();
            if( val > 0 ) {
                --val;
                mtx.unlock();
                break;
            }
            mtx.unlock();
        }
    }
};

struct Fifo {
    Semaphore mtx;
    deque<Semaphore*> qfifo;
    Semaphore qsize;
    Fifo(): mtx(1), qsize(0) {}
    void wait() {
        mtx.wait();
            Semaphore* my = new Semaphore(0);
            qfifo.push_back(my);
        mtx.signal();
        qsize.signal();
            my->wait();
            delete my;
    }
    void signal() {
        qsize.wait();
        mtx.wait();
            Semaphore* to_up = qfifo.front();
            qfifo.pop_front();
        mtx.signal();
            to_up->signal();
        //Listing 3.22 from little book of semaphores is broken!
    }
} fifo;

const int N = 10;

mutex io;

void f(int id) {
    if(id<=N/2) {
        io.lock();cout << "wait " << id << '\n';io.unlock();
        fifo.wait();
        io.lock();cout << "raised " << id << '\n';io.unlock();
    } else {
        io.lock();cout << "alarm by " << id << '\n';io.unlock();
        fifo.signal();
        io.lock();cout << "alarmed " << id << '\n';io.unlock();
    }
}

int main() {
    vector<thread> v;
    for(int i=1; i<=N; ++i)
        v.push_back(thread(f, i));
    for(auto& th: v) th.join();
    return 0;
}
<|endoftext|>


<commit_before>#include "Platform.h"
#include <stdlib.h>
#include "CppUTest/TestHarness.h"
#undef malloc
#undef free
#undef calloc
#undef realloc

#include "CppUTest/TestRegistry.h"
#include <stdio.h>
#include <stdarg.h>
#include <setjmp.h>
#include <string.h>
#include <math.h>
#include <float.h>
#include <time.h>
#include "CppUTest/PlatformSpecificFunctions.h"

#include <windows.h>
#include <mmsystem.h>

#include <setjmp.h>

static jmp_buf test_exit_jmp_buf[10];
static int jmp_buf_index = 0;

int PlatformSpecificSetJmp(void (*function) (void* data), void* data)
{
	if (0 == setjmp(test_exit_jmp_buf[jmp_buf_index])) {
	    jmp_buf_index++;
		function(data);
	    jmp_buf_index--;
		return 1;
	}
	return 0;
}

void PlatformSpecificLongJmp()
{
	jmp_buf_index--;
	longjmp(test_exit_jmp_buf[jmp_buf_index], 1);
}

void PlatformSpecificRestoreJumpBuffer()
{
	jmp_buf_index--;
}

void PlatformSpecificRunTestInASeperateProcess(UtestShell* shell, TestPlugin* plugin, TestResult* result)
{
   printf("-p doesn't work on this platform as it is not implemented. Running inside the process\b");
   shell->runOneTest(plugin, *result);
}

TestOutput::WorkingEnvironment PlatformSpecificGetWorkingEnvironment()
{
	return TestOutput::vistualStudio;
}

///////////// Time in millis

static long TimeInMillisImplementation()
{
    return timeGetTime()/1000;
}

static long (*timeInMillisFp) () = TimeInMillisImplementation;

long GetPlatformSpecificTimeInMillis()
{
	return timeInMillisFp();
}

void SetPlatformSpecificTimeInMillisMethod(long (*platformSpecific) ())
{
	timeInMillisFp = (platformSpecific == 0) ? TimeInMillisImplementation : platformSpecific;
}

///////////// Time in String

static const char* TimeStringImplementation()
{
	time_t tm = time(NULL);
	static char dateTime[80];
	struct tm *tmp = localtime(&tm);
	strftime(dateTime, 80, "%Y-%m-%dT%H:%M:%S", tmp);
	return dateTime;
}

static const char* (*timeStringFp) () = TimeStringImplementation;

const char* GetPlatformSpecificTimeString()
{
	return timeStringFp();
}

void SetPlatformSpecificTimeStringMethod(const char* (*platformMethod) ())
{
	timeStringFp = (platformMethod == 0) ? TimeStringImplementation : platformMethod;
}

////// taken from gcc

int PlatformSpecificAtoI(const char*str)
{
   return atoi(str);
}

size_t PlatformSpecificStrLen(const char* str)
{
   return strlen(str);
}

char* PlatformSpecificStrCat(char* s1, const char* s2)
{
   return strcat(s1, s2);
}

char* PlatformSpecificStrCpy(char* s1, const char* s2)
{
   return strcpy(s1, s2);
}

char* PlatformSpecificStrNCpy(char* s1, const char* s2, size_t size)
{
   return strncpy(s1, s2, size);
}

int PlatformSpecificStrCmp(const char* s1, const char* s2)
{
   return strcmp(s1, s2);
}

int PlatformSpecificStrNCmp(const char* s1, const char* s2, size_t size)
{
   return strncmp(s1, s2, size);
}
char* PlatformSpecificStrStr(const char* s1, const char* s2)
{
   return (char*) strstr(s1, s2);
}

int PlatformSpecificVSNprintf(char *str, size_t size, const char* format, va_list args)
{
	char* buf = 0;
	size_t sizeGuess = size;

	int result = _vsnprintf( str, size, format, args);
	str[size-1] = 0;
	while (result == -1)
	{
		if (buf != 0)
			free(buf);
		sizeGuess += 10;
		buf = (char*)malloc(sizeGuess);
		result = _vsnprintf( buf, sizeGuess, format, args);
	}

	if (buf != 0)
		free(buf);
	return result;

}

PlatformSpecificFile PlatformSpecificFOpen(const char* filename, const char* flag)
{
   return fopen(filename, flag);
}

void PlatformSpecificFPuts(const char* str, PlatformSpecificFile file)
{
   fputs(str, (FILE*)file);
}

void PlatformSpecificFClose(PlatformSpecificFile file)
{
   fclose((FILE*)file);
}

void PlatformSpecificFlush()
{
  fflush(stdout);
}

int PlatformSpecificPutchar(int c)
{
  return putchar(c);
}

void* PlatformSpecificMalloc(size_t size)
{
   return malloc(size);
}

void* PlatformSpecificRealloc (void* memory, size_t size)
{
   return realloc(memory, size);
}

void PlatformSpecificFree(void* memory)
{
   free(memory);
}

void* PlatformSpecificMemCpy(void* s1, const void* s2, size_t size)
{
   return memcpy(s1, s2, size);
}

void* PlatformSpecificMemset(void* mem, int c, size_t size)
{
	return memset(mem, c, size);
}

double PlatformSpecificFabs(double d)
{
   return fabs(d);
}

int PlatformSpecificIsNan(double d)
{
	return _isnan(d);
}

int PlatformSpecificVSNprintf(char *str, unsigned int size, const char* format, void* args)
{
   return _vsnprintf( str, size, format, (va_list) args);
}

char PlatformSpecificToLower(char c)
{
	return tolower(c);
}

<commit_msg>Windows timeGetTime() returns milli-seconds.<commit_after>#include "Platform.h"
#include <stdlib.h>
#include "CppUTest/TestHarness.h"
#undef malloc
#undef free
#undef calloc
#undef realloc

#include "CppUTest/TestRegistry.h"
#include <stdio.h>
#include <stdarg.h>
#include <setjmp.h>
#include <string.h>
#include <math.h>
#include <float.h>
#include <time.h>
#include "CppUTest/PlatformSpecificFunctions.h"

#include <windows.h>
#include <mmsystem.h>

#include <setjmp.h>

static jmp_buf test_exit_jmp_buf[10];
static int jmp_buf_index = 0;

int PlatformSpecificSetJmp(void (*function) (void* data), void* data)
{
	if (0 == setjmp(test_exit_jmp_buf[jmp_buf_index])) {
	    jmp_buf_index++;
		function(data);
	    jmp_buf_index--;
		return 1;
	}
	return 0;
}

void PlatformSpecificLongJmp()
{
	jmp_buf_index--;
	longjmp(test_exit_jmp_buf[jmp_buf_index], 1);
}

void PlatformSpecificRestoreJumpBuffer()
{
	jmp_buf_index--;
}

void PlatformSpecificRunTestInASeperateProcess(UtestShell* shell, TestPlugin* plugin, TestResult* result)
{
   printf("-p doesn't work on this platform as it is not implemented. Running inside the process\b");
   shell->runOneTest(plugin, *result);
}

TestOutput::WorkingEnvironment PlatformSpecificGetWorkingEnvironment()
{
	return TestOutput::vistualStudio;
}

///////////// Time in millis

static long TimeInMillisImplementation()
{
    return timeGetTime();
}

static long (*timeInMillisFp) () = TimeInMillisImplementation;

long GetPlatformSpecificTimeInMillis()
{
	return timeInMillisFp();
}

void SetPlatformSpecificTimeInMillisMethod(long (*platformSpecific) ())
{
	timeInMillisFp = (platformSpecific == 0) ? TimeInMillisImplementation : platformSpecific;
}

///////////// Time in String

static const char* TimeStringImplementation()
{
	time_t tm = time(NULL);
	static char dateTime[80];
	struct tm *tmp = localtime(&tm);
	strftime(dateTime, 80, "%Y-%m-%dT%H:%M:%S", tmp);
	return dateTime;
}

static const char* (*timeStringFp) () = TimeStringImplementation;

const char* GetPlatformSpecificTimeString()
{
	return timeStringFp();
}

void SetPlatformSpecificTimeStringMethod(const char* (*platformMethod) ())
{
	timeStringFp = (platformMethod == 0) ? TimeStringImplementation : platformMethod;
}

////// taken from gcc

int PlatformSpecificAtoI(const char*str)
{
   return atoi(str);
}

size_t PlatformSpecificStrLen(const char* str)
{
   return strlen(str);
}

char* PlatformSpecificStrCat(char* s1, const char* s2)
{
   return strcat(s1, s2);
}

char* PlatformSpecificStrCpy(char* s1, const char* s2)
{
   return strcpy(s1, s2);
}

char* PlatformSpecificStrNCpy(char* s1, const char* s2, size_t size)
{
   return strncpy(s1, s2, size);
}

int PlatformSpecificStrCmp(const char* s1, const char* s2)
{
   return strcmp(s1, s2);
}

int PlatformSpecificStrNCmp(const char* s1, const char* s2, size_t size)
{
   return strncmp(s1, s2, size);
}
char* PlatformSpecificStrStr(const char* s1, const char* s2)
{
   return (char*) strstr(s1, s2);
}

int PlatformSpecificVSNprintf(char *str, size_t size, const char* format, va_list args)
{
	char* buf = 0;
	size_t sizeGuess = size;

	int result = _vsnprintf( str, size, format, args);
	str[size-1] = 0;
	while (result == -1)
	{
		if (buf != 0)
			free(buf);
		sizeGuess += 10;
		buf = (char*)malloc(sizeGuess);
		result = _vsnprintf( buf, sizeGuess, format, args);
	}

	if (buf != 0)
		free(buf);
	return result;

}

PlatformSpecificFile PlatformSpecificFOpen(const char* filename, const char* flag)
{
   return fopen(filename, flag);
}

void PlatformSpecificFPuts(const char* str, PlatformSpecificFile file)
{
   fputs(str, (FILE*)file);
}

void PlatformSpecificFClose(PlatformSpecificFile file)
{
   fclose((FILE*)file);
}

void PlatformSpecificFlush()
{
  fflush(stdout);
}

int PlatformSpecificPutchar(int c)
{
  return putchar(c);
}

void* PlatformSpecificMalloc(size_t size)
{
   return malloc(size);
}

void* PlatformSpecificRealloc (void* memory, size_t size)
{
   return realloc(memory, size);
}

void PlatformSpecificFree(void* memory)
{
   free(memory);
}

void* PlatformSpecificMemCpy(void* s1, const void* s2, size_t size)
{
   return memcpy(s1, s2, size);
}

void* PlatformSpecificMemset(void* mem, int c, size_t size)
{
	return memset(mem, c, size);
}

double PlatformSpecificFabs(double d)
{
   return fabs(d);
}

int PlatformSpecificIsNan(double d)
{
	return _isnan(d);
}

int PlatformSpecificVSNprintf(char *str, unsigned int size, const char* format, void* args)
{
   return _vsnprintf( str, size, format, (va_list) args);
}

char PlatformSpecificToLower(char c)
{
	return tolower(c);
}

<|endoftext|>