OSDN Git Service

最初のコミット
[winaudioj/stedx.git] / rcpconv.cpp
1 /*
2   RCP converter
3
4   Copyright 1999 by Daisuke Nagano <breeze.nagano@nifty.ne.jp>
5   May.28.1999
6   Oct.16.2002
7
8
9   Permission is hereby granted, free of charge, to any person obtaining a copy
10   of this software and associated documentation files (the "Software"), to deal
11   in the Software without restriction, including without limitation the rights
12   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13   copies of the Software, and to permit persons to whom the Software is
14   furnished to do so, subject to the following conditions:
15
16   The above copyright notice and this permission notice shall be included in
17   all copies or substantial portions of the Software.
18
19   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
22   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25   THE SOFTWARE.
26 */
27
28 /* ------------------------------------------------------------------- */
29
30 #include <stdio.h>
31 #include <stdlib.h>
32
33 #include "rcp.h"
34 #include "rcpconv.h"
35
36 /* ------------------------------------------------------------------- */
37
38 long rcpconv( unsigned char *data, long length, unsigned char **smf, 
39               unsigned char *copyright ) {
40
41   RCP_DATA rcp;
42   long smf_length;
43
44   rcp.length       = length;
45   rcp.data         = data;
46   rcp.date         = NULL;  /* timestamp text (ctime) of original RCP file */
47   rcp.file_name    = NULL;  /* filename of original RCP file */
48 #ifdef RCPCONV_COMMAND_NAME
49   rcp.command_name = RCPCONV_COMMAND_NAME;
50 #else
51   rcp.command_name = NULL;
52 #endif
53   rcp.copyright    = copyright;
54
55   rcp.enable_converter_notice = FLAG_FALSE;
56   rcp.enable_verbose          = FLAG_FALSE;
57
58   *smf = rcptomid( &rcp );
59   if ( *smf == NULL ) smf_length = -10;
60   else smf_length = rcp.smf_size;
61
62   return smf_length;
63 }
64
65 long rcpconv_with_notice( unsigned char *data, long length, unsigned char **smf, 
66                           unsigned char *copyright,
67                           unsigned char *command_name,
68                           unsigned char *file_name,
69                           unsigned char *date ) {
70
71   RCP_DATA rcp;
72   long smf_length;
73
74   rcp.length       = length;
75   rcp.data         = data;
76   rcp.date         = date;
77   rcp.file_name    = file_name;
78   rcp.command_name = command_name;
79   rcp.copyright    = copyright;
80
81   rcp.enable_converter_notice = FLAG_TRUE;
82   rcp.enable_verbose          = FLAG_FALSE;
83
84   *smf = rcptomid( &rcp );
85   if ( *smf == NULL ) smf_length = -10;
86   else smf_length = rcp.smf_size;
87
88   return smf_length;
89 }