diff options
author | Lev Walkin <vlm@lionet.info> | 2006-08-25 02:35:08 +0000 |
---|---|---|
committer | Lev Walkin <vlm@lionet.info> | 2006-08-25 02:35:08 +0000 |
commit | d0625682126d9dccb448fe968c3bb94b0aa2aa84 (patch) | |
tree | 1d41392b6466a7e9e378d00a9dbc6a058b20fc4f | |
parent | 5e2f23e54627c5f73a1e53cf82b6ada77be3ad3b (diff) |
-Dasn_DEF is not -DPDU
-rw-r--r-- | doc/asn1c-quick.pdf | bin | 101967 -> 102144 bytes | |||
-rw-r--r-- | examples/sample.source.MHEG5/Makefile | 2 | ||||
-rw-r--r-- | examples/sample.source.PKIX1/Makefile | 2 | ||||
-rw-r--r-- | examples/sample.source.TAP3/Makefile | 2 | ||||
-rw-r--r-- | skeletons/converter-sample.c | 17 |
5 files changed, 14 insertions, 9 deletions
diff --git a/doc/asn1c-quick.pdf b/doc/asn1c-quick.pdf Binary files differindex c16b16ce..e9910afe 100644 --- a/doc/asn1c-quick.pdf +++ b/doc/asn1c-quick.pdf diff --git a/examples/sample.source.MHEG5/Makefile b/examples/sample.source.MHEG5/Makefile index 7fe0f49d..43e6b90c 100644 --- a/examples/sample.source.MHEG5/Makefile +++ b/examples/sample.source.MHEG5/Makefile @@ -472,7 +472,7 @@ InterchangedObject.c: ../ISO13522-MHEG-5.asn regenerate.Makefile ASN_CONVERTER=../../skeletons/converter-sample.c $(TARGET).o: $(ASN_CONVERTER) - $(CC) $(CFLAGS) -Dasn_DEF=asn_DEF_InterchangedObject -o $(TARGET).o -c $(ASN_CONVERTER) + $(CC) $(CFLAGS) -DPDU=InterchangedObject -o $(TARGET).o -c $(ASN_CONVERTER) distclean: clean rm -f $(ASN_MODULE_SOURCES) $(ASN_MODULE_HEADERS) diff --git a/examples/sample.source.PKIX1/Makefile b/examples/sample.source.PKIX1/Makefile index 6eb381ff..8ea848d2 100644 --- a/examples/sample.source.PKIX1/Makefile +++ b/examples/sample.source.PKIX1/Makefile @@ -375,7 +375,7 @@ Certificate.c: regenerate.Makefile ASN_CONVERTER=../../skeletons/converter-sample.c $(TARGET).o: $(ASN_CONVERTER) - $(CC) $(CFLAGS) -Dasn_DEF=asn_DEF_Certificate -o $(TARGET).o -c $(ASN_CONVERTER) + $(CC) $(CFLAGS) -DPDU=Certificate -o $(TARGET).o -c $(ASN_CONVERTER) distclean: clean rm -f $(ASN_MODULE_SOURCES) $(ASN_MODULE_HEADERS) diff --git a/examples/sample.source.TAP3/Makefile b/examples/sample.source.TAP3/Makefile index 24833598..7b4f3977 100644 --- a/examples/sample.source.TAP3/Makefile +++ b/examples/sample.source.TAP3/Makefile @@ -702,7 +702,7 @@ DataInterChange.c: ../tap3.asn1 regenerate.Makefile ASN_CONVERTER=../../skeletons/converter-sample.c $(TARGET).o: $(ASN_CONVERTER) - $(CC) $(CFLAGS) -Dasn_DEF=asn_DEF_DataInterChange -o $(TARGET).o -c $(ASN_CONVERTER) + $(CC) $(CFLAGS) -DPDU=DataInterChange -o $(TARGET).o -c $(ASN_CONVERTER) distclean: clean rm -f $(ASN_MODULE_SOURCES) $(ASN_MODULE_HEADERS) diff --git a/skeletons/converter-sample.c b/skeletons/converter-sample.c index dd0efdce..3a76b764 100644 --- a/skeletons/converter-sample.c +++ b/skeletons/converter-sample.c @@ -1,10 +1,10 @@ /* - * Generic decoder template for a selected ASN.1 type. - * Copyright (c) 2005 Lev Walkin <vlm@lionet.info>. All rights reserved. + * Generic converter template for a selected ASN.1 type. + * Copyright (c) 2005, 2006 Lev Walkin <vlm@lionet.info>. All rights reserved. * - * To compile with your own ASN.1 type, please redefine the asn_DEF as shown: + * To compile with your own ASN.1 type, please redefine the PDU as shown: * - * cc -Dasn_DEF=asn_DEF_MyCustomType -o myDecoder.o -c asn-decoder-template.c + * cc -DPDU=MyCustomType -o myDecoder.o -c converter-sample.c */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -21,7 +21,12 @@ #include <asn_application.h> #include <asn_internal.h> /* for _ASN_DEFAULT_STACK_MAX */ -extern asn_TYPE_descriptor_t asn_DEF; /* ASN.1 type to be decoded */ +/* Convert "Type" defined by -DPDU into "asn_DEF_Type" */ +#define ASN_DEF_PDU(t) asn_DEF_ ## t +#define DEF_PDU_Type(t) ASN_DEF_PDU(t) +#define PDU_Type DEF_PDU_Type(PDU) + +extern asn_TYPE_descriptor_t PDU_Type; /* ASN.1 type to be decoded */ #ifdef ASN_PDU_COLLECTION /* Generated by asn1c: -pdu=... */ extern asn_TYPE_descriptor_t *asn_pdu_collection[]; #endif @@ -66,7 +71,7 @@ DEBUG(const char *fmt, ...) { int main(int ac, char **av) { - static asn_TYPE_descriptor_t *pduType = &asn_DEF; + static asn_TYPE_descriptor_t *pduType = &PDU_Type; ssize_t suggested_bufsize = 8192; /* close or equal to stdio buffer */ int number_of_iterations = 1; int num; |