Skip to content

Commit 72c95db

Browse files
MdeBoerBlazdellsbscholz
authored andcommitted
add slice support
1 parent d8787b9 commit 72c95db

3 files changed

Lines changed: 18 additions & 14 deletions

File tree

src/stdio/src/FibreIO/ScanStringArr.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ void FibreScanStringArray( SAC_ND_PARAM_out( resout_nt, array *), FILE *stream)
2121
array *SAC_ND_A_FIELD( res_nt );
2222
int size;
2323
int i;
24-
25-
SAC_ND_ALLOC__DESC( res_nt, 0);
26-
SAC_ND_SET__RC( res_nt, 1);
27-
24+
char* s;
2825

2926
start_token = PARSE_STRING_ARRAY;
3027
doScan( stream);
@@ -35,14 +32,18 @@ void FibreScanStringArray( SAC_ND_PARAM_out( resout_nt, array *), FILE *stream)
3532
}
3633

3734
res = SAC_StringArray_alloc( dims, size);
38-
35+
3936
for( i=0; i < dims; i++) {
4037
res->shp[i] = shape[i];
4138
}
4239

4340
res->data = stringarray;
4441

42+
SAC_ND_ALLOC__DESC( res_nt, 0);
43+
SAC_ND_SET__RC( res_nt, 1);
44+
4545
for( i=0; i < size ; i++) {
46+
s = stringarray[i];
4647
SAC_ND_DECL__DESC( s_nt, );
4748
SAC_ND_ALLOC__DESC( s_nt, 0);
4849
SAC_ND_SET__RC( s_nt, 1);
@@ -68,10 +69,7 @@ void FibreScanStringArrayStr( SAC_ND_PARAM_out( resout_nt, array *), char *strea
6869
array *SAC_ND_A_FIELD( res_nt );
6970
int size;
7071
int i;
71-
72-
SAC_ND_ALLOC__DESC( res_nt, 0);
73-
SAC_ND_SET__RC( res_nt, 1);
74-
72+
char* s;
7573

7674
start_token = PARSE_STRING_ARRAY;
7775
yy_scan_string( stream);
@@ -90,7 +88,11 @@ void FibreScanStringArrayStr( SAC_ND_PARAM_out( resout_nt, array *), char *strea
9088

9189
res->data = stringarray;
9290

91+
SAC_ND_ALLOC__DESC( res_nt, 0);
92+
SAC_ND_SET__RC( res_nt, 1);
93+
9394
for( i=0; i < size ; i++) {
95+
s = stringarray[i];
9496
SAC_ND_DECL__DESC( s_nt, );
9597
SAC_ND_ALLOC__DESC( s_nt, 0);
9698
SAC_ND_SET__RC( s_nt, 1);

src/stdio/src/File/mkstemp.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ int SACmkstemp ( SAC_ND_PARAM_out_nodesc (filep_nt, FILE*),
2626
// initialise filep
2727
SAC_ND_A_FIELD (filep_nt) = NULL;
2828

29-
// alloc string descriptor and string
30-
SAC_ND_ALLOC__DESC (str_nt, 0)
29+
// alloc string
3130
SAC_ND_SET__RC (str_nt, 1)
3231
SAC_ND_A_FIELD (str_nt) = SAC_MALLOC (length + 1);
3332

@@ -46,6 +45,9 @@ int SACmkstemp ( SAC_ND_PARAM_out_nodesc (filep_nt, FILE*),
4645
error = errno;
4746
}
4847
}
48+
// alloc string descriptor
49+
SAC_ND_ALLOC__DESC (str_nt, 0)
50+
4951

5052
SAC_ND_RET_out__NODESC (filep_nt, filep_nt)
5153
SAC_ND_RET_out (str_nt, str_nt)

src/structures/src/StringArray/genarray.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ void SAC_StringArray_genarray( SAC_ND_PARAM_out( resout_nt, array *),
1717
int dim, size;
1818
int i;
1919

20-
SAC_ND_ALLOC__DESC( res_nt, 0);
21-
SAC_ND_SET__RC( res_nt, 1);
22-
2320
dim = SAC_ND_A_DESC_SIZE( shp_nt );
2421
size = 1;
2522
for( i=0; i < dim; i++) {
@@ -28,6 +25,9 @@ void SAC_StringArray_genarray( SAC_ND_PARAM_out( resout_nt, array *),
2825

2926
res = SAC_StringArray_alloc( dim, size);
3027

28+
SAC_ND_ALLOC__DESC( res_nt, 0);
29+
SAC_ND_SET__RC( res_nt, 1);
30+
3131
for( i=0; i < dim; i++) {
3232
res->shp[i] = SAC_ND_READ( shp_nt, i);
3333
}

0 commit comments

Comments
 (0)