From: CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 17-NOV-1989 18:23 To: MRGATE::"ARISIA::EVERHART" Subj: Logical manipulation with TPU calluser routines Received: From UCBVAX.BERKELEY.EDU by GIZMO.SRI.COM with TCP; Fri, 17 NOV 89 12:36:51 PDT Received: by ucbvax.Berkeley.EDU (5.61/1.39) id AA06950; Fri, 17 Nov 89 12:26:57 -0800 Received: from USENET by ucbvax.Berkeley.EDU with netnews for info-vax@kl.sri.com (info-vax@kl.sri.com) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 17 Nov 89 20:16:39 GMT From: usc!jarthur!dsolomon@ucsd.edu (Daniel Solomon) Organization: Harvey Mudd College, Claremont, CA Subject: Logical manipulation with TPU calluser routines Message-Id: <3102@jarthur.Claremont.EDU> Sender: info-vax-request@kl.sri.com To: info-vax@kl.sri.com In article <8911170938.AA29086@ucbvax.Berkeley.EDU> J3GUM%MKVAX1.DECNET@MSUS1.BITNET (Sire Jeffrey of Hundstad) writes: >Hello, > Is there anyway to translate a logical from inside the TPU editor. > I'm using a VAX running VMS 5.1-1. > > As long as I'm at it....where can I find the callable_tpu routines and > an explanation on HOW to use them? > >Many thanks (in advance). > > > Jeffrey E. Hundstad > j3gum%mkvax1.decnet@msus1.bitnet > I had to handle a similar problem. There are three components that are needed to set up the calluser. First of all, you have to set up the tpu procedure to call the calluser. The calluser procedure contains two parameters, and integer and a string. I found an interesting convention to use for these parameters. I use the string to pass any values that I will need in the calluser executable, and the integer to indicate a section of code in the executable, since you are only allowed to have one calluser executable. That I will explain further below. First of all, here is a section of my command file that calls the calluser: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ STARTUP.TPU ! VARIABLE prev_proc,cu; ! ! Dove call_user routine ! procedure dove_calluser (num,param) cu := call_user(num,param); endprocedure; What you do is when you want to go to the calluser routine, you use this command, with the first parameter being an integer, and the second parameter being a string. dove_calluser (1,filename); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CALLUSER.PAS: What this calluser does is take a logical (PREV_PROC), translate it to a string, and then pass that string value to a string variable in TPU. What I did here was record a process name as a logical value, and then when I wanted to attach out of TPU, I get the process name of the previous process through the calluser routine below. I also go the other way, and I put the value of a TPU variable (the parameter) and define it as a logical (FILE_NAME). Using these, you can use logicals to transfer values back and forth between DCL and TPU. [inherit('SYS$LIBRARY:STARLET')] module calluser (input,output); type log_name = varying [255] of char; var param,pn,command:log_name; [global] procedure TPU$CALLUSER(number:integer; string: [class_s] packed array [l1..u1 : integer] of char); [external] function TPU$EXECUTE_COMMAND (command : [class_s] packed array [l1..u1 : integer] of char):unsigned; extern; [external] function LIB$SET_LOGICAL (%descr logical :log_name; %descr equiv_string :log_name; %descr attr :log_name:='LNM$JOB'):integer; extern; procedure TRANSLATE (input_string:log_name; VAR output_string:log_name); VAR return_status :INTEGER; trnlnm_item_list :RECORD buffer_length : [WORD] 0..65535; item_code : [WORD] 0..65535; buffer_address : INTEGER; return_length : INTEGER; end_of_list : INTEGER; END; begin WITH trnlnm_item_list DO begin buffer_length :=SIZE(output_string.body); item_code :=LNM$_STRING; buffer_address:=IADDRESS(output_string.body); return_length :=IADDRESS(output_string.length); end_of_list :=0 end; return_status := $TRNLNM ( TABNAM :='LNM$JOB', LOGNAM :=input_string, ITMLST :=trnlnm_item_list); end; begin case number of 1: begin param := string; LIB$SET_LOGICAL('FILE_NAME',param); TRANSLATE ('PREV_PROC',pn); command := 'prev_proc := ' + chr(39) + pn + chr(39); TPU$EXECUTE_COMMAND (command); end; end; end. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The last thing that needs to be done is you have to define a logical to indicate where the TPU calluser executable is: DEFINE/NOLOG TPU$CALLUSER directory:CALLUSER.EXE This is the reason that I set up the case statement. Only one executable can be defined to the logical. These sections of code are slightly abbreviated to include just the section that you asked for. I hope that this helps. If you have any specific questions, or if the above code doesn't seem to work for some reason, send me some e-mail. ---------------------------------------------------------------------------- dsolomon@hmcvax.bitnet | "No amount of planning will ever replace dsolomon@jarthur.claremont.edu | dumb luck" dsolomon@jarthur.UUCP |