COMPILATION LISTING OF SEGMENT xforum_format_ Compiled by: Multics PL/I Compiler, Release 28e, of February 14, 1985 Compiled at: Honeywell Multics Op. - System M Compiled on: 04/24/86 1529.4 mst Thu Options: optimize map 1 /****^ *********************************************************** 2* * * 3* * Copyright, (C) Honeywell Information Systems Inc., 1983 * 4* * * 5* *********************************************************** */ 6 7 8 9 /****^ HISTORY COMMENTS: 10* 1) change(85-01-21,Davids), approve(86-02-04,MCR7350), 11* audit(86-04-24,Gilcrease), install(86-04-24,MR12.0-1048): 12* Modified so that if the write_sw is true (write entry called) The 13* subject is separated from the comment by the character . 14* This gives the emacs extension something to search for instead of 15* assuming that there are no s embedded in the subject. An 16* assumption that does not have to be true. characters 17* embedded in the subject are translated into spaces when the 18* comments are listed. 19* 20* 85-03-04 Davids: Added the parameter P_for_emacs_sw to the append 21* entry. This will indicate that the output of this append is to be 22* for emacs so special handling of the subject will be done. Change 23* the write entry to alwasy set the for_emacs_sw variable to ON. 24* Modified the ioa control string for display so that if the clear 25* switch is off a line feed will preceed the comment. Modified the 26* control string for write and append so that if the comment is not 27* the first comment, i.e bit_count ^= 0 then either a form feed will 28* preceed the comment (for the non emacs case) or a line feed will 29* (for the emacs case.) 30* 31* 85-04-10 Davids: Modified so that the output of a comment produced 32* via the write_sw, append_sw, or display_sw uses the date_time 33* string produced by the new date_time_$format routine which takes 34* into account the user's default date_time format and language. 35* 2) change(85-04-11,Davids), approve(86-02-04,MCR7350), 36* audit(86-04-24,Gilcrease), install(86-04-24,MR12.0-1048): 37* Added the parameters P_line_item and P_subject_max_len to the 38* parameter list for the list entry. Also changed the list entry to 39* use the P_item_line as the ioa control string for outputing the 40* list and to use the string "..." as an indication that the subject 41* has been truncated. The P_subject_max_len is used as the maximum 42* length that the subject can be. Finally the subject is now 43* truncated at a new line character instead of translating the 44* character to a space. This what all the other subject display 45* routines do, i.e. subject on status line and subjects in the 46* subject menu. 47* 48* 85-06-21 Davids: Extensive internal reorganization. Gave each 49* entry its own set of parameters. Replaced the COMMON block of 50* code with internal procedures. Added variable declaration 51* comments and updated header comments. 52* END HISTORY COMMENTS */ 53 54 55 xforum_format_: proc (); 56 57 /* 58* BEGIN DESCRIPTION 59* 60* function: 61* This procedure is used to display transaction. Transactions may be 62* displayed on the terminal as either the complete transaction or just a 63* one line "list" entry. Transactions may also be written to a segment. 64* Only 1 transaction can be displayed during the call. A pointer to the 65* transaction structure is input. 66* 67* Note that once the transaction is displayed the storage associated with 68* it is freed. 69* 70* description of entry points: 71* xforum_format_: 72* input: 73* output: 74* It is an error to call the main entry point. The xforum_fatal_error 75* condition will be signaled with an "internal programming error" error 76* message. 77* 78* display: 79* input: ptr pointer to forum_user_trans structure for 80* transaction to be displayed 81* bit (1) aligned if "1"b the user_io window will be 82* cleared prior to the display 83* output: fixed bin (35)) standard error code 84* This entry displays a transaction on the terminal. By not clearing the 85* user_io window before the display you can display multiple 86* transactions on the screen. The transaction header includes the 87* date-time that the transaction was entered in the user's default 88* date-time format. The forum_user_trans structure is freed after the 89* display is completed. 90* 91* list: 92* input: ptr pointer to forum_user_trans structure for 93* transaction to be listed 94* char (*) ioa_ control string to be used to output 95* line of listing 96* fixed bin max number of chars from subject to 97* include in listing 98* output: fixed bin (35) standard error code 99* This entry is used to output a 1 line listing of a transaction. The 100* listing includes the forum transaction number, the number of lines in 101* the transaction, the date and time that it was entered, the person and 102* project ids of the person who entered it and as much of the subject as 103* is possible. The format for all this output is controled by the input 104* ioa_ control string. This entry does not print out any header lines, 105* it is assumed that the caller has done so. It also therefore never 106* clears the user_io window. If the transaction subject is longer than 107* the input max length the subject is truncated to max_len - 3 and ... 108* appended to it. If the subject contains a new line character it is 109* truncated at that point and ... appended to it. The date and time 110* are output in tghe user's default date and time formats. NOTE that 111* these can be different from the user's default date_time format. 112* The forum_user_trans structure is freed after the listing line is 113* output. 114* 115* write: 116* input: ptr pointer to forum_user_trans structure for 117* transaction to be written 118* ptr pointer to segment that transaction is to 119* be written to 120* output: fixed bin (35) standard error code 121* This entry writes the transaction to a segment. The transaction will 122* begin at the beginning of the segment. The bit count of the segment 123* will be set and the segment truncated to the transaction length. 124* It will also be specially formated so that the emacs extension can 125* use it. See the description of the internal proc write_to_seg for a 126* description of the special emacs formating. The transaction will be 127* written using the user's default date-time format and the 128* forum_user_trans structure will be freed after it is written. The 129* user_io is not touched by this entry. 130* 131* append: 132* input: ptr pointer to forum_user_trans structure for 133* transaction to be appended 134* ptr pointer to segment that transaction is to 135* be appended to 136* bit (1) aligned "1"b indicates that segment will be 137* handed to emacs for display 138* input/output: 139* fixed bin (24) original and updated bit count of segment 140* output: fixed bin (35) standard error code 141* This entry appends a transaction to the end of a segment. 142* The bit count of the segment will be updated to reflect the new data. 143* If the input for_emacs_sw is set to true the transaction will be 144* specially formated so that the emacs extension can use it. See the 145* description of the internal proc write_to_seg for a description of the 146* special emacs formating. The transaction will be written using the 147* user's default date-time format and the forum_user_trans structure 148* will be freed after it is written. The user_io is not touched by 149* this entry. 150* 151* 152* 153* description of internal procedures: 154* write_to_seg: This procedure is called by both the write entry and the 155* append entry. It writes the transaction to the segment positioning it 156* to start after anything already in the segment (the write entry calls it 157* with a starting bit count of 0). After its written the new bit count is 158* calculated and set. The header line of the transaction includes the 159* date-time that the transaction was entered. This date-time is written in 160* the user's default date-time format. There are two formats that are used 161* to output the transaction. The "normal" format will preceed each 162* transaction with a form feed, unless the segment's starting bit count is 163* 0. In the "emacs" format the transactions are preceeded by a blank line, 164* unless the segment's starting bit count is 0. In addition an ESCAPE 165* character will be appended onto the subject of the transaction written 166* when the segments starting bit count is 0. The ESCAPE is used to 167* terminate the subject so that the emacs editor extension can identify 168* the end og multi-line subjects. After the segment's bit count has been 169* updated the forum_user_trans structure is freed. 170* 171* make_end_line: This internal procedure creates the last line displayed 172* when the transaction is displayed or written to a segment. It determines 173* if the transaction being displayed or written is part of a comment chain. 174* The end line string indicates that the end of the transaction has been 175* reached and if there is a previous or next comment in the same comment 176* chain. The end line string is returned to the main procedure and used as 177* an argument in the calls to ioa_. 178* 179* count_lines: This internal proc counts the number of lines that make up 180* the comment. It does this by searching the comment counting new line 181* characters. 182* 183* error: Similar to all other error procedures. It records in an internal 184* static structure the details of an error and then signals the 185* xforum_fatal_error condition. 186* 187* known bugs: 188* 189* notes: 190* 191* history 192* 84-06-14 Davids: Modified so that fnumber (the transaction number) is 193* declared fixed bin instead of pc "9999". This was needed because 194* there are meetings with more than 9999 transactions. Fixed bin was used 195* so that leading 0's are not output. Changed call ioa_ statements to refer 196* to fnumber as ^i instead of ^a. 197* 198* 84-08-08 Davids: Modified so that the loop that counts the number of 199* lines (at the beginning of COMMON) can handle the case where the last 200* line does not end in a NL character. This was causing an infinite loop. 201* Also added the make_end_line routine to change the termination string 202* to that defined in the MTB. 203* 204* 84-09-26 Davids: Modified so that right before it returns it frees the 205* structure associated with the transaction. This was put here instead of 206* requiring that the all the callers did it. Also changed from using 207* hcs_$set_bc to using terminate_file_. 208* 209* 84-09-27 Davids: Added the append entry point and code in COMMON to 210* implement it. 211* 212* 84-10-24 Davids: Modified the make_end_line internal proc so that 213* the forum_user_trans structures that are allocated in the calls 214* to xforum_trans$next_ref and previous_ref are freed. they were not being 215* freed and large numbers of selections were causing RQOs in the pdir - 216* which results in a fatal process error. 217* 218* 84-10-29 Davids: Added the approx_trans_length variable and made the 219* lengths of seg and append_seg that long instead of the constant 1000000 220* characters. This was needed because ioa_$rs was creating a segment of 221* 1000000 characters of 245 pages. If the user does not have the quota 222* it dies with a record quota overflow. The 500 character constant is used 223* to take care of the header and trailer lines. 224* 225* 84-11-14 Davids: Auditing changes: 1) Under the COMMON label, combined 226* the the write and append code by extending the ioa_ string to include the 227* form feed if the bit count is not zero. 2) Also combined the code for 228* producing a listing so that only 1 call to ioa_ is made. a local copy 229* of the subject is made which is either the entire subject or the first 230* 18 characters of the subject and the string . 3) In make_end_line 231* combined three separate calls to ioa_ which depended on the flags into 1 232* call with a more complex ioa_ string and the flags input to ioa_. 233* 3) cleaned up the declarations. 234* END DESCRIPTION 235**/ 236 237 /* PARAMETERS */ 238 239 /* EXTERNAL STATIC */ 240 241 /* ENTRIES */ 242 243 dcl date_time_$format entry (char (*), fixed bin (71), char (*), char (*)) returns (char (250) var); 244 dcl ioa_ entry () options (variable); 245 dcl ioa_$rs entry () options (variable); 246 dcl ioa_$rsnnl entry () options (variable); 247 dcl iox_$user_io ptr ext static; 248 dcl signal_ entry () options (variable); 249 dcl terminate_file_ entry (ptr, fixed bin (24), bit (*), fixed bin (35)); 250 dcl window_$clear_window entry (ptr, fixed bin (35)); 251 dcl xforum_trans_$next_ref entry (fixed bin, ptr, fixed bin (35)); 252 dcl xforum_trans_$prev_ref entry (fixed bin, ptr, fixed bin (35)); 253 254 /* CONDITIONS */ 255 256 /* INTERNAL AUTOMATIC */ 257 258 dcl xf_end_line char (100) varying;/* contains the last line of the display */ 259 /* indicates the comment number and if its part of a subject chain */ 260 261 /* INTERNAL STATIC */ 262 263 dcl 01 xf_xforum_error_info like xforum_error_info internal static; 264 /* used to record error infor to be outpuyt to the user */ 265 266 /* CONSTANTS */ 267 268 dcl xf_NL char (1) init (" 269 ") internal static options (constant); 270 /* new line character */ 271 272 /* BUILTINS */ 273 274 dcl ( 275 addbitno, 276 addr, 277 index, 278 length, 279 null, 280 rtrim, 281 substr 282 ) builtin; 283 284 /* BASED */ 285 286 /* INCLUDE FILES */ 287 1 1 /* BEGIN INCLUDE FILE xforum_error_info 84-06-19 Davids */ 1 2 1 3 dcl 01 xforum_error_info based, 1 4 02 name char (32), 1 5 02 entry char (32), 1 6 02 doing char (100), 1 7 02 code fixed bin (35), 1 8 02 reason char (512); 1 9 1 10 /* END INCLUDE FILE xforum_error_info */ 288 289 2 1 /* START OF: xforum_ptr_struct_.incl.pl1 * * * * * */ 2 2 2 3 declare 1 xforum_ptr_struct_ external static, 2 4 2 xforum_meeting_list_ptr ptr, 2 5 2 xforum_meeting_info_ptr ptr, 2 6 2 xforum_trans_array_ptr ptr, 2 7 2 xforum_system_area_ptr ptr; 2 8 2 9 /* END OF: xforum_ptr_struct_.incl.pl1 * * * * * */ 290 291 3 1 /* START OF: xforum_meeting_info.incl.pl1 * * * * * */ 3 2 3 3 3 4 3 5 /****^ HISTORY COMMENTS: 3 6* 1) change(84-05-03,Davids), approve(84-05-03,MCR7350), 3 7* audit(86-04-24,Gilcrease), install(86-04-24,MR12.0-1048): 3 8* Changed the length of name from 20 characters to 32 characters. 3 9* Version 2 forum names can be 26 characters long (forum suffix) - 3 10* and a little extra incase version 3 uses a shorter suffix yet. 3 11* 3 12* 84-10-03 Davids: added the unread_count, next_unread, and 3 13* seen_map_ptr elements. Also the declaration for the 3 14* seen_map_string and seen_map. 3 15* 3 16* 85-01-24 Davids: added the set_array_ptr to the 3 17* xforum_meeting_info structure and the set_array structure and 3 18* SET_ARRAY_SPEC_LEN variable. 3 19* 2) change(86-02-17,LJAdams), approve(86-02-17,MCR7350), 3 20* audit(86-04-24,Gilcrease), install(86-04-24,MR12.0-1048): 3 21* Added restref flag. 3 22* END HISTORY COMMENTS */ 3 23 3 24 declare 1 xforum_meeting_info based (xforum_meeting_info_ptr), 3 25 2 name char (32), 3 26 2 lidx fixed bin, 3 27 2 idx fixed bin, 3 28 2 current fixed bin, 3 29 2 last_seen fixed bin, 3 30 2 first_trans fixed bin, 3 31 2 last_trans fixed bin, 3 32 2 new_trans fixed bin, 3 33 2 flags unal, 3 34 3 all bit (1), 3 35 3 allref bit (1), 3 36 3 restref bit (1), 3 37 3 new bit (1), 3 38 3 range bit (1), 3 39 3 set bit (1), 3 40 2 current_ref fixed bin, 3 41 2 low fixed bin, 3 42 2 high fixed bin, 3 43 2 trans_struct_ptr ptr, 3 44 2 next_unread fixed bin, 3 45 2 unread_count fixed bin, 3 46 2 seen_map_ptr ptr, 3 47 2 set_array_ptr ptr; 3 48 3 49 dcl seen_map_string bit (1000000) based; 3 50 dcl seen_map (1000000) bit (1) unaligned based; 3 51 3 52 dcl 01 set_array based (xforum_meeting_info.set_array_ptr), 3 53 02 number fixed bin, 3 54 02 spec char (80) varying, 3 55 02 index (100000); 3 56 3 57 dcl SET_ARRAY_SPEC_LEN fixed bin init (80) internal static options (constant); 3 58 3 59 /* END OF: xforum_meeting_info.incl.pl1 * * * * * */ 292 293 4 1 /* BEGIN INCLUDE FILE: forum_user_trans.incl.pl1 */ 4 2 4 3 dcl alloc_text_length fixed bin (21); /* length of text area to allocate */ 4 4 dcl alloc_subject_length fixed bin (21); /* length of subject area to allocate */ 4 5 dcl forum_user_trans_ptr ptr; /* pointer to below structure */ 4 6 4 7 dcl 1 forum_user_trans based (forum_user_trans_ptr) aligned, 4 8 2 type fixed bin, /* type of transaction */ 4 9 2 person_id char (22), /* person_id of author of this transaction */ 4 10 2 project_id char (9), /* project_id of author of this transaction */ 4 11 2 time fixed bin (71), /* time transaction was entered */ 4 12 2 trans_no fixed bin, /* number of this transaction */ 4 13 2 next_trans_ptr ptr, /* pointer (in user ring) of next transaction */ 4 14 2 prev_trans_ptr ptr, /* pointer (in user ring) of previous transaction */ 4 15 2 subject_length fixed bin (21), /* length of subject field of transaction */ 4 16 2 text_length fixed bin (21), /* length of text field of transaction */ 4 17 2 unfilled bit (1) aligned, /* set if transaction is NOT stored filled */ 4 18 2 subject char (alloc_subject_length refer (forum_user_trans.subject_length)) unaligned, /* subject of transaction */ 4 19 2 text char (alloc_text_length refer (forum_user_trans.text_length)) unaligned; /* text of transaction */ 4 20 4 21 declare user_trans_type fixed bin static options (constant) initial (1); 4 22 declare message_type fixed bin static options (constant) initial (2); 4 23 4 24 declare (ONLY_UNDELETED init (0), 4 25 INCLUDE_DELETED init (1), 4 26 ONLY_DELETED init (2)) 4 27 fixed bin static options (constant); 4 28 4 29 /* END INCLUDE FILE: forum_user_trans.incl.pl1 */ 294 295 5 1 /* BEGIN INCLUDE FILE ... terminate_file.incl.pl1 */ 5 2 /* format: style2,^inddcls,idind32 */ 5 3 5 4 declare 1 terminate_file_switches based, 5 5 2 truncate bit (1) unaligned, 5 6 2 set_bc bit (1) unaligned, 5 7 2 terminate bit (1) unaligned, 5 8 2 force_write bit (1) unaligned, 5 9 2 delete bit (1) unaligned; 5 10 5 11 declare TERM_FILE_TRUNC bit (1) internal static options (constant) initial ("1"b); 5 12 declare TERM_FILE_BC bit (2) internal static options (constant) initial ("01"b); 5 13 declare TERM_FILE_TRUNC_BC bit (2) internal static options (constant) initial ("11"b); 5 14 declare TERM_FILE_TERM bit (3) internal static options (constant) initial ("001"b); 5 15 declare TERM_FILE_TRUNC_BC_TERM bit (3) internal static options (constant) initial ("111"b); 5 16 declare TERM_FILE_FORCE_WRITE bit (4) internal static options (constant) initial ("0001"b); 5 17 declare TERM_FILE_DELETE bit (5) internal static options (constant) initial ("00001"b); 5 18 5 19 /* END INCLUDE FILE ... terminate_file.incl.pl1 */ 296 297 298 call error (0, "Internal programming error - xforum_format_$xforum_format called."); 299 300 display: entry (d_forum_user_trans_ptr, d_clear_sw, d_code); 301 302 /* PARAMETERS */ 303 304 dcl d_forum_user_trans_ptr ptr; /* (input) pointer to forum_user_trans */ 305 /* structure for transaction to be displayed */ 306 dcl d_clear_sw bit (1) aligned; /* (input) if "1"b the user_io window */ 307 /* will be cleared prior to the display */ 308 dcl d_code fixed bin (35); /* (output) standard error code */ 309 310 /* INTERNAL AUTOMATIC */ 311 312 dcl d_date_time char (256); /* date and time comment was entered */ 313 /* formated according to the users date_time format */ 314 dcl d_lines fixed bin; /* number of lines in the comment */ 315 dcl d_number fixed bin; /* forum comment number */ 316 317 318 319 320 321 d_code = 0; 322 323 if d_clear_sw 324 then call window_$clear_window (iox_$user_io, (0)); 325 326 forum_user_trans_ptr = d_forum_user_trans_ptr; 327 d_number = forum_user_trans.trans_no; 328 d_lines = count_lines (); 329 call make_end_line (d_number); 330 331 d_date_time = date_time_$format ("^", forum_user_trans.time, "", ""); 332 call ioa_ ( 333 "^[^/^][^i] (^d line^[s^]) ^a.^a ^a ^a^/Subject: ^a^/^a--------------^/^a", 334 ^d_clear_sw, d_number, d_lines, (d_lines ^= 1), 335 forum_user_trans.person_id, forum_user_trans.project_id, 336 d_date_time, xforum_meeting_info.name, 337 forum_user_trans.subject, forum_user_trans.text, 338 xf_end_line); 339 340 free forum_user_trans; 341 342 return; 343 344 list: entry (l_forum_user_trans_ptr, l_item_line, l_subject_max_len, l_code); 345 346 /* PARAMETERS */ 347 348 dcl l_forum_user_trans_ptr ptr; /* (input) pointer to forum_user_trans */ 349 /* structure for transaction to be listed */ 350 dcl l_item_line char (*); /* (input) ioa_ control string to */ 351 /* be used to output line of listing */ 352 dcl l_subject_max_len fixed bin; /* (input) max number of chars from */ 353 /* subject to include in listing */ 354 dcl l_code fixed bin (35); /* (output) standard error code */ 355 356 /* INTERNAL AUTOMATIC */ 357 358 dcl l_date_string char (100); /* date comment was entered */ 359 /* formated according to the users date format */ 360 dcl l_lines fixed bin; /* number of lines in the comment */ 361 dcl l_local_subject char (25); /* that part of the subject string that will be listed */ 362 dcl l_nl_index fixed bin; /* index in local_subject string of */ 363 /* the first new line char, if any */ 364 dcl l_number fixed bin; /* forum comment number */ 365 dcl l_time_string char (100); /* time comment was entered */ 366 /* formated according to the users time format */ 367 368 369 370 371 372 l_code = 0; 373 374 forum_user_trans_ptr = l_forum_user_trans_ptr; 375 l_number = forum_user_trans.trans_no; 376 l_lines = count_lines (); 377 378 l_date_string = date_time_$format ("^", forum_user_trans.time, "", ""); 379 l_time_string = date_time_$format ("^