cfad47cfa3/tads2/linfdum.c

4b825dc642cb6eb9a060e54bf8d69288fbee4904cfad47cfa334b206c65f22086bcc5d63e6f70944
1
#ifdef RCSID
2
static char RCSid[] =
3
"$Header: d:/cvsroot/tads/TADS2/LINFDUM.C,v 1.2 1999/05/17 02:52:12 MJRoberts Exp $";
4
#endif
5
6
/* 
7
 *   Copyright (c) 1992, 2002 Michael J. Roberts.  All Rights Reserved.
8
 *   
9
 *   Please see the accompanying license file, LICENSE.TXT, for information
10
 *   on using and copying this software.  
11
 */
12
/*
13
Name
14
  linfdum.c - dummy implementation of line source loader
15
Function
16
  Implements a line source loader that just reads a file line source
17
  from a .gam file and ignores the information therein.  Used to link
18
  the run-time if debugging functions are not desired (because the
19
  rest of the linf implementation will be unnecessary in this case).
20
Notes
21
  None
22
Modified
23
  04/11/92 MJRoberts     - creation
24
*/
25
26
#include <stdio.h>
27
#include <string.h>
28
#include <stdlib.h>
29
#include <limits.h>
30
31
#include "os.h"
32
#include "std.h"
33
#include "err.h"
34
#include "mch.h"
35
#include "linf.h"
36
#include "dbg.h"
37
#include "tok.h"
38
39
/* read and ignore a file-line-source from binary (.gam) file */
40
int linfload(osfildef *fp, dbgcxdef *dbgctx, errcxdef *ec, tokpdef *path)
41
{
42
    uchar    buf[UCHAR_MAX + 6];
43
    uint     pgcnt;
44
    ulong    reccnt;
45
46
    VARUSED(ec);
47
    VARUSED(dbgctx);
48
    VARUSED(path);
49
    
50
    /* read the source's description from the file */
51
    if (osfrb(fp, buf, 6)
52
        || osfrb(fp, buf + 6, (int)buf[1]))
53
        return(TRUE);
54
    
55
    /* skip the pages of debugging line records */
56
    reccnt = osrp4(buf + 2);
57
    if (!reccnt) return(FALSE);                  /* no debug records at all */
58
    pgcnt = 1 + ((reccnt - 1) >> 10);             /* figure number of pages */
59
    while (pgcnt--)
60
    {
61
        if (osfseek(fp, (1024 * DBGLINFSIZ), OSFSK_CUR)) return(TRUE);
62
    }
63
64
    /* do nothing with this information - just return success */
65
    return(FALSE);
66
}
67
68