?? RIGHT := 110 ??
?? NEWTITLE := 'DEFINE_SUBPRODUCT Subutility: DEFINE_FILE_PERMIT Subcommand.' ??
MODULE ram$define_file_permit;

{ PURPOSE:
{   This module defines a public permit for a file or all files in the
{   current subproduct.
{
{ DESIGN:
{   This module is the driver for the DEFINE_FILE_PERMIT
{   in the DEFINE_SUBPRODUCTS utility.
{   The compiled module resides in RAF$LIBRARY.
{
{ NOTES:
{

?? NEWTITLE := 'Global Declarations Referenced by This Module', EJECT ??
*copyc clp$scan_parameter_list
*copyc clp$get_value
*copyc rap$define_permit

?? TITLE := 'Global Declarations Declared by This Module', EJECT ??

{ PURPOSE:
{   This procedure defines a public permit for a file or all files in the
{   current subproduct.
{
{ DESIGN:
{   This procedure is only the command interface.  RAM$DEFINE_PERMITS
{   is where the actual work is completed.
{
{ NOTES:
{
{


?? TITLE := '[XDCL] rap$define_file_permit', EJECT ??

  PROCEDURE [XDCL] rap$define_file_permit
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);


{ pdt deffp_pdt (
{   file, files, f                 : file or key all = all
{   access_modes, access_mode, am  : list of key none, read, execute, append, modify, shorten, write, ..
{                                    all, cycle, control = $required
{   share_modes, share_mode, sm    : list of key none, read, execute, append, modify, shorten, write, ..
{                                    all = $optional
{   application_information, ai    : string 0..31 = $optional
{   status                         : var of status = $optional
{   )

?? PUSH (LISTEXT := ON) ??

  VAR
    deffp_pdt: [STATIC, READ, cls$pdt] clt$parameter_descriptor_table := [^deffp_pdt_names, ^deffp_pdt_params
      ];

  VAR
    deffp_pdt_names: [STATIC, READ, cls$pdt_names_and_defaults] array [1 .. 12] of
      clt$parameter_name_descriptor := [['FILE', 1], ['FILES', 1], ['F', 1], ['ACCESS_MODES', 2], [
      'ACCESS_MODE', 2], ['AM', 2], ['SHARE_MODES', 3], ['SHARE_MODE', 3], ['SM', 3], [
      'APPLICATION_INFORMATION', 4], ['AI', 4], ['STATUS', 5]];

  VAR
    deffp_pdt_params: [STATIC, READ, cls$pdt_parameters] array [1 .. 5] of clt$parameter_descriptor := [

{ FILE FILES F }
    [[clc$optional_with_default, ^deffp_pdt_dv1], 1, 1, 1, 1, clc$value_range_not_allowed, [^deffp_pdt_kv1,
      clc$file_value]],

{ ACCESS_MODES ACCESS_MODE AM }
    [[clc$required], 1, clc$max_value_sets,1, 1, clc$value_range_not_allowed, [^deffp_pdt_kv2,
      clc$keyword_value]],

{ SHARE_MODES SHARE_MODE SM }
    [[clc$optional], 1, clc$max_value_sets,1, 1, clc$value_range_not_allowed, [^deffp_pdt_kv3,
      clc$keyword_value]],

{ APPLICATION_INFORMATION AI }
    [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$string_value, 0, 31]],

{ STATUS }
    [[clc$optional], 1, 1, 1, 1, clc$value_range_not_allowed, [NIL, clc$variable_reference,
      clc$array_not_allowed, clc$status_value]]];

  VAR
    deffp_pdt_kv1: [STATIC, READ, cls$pdt_names_and_defaults] array [1 .. 1] of ost$name := ['ALL'];

  VAR
    deffp_pdt_kv2: [STATIC, READ, cls$pdt_names_and_defaults] array [1 .. 10] of ost$name := ['NONE','READ',
      'EXECUTE','APPEND','MODIFY','SHORTEN','WRITE','ALL','CYCLE','CONTROL'];

  VAR
    deffp_pdt_kv3: [STATIC, READ, cls$pdt_names_and_defaults] array [1 .. 8] of ost$name := ['NONE','READ',
      'EXECUTE','APPEND','MODIFY','SHORTEN','WRITE','ALL'];

  VAR
    deffp_pdt_dv1: [STATIC, READ, cls$pdt_names_and_defaults] string (3) := 'all';

?? POP ??

    status.normal := TRUE;

    clp$scan_parameter_list (parameter_list, deffp_pdt, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    rap$define_permit ('FILE', status);

  PROCEND rap$define_file_permit;

MODEND ram$define_file_permit;
