-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOpenDoor.h
1123 lines (1028 loc) · 43.5 KB
/
OpenDoor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* OpenDoors Online Software Programming Toolkit
* (C) Copyright 1991 - 1999 by Brian Pirie.
*
* Oct-2001 door32.sys/socket modifications by Rob Swindell (www.synchro.net)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* File: OpenDoor.h
*
* Description: C/C++ definition of the OpenDoors API. Any program source file
* that uses OpenDoors must #include this file.
*
* Revisions: Date Ver Who Change
* ---------------------------------------------------------------
* Dec 02, 1995 6.00 BP New file header format.
* Dec 09, 1995 6.00 BP Added od_multiline_edit() prototype.
* Dec 12, 1995 6.00 BP Cleaned up, added DLL definitions.
* Dec 12, 1995 6.00 BP Moved ODPLAT_??? to OpenDoor.h.
* Dec 21, 1995 6.00 BP Add ability to use already open port.
* Dec 22, 1995 6.00 BP Added od_connect_speed.
* Dec 23, 1995 6.00 BP Added EDIT_FLAG_SHOW_SIZE.
* Dec 30, 1995 6.00 BP Added ODCALL for calling convention.
* Jan 01, 1996 6.00 BP BCC32 compatibility changes.
* Jan 01, 1996 6.00 BP Added new mulitline editor options.
* Jan 01, 1996 6.00 BP Added od_disable_dtr, DIS_DTR_DISABLE.
* Jan 03, 1996 6.00 BP Further BCC32 compatiblity changes.
* Jan 04, 1996 6.00 BP Added od_get_input() and related defs.
* Jan 07, 1996 6.00 BP Added OD_GLOBAL_CONV.
* Jan 19, 1996 6.00 BP Removed some unused stuff.
* Jan 19, 1996 6.00 BP Added od_internal_debug.
* Jan 23, 1996 6.00 BP Added od_exiting and ERR_UNSUPPORTED.
* Jan 30, 1996 6.00 BP New extern "C" decl for od_control.
* Jan 30, 1996 6.00 BP Replaced od_yield() with od_sleep().
* Jan 31, 1996 6.00 BP Added DIS_NAME_PROMPT.
* Jan 31, 1996 6.00 BP Added tODMilliSec, OD_NO_TIMEOUT.
* Jan 31, 1996 6.00 BP Added timeout for od_get_input().
* Feb 02, 1996 6.00 BP Add RA 2.50-related od_control vars.
* Feb 03, 1996 6.00 BP Added more editor options.
* Feb 06, 1996 6.00 BP Added od_silent_mode.
* Feb 08, 1996 6.00 BP Added editor buffer grow option.
* Feb 13, 1996 6.00 BP Added od_get_input() flags parameter.
* Feb 14, 1996 6.00 BP Recognize Borland's __WIN32__ define.
* Feb 17, 1996 6.00 BP Added OD_KEY_F1 thru OD_KEY_F10.
* Feb 19, 1996 6.00 BP Changed version number to 6.00.
* Feb 27, 1996 6.00 BP Added od_max_key_latency.
* Mar 03, 1996 6.10 BP Begin version 6.10.
* Mar 03, 1996 6.10 BP Fixed OD_COMPONENT for medium mem mod.
* Mar 06, 1996 6.10 BP Added TRIBBS.SYS support.
* Mar 06, 1996 6.10 BP Added COM_DOOR32.
* Mar 11, 1996 6.10 BP Added OD_VERSION.
* Mar 13, 1996 6.10 BP Added od_get_cursor().
* Mar 13, 1996 6.10 BP Added od_local_win_col.
* Mar 14, 1996 6.10 BP Added od_config_callback.
* Mar 21, 1996 6.10 BP Added od_control_get().
* Apr 08, 1996 6.10 BP Added command-line parsing callbacks.
* Oct 19, 2001 6.20 RS Added door32.sys and socket support.
* Oct 19, 2001 6.21 RS Fixed socket disconnect bug.
*/
/* Only parse OpenDoor.h once. */
#ifndef _INC_OPENDOOR
#define _INC_OPENDOOR
/* ========================================================================= */
/* Version and platform definitions. */
/* ========================================================================= */
/* OpenDoors API version number. */
#define OD_VERSION 0x624
#define DIRSEP '\\'
#define DIRSEP_STR "\\"
/* OpenDoors target platform. */
#if defined(WIN32) || defined(__WIN32__) || defined(_WIN32)
#define ODPLAT_WIN32
#undef ODPLAT_DOS
#ifdef OD_WIN32_STATIC
#pragma message("Compiling for Win32 static version of OpenDoors")
#else /* !OD_WIN32_STATIC */
#pragma message("Compiling for Win32 DLL version of OpenDoors")
#define OD_DLL
#endif /* !OD_WIN32_STATIC */
#else /* !WIN32 */
#if defined(__unix__) || defined(__NetBSD__) || defined(__APPLE__)
#define ODPLAT_NIX
#undef ODPLAT_DOS
#undef DIRSEP
#define DIRSEP '/'
#undef DIRSEP_STR
#define DIRSEP_STR "/"
#else
#define ODPLAT_DOS
#undef ODPLAT_WIN32
#pragma message("Compiling for DOS version of OpenDoors")
#endif /* !NIX */
#endif /* !WIN32 */
/* Include any other headers required by OpenDoor.h. */
#ifdef ODPLAT_WIN32
#include "windows.h"
#endif /* ODPLAT_WIN32 */
/* For DLL versions, definitions of function or data that is exported from */
/* a module or imported into a module. */
#ifdef OD_DLL
#if defined(_MSC_VER) || defined(__BORLANDC__)
#define OD_EXPORT __declspec(dllexport)
#else /* !_MSC_VER || __BORLANDC__ */
#define OD_EXPORT _export
#endif /* !_MSC_VER */
#define OD_IMPORT DECLSPEC_IMPORT
#else /* !OD_DLL */
#define OD_EXPORT
#define OD_IMPORT
#endif /* !OD_DLL */
/* Definition of function naming convention used by OpenDoors. */
#ifdef __cplusplus
#define OD_NAMING_CONVENTION extern "C"
#else /* !__cplusplus */
#define OD_NAMING_CONVENTION
#endif /* !__cplusplus */
/* Definition of function calling convention used by OpenDoors. */
#ifdef ODPLAT_WIN32
#define ODCALL WINAPI
#define ODVCALL WINAPIV
#define OD_GLOBAL_CONV WINAPI
#else /* !ODPLAT_WIN32 */
#define ODCALL
#define ODVCALL
#define OD_GLOBAL_CONV
#endif /* !ODPLAT_WIN32 */
/* OpenDoors API function declaration type. */
#ifdef BUILDING_OPENDOORS
#define ODAPIDEF OD_NAMING_CONVENTION OD_EXPORT
#else /* !BUILDING_OPENDOORS */
#define ODAPIDEF OD_NAMING_CONVENTION OD_IMPORT
#endif /* !BUILDING_OPENDOORS */
/* OpenDoors API global variable definition and declaration types. */
#define OD_API_VAR_DEFN OD_NAMING_CONVENTION OD_EXPORT
#ifdef BUILDING_OPENDOORS
#define OD_API_VAR_DECL extern OD_EXPORT
#else /* !BUILDING_OPENDOORS */
#define OD_API_VAR_DECL extern OD_IMPORT
#endif /* !BUILDING_OPENDOORS */
/* Explicitly far pointers. */
#ifdef ODPLAT_DOS
#define ODFAR far
#else /* !ODPLAT_DOS */
#define ODFAR
#endif /* !ODPLAT_DOS */
/* ========================================================================= */
/* Primitive data types. */
/* ========================================================================= */
/* Portable types that are the same size across all platforms */
#ifndef ODPLAT_WIN32
#ifndef BYTE
typedef unsigned char BYTE; /* Unsigned, 8 bits. */
#endif
#ifndef WORD
typedef unsigned short WORD; /* Unsigned, 16 bits. */
#endif
#ifndef DWORD
typedef unsigned long DWORD; /* Unsigned, 32 bits. */
#endif
#ifndef CHAR
typedef char CHAR; /* Native character representation. */
#endif
#define DWORD_DEFINED
#define WORD_DEFINED
#endif /* !ODPLAT_WIN32 */
typedef signed char INT8; /* Signed, 8 bits. */
typedef signed short int INT16; /* Signed, 16 bits. */
#ifndef ODPLAT_WIN32 /* avoid type redefinition from basetsd.h */
typedef signed long int INT32; /* Signed, 32 bits. */
#endif
/* Types that vary in size depending on platform. These are guranteed to be */
/* at least the given size, but may be larger if this platform can */
/* represent a larger value more efficiently (or as efficiently). */
#ifndef ODPLAT_WIN32
typedef int INT; /* Integer, at least 16 bits. */
typedef unsigned int UINT; /* Unsigned integer, at least 16 bits. */
#ifndef BOOL
typedef char BOOL; /* Boolean value, at least 1 bit. */
#endif /* !BOOL */
#endif /* !ODPLAT_WIN32 */
/* TRUE and FALSE manifest constants, for use with BOOL data type. */
#ifndef FALSE
#define FALSE 0
#endif /* !FALSE */
#ifndef TRUE
#define TRUE 1
#endif /* !TRUE */
/* ========================================================================= */
/* OpenDoors complex data types and defines. */
/* ========================================================================= */
/* Millisecond time type. */
typedef DWORD tODMilliSec;
/* Special value tODMilliSec value for no timeouts. */
#ifdef ODPLAT_WIN32
#define OD_NO_TIMEOUT INFINITE
#else /* !ODPLAT_WIN32 */
#define OD_NO_TIMEOUT 0xffffffffL
#endif /* !ODPLAT_WIN32 */
/* Multi-line editor defintions. */
/* Editor text formats. */
typedef enum
{
FORMAT_PARAGRAPH_BREAKS
,FORMAT_LINE_BREAKS
,FORMAT_FTSC_MESSAGE
,FORMAT_NO_WORDWRAP
} tODEditTextFormat;
/* Menu callback function return values. */
typedef enum
{
EDIT_MENU_DO_NOTHING
,EDIT_MENU_EXIT_EDITOR
} tODEditMenuResult;
/* Editor flags. */
#define EFLAG_NORMAL 0x00000000
/* Optional multi-line editor settings. */
typedef struct
{
INT nAreaLeft;
INT nAreaTop;
INT nAreaRight;
INT nAreaBottom;
tODEditTextFormat TextFormat;
tODEditMenuResult (*pfMenuCallback)(void *pUnused);
void * (*pfBufferRealloc)(void *pOriginalBuffer, UINT unNewSize);
DWORD dwEditFlags;
char *pszFinalBuffer;
UINT unFinalBufferSize;
} tODEditOptions;
/* Editor return values. */
#define OD_MULTIEDIT_ERROR 0
#define OD_MULTIEDIT_SUCCESS 1
/* Input event information. */
/* Input event types. */
typedef enum
{
EVENT_CHARACTER
,EVENT_EXTENDED_KEY
} tODInputEventType;
/* Extended key codes. */
#define OD_KEY_F1 0x3b
#define OD_KEY_F2 0x3c
#define OD_KEY_F3 0x3d
#define OD_KEY_F4 0x3e
#define OD_KEY_F5 0x3f
#define OD_KEY_F6 0x40
#define OD_KEY_F7 0x41
#define OD_KEY_F8 0x42
#define OD_KEY_F9 0x43
#define OD_KEY_F10 0x44
#define OD_KEY_UP 0x48
#define OD_KEY_DOWN 0x50
#define OD_KEY_LEFT 0x4b
#define OD_KEY_RIGHT 0x4d
#define OD_KEY_INSERT 0x52
#define OD_KEY_DELETE 0x53
#define OD_KEY_HOME 0x47
#define OD_KEY_END 0x4f
#define OD_KEY_PGUP 0x49
#define OD_KEY_PGDN 0x51
#define OD_KEY_F11 0x85
#define OD_KEY_F12 0x86
#define OD_KEY_SHIFTTAB 0x0f
/* Input event structure. */
typedef struct
{
tODInputEventType EventType;
BOOL bFromRemote;
char chKeyPress;
} tODInputEvent;
/* Third option (in addition to TRUE and FALSE) for tri-state options. */
#define MAYBE 2
/* od_spawnvpe() flags. */
#define P_WAIT 0
#define P_NOWAIT 1
#define CURRENT 0
#define IRET 1
/* od_edit_str() flags. */
#define EDIT_FLAG_NORMAL 0x0000
#define EDIT_FLAG_NO_REDRAW 0x0001
#define EDIT_FLAG_FIELD_MODE 0x0002
#define EDIT_FLAG_EDIT_STRING 0x0004
#define EDIT_FLAG_STRICT_INPUT 0x0008
#define EDIT_FLAG_PASSWORD_MODE 0x0010
#define EDIT_FLAG_ALLOW_CANCEL 0x0020
#define EDIT_FLAG_FILL_STRING 0x0040
#define EDIT_FLAG_AUTO_ENTER 0x0080
#define EDIT_FLAG_AUTO_DELETE 0x0100
#define EDIT_FLAG_KEEP_BLANK 0x0200
#define EDIT_FLAG_PERMALITERAL 0x0400
#define EDIT_FLAG_LEAVE_BLANK 0x0800
#define EDIT_FLAG_SHOW_SIZE 0x1000
/* od_edit_str() return values. */
#define EDIT_RETURN_ERROR 0
#define EDIT_RETURN_CANCEL 1
#define EDIT_RETURN_ACCEPT 2
#define EDIT_RETURN_PREVIOUS 3
#define EDIT_RETURN_NEXT 4
/* od_popup_menu() flag values. */
#define MENU_NORMAL 0x0000
#define MENU_ALLOW_CANCEL 0x0001
#define MENU_PULLDOWN 0x0002
#define MENU_KEEP 0x0004
#define MENU_DESTROY 0x0008
/* od_autodetect() flag values. */
#define DETECT_NORMAL 0x0000
/* od_scroll() flags. */
#define SCROLL_NORMAL 0x0000
#define SCROLL_NO_CLEAR 0x0001
/* OpenDoors status line settings */
#define STATUS_NORMAL 0
#define STATUS_NONE 8
#define STATUS_ALTERNATE_1 1
#define STATUS_ALTERNATE_2 2
#define STATUS_ALTERNATE_3 3
#define STATUS_ALTERNATE_4 4
#define STATUS_ALTERNATE_5 5
#define STATUS_ALTERNATE_6 6
#define STATUS_ALTERNATE_7 7
/* OpenDoors color definitions. */
#define D_BLACK 0
#define D_BLUE 1
#define D_GREEN 2
#define D_CYAN 3
#define D_RED 4
#define D_MAGENTA 5
#define D_BROWN 6
#define D_GREY 7
#define L_BLACK 8
#define L_BLUE 9
#define L_GREEN 10
#define L_CYAN 11
#define L_RED 12
#define L_MAGENTA 13
#define L_YELLOW 14
#define L_WHITE 15
#define B_BLACK L_BLACK
#define B_BLUE L_BLUE
#define B_GREEN L_GREEN
#define B_CYAN L_CYAN
#define B_RED L_RED
#define B_MAGENTA L_MAGENTA
#define B_BROWN L_YELLOW
#define B_GREY L_WHITE
/* Door information file formats (od_control.od_info_type). */
#define DORINFO1 0 /* DORINFO?.DEF */
#define EXITINFO 1 /* QBBS 2.6? EXITINFO.BBS & DORINFO?.DEF */
#define RA1EXITINFO 2 /* RA 1.?? EXITINFO.BBS & DORINFO?.DEF */
#define CHAINTXT 3 /* CHAIN.TXT */
#define SFDOORSDAT 4 /* SFDOORS.DAT */
#define CALLINFO 5 /* CALLINFO.BBS */
#define DOORSYS_GAP 6 /* GAP/PC-Board DOOR.SYS */
#define DOORSYS_DRWY 7 /* DoorWay DOOR.SYS */
#define QBBS275EXITINFO 8 /* QuickBBS 2.75+ EXITINFO.BBS */
#define CUSTOM 9 /* User-defined custom format */
#define DOORSYS_WILDCAT 10 /* WildCat! DOOR.SYS */
#define RA2EXITINFO 11 /* RA 2.00+ EXITINFO.BBS */
#define TRIBBSSYS 12 /* TRIBBS.SYS */
#define DOOR32SYS 13 /* DOOR32.SYS */
#define NO_DOOR_FILE 100 /* No door information file was found */
/* Error type (od_control.od_error). */
#define ERR_NONE 0 /* No error yet */
#define ERR_MEMORY 1 /* Unable to allocate enough memory */
#define ERR_NOGRAPHICS 2 /* Function requires ANSI/AVATAR/RIP mode */
#define ERR_PARAMETER 3 /* Invalid value was passed to a function */
#define ERR_FILEOPEN 4 /* Unable to open file */
#define ERR_LIMIT 5 /* An internal limit has been exceeded */
#define ERR_FILEREAD 6 /* Unable to read from file */
#define ERR_NOREMOTE 7 /* Function may not be called in local mode */
#define ERR_GENERALFAILURE 8 /* Percise cause of failure is unknown */
#define ERR_NOTHINGWAITING 9 /* A request for data when none was ready */
#define ERR_NOMATCH 10 /* No match was found */
#define ERR_UNSUPPORTED 11 /* Not supported in this version */
/* od_control.od_errorlevel indicies. */
#define ERRORLEVEL_ENABLE 0
#define ERRORLEVEL_CRITICAL 1
#define ERRORLEVEL_NOCARRIER 2
#define ERRORLEVEL_HANGUP 3
#define ERRORLEVEL_TIMEOUT 4
#define ERRORLEVEL_INACTIVITY 5
#define ERRORLEVEL_DROPTOBBS 6
#define ERRORLEVEL_NORMAL 7
/* Special od_popup_menu() return values. */
#define POPUP_ERROR -1
#define POPUP_ESCAPE 0
#define POPUP_LEFT -2
#define POPUP_RIGHT -3
/* od_get_input() flags. */
#define GETIN_NORMAL 0x0000
#define GETIN_RAW 0x0001
#define GETIN_RAWCTRL 0x0002
/* od_control.od_box_chars array indicies. */
#define BOX_UPPERLEFT 0
#define BOX_TOP 1
#define BOX_UPPERRIGHT 2
#define BOX_LEFT 3
#define BOX_LOWERLEFT 4
#define BOX_LOWERRIGHT 5
#define BOX_BOTTOM 6
#define BOX_RIGHT 7
/* od_control.od_okaytopage settings. */
#define PAGE_DISABLE 0
#define PAGE_ENABLE 1
#define PAGE_USE_HOURS 2
/* Method used for serial I/O (od_control.od_com_method). */
#define COM_FOSSIL 1
#define COM_INTERNAL 2
#define COM_WIN32 3
#define COM_DOOR32 4
#define COM_SOCKET 5
#define COM_STDIO 6
/* Flow control method (od_control.od_com_flow_control). */
#define COM_DEFAULT_FLOW 0
#define COM_RTSCTS_FLOW 1
#define COM_NO_FLOW 2
/* Optional component initialization functions. */
ODAPIDEF void ODCALL ODConfigInit(void);
ODAPIDEF void ODCALL ODLogEnable(void);
ODAPIDEF void ODCALL ODMPSEnable(void);
/* Optional OpenDoors component settings. */
typedef void(ODFAR OD_COMPONENT)(void);
#define INCLUDE_CONFIG_FILE (OD_COMPONENT *)ODConfigInit
#define NO_CONFIG_FILE NULL
#define INCLUDE_LOGFILE (OD_COMPONENT *)ODLogEnable
#define NO_LOGFILE NULL
#define INCLUDE_MPS (OD_COMPONENT *)ODMPSEnable
#define NO_MPS NULL
/* Built-in personality defintion functions. */
ODAPIDEF void ODCALL pdef_opendoors(BYTE btOperation);
ODAPIDEF void ODCALL pdef_pcboard(BYTE btOperation);
ODAPIDEF void ODCALL pdef_ra(BYTE btOperation);
ODAPIDEF void ODCALL pdef_wildcat(BYTE btOperation);
/* Personality proc type. */
typedef void(ODFAR OD_PERSONALITY_PROC)(BYTE);
/* Personality identifiers. */
#define PER_OPENDOORS (void *)pdef_opendoors
#define PER_PCBOARD (void *)pdef_pcboard
#define PER_RA (void *)pdef_ra
#define PER_WILDCAT (void *)pdef_wildcat
/* od_control.od_disable flags. */
#define DIS_INFOFILE 0x0001
#define DIS_CARRIERDETECT 0x0002
#define DIS_TIMEOUT 0x0004
#define DIS_LOCAL_OVERRIDE 0x0008
#define DIS_BPS_SETTING 0x0010
#define DIS_LOCAL_INPUT 0x0020
#define DIS_SYSOP_KEYS 0x0040
#define DIS_DTR_DISABLE 0x0080
#define DIS_NAME_PROMPT 0x0100
/* Event status settings. */
#define ES_DELETED 0
#define ES_ENABLED 1
#define ES_DISABLED 2
/* Personality proceedure operations. */
#define PEROP_DISPLAY1 0
#define PEROP_DISPLAY2 1
#define PEROP_DISPLAY3 2
#define PEROP_DISPLAY4 3
#define PEROP_DISPLAY5 4
#define PEROP_DISPLAY6 5
#define PEROP_DISPLAY7 6
#define PEROP_DISPLAY8 7
#define PEROP_UPDATE1 10
#define PEROP_UPDATE2 11
#define PEROP_UPDATE3 12
#define PEROP_UPDATE4 13
#define PEROP_UPDATE5 14
#define PEROP_UPDATE6 15
#define PEROP_UPDATE7 16
#define PEROP_UPDATE8 17
#define PEROP_INITIALIZE 20
#define PEROP_CUSTOMKEY 21
#define PEROP_DEINITIALIZE 22
/* ========================================================================= */
/* The OpenDoors control structure (od_control) */
/* ========================================================================= */
/* Force byte alignment, if possible */
#ifdef __TURBOC__
#if(__TURBOC__ >= 0x295)
#pragma option -a-
#endif /* __TURBOC__ >= 0x295 */
#endif /* __TURBOC__ */
#ifdef _MSC_VER
#pragma pack(1)
#endif /* _MSC_VER */
typedef struct
{
/* Location or name of door information file (if one is to be used). */
char info_path[60];
/* Serial port settings. */
DWORD baud;
DWORD od_connect_speed;
INT16 od_com_address;
BYTE od_com_irq;
BYTE od_com_method;
BYTE od_com_flow_control;
WORD od_com_rx_buf;
WORD od_com_tx_buf;
BYTE od_com_fifo_trigger;
BOOL od_com_no_fifo;
BOOL od_no_fossil;
BOOL od_use_socket;
INT16 port;
DWORD od_open_handle;
/* Caller and system information. */
char system_name[40];
char sysop_name[40];
INT32 system_calls;
char system_last_caller[36];
char timelog_start_date[9];
INT16 timelog_busyperhour[24];
INT16 timelog_busyperday[7];
char user_name[36];
char user_location[26];
char user_password[16];
char user_dataphone[16];
char user_homephone[16];
char user_lasttime[6];
char user_lastdate[9];
BYTE user_attribute;
BYTE user_flags[4];
DWORD user_net_credit;
DWORD user_pending;
WORD user_messages;
DWORD user_lastread;
WORD user_security;
DWORD user_numcalls;
DWORD user_uploads;
DWORD user_downloads;
DWORD user_upk;
DWORD user_downk;
DWORD user_todayk;
WORD user_time_used;
WORD user_screen_length;
BYTE user_last_pwdchange;
BYTE user_attrib2;
WORD user_group;
BYTE event_status;
char event_starttime[6];
BYTE event_errorlevel;
BYTE event_days;
BYTE event_force;
char event_last_run[9];
BYTE user_netmailentered;
BYTE user_echomailentered;
char user_logintime[6];
char user_logindate[9];
INT16 user_timelimit;
INT32 user_loginsec;
INT32 user_credit;
WORD user_num;
INT16 user_readthru;
INT16 user_numpages;
INT16 user_downlimit;
char user_timeofcreation[6];
char user_logonpassword[16];
BYTE user_wantchat;
BYTE user_ansi;
INT16 user_deducted_time;
char user_menustack[50][9];
BYTE user_menustackpointer;
char user_handle[36];
char user_comment[81];
char user_firstcall[9];
BYTE user_combinedrecord[200];
char user_birthday[9];
char user_subdate[9];
BYTE user_screenwidth;
BYTE user_language;
BYTE user_date_format;
char user_forward_to[36];
BYTE user_error_free;
BYTE sysop_next;
BYTE user_emsi_session;
char user_emsi_crtdef[41];
char user_emsi_protocols[41];
char user_emsi_capabilities[41];
char user_emsi_requests[41];
char user_emsi_software[41];
BYTE user_hold_attr1;
BYTE user_hold_attr2;
BYTE user_hold_len;
char user_reasonforchat[78];
char user_callsign[12];
WORD user_msg_area;
WORD user_file_area;
char user_protocol;
WORD user_file_group;
BYTE user_last_birthday_check;
char user_sex;
DWORD user_xi_record;
WORD user_msg_group;
BYTE user_avatar;
char user_org[51];
char user_address[3][51];
INT32 user_pwd_crc;
INT32 user_logon_pwd_crc;
char user_last_cost_menu[9];
WORD user_menu_cost;
BYTE user_rip;
BYTE user_rip_ver;
BYTE user_attrib3;
BOOL user_expert;
char system_last_handle[36];
/* Door information file statistics. */
BYTE od_info_type;
BYTE od_extended_info;
WORD od_node;
BYTE od_ra_info;
/* Current program settings. */
BOOL od_always_clear;
BOOL od_force_local;
BOOL od_chat_active;
BOOL od_current_statusline;
INT16 od_error;
BYTE od_last_input;
BOOL od_logfile_disable;
char od_logfile_name[80];
WORD od_maxtime;
INT16 od_maxtime_deduction;
BOOL od_okaytopage;
INT16 od_pagestartmin;
INT16 od_pageendmin;
BOOL od_page_pausing;
INT16 od_page_statusline;
BOOL od_user_keyboard_on;
BOOL od_update_status_now;
INT16 od_cur_attrib;
/* OpenDoors customization settings. */
char od_box_chars[8];
char od_cfg_text[48][33];
char od_cfg_lines[25][33];
OD_COMPONENT *od_config_file;
const char * od_config_filename;
void (*od_config_function)(char *keyword, char *options);
char od_color_char;
char od_color_delimiter;
char od_color_names[12][33];
BOOL od_clear_on_exit;
void (*od_cmd_line_handler)(char *pszKeyword, char *pszOptions);
void (*od_cmd_line_help_func)(void);
void (*od_default_personality)(BYTE operation);
BOOL od_default_rip_win;
WORD od_disable;
char od_disable_dtr[40];
BOOL od_disable_inactivity;
BOOL od_emu_simulate_modem;
BYTE od_errorlevel[8];
BOOL od_full_color;
BOOL od_full_put;
WORD od_in_buf_size;
INT16 od_inactivity;
INT16 od_inactive_warning;
BOOL od_internal_debug;
tODMilliSec od_max_key_latency;
char od_list_pause;
char od_list_stop;
OD_COMPONENT *od_logfile;
char *od_logfile_messages[14];
OD_COMPONENT *od_mps;
BOOL od_nocopyright;
BOOL od_noexit;
BOOL od_no_ra_codes;
BYTE od_page_len;
char od_prog_copyright[40];
char od_prog_name[40];
char od_prog_version[40];
DWORD od_reg_key;
char od_reg_name[36];
BOOL od_silent_mode;
BOOL od_status_on;
BOOL od_spawn_freeze_time;
BOOL od_swapping_disable;
BOOL od_swapping_noems;
char od_swapping_path[80];
/* Custom function hooks. */
void (*od_no_file_func)(void);
void (*od_before_exit)(void);
void (*od_cbefore_chat)(void);
void (*od_cafter_chat)(void);
void (*od_cbefore_shell)(void);
void (*od_cafter_shell)(void);
void (*od_config_callback)(void);
void (*od_help_callback)(void);
void (*od_ker_exec)(void);
void (*od_local_input)(INT16 key);
void (*od_time_msg_func)(char *string);
/* OpenDoors function key customizations. */
WORD key_chat;
WORD key_dosshell;
WORD key_drop2bbs;
WORD key_hangup;
WORD key_keyboardoff;
WORD key_lesstime;
WORD key_lockout;
WORD key_moretime;
WORD key_status[9];
WORD key_sysopnext;
/* Additional function keys. */
BYTE od_num_keys;
INT16 od_hot_key[16];
INT16 od_last_hot;
void (*od_hot_function[16])(void);
/* OpenDoors prompt customizations. */
char * od_after_chat;
char * od_after_shell;
char * od_before_chat;
char * od_before_shell;
char * od_chat_reason;
char * od_continue;
char od_continue_yes;
char od_continue_no;
char od_continue_nonstop;
char * od_day[7];
char * od_hanging_up;
char * od_exiting;
char * od_help_text;
char * od_help_text2;
char * od_inactivity_timeout;
char * od_inactivity_warning;
char * od_month[12];
char * od_no_keyboard;
char * od_no_sysop;
char * od_no_response;
char * od_no_time;
char * od_offline;
char * od_paging;
char * od_press_key;
char * od_sending_rip;
char * od_status_line[3];
char * od_sysop_next;
char * od_time_left;
char * od_time_warning;
char * od_want_chat;
char * od_cmd_line_help;
/* OpenDoors color customizations. */
BYTE od_chat_color1;
BYTE od_chat_color2;
BYTE od_list_comment_col;
BYTE od_list_name_col;
BYTE od_list_offline_col;
BYTE od_list_size_col;
BYTE od_list_title_col;
BYTE od_local_win_col;
BYTE od_continue_col;
BYTE od_menu_title_col;
BYTE od_menu_border_col;
BYTE od_menu_text_col;
BYTE od_menu_key_col;
BYTE od_menu_highlight_col;
BYTE od_menu_highkey_col;
/* Platform-specific settings. */
#ifdef ODPLAT_WIN32
HICON od_app_icon;
int od_cmd_show;
#endif /* ODPLAT_WIN32 */
} tODControl;
/* Restore original structure alignment, if possible. */
#ifdef _MSC_VER
#pragma pack()
#endif /* _MSC_VER */
/* The od_control external variable. */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
OD_API_VAR_DECL tODControl
#ifndef _WIN32 /* warning C4229: anachronism used : modifiers on data are ignored */
OD_GLOBAL_CONV
#endif
od_control;
#ifdef __cplusplus
}
#endif /* __cplusplus */
/* ========================================================================= */
/* OpenDoors API function prototypes. */
/* ========================================================================= */
/* Programs interface with OpenDoors by calling any of the OpenDoors API
* functions. A summary of these functions appears below, followed by the
* function definition prototypes. Full information on these functions is
* provided by the OpenDoors manual. Functions denoted (ANS/AVT) require ANSI
* or AVATAR display modes to be active.
*
* OUTPUT FUNCTIONS - TEXT DISPLAY
* od_printf() - Performs formatted output, with color settings
* od_disp_str() - Displays a normal, nul-terminated string.
* od_disp() - Sends chars to modem, with/without local echo
* od_disp_emu() - Displays a string, translating ANSI/AVT codes
* od_repeat() - Efficiently displays a character repeatedly
* od_putch() - Displays a single character.
*
* OUTPUT FUNCTIONS - COLOUR AND CURSOR CONTROL
* od_set_color() - Sets color according to fore/background values
* od_set_attrib() - Sets color to specified IBM-PC attribute
* od_set_cursor() - Positions cursor on screen (ANS/AVT)
* od_get_cursor() - Estimates the current cursor position on screen
*
* OUTPUT FUNCTIONS - SCREEN MANIPULATION
* od_clr_scr() - Clears the screen
* od_save_screen() - Saves the contents of entire screen
* od_restore_screen() - Restores the contents of entire screen
*
* OUTPUT FUNCTIONS - BLOCK MANIPULATION
* od_clr_line() - Clears the remainder of the current line
* od_gettext() - Gets the contents a block of screen (ANS/AVT)
* od_puttext() - Displays block stored by gettext() (ANS/AVT)
* od_scroll() - Scrolls a portion of the screen (ANS/AVT)
*
* OUTPUT FUNCTIONS - WINDOWS & MENUS
* od_draw_box() - Draws a box on the screen (ANS/AVT)
* od_window_create() - Creates a window, storing underlying (ANS/AVT)
* od_window_remove() - Removes window, restoring underlying (ANS/AVT)
* od_popup_menu() - Displays popup menu with "light" bar (ANS/AVT)
*
* OUTPUT FUNCTIONS - FILE DISPLAY
* od_send_file() - Displays an ASCII/ANSI/AVATAR/RIP file
* od_hotkey_menu() - Displays ASC/ANS/AVATAR/RIP menu, with hotkeys
* od_list_files() - Lists files avail for download using FILES.BBS
*
* INPUT FUNCTIONS
* od_get_answer() - Inputs a key, allowing only specified responses
* od_get_key() - Inputs a key, optionally waiting for next key
* od_get_input() - Obtains next input, with translation
* od_input_str() - Inputs string of specified length from keyboard
* od_edit_str() - Fancy formatted string input function (ANS/AVT)
* od_clear_keybuffer() - Removes any waiting keys in keyboard buffer
* od_multiline_edit() - Edits text that spans multiple lines (ANS/AVT)
* od_key_pending() - Returns TRUE if a key is waiting to be processed
*
* COMMON DOOR ACTIVITY FUNCTIONS
* od_page() - Allows user to page sysop
* od_spawn() - Suspends OpenDoors & starts another program
* od_spawnvpe() - Like od_spawn, but with more options
* od_log_write() - Writes a logfile entry
* od_parse_cmd_line() - Handles standard command-line parameters
*
* SPECIAL CONTROL FUNCTIONS
* od_init() - Forces OpenDoors initialization
* od_color_config() - Translates color description to color value
* od_add_personality() - Adds another local interface personality
* od_set_statusline() - Sets the current status line setting
* od_autodetect() - Determines the remote system terminal type
* od_kernel() - Call when not calling other functions
* od_exit() - Ends OpenDoors program
* od_carrier() - Indicates whether remote connection is present
* od_set_dtr() - Raises / lowers the DTR signal to the modem
* od_chat() - Manually starts chat mode
* od_sleep() - Yield to other processes
* od_control_get() - Returns a pointer to the od_control structure.
*/
ODAPIDEF BOOL ODCALL od_add_personality(const char *pszName, BYTE btOutputTop,
BYTE btOutputBottom,
OD_PERSONALITY_PROC *pfPerFunc);
ODAPIDEF void ODCALL od_autodetect(INT nFlags);
ODAPIDEF BOOL ODCALL od_carrier(void);
ODAPIDEF void ODCALL od_chat(void);
ODAPIDEF void ODCALL od_clear_keybuffer(void);
ODAPIDEF void ODCALL od_clr_line(void);
ODAPIDEF void ODCALL od_clr_scr(void);
ODAPIDEF BYTE ODCALL od_color_config(char *pszColorDesc);
ODAPIDEF tODControl * ODCALL od_control_get(void);
ODAPIDEF void ODCALL od_disp(const char *pachBuffer, INT nSize, BOOL bLocalEcho);
ODAPIDEF void ODCALL od_disp_emu(const char *pszToDisplay, BOOL bRemoteEcho);
ODAPIDEF void ODCALL od_disp_str(const char *pszToDisplay);
ODAPIDEF BOOL ODCALL od_draw_box(BYTE btLeft, BYTE btTop, BYTE btRight,
BYTE btBottom);
ODAPIDEF WORD ODCALL od_edit_str(char *pszInput, char *pszFormat, INT nRow,
INT nColumn, BYTE btNormalColour,
BYTE btHighlightColour, char chBlank,
WORD nFlags);
ODAPIDEF void ODCALL od_exit(INT nErrorLevel, BOOL bTermCall);
ODAPIDEF char ODCALL od_get_answer(const char *pszOptions);
ODAPIDEF void ODCALL od_get_cursor(INT *pnRow, INT *pnColumn);
ODAPIDEF BOOL ODCALL od_get_input(tODInputEvent *pInputEvent,
tODMilliSec TimeToWait, WORD wFlags);
ODAPIDEF BOOL ODCALL od_key_pending(void);
ODAPIDEF char ODCALL od_get_key(BOOL bWait);
ODAPIDEF BOOL ODCALL od_gettext(INT nLeft, INT nTop, INT nRight,
INT nBottom, void *pBlock);
ODAPIDEF char ODCALL od_hotkey_menu(char *pszFileName, char *pszHotKeys,
BOOL bWait);
ODAPIDEF void ODCALL od_init(void);
ODAPIDEF void ODCALL od_input_str(char *pszInput, INT nMaxLength,
unsigned char chMin, unsigned char chMax);
ODAPIDEF void ODCALL od_kernel(void);
ODAPIDEF BOOL ODCALL od_list_files(char *pszFileSpec);
ODAPIDEF BOOL ODCALL od_log_write(char *pszMessage);
ODAPIDEF INT ODCALL od_multiline_edit(char *pszBufferToEdit,
UINT unBufferSize, tODEditOptions *pEditOptions);
ODAPIDEF void ODCALL od_page(void);
#ifdef ODPLAT_WIN32
ODAPIDEF void ODCALL od_parse_cmd_line(LPSTR pszCmdLine);
#else /* !ODPLAT_WIN32 */
ODAPIDEF void ODCALL od_parse_cmd_line(INT nArgCount,
char *papszArguments[]);
#endif /* !ODPLAT_WIN32 */
ODAPIDEF INT ODCALL od_popup_menu(char *pszTitle, char *pszText,
INT nLeft, INT nTop, INT nLevel, WORD uFlags);
ODAPIDEF void ODVCALL od_printf(const char *pszFormat, ...);
ODAPIDEF void ODCALL od_putch(char chToDisplay);