summary refs log tree commit diff stats
path: root/lib/wrappers/pdcurses.nim
blob: f014c5e9c9e7d7c5719ec9f1081e719a79533c6c (plain) (blame)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
{.deadCodeElim: on.}

discard """

curses.h:
#ifdef C2NIM
#dynlib pdcursesdll
#skipinclude
#prefix PDC_
#def FALSE
#def TRUE
#def NULL
#def bool unsigned char
#def chtype unsigned long
#def cchar_t unsigned long
#def attr_t unsigned long
#def mmask_t unsigned long
#def wchar_t char
#def PDCEX
#cdecl
#endif

pdcwin.h:
#ifdef C2NIM
#dynlib pdcursesdll
#skipinclude
#prefix pdc_
#prefix PDC_
#stdcall
#endif
"""

when defined(windows):
  import windows
  
  const
    pdcursesdll = "pdcurses.dll"
    unixOS = false
  {.pragma: extdecl, stdcall.}

when not defined(windows):
  const
    unixOS = true
  {.pragma: extdecl, cdecl.}

type
  cunsignedchar = char
  cunsignedlong = uint32

const 
  BUILD* = 3401
  PDCURSES* = 1               # PDCurses-only routines 
  XOPEN* = 1                  # X/Open Curses routines 
  SYSVcurses* = 1             # System V Curses routines 
  BSDcurses* = 1              # BSD Curses routines 
  CHTYPE_LONG* = 1            # size of chtype; long 
  ERR* = (- 1)
  OK* = 0
  BUTTON_RELEASED* = 0x00000000
  BUTTON_PRESSED* = 0x00000001
  BUTTON_CLICKED* = 0x00000002
  BUTTON_DOUBLE_CLICKED* = 0x00000003
  BUTTON_TRIPLE_CLICKED* = 0x00000004
  BUTTON_MOVED* = 0x00000005  # PDCurses 
  WHEEL_SCROLLED* = 0x00000006 # PDCurses 
  BUTTON_ACTION_MASK* = 0x00000007 # PDCurses 
  BUTTON_MODIFIER_MASK* = 0x00000038 # PDCurses 
  MOUSE_MOVED* = 0x00000008
  MOUSE_POSITION* = 0x00000010
  MOUSE_WHEEL_UP* = 0x00000020
  MOUSE_WHEEL_DOWN* = 0x00000040
  BUTTON1_RELEASED* = 0x00000001
  BUTTON1_PRESSED* = 0x00000002
  BUTTON1_CLICKED* = 0x00000004
  BUTTON1_DOUBLE_CLICKED* = 0x00000008
  BUTTON1_TRIPLE_CLICKED* = 0x00000010
  BUTTON1_MOVED* = 0x00000010 # PDCurses 
  BUTTON2_RELEASED* = 0x00000020
  BUTTON2_PRESSED* = 0x00000040
  BUTTON2_CLICKED* = 0x00000080
  BUTTON2_DOUBLE_CLICKED* = 0x00000100
  BUTTON2_TRIPLE_CLICKED* = 0x00000200
  BUTTON2_MOVED* = 0x00000200 # PDCurses 
  BUTTON3_RELEASED* = 0x00000400
  BUTTON3_PRESSED* = 0x00000800
  BUTTON3_CLICKED* = 0x00001000
  BUTTON3_DOUBLE_CLICKED* = 0x00002000
  BUTTON3_TRIPLE_CLICKED* = 0x00004000
  BUTTON3_MOVED* = 0x00004000 # PDCurses 
  BUTTON4_RELEASED* = 0x00008000
  BUTTON4_PRESSED* = 0x00010000
  BUTTON4_CLICKED* = 0x00020000
  BUTTON4_DOUBLE_CLICKED* = 0x00040000
  BUTTON4_TRIPLE_CLICKED* = 0x00080000
  BUTTON5_RELEASED* = 0x00100000
  BUTTON5_PRESSED* = 0x00200000
  BUTTON5_CLICKED* = 0x00400000
  BUTTON5_DOUBLE_CLICKED* = 0x00800000
  BUTTON5_TRIPLE_CLICKED* = 0x01000000
  MOUSE_WHEEL_SCROLL* = 0x02000000 # PDCurses 
  BUTTON_MODIFIER_SHIFT* = 0x04000000 # PDCurses 
  BUTTON_MODIFIER_CONTROL* = 0x08000000 # PDCurses 
  BUTTON_MODIFIER_ALT* = 0x10000000 # PDCurses 
  ALL_MOUSE_EVENTS* = 0x1FFFFFFF
  REPORT_MOUSE_POSITION* = 0x20000000
  A_NORMAL* = 0
  A_ALTCHARSET* = 0x00010000
  A_RIGHTLINE* = 0x00020000
  A_LEFTLINE* = 0x00040000
  A_INVIS* = 0x00080000
  A_UNDERLINE* = 0x00100000
  A_REVERSE* = 0x00200000
  A_BLINK* = 0x00400000
  A_BOLD* = 0x00800000
  A_ATTRIBUTES* = 0xFFFF0000
  A_CHARTEXT* = 0x0000FFFF
  A_COLOR* = 0xFF000000
  A_ITALIC* = A_INVIS
  A_PROTECT* = (A_UNDERLINE or A_LEFTLINE or A_RIGHTLINE)
  ATTR_SHIFT* = 19
  COLOR_SHIFT* = 24
  A_STANDOUT* = (A_REVERSE or A_BOLD) # X/Open 
  A_DIM* = A_NORMAL
  CHR_MSK* = A_CHARTEXT       # Obsolete 
  ATR_MSK* = A_ATTRIBUTES     # Obsolete 
  ATR_NRM* = A_NORMAL         # Obsolete 
  WA_ALTCHARSET* = A_ALTCHARSET
  WA_BLINK* = A_BLINK
  WA_BOLD* = A_BOLD
  WA_DIM* = A_DIM
  WA_INVIS* = A_INVIS
  WA_LEFT* = A_LEFTLINE
  WA_PROTECT* = A_PROTECT
  WA_REVERSE* = A_REVERSE
  WA_RIGHT* = A_RIGHTLINE
  WA_STANDOUT* = A_STANDOUT
  WA_UNDERLINE* = A_UNDERLINE
  WA_HORIZONTAL* = A_NORMAL
  WA_LOW* = A_NORMAL
  WA_TOP* = A_NORMAL
  WA_VERTICAL* = A_NORMAL
  COLOR_BLACK* = 0
  COLOR_RED* = 1
  COLOR_GREEN* = 2
  COLOR_BLUE* = 4
  COLOR_CYAN* = (COLOR_BLUE or COLOR_GREEN)
  COLOR_MAGENTA* = (COLOR_RED or COLOR_BLUE)
  COLOR_YELLOW* = (COLOR_RED or COLOR_GREEN)
  COLOR_WHITE* = 7
  KEY_CODE_YES* = 0x00000100  # If get_wch() gives a key code 
  KEY_BREAK* = 0x00000101     # Not on PC KBD 
  KEY_DOWN* = 0x00000102      # Down arrow key 
  KEY_UP* = 0x00000103        # Up arrow key 
  KEY_LEFT* = 0x00000104      # Left arrow key 
  KEY_RIGHT* = 0x00000105     # Right arrow key 
  KEY_HOME* = 0x00000106      # home key 
  KEY_BACKSPACE* = 0x00000107 # not on pc 
  KEY_F0* = 0x00000108        # function keys; 64 reserved 
  KEY_DL* = 0x00000148        # delete line 
  KEY_IL* = 0x00000149        # insert line 
  KEY_DC* = 0x0000014A        # delete character 
  KEY_IC* = 0x0000014B        # insert char or enter ins mode 
  KEY_EIC* = 0x0000014C       # exit insert char mode 
  KEY_CLEAR* = 0x0000014D     # clear screen 
  KEY_EOS* = 0x0000014E       # clear to end of screen 
  KEY_EOL* = 0x0000014F       # clear to end of line 
  KEY_SF* = 0x00000150        # scroll 1 line forward 
  KEY_SR* = 0x00000151        # scroll 1 line back (reverse) 
  KEY_NPAGE* = 0x00000152     # next page 
  KEY_PPAGE* = 0x00000153     # previous page 
  KEY_STAB* = 0x00000154      # set tab 
  KEY_CTAB* = 0x00000155      # clear tab 
  KEY_CATAB* = 0x00000156     # clear all tabs 
  KEY_ENTER* = 0x00000157     # enter or send (unreliable) 
  KEY_SRESET* = 0x00000158    # soft/reset (partial/unreliable) 
  KEY_RESET* = 0x00000159     # reset/hard reset (unreliable) 
  KEY_PRINT* = 0x0000015A     # print/copy 
  KEY_LL* = 0x0000015B        # home down/bottom (lower left) 
  KEY_ABORT* = 0x0000015C     # abort/terminate key (any) 
  KEY_SHELP* = 0x0000015D     # short help 
  KEY_LHELP* = 0x0000015E     # long help 
  KEY_BTAB* = 0x0000015F      # Back tab key 
  KEY_BEG* = 0x00000160       # beg(inning) key 
  KEY_CANCEL* = 0x00000161    # cancel key 
  KEY_CLOSE* = 0x00000162     # close key 
  KEY_COMMAND* = 0x00000163   # cmd (command) key 
  KEY_COPY* = 0x00000164      # copy key 
  KEY_CREATE* = 0x00000165    # create key 
  KEY_END* = 0x00000166       # end key 
  KEY_EXIT* = 0x00000167      # exit key 
  KEY_FIND* = 0x00000168      # find key 
  KEY_HELP* = 0x00000169      # help key 
  KEY_MARK* = 0x0000016A      # mark key 
  KEY_MESSAGE* = 0x0000016B   # message key 
  KEY_MOVE* = 0x0000016C      # move key 
  KEY_NEXT* = 0x0000016D      # next object key 
  KEY_OPEN* = 0x0000016E      # open key 
  KEY_OPTIONS* = 0x0000016F   # options key 
  KEY_PREVIOUS* = 0x00000170  # previous object key 
  KEY_REDO* = 0x00000171      # redo key 
  KEY_REFERENCE* = 0x00000172 # ref(erence) key 
  KEY_REFRESH* = 0x00000173   # refresh key 
  KEY_REPLACE* = 0x00000174   # replace key 
  KEY_RESTART* = 0x00000175   # restart key 
  KEY_RESUME* = 0x00000176    # resume key 
  KEY_SAVE* = 0x00000177      # save key 
  KEY_SBEG* = 0x00000178      # shifted beginning key 
  KEY_SCANCEL* = 0x00000179   # shifted cancel key 
  KEY_SCOMMAND* = 0x0000017A  # shifted command key 
  KEY_SCOPY* = 0x0000017B     # shifted copy key 
  KEY_SCREATE* = 0x0000017C   # shifted create key 
  KEY_SDC* = 0x0000017D       # shifted delete char key 
  KEY_SDL* = 0x0000017E       # shifted delete line key 
  KEY_SELECT* = 0x0000017F    # select key 
  KEY_SEND* = 0x00000180      # shifted end key 
  KEY_SEOL* = 0x00000181      # shifted clear line key 
  KEY_SEXIT* = 0x00000182     # shifted exit key 
  KEY_SFIND* = 0x00000183     # shifted find key 
  KEY_SHOME* = 0x00000184     # shifted home key 
  KEY_SIC* = 0x00000185       # shifted input key 
  KEY_SLEFT* = 0x00000187     # shifted left arrow key 
  KEY_SMESSAGE* = 0x00000188  # shifted message key 
  KEY_SMOVE* = 0x00000189     # shifted move key 
  KEY_SNEXT* = 0x0000018A     # shifted next key 
  KEY_SOPTIONS* = 0x0000018B  # shifted options key 
  KEY_SPREVIOUS* = 0x0000018C # shifted prev key 
  KEY_SPRINT* = 0x0000018D    # shifted print key 
  KEY_SREDO* = 0x0000018E     # shifted redo key 
  KEY_SREPLACE* = 0x0000018F  # shifted replace key 
  KEY_SRIGHT* = 0x00000190    # shifted right arrow 
  KEY_SRSUME* = 0x00000191    # shifted resume key 
  KEY_SSAVE* = 0x00000192     # shifted save key 
  KEY_SSUSPEND* = 0x00000193  # shifted suspend key 
  KEY_SUNDO* = 0x00000194     # shifted undo key 
  KEY_SUSPEND* = 0x00000195   # suspend key 
  KEY_UNDO* = 0x00000196      # undo key 
  ALT_0* = 0x00000197
  ALT_1* = 0x00000198
  ALT_2* = 0x00000199
  ALT_3* = 0x0000019A
  ALT_4* = 0x0000019B
  ALT_5* = 0x0000019C
  ALT_6* = 0x0000019D
  ALT_7* = 0x0000019E
  ALT_8* = 0x0000019F
  ALT_9* = 0x000001A0
  ALT_A* = 0x000001A1
  ALT_B* = 0x000001A2
  ALT_C* = 0x000001A3
  ALT_D* = 0x000001A4
  ALT_E* = 0x000001A5
  ALT_F* = 0x000001A6
  ALT_G* = 0x000001A7
  ALT_H* = 0x000001A8
  ALT_I* = 0x000001A9
  ALT_J* = 0x000001AA
  ALT_K* = 0x000001AB
  ALT_L* = 0x000001AC
  ALT_M* = 0x000001AD
  ALT_N* = 0x000001AE
  ALT_O* = 0x000001AF
  ALT_P* = 0x000001B0
  ALT_Q* = 0x000001B1
  ALT_R* = 0x000001B2
  ALT_S* = 0x000001B3
  ALT_T* = 0x000001B4
  ALT_U* = 0x000001B5
  ALT_V* = 0x000001B6
  ALT_W* = 0x000001B7
  ALT_X* = 0x000001B8
  ALT_Y* = 0x000001B9
  ALT_Z* = 0x000001BA
  CTL_LEFT* = 0x000001BB      # Control-Left-Arrow 
  CTL_RIGHT* = 0x000001BC
  CTL_PGUP* = 0x000001BD
  CTL_PGDN* = 0x000001BE
  CTL_HOME* = 0x000001BF
  CTL_END* = 0x000001C0
  KEY_A1* = 0x000001C1        # upper left on Virtual keypad 
  KEY_A2* = 0x000001C2        # upper middle on Virt. keypad 
  KEY_A3* = 0x000001C3        # upper right on Vir. keypad 
  KEY_B1* = 0x000001C4        # middle left on Virt. keypad 
  KEY_B2* = 0x000001C5        # center on Virt. keypad 
  KEY_B3* = 0x000001C6        # middle right on Vir. keypad 
  KEY_C1* = 0x000001C7        # lower left on Virt. keypad 
  KEY_C2* = 0x000001C8        # lower middle on Virt. keypad 
  KEY_C3* = 0x000001C9        # lower right on Vir. keypad 
  PADSLASH* = 0x000001CA      # slash on keypad 
  PADENTER* = 0x000001CB      # enter on keypad 
  CTL_PADENTER* = 0x000001CC  # ctl-enter on keypad 
  ALT_PADENTER* = 0x000001CD  # alt-enter on keypad 
  PADSTOP* = 0x000001CE       # stop on keypad 
  PADSTAR* = 0x000001CF       # star on keypad 
  PADMINUS* = 0x000001D0      # minus on keypad 
  PADPLUS* = 0x000001D1       # plus on keypad 
  CTL_PADSTOP* = 0x000001D2   # ctl-stop on keypad 
  CTL_PADCENTER* = 0x000001D3 # ctl-enter on keypad 
  CTL_PADPLUS* = 0x000001D4   # ctl-plus on keypad 
  CTL_PADMINUS* = 0x000001D5  # ctl-minus on keypad 
  CTL_PADSLASH* = 0x000001D6  # ctl-slash on keypad 
  CTL_PADSTAR* = 0x000001D7   # ctl-star on keypad 
  ALT_PADPLUS* = 0x000001D8   # alt-plus on keypad 
  ALT_PADMINUS* = 0x000001D9  # alt-minus on keypad 
  ALT_PADSLASH* = 0x000001DA  # alt-slash on keypad 
  ALT_PADSTAR* = 0x000001DB   # alt-star on keypad 
  ALT_PADSTOP* = 0x000001DC   # alt-stop on keypad 
  CTL_INS* = 0x000001DD       # ctl-insert 
  ALT_DEL* = 0x000001DE       # alt-delete 
  ALT_INS* = 0x000001DF       # alt-insert 
  CTL_UP* = 0x000001E0        # ctl-up arrow 
  CTL_DOWN* = 0x000001E1      # ctl-down arrow 
  CTL_TAB* = 0x000001E2       # ctl-tab 
  ALT_TAB* = 0x000001E3
  ALT_MINUS* = 0x000001E4
  ALT_EQUAL* = 0x000001E5
  ALT_HOME* = 0x000001E6
  ALT_PGUP* = 0x000001E7
  ALT_PGDN* = 0x000001E8
  ALT_END* = 0x000001E9
  ALT_UP* = 0x000001EA        # alt-up arrow 
  ALT_DOWN* = 0x000001EB      # alt-down arrow 
  ALT_RIGHT* = 0x000001EC     # alt-right arrow 
  ALT_LEFT* = 0x000001ED      # alt-left arrow 
  ALT_ENTER* = 0x000001EE     # alt-enter 
  ALT_ESC* = 0x000001EF       # alt-escape 
  ALT_BQUOTE* = 0x000001F0    # alt-back quote 
  ALT_LBRACKET* = 0x000001F1  # alt-left bracket 
  ALT_RBRACKET* = 0x000001F2  # alt-right bracket 
  ALT_SEMICOLON* = 0x000001F3 # alt-semi-colon 
  ALT_FQUOTE* = 0x000001F4    # alt-forward quote 
  ALT_COMMA* = 0x000001F5     # alt-comma 
  ALT_STOP* = 0x000001F6      # alt-stop 
  ALT_FSLASH* = 0x000001F7    # alt-forward slash 
  ALT_BKSP* = 0x000001F8      # alt-backspace 
  CTL_BKSP* = 0x000001F9      # ctl-backspace 
  PAD0* = 0x000001FA          # keypad 0 
  CTL_PAD0* = 0x000001FB      # ctl-keypad 0 
  CTL_PAD1* = 0x000001FC
  CTL_PAD2* = 0x000001FD
  CTL_PAD3* = 0x000001FE
  CTL_PAD4* = 0x000001FF
  CTL_PAD5* = 0x00000200
  CTL_PAD6* = 0x00000201
  CTL_PAD7* = 0x00000202
  CTL_PAD8* = 0x00000203
  CTL_PAD9* = 0x00000204
  ALT_PAD0* = 0x00000205      # alt-keypad 0 
  ALT_PAD1* = 0x00000206
  ALT_PAD2* = 0x00000207
  ALT_PAD3* = 0x00000208
  ALT_PAD4* = 0x00000209
  ALT_PAD5* = 0x0000020A
  ALT_PAD6* = 0x0000020B
  ALT_PAD7* = 0x0000020C
  ALT_PAD8* = 0x0000020D
  ALT_PAD9* = 0x0000020E
  CTL_DEL* = 0x0000020F       # clt-delete 
  ALT_BSLASH* = 0x00000210    # alt-back slash 
  CTL_ENTER* = 0x00000211     # ctl-enter 
  SHF_PADENTER* = 0x00000212  # shift-enter on keypad 
  SHF_PADSLASH* = 0x00000213  # shift-slash on keypad 
  SHF_PADSTAR* = 0x00000214   # shift-star  on keypad 
  SHF_PADPLUS* = 0x00000215   # shift-plus  on keypad 
  SHF_PADMINUS* = 0x00000216  # shift-minus on keypad 
  SHF_UP* = 0x00000217        # shift-up on keypad 
  SHF_DOWN* = 0x00000218      # shift-down on keypad 
  SHF_IC* = 0x00000219        # shift-insert on keypad 
  SHF_DC* = 0x0000021A        # shift-delete on keypad 
  KEY_MOUSE* = 0x0000021B     # "mouse" key 
  KEY_SHIFT_L* = 0x0000021C   # Left-shift 
  KEY_SHIFT_R* = 0x0000021D   # Right-shift 
  KEY_CONTROL_L* = 0x0000021E # Left-control 
  KEY_CONTROL_R* = 0x0000021F # Right-control 
  KEY_ALT_L* = 0x00000220     # Left-alt 
  KEY_ALT_R* = 0x00000221     # Right-alt 
  KEY_RESIZE* = 0x00000222    # Window resize 
  KEY_SUP* = 0x00000223       # Shifted up arrow 
  KEY_SDOWN* = 0x00000224     # Shifted down arrow 
  KEY_MIN* = KEY_BREAK        # Minimum curses key value 
  KEY_MAX* = KEY_SDOWN        # Maximum curses key 
  CLIP_SUCCESS* = 0
  CLIP_ACCESS_ERROR* = 1
  CLIP_EMPTY* = 2
  CLIP_MEMORY_ERROR* = 3
  KEY_MODIFIER_SHIFT* = 1
  KEY_MODIFIER_CONTROL* = 2
  KEY_MODIFIER_ALT* = 4
  KEY_MODIFIER_NUMLOCK* = 8

when appType == "gui":
  const
    BUTTON_SHIFT* = BUTTON_MODIFIER_SHIFT
    BUTTON_CONTROL* = BUTTON_MODIFIER_CONTROL
    BUTTON_CTRL* = BUTTON_MODIFIER_CONTROL
    BUTTON_ALT* = BUTTON_MODIFIER_ALT
else:
  const 
    BUTTON_SHIFT* = 0x00000008
    BUTTON_CONTROL* = 0x00000010
    BUTTON_ALT* = 0x00000020

type 
  TMOUSE_STATUS*{.pure, final.} = object 
    x*: cint                  # absolute column, 0 based, measured in characters 
    y*: cint                  # absolute row, 0 based, measured in characters 
    button*: array[0..3 - 1, cshort] # state of each button 
    changes*: cint            # flags indicating what has changed with the mouse 
  
  TMEVENT*{.pure, final.} = object 
    id*: cshort               # unused, always 0 
    x*: cint
    y*: cint
    z*: cint                  # x, y same as MOUSE_STATUS; z unused 
    bstate*: cunsignedlong    # equivalent to changes + button[], but
                              #                           in the same format as used for mousemask() 
  
  TWINDOW*{.pure, final.} = object 
    cury*: cint              # current pseudo-cursor 
    curx*: cint
    maxy*: cint              # max window coordinates 
    maxx*: cint
    begy*: cint              # origin on screen 
    begx*: cint
    flags*: cint             # window properties 
    attrs*: cunsignedlong    # standard attributes and colors 
    bkgd*: cunsignedlong     # background, normally blank 
    clear*: cunsignedchar    # causes clear at next refresh 
    leaveit*: cunsignedchar  # leaves cursor where it is 
    scroll*: cunsignedchar   # allows window scrolling 
    nodelay*: cunsignedchar  # input character wait flag 
    immed*: cunsignedchar    # immediate update flag 
    sync*: cunsignedchar     # synchronise window ancestors 
    use_keypad*: cunsignedchar # flags keypad key mode active 
    y*: ptr ptr cunsignedlong # pointer to line pointer array 
    firstch*: ptr cint       # first changed character in line 
    lastch*: ptr cint        # last changed character in line 
    tmarg*: cint             # top of scrolling region 
    bmarg*: cint             # bottom of scrolling region 
    delayms*: cint           # milliseconds of delay for getch() 
    parx*: cint
    pary*: cint              # coords relative to parent (0,0) 
    parent*: ptr TWINDOW        # subwin's pointer to parent win 
  
  TPANELOBS*{.pure, final.} = object 
    above*: ptr TPANELOBS
    pan*: ptr TPANEL

  TPANEL*{.pure, final.} = object 
    win*: ptr TWINDOW
    wstarty*: cint
    wendy*: cint
    wstartx*: cint
    wendx*: cint
    below*: ptr TPANEL
    above*: ptr TPANEL
    user*: pointer
    obscure*: ptr TPANELOBS

when unixOS:
  type
    TSCREEN*{.pure, final.} = object 
      alive*: cunsignedchar     # if initscr() called, and not endwin() 
      autocr*: cunsignedchar    # if cr -> lf 
      cbreak*: cunsignedchar    # if terminal unbuffered 
      echo*: cunsignedchar      # if terminal echo 
      raw_inp*: cunsignedchar   # raw input mode (v. cooked input) 
      raw_out*: cunsignedchar   # raw output mode (7 v. 8 bits) 
      audible*: cunsignedchar   # FALSE if the bell is visual 
      mono*: cunsignedchar      # TRUE if current screen is mono 
      resized*: cunsignedchar   # TRUE if TERM has been resized 
      orig_attr*: cunsignedchar # TRUE if we have the original colors 
      orig_fore*: cshort        # original screen foreground color 
      orig_back*: cshort        # original screen foreground color 
      cursrow*: cint            # position of physical cursor 
      curscol*: cint            # position of physical cursor 
      visibility*: cint         # visibility of cursor 
      orig_cursor*: cint        # original cursor size 
      lines*: cint              # new value for LINES 
      cols*: cint               # new value for COLS 
      trap_mbe*: cunsignedlong # trap these mouse button events 
      map_mbe_to_key*: cunsignedlong # map mouse buttons to slk 
      mouse_wait*: cint # time to wait (in ms) for a button release after a press
      slklines*: cint           # lines in use by slk_init() 
      slk_winptr*: ptr TWINDOW   # window for slk 
      linesrippedoff*: cint     # lines ripped off via ripoffline() 
      linesrippedoffontop*: cint # lines ripped off on top via ripoffline() 
      delaytenths*: cint        # 1/10ths second to wait block getch() for 
      preserve*: cunsignedchar # TRUE if screen background to be preserved 
      restore*: cint           # specifies if screen background to be restored, and how 
      save_key_modifiers*: cunsignedchar # TRUE if each key modifiers saved with each key press 
      return_key_modifiers*: cunsignedchar # TRUE if modifier keys are returned as "real" keys 
      key_code*: cunsignedchar # TRUE if last key is a special key;
      XcurscrSize*: cint        # size of Xcurscr shared memory block 
      sb_on*: cunsignedchar
      sb_viewport_y*: cint
      sb_viewport_x*: cint
      sb_total_y*: cint
      sb_total_x*: cint
      sb_cur_y*: cint
      sb_cur_x*: cint
      line_color*: cshort       # color of line attributes - default -1 
else:
  type
    TSCREEN*{.pure, final.} = object 
      alive*: cunsignedchar     # if initscr() called, and not endwin() 
      autocr*: cunsignedchar    # if cr -> lf 
      cbreak*: cunsignedchar    # if terminal unbuffered 
      echo*: cunsignedchar      # if terminal echo 
      raw_inp*: cunsignedchar   # raw input mode (v. cooked input) 
      raw_out*: cunsignedchar   # raw output mode (7 v. 8 bits) 
      audible*: cunsignedchar   # FALSE if the bell is visual 
      mono*: cunsignedchar      # TRUE if current screen is mono 
      resized*: cunsignedchar   # TRUE if TERM has been resized 
      orig_attr*: cunsignedchar # TRUE if we have the original colors 
      orig_fore*: cshort        # original screen foreground color 
      orig_back*: cshort        # original screen foreground color 
      cursrow*: cint            # position of physical cursor 
      curscol*: cint            # position of physical cursor 
      visibility*: cint         # visibility of cursor 
      orig_cursor*: cint        # original cursor size 
      lines*: cint              # new value for LINES 
      cols*: cint               # new value for COLS 
      trap_mbe*: cunsignedlong # trap these mouse button events 
      map_mbe_to_key*: cunsignedlong # map mouse buttons to slk 
      mouse_wait*: cint # time to wait (in ms) for a button release after a press
      slklines*: cint           # lines in use by slk_init() 
      slk_winptr*: ptr TWINDOW   # window for slk 
      linesrippedoff*: cint     # lines ripped off via ripoffline() 
      linesrippedoffontop*: cint # lines ripped off on top via ripoffline() 
      delaytenths*: cint        # 1/10ths second to wait block getch() for 
      preserve*: cunsignedchar # TRUE if screen background to be preserved 
      restore*: cint           # specifies if screen background to be restored, and how 
      save_key_modifiers*: cunsignedchar # TRUE if each key modifiers saved with each key press 
      return_key_modifiers*: cunsignedchar # TRUE if modifier keys are returned as "real" keys 
      key_code*: cunsignedchar # TRUE if last key is a special key;
      line_color*: cshort       # color of line attributes - default -1 

var
  LINES*{.importc: "LINES", dynlib: pdcursesdll.}: cint
  COLS*{.importc: "COLS", dynlib: pdcursesdll.}: cint
  stdscr*{.importc: "stdscr", dynlib: pdcursesdll.}: ptr TWINDOW
  curscr*{.importc: "curscr", dynlib: pdcursesdll.}: ptr TWINDOW
  SP*{.importc: "SP", dynlib: pdcursesdll.}: ptr TSCREEN
  Mouse_status*{.importc: "Mouse_status", dynlib: pdcursesdll.}: TMOUSE_STATUS
  COLORS*{.importc: "COLORS", dynlib: pdcursesdll.}: cint
  COLOR_PAIRS*{.importc: "COLOR_PAIRS", dynlib: pdcursesdll.}: cint
  TABSIZE*{.importc: "TABSIZE", dynlib: pdcursesdll.}: cint
  acs_map*{.importc: "acs_map", dynlib: pdcursesdll.}: ptr cunsignedlong
  ttytype*{.importc: "ttytype", dynlib: pdcursesdll.}: cstring

template BUTTON_CHANGED*(x: expr): expr = 
  (Mouse_status.changes and (1 shl ((x) - 1)))

template BUTTON_STATUS*(x: expr): expr = 
  (Mouse_status.button[(x) - 1])

template ACS_PICK*(w, n: expr): expr = 
  (cast[int32](w) or A_ALTCHARSET)

template KEY_F*(n: expr): expr = 
  (KEY_F0 + (n))

template COLOR_PAIR*(n: expr): expr = 
  ((cast[cunsignedlong]((n)) shl COLOR_SHIFT) and A_COLOR)

template PAIR_NUMBER*(n: expr): expr = 
  (((n) and A_COLOR) shr COLOR_SHIFT)

const
  #MOUSE_X_POS* = (Mouse_status.x)
  #MOUSE_Y_POS* = (Mouse_status.y)
  #A_BUTTON_CHANGED* = (Mouse_status.changes and 7)
  #MOUSE_MOVED* = (Mouse_status.changes and MOUSE_MOVED)
  #MOUSE_POS_REPORT* = (Mouse_status.changes and MOUSE_POSITION)
  #MOUSE_WHEEL_UP* = (Mouse_status.changes and MOUSE_WHEEL_UP)
  #MOUSE_WHEEL_DOWN* = (Mouse_status.changes and MOUSE_WHEEL_DOWN)
  ACS_ULCORNER* = ACS_PICK('l', '+')
  ACS_LLCORNER* = ACS_PICK('m', '+')
  ACS_URCORNER* = ACS_PICK('k', '+')
  ACS_LRCORNER* = ACS_PICK('j', '+')
  ACS_RTEE* = ACS_PICK('u', '+')
  ACS_LTEE* = ACS_PICK('t', '+')
  ACS_BTEE* = ACS_PICK('v', '+')
  ACS_TTEE* = ACS_PICK('w', '+')
  ACS_HLINE* = ACS_PICK('q', '-')
  ACS_VLINE* = ACS_PICK('x', '|')
  ACS_PLUS* = ACS_PICK('n', '+')
  ACS_S1* = ACS_PICK('o', '-')
  ACS_S9* = ACS_PICK('s', '_')
  ACS_DIAMOND* = ACS_PICK('`', '+')
  ACS_CKBOARD* = ACS_PICK('a', ':')
  ACS_DEGREE* = ACS_PICK('f', '\'')
  ACS_PLMINUS* = ACS_PICK('g', '#')
  ACS_BULLET* = ACS_PICK('~', 'o')
  ACS_LARROW* = ACS_PICK(',', '<')
  ACS_RARROW* = ACS_PICK('+', '>')
  ACS_DARROW* = ACS_PICK('.', 'v')
  ACS_UARROW* = ACS_PICK('-', '^')
  ACS_BOARD* = ACS_PICK('h', '#')
  ACS_LANTERN* = ACS_PICK('i', '*')
  ACS_BLOCK* = ACS_PICK('0', '#')
  ACS_S3* = ACS_PICK('p', '-')
  ACS_S7* = ACS_PICK('r', '-')
  ACS_LEQUAL* = ACS_PICK('y', '<')
  ACS_GEQUAL* = ACS_PICK('z', '>')
  ACS_PI* = ACS_PICK('{', 'n')
  ACS_NEQUAL* = ACS_PICK('|', '+')
  ACS_STERLING* = ACS_PICK('}', 'L')
  ACS_BSSB* = ACS_ULCORNER
  ACS_SSBB* = ACS_LLCORNER
  ACS_BBSS* = ACS_URCORNER
  ACS_SBBS* = ACS_LRCORNER
  ACS_SBSS* = ACS_RTEE
  ACS_SSSB* = ACS_LTEE
  ACS_SSBS* = ACS_BTEE
  ACS_BSSS* = ACS_TTEE
  ACS_BSBS* = ACS_HLINE
  ACS_SBSB* = ACS_VLINE
  ACS_SSSS* = ACS_PLUS
discard """WACS_ULCORNER* = (addr((acs_map['l'])))
  WACS_LLCORNER* = (addr((acs_map['m'])))
  WACS_URCORNER* = (addr((acs_map['k'])))
  WACS_LRCORNER* = (addr((acs_map['j'])))
  WACS_RTEE* = (addr((acs_map['u'])))
  WACS_LTEE* = (addr((acs_map['t'])))
  WACS_BTEE* = (addr((acs_map['v'])))
  WACS_TTEE* = (addr((acs_map['w'])))
  WACS_HLINE* = (addr((acs_map['q'])))
  WACS_VLINE* = (addr((acs_map['x'])))
  WACS_PLUS* = (addr((acs_map['n'])))
  WACS_S1* = (addr((acs_map['o'])))
  WACS_S9* = (addr((acs_map['s'])))
  WACS_DIAMOND* = (addr((acs_map['`'])))
  WACS_CKBOARD* = (addr((acs_map['a'])))
  WACS_DEGREE* = (addr((acs_map['f'])))
  WACS_PLMINUS* = (addr((acs_map['g'])))
  WACS_BULLET* = (addr((acs_map['~'])))
  WACS_LARROW* = (addr((acs_map[','])))
  WACS_RARROW* = (addr((acs_map['+'])))
  WACS_DARROW* = (addr((acs_map['.'])))
  WACS_UARROW* = (addr((acs_map['-'])))
  WACS_BOARD* = (addr((acs_map['h'])))
  WACS_LANTERN* = (addr((acs_map['i'])))
  WACS_BLOCK* = (addr((acs_map['0'])))
  WACS_S3* = (addr((acs_map['p'])))
  WACS_S7* = (addr((acs_map['r'])))
  WACS_LEQUAL* = (addr((acs_map['y'])))
  WACS_GEQUAL* = (addr((acs_map['z'])))
  WACS_PI* = (addr((acs_map['{'])))
  WACS_NEQUAL* = (addr((acs_map['|'])))
  WACS_STERLING* = (addr((acs_map['}'])))
  WACS_BSSB* = WACS_ULCORNER
  WACS_SSBB* = WACS_LLCORNER
  WACS_BBSS* = WACS_URCORNER
  WACS_SBBS* = WACS_LRCORNER
  WACS_SBSS* = WACS_RTEE
  WACS_SSSB* = WACS_LTEE
  WACS_SSBS* = WACS_BTEE
  WACS_BSSS* = WACS_TTEE
  WACS_BSBS* = WACS_HLINE
  WACS_SBSB* = WACS_VLINE
  WACS_SSSS* = WACS_PLUS"""

proc addch*(a2: cunsignedlong): cint{.extdecl, importc: "addch", 
                                      dynlib: pdcursesdll.}
proc addchnstr*(a2: ptr cunsignedlong; a3: cint): cint{.extdecl, 
    importc: "addchnstr", dynlib: pdcursesdll.}
proc addchstr*(a2: ptr cunsignedlong): cint{.extdecl, importc: "addchstr", 
    dynlib: pdcursesdll.}
proc addnstr*(a2: cstring; a3: cint): cint{.extdecl, importc: "addnstr", 
    dynlib: pdcursesdll.}
proc addstr*(a2: cstring): cint{.extdecl, importc: "addstr", dynlib: pdcursesdll.}
proc attroff*(a2: cunsignedlong): cint{.extdecl, importc: "attroff", 
                                        dynlib: pdcursesdll.}
proc attron*(a2: cunsignedlong): cint{.extdecl, importc: "attron", 
                                       dynlib: pdcursesdll.}
proc attrset*(a2: cunsignedlong): cint{.extdecl, importc: "attrset", 
                                        dynlib: pdcursesdll.}
proc attr_get*(a2: ptr cunsignedlong; a3: ptr cshort; a4: pointer): cint{.extdecl, 
    importc: "attr_get", dynlib: pdcursesdll.}
proc attr_off*(a2: cunsignedlong; a3: pointer): cint{.extdecl, 
    importc: "attr_off", dynlib: pdcursesdll.}
proc attr_on*(a2: cunsignedlong; a3: pointer): cint{.extdecl, importc: "attr_on", 
    dynlib: pdcursesdll.}
proc attr_set*(a2: cunsignedlong; a3: cshort; a4: pointer): cint{.extdecl, 
    importc: "attr_set", dynlib: pdcursesdll.}
proc baudrate*(): cint{.extdecl, importc: "baudrate", dynlib: pdcursesdll.}
proc beep*(): cint{.extdecl, importc: "beep", dynlib: pdcursesdll.}
proc bkgd*(a2: cunsignedlong): cint{.extdecl, importc: "bkgd", dynlib: pdcursesdll.}
proc bkgdset*(a2: cunsignedlong){.extdecl, importc: "bkgdset", dynlib: pdcursesdll.}
proc border*(a2: cunsignedlong; a3: cunsignedlong; a4: cunsignedlong; 
             a5: cunsignedlong; a6: cunsignedlong; a7: cunsignedlong; 
             a8: cunsignedlong; a9: cunsignedlong): cint{.extdecl, 
    importc: "border", dynlib: pdcursesdll.}
proc box*(a2: ptr TWINDOW; a3: cunsignedlong; a4: cunsignedlong): cint{.extdecl, 
    importc: "box", dynlib: pdcursesdll.}
proc can_change_color*(): cunsignedchar{.extdecl, importc: "can_change_color", 
    dynlib: pdcursesdll.}
proc cbreak*(): cint{.extdecl, importc: "cbreak", dynlib: pdcursesdll.}
proc chgat*(a2: cint; a3: cunsignedlong; a4: cshort; a5: pointer): cint{.extdecl, 
    importc: "chgat", dynlib: pdcursesdll.}
proc clearok*(a2: ptr TWINDOW; a3: cunsignedchar): cint{.extdecl, 
    importc: "clearok", dynlib: pdcursesdll.}
proc clear*(): cint{.extdecl, importc: "clear", dynlib: pdcursesdll.}
proc clrtobot*(): cint{.extdecl, importc: "clrtobot", dynlib: pdcursesdll.}
proc clrtoeol*(): cint{.extdecl, importc: "clrtoeol", dynlib: pdcursesdll.}
proc color_content*(a2: cshort; a3: ptr cshort; a4: ptr cshort; a5: ptr cshort): cint{.
    extdecl, importc: "color_content", dynlib: pdcursesdll.}
proc color_set*(a2: cshort; a3: pointer): cint{.extdecl, importc: "color_set", 
    dynlib: pdcursesdll.}
proc copywin*(a2: ptr TWINDOW; a3: ptr TWINDOW; a4: cint; a5: cint; a6: cint; 
              a7: cint; a8: cint; a9: cint; a10: cint): cint{.extdecl, 
    importc: "copywin", dynlib: pdcursesdll.}
proc curs_set*(a2: cint): cint{.extdecl, importc: "curs_set", dynlib: pdcursesdll.}
proc def_prog_mode*(): cint{.extdecl, importc: "def_prog_mode", 
                             dynlib: pdcursesdll.}
proc def_shell_mode*(): cint{.extdecl, importc: "def_shell_mode", 
                              dynlib: pdcursesdll.}
proc delay_output*(a2: cint): cint{.extdecl, importc: "delay_output", 
                                    dynlib: pdcursesdll.}
proc delch*(): cint{.extdecl, importc: "delch", dynlib: pdcursesdll.}
proc deleteln*(): cint{.extdecl, importc: "deleteln", dynlib: pdcursesdll.}
proc delscreen*(a2: ptr TSCREEN){.extdecl, importc: "delscreen", 
                                 dynlib: pdcursesdll.}
proc delwin*(a2: ptr TWINDOW): cint{.extdecl, importc: "delwin", 
                                    dynlib: pdcursesdll.}
proc derwin*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cint; a6: cint): ptr TWINDOW{.
    extdecl, importc: "derwin", dynlib: pdcursesdll.}
proc doupdate*(): cint{.extdecl, importc: "doupdate", dynlib: pdcursesdll.}
proc dupwin*(a2: ptr TWINDOW): ptr TWINDOW{.extdecl, importc: "dupwin", 
    dynlib: pdcursesdll.}
proc echochar*(a2: cunsignedlong): cint{.extdecl, importc: "echochar", 
    dynlib: pdcursesdll.}
proc echo*(): cint{.extdecl, importc: "echo", dynlib: pdcursesdll.}
proc endwin*(): cint{.extdecl, importc: "endwin", dynlib: pdcursesdll.}
proc erasechar*(): char{.extdecl, importc: "erasechar", dynlib: pdcursesdll.}
proc erase*(): cint{.extdecl, importc: "erase", dynlib: pdcursesdll.}
proc filter*(){.extdecl, importc: "filter", dynlib: pdcursesdll.}
proc flash*(): cint{.extdecl, importc: "flash", dynlib: pdcursesdll.}
proc flushinp*(): cint{.extdecl, importc: "flushinp", dynlib: pdcursesdll.}
proc getbkgd*(a2: ptr TWINDOW): cunsignedlong{.extdecl, importc: "getbkgd", 
    dynlib: pdcursesdll.}
proc getnstr*(a2: cstring; a3: cint): cint{.extdecl, importc: "getnstr", 
    dynlib: pdcursesdll.}
proc getstr*(a2: cstring): cint{.extdecl, importc: "getstr", dynlib: pdcursesdll.}
proc getwin*(a2: TFile): ptr TWINDOW{.extdecl, importc: "getwin", 
                                        dynlib: pdcursesdll.}
proc halfdelay*(a2: cint): cint{.extdecl, importc: "halfdelay", 
                                 dynlib: pdcursesdll.}
proc has_colors*(): cunsignedchar{.extdecl, importc: "has_colors", 
                                   dynlib: pdcursesdll.}
proc has_ic*(): cunsignedchar{.extdecl, importc: "has_ic", dynlib: pdcursesdll.}
proc has_il*(): cunsignedchar{.extdecl, importc: "has_il", dynlib: pdcursesdll.}
proc hline*(a2: cunsignedlong; a3: cint): cint{.extdecl, importc: "hline", 
    dynlib: pdcursesdll.}
proc idcok*(a2: ptr TWINDOW; a3: cunsignedchar){.extdecl, importc: "idcok", 
    dynlib: pdcursesdll.}
proc idlok*(a2: ptr TWINDOW; a3: cunsignedchar): cint{.extdecl, importc: "idlok", 
    dynlib: pdcursesdll.}
proc immedok*(a2: ptr TWINDOW; a3: cunsignedchar){.extdecl, importc: "immedok", 
    dynlib: pdcursesdll.}
proc inchnstr*(a2: ptr cunsignedlong; a3: cint): cint{.extdecl, 
    importc: "inchnstr", dynlib: pdcursesdll.}
proc inchstr*(a2: ptr cunsignedlong): cint{.extdecl, importc: "inchstr", 
    dynlib: pdcursesdll.}
proc inch*(): cunsignedlong{.extdecl, importc: "inch", dynlib: pdcursesdll.}
proc init_color*(a2: cshort; a3: cshort; a4: cshort; a5: cshort): cint{.extdecl, 
    importc: "init_color", dynlib: pdcursesdll.}
proc init_pair*(a2: cshort; a3: cshort; a4: cshort): cint{.extdecl, 
    importc: "init_pair", dynlib: pdcursesdll.}
proc initscr*(): ptr TWINDOW{.extdecl, importc: "initscr", dynlib: pdcursesdll.}
proc innstr*(a2: cstring; a3: cint): cint{.extdecl, importc: "innstr", 
    dynlib: pdcursesdll.}
proc insch*(a2: cunsignedlong): cint{.extdecl, importc: "insch", 
                                      dynlib: pdcursesdll.}
proc insdelln*(a2: cint): cint{.extdecl, importc: "insdelln", dynlib: pdcursesdll.}
proc insertln*(): cint{.extdecl, importc: "insertln", dynlib: pdcursesdll.}
proc insnstr*(a2: cstring; a3: cint): cint{.extdecl, importc: "insnstr", 
    dynlib: pdcursesdll.}
proc insstr*(a2: cstring): cint{.extdecl, importc: "insstr", dynlib: pdcursesdll.}
proc instr*(a2: cstring): cint{.extdecl, importc: "instr", dynlib: pdcursesdll.}
proc intrflush*(a2: ptr TWINDOW; a3: cunsignedchar): cint{.extdecl, 
    importc: "intrflush", dynlib: pdcursesdll.}
proc isendwin*(): cunsignedchar{.extdecl, importc: "isendwin", dynlib: pdcursesdll.}
proc is_linetouched*(a2: ptr TWINDOW; a3: cint): cunsignedchar{.extdecl, 
    importc: "is_linetouched", dynlib: pdcursesdll.}
proc is_wintouched*(a2: ptr TWINDOW): cunsignedchar{.extdecl, 
    importc: "is_wintouched", dynlib: pdcursesdll.}
proc keyname*(a2: cint): cstring{.extdecl, importc: "keyname", dynlib: pdcursesdll.}
proc keypad*(a2: ptr TWINDOW; a3: cunsignedchar): cint{.extdecl, importc: "keypad", 
    dynlib: pdcursesdll.}
proc killchar*(): char{.extdecl, importc: "killchar", dynlib: pdcursesdll.}
proc leaveok*(a2: ptr TWINDOW; a3: cunsignedchar): cint{.extdecl, 
    importc: "leaveok", dynlib: pdcursesdll.}
proc longname*(): cstring{.extdecl, importc: "longname", dynlib: pdcursesdll.}
proc meta*(a2: ptr TWINDOW; a3: cunsignedchar): cint{.extdecl, importc: "meta", 
    dynlib: pdcursesdll.}
proc move*(a2: cint; a3: cint): cint{.extdecl, importc: "move", 
                                      dynlib: pdcursesdll.}
proc mvaddch*(a2: cint; a3: cint; a4: cunsignedlong): cint{.extdecl, 
    importc: "mvaddch", dynlib: pdcursesdll.}
proc mvaddchnstr*(a2: cint; a3: cint; a4: ptr cunsignedlong; a5: cint): cint{.
    extdecl, importc: "mvaddchnstr", dynlib: pdcursesdll.}
proc mvaddchstr*(a2: cint; a3: cint; a4: ptr cunsignedlong): cint{.extdecl, 
    importc: "mvaddchstr", dynlib: pdcursesdll.}
proc mvaddnstr*(a2: cint; a3: cint; a4: cstring; a5: cint): cint{.extdecl, 
    importc: "mvaddnstr", dynlib: pdcursesdll.}
proc mvaddstr*(a2: cint; a3: cint; a4: cstring): cint{.extdecl, 
    importc: "mvaddstr", dynlib: pdcursesdll.}
proc mvchgat*(a2: cint; a3: cint; a4: cint; a5: cunsignedlong; a6: cshort; 
              a7: pointer): cint{.extdecl, importc: "mvchgat", dynlib: pdcursesdll.}
proc mvcur*(a2: cint; a3: cint; a4: cint; a5: cint): cint{.extdecl, 
    importc: "mvcur", dynlib: pdcursesdll.}
proc mvdelch*(a2: cint; a3: cint): cint{.extdecl, importc: "mvdelch", 
    dynlib: pdcursesdll.}
proc mvderwin*(a2: ptr TWINDOW; a3: cint; a4: cint): cint{.extdecl, 
    importc: "mvderwin", dynlib: pdcursesdll.}
proc mvgetch*(a2: cint; a3: cint): cint{.extdecl, importc: "mvgetch", 
    dynlib: pdcursesdll.}
proc mvgetnstr*(a2: cint; a3: cint; a4: cstring; a5: cint): cint{.extdecl, 
    importc: "mvgetnstr", dynlib: pdcursesdll.}
proc mvgetstr*(a2: cint; a3: cint; a4: cstring): cint{.extdecl, 
    importc: "mvgetstr", dynlib: pdcursesdll.}
proc mvhline*(a2: cint; a3: cint; a4: cunsignedlong; a5: cint): cint{.extdecl, 
    importc: "mvhline", dynlib: pdcursesdll.}
proc mvinch*(a2: cint; a3: cint): cunsignedlong{.extdecl, importc: "mvinch", 
    dynlib: pdcursesdll.}
proc mvinchnstr*(a2: cint; a3: cint; a4: ptr cunsignedlong; a5: cint): cint{.
    extdecl, importc: "mvinchnstr", dynlib: pdcursesdll.}
proc mvinchstr*(a2: cint; a3: cint; a4: ptr cunsignedlong): cint{.extdecl, 
    importc: "mvinchstr", dynlib: pdcursesdll.}
proc mvinnstr*(a2: cint; a3: cint; a4: cstring; a5: cint): cint{.extdecl, 
    importc: "mvinnstr", dynlib: pdcursesdll.}
proc mvinsch*(a2: cint; a3: cint; a4: cunsignedlong): cint{.extdecl, 
    importc: "mvinsch", dynlib: pdcursesdll.}
proc mvinsnstr*(a2: cint; a3: cint; a4: cstring; a5: cint): cint{.extdecl, 
    importc: "mvinsnstr", dynlib: pdcursesdll.}
proc mvinsstr*(a2: cint; a3: cint; a4: cstring): cint{.extdecl, 
    importc: "mvinsstr", dynlib: pdcursesdll.}
proc mvinstr*(a2: cint; a3: cint; a4: cstring): cint{.extdecl, importc: "mvinstr", 
    dynlib: pdcursesdll.}
proc mvprintw*(a2: cint; a3: cint; a4: cstring): cint{.varargs, extdecl, 
    importc: "mvprintw", dynlib: pdcursesdll.}
proc mvscanw*(a2: cint; a3: cint; a4: cstring): cint{.varargs, extdecl, 
    importc: "mvscanw", dynlib: pdcursesdll.}
proc mvvline*(a2: cint; a3: cint; a4: cunsignedlong; a5: cint): cint{.extdecl, 
    importc: "mvvline", dynlib: pdcursesdll.}
proc mvwaddchnstr*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: ptr cunsignedlong; 
                   a6: cint): cint{.extdecl, importc: "mvwaddchnstr", 
                                    dynlib: pdcursesdll.}
proc mvwaddchstr*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: ptr cunsignedlong): cint{.
    extdecl, importc: "mvwaddchstr", dynlib: pdcursesdll.}
proc mvwaddch*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cunsignedlong): cint{.
    extdecl, importc: "mvwaddch", dynlib: pdcursesdll.}
proc mvwaddnstr*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cstring; a6: cint): cint{.
    extdecl, importc: "mvwaddnstr", dynlib: pdcursesdll.}
proc mvwaddstr*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cstring): cint{.extdecl, 
    importc: "mvwaddstr", dynlib: pdcursesdll.}
proc mvwchgat*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cint; a6: cunsignedlong; 
               a7: cshort; a8: pointer): cint{.extdecl, importc: "mvwchgat", 
    dynlib: pdcursesdll.}
proc mvwdelch*(a2: ptr TWINDOW; a3: cint; a4: cint): cint{.extdecl, 
    importc: "mvwdelch", dynlib: pdcursesdll.}
proc mvwgetch*(a2: ptr TWINDOW; a3: cint; a4: cint): cint{.extdecl, 
    importc: "mvwgetch", dynlib: pdcursesdll.}
proc mvwgetnstr*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cstring; a6: cint): cint{.
    extdecl, importc: "mvwgetnstr", dynlib: pdcursesdll.}
proc mvwgetstr*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cstring): cint{.extdecl, 
    importc: "mvwgetstr", dynlib: pdcursesdll.}
proc mvwhline*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cunsignedlong; a6: cint): cint{.
    extdecl, importc: "mvwhline", dynlib: pdcursesdll.}
proc mvwinchnstr*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: ptr cunsignedlong; 
                  a6: cint): cint{.extdecl, importc: "mvwinchnstr", 
                                   dynlib: pdcursesdll.}
proc mvwinchstr*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: ptr cunsignedlong): cint{.
    extdecl, importc: "mvwinchstr", dynlib: pdcursesdll.}
proc mvwinch*(a2: ptr TWINDOW; a3: cint; a4: cint): cunsignedlong{.extdecl, 
    importc: "mvwinch", dynlib: pdcursesdll.}
proc mvwinnstr*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cstring; a6: cint): cint{.
    extdecl, importc: "mvwinnstr", dynlib: pdcursesdll.}
proc mvwinsch*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cunsignedlong): cint{.
    extdecl, importc: "mvwinsch", dynlib: pdcursesdll.}
proc mvwinsnstr*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cstring; a6: cint): cint{.
    extdecl, importc: "mvwinsnstr", dynlib: pdcursesdll.}
proc mvwinsstr*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cstring): cint{.extdecl, 
    importc: "mvwinsstr", dynlib: pdcursesdll.}
proc mvwinstr*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cstring): cint{.extdecl, 
    importc: "mvwinstr", dynlib: pdcursesdll.}
proc mvwin*(a2: ptr TWINDOW; a3: cint; a4: cint): cint{.extdecl, importc: "mvwin", 
    dynlib: pdcursesdll.}
proc mvwprintw*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cstring): cint{.varargs, 
    extdecl, importc: "mvwprintw", dynlib: pdcursesdll.}
proc mvwscanw*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cstring): cint{.varargs, 
    extdecl, importc: "mvwscanw", dynlib: pdcursesdll.}
proc mvwvline*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cunsignedlong; a6: cint): cint{.
    extdecl, importc: "mvwvline", dynlib: pdcursesdll.}
proc napms*(a2: cint): cint{.extdecl, importc: "napms", dynlib: pdcursesdll.}
proc newpad*(a2: cint; a3: cint): ptr TWINDOW{.extdecl, importc: "newpad", 
    dynlib: pdcursesdll.}
proc newterm*(a2: cstring; a3: TFile; a4: TFile): ptr TSCREEN{.extdecl, 
    importc: "newterm", dynlib: pdcursesdll.}
proc newwin*(a2: cint; a3: cint; a4: cint; a5: cint): ptr TWINDOW{.extdecl, 
    importc: "newwin", dynlib: pdcursesdll.}
proc nl*(): cint{.extdecl, importc: "nl", dynlib: pdcursesdll.}
proc nocbreak*(): cint{.extdecl, importc: "nocbreak", dynlib: pdcursesdll.}
proc nodelay*(a2: ptr TWINDOW; a3: cunsignedchar): cint{.extdecl, 
    importc: "nodelay", dynlib: pdcursesdll.}
proc noecho*(): cint{.extdecl, importc: "noecho", dynlib: pdcursesdll.}
proc nonl*(): cint{.extdecl, importc: "nonl", dynlib: pdcursesdll.}
proc noqiflush*(){.extdecl, importc: "noqiflush", dynlib: pdcursesdll.}
proc noraw*(): cint{.extdecl, importc: "noraw", dynlib: pdcursesdll.}
proc notimeout*(a2: ptr TWINDOW; a3: cunsignedchar): cint{.extdecl, 
    importc: "notimeout", dynlib: pdcursesdll.}
proc overlay*(a2: ptr TWINDOW; a3: ptr TWINDOW): cint{.extdecl, importc: "overlay", 
    dynlib: pdcursesdll.}
proc overwrite*(a2: ptr TWINDOW; a3: ptr TWINDOW): cint{.extdecl, 
    importc: "overwrite", dynlib: pdcursesdll.}
proc pair_content*(a2: cshort; a3: ptr cshort; a4: ptr cshort): cint{.extdecl, 
    importc: "pair_content", dynlib: pdcursesdll.}
proc pechochar*(a2: ptr TWINDOW; a3: cunsignedlong): cint{.extdecl, 
    importc: "pechochar", dynlib: pdcursesdll.}
proc pnoutrefresh*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cint; a6: cint; 
                   a7: cint; a8: cint): cint{.extdecl, importc: "pnoutrefresh", 
    dynlib: pdcursesdll.}
proc prefresh*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cint; a6: cint; a7: cint; 
               a8: cint): cint{.extdecl, importc: "prefresh", dynlib: pdcursesdll.}
proc printw*(a2: cstring): cint{.varargs, extdecl, importc: "printw", 
                                 dynlib: pdcursesdll.}
proc putwin*(a2: ptr TWINDOW; a3: TFile): cint{.extdecl, importc: "putwin", 
    dynlib: pdcursesdll.}
proc qiflush*(){.extdecl, importc: "qiflush", dynlib: pdcursesdll.}
proc raw*(): cint{.extdecl, importc: "raw", dynlib: pdcursesdll.}
proc redrawwin*(a2: ptr TWINDOW): cint{.extdecl, importc: "redrawwin", 
                                       dynlib: pdcursesdll.}
proc refresh*(): cint{.extdecl, importc: "refresh", dynlib: pdcursesdll.}
proc reset_prog_mode*(): cint{.extdecl, importc: "reset_prog_mode", 
                               dynlib: pdcursesdll.}
proc reset_shell_mode*(): cint{.extdecl, importc: "reset_shell_mode", 
                                dynlib: pdcursesdll.}
proc resetty*(): cint{.extdecl, importc: "resetty", dynlib: pdcursesdll.}
#int     ripoffline(int, int (*)(TWINDOW *, int));
proc savetty*(): cint{.extdecl, importc: "savetty", dynlib: pdcursesdll.}
proc scanw*(a2: cstring): cint{.varargs, extdecl, importc: "scanw", 
                                dynlib: pdcursesdll.}
proc scr_dump*(a2: cstring): cint{.extdecl, importc: "scr_dump", 
                                   dynlib: pdcursesdll.}
proc scr_init*(a2: cstring): cint{.extdecl, importc: "scr_init", 
                                   dynlib: pdcursesdll.}
proc scr_restore*(a2: cstring): cint{.extdecl, importc: "scr_restore", 
                                      dynlib: pdcursesdll.}
proc scr_set*(a2: cstring): cint{.extdecl, importc: "scr_set", dynlib: pdcursesdll.}
proc scrl*(a2: cint): cint{.extdecl, importc: "scrl", dynlib: pdcursesdll.}
proc scroll*(a2: ptr TWINDOW): cint{.extdecl, importc: "scroll", 
                                    dynlib: pdcursesdll.}
proc scrollok*(a2: ptr TWINDOW; a3: cunsignedchar): cint{.extdecl, 
    importc: "scrollok", dynlib: pdcursesdll.}
proc set_term*(a2: ptr TSCREEN): ptr TSCREEN{.extdecl, importc: "set_term", 
    dynlib: pdcursesdll.}
proc setscrreg*(a2: cint; a3: cint): cint{.extdecl, importc: "setscrreg", 
    dynlib: pdcursesdll.}
proc slk_attroff*(a2: cunsignedlong): cint{.extdecl, importc: "slk_attroff", 
    dynlib: pdcursesdll.}
proc slk_attr_off*(a2: cunsignedlong; a3: pointer): cint{.extdecl, 
    importc: "slk_attr_off", dynlib: pdcursesdll.}
proc slk_attron*(a2: cunsignedlong): cint{.extdecl, importc: "slk_attron", 
    dynlib: pdcursesdll.}
proc slk_attr_on*(a2: cunsignedlong; a3: pointer): cint{.extdecl, 
    importc: "slk_attr_on", dynlib: pdcursesdll.}
proc slk_attrset*(a2: cunsignedlong): cint{.extdecl, importc: "slk_attrset", 
    dynlib: pdcursesdll.}
proc slk_attr_set*(a2: cunsignedlong; a3: cshort; a4: pointer): cint{.extdecl, 
    importc: "slk_attr_set", dynlib: pdcursesdll.}
proc slk_clear*(): cint{.extdecl, importc: "slk_clear", dynlib: pdcursesdll.}
proc slk_color*(a2: cshort): cint{.extdecl, importc: "slk_color", 
                                   dynlib: pdcursesdll.}
proc slk_init*(a2: cint): cint{.extdecl, importc: "slk_init", dynlib: pdcursesdll.}
proc slk_label*(a2: cint): cstring{.extdecl, importc: "slk_label", 
                                    dynlib: pdcursesdll.}
proc slk_noutrefresh*(): cint{.extdecl, importc: "slk_noutrefresh", 
                               dynlib: pdcursesdll.}
proc slk_refresh*(): cint{.extdecl, importc: "slk_refresh", dynlib: pdcursesdll.}
proc slk_restore*(): cint{.extdecl, importc: "slk_restore", dynlib: pdcursesdll.}
proc slk_set*(a2: cint; a3: cstring; a4: cint): cint{.extdecl, importc: "slk_set", 
    dynlib: pdcursesdll.}
proc slk_touch*(): cint{.extdecl, importc: "slk_touch", dynlib: pdcursesdll.}
proc standend*(): cint{.extdecl, importc: "standend", dynlib: pdcursesdll.}
proc standout*(): cint{.extdecl, importc: "standout", dynlib: pdcursesdll.}
proc start_color*(): cint{.extdecl, importc: "start_color", dynlib: pdcursesdll.}
proc subpad*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cint; a6: cint): ptr TWINDOW{.
    extdecl, importc: "subpad", dynlib: pdcursesdll.}
proc subwin*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cint; a6: cint): ptr TWINDOW{.
    extdecl, importc: "subwin", dynlib: pdcursesdll.}
proc syncok*(a2: ptr TWINDOW; a3: cunsignedchar): cint{.extdecl, importc: "syncok", 
    dynlib: pdcursesdll.}
proc termattrs*(): cunsignedlong{.extdecl, importc: "termattrs", 
                                  dynlib: pdcursesdll.}
proc termattrs2*(): cunsignedlong{.extdecl, importc: "term_attrs", 
                                   dynlib: pdcursesdll.}
proc termname*(): cstring{.extdecl, importc: "termname", dynlib: pdcursesdll.}
proc timeout*(a2: cint){.extdecl, importc: "timeout", dynlib: pdcursesdll.}
proc touchline*(a2: ptr TWINDOW; a3: cint; a4: cint): cint{.extdecl, 
    importc: "touchline", dynlib: pdcursesdll.}
proc touchwin*(a2: ptr TWINDOW): cint{.extdecl, importc: "touchwin", 
                                      dynlib: pdcursesdll.}
proc typeahead*(a2: cint): cint{.extdecl, importc: "typeahead", 
                                 dynlib: pdcursesdll.}
proc untouchwin*(a2: ptr TWINDOW): cint{.extdecl, importc: "untouchwin", 
                                        dynlib: pdcursesdll.}
proc use_env*(a2: cunsignedchar){.extdecl, importc: "use_env", dynlib: pdcursesdll.}
proc vidattr*(a2: cunsignedlong): cint{.extdecl, importc: "vidattr", 
                                        dynlib: pdcursesdll.}
proc vid_attr*(a2: cunsignedlong; a3: cshort; a4: pointer): cint{.extdecl, 
    importc: "vid_attr", dynlib: pdcursesdll.}
#int     vidputs(chtype, int (*)(int));
#int     vid_puts(attr_t, short, void *, int (*)(int));
proc vline*(a2: cunsignedlong; a3: cint): cint{.extdecl, importc: "vline", 
    dynlib: pdcursesdll.}
proc vwprintw*(a2: ptr TWINDOW; a3: cstring): cint{.extdecl, varargs,
    importc: "vw_printw", dynlib: pdcursesdll.}
proc vwprintw2*(a2: ptr TWINDOW; a3: cstring): cint{.extdecl, varargs,
    importc: "vwprintw", dynlib: pdcursesdll.}
proc vwscanw*(a2: ptr TWINDOW; a3: cstring): cint{.extdecl, varargs,
    importc: "vw_scanw", dynlib: pdcursesdll.}
proc vwscanw2*(a2: ptr TWINDOW; a3: cstring): cint{.extdecl, varargs,
    importc: "vwscanw", dynlib: pdcursesdll.}
proc waddchnstr*(a2: ptr TWINDOW; a3: ptr cunsignedlong; a4: cint): cint{.extdecl, 
    importc: "waddchnstr", dynlib: pdcursesdll.}
proc waddchstr*(a2: ptr TWINDOW; a3: ptr cunsignedlong): cint{.extdecl, 
    importc: "waddchstr", dynlib: pdcursesdll.}
proc waddch*(a2: ptr TWINDOW; a3: cunsignedlong): cint{.extdecl, importc: "waddch", 
    dynlib: pdcursesdll.}
proc waddnstr*(a2: ptr TWINDOW; a3: cstring; a4: cint): cint{.extdecl, 
    importc: "waddnstr", dynlib: pdcursesdll.}
proc waddstr*(a2: ptr TWINDOW; a3: cstring): cint{.extdecl, importc: "waddstr", 
    dynlib: pdcursesdll.}
proc wattroff*(a2: ptr TWINDOW; a3: cunsignedlong): cint{.extdecl, 
    importc: "wattroff", dynlib: pdcursesdll.}
proc wattron*(a2: ptr TWINDOW; a3: cunsignedlong): cint{.extdecl, 
    importc: "wattron", dynlib: pdcursesdll.}
proc wattrset*(a2: ptr TWINDOW; a3: cunsignedlong): cint{.extdecl, 
    importc: "wattrset", dynlib: pdcursesdll.}
proc wattr_get*(a2: ptr TWINDOW; a3: ptr cunsignedlong; a4: ptr cshort; 
                a5: pointer): cint{.extdecl, importc: "wattr_get", 
                                    dynlib: pdcursesdll.}
proc wattr_off*(a2: ptr TWINDOW; a3: cunsignedlong; a4: pointer): cint{.extdecl, 
    importc: "wattr_off", dynlib: pdcursesdll.}
proc wattr_on*(a2: ptr TWINDOW; a3: cunsignedlong; a4: pointer): cint{.extdecl, 
    importc: "wattr_on", dynlib: pdcursesdll.}
proc wattr_set*(a2: ptr TWINDOW; a3: cunsignedlong; a4: cshort; a5: pointer): cint{.
    extdecl, importc: "wattr_set", dynlib: pdcursesdll.}
proc wbkgdset*(a2: ptr TWINDOW; a3: cunsignedlong){.extdecl, importc: "wbkgdset", 
    dynlib: pdcursesdll.}
proc wbkgd*(a2: ptr TWINDOW; a3: cunsignedlong): cint{.extdecl, importc: "wbkgd", 
    dynlib: pdcursesdll.}
proc wborder*(a2: ptr TWINDOW; a3: cunsignedlong; a4: cunsignedlong; 
              a5: cunsignedlong; a6: cunsignedlong; a7: cunsignedlong; 
              a8: cunsignedlong; a9: cunsignedlong; a10: cunsignedlong): cint{.
    extdecl, importc: "wborder", dynlib: pdcursesdll.}
proc wchgat*(a2: ptr TWINDOW; a3: cint; a4: cunsignedlong; a5: cshort; 
             a6: pointer): cint{.extdecl, importc: "wchgat", dynlib: pdcursesdll.}
proc wclear*(a2: ptr TWINDOW): cint{.extdecl, importc: "wclear", 
                                    dynlib: pdcursesdll.}
proc wclrtobot*(a2: ptr TWINDOW): cint{.extdecl, importc: "wclrtobot", 
                                       dynlib: pdcursesdll.}
proc wclrtoeol*(a2: ptr TWINDOW): cint{.extdecl, importc: "wclrtoeol", 
                                       dynlib: pdcursesdll.}
proc wcolor_set*(a2: ptr TWINDOW; a3: cshort; a4: pointer): cint{.extdecl, 
    importc: "wcolor_set", dynlib: pdcursesdll.}
proc wcursyncup*(a2: ptr TWINDOW){.extdecl, importc: "wcursyncup", 
                                  dynlib: pdcursesdll.}
proc wdelch*(a2: ptr TWINDOW): cint{.extdecl, importc: "wdelch", 
                                    dynlib: pdcursesdll.}
proc wdeleteln*(a2: ptr TWINDOW): cint{.extdecl, importc: "wdeleteln", 
                                       dynlib: pdcursesdll.}
proc wechochar*(a2: ptr TWINDOW; a3: cunsignedlong): cint{.extdecl, 
    importc: "wechochar", dynlib: pdcursesdll.}
proc werase*(a2: ptr TWINDOW): cint{.extdecl, importc: "werase", 
                                    dynlib: pdcursesdll.}
proc wgetch*(a2: ptr TWINDOW): cint{.extdecl, importc: "wgetch", 
                                    dynlib: pdcursesdll.}
proc wgetnstr*(a2: ptr TWINDOW; a3: cstring; a4: cint): cint{.extdecl, 
    importc: "wgetnstr", dynlib: pdcursesdll.}
proc wgetstr*(a2: ptr TWINDOW; a3: cstring): cint{.extdecl, importc: "wgetstr", 
    dynlib: pdcursesdll.}
proc whline*(a2: ptr TWINDOW; a3: cunsignedlong; a4: cint): cint{.extdecl, 
    importc: "whline", dynlib: pdcursesdll.}
proc winchnstr*(a2: ptr TWINDOW; a3: ptr cunsignedlong; a4: cint): cint{.extdecl, 
    importc: "winchnstr", dynlib: pdcursesdll.}
proc winchstr*(a2: ptr TWINDOW; a3: ptr cunsignedlong): cint{.extdecl, 
    importc: "winchstr", dynlib: pdcursesdll.}
proc winch*(a2: ptr TWINDOW): cunsignedlong{.extdecl, importc: "winch", 
    dynlib: pdcursesdll.}
proc winnstr*(a2: ptr TWINDOW; a3: cstring; a4: cint): cint{.extdecl, 
    importc: "winnstr", dynlib: pdcursesdll.}
proc winsch*(a2: ptr TWINDOW; a3: cunsignedlong): cint{.extdecl, importc: "winsch", 
    dynlib: pdcursesdll.}
proc winsdelln*(a2: ptr TWINDOW; a3: cint): cint{.extdecl, importc: "winsdelln", 
    dynlib: pdcursesdll.}
proc winsertln*(a2: ptr TWINDOW): cint{.extdecl, importc: "winsertln", 
                                       dynlib: pdcursesdll.}
proc winsnstr*(a2: ptr TWINDOW; a3: cstring; a4: cint): cint{.extdecl, 
    importc: "winsnstr", dynlib: pdcursesdll.}
proc winsstr*(a2: ptr TWINDOW; a3: cstring): cint{.extdecl, importc: "winsstr", 
    dynlib: pdcursesdll.}
proc winstr*(a2: ptr TWINDOW; a3: cstring): cint{.extdecl, importc: "winstr", 
    dynlib: pdcursesdll.}
proc wmove*(a2: ptr TWINDOW; a3: cint; a4: cint): cint{.extdecl, importc: "wmove", 
    dynlib: pdcursesdll.}
proc wnoutrefresh*(a2: ptr TWINDOW): cint{.extdecl, importc: "wnoutrefresh", 
    dynlib: pdcursesdll.}
proc wprintw*(a2: ptr TWINDOW; a3: cstring): cint{.varargs, extdecl, 
    importc: "wprintw", dynlib: pdcursesdll.}
proc wredrawln*(a2: ptr TWINDOW; a3: cint; a4: cint): cint{.extdecl, 
    importc: "wredrawln", dynlib: pdcursesdll.}
proc wrefresh*(a2: ptr TWINDOW): cint{.extdecl, importc: "wrefresh", 
                                      dynlib: pdcursesdll.}
proc wscanw*(a2: ptr TWINDOW; a3: cstring): cint{.varargs, extdecl, 
    importc: "wscanw", dynlib: pdcursesdll.}
proc wscrl*(a2: ptr TWINDOW; a3: cint): cint{.extdecl, importc: "wscrl", 
    dynlib: pdcursesdll.}
proc wsetscrreg*(a2: ptr TWINDOW; a3: cint; a4: cint): cint{.extdecl, 
    importc: "wsetscrreg", dynlib: pdcursesdll.}
proc wstandend*(a2: ptr TWINDOW): cint{.extdecl, importc: "wstandend", 
                                       dynlib: pdcursesdll.}
proc wstandout*(a2: ptr TWINDOW): cint{.extdecl, importc: "wstandout", 
                                       dynlib: pdcursesdll.}
proc wsyncdown*(a2: ptr TWINDOW){.extdecl, importc: "wsyncdown", 
                                 dynlib: pdcursesdll.}
proc wsyncup*(a2: ptr TWINDOW){.extdecl, importc: "wsyncup", dynlib: pdcursesdll.}
proc wtimeout*(a2: ptr TWINDOW; a3: cint){.extdecl, importc: "wtimeout", 
    dynlib: pdcursesdll.}
proc wtouchln*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cint): cint{.extdecl, 
    importc: "wtouchln", dynlib: pdcursesdll.}
proc wvline*(a2: ptr TWINDOW; a3: cunsignedlong; a4: cint): cint{.extdecl, 
    importc: "wvline", dynlib: pdcursesdll.}
proc addnwstr*(a2: cstring; a3: cint): cint{.extdecl, importc: "addnwstr", 
    dynlib: pdcursesdll.}
proc addwstr*(a2: cstring): cint{.extdecl, importc: "addwstr", 
                                      dynlib: pdcursesdll.}
proc add_wch*(a2: ptr cunsignedlong): cint{.extdecl, importc: "add_wch", 
    dynlib: pdcursesdll.}
proc add_wchnstr*(a2: ptr cunsignedlong; a3: cint): cint{.extdecl, 
    importc: "add_wchnstr", dynlib: pdcursesdll.}
proc add_wchstr*(a2: ptr cunsignedlong): cint{.extdecl, importc: "add_wchstr", 
    dynlib: pdcursesdll.}
proc border_set*(a2: ptr cunsignedlong; a3: ptr cunsignedlong; 
                 a4: ptr cunsignedlong; a5: ptr cunsignedlong; 
                 a6: ptr cunsignedlong; a7: ptr cunsignedlong; 
                 a8: ptr cunsignedlong; a9: ptr cunsignedlong): cint{.extdecl, 
    importc: "border_set", dynlib: pdcursesdll.}
proc box_set*(a2: ptr TWINDOW; a3: ptr cunsignedlong; a4: ptr cunsignedlong): cint{.
    extdecl, importc: "box_set", dynlib: pdcursesdll.}
proc echo_wchar*(a2: ptr cunsignedlong): cint{.extdecl, importc: "echo_wchar", 
    dynlib: pdcursesdll.}
proc erasewchar*(a2: cstring): cint{.extdecl, importc: "erasewchar", 
    dynlib: pdcursesdll.}
proc getbkgrnd*(a2: ptr cunsignedlong): cint{.extdecl, importc: "getbkgrnd", 
    dynlib: pdcursesdll.}
proc getcchar*(a2: ptr cunsignedlong; a3: cstring; a4: ptr cunsignedlong; 
               a5: ptr cshort; a6: pointer): cint{.extdecl, importc: "getcchar", 
    dynlib: pdcursesdll.}
proc getn_wstr*(a2: ptr cint; a3: cint): cint{.extdecl, importc: "getn_wstr", 
    dynlib: pdcursesdll.}
proc get_wch*(a2: ptr cint): cint{.extdecl, importc: "get_wch", 
                                     dynlib: pdcursesdll.}
proc get_wstr*(a2: ptr cint): cint{.extdecl, importc: "get_wstr", 
                                      dynlib: pdcursesdll.}
proc hline_set*(a2: ptr cunsignedlong; a3: cint): cint{.extdecl, 
    importc: "hline_set", dynlib: pdcursesdll.}
proc innwstr*(a2: cstring; a3: cint): cint{.extdecl, importc: "innwstr", 
    dynlib: pdcursesdll.}
proc ins_nwstr*(a2: cstring; a3: cint): cint{.extdecl, importc: "ins_nwstr", 
    dynlib: pdcursesdll.}
proc ins_wch*(a2: ptr cunsignedlong): cint{.extdecl, importc: "ins_wch", 
    dynlib: pdcursesdll.}
proc ins_wstr*(a2: cstring): cint{.extdecl, importc: "ins_wstr", 
                                       dynlib: pdcursesdll.}
proc inwstr*(a2: cstring): cint{.extdecl, importc: "inwstr", 
                                     dynlib: pdcursesdll.}
proc in_wch*(a2: ptr cunsignedlong): cint{.extdecl, importc: "in_wch", 
    dynlib: pdcursesdll.}
proc in_wchnstr*(a2: ptr cunsignedlong; a3: cint): cint{.extdecl, 
    importc: "in_wchnstr", dynlib: pdcursesdll.}
proc in_wchstr*(a2: ptr cunsignedlong): cint{.extdecl, importc: "in_wchstr", 
    dynlib: pdcursesdll.}
proc key_name*(a2: char): cstring{.extdecl, importc: "key_name", 
                                      dynlib: pdcursesdll.}
proc killwchar*(a2: cstring): cint{.extdecl, importc: "killwchar", 
                                        dynlib: pdcursesdll.}
proc mvaddnwstr*(a2: cint; a3: cint; a4: cstring; a5: cint): cint{.extdecl, 
    importc: "mvaddnwstr", dynlib: pdcursesdll.}
proc mvaddwstr*(a2: cint; a3: cint; a4: cstring): cint{.extdecl, 
    importc: "mvaddwstr", dynlib: pdcursesdll.}
proc mvadd_wch*(a2: cint; a3: cint; a4: ptr cunsignedlong): cint{.extdecl, 
    importc: "mvadd_wch", dynlib: pdcursesdll.}
proc mvadd_wchnstr*(a2: cint; a3: cint; a4: ptr cunsignedlong; a5: cint): cint{.
    extdecl, importc: "mvadd_wchnstr", dynlib: pdcursesdll.}
proc mvadd_wchstr*(a2: cint; a3: cint; a4: ptr cunsignedlong): cint{.extdecl, 
    importc: "mvadd_wchstr", dynlib: pdcursesdll.}
proc mvgetn_wstr*(a2: cint; a3: cint; a4: ptr cint; a5: cint): cint{.extdecl, 
    importc: "mvgetn_wstr", dynlib: pdcursesdll.}
proc mvget_wch*(a2: cint; a3: cint; a4: ptr cint): cint{.extdecl, 
    importc: "mvget_wch", dynlib: pdcursesdll.}
proc mvget_wstr*(a2: cint; a3: cint; a4: ptr cint): cint{.extdecl, 
    importc: "mvget_wstr", dynlib: pdcursesdll.}
proc mvhline_set*(a2: cint; a3: cint; a4: ptr cunsignedlong; a5: cint): cint{.
    extdecl, importc: "mvhline_set", dynlib: pdcursesdll.}
proc mvinnwstr*(a2: cint; a3: cint; a4: cstring; a5: cint): cint{.extdecl, 
    importc: "mvinnwstr", dynlib: pdcursesdll.}
proc mvins_nwstr*(a2: cint; a3: cint; a4: cstring; a5: cint): cint{.extdecl, 
    importc: "mvins_nwstr", dynlib: pdcursesdll.}
proc mvins_wch*(a2: cint; a3: cint; a4: ptr cunsignedlong): cint{.extdecl, 
    importc: "mvins_wch", dynlib: pdcursesdll.}
proc mvins_wstr*(a2: cint; a3: cint; a4: cstring): cint{.extdecl, 
    importc: "mvins_wstr", dynlib: pdcursesdll.}
proc mvinwstr*(a2: cint; a3: cint; a4: cstring): cint{.extdecl, 
    importc: "mvinwstr", dynlib: pdcursesdll.}
proc mvin_wch*(a2: cint; a3: cint; a4: ptr cunsignedlong): cint{.extdecl, 
    importc: "mvin_wch", dynlib: pdcursesdll.}
proc mvin_wchnstr*(a2: cint; a3: cint; a4: ptr cunsignedlong; a5: cint): cint{.
    extdecl, importc: "mvin_wchnstr", dynlib: pdcursesdll.}
proc mvin_wchstr*(a2: cint; a3: cint; a4: ptr cunsignedlong): cint{.extdecl, 
    importc: "mvin_wchstr", dynlib: pdcursesdll.}
proc mvvline_set*(a2: cint; a3: cint; a4: ptr cunsignedlong; a5: cint): cint{.
    extdecl, importc: "mvvline_set", dynlib: pdcursesdll.}
proc mvwaddnwstr*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cstring; a6: cint): cint{.
    extdecl, importc: "mvwaddnwstr", dynlib: pdcursesdll.}
proc mvwaddwstr*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cstring): cint{.
    extdecl, importc: "mvwaddwstr", dynlib: pdcursesdll.}
proc mvwadd_wch*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: ptr cunsignedlong): cint{.
    extdecl, importc: "mvwadd_wch", dynlib: pdcursesdll.}
proc mvwadd_wchnstr*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: ptr cunsignedlong; 
                     a6: cint): cint{.extdecl, importc: "mvwadd_wchnstr", 
                                      dynlib: pdcursesdll.}
proc mvwadd_wchstr*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: ptr cunsignedlong): cint{.
    extdecl, importc: "mvwadd_wchstr", dynlib: pdcursesdll.}
proc mvwgetn_wstr*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: ptr cint; a6: cint): cint{.
    extdecl, importc: "mvwgetn_wstr", dynlib: pdcursesdll.}
proc mvwget_wch*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: ptr cint): cint{.
    extdecl, importc: "mvwget_wch", dynlib: pdcursesdll.}
proc mvwget_wstr*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: ptr cint): cint{.
    extdecl, importc: "mvwget_wstr", dynlib: pdcursesdll.}
proc mvwhline_set*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: ptr cunsignedlong; 
                   a6: cint): cint{.extdecl, importc: "mvwhline_set", 
                                    dynlib: pdcursesdll.}
proc mvwinnwstr*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cstring; a6: cint): cint{.
    extdecl, importc: "mvwinnwstr", dynlib: pdcursesdll.}
proc mvwins_nwstr*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cstring; a6: cint): cint{.
    extdecl, importc: "mvwins_nwstr", dynlib: pdcursesdll.}
proc mvwins_wch*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: ptr cunsignedlong): cint{.
    extdecl, importc: "mvwins_wch", dynlib: pdcursesdll.}
proc mvwins_wstr*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cstring): cint{.
    extdecl, importc: "mvwins_wstr", dynlib: pdcursesdll.}
proc mvwin_wch*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: ptr cunsignedlong): cint{.
    extdecl, importc: "mvwin_wch", dynlib: pdcursesdll.}
proc mvwin_wchnstr*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: ptr cunsignedlong; 
                    a6: cint): cint{.extdecl, importc: "mvwin_wchnstr", 
                                     dynlib: pdcursesdll.}
proc mvwin_wchstr*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: ptr cunsignedlong): cint{.
    extdecl, importc: "mvwin_wchstr", dynlib: pdcursesdll.}
proc mvwinwstr*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cstring): cint{.
    extdecl, importc: "mvwinwstr", dynlib: pdcursesdll.}
proc mvwvline_set*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: ptr cunsignedlong; 
                   a6: cint): cint{.extdecl, importc: "mvwvline_set", 
                                    dynlib: pdcursesdll.}
proc pecho_wchar*(a2: ptr TWINDOW; a3: ptr cunsignedlong): cint{.extdecl, 
    importc: "pecho_wchar", dynlib: pdcursesdll.}
proc setcchar*(a2: ptr cunsignedlong; a3: cstring; a4: cunsignedlong; 
               a5: cshort; a6: pointer): cint{.extdecl, importc: "setcchar", 
    dynlib: pdcursesdll.}
proc slk_wset*(a2: cint; a3: cstring; a4: cint): cint{.extdecl, 
    importc: "slk_wset", dynlib: pdcursesdll.}
proc unget_wch*(a2: char): cint{.extdecl, importc: "unget_wch", 
                                    dynlib: pdcursesdll.}
proc vline_set*(a2: ptr cunsignedlong; a3: cint): cint{.extdecl, 
    importc: "vline_set", dynlib: pdcursesdll.}
proc waddnwstr*(a2: ptr TWINDOW; a3: cstring; a4: cint): cint{.extdecl, 
    importc: "waddnwstr", dynlib: pdcursesdll.}
proc waddwstr*(a2: ptr TWINDOW; a3: cstring): cint{.extdecl, 
    importc: "waddwstr", dynlib: pdcursesdll.}
proc wadd_wch*(a2: ptr TWINDOW; a3: ptr cunsignedlong): cint{.extdecl, 
    importc: "wadd_wch", dynlib: pdcursesdll.}
proc wadd_wchnstr*(a2: ptr TWINDOW; a3: ptr cunsignedlong; a4: cint): cint{.
    extdecl, importc: "wadd_wchnstr", dynlib: pdcursesdll.}
proc wadd_wchstr*(a2: ptr TWINDOW; a3: ptr cunsignedlong): cint{.extdecl, 
    importc: "wadd_wchstr", dynlib: pdcursesdll.}
proc wbkgrnd*(a2: ptr TWINDOW; a3: ptr cunsignedlong): cint{.extdecl, 
    importc: "wbkgrnd", dynlib: pdcursesdll.}
proc wbkgrndset*(a2: ptr TWINDOW; a3: ptr cunsignedlong){.extdecl, 
    importc: "wbkgrndset", dynlib: pdcursesdll.}
proc wborder_set*(a2: ptr TWINDOW; a3: ptr cunsignedlong; a4: ptr cunsignedlong; 
                  a5: ptr cunsignedlong; a6: ptr cunsignedlong; 
                  a7: ptr cunsignedlong; a8: ptr cunsignedlong; 
                  a9: ptr cunsignedlong; a10: ptr cunsignedlong): cint{.extdecl, 
    importc: "wborder_set", dynlib: pdcursesdll.}
proc wecho_wchar*(a2: ptr TWINDOW; a3: ptr cunsignedlong): cint{.extdecl, 
    importc: "wecho_wchar", dynlib: pdcursesdll.}
proc wgetbkgrnd*(a2: ptr TWINDOW; a3: ptr cunsignedlong): cint{.extdecl, 
    importc: "wgetbkgrnd", dynlib: pdcursesdll.}
proc wgetn_wstr*(a2: ptr TWINDOW; a3: ptr cint; a4: cint): cint{.extdecl, 
    importc: "wgetn_wstr", dynlib: pdcursesdll.}
proc wget_wch*(a2: ptr TWINDOW; a3: ptr cint): cint{.extdecl, 
    importc: "wget_wch", dynlib: pdcursesdll.}
proc wget_wstr*(a2: ptr TWINDOW; a3: ptr cint): cint{.extdecl, 
    importc: "wget_wstr", dynlib: pdcursesdll.}
proc whline_set*(a2: ptr TWINDOW; a3: ptr cunsignedlong; a4: cint): cint{.extdecl, 
    importc: "whline_set", dynlib: pdcursesdll.}
proc winnwstr*(a2: ptr TWINDOW; a3: cstring; a4: cint): cint{.extdecl, 
    importc: "winnwstr", dynlib: pdcursesdll.}
proc wins_nwstr*(a2: ptr TWINDOW; a3: cstring; a4: cint): cint{.extdecl, 
    importc: "wins_nwstr", dynlib: pdcursesdll.}
proc wins_wch*(a2: ptr TWINDOW; a3: ptr cunsignedlong): cint{.extdecl, 
    importc: "wins_wch", dynlib: pdcursesdll.}
proc wins_wstr*(a2: ptr TWINDOW; a3: cstring): cint{.extdecl, 
    importc: "wins_wstr", dynlib: pdcursesdll.}
proc winwstr*(a2: ptr TWINDOW; a3: cstring): cint{.extdecl, importc: "winwstr", 
    dynlib: pdcursesdll.}
proc win_wch*(a2: ptr TWINDOW; a3: ptr cunsignedlong): cint{.extdecl, 
    importc: "win_wch", dynlib: pdcursesdll.}
proc win_wchnstr*(a2: ptr TWINDOW; a3: ptr cunsignedlong; a4: cint): cint{.extdecl, 
    importc: "win_wchnstr", dynlib: pdcursesdll.}
proc win_wchstr*(a2: ptr TWINDOW; a3: ptr cunsignedlong): cint{.extdecl, 
    importc: "win_wchstr", dynlib: pdcursesdll.}
proc wunctrl*(a2: ptr cunsignedlong): cstring{.extdecl, importc: "wunctrl", 
    dynlib: pdcursesdll.}
proc wvline_set*(a2: ptr TWINDOW; a3: ptr cunsignedlong; a4: cint): cint{.extdecl, 
    importc: "wvline_set", dynlib: pdcursesdll.}
proc getattrs*(a2: ptr TWINDOW): cunsignedlong{.extdecl, importc: "getattrs", 
    dynlib: pdcursesdll.}
proc getbegx*(a2: ptr TWINDOW): cint{.extdecl, importc: "getbegx", 
                                     dynlib: pdcursesdll.}
proc getbegy*(a2: ptr TWINDOW): cint{.extdecl, importc: "getbegy", 
                                     dynlib: pdcursesdll.}
proc getmaxx*(a2: ptr TWINDOW): cint{.extdecl, importc: "getmaxx", 
                                     dynlib: pdcursesdll.}
proc getmaxy*(a2: ptr TWINDOW): cint{.extdecl, importc: "getmaxy", 
                                     dynlib: pdcursesdll.}
proc getparx*(a2: ptr TWINDOW): cint{.extdecl, importc: "getparx", 
                                     dynlib: pdcursesdll.}
proc getpary*(a2: ptr TWINDOW): cint{.extdecl, importc: "getpary", 
                                     dynlib: pdcursesdll.}
proc getcurx*(a2: ptr TWINDOW): cint{.extdecl, importc: "getcurx", 
                                     dynlib: pdcursesdll.}
proc getcury*(a2: ptr TWINDOW): cint{.extdecl, importc: "getcury", 
                                     dynlib: pdcursesdll.}
proc traceoff*(){.extdecl, importc: "traceoff", dynlib: pdcursesdll.}
proc traceon*(){.extdecl, importc: "traceon", dynlib: pdcursesdll.}
proc unctrl*(a2: cunsignedlong): cstring{.extdecl, importc: "unctrl", 
    dynlib: pdcursesdll.}
proc crmode*(): cint{.extdecl, importc: "crmode", dynlib: pdcursesdll.}
proc nocrmode*(): cint{.extdecl, importc: "nocrmode", dynlib: pdcursesdll.}
proc draino*(a2: cint): cint{.extdecl, importc: "draino", dynlib: pdcursesdll.}
proc resetterm*(): cint{.extdecl, importc: "resetterm", dynlib: pdcursesdll.}
proc fixterm*(): cint{.extdecl, importc: "fixterm", dynlib: pdcursesdll.}
proc saveterm*(): cint{.extdecl, importc: "saveterm", dynlib: pdcursesdll.}
proc setsyx*(a2: cint; a3: cint): cint{.extdecl, importc: "setsyx", 
                                        dynlib: pdcursesdll.}
proc mouse_set*(a2: cunsignedlong): cint{.extdecl, importc: "mouse_set", 
    dynlib: pdcursesdll.}
proc mouse_on*(a2: cunsignedlong): cint{.extdecl, importc: "mouse_on", 
    dynlib: pdcursesdll.}
proc mouse_off*(a2: cunsignedlong): cint{.extdecl, importc: "mouse_off", 
    dynlib: pdcursesdll.}
proc request_mouse_pos*(): cint{.extdecl, importc: "request_mouse_pos", 
                                 dynlib: pdcursesdll.}
proc map_button*(a2: cunsignedlong): cint{.extdecl, importc: "map_button", 
    dynlib: pdcursesdll.}
proc wmouse_position*(a2: ptr TWINDOW; a3: ptr cint; a4: ptr cint){.extdecl, 
    importc: "wmouse_position", dynlib: pdcursesdll.}
proc getmouse*(): cunsignedlong{.extdecl, importc: "getmouse", dynlib: pdcursesdll.}
proc getbmap*(): cunsignedlong{.extdecl, importc: "getbmap", dynlib: pdcursesdll.}
proc assume_default_colors*(a2: cint; a3: cint): cint{.extdecl, 
    importc: "assume_default_colors", dynlib: pdcursesdll.}
proc curses_version*(): cstring{.extdecl, importc: "curses_version", 
                                 dynlib: pdcursesdll.}
proc has_key*(a2: cint): cunsignedchar{.extdecl, importc: "has_key", 
                                        dynlib: pdcursesdll.}
proc use_default_colors*(): cint{.extdecl, importc: "use_default_colors", 
                                  dynlib: pdcursesdll.}
proc wresize*(a2: ptr TWINDOW; a3: cint; a4: cint): cint{.extdecl, 
    importc: "wresize", dynlib: pdcursesdll.}
proc mouseinterval*(a2: cint): cint{.extdecl, importc: "mouseinterval", 
                                     dynlib: pdcursesdll.}
proc mousemask*(a2: cunsignedlong; a3: ptr cunsignedlong): cunsignedlong{.extdecl, 
    importc: "mousemask", dynlib: pdcursesdll.}
proc mouse_trafo*(a2: ptr cint; a3: ptr cint; a4: cunsignedchar): cunsignedchar{.
    extdecl, importc: "mouse_trafo", dynlib: pdcursesdll.}
proc nc_getmouse*(a2: ptr TMEVENT): cint{.extdecl, importc: "nc_getmouse", 
    dynlib: pdcursesdll.}
proc ungetmouse*(a2: ptr TMEVENT): cint{.extdecl, importc: "ungetmouse", 
                                        dynlib: pdcursesdll.}
proc wenclose*(a2: ptr TWINDOW; a3: cint; a4: cint): cunsignedchar{.extdecl, 
    importc: "wenclose", dynlib: pdcursesdll.}
proc wmouse_trafo*(a2: ptr TWINDOW; a3: ptr cint; a4: ptr cint; a5: cunsignedchar): cunsignedchar{.
    extdecl, importc: "wmouse_trafo", dynlib: pdcursesdll.}
proc addrawch*(a2: cunsignedlong): cint{.extdecl, importc: "addrawch", 
    dynlib: pdcursesdll.}
proc insrawch*(a2: cunsignedlong): cint{.extdecl, importc: "insrawch", 
    dynlib: pdcursesdll.}
proc is_termresized*(): cunsignedchar{.extdecl, importc: "is_termresized", 
                                       dynlib: pdcursesdll.}
proc mvaddrawch*(a2: cint; a3: cint; a4: cunsignedlong): cint{.extdecl, 
    importc: "mvaddrawch", dynlib: pdcursesdll.}
proc mvdeleteln*(a2: cint; a3: cint): cint{.extdecl, importc: "mvdeleteln", 
    dynlib: pdcursesdll.}
proc mvinsertln*(a2: cint; a3: cint): cint{.extdecl, importc: "mvinsertln", 
    dynlib: pdcursesdll.}
proc mvinsrawch*(a2: cint; a3: cint; a4: cunsignedlong): cint{.extdecl, 
    importc: "mvinsrawch", dynlib: pdcursesdll.}
proc mvwaddrawch*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cunsignedlong): cint{.
    extdecl, importc: "mvwaddrawch", dynlib: pdcursesdll.}
proc mvwdeleteln*(a2: ptr TWINDOW; a3: cint; a4: cint): cint{.extdecl, 
    importc: "mvwdeleteln", dynlib: pdcursesdll.}
proc mvwinsertln*(a2: ptr TWINDOW; a3: cint; a4: cint): cint{.extdecl, 
    importc: "mvwinsertln", dynlib: pdcursesdll.}
proc mvwinsrawch*(a2: ptr TWINDOW; a3: cint; a4: cint; a5: cunsignedlong): cint{.
    extdecl, importc: "mvwinsrawch", dynlib: pdcursesdll.}
proc raw_output*(a2: cunsignedchar): cint{.extdecl, importc: "raw_output", 
    dynlib: pdcursesdll.}
proc resize_term*(a2: cint; a3: cint): cint{.extdecl, importc: "resize_term", 
    dynlib: pdcursesdll.}
proc resize_window*(a2: ptr TWINDOW; a3: cint; a4: cint): ptr TWINDOW{.extdecl, 
    importc: "resize_window", dynlib: pdcursesdll.}
proc waddrawch*(a2: ptr TWINDOW; a3: cunsignedlong): cint{.extdecl, 
    importc: "waddrawch", dynlib: pdcursesdll.}
proc winsrawch*(a2: ptr TWINDOW; a3: cunsignedlong): cint{.extdecl, 
    importc: "winsrawch", dynlib: pdcursesdll.}
proc wordchar*(): char{.extdecl, importc: "wordchar", dynlib: pdcursesdll.}
proc slk_wlabel*(a2: cint): cstring{.extdecl, importc: "slk_wlabel", 
    dynlib: pdcursesdll.}
proc debug*(a2: cstring){.varargs, extdecl, importc: "PDC_debug", 
                          dynlib: pdcursesdll.}
proc ungetch*(a2: cint): cint{.extdecl, importc: "PDC_ungetch", 
                               dynlib: pdcursesdll.}
proc set_blink*(a2: cunsignedchar): cint{.extdecl, importc: "PDC_set_blink", 
    dynlib: pdcursesdll.}
proc set_line_color*(a2: cshort): cint{.extdecl, importc: "PDC_set_line_color", 
                                        dynlib: pdcursesdll.}
proc set_title*(a2: cstring){.extdecl, importc: "PDC_set_title", 
                              dynlib: pdcursesdll.}
proc clearclipboard*(): cint{.extdecl, importc: "PDC_clearclipboard", 
                              dynlib: pdcursesdll.}
proc freeclipboard*(a2: cstring): cint{.extdecl, importc: "PDC_freeclipboard", 
                                        dynlib: pdcursesdll.}
proc getclipboard*(a2: cstringArray; a3: ptr clong): cint{.extdecl, 
    importc: "PDC_getclipboard", dynlib: pdcursesdll.}
proc setclipboard*(a2: cstring; a3: clong): cint{.extdecl, 
    importc: "PDC_setclipboard", dynlib: pdcursesdll.}
proc get_input_fd*(): cunsignedlong{.extdecl, importc: "PDC_get_input_fd", 
                                     dynlib: pdcursesdll.}
proc get_key_modifiers*(): cunsignedlong{.extdecl, 
    importc: "PDC_get_key_modifiers", dynlib: pdcursesdll.}
proc return_key_modifiers*(a2: cunsignedchar): cint{.extdecl, 
    importc: "PDC_return_key_modifiers", dynlib: pdcursesdll.}
proc save_key_modifiers*(a2: cunsignedchar): cint{.extdecl, 
    importc: "PDC_save_key_modifiers", dynlib: pdcursesdll.}
proc bottom_panel*(pan: ptr TPANEL): cint{.extdecl, importc: "bottom_panel", 
    dynlib: pdcursesdll.}
proc del_panel*(pan: ptr TPANEL): cint{.extdecl, importc: "del_panel", 
                                       dynlib: pdcursesdll.}
proc hide_panel*(pan: ptr TPANEL): cint{.extdecl, importc: "hide_panel", 
                                        dynlib: pdcursesdll.}
proc move_panel*(pan: ptr TPANEL; starty: cint; startx: cint): cint{.extdecl, 
    importc: "move_panel", dynlib: pdcursesdll.}
proc new_panel*(win: ptr TWINDOW): ptr TPANEL{.extdecl, importc: "new_panel", 
    dynlib: pdcursesdll.}
proc panel_above*(pan: ptr TPANEL): ptr TPANEL{.extdecl, importc: "panel_above", 
    dynlib: pdcursesdll.}
proc panel_below*(pan: ptr TPANEL): ptr TPANEL{.extdecl, importc: "panel_below", 
    dynlib: pdcursesdll.}
proc panel_hidden*(pan: ptr TPANEL): cint{.extdecl, importc: "panel_hidden", 
    dynlib: pdcursesdll.}
proc panel_userptr*(pan: ptr TPANEL): pointer{.extdecl, importc: "panel_userptr", 
    dynlib: pdcursesdll.}
proc panel_window*(pan: ptr TPANEL): ptr TWINDOW{.extdecl, importc: "panel_window", 
    dynlib: pdcursesdll.}
proc replace_panel*(pan: ptr TPANEL; win: ptr TWINDOW): cint{.extdecl, 
    importc: "replace_panel", dynlib: pdcursesdll.}
proc set_panel_userptr*(pan: ptr TPANEL; uptr: pointer): cint{.extdecl, 
    importc: "set_panel_userptr", dynlib: pdcursesdll.}
proc show_panel*(pan: ptr TPANEL): cint{.extdecl, importc: "show_panel", 
                                        dynlib: pdcursesdll.}
proc top_panel*(pan: ptr TPANEL): cint{.extdecl, importc: "top_panel", 
                                       dynlib: pdcursesdll.}
proc update_panels*(){.extdecl, importc: "update_panels", dynlib: pdcursesdll.}

when unixOS:
  proc Xinitscr*(a2: cint; a3: cstringArray): ptr TWINDOW{.extdecl, 
    importc: "Xinitscr", dynlib: pdcursesdll.}
  proc XCursesExit*(){.extdecl, importc: "XCursesExit", dynlib: pdcursesdll.}
  proc sb_init*(): cint{.extdecl, importc: "sb_init", dynlib: pdcursesdll.}
  proc sb_set_horz*(a2: cint; a3: cint; a4: cint): cint{.extdecl, 
    importc: "sb_set_horz", dynlib: pdcursesdll.}
  proc sb_set_vert*(a2: cint; a3: cint; a4: cint): cint{.extdecl, 
    importc: "sb_set_vert", dynlib: pdcursesdll.}
  proc sb_get_horz*(a2: ptr cint; a3: ptr cint; a4: ptr cint): cint{.extdecl, 
    importc: "sb_get_horz", dynlib: pdcursesdll.}
  proc sb_get_vert*(a2: ptr cint; a3: ptr cint; a4: ptr cint): cint{.extdecl, 
    importc: "sb_get_vert", dynlib: pdcursesdll.}
  proc sb_refresh*(): cint{.extdecl, importc: "sb_refresh", dynlib: pdcursesdll.}

template getch*(): expr = 
  wgetch(stdscr)

template ungetch*(ch: expr): expr = 
  ungetch(ch)

template getbegyx*(w, y, x: expr): expr =
  y = getbegy(w)
  x = getbegx(w)

template getmaxyx*(w, y, x: expr): expr =
  y = getmaxy(w)
  x = getmaxx(w)

template getparyx*(w, y, x: expr): expr =
  y = getpary(w)
  x = getparx(w)

template getyx*(w, y, x: expr): expr =
  y = getcury(w)
  x = getcurx(w)

template getsyx*(y, x: expr): stmt = 
  if curscr.leaveit:
    (x) = - 1
    (y) = (x)
  else: getyx(curscr, (y), (x))
  
template getmouse*(x: expr): expr = 
  nc_getmouse(x)

when defined(windows):
  var
    atrtab*{.importc: "pdc_atrtab", dynlib: pdcursesdll.}: cstring
    con_out*{.importc: "pdc_con_out", dynlib: pdcursesdll.}: HANDLE
    con_in*{.importc: "pdc_con_in", dynlib: pdcursesdll.}: HANDLE
    quick_edit*{.importc: "pdc_quick_edit", dynlib: pdcursesdll.}: DWORD

  proc get_buffer_rows*(): cint{.extdecl, importc: "PDC_get_buffer_rows", 
                               dynlib: pdcursesdll.}