Browse Prior Art Database

Universal Printing of User Defined Data Types

IP.com Disclosure Number: IPCOM000116176D
Original Publication Date: 1995-Aug-01
Included in the Prior Art Database: 2005-Mar-30
Document File: 2 page(s) / 59K

Publishing Venue

IBM

Related People

Malik, N: AUTHOR [+4]

Abstract

In many C programs, it is necessary to print the contents of user-defined abstract data types. These data structures are usually cumbersome to print due to complexity and heavy nesting of types. Currently, in order to print user-defined types, the application programmer has to manually write type-specific print routines resulting in substantial lines of code.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 57% of the total text.

Universal Printing of User Defined Data Types

      In many C programs, it is necessary to print the contents of
user-defined abstract data types.  These data structures are usually
cumbersome to print due to complexity and heavy nesting of types.
Currently, in order to print user-defined types, the application
programmer has to manually write type-specific print routines
resulting in substantial lines of code.

      Described is a software tool which scans the programmer's code
and generates an Abstract Syntax Tree (AST) of user-defined types.
Using the AST, the tool will be able to generate a set of print
routines for every user-defined type definition.  Since all
user-defined types resolve to basic C data types (char, int,
...etc.), the leaf nodes in the tree will generate
terminal-print-routines while the intermediate and top level nodes
generate top and intermediate-print-routines which call either
terminal-print-routines or intermediate-print-routines.  While
traversing the AST, the tool will ensure that only one print routine
is generated for every type definition.  The set of generated print
routines can then be complied into a library and linked to the
application program.  The tool also generates a known Application
Programming Interface (API) function for the programmers to access
the print routines.  This API function has the following prototype:
  Print_Type("typename", &variable);

      In order to print the contents of a particular data s...