home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / intel / 1620 < prev    next >
Encoding:
Internet Message Format  |  1992-08-31  |  2.8 KB

  1. Path: sparky!uunet!sun-barr!cs.utexas.edu!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!ohstpy!mswe.dnet.ms.philips.nl!mosterman
  2. Newsgroups: comp.sys.intel
  3. Subject: Re: PLM programming query
  4. Message-ID: <1992Aug28.104119.131015@mswe.dnet.ms.philips.nl>
  5. From: mosterman@mswe.dnet.ms.philips.nl (Wim Mosterman)
  6. Date: 28 Aug 92 10:41:19 +0100
  7. References: <1992Aug26.093356.6125@canon.co.uk>
  8. Organization: Philips Medical Systems Nederland
  9. Lines: 58
  10.  
  11. In article <1992Aug26.093356.6125@canon.co.uk>, chudley@canon.co.uk (Martin Chudley) writes:
  12. > Apologies for this, it shouldn't be necessary but the PLM manual isn't very
  13. > helpful on this subject.
  14. > All I want to do is pass a string to a procedure. At present I'm using the
  15. > dot operator to pass a string constant in the function call and a based variable
  16. > to access it inside the procedure, and I get garbage. Can anyone send a few
  17. > lines of code showing how to do this - maybe I should just fork out for
  18. > something sensible like a C compiler.
  19. > Thanks
  20. > -- 
  21. > Martin Chudley (Postmaster)
  22. > ARPA : chudley@canon.co.uk                Voice : +44 483 574325
  23. > UUCP : ...seismo!mcsun!uknet!canon!chudley        Fax   : +44 483 574360
  24.  
  25. For PLM-51 try this one:
  26.  
  27. /****************************************************************/
  28. /* procedure which wants a pointer to a CONSTANT string        */
  29. /****************************************************************/
  30. write_string: PROCEDURE (ptr, type) USING 2 PUBLIC;
  31.     DECLARE type    BIT;    /* TRUE means ptr points to CONSTANT */
  32.     DECLARE ptr        WORD;
  33.     DECLARE string1    BASED ptr (1) BYTE CONSTANT;
  34.     DECLARE string2    BASED ptr (1) BYTE AUXILIARY;
  35.  
  36.     IF (type) THEN DO;
  37.      /* Use string1 for constant type */
  38.     END ELSE DO;
  39.      /* Use string2 for non-constant type */
  40.     END;
  41. END write_string;
  42.  
  43. /****************************************************************/
  44. /* The calls:                            */
  45. /****************************************************************/
  46. DECLARE output_string (80)    BYTE AUXILIARY;
  47.  
  48.     CALL write_string(.('any string', 0DH, 0AH, 0), 1);
  49.     CALL write_string(.output_string, 0);
  50.  
  51. Disclaimer:
  52.     I'm not sure that the syntax is okay everywhere.
  53.     I assembled this from some old sources I made long ago.
  54.  
  55. Hopefully this helps.
  56. .-------------------------------..-------------------------------.
  57. |  .--.          ,-.  ,-.       ||                        ,-----.|
  58. |  \   \        /   \/   \      ||                        |     ||
  59. |   \   \  ,.  /          \     ||                        |     ||
  60. |    \   \/  \/   /\  /\   \    ||  Wim Mosterman         `-----'|
  61. |     \          /  `'  \   \   ||  Philips Medical Systems      |
  62. |      \   /\   /        \   \  ||  Best, The Netherlands        |
  63. |       `-'  `-'          `--'  ||  mosterma@mmra1.ms.philips.nl |
  64. `-------------------------------'`-------------------------------'
  65.