File: phe.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 (110 lines) | stat: -rw-r--r-- 2,657 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
#include <stdlib.h>
#include <stdio.h>
#include "wv.h"

void wvGetPHE6(PHE *dest,U8 *page,U16 *pos)
	{
	U8 temp8;

#ifdef PURIFY
	wvInitPHE(dest,0);
#endif

	temp8 = bgetc(&(page[*pos]),pos);
	dest->var1.fSpare = temp8 & 0x01;
	dest->var1.fUnk = (temp8 & 0x02) >> 1;

	dest->var1.fDiffLines = (temp8 & 0x04) >> 2;
	dest->var1.reserved1 = (temp8 & 0xf8) >> 3;

	dest->var1.clMac = bgetc(&(page[*pos]),pos);

	dest->var1.dxaCol = (S16) bread_16ubit(&(page[*pos]),pos);
	dest->var1.dymHeight = (S32) bread_16ubit(&(page[*pos]),pos);
	}

void wvGetPHE(PHE *dest,int which,U8 *page,U16 *pos)
	{
	U8 temp8;
	U32 temp32;

#ifdef PURIFY
	wvInitPHE(dest,which);
#endif

	if (which)
		{
		temp32 = bread_32ubit(&(page[*pos]),pos);
		dest->var2.fSpare = temp32 & 0x0001;
        dest->var2.fUnk = (temp32 & 0x0002) >> 1;
        dest->var2.dcpTtpNext = (temp32 & 0xfffffffc) >> 2;
		dest->var2.dxaCol = (S32) bread_32ubit(&(page[*pos]),pos);
		dest->var2.dymHeight = (S32) bread_32ubit(&(page[*pos]),pos);
		}
	else
		{
		temp8 = bgetc(&(page[*pos]),pos);
		dest->var1.fSpare = temp8 & 0x01;
        dest->var1.fUnk = (temp8 & 0x02) >> 1;

		dest->var1.fDiffLines = (temp8 & 0x04) >> 2;
        dest->var1.reserved1 = (temp8 & 0xf8) >> 3;

        dest->var1.clMac = bgetc(&(page[*pos]),pos);

        dest->var1.reserved2 = bread_16ubit(&(page[*pos]),pos);
		
		dest->var1.dxaCol = (S32) bread_32ubit(&(page[*pos]),pos);
        dest->var1.dymHeight = (S32) bread_32ubit(&(page[*pos]),pos);
		}
	}

void wvCopyPHE(PHE *dest,PHE *src,int which)
	{
	if (which)
		{
		dest->var2.fSpare = src->var2.fSpare;
        dest->var2.fUnk = src->var2.fUnk;
        dest->var2.dcpTtpNext = src->var2.dcpTtpNext;
        dest->var2.dxaCol = src->var2.dxaCol;
        dest->var2.dymHeight = src->var2.dymHeight;
		}
	else
		{
		dest->var1.fSpare = src->var1.fSpare;
        dest->var1.fUnk = src->var1.fUnk;

		dest->var1.fDiffLines = src->var1.fDiffLines;
        dest->var1.reserved1 = src->var1.reserved1;
        dest->var1.clMac = src->var1.clMac;
        dest->var1.reserved2 = src->var1.reserved2;
		
		dest->var1.dxaCol = src->var1.dxaCol;
        dest->var1.dymHeight = src->var1.dymHeight;
		}
	}

void wvInitPHE(PHE *item,int which)
	{
	if (which)
		{
		item->var2.fSpare = 0;
        item->var2.fUnk = 0;
        item->var2.dcpTtpNext = 0;
        item->var2.dxaCol = 0;
        item->var2.dymHeight = 0;
		}
	else
		{
		item->var1.fSpare = 0;
        item->var1.fUnk = 0;

		item->var1.fDiffLines = 0;
        item->var1.reserved1 = 0;
        item->var1.clMac = 0;
        item->var1.reserved2 = 0;
		
		item->var1.dxaCol = 0;
        item->var1.dymHeight = 0;
		}
	}