-Dasn_DEF is not -DPDU

git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@1140 59561ff5-6e30-0410-9f3c-9617f08c8826
This commit is contained in:
vlm 2006-08-25 02:35:08 +00:00
parent 9bcc5990ba
commit b51ebb2e1f
5 changed files with 14 additions and 9 deletions

Binary file not shown.

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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;