File: tc.c

package info (click to toggle)
abiword 0.7.7-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 20,604 kB
  • ctags: 18,358
  • sloc: cpp: 88,791; ansic: 66,296; sh: 7,777; makefile: 3,397; xml: 687; perl: 361; awk: 273; sed: 36; csh: 28
file content (119 lines) | stat: -rw-r--r-- 3,194 bytes parent folder | download
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#include <stdlib.h>
#include <stdio.h>
#include "wv.h"
#include "wvinternal.h"

int wvGetTC_internal(version ver,TC *tc,FILE *infd,U8 *pointer)
    {
    U16 temp16;
	BRC10 brc10;

#ifdef PURIFY
    wvInitTC(tc);
#endif
	temp16 = dread_16ubit(infd,&pointer);
	wvTrace(("temp16 is %x\n",temp16));

	if (ver==WORD8)
		{
		tc->fFirstMerged = temp16 & 0x0001;
		tc->fMerged = (temp16 & 0x0002) >> 1;
		tc->fVertical = (temp16 & 0x0004) >> 2;
		tc->fBackward = (temp16 & 0x0008) >> 3;
		tc->fRotateFont = (temp16 & 0x0010) >> 4;
		tc->fVertMerge = (temp16 & 0x0020) >> 5;
		tc->fVertRestart = (temp16 & 0x0040) >> 6;
		tc->vertAlign = (temp16 & 0x0180) >> 7;
		tc->fUnused = (temp16 & 0xFE00) >> 9;
		
    	tc->wUnused = dread_16ubit(infd,&pointer);
		wvGetBRC_internal(&tc->brcTop,infd,pointer);
		pointer+=cbBRC;
		wvGetBRC_internal(&tc->brcLeft,infd,pointer);
		pointer+=cbBRC;
		wvGetBRC_internal(&tc->brcBottom,infd,pointer);
		pointer+=cbBRC;
		wvGetBRC_internal(&tc->brcRight,infd,pointer);
		pointer+=cbBRC;
		}
	else
		{
    	wvInitTC(tc);
		tc->fFirstMerged = temp16 & 0x0001;
		tc->fMerged = (temp16 & 0x0002) >> 1;
		/* 
		This + word 6 205 in sprm.c I thought
		would make sense together, until I get
		another example I have disabled the two
		of them
		*/
#if 0
		tc->fVertical = (temp16 & 0x0004) >> 2;
		tc->fBackward = (temp16 & 0x0008) >> 3;
		tc->fRotateFont = (temp16 & 0x0010) >> 4;
		tc->fVertMerge = (temp16 & 0x0020) >> 5;
		tc->fVertRestart = (temp16 & 0x0040) >> 6;
		tc->vertAlign = (temp16 & 0x0180) >> 7;
		tc->fUnused = (temp16 & 0xFE00) >> 9;
#endif

		wvGetBRC10_internal(&brc10,infd,pointer);
		wvConvertBRC10ToBRC(&tc->brcTop,&brc10);
		pointer+=cb6BRC;
		wvGetBRC10_internal(&brc10,infd,pointer);
		wvConvertBRC10ToBRC(&tc->brcLeft,&brc10);
		pointer+=cb6BRC;
		wvGetBRC10_internal(&brc10,infd,pointer);
		wvConvertBRC10ToBRC(&tc->brcBottom,&brc10);
		pointer+=cb6BRC;
		wvGetBRC10_internal(&brc10,infd,pointer);
		wvConvertBRC10ToBRC(&tc->brcRight,&brc10);
		pointer+=cb6BRC;
		return(cb6TC);
		}
	return(cbTC);
    }

int wvGetTCFromBucket(version ver,TC *abrc,U8 *pointer)
    {
    return(wvGetTC_internal(ver,abrc,NULL,pointer));
    }


void wvCopyTC(TC *dest,TC *src)
	{
    dest->fFirstMerged = src->fFirstMerged;
    dest->fMerged = src->fMerged;
    dest->fVertical = src->fVertical;
    dest->fBackward = src->fBackward;
    dest->fRotateFont = src->fRotateFont;
    dest->fVertMerge = src->fVertMerge;
    dest->fVertRestart = src->fVertRestart;
    dest->vertAlign = src->vertAlign;
    dest->fUnused = src->fUnused;
    dest->wUnused = src->wUnused;

    wvCopyBRC(&src->brcTop,&dest->brcTop);
    wvCopyBRC(&src->brcLeft,&dest->brcLeft);
    wvCopyBRC(&src->brcBottom,&dest->brcBottom);
    wvCopyBRC(&src->brcRight,&dest->brcRight);
	}

void wvInitTC(TC *item)
	{
    item->fFirstMerged = 0;
    item->fMerged = 0;
    item->fVertical = 0;
    item->fBackward = 0;
    item->fRotateFont = 0;
    item->fVertMerge = 0;
    item->fVertRestart = 0;
    item->vertAlign = 0;
    item->fUnused = 0;
    item->wUnused = 0;

    wvInitBRC(&item->brcTop);
    wvInitBRC(&item->brcLeft);
    wvInitBRC(&item->brcBottom);
    wvInitBRC(&item->brcRight);
	}