[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference azur::mcc

Title:DECmcc user notes file. Does not replace IPMT.
Notice:Use IPMT for problems. Newsletter location in note 6187
Moderator:TAEC::BEROUD
Created:Mon Aug 21 1989
Last Modified:Wed Jun 04 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:6497
Total number of notes:27359

1112.0. "Ilv encoding for default parameters..." by PHONE::ALLAIN () Fri Jun 07 1991 11:02

Hi, I'm having a probleme with Ilv encoding (again, I know....)

I'd like some information about the way I have to decode the p_in_p ilv code.

My create directive has two parameters (see the attached code). I've put an 
ilv_dump on the p_in_p descriptor right at the beginning of my do_directive,
and this is what I get depending on the number of parameters I specify:

The first one: (using one specified and one default value.)

MCC> create cmeagt tutu demochar1=5 

[  0 ] (
    [  15 ]     05
    [  20 ]     64  -- d
    )


The second one: (using the default values...)

MCC> create cmeagt tutu

[  0 ] (
    [  15 ] (
        [  5 ]
        )
    [  20 ] (
        [  5 ]
        )
    )


Why don't they look the same way? 

You will notice that in the first one, by specifying only one parameter, 
the other one is default encoded the same way the specified one was.
When I don't specify any thing, I get another level.

Could someone explain me what's happening and how I should handle this 


Thanks

Francois


Here is my MSL :



       DIRECTIVE CREATE = 12 :
          DIRECTIVE-TYPE = ACTION,
          DISPLAY = TRUE,
          SYMBOL = CREATE_INST,
          CATEGORIES = ( CONFIGURATION ),

          REQUEST
              ARGUMENT demoChar1 = 15 : Unsigned8
                ECHO = TRUE,
                DISPLAY = TRUE,
                REQUIRED = TRUE,
                DEFAULT = 88,
                SYMBOL = ARG_CREATE_DEMO_CHAR1
              END ARGUMENT demoChar1;

              ARGUMENT demoChar2 = 20 : Unsigned16
                ECHO = TRUE,
                DISPLAY = TRUE,
                REQUIRED = TRUE,
                DEFAULT = 100,
                SYMBOL = ARG_CREATE_DEMO_CHAR2
              END ARGUMENT demoChar2;
          END REQUEST;
                                           
T.RTitleUserPersonal
Name
DateLines
1112.1PHONE::ALLAINFri Jun 07 1991 18:2910
Page 125 in the SRM, I see : "The Ilv encoding of the architected use default
value is discussed in more detail in chapter 9."

I can't find where!

Does someone knows about this?

Thanks

Francois
1112.2refer to chapter 11, not 9TOOK::STRUTTManagement - the one word oxymoronFri Jun 07 1991 23:417
    I think you've found a bad forward reference in the SRM. We'll fix it.
    
    Meantime, best place I can point you to is the decsription of
    mcc_ilv_put in Chapter 11, on page 654 (for the v1.1 SRM), and the
    decription of the flag MCC_M_FLAGS_DEFAULT
    
    Colin
1112.3impl default flagTOOK::CALLANDERJill Callander DTN 226-5316Sun Jun 09 1991 22:3715
    When decoding an ILV buffer, it is important to note that the CVR of
    the ilv_get will be the place to find out about the default value. Now
    the correct way to encode a default value is to use the implementation
    specific default flag that ILV supports. In this case the ILV dump will
    show no value for the field, and the CVR on the get will retur
    soemthing like mcc_ilv_impldefault.
    
    BUT... and you knew there had to be one.... the FCL has a bug in it
    (since the impldefault is not how defaults were originally defined), so
    that in some instances it encodes the default value from the dictionary
    and not the flag. In the cases where the value was encoded an ILV dump
    will show that.
    
    Hope this helps.
    
1112.4default valuesPHONE::ALLAINMon Jun 10 1991 11:4622
Hi

Thanks for the answers.

I still have a question. When I get the mcc_ilv_impldefault status from the 
ilv_get routine, where can I get the default value I have put in the MSL? Is 
it nested inside the ilv encoding at another level?

In my example with the create directive (see .0), I'd like to have the values
88 and 100 to be set for my two attributes demochar1 and demochar2 when I don't
specify any parameters. I don't believe I should have to "hard code' it in the 
.C file for the create directive (that would be real dirty...)

What you called a bug, Jill, seems to be an easy way to get that value..., that 
would allow to write the same code in the .C file for handling the default or 
the specified parameters.

Is there something I missunderstood (again)? 

Thanks for your help.

Francois.
1112.5I don't think its so dirty...TOOK::KOHLSRuth KohlsMon Jun 10 1991 14:5838
>I still have a question. When I get the mcc_ilv_impldefault status from the 
>ilv_get routine, where can I get the default value I have put in the MSL? Is 
>it nested inside the ilv encoding at another level?

No.  The Implementation Default mechanism Assumes that the Implementation
knows the default.  the [5] you see is actually the encoding of an ASN.1 NULL
datatype.

>In my example with the create directive (see .0), I'd like to have the values
>88 and 100 to be set for my two attributes demochar1 and demochar2 when I don't
>specify any parameters. I don't believe I should have to "hard code' it in the 
>.C file for the create directive (that would be real dirty...)

I believe your code also could get it out of the dictionary--which will take
more work than the "dirty" way.

>What you called a bug, Jill, seems to be an easy way to get that value..., that 
>would allow to write the same code in the .C file for handling the default or 
>the specified parameters.

>Is there something I missunderstood (again)? 

No, I think you've understood. Implementation Default is currently expected 
to be a default someone would want to be hard-coded, an architectural constant 
for instance, which changes only when the spec is changed, but the value might 
be different on different boxes.  Plus, you save a 
little ILV encoding buffer by not sending the value over.  The Implementation
sees a that this item is a default and knows what to do, without decoding
more ILV.

The way FCL was doing it is valid, but takes more dictionary lookup code
executions, and more buffer (if the default is lengthy it might matter),
and requires that there be only one value for the default (unless variants
are already known --there was a previous note about create args and variants).

Ruth

1112.6Ok.PHONE::ALLAINMon Jun 10 1991 15:368
Ok.

I'll try to get the value from the dictionnary. I'll give up if it's to 
complicated... 

Thanks for your help everybody.

Francois.
1112.7Examples?PHONE::ALLAINMon Jun 10 1991 16:4211
Re .3

Jill,

Would it be possible to get an example of how you encode the default value from 
the dictionnary? I would like to do it in my create directive (I think that it's 
what's done by the FCL as "a bug"?)

Thanks.

Francois.
1112.8encode, or retrieve?TOOK::CALLANDERJill Callander DTN 226-5316Tue Jun 11 1991 14:4828
>>Would it be possible to get an example of how you encode the default value from 
>>the dictionnary? I would like to do it in my create directive (I think that it's 
>>what's done by the FCL as "a bug"?)


Do you really mean encode, or are you asking how to get the value from the
dictionary.

To get the value from the dictionary do the following.

Take the entity spec (what you got in in_e should be fine), and call
mcc_dict_build_spec. This will convert it into a dictionary specification.
Then append to the aes (using aes_create) the following levels: 
	DIRECTIVE -- create
	REQUEST -- create
	ARGUMENT -- arg_in_question
	DEFINITION -- mcc_k_dd_default
Then call the dictionary, mcc_dict_get_def_info, to pick up the current value
for the default.

As to a real live code segment, if you still need one, contact me off line.
The problem with code segments, is giving you all the associated routines
we use to build stuff up.

BTW: I call it an FCL error, since the SRM says to always pass the flag.

jill
1112.9PHONE::ALLAINTue Jun 11 1991 16:1958
Thanks Jill,

I'm trying to retrieve the value.

Could you be more precise about the way you append the different levels, 
especially how you build the instance descriptor (mcc_l_dt, mcc_a_pointer, 
mcc_l_id). I've enclosed what I'm trying at the end of the note. I get a
NoENTITY status from the get_def_info routine... I must be building the entity
with the wrong instances...


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

This is what I'm trying:

strcpy (inst,"create");
status = mcc_desframe_create_descriptor(&(*p_context)->alloc_mem_list,
                                        &desc,
                                        0,
                                        &MCC_K_DT_FULL_NAME,
                                        &inst,
                                        0,
                                        0);
status = mcc_aes_create (       &entity,
                                &MCC_K_DICT_DIRECTIVE,
                                desc,
                                &MCC_K_AES_NOT_WILD);

status = mcc_aes_create (       &entity,
                                &MCC_K_DICT_REQUEST,
                                desc,
                                &MCC_K_AES_NOT_WILD);
strcpy(inst,"demochar1");
status = mcc_desframe_create_descriptor(&(*p_context)->alloc_mem_list,
                                        &desc,
                                        0,
                                        &MCC_K_DT_FULL_NAME,
                                        &inst,
                                        0,
                                        0);
status = mcc_aes_create (       &entity,
                                &MCC_K_DICT_ARGUMENT,
                                desc,
                                &MCC_K_AES_NOT_WILD);

status = mcc_desframe_create_descriptor(&(*p_context)->alloc_mem_list,
                                        &desc,
                                        0,
                                        0,
                                        &MCC_K_DD_VALUE_DEFAULT,
                                        0,
                                        0);
status = mcc_aes_create (       &entity,
                                &MCC_K_DICT_DEFINITION,
                                desc,
                                &MCC_K_AES_NOT_WILD);

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
1112.10more infoTOOK::HAOWed Jun 12 1991 09:5622
    For your instance descriptor, it's more efficient to use directive and
    argument codes instead of strings.  Here's more detailed info:
    
    Directive Create:
    	mcc_l_id = MCC_K_DICT_DIRECTIVE
    	mcc_l_dt = MCC_K_DT_UNSIGNED32
     	mcc_a_pointer = &buf, where, MCC_T_Unsigned32 buf = MCC_K_VERB_CREATE
    
    Request Create:
        (same as above except mcc_l_id = MCC_K_DICT_REQUEST)
    
    Argument <your-arg>:
      	mcc_l_id = MCC_K_DICT_ARGUMENT
        buf = <your-arg-id>
    
    Definition:
    	mcc_l_id = MCC_K_DICT_DEFINITION
        buf = MCC_K_DD_VALUE_DEFAULT (or whatever definition you're
    				      trying to retrieve)
    
    Christine
    
1112.11Good, good...PHONE::ALLAINWed Jun 12 1991 10:065
Ok, I'm gonna try it.

Thanks a lot.

Francois
1112.12Problem:PHONE::ALLAINWed Jun 12 1991 15:3665
I was trying to get the default value as explained in the previous replies,
but I always got a NOENTITY status (next reply is the code I wrote for this...)

Then in order to avoid the NOENTITY status I tried the following code for
getting (as a test) the presentation name for my class CMEAGT (a went up as much
as possible in the hierarchie), and I get this as output:

 depth = 2
 hop: @�

The "funny" thing is that all the status are Good, I don't know why I can't get
the presentation name... I must be doing something wrong somewhere, but I just 
can't find it.

If someone could help, that would be great...
Thanks

Francois.




char                            *inst;

inst = malloc(100);  /* just for testing   */


status = mcc_aes_copy (&(p_callargs->p_in_entity), &entity);
status = mcc_dict_build_spec (  entity,
                                &dict_spec,
                                MCC_K_NULL_PTR,
                                MCC_K_NULL_PTR);

status = mcc_desframe_create_descriptor(&(*p_context)->alloc_mem_list,
                                        &desc,
                                        0,
                                        &MCC_K_DT_UNSIGNED32,
                                        &MCC_K_DD_PRESENTATION_NAME,
                                        &MCC_K_DICT_DEFINITION,
                                        &DSC_K_DTYPE_LU);

status = mcc_aes_create (       	&dict_spec,
                                	&MCC_K_DICT_DEFINITION,
                                	desc,
                                	&MCC_K_AES_NOT_WILD);

status = mcc_aes_depth (&dict_spec, &depth);
printf ("\n depth = %d", depth);

p_dict_data_buffer = (struct MCC_R_DICT_DEF *)mcc_calloc(1, sizeof(struct MCC_R

if (p_dict_data_buffer == NULL) status = MCC_S_ALLOC;

p_dict_data_buffer->def_r_value_desc.mcc_w_maxstrlen = 100;
p_dict_data_buffer->def_r_value_desc.mcc_w_curlen = p_dict_data_buffer->def_r_value_desc.mcc_w_maxstrlen;
p_dict_data_buffer->def_r_value_desc.mcc_b_dtype = DSC_K_DTYPE_T;
p_dict_data_buffer->def_r_value_desc.mcc_b_class = DSC_K_CLASS_S;
p_dict_data_buffer->def_r_value_desc.mcc_a_pointer = inst;
p_dict_data_buffer->def_r_value_desc.mcc_b_ver = 1;
p_dict_data_buffer->def_r_value_desc.mcc_l_dt = MCC_K_DT_LATIN1STRING;
p_dict_data_buffer->def_r_value_desc.mcc_a_link = MCC_K_NULL_PTR;

status = mcc_dict_get_def_info(dict_spec, p_dict_data_buffer);

printf("\n hop: %s", p_dict_data_buffer->def_r_value_desc.mcc_a_pointer);
1112.13NOENTITY again.PHONE::ALLAINWed Jun 12 1991 15:4572
Status are all fine except the last one from get_def_info, wich is NOENTITY.

Thanks in advance for any help.



Here is the code:>>>>>>>>>>>>>>>>>

status = mcc_aes_copy (&(p_callargs->p_in_entity), &entity);

status = mcc_dict_build_spec (  entity,
                                &dict_spec,
                                MCC_K_NULL_PTR,
                                MCC_K_NULL_PTR);
status = mcc_desframe_create_descriptor(&(*p_context)->alloc_mem_list,
                                        &desc,
                                        0,
                                        &MCC_K_DT_UNSIGNED32,
                                        &MCC_K_VERB_CREATE,
                                        &MCC_K_DICT_DIRECTIVE,
                                        &DSC_K_DTYPE_LU);

status = mcc_aes_create (       &dict_spec,
                                &MCC_K_DICT_DIRECTIVE,
                                desc,
                                &MCC_K_AES_NOT_WILD);
status = mcc_desframe_create_descriptor(&(*p_context)->alloc_mem_list,
                                        &desc,
                                        0,
                                        &MCC_K_DT_UNSIGNED32,
                                        &MCC_K_VERB_CREATE,
                                        &MCC_K_DICT_REQUEST,
                                        &DSC_K_DTYPE_LU);
status = mcc_aes_create (       &dict_spec,
                                &MCC_K_DICT_REQUEST,
                                desc,
                                &MCC_K_AES_NOT_WILD);
status = mcc_desframe_create_descriptor(&(*p_context)->alloc_mem_list,
                                        &desc,
                                        0,
                                        &MCC_K_DT_UNSIGNED32,
                                        &MCC_K_ARG_CREATE_DEMO_CHAR1,
                                        &MCC_K_DICT_ARGUMENT,
                                        &DSC_K_DTYPE_LU);
status = mcc_aes_create (       &dict_spec,
                                &MCC_K_DICT_ARGUMENT,
                                desc,
                                &MCC_K_AES_NOT_WILD);
status = mcc_desframe_create_descriptor(&(*p_context)->alloc_mem_list,
                                        &desc,
                                        0,
                                        &MCC_K_DT_UNSIGNED32,
                                        &MCC_K_DD_VALUE_DEFAULT,
                                        &MCC_K_DICT_DEFINITION,
                                        &DSC_K_DTYPE_LU);
status = mcc_aes_create (       &dict_spec,
                                &MCC_K_DICT_DEFINITION,
                                desc,
                                &MCC_K_AES_NOT_WILD);

p_dict_data_buffer = (struct MCC_R_DICT_DEF *)mcc_calloc(1, sizeof(struct MCC_R
if (p_dict_data_buffer == NULL) status = MCC_S_ALLOC;

p_dict_data_buffer->def_r_value_desc.mcc_w_maxstrlen = 100;

p_dict_data_buffer->def_r_value_desc.mcc_w_curlen = p_dict_data_buffer->def_r_value_desc.mcc_w_maxstrlen;
p_dict_data_buffer->def_r_value_desc.mcc_a_pointer = &buffer1;
p_dict_data_buffer->def_r_value_desc.mcc_b_ver = 1;
p_dict_data_buffer->def_r_value_desc.mcc_l_dt = MCC_K_DT_UNSIGNED8;
p_dict_data_buffer->def_r_value_desc.mcc_a_link = MCC_K_NULL_PTR;

status = mcc_dict_get_def_info(dict_spec, p_dict_data_buffer);
1112.14doublecheck dictionaryTOOK::HAOThu Jun 13 1991 10:286
    The NOENTITY status means that it can't find what you've specified in
    the dict_spec in the dictionary.  Why don't you manually verify that
    it's in the dictionary first by running DAP?
    
    Christine
    
1112.15I've already manually verified...PHONE::ALLAINThu Jun 13 1991 10:3527
This value 88 is the one I desesperatly want...




DAP> show Argument DEMOCHAR1

   Class (1) : CMEAGT
     Directive (6) : CREATE
       Request (7) : CREATE
-------> Argument (4) : DEMOCHAR1
           Definition (3) : PRESENTATION_NAME
           Definition (3) : VALUE_DATA_TYPE
           Definition (3) : VALUE_LENGTH
           Definition (3) : ECHO
           Definition (3) : DISPLAY
           Definition (3) : VALUE_REQUIRED
           Definition (3) : DEFAULT_ALLOWED
           Definition (3) : VALUE_DEFAULT

DAP> show Definition VALUE_DEFAULT

   Definition Name = VALUE_DEFAULT
   Type = T   Length = 2   Count = 1   Defined = TRUE   Class = S
   value[1] = "88"

DAP>
1112.16dump it and let's take a lookTOOK::CALLANDERJill Callander DTN 226-5316Fri Jun 14 1991 12:559
call mcc_aes_dump and let's take a look at exactly what you hav ein
the AES before *AND* after the dictionary call. This will help. There is
always the potential tha the problem isn't in your set-up but in a memory clobber
occurring some where else that is just showing up now. Have you tried using 
fakeVM to check for such cases?

Put the dumps here when you have them.

jill
1112.17Sorry JillPHONE::ALLAINFri Jun 14 1991 15:5523
My problems are solved.

Christine helped me a lot "off line" (by mail) yesterday.

I shoud have put a note to let you know I was all set, sorry about this.

The problem I had was caused (I think) by the mcc_desframe_create_descriptor
wich seems not to set all fields in the right way for using it in the
aes_create routine...

Now I "fill" manually the descriptor and it works fine... I've send a mail to 
christine about this problem...

I'm know trying to write a routine wich would do the same thing as what the FCL
does in certain cases. I will rebuild the p_in_p in the way I need it.

I'm trying to write it as general as possible in order to be able to use it 
in all my routines without any changes...

I may contact you again later, because I thing I'll have a probleme to convert
the String I'm getting from the dictionary into the right datatype.

Francois.