aboutsummaryrefslogtreecommitdiffstats
path: root/test/coverage/main.c
blob: af8762562768051dba1628215fe01b4c7b99c8dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
    ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.

    This file is part of ChibiOS/RT.

    ChibiOS/RT is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.

    ChibiOS/RT is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <windows.h>
#include <string.h>
#include <stdio.h>

#include <ch.h>
#include <test.h>

extern FullDuplexDriver COM1;

/*
 * Simulator main.
 */
int main(int argc, char *argv[]) {
  msg_t result;

  chSysInit();
  result = TestThread(&COM1);
  chThdSleepMilliseconds(1); /* Gives time to flush COM1 output queue */
  fflush(stdout);
  if (result)
    exit(1);
  else
    exit(0);
}
ighlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/*-*-c++-*-
 * $Id$
 *
 * This file is part of plptools.
 *
 *  Copyright (C) 1999  Philip Proudman <philip.proudman@btinternet.com>
 *  Copyright (C) 1999-2001 Fritz Elfert <felfert@to.com>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */
#ifndef _BUFFERARRAY_H_
#define _BUFFERARRAY_H_

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
class bufferStore;

/**
 * An array of bufferStores
 */
class bufferArray {
public:
    /**
    * constructs a new bufferArray.
    * A minimum of @ref ALLOC_MIN
    * elements is allocated.
    */
    bufferArray();

    /**
    * Constructs a new bufferArray.
    *
    * @param a The initial contents for this array.
    */
    bufferArray(const bufferArray &a);

    /**
    * Destroys the bufferArray.
    */
    ~bufferArray();

    /**
    * Copys the bufferArray.
    */
    bufferArray &operator =(const bufferArray &a);

    /**
    * Checks if this bufferArray is empty.
    *
    * @return true if the bufferArray is empty.
    */
    bool empty() const;

    /**
    * Retrieves the bufferStore at given index.
    *
    * @return The bufferStore at index.
    */
    bufferStore &operator [](const unsigned long index);

    /**
    * Appends a bufferStore to a bufferArray.
    *
    * @param s The bufferStore to be appended.
    *
    * @returns A new bufferArray with bufferStore appended to.
    */
    bufferArray operator +(const bufferStore &s);

    /**
    * Concatenates two bufferArrays.
    *
    * @param a The bufferArray to be appended.
    *
    * @returns A new bufferArray consisting with a appended.
    */
    bufferArray operator +(const bufferArray &a);

    /**
    * Appends a bufferStore to current instance.
    *
    * @param s The bufferStore to append.
    *
    * @returns A reference to the current instance with s appended.
    */
    bufferArray &operator +=(const bufferStore &s);

    /**
    * Appends a bufferArray to current instance.
    *
    * @param a The bufferArray to append.
    *
    * @returns A reference to the current instance with a appended.
    */
    bufferArray &operator +=(const bufferArray &a);

    /**
    * Removes the first bufferStore.
    *
    * @return The removed bufferStore.
    */
    bufferStore pop(void);

    /**
    * Inserts a bufferStore at index 0.
    *
    * @param b The bufferStore to be inserted.
    */
    void push(const bufferStore& b);

    /**
    * Appends a bufferStore.
    *
    * @param b The bufferStore to be appended.
    */
    void append(const bufferStore& b);

    /**
    * Evaluates the current length.
    *
    * @return The current number of bufferStores
    */
    long length(void);

    /**
    * Empties the bufferArray.
    */
    void clear(void);

private:
    /**
    * Minimum number of bufferStores to
    * allocate.
    */
    static const long ALLOC_MIN = 5;

    /**
    * The current number of bufferStores in
    * this bufferArray.
    */
    long len;

    /**
    * The current number of bufferStores
    * allocated.
    */
    long lenAllocd;

    /**
    * The content.
    */
    bufferStore* buff;
};

inline bool bufferArray::empty() const { return len == 0; }

#endif

/*
 * Local variables:
 * c-basic-offset: 4
 * End:
 */