summaryrefslogtreecommitdiff
path: root/rhtvision/examples/tvhc/tvhc.h
blob: 5cb115b42795304599fa862822e315ac689c7031 (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
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
94
95
/*-----------------------------------------------------*/
/*                                                     */
/*   Turbo Vision 1.0                                  */
/*   Turbo Vision TVHC header file                     */
/*   Copyright (c) 1991 by Borland International       */
/*                                                     */
/*-----------------------------------------------------*/

#if !defined( TVHC_H )
#define TVHC_H

const int MAXSIZE = 80;
const int MAXSTRSIZE=256;
const char commandChar[] = ".";
const int bufferSize = 4096;

typedef enum State { undefined, wrapping, notWrapping } _State;

class TProtectedStream : public CLY_std(fstream)
{
public:
    TProtectedStream( char *aFileName, CLY_OpenModeT aMode );

private:
    char  fileName[MAXSIZE];
    CLY_OpenModeT mode;
};

// Topic Reference

struct TFixUp
{
    long pos;
    TFixUp *next;
};

union Content
{
    int /*ushort*/ value;
    TFixUp *fixUpList;
};

struct TReference 
{
    char *topic;
    Boolean resolved;
    Content val;
};

class TRefTable : public TSortedCollection
{

public:
    TRefTable( ccIndex aLimit, ccIndex aDelta );
    virtual int compare( void *key1,void *key2 );
    virtual void freeItem( void *item );
    TReference *getReference( char *topic );
    virtual void *keyOf( void *item );

private:
    virtual void *readItem( ipstream& ) { return 0; };
    virtual void writeItem( void *, opstream& ) {};
};

struct TCrossRefNode
{
    char *topic;
    int offset;
    uchar length;
    TCrossRefNode *next;
};

class TTopicDefinition : public TObject
{
public:

    TTopicDefinition(char *aTopic, ushort aValue);
    ~TTopicDefinition(void);

    char *topic;
    ushort value;
    TTopicDefinition *next;

};

char helpName[MAXSIZE];
uchar buffer[bufferSize];
int ofs;
TRefTable *refTable = 0;
TCrossRefNode  *xRefs;
char line[MAXSTRSIZE] = "";
Boolean lineInBuffer = False;
int lineCount = 0;

#endif  // TVHC_H