File: Knox_Stddef.h

package info (click to toggle)
parsinsert 1.04-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 105,628 kB
  • sloc: cpp: 8,678; makefile: 108; sh: 15
file content (93 lines) | stat: -rw-r--r-- 3,047 bytes parent folder | download | duplicates (6)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/////////////////////////////////////////////////////////////////////////////////////////////////// 
//  File      : Knox_Stddef.h
//  Purpose   : Set of routines and old habit data types
//
//  Developer : David Knox (david.knox@colorado.edu) Jan 2011
//  Copyright : Copyright (C) 2007-2011 David Knox
//
//  Web site  : http://parsinsert.sourceforge.net/
//
/////////////////////////////////////////////////////////////////////////////////////////////////// 
//	This file is part of ParsInsert.
//
//    ParsInsert 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.
//
//    ParsInsert 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 ParsInsert.  If not, see <http://www.gnu.org/licenses/>.
///////////////////////////////////////////////////////////////////////////////////////////////////
#if !defined(__KNOX_STDDEF_H__)
#define __KNOX_STDDEF_H__

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <string>
#include <vector>

using namespace std;

///////////////////////////////////////////////////////////////////////////////////////////////////

typedef vector<string> CStringList;

#define PVOID void*
#define LPSTR char *
#define LPCSTR const char *
#define BYTE unsigned char
#define WORD unsigned short
#define DWORD long unsigned int
#define BOOL int
#define TRUE 1
#define FALSE 0

#ifndef INT_MAX
#define INT_MAX 20000000
#endif

#define DEBUG TRUE
///////////////////////////////////////////////////////////////////////////////////////////////////

//
// Function that will only print if in DEBUG mode
#define TRACE if (DEBUG) printf

//
// Application Log: Manages a log file.  Display functions will print to 
//					multiple locations (Stdout, Application log)
//					File is always current (Flush after each write)
//
extern FILE		*appLog;
extern void 	OpenAppLog(LPCSTR filename, LPCSTR mode="a+");
extern void 	CloseAppLog();

extern void 	Display(LPSTR format, ...);
extern void 	DisplayT(LPSTR format, ...);
extern void 	DisplayL(LPSTR format, ...);

// Helper Functions

//
//  Read Next Line from file into buffer
//
extern BOOL		ReadNextLine(LPSTR line, int len, FILE *f);

// Trim the string, removing unwanted characters from the ends.
extern void		Trim(string& s, LPCSTR unwanted);	
extern void		TrimLeft(string& s, LPCSTR unwanted);	
extern void		TrimRight(string& s, LPCSTR unwanted);	

// convert the string to all same case
extern void		ToLower(string& s);
extern void		ToUpper(string& s);

///////////////////////////////////////////////////////////////////////////////////////////////////
#endif