home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / unix / question / 13576 < prev    next >
Encoding:
Text File  |  1992-11-18  |  2.1 KB  |  49 lines

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!walter!spiegel@bellcore.com
  3. From: spiegel@song.bellcore.com (Murray Spiegel)
  4. Subject: function calls for awkcc code
  5. Message-ID: <1992Nov18.163223.14783@walter.bellcore.com>
  6. Sender: news@walter.bellcore.com
  7. Nntp-Posting-Host: song.bellcore.com
  8. Organization: Bellcore
  9. Date: Wed, 18 Nov 92 16:32:23 GMT
  10. Lines: 37
  11.  
  12. We have developed an application using (n)awk, and convert to C
  13. using awkcc when we want to run the program (for purposes of speed up).
  14.  
  15. The program takes input from stdin and writes to stdout.
  16. (When stuff is read into an awk program some other variables
  17. like $0, NF, etc, are also set.)
  18.  
  19. We want to change the input/output mechanism of our program,
  20. specifically the awkcc generated version, as that is what 
  21. we will be using in the final product.
  22.  
  23. We want our program to be implemented as a _function call_.
  24.  
  25. That is, instead of reading stuff from stdin, our C program 
  26. is passed a parameter which would be the input string, and returns
  27. an output string (instead of writing to stdio). As our program takes 
  28. a long time to initialize (it has a very large BEGIN structure), 
  29. we do not want to do the initialization for every input.
  30.  
  31. The awkcc generated code is very obscure, and it seems a non-trivial
  32. task to implement our awkcc generated program as a function call. 
  33. We did locate the function which opens the input as a stream of type FILE *. 
  34. However, it seems trying to change that would in turn entail changing/rewriting 
  35. a whole bunch of code. We are looking for help to solve this problem.
  36.  
  37. One way to get around this problem is to have a parent process which
  38. connects via pipes in both directions to a child process (our program)
  39. which is started up once.  We then communicated with the parent C
  40. program.   But in our case, we DO NOT want to have about 48 different
  41. child processes running for 48 the different sources which can access
  42. our program on one machine.
  43.  
  44. That's why we are looking into implementing our program as a function call.
  45.  
  46. Anyone who can offer some help, please send me email.  Thank you!
  47.  
  48. spiegel@bellcore.com
  49.