Skip to content

Commit ebf772d

Browse files
committed
Pull datCctyp into a separate file
it wasn't obvious where it was before.
1 parent 7c468a4 commit ebf772d

File tree

3 files changed

+94
-13
lines changed

3 files changed

+94
-13
lines changed

Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ C_ROUTINES = \
8585
datFind.c \
8686
datType.c \
8787
datClen.c \
88+
datCctyp.c \
8889
datName.c \
8990
datSize.c \
9091
datShape.c \

datCctyp.c

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/*
2+
*+
3+
* Name:
4+
* datCctyp
5+
6+
* Purpose:
7+
* Creat type string
8+
9+
* Language:
10+
* Starlink ANSI C
11+
12+
* Type of Module:
13+
* Library routine
14+
15+
* Invocation:
16+
* datCctyp( size_t size, char type[DAT__SZTYP+1] );
17+
18+
* Arguments:
19+
* size = size_t (Given)
20+
* Character string size
21+
* type = char * (Given)
22+
* Type string. Allocated size must be at least DAT__SZTYP+1 characters
23+
* long. String will be of the form "_CHAR*nnn".
24+
25+
* Description:
26+
* Create a type string for a specified size of character string.
27+
28+
* Authors:
29+
* TIMJ: Tim Jenness (Cornell)
30+
* {enter_new_authors_here}
31+
32+
* History:
33+
* 2014-08-31 (TIMJ):
34+
* Initial version
35+
* {enter_further_changes_here}
36+
37+
* Copyright:
38+
* Copyright (C) 2014 Cornell University
39+
* All Rights Reserved.
40+
41+
* Licence:
42+
* Redistribution and use in source and binary forms, with or
43+
* without modification, are permitted provided that the following
44+
* conditions are met:
45+
*
46+
* - Redistributions of source code must retain the above copyright
47+
* notice, this list of conditions and the following disclaimer.
48+
*
49+
* - Redistributions in binary form must reproduce the above
50+
* copyright notice, this list of conditions and the following
51+
* disclaimer in the documentation and/or other materials
52+
* provided with the distribution.
53+
*
54+
* - Neither the name of the {organization} nor the names of its
55+
* contributors may be used to endorse or promote products
56+
* derived from this software without specific prior written
57+
* permission.
58+
*
59+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
60+
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
61+
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
62+
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
63+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
64+
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
65+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
66+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
67+
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
68+
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
69+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
70+
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
71+
* THE POSSIBILITY OF SUCH DAMAGE.
72+
73+
* Bugs:
74+
* {note_any_bugs_here}
75+
*-
76+
*/
77+
78+
#include <stdio.h>
79+
80+
#include "ems.h"
81+
#include "sae_par.h"
82+
83+
#include "hds1.h"
84+
#include "dat1.h"
85+
#include "hds.h"
86+
87+
void
88+
datCctyp( size_t size, char *type ) {
89+
90+
/* have to assume the buffer is big enough - should be DAT__SZTYP+1
91+
- noting that snprintf is C99 so not used (yet) */
92+
sprintf( type, "_CHAR*%zu", size);
93+
}

datnew1.c

-13
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,6 @@ datNewC(const HDSLoc *locator,
4444
return *status;
4545
}
4646

47-
/*====================================*/
48-
/* DAT_CCTYP - Create type string */
49-
/*====================================*/
50-
51-
void
52-
datCctyp( size_t size,
53-
char *type )
54-
{
55-
/* have to assume the buffer is big enough - should be DAT__SZTYP+1
56-
- noting that snprintf is C99 so not used (yet) */
57-
sprintf( type, "_CHAR*%lu", (unsigned long)size);
58-
}
59-
6047
/*================================================*/
6148
/* DAT_NEW1 - Create a vector structure component */
6249
/*================================================*/

0 commit comments

Comments
 (0)