home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 344_01 / p2s.doc < prev    next >
Text File  |  1990-09-21  |  2KB  |  62 lines

  1. Program: 
  2. *                 P2S
  3. *
  4. *         printf() to streams i/o converter
  5. *
  6. * Description:
  7. *
  8. * Converts printf() calls to << operators
  9. * Uses Lex to find printf's, fprintf's and sprintf's in C source
  10. * and then uses p2s() call to convert the printf arguments to C++ streams
  11. * formatted I/O.
  12. * Does handle things like %6.2f (width and precision flags)
  13. * by generating the appropriate streams manipulators - setw()
  14. * and setprecision().
  15. * Does NOT handle things like %-6.2f (yet) since there are no manipulators
  16. * for left and right justification (if you decide to enhance this to
  17. * handle this or anything else please submit back to CUG or me)
  18. *
  19. * stdin reads inoriginal C source, converted source goes to stdout.
  20. *
  21. * Usage: 
  22. *
  23. * P2S < {.c file with printfs} > {file with streams i/o}
  24. * Options:
  25. *    f - don't convert fprintf()'s
  26. *    p - don't convert printf()'s
  27. *    s - don't convert sprintf()'s
  28. *    i - converts by doing 
  29. *        #ifdef __cplusplus
  30. *          ... streams code ..
  31. *        #else
  32. *          ... old printf code ...
  33. *        #endif
  34. *        to maintain backward compatibility with C (if desired)
  35. *
  36. * Example:
  37. *
  38. * For example to only convert fprintf calls and maintain C compatibility
  39. * the invocation is:
  40. *
  41. *     p2s p s i < foo.c >foo.cpp
  42. *         
  43. *    
  44. * Construction:
  45. *
  46. * Just flex (or lex) this file, and compile the resultant C source. 
  47. * MKP2S.BAT shows how to make program with Flex and Turbo C.
  48. *
  49. * Restrictions:
  50. * You may use this program without restriction as a tool in your own 
  51. * development efforts. 
  52. * You MAY NOT redistribute either the source or executables, in modified
  53. * or unmodified form, for any amount of money or along with any other 
  54. * commercial package. You must include this copyright in any program
  55. * which uses this source and you may not distribute such programs 
  56. * commercially. No restrictions apply to any programs which you converted
  57. * using this tool (using the tool is unrestricted, distributing it or using
  58. * its source is).
  59. * Copyright (c) 1990. Adam Blum, Retrieval Systems Corporation,(703)-524-4534
  60.