Posts: 1,058
Threads: 367
Joined: Oct 2007
I have two questions in relation to a long list of strings in one of my macros :
(a) To declare this long list of strings is it possible to use one declaration statement (str) and then continue the list in several lines? In other words is it possible to use continuation lines in QM editor?
(b) Is it possible to use a kind of fortran-like equivalence statement for this long list of strings, for example in the case you need to output their values using the elements of an ARRAY in a for-like statement than using explicitly the name of each-one of the strings.
Many thanks for any advice.
Posts: 12,087
Threads: 142
Joined: Dec 2002
07-12-2018, 10:52 AM
(This post was last modified: 07-12-2018, 10:57 AM by Gintaras.)
1. Like this?
str a="a",
b="b",
c="c",
...
2. Yes, but without variable names.
Posts: 1,058
Threads: 367
Joined: Oct 2007
Thank you for dealing with it. Let me give an example:
(a) At present I use :
str u_itape u_ifile u_ispect u_sample u_smpby u_smpdate u_smptime u_anaby u_anadate u_anatime
str u_idet u_lab1 u_lab2 u_mcatype u_ireg u_ich u_igeo u_vlm u_decay u_samdur u_remarks
str u_acq_date u_acq_time u_acqby
Is it possible to use one str statement, instead of three?
(b) Is there a simple way (recursive list) to output the values of these strings?
Best regards.
Posts: 12,087
Threads: 142
Joined: Dec 2002
07-12-2018, 11:23 AM
(This post was last modified: 07-12-2018, 11:28 AM by Gintaras.)
1. No. Only Ctrl+W.
2.
Macro
Macro8
out
str u_itape("first") u_ifile u_ispect u_sample u_smpby u_smpdate u_smptime u_anaby u_anadate u_anatime u_idet u_lab1 u_lab2 u_mcatype u_ireg u_ich u_igeo u_vlm u_decay u_samdur u_remarks u_acq_date u_acq_time u_acqby("last")
str* p
for p &u_itape &u_acqby+1 sizeof(str)
,out *p
or
Macro
Macro8
out
str u_itape("first") u_ifile u_ispect u_sample u_smpby u_smpdate u_smptime u_anaby u_anadate u_anatime u_idet u_lab1 u_lab2 u_mcatype u_ireg u_ich u_igeo u_vlm u_decay u_samdur u_remarks u_acq_date u_acq_time u_acqby("last")
str* p=&u_itape; int i
for i 0 (&u_acqby-p)/sizeof(str)+1
,out p[i]
Posts: 1,058
Threads: 367
Joined: Oct 2007
(1) Could you please explain what do you mean by CTRL+W
(2) It is very bright!!!
Many thanks!
Posts: 12,087
Threads: 142
Joined: Dec 2002
Posts: 1,058
Threads: 367
Joined: Oct 2007
07-12-2018, 12:51 PM
(This post was last modified: 07-12-2018, 04:00 PM by ssimop.)
Thank you, I should have known that. Could you please advise if there exist an upper limit of characters that you may continue wrapping? I am sorry but I failed finding this issue in help files.
Posts: 12,087
Threads: 142
Joined: Dec 2002