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