forked from mandovinnie/Lute-Tab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathincl.cc
83 lines (64 loc) · 2.12 KB
/
incl.cc
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
/*
This program is copyright 1991 by Wayne Cripps,
P.O. Box 677 Hanover N.H. 03755.
All rights reserved. It is supplied "as is"
without express or implied warranty.
Permission is granted to use, copy, modify and distribute
this software without fee, provided that this notice appears
in all copies, and that a copy of this notice is provided to
anyone who recieves a binary copy without sources.
This software may not be used for commercial purposes
without explicit, prior written permission.
Please mail bug reports, suggestions, and improvements
*/
#ifdef sgi
#include <bstring.h>
#endif
#include "win.h"
#include "tab.h"
#include "i_buf.h"
#include "file_in.h"
void get_tab_file(file_in *fi, i_buf *ib, struct file_info *f);
void include(i_buf *ib, struct file_info *f, char file []);
extern double staff_len, o_staff_len;
/* we should read as main input, then return */
void include(i_buf *ib, struct file_info *f, char file [])
{
struct file_info *newf;
file_in *ffi;
newf = (struct file_info *)malloc( sizeof (struct file_info));
newf->file = (char *)malloc( BUFSIZ );
strcpy (newf->file, file);
newf->out_file = (char *)malloc( BUFSIZ );
newf->flags = f->flags;
newf->m_flags = f->m_flags;
newf->line_flag = f->line_flag;
newf->flag_flag = f->flag_flag;
newf->char_flag = f->char_flag;
newf->num_flag = f->num_flag;
newf->note_flag = f->note_flag;
newf->n_text = f->n_text;
newf->note_conv = f->note_conv;
newf->c_space = f->c_space;
newf->page = f->page;
newf->sys_skip = f->sys_skip;
/* font names and font sizes? */
newf->include = 1;
if ( ! (f->m_flags & QUIET ))
dbg1(Warning, "tab: including file %s\n", (void *)newf->file);
newf->flags |= INCLUDE;
staff_len = o_staff_len;
#if defined WIN32
ffi = new file_in(newf->file, "r");
#else
ffi = new file_in(newf->file, "rb");
#endif /* WIN32 */
get_tab_file(ffi, ib, newf);
delete (ffi);
f->page = newf->page;
free(newf->file);
free(newf->out_file);
free(newf);
return;
}