/*
Copyright (c) 1998-2005, Dirk Krause
All rights reserved.

Redistribution and use in source and binary forms,
with or without modification, are permitted provided
that the following conditions are met:

* Redistributions of source code must retain the above
  copyright notice, this list of conditions and the
  following disclaimer.
* Redistributions in binary form must reproduce the above 
  opyright notice, this list of conditions and the following
  disclaimer in the documentation and/or other materials
  provided with the distribution.
* Neither the name of the Dirk Krause nor the names of
  contributors may be used to endorse or promote
  products derived from this software without specific
  prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, 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 TRACECO_INC
#define TRACECO_INC 1

#include <dk.h>

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#if DK_HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif

#if DK_HAVE_UNISTD_H
#include <unistd.h>
#endif
#if DK_HAVE_DIRENT_H
#include <dirent.h>
#endif
#if DK_HAVE_IO_H
#include <io.h>
#endif
#if DK_HAVE_DIR_H
#include <dir.h>
#endif
#if DK_HAVE_DIRECT_H
#include <direct.h>
#endif

#include <troutput.h>

#define  TRACE_CMD_BUFFER_SIZE 2048
#define TRACE_CONTROL '$'

#ifndef MAXPATHLEN
#define MAXPATHLEN 1024
#endif

typedef struct {
  kOutputData *outData;
  /* kTca     automat; */
  int     automat;
  char    filename1[MAXPATHLEN];
  char    filename2[MAXPATHLEN];
  char    filename3[MAXPATHLEN];
  FILE   *inputFile;
  FILE   *outputFile;
  FILE   *tempFile;
  int     mode;
  char    currentChar;
  int     originalModus;
  int     lineNumber;
  int     lineIndent;
  int     lineTextFound;
  char    cmdBuffer[TRACE_CMD_BUFFER_SIZE];
  char    *ptrBuffer;
  int     inBuffer;
  int     currentLineLength;
  int     maxLineLength;
  int     boxWidth;
  int     day;
  int     month;
  int     year;
  int     hour;
  int     min;
  int     sec;
  /* kStorage methods; */
  char    *shortFileNamePointer;
} kTraceCodeData;



#if DK_HAVE_PROTOTYPES
#if defined(__cplusplus)
extern "C" {
#endif
int kTraceCodeRunArg(
  kTraceCodeData *traceCode, kOutputData *output,
  int argc,                  char *argv[]
);
#if defined(__cplusplus)
}
#endif
#else
#ifndef TRACECO_C
int void kTraceCodeRunArg();
#endif
#endif


#endif

