?? NEWTITLE := 'NOS/VE Permanent Files : Convert String to PF Path' ??
MODULE pfm$convert_string_to_pf_path;
?? RIGHT := 110 ??

{ PURPOSE:
{   This module contains the routines needed to convert a string to a pft$path.
{   The caller of PFP$CONVERT_FS_PATH_TO_PF_PATH must first have called
{   PFP$CONVERT_STRING_TO_FS_PATH, since the format of the fs_path_string must be that
{   of an fst$evaluated_file_reference path_structure.

?? NEWTITLE := '  Global Declarations Referenced by this module', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc cle$ecc_file_reference
*copyc fsc$max_path_size
*copyc fst$path_element_size
*copyc fst$path_index
*copyc pft$path
?? POP ??
*copyc clp$convert_cyc_ref_to_cyc_sel
*copyc clp$setup_and_parse_file_ref
*copyc clp$trimmed_string_size
*copyc clv$user_identification
*copyc osp$set_status_abnormal

?? TITLE := 'pfp$convert_string_to_fs_path', EJECT ??
*copyc pfh$convert_string_to_fs_path

  PROCEDURE [XDCL, #GATE] pfp$convert_string_to_fs_path
    (    str: string ( * );
     VAR fs_path_string: string (fsc$max_path_size);
     VAR number_of_path_elements: fst$number_of_path_elements;
     VAR cycle_reference: fst$cycle_reference;
     VAR open_position: fst$open_position;
     VAR status: ost$status);

    VAR
      evaluated_file_reference: fst$evaluated_file_reference;

    clp$setup_and_parse_file_ref (str, $clt$file_ref_parsing_options [clc$command_file_ref_allowed],
          clv$user_identification, evaluated_file_reference, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    fs_path_string := evaluated_file_reference.path_structure
          (1, evaluated_file_reference.path_structure_size);
    number_of_path_elements := evaluated_file_reference.number_of_path_elements;
    cycle_reference := evaluated_file_reference.cycle_reference;
    open_position := evaluated_file_reference.path_handle_info.path_handle.open_position;

  PROCEND pfp$convert_string_to_fs_path;
?? TITLE := 'pfp$convert_fs_path_to_pf_path', EJECT ??
*copyc pfh$convert_fs_path_to_pf_path

  PROCEDURE [XDCL, #GATE] pfp$convert_fs_path_to_pf_path
    (    fs_path_string: string (fsc$max_path_size);
     VAR pf_path: {input, output} ^pft$path;
         cycle_reference: fst$cycle_reference;
     VAR cycle_selector: clt$cycle_selector;
     VAR status: ost$status);

    VAR
      i: fst$number_of_path_elements,
      path_element_size: integer,
      path_index: fst$path_index;

    status.normal := TRUE;
    path_index := 1;
    FOR i := 1 TO UPPERBOUND (pf_path^) DO
      path_element_size := $INTEGER (fs_path_string (path_index));
      IF (path_element_size < 0) OR (path_element_size > fsc$max_path_element_size) THEN
        osp$set_status_abnormal ('CL', cle$improper_fs_path_structure,
              fs_path_string (1, clp$trimmed_string_size (fs_path_string)), status);
        RETURN; {----->
      IFEND;
      pf_path^ [i] := fs_path_string (path_index + 1, path_element_size);
      path_index := path_index + path_element_size + 1;
    FOREND;

    clp$convert_cyc_ref_to_cyc_sel (cycle_reference, cycle_selector);

  PROCEND pfp$convert_fs_path_to_pf_path;

MODEND pfm$convert_string_to_pf_path;

