× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: API parameter lengths
  • From: bmorris@xxxxxxxxxx
  • Date: Mon, 9 Jul 2001 14:24:07 -0400
  • Importance: Normal


>Date: Mon, 9 Jul 2001 10:54:23 -0500
>From: "Alexei Pytel" <pytel@us.ibm.com>
>
>CALL command does not do this.
>C PEP (program entry point) procedure does. For every main() in C,
compiler
>generates a PEP (you may see it if you do DSPMOD on C module). This PEP
>procedure among other things will scan for first blank in each parameter
>and create null-terminated string for each parameter.
?This makes it very difficult to pass non-character parameters to C main().

Alexei, that is not true; where did you hear that?  If you call a C program
with a parameter of 'abc def ghi', it will get one parameter.  The
null-termination is indeed done by the call command.

Calling a C program from another program is not difficult.  In that
case, the C program receives the same parameters that the caller passed
because the PEP doesn't do any processing on the parameters except to
build the argv array from the parameters that are passed to the program.
But it just copies the parameter pointers into the array of pointers; it
doesn't do anything with the parameter data.

A test:

#include <stdio.h>
main(int argc, char *argv[])
{
   int i;
   for (i = 1; i < argc; i++)
   {
      printf("arg %d %s\n", i, argv[i]);
   }
}
===> CALL pgm ('abc def ghi' 'zyx')
arg 1 abc def ghi
arg 2 zyx





Barbara Morris

+---
| This is the MI Programmers Mailing List!
| To submit a new message, send your mail to MI400@midrange.com.
| To subscribe to this list send email to MI400-SUB@midrange.com.
| To unsubscribe from this list send email to MI400-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: dr2@cssas400.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.