cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

_STRICT_ variables

pek
1-Newbie
1-Newbie

_STRICT_ variables

Hi,

I'v read about this _STRICT_ variable and it sounded as a very good
guard against mistyped variables, a killer error in ACL.
I'm having problem with using it: it founded my undeclared/mistyped
variables but it also reports my global array as undefined:

package ST_Adept

# lots of code

global g_astrPreviousEditHooks[]

# some code

function AddMenuHook( a_strHookName)
{
local bFound, nI

bFound = h::False
for ( nI in g_astrPreviousEditHooks) ;# *** this line generates the
error ***
{
if ( g_astrPreviousEditHooks[ nI] == a_strHookName)
{
bFound = h::True
}
}
if ( !bFound)
{
g_astrPreviousEditHooks[ high_bound( g_astrPreviousEditHooks) + 1] =
a_strHookName
}
}

when I write 'source ST_Adept.cmd' to the commandline, execution stops
at the marked line:
[A11284] Operand of "in" operator must eb an array name:
g_astrPreviousEditHooks
(at line 7596 of file....)

Does anyone have such experiences?
Could someone tell me how to declare an array to be accepted in _STRICT_
case?

Thanks in advance:
Peter Krassoi


4 REPLIES 4
lhales
1-Newbie
(To:pek)

Peter,

I hope that someone with a bit more experience on this subject than me can
help you a bit more. I did a grep of my Adept directory, looking for
_STRICT_. I found several command files that use the _STRICT_. The
_stysht.cmd file caught my eye though. It had a line that stated

"# Because _STRICT_, we need to redeclare these global arrays."

It was interesting because the _STRICT_ call was commented out as wel.
There was no further information beyond this.

What it appeared to me though is that the two global variables they needed
to redeclare were being used in a loop. My quick look at some of the other
files that used _STRICT_ didn't immediately show any other global values
being used in that manner.

A couple of other files that use _STRICT_ are the pub_hhelp.cmd and
_link.cmd files.

This is just an "educated (?)" guess on my part. I hope that it at least
gives you something to look at in comparison to what you are doing. Anyone
else out there, I'm willing to learn from this one.

Lynn E. Hales
Information Technology Consultant
lhales@csc.com
(757)262-3495

Péter Krassói <pek@step.hu>@arbortext.com on 01/22/2001 09:57:40 AM

Please respond to adepters@arbortext.com

Sent by: owner-adepters@arbortext.com
unknown1
1-Newbie
(To:pek)

Péter,

I did a little checking into this. We're guessing that the problem
might be because you have deleted your array somewhere in your code.
If you find that this is the case, you can substitute a user-defined
function such as this:

function EmptyArray(arr[]) {
delete(arr);
}

So you would replace

delete(g_astrPreviousEditHooks);

with

EmptyArray(g_astrPreviousEditHooks);

The former deletes the global symbol, the latter removes the contents
but leaves the array name still declared.

Hope this helps.

Paul

At 03:57 PM 1/22/01 +0100, Péter Krassói wrote:
>Hi,
>
>I'v read about this _STRICT_ variable and it sounded as a very good
>guard against mistyped variables, a killer error in ACL.
>I'm having problem with using it: it founded my undeclared/mistyped
>variables but it also reports my global array as undefined:
>
>package ST_Adept
>
># lots of code
>
>global g_astrPreviousEditHooks[]
>
># some code
>
>function AddMenuHook( a_strHookName)
>{
> local bFound, nI
>
> bFound = h::False
> for ( nI in g_astrPreviousEditHooks) ;# *** this line generates the
>error ***
> {
> if ( g_astrPreviousEditHooks[ nI] == a_strHookName)
> {
> bFound = h::True
> }
> }
> if ( !bFound)
> {
> g_astrPreviousEditHooks[ high_bound( g_astrPreviousEditHooks) + 1] =
>a_strHookName
> }
>}
>
>when I write 'source ST_Adept.cmd' to the commandline, execution stops
>at the marked line:
>[A11284] Operand of "in" operator must eb an array name:
>g_astrPreviousEditHooks
>(at line 7596 of file....)
>
>Does anyone have such experiences?
>Could someone tell me how to declare an array to be accepted in _STRICT_
>case?
>
>Thanks in advance:
> Peter Krassoi


saslmp
1-Newbie
(To:pek)

Hello Peter,

> adepters-digest Tuesday, 23 January 19101 Volume 02 : Number 969
pek
1-Newbie
1-Newbie
(To:pek)

> From: Lee Peterson <saslmp@unx.sas.com>
Announcements