1 /* wvWare
2  * Copyright (C) Caolan McNamara, Dom Lachowicz, and others
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17  * 02111-1307, USA.
18  */
19 
20 #ifdef HAVE_CONFIG_H
21 #include "config.h"
22 #endif
23 
24 #include <stdlib.h>
25 #include <stdio.h>
26 #include "wv.h"
27 
28 void
wvGetPGD(wvVersion ver,PGD * item,wvStream * fd)29 wvGetPGD (wvVersion ver, PGD * item, wvStream * fd)
30 {
31     U16 temp16;
32 
33     temp16 = read_16ubit (fd);
34     item->fContinue = temp16 & 0x0001;
35     item->fUnk = (temp16 & 0x0002) >> 1;
36     item->fRight = (temp16 & 0x0004) >> 2;
37     item->fPgnRestart = (temp16 & 0x0008) >> 3;
38     item->fEmptyPage = (temp16 & 0x0010) >> 4;
39     item->fAllFtn = (temp16 & 0x0020) >> 5;
40     item->fColOnly = (temp16 & 0x0040) >> 6;
41     item->fTableBreaks = (temp16 & 0x0080) >> 7;
42     item->fMarked = (temp16 & 0x0100) >> 8;
43     item->fColumnBreaks = (temp16 & 0x0200) >> 9;
44     item->fTableHeader = (temp16 & 0x0400) >> 10;
45     item->fNewPage = (temp16 & 0x0800) >> 11;
46     item->bkc = (temp16 & 0xF000) >> 12;
47 
48     item->lnn = read_16ubit (fd);
49     item->pgn = read_16ubit (fd);
50     if (ver == WORD8)
51 	item->dym = (S32) read_32ubit (fd);
52     else
53 	item->dym = 0;
54 }
55