rrlp-ephemeris: Add directory with asn1c patches

 - One is just to improve the debug prints
 - The other fixes a problem in PER encoding found by Dieter Spaar.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
diff --git a/asn1c_patches/00_add_enumerated_verbose.diff b/asn1c_patches/00_add_enumerated_verbose.diff
new file mode 100644
index 0000000..64c22a3
--- /dev/null
+++ b/asn1c_patches/00_add_enumerated_verbose.diff
@@ -0,0 +1,56 @@
+Index: skeletons/NativeEnumerated.c
+===================================================================
+--- skeletons/NativeEnumerated.c	(revision 1407)
++++ skeletons/NativeEnumerated.c	(working copy)
+@@ -22,7 +22,7 @@
+ 	"ENUMERATED",			/* The ASN.1 type is still ENUMERATED */
+ 	"ENUMERATED",
+ 	NativeInteger_free,
+-	NativeInteger_print,
++	NativeEnumerated_print,
+ 	asn_generic_no_constraint,
+ 	NativeInteger_decode_ber,
+ 	NativeInteger_encode_der,
+@@ -205,3 +205,30 @@
+ 	_ASN_ENCODED_OK(er);
+ }
+ 
++int
++NativeEnumerated_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
++	asn_app_consume_bytes_f *cb, void *app_key) {
++	asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics;
++	const long *native = (const long *)sptr;
++	char scratch[256];
++	int ret;
++
++	(void)td;	/* Unused argument */
++	(void)ilevel;	/* Unused argument */
++
++	if(native) {
++		const asn_INTEGER_enum_map_t *map = INTEGER_map_value2enum(specs, *native);
++		if (map && map->enum_len && map->enum_name) {
++			ret = snprintf(scratch, sizeof(scratch),
++				"%s", map->enum_name);
++		} else {
++			ret = snprintf(scratch, sizeof(scratch),
++				(specs && specs->field_unsigned)
++				? "%lu" : "%ld", *native);
++		}
++		assert(ret > 0 && (size_t)ret < sizeof(scratch));
++		return (cb(scratch, ret, app_key) < 0) ? -1 : 0;
++	} else {
++		return (cb("<absent>", 8, app_key) < 0) ? -1 : 0;
++	}
++}
+Index: skeletons/NativeEnumerated.h
+===================================================================
+--- skeletons/NativeEnumerated.h	(revision 1407)
++++ skeletons/NativeEnumerated.h	(working copy)
+@@ -24,6 +24,7 @@
+ xer_type_encoder_f NativeEnumerated_encode_xer;
+ per_type_decoder_f NativeEnumerated_decode_uper;
+ per_type_encoder_f NativeEnumerated_encode_uper;
++asn_struct_print_f NativeEnumerated_print;
+ 
+ #ifdef __cplusplus
+ }
diff --git a/asn1c_patches/01_fix_per_encoding_dieter.diff b/asn1c_patches/01_fix_per_encoding_dieter.diff
new file mode 100644
index 0000000..a09c201
--- /dev/null
+++ b/asn1c_patches/01_fix_per_encoding_dieter.diff
@@ -0,0 +1,17 @@
+Index: skeletons/per_support.c
+===================================================================
+--- skeletons/per_support.c	(revision 1407)
++++ skeletons/per_support.c	(working copy)
+@@ -336,7 +336,12 @@
+ 		buf[3] = bits;
+ 	else {
+ 		ASN_DEBUG("->[PER out split %d]", obits);
++#if 1 // Dieter
++		po->nboff -= obits; // undo incrementation from a few lines above
++		per_put_few_bits(po, bits >> (obits - 24), 24); // shift according to the rest of the bits 
++#else		
+ 		per_put_few_bits(po, bits >> 8, 24);
++#endif
+ 		per_put_few_bits(po, bits, obits - 24);
+ 		ASN_DEBUG("<-[PER out split %d]", obits);
+ 	}