
  PROCEDURE [INLINE] fdp$add_comment
    (    p_form_status: ^fdt$form_status;
         p_form_definition: ^fdt$form_definition;
         p_comment: ^fdt$comment;
     VAR comment_definitions: fdt$comment_definitions;
     VAR status: ost$status);

    CONST
      comments_to_expand = 1;

    VAR
      i: fdt$comment_index,
      number_comments: fdt$number_comments,
      p_new_comment_definitions: ^array [1 .. * ] of fdt$comment_definition,
      p_old_comment_definitions: ^array [1 .. * ] of fdt$comment_definition,
      p_stored_comment: ^fdt$comment;

    status.normal := TRUE;
    p_old_comment_definitions := fdp$ptr_comments
          (comment_definitions, p_form_status^.p_form_module);
    NEXT p_stored_comment: [STRLENGTH (p_comment^)] IN
          p_form_status^.p_form_module;
    IF p_stored_comment <> NIL THEN
      p_stored_comment^ := p_comment^;
      IF p_old_comment_definitions = NIL THEN
        NEXT p_new_comment_definitions: [1 .. comments_to_expand] IN
              p_form_status^.p_form_module;
        IF p_new_comment_definitions <> NIL THEN
          fdp$rel_comments (p_new_comment_definitions,
                p_form_status^.p_form_module, comment_definitions);
          p_new_comment_definitions^ [1].p_comment :=
                #REL (p_stored_comment, p_form_status^.p_form_module^);
          comment_definitions.active_number := 1;
        ELSE
          osp$set_status_abnormal (fdc$format_display_identifier,
                fde$no_space_available, '', status);
        IFEND;
        RETURN;
      IFEND;

      { Try to use an inactive entry. }

      number_comments := comment_definitions.active_number;
      IF number_comments < comment_definitions.total_number THEN
        number_comments := number_comments + 1;
        comment_definitions.active_number := number_comments;
        p_old_comment_definitions^ [number_comments].
              p_comment := #REL (p_stored_comment,
              p_form_status^.p_form_module^);
        RETURN;
      IFEND;

      { Expand the array for comments. }

      NEXT p_new_comment_definitions: [1 .. comments_to_expand +
            number_comments] IN p_form_status^.p_form_module;
      IF p_new_comment_definitions <> NIL THEN

        { Copy old comments to new array. }

        FOR i := 1 TO number_comments DO
          p_new_comment_definitions^ [i] := p_old_comment_definitions^ [i];
        FOREND;

        fdp$rel_comments (p_new_comment_definitions,
              p_form_status^.p_form_module, comment_definitions);
        number_comments := number_comments + 1;
        comment_definitions.active_number := number_comments;
        p_new_comment_definitions^ [number_comments].
              p_comment := #REL (p_stored_comment,
              p_form_status^.p_form_module^);
      ELSE
        osp$set_status_abnormal (fdc$format_display_identifier,
              fde$no_space_available, 'allocating comments', status);
      IFEND;
    ELSE { No space for storing comment. }
      osp$set_status_abnormal (fdc$format_display_identifier,
            fde$no_space_available, 'allocating comments', status);
    IFEND;
  PROCEND fdp$add_comment;

?? PUSH (LISTEXT := ON) ??
*copyc fde$condition_identifiers
*copyc fdp$ptr_comments
*copyc fdp$rel_comments
*copyc fdt$comment
*copyc fdt$comment_definition
*copyc fdt$comment_definitions
*copyc fdt$comment_index
*copyc fdt$form_definition
*copyc fdt$form_status
*copyc fdt$number_comments
*copyc osp$set_status_abnormal
*copyc ost$status
?? POP ??


