morph lenpfx to valterm: make item type generic
This commit is contained in:
parent
0eb8074644
commit
76c005ac8b
2 changed files with 7 additions and 4 deletions
|
@ -13,9 +13,9 @@ morph_array_as_valterm_to_lenpfx (Terminator:native.UInt8)
|
|||
```
|
||||
|
||||
|
||||
morph_array_as_lenpfx_to_valterm (Terminator:native.UInt8)
|
||||
<Seq~<LengthPrefix native.UInt64> native.UInt8>
|
||||
--> <Seq~<ValueTerminated Terminator> native.UInt8>
|
||||
morph_array_as_lenpfx_to_valterm (T: Type, Terminator: T)
|
||||
<Seq~<LengthPrefix native.UInt64> T>
|
||||
--> <Seq~<ValueTerminated Terminator> T>
|
||||
```
|
||||
for( uint64_t i = 0; i < src->len; ++i )
|
||||
*dst++ = src->items[i];
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <stdlib.h>
|
||||
```
|
||||
|
||||
morph_seqseq_valsep_uint8 (T: Type, SrcDelim: T, DstDelim: T)
|
||||
morph_valsep_delim (T: Type, SrcDelim: T, DstDelim: T)
|
||||
< Seq <Seq T> >
|
||||
~ < ValueSep SrcDelim T >
|
||||
~ < Seq~<LengthPrefix native.UInt64> T >
|
||||
|
@ -22,6 +22,9 @@ morph_seqseq_valsep_uint8 (T: Type, SrcDelim: T, DstDelim: T)
|
|||
if( DstDelim == '\n' ) {
|
||||
PRESCAN_LENGTH_PREFIX_CALL(nativeUInt64, T, push)( dst, '\\' );
|
||||
PRESCAN_LENGTH_PREFIX_CALL(nativeUInt64, T, push)( dst, 'n' );
|
||||
} else {
|
||||
PRESCAN_LENGTH_PREFIX_CALL(nativeUInt64, T, push)( dst, '\\' );
|
||||
PRESCAN_LENGTH_PREFIX_CALL(nativeUInt64, T, push)( dst, DstDelim );
|
||||
}
|
||||
} else {
|
||||
PRESCAN_LENGTH_PREFIX_CALL(nativeUInt64, T, push)( dst, src->items[i] );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue