aboutsummaryrefslogtreecommitdiff
path: root/pkg/tbtables/tbeszt.x
blob: f7fc0ff39459e104fb4da73d562d1a83acc7b136 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
include <mach.h>		# needed for SZB_CHAR
include "tbtables.h"

# tbeszt -- length of char element
# This routine returns the amount of space (unit = char) taken up in a
# table file by a character string.  This may be different from the length
# of the string as would be returned by the strlen function, say, because
# the element in the table is packed, and the space is rounded up to a
# multiple of SZB_CHAR bytes.
#
# Phil Hodge, 28-Jul-1994  Function created.
# Phil Hodge, 31-Oct-1994  Check for data type = TY_CHAR.

int procedure tbeszt (cptr)

pointer cptr			# i: pointer to column descriptor
#--

begin
	if (COL_DTYPE(cptr) == TY_CHAR)		# old notation
	    return (COL_LEN(cptr))
	else
	    return ((-COL_DTYPE(cptr) + SZB_CHAR-1) / SZB_CHAR)
end