-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstrsub.c
More file actions
83 lines (61 loc) · 1.59 KB
/
Copy pathstrsub.c
File metadata and controls
83 lines (61 loc) · 1.59 KB
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
/////////////////////////////////////////////////////////////////////////////
//
// /
// - P / E C E -
// / mobile equipment
//
// System Programs
//
//
// PIECE TOOLS : mucc : Ver 1.00
//
// Copyright (C)2001 AUQAPLUS Co., Ltd. / OeRSTED, Inc. all rights reserved.
//
// Coded by MIO.H (OeRSTED)
//
// Comments:
//
// ミュージック・データ・コンバーター
//
// v1.00 2001.11.09 MIO.H
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "hash.h"
#include "mucc.h"
#define MAXSTRS 5000
#define MAXCBUF (80*1024)
static HASHDATA strhd[MAXSTRS];
static char cbuff[MAXCBUF];
static int hdc = 0;
static int cbc = 0;
HASHDATA *RegisterStr( char *str, unsigned long type, unsigned long value )
{
HASHDATA *phd = NULL;
int n = strlen(str);
if ( n == 0 ) return 0;
if ( cbc + n + 1 >= MAXCBUF ) fatal( "String area over(1)" );
if ( hdc + 1 >= MAXSTRS ) fatal( "String area over(2)" );
phd = strhd + hdc++;
phd->str = cbuff + cbc;
phd->type = type;
phd->value = value;
memcpy( phd->str, str, n+1 );
cbc += n+1;
return phd;
}
HASHDATA *RegisterStrHash( char *str, unsigned long type, unsigned long value )
{
HASHDATA *phd = SearchHash( str );
if ( !phd ) {
phd = RegisterStr( str, type, value );
if ( phd ) RegisterHash( phd );
}
return phd;
}
void ReportStr( void )
{
printf( "Total used string entries = %d(%5.1f%%)\n", hdc, hdc * 100.0 / MAXSTRS );
printf( "Total used string area = %d(%5.1f%%)\n", cbc, cbc * 100.0 / MAXCBUF );
}