~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to rtl/unix/terminfo.pp

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
{
2
 
    $Id: terminfo.pp,v 1.6 2004/03/05 22:18:15 jonas Exp $
3
 
    This file is part of the Free Pascal run time library.
4
 
    Copyright (c) 1999-2000 by Florian Klaempfl
5
 
    member of the Free Pascal development team
6
 
 
7
 
    TermInfo interface unit for linux
8
 
 
9
 
    See the file COPYING.FPC, included in this distribution,
10
 
    for details about the copyright.
11
 
 
12
 
    This program is distributed in the hope that it will be useful,
13
 
    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
 
 
16
 
 **********************************************************************}
17
 
unit TermInfo;
18
 
 
19
 
interface
20
 
 
21
 
{$linklib ncurses}
22
 
{$linklib c}
23
 
{$packrecords c}
24
 
 
25
 
const curseslib = 'ncurses';
26
 
 
27
 
const
28
 
  { boolean values }
29
 
  auto_left_margin              = 0;
30
 
  auto_right_margin             = 1;
31
 
  no_esc_ctlc                   = 2;
32
 
  ceol_standout_glitch          = 3;
33
 
  eat_newline_glitch            = 4;
34
 
  erase_overstrike              = 5;
35
 
  generic_type                  = 6;
36
 
  hard_copy                     = 7;
37
 
  has_meta_key                  = 8;
38
 
  has_status_line               = 9;
39
 
  insert_null_glitch            = 10;
40
 
  memory_above                  = 11;
41
 
  memory_below                  = 12;
42
 
  move_insert_mode              = 13;
43
 
  move_standout_mode            = 14;
44
 
  over_strike                   = 15;
45
 
  status_line_esc_ok            = 16;
46
 
  dest_tabs_magic_smso          = 17;
47
 
  tilde_glitch                  = 18;
48
 
  transparent_underline         = 19;
49
 
  xon_xoff                      = 20;
50
 
  needs_xon_xoff                = 21;
51
 
  prtr_silent                   = 22;
52
 
  hard_cursor                   = 23;
53
 
  non_rev_rmcup                 = 24;
54
 
  no_pad_char                   = 25;
55
 
  non_dest_scroll_region        = 26;
56
 
  can_change                    = 27;
57
 
  back_color_erase              = 28;
58
 
  hue_lightness_saturation      = 29;
59
 
  col_addr_glitch               = 30;
60
 
  cr_cancels_micro_mode         = 31;
61
 
  has_print_wheel               = 32;
62
 
  row_addr_glitch               = 33;
63
 
  semi_auto_right_margin        = 34;
64
 
  cpi_changes_res               = 35;
65
 
  lpi_changes_res               = 36;
66
 
 
67
 
  { numbers ... }
68
 
  columns                       = 0;
69
 
  init_tabs                     = 1;
70
 
  lines                         = 2;
71
 
  lines_of_memory               = 3;
72
 
  magic_cookie_glitch           = 4;
73
 
  padding_baud_rate             = 5;
74
 
  virtual_terminal              = 6;
75
 
  width_status_line             = 7;
76
 
  num_labels                    = 8;
77
 
  label_height                  = 9;
78
 
  label_width                   = 10;
79
 
  max_attributes                = 11;
80
 
  maximum_windows               = 12;
81
 
  max_colors                    = 13;
82
 
  max_pairs                     = 14;
83
 
  no_color_video                = 15;
84
 
  buffer_capacity               = 16;
85
 
  dot_vert_spacing              = 17;
86
 
  dot_horz_spacing              = 18;
87
 
  max_micro_address             = 19;
88
 
  max_micro_jump                = 20;
89
 
  micro_char_size               = 21;
90
 
  micro_line_size               = 22;
91
 
  number_of_pins                = 23;
92
 
  output_res_char               = 24;
93
 
  output_res_line               = 25;
94
 
  output_res_horz_inch          = 26;
95
 
  output_res_vert_inch          = 27;
96
 
  print_rate                    = 28;
97
 
  wide_char_size                = 29;
98
 
  buttons                       = 30;
99
 
  bit_image_entwining           = 31;
100
 
  bit_image_type                = 32;
101
 
 
102
 
  { strings }
103
 
  back_tab                      = 0;
104
 
  bell                          = 1;
105
 
  carriage_return               = 2;
106
 
  change_scroll_region          = 3;
107
 
  clear_all_tabs                = 4;
108
 
  clear_screen                  = 5;
109
 
  clr_eol                       = 6;
110
 
  clr_eos                       = 7;
111
 
  column_address                = 8;
112
 
  command_character             = 9;
113
 
  cursor_address                = 10;
114
 
  cursor_down                   = 11;
115
 
  cursor_home                   = 12;
116
 
  cursor_invisible              = 13;
117
 
  cursor_left                   = 14;
118
 
  cursor_mem_address            = 15;
119
 
  cursor_normal                 = 16;
120
 
  cursor_right                  = 17;
121
 
  cursor_to_ll                  = 18;
122
 
  cursor_up                     = 19;
123
 
  cursor_visible                = 20;
124
 
  delete_character              = 21;
125
 
  delete_line                   = 22;
126
 
  dis_status_line               = 23;
127
 
  down_half_line                = 24;
128
 
  enter_alt_charset_mode        = 25;
129
 
  enter_blink_mode              = 26;
130
 
  enter_bold_mode               = 27;
131
 
  enter_ca_mode                 = 28;
132
 
  enter_delete_mode             = 29;
133
 
  enter_dim_mode                = 30;
134
 
  enter_insert_mode             = 31;
135
 
  enter_secure_mode             = 32;
136
 
  enter_protected_mode          = 33;
137
 
  enter_reverse_mode            = 34;
138
 
  enter_standout_mode           = 35;
139
 
  enter_underline_mode          = 36;
140
 
  erase_chars                   = 37;
141
 
  exit_alt_charset_mode         = 38;
142
 
  exit_attribute_mode           = 39;
143
 
  exit_ca_mode                  = 40;
144
 
  exit_delete_mode              = 41;
145
 
  exit_insert_mode              = 42;
146
 
  exit_standout_mode            = 43;
147
 
  exit_underline_mode           = 44;
148
 
  flash_screen                  = 45;
149
 
  form_feed                     = 46;
150
 
  from_status_line              = 47;
151
 
  init_1string                  = 48;
152
 
  init_2string                  = 49;
153
 
  init_3string                  = 50;
154
 
  init_file                     = 51;
155
 
  insert_character              = 52;
156
 
  insert_line                   = 53;
157
 
  insert_padding                = 54;
158
 
  key_backspace                 = 55;
159
 
  key_catab                     = 56;
160
 
  key_clear                     = 57;
161
 
  key_ctab                      = 58;
162
 
  key_dc                        = 59;
163
 
  key_dl                        = 60;
164
 
  key_down                      = 61;
165
 
  key_eic                       = 62;
166
 
  key_eol                       = 63;
167
 
  key_eos                       = 64;
168
 
  key_f0                        = 65;
169
 
  key_f1                        = 66;
170
 
  key_f10                       = 67;
171
 
  key_f2                        = 68;
172
 
  key_f3                        = 69;
173
 
  key_f4                        = 70;
174
 
  key_f5                        = 71;
175
 
  key_f6                        = 72;
176
 
  key_f7                        = 73;
177
 
  key_f8                        = 74;
178
 
  key_f9                        = 75;
179
 
  key_home                      = 76;
180
 
  key_ic                        = 77;
181
 
  key_il                        = 78;
182
 
  key_left                      = 79;
183
 
  key_ll                        = 80;
184
 
  key_npage                     = 81;
185
 
  key_ppage                     = 82;
186
 
  key_right                     = 83;
187
 
  key_sf                        = 84;
188
 
  key_sr                        = 85;
189
 
  key_stab                      = 86;
190
 
  key_up                        = 87;
191
 
  keypad_local                  = 88;
192
 
  keypad_xmit                   = 89;
193
 
  lab_f0                        = 90;
194
 
  lab_f1                        = 91;
195
 
  lab_f10                       = 92;
196
 
  lab_f2                        = 93;
197
 
  lab_f3                        = 94;
198
 
  lab_f4                        = 95;
199
 
  lab_f5                        = 96;
200
 
  lab_f6                        = 97;
201
 
  lab_f7                        = 98;
202
 
  lab_f8                        = 99;
203
 
  lab_f9                        = 100;
204
 
  meta_off                      = 101;
205
 
  meta_on                       = 102;
206
 
  newline                       = 103;
207
 
  pad_char                      = 104;
208
 
  parm_dch                      = 105;
209
 
  parm_delete_line              = 106;
210
 
  parm_down_cursor              = 107;
211
 
  parm_ich                      = 108;
212
 
  parm_index                    = 109;
213
 
  parm_insert_line              = 110;
214
 
  parm_left_cursor              = 111;
215
 
  parm_right_cursor             = 112;
216
 
  parm_rindex                   = 113;
217
 
  parm_up_cursor                = 114;
218
 
  pkey_key                      = 115;
219
 
  pkey_local                    = 116;
220
 
  pkey_xmit                     = 117;
221
 
  print_screen                  = 118;
222
 
  prtr_off                      = 119;
223
 
  prtr_on                       = 120;
224
 
  repeat_char                   = 121;
225
 
  reset_1string                 = 122;
226
 
  reset_2string                 = 123;
227
 
  reset_3string                 = 124;
228
 
  reset_file                    = 125;
229
 
  restore_cursor                = 126;
230
 
  row_address                   = 127;
231
 
  save_cursor                   = 128;
232
 
  scroll_forward                = 129;
233
 
  scroll_reverse                = 130;
234
 
  set_attributes                = 131;
235
 
  set_tab                       = 132;
236
 
  set_window                    = 133;
237
 
  tab                           = 134;
238
 
  to_status_line                = 135;
239
 
  underline_char                = 136;
240
 
  up_half_line                  = 137;
241
 
  init_prog                     = 138;
242
 
  key_a1                        = 139;
243
 
  key_a3                        = 140;
244
 
  key_b2                        = 141;
245
 
  key_c1                        = 142;
246
 
  key_c3                        = 143;
247
 
  prtr_non                      = 144;
248
 
  char_padding                  = 145;
249
 
  acs_chars                     = 146;
250
 
  plab_norm                     = 147;
251
 
  key_btab                      = 148;
252
 
  enter_xon_mode                = 149;
253
 
  exit_xon_mode                 = 150;
254
 
  enter_am_mode                 = 151;
255
 
  exit_am_mode                  = 152;
256
 
  xon_character                 = 153;
257
 
  xoff_character                = 154;
258
 
  ena_acs                       = 155;
259
 
  label_on                      = 156;
260
 
  label_off                     = 157;
261
 
  key_beg                       = 158;
262
 
  key_cancel                    = 159;
263
 
  key_close                     = 160;
264
 
  key_command                   = 161;
265
 
  key_copy                      = 162;
266
 
  key_create                    = 163;
267
 
  key_end                       = 164;
268
 
  key_enter                     = 165;
269
 
  key_exit                      = 166;
270
 
  key_find                      = 167;
271
 
  key_help                      = 168;
272
 
  key_mark                      = 169;
273
 
  key_message                   = 170;
274
 
  key_move                      = 171;
275
 
  key_next                      = 172;
276
 
  key_open                      = 173;
277
 
  key_options                   = 174;
278
 
  key_previous                  = 175;
279
 
  key_print                     = 176;
280
 
  key_redo                      = 177;
281
 
  key_reference                 = 178;
282
 
  key_refresh                   = 179;
283
 
  key_replace                   = 180;
284
 
  key_restart                   = 181;
285
 
  key_resume                    = 182;
286
 
  key_save                      = 183;
287
 
  key_suspend                   = 184;
288
 
  key_undo                      = 185;
289
 
  key_sbeg                      = 186;
290
 
  key_scancel                   = 187;
291
 
  key_scommand                  = 188;
292
 
  key_scopy                     = 189;
293
 
  key_screate                   = 190;
294
 
  key_sdc                       = 191;
295
 
  key_sdl                       = 192;
296
 
  key_select                    = 193;
297
 
  key_send                      = 194;
298
 
  key_seol                      = 195;
299
 
  key_sexit                     = 196;
300
 
  key_sfind                     = 197;
301
 
  key_shelp                     = 198;
302
 
  key_shome                     = 199;
303
 
  key_sic                       = 200;
304
 
  key_sleft                     = 201;
305
 
  key_smessage                  = 202;
306
 
  key_smove                     = 203;
307
 
  key_snext                     = 204;
308
 
  key_soptions                  = 205;
309
 
  key_sprevious                 = 206;
310
 
  key_sprint                    = 207;
311
 
  key_sredo                     = 208;
312
 
  key_sreplace                  = 209;
313
 
  key_sright                    = 210;
314
 
  key_srsume                    = 211;
315
 
  key_ssave                     = 212;
316
 
  key_ssuspend                  = 213;
317
 
  key_sundo                     = 214;
318
 
  req_for_input                 = 215;
319
 
  key_f11                       = 216;
320
 
  key_f12                       = 217;
321
 
  key_f13                       = 218;
322
 
  key_f14                       = 219;
323
 
  key_f15                       = 220;
324
 
  key_f16                       = 221;
325
 
  key_f17                       = 222;
326
 
  key_f18                       = 223;
327
 
  key_f19                       = 224;
328
 
  key_f20                       = 225;
329
 
  key_f21                       = 226;
330
 
  key_f22                       = 227;
331
 
  key_f23                       = 228;
332
 
  key_f24                       = 229;
333
 
  key_f25                       = 230;
334
 
  key_f26                       = 231;
335
 
  key_f27                       = 232;
336
 
  key_f28                       = 233;
337
 
  key_f29                       = 234;
338
 
  key_f30                       = 235;
339
 
  key_f31                       = 236;
340
 
  key_f32                       = 237;
341
 
  key_f33                       = 238;
342
 
  key_f34                       = 239;
343
 
  key_f35                       = 240;
344
 
  key_f36                       = 241;
345
 
  key_f37                       = 242;
346
 
  key_f38                       = 243;
347
 
  key_f39                       = 244;
348
 
  key_f40                       = 245;
349
 
  key_f41                       = 246;
350
 
  key_f42                       = 247;
351
 
  key_f43                       = 248;
352
 
  key_f44                       = 249;
353
 
  key_f45                       = 250;
354
 
  key_f46                       = 251;
355
 
  key_f47                       = 252;
356
 
  key_f48                       = 253;
357
 
  key_f49                       = 254;
358
 
  key_f50                       = 255;
359
 
  key_f51                       = 256;
360
 
  key_f52                       = 257;
361
 
  key_f53                       = 258;
362
 
  key_f54                       = 259;
363
 
  key_f55                       = 260;
364
 
  key_f56                       = 261;
365
 
  key_f57                       = 262;
366
 
  key_f58                       = 263;
367
 
  key_f59                       = 264;
368
 
  key_f60                       = 265;
369
 
  key_f61                       = 266;
370
 
  key_f62                       = 267;
371
 
  key_f63                       = 268;
372
 
  clr_bol                       = 269;
373
 
  clear_margins                 = 270;
374
 
  set_left_margin               = 271;
375
 
  set_right_margin              = 272;
376
 
  label_format                  = 273;
377
 
  set_clock                     = 274;
378
 
  display_clock                 = 275;
379
 
  remove_clock                  = 276;
380
 
  create_window                 = 277;
381
 
  goto_window                   = 278;
382
 
  hangup                        = 279;
383
 
  dial_phone                    = 280;
384
 
  quick_dial                    = 281;
385
 
  tone                          = 282;
386
 
  pulse                         = 283;
387
 
  flash_hook                    = 284;
388
 
  fixed_pause                   = 285;
389
 
  wait_tone                     = 286;
390
 
  user0                         = 287;
391
 
  user1                         = 288;
392
 
  user2                         = 289;
393
 
  user3                         = 290;
394
 
  user4                         = 291;
395
 
  user5                         = 292;
396
 
  user6                         = 293;
397
 
  user7                         = 294;
398
 
  user8                         = 295;
399
 
  user9                         = 296;
400
 
  orig_pair                     = 297;
401
 
  orig_colors                   = 298;
402
 
  initialize_color              = 299;
403
 
  initialize_pair               = 300;
404
 
  set_color_pair                = 301;
405
 
  set_foreground                = 302;
406
 
  set_background                = 303;
407
 
  change_char_pitch             = 304;
408
 
  change_line_pitch             = 305;
409
 
  change_res_horz               = 306;
410
 
  change_res_vert               = 307;
411
 
  define_char                   = 308;
412
 
  enter_doublewide_mode         = 309;
413
 
  enter_draft_quality           = 310;
414
 
  enter_italics_mode            = 311;
415
 
  enter_leftward_mode           = 312;
416
 
  enter_micro_mode              = 313;
417
 
  enter_near_letter_quality     = 314;
418
 
  enter_normal_quality          = 315;
419
 
  enter_shadow_mode             = 316;
420
 
  enter_subscript_mode          = 317;
421
 
  enter_superscript_mode        = 318;
422
 
  enter_upward_mode             = 319;
423
 
  exit_doublewide_mode          = 320;
424
 
  exit_italics_mode             = 321;
425
 
  exit_leftward_mode            = 322;
426
 
  exit_micro_mode               = 323;
427
 
  exit_shadow_mode              = 324;
428
 
  exit_subscript_mode           = 325;
429
 
  exit_superscript_mode         = 326;
430
 
  exit_upward_mode              = 327;
431
 
  micro_column_address          = 328;
432
 
  micro_down                    = 329;
433
 
  micro_left                    = 330;
434
 
  micro_right                   = 331;
435
 
  micro_row_address             = 332;
436
 
  micro_up                      = 333;
437
 
  order_of_pins                 = 334;
438
 
  parm_down_micro               = 335;
439
 
  parm_left_micro               = 336;
440
 
  parm_right_micro              = 337;
441
 
  parm_up_micro                 = 338;
442
 
  select_char_set               = 339;
443
 
  set_bottom_margin             = 340;
444
 
  set_bottom_margin_parm        = 341;
445
 
  set_left_margin_parm          = 342;
446
 
  set_right_margin_parm         = 343;
447
 
  set_top_margin                = 344;
448
 
  set_top_margin_parm           = 345;
449
 
  start_bit_image               = 346;
450
 
  start_char_set_def            = 347;
451
 
  stop_bit_image                = 348;
452
 
  stop_char_set_def             = 349;
453
 
  subscript_characters          = 350;
454
 
  superscript_characters        = 351;
455
 
  these_cause_cr                = 352;
456
 
  zero_motion                   = 353;
457
 
  char_set_names                = 354;
458
 
  key_mouse                     = 355;
459
 
  mouse_info                    = 356;
460
 
  req_mouse_pos                 = 357;
461
 
  get_mouse                     = 358;
462
 
  set_a_foreground              = 359;
463
 
  set_a_background              = 360;
464
 
  pkey_plab                     = 361;
465
 
  device_type                   = 362;
466
 
  code_set_init                 = 363;
467
 
  set0_des_seq                  = 364;
468
 
  set1_des_seq                  = 365;
469
 
  set2_des_seq                  = 366;
470
 
  set3_des_seq                  = 367;
471
 
  set_lr_margin                 = 368;
472
 
  set_tb_margin                 = 369;
473
 
  bit_image_repeat              = 370;
474
 
  bit_image_newline             = 371;
475
 
  bit_image_carriage_return     = 372;
476
 
  color_names                   = 373;
477
 
  define_bit_image_region       = 374;
478
 
  end_bit_image_region          = 375;
479
 
  set_color_band                = 376;
480
 
  set_page_length               = 377;
481
 
  display_pc_char               = 378;
482
 
  enter_pc_charset_mode         = 379;
483
 
  exit_pc_charset_mode          = 380;
484
 
  enter_scancode_mode           = 381;
485
 
  exit_scancode_mode            = 382;
486
 
  pc_term_options               = 383;
487
 
  scancode_escape               = 384;
488
 
  alt_scancode_esc              = 385;
489
 
  enter_horizontal_hl_mode      = 386;
490
 
  enter_left_hl_mode            = 387;
491
 
  enter_low_hl_mode             = 388;
492
 
  enter_right_hl_mode           = 389;
493
 
  enter_top_hl_mode             = 390;
494
 
  enter_vertical_hl_mode        = 391;
495
 
 
496
 
  { older synonyms for some booleans }
497
 
  beehive_glitch                = no_esc_ctlc;
498
 
  teleray_glitch                = dest_tabs_magic_smso;
499
 
  micro_col_size                = micro_char_size;
500
 
  { internal }
501
 
  termcap_init2               = 392;
502
 
  termcap_reset               = 393;
503
 
  magic_cookie_glitch_ul      = 33;
504
 
  backspaces_with_bs          = 37;
505
 
  crt_no_scrolling            = 38;
506
 
  no_correctly_working_cr     = 39;
507
 
  carriage_return_delay       = 34;
508
 
  new_line_delay              = 35;
509
 
  linefeed_if_not_lf          = 394;
510
 
  backspace_if_not_bs         = 395;
511
 
  gnu_has_meta_key            = 40;
512
 
  linefeed_is_newline         = 41;
513
 
  backspace_delay             = 36;
514
 
  horizontal_tab_delay        = 37;
515
 
  number_of_function_keys     = 38;
516
 
  other_non_function_keys     = 396;
517
 
  arrow_key_map               = 397;
518
 
  has_hardware_tabs           = 42;
519
 
  return_does_clr_eol         = 43;
520
 
  acs_ulcorner                = 398;
521
 
  acs_llcorner                = 399;
522
 
  acs_urcorner                = 400;
523
 
  acs_lrcorner                = 401;
524
 
  acs_ltee                    = 402;
525
 
  acs_rtee                    = 403;
526
 
  acs_btee                    = 404;
527
 
  acs_ttee                    = 405;
528
 
  acs_hline                   = 406;
529
 
  acs_vline                   = 407;
530
 
  acs_plus                    = 408;
531
 
  memory_lock                 = 409;
532
 
  memory_unlock               = 410;
533
 
  box_chars_1                 = 411;
534
 
 
535
 
 
536
 
const
537
 
  NCCS = 32;
538
 
  BoolCount = 44;
539
 
  NumCount = 39;
540
 
  StrCount = 412;
541
 
 
542
 
type
543
 
  TCFlag_t = Longint;
544
 
  Speed_t = Longint;
545
 
  TermIOS = record
546
 
    c_iflag, c_oflag, c_cflag, c_lflag: TCFlag_t;
547
 
    c_line: Byte;
548
 
    c_cc: array [0..NCCS-1] of Char;
549
 
    c_ispeed, c_ospeed: Speed_t;
550
 
    Pad: word;
551
 
  end;
552
 
 
553
 
  TT_BoolArray = array [0..BoolCount - 1] of Boolean;
554
 
  TT_WordArray = array [0..NumCount - 1] of Word;
555
 
  TT_PCharArray = array [0..StrCount - 1] of PChar;
556
 
 
557
 
  TermType4 = record
558
 
    Term_Names: PChar;
559
 
    Str_Table: PChar;
560
 
    Booleans: TT_BoolArray;
561
 
    Numbers: TT_WordArray;
562
 
    Strings: TT_PCharArray;
563
 
  end;
564
 
 
565
 
  Terminal_ptr4 = ^Terminal4;
566
 
  Terminal4 = record
567
 
    TType: TermType4;
568
 
    FileDes: Word;
569
 
    Ottyb, Nttyb: Termios;
570
 
    Pad: longint;
571
 
  end;
572
 
 
573
 
  TermType5 = record
574
 
    Term_Names: PChar;
575
 
    Str_Table: PChar;
576
 
    Booleans: ^TT_BoolArray;
577
 
    Numbers: ^TT_WordArray;
578
 
    Strings: ^TT_PCharArray;
579
 
  end;
580
 
 
581
 
  Terminal_ptr5 = ^Terminal5;
582
 
  Terminal5 = record
583
 
    TType: TermType5;
584
 
    FileDes: Word;
585
 
    Ottyb, Nttyb: Termios;
586
 
    Pad: longint;
587
 
  end;
588
 
 
589
 
  TerminalCommon_ptr1 = ^TerminalCommon1;
590
 
  TerminalCommon1 = record
591
 
    Term_Names: PChar;
592
 
    Str_Table: PChar;
593
 
  end;
594
 
 
595
 
  TerminalCommon_ptr2 = ^TerminalCommon2;
596
 
  TerminalCommon2 = record
597
 
    FileDes: Word;
598
 
    Ottyb, Nttyb: Termios;
599
 
    Pad: longint;
600
 
  end;
601
 
 
602
 
  WriterFunc = function (P: PChar): Longint;
603
 
 
604
 
var
605
 
{$ifndef darwin}
606
 
  cur_term : TerminalCommon_ptr1; cvar; external;
607
 
{$else darwin}
608
 
  cur_term : TerminalCommon_ptr1; external curseslib name 'cur_term';
609
 
{$endif darwin}
610
 
  cur_term_booleans: ^TT_BoolArray;
611
 
  cur_term_numbers: ^TT_WordArray;
612
 
  cur_term_strings: ^TT_PCharArray;
613
 
  cur_term_common: TerminalCommon_ptr2;
614
 
 
615
 
const
616
 
  cur_term_valid : boolean = false;
617
 
 
618
 
{ Note: the following two procedures expect a pointer to a full terminfo }
619
 
{ structure, not just to the common parts. However, since this structure }
620
 
{ differs for different versions of ncurses,it's impossible to give a    }
621
 
{ general declaration here which is correct (JM)                         }
622
 
function set_curterm(term: TerminalCommon_ptr1): TerminalCommon_ptr1;cdecl;
623
 
function del_curterm(term: TerminalCommon_ptr1): Longint;
624
 
 
625
 
{ sets whether to use environment variables for LINES and COLUMNS }
626
 
procedure use_env(B: Longint);cdecl;
627
 
 
628
 
function putp(Ndx: Longint): Longint;
629
 
 
630
 
{ this function must be called before any terminal properties are accessed }
631
 
function setupterm(Term: PChar; fd: Longint; var ErrCode: Longint): Longint;
632
 
 
633
 
{ reinitialize lib }
634
 
function restartterm(Term: PChar; fd: Longint; var ErrCode: Longint): Longint;cdecl;
635
 
 
636
 
{function tgetent(P1, P2: PChar): Longint;
637
 
function tgetflag(P: PChar): Longint;
638
 
function tgetnum(P: PChar): Longint;
639
 
function tgoto(P: PChar; L1, L2: Longint): PChar;
640
 
function tgetstr(P: PChar; var R: PChar): PChar;
641
 
function tigetflag(P: PChar): Longint;
642
 
function tigetnum(P: PChar): Longint;
643
 
function tigetstr(P: PChar): PChar;
644
 
function tparm(P: PChar, ...): PChar;
645
 
function tparam(const char *, char *, int, ...): PChar;}
646
 
function tputs(Ndx: Word; L1: Longint; F: WriterFunc): Longint;
647
 
 
648
 
implementation
649
 
 
650
 
uses
651
 
  baseUnix;
652
 
 
653
 
function putp(Ndx: Longint): Longint;
654
 
var
655
 
  P: PChar;
656
 
begin
657
 
  if not assigned(cur_term) then
658
 
    RunError(219);
659
 
  P := cur_term_strings^[Ndx];
660
 
  putp := fpWrite(cur_term_common^.filedes, P^, StrLen(P));
661
 
end;
662
 
 
663
 
function tputs(Ndx: Word; L1: Longint; F: WriterFunc): Longint;
664
 
var
665
 
  P: PChar;
666
 
begin
667
 
  if not assigned(cur_term) then
668
 
    RunError(219);
669
 
  { L1 := L1; why was this here ?? PM }
670
 
  P := cur_term_strings^[Ndx];
671
 
  tputs := F(P);
672
 
end;
673
 
 
674
 
function set_curterm(term: TerminalCommon_ptr1): TerminalCommon_ptr1; cdecl; external curseslib;
675
 
 
676
 
procedure use_env(B: Longint); cdecl; external curseslib;
677
 
 
678
 
function restartterm(Term: PChar; fd: Longint; var ErrCode: Longint): Longint; cdecl; external curseslib;
679
 
 
680
 
function setuptermC(Term: PChar; fd: Longint; var ErrCode: Longint): Longint; cdecl; external curseslib name 'setupterm';
681
 
 
682
 
function setupterm(Term: PChar; fd: Longint; var ErrCode: Longint): Longint;
683
 
var
684
 
  versioncheck: longint;
685
 
begin
686
 
  setupterm := setuptermC(term,fd,errcode);
687
 
  if not assigned(cur_term) then
688
 
    exit;
689
 
  cur_term_valid := true;
690
 
  versioncheck := 0;
691
 
  repeat
692
 
    if (Terminal_ptr4(cur_term)^.ttype.Booleans[versioncheck] in [false,true]) then
693
 
      inc(versioncheck)
694
 
    else versioncheck := -1;
695
 
  until (versioncheck = BoolCount) or
696
 
        (versioncheck = -1);
697
 
  if versioncheck = BoolCount then
698
 
    { version 4.x }
699
 
    begin
700
 
      cur_term_booleans := @Terminal_ptr4(cur_term)^.ttype.Booleans;
701
 
      cur_term_numbers := @Terminal_ptr4(cur_term)^.ttype.Numbers;
702
 
      cur_term_strings := @Terminal_ptr4(cur_term)^.ttype.Strings;
703
 
      cur_term_common := pointer(@Terminal_ptr4(cur_term)^.FileDes);
704
 
    end
705
 
  else
706
 
    { assume 5.x or higher }
707
 
    begin
708
 
      cur_term_booleans := Terminal_ptr5(cur_term)^.ttype.Booleans;
709
 
      cur_term_numbers := Terminal_ptr5(cur_term)^.ttype.Numbers;
710
 
      cur_term_strings := Terminal_ptr5(cur_term)^.ttype.Strings;
711
 
      cur_term_common := pointer(@Terminal_ptr5(cur_term)^.FileDes);
712
 
    end;
713
 
end;
714
 
 
715
 
function del_curtermC(term: TerminalCommon_ptr1): Longint; cdecl; external curseslib name 'del_curterm';
716
 
 
717
 
function del_curterm(term: TerminalCommon_ptr1): Longint;
718
 
var
719
 
  reset_cur_term : boolean;
720
 
begin
721
 
  if term=cur_term then
722
 
    begin
723
 
      cur_term_booleans := nil;
724
 
      cur_term_numbers := nil;
725
 
      cur_term_strings := nil;
726
 
      cur_term_common := nil;
727
 
      reset_cur_term := true;
728
 
    end
729
 
  else
730
 
    reset_cur_term := false;
731
 
  del_curterm := del_curtermC(term);
732
 
  if reset_cur_term then
733
 
    cur_term_valid := false;
734
 
end;
735
 
 
736
 
{function tgetent(P1, P2: PChar): Longint; cdecl; external;
737
 
function tgetflag(P: PChar): Longint; cdecl; external;
738
 
function tgetnum(P: PChar): Longint; cdecl; external;
739
 
function tgoto(P: PChar; L1, L2: Longint): PChar; cdecl; external;
740
 
function tgetstr(P: PChar; var R: PChar): PChar; cdecl; external;
741
 
function tigetflag(P: PChar): Longint; cdecl; external;
742
 
function tigetnum(P: PChar): Longint; cdecl; external;
743
 
function tigetstr(P: PChar): PChar; cdecl; external;
744
 
function tparm(P: PChar; ...): PChar; cdecl; external;
745
 
function tparam(const char *, char *, int, ...): PChar; cdecl; external;}
746
 
 
747
 
end.
748
 
{
749
 
  $Log: terminfo.pp,v $
750
 
  Revision 1.6  2004/03/05 22:18:15  jonas
751
 
    * fixed declaration for cur_term for darwin now that the importing of
752
 
      variables from shared libraries works
753
 
 
754
 
  Revision 1.5  2004/02/06 22:35:50  jonas
755
 
    + some darwin support, doesn't work yet because of imported variables
756
 
      problem
757
 
 
758
 
  Revision 1.4  2003/09/14 20:15:01  marco
759
 
   * Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
760
 
 
761
 
  Revision 1.3  2002/09/07 16:01:28  peter
762
 
    * old logs removed and tabs fixed
763
 
 
764
 
}