Skip to content

Commit 6a735ba

Browse files
committed
update #if's to include OW (builds but not functional)
1 parent 3c13a5c commit 6a735ba

File tree

1 file changed

+35
-18
lines changed

1 file changed

+35
-18
lines changed

src/share.c

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,23 @@ static void interrupt far handler2f(intregs_t iregs) {
294294
/* nasm -fobj -o foo.obj foo.asm ... */
295295

296296
#elif defined(__GNUC__) || defined(__WATCOMC__)
297+
298+
#if defined(__WATCOMC__)
299+
#pragma aux (__gcc16) i2D_next
300+
#pragma aux (__gcc16) i2D_handler
301+
302+
#pragma aux amisnum "*"
303+
#pragma aux (__gcc16) asm_find_resident
304+
#pragma aux (__gcc16) asm_uninstall
305+
#pragma aux (__gcc16) asm_enable
306+
#pragma aux (__gcc16) asm_disable
307+
#pragma aux (__gcc16) asm_init
308+
309+
#pragma aux (__gcc16) asm_get_status
310+
311+
#pragma aux top_of_stack "*"
312+
#endif
313+
297314
/* Within IBM Interrupt Sharing Protocol header */
298315
extern void __far __interrupt (*i2D_next)(void);
299316
/* Prototype for NASM interrupt handler function */
@@ -403,7 +420,7 @@ static void remove_all_locks(int fileno) {
403420
lptr = &lock_table[i];
404421
if (lptr->used && lptr->fileno == fileno) {
405422
lptr->used = 0;
406-
#if defined(__GNUC__)
423+
#if defined(__GNUC__) || defined(__WATCOMC__)
407424
++ lock_table_free;
408425
#endif
409426
}
@@ -412,7 +429,7 @@ static void remove_all_locks(int fileno) {
412429

413430
static void free_file_table_entry(int fileno) {
414431
file_table[fileno].filename[0] = '\0';
415-
#if defined(__GNUC__)
432+
#if defined(__GNUC__) || defined(__WATCOMC__)
416433
++ file_table_free;
417434
#endif
418435
}
@@ -557,7 +574,7 @@ static int open_check
557574
for (i = 0; i < sizeof(fptr->filename); i++) {
558575
if ((fptr->filename[i] = filename[i]) == '\0') break;
559576
}
560-
#if defined(__GNUC__)
577+
#if defined(__GNUC__) || defined(__WATCOMC__)
561578
-- file_table_free;
562579
#endif
563580
fptr->psp = psp;
@@ -666,7 +683,7 @@ static int lock_unlock
666683
&& (lptr->start == ofs)
667684
&& (lptr->end == endofs) ) {
668685
lptr->used = 0;
669-
#if defined(__GNUC__)
686+
#if defined(__GNUC__) || defined(__WATCOMC__)
670687
++ lock_table_free;
671688
#endif
672689
return 0;
@@ -687,7 +704,7 @@ static int lock_unlock
687704
lptr->end = ofs+(unsigned long)len;
688705
lptr->fileno = fileno;
689706
lptr->psp = psp;
690-
#if defined(__GNUC__)
707+
#if defined(__GNUC__) || defined(__WATCOMC__)
691708
-- lock_table_free;
692709
#endif
693710
return 0;
@@ -771,7 +788,7 @@ unsigned short init_tables(void) {
771788
return paras;
772789
}
773790

774-
#if !defined(__GNUC__)
791+
#if defined(__TURBOC__)
775792
static const char msg_usage_3[] NON_RES_RODATA = "%s [/F:space] [/L:locks]\n";
776793
#else
777794
static const char msg_usage_4[] NON_RES_RODATA = "%s [/F:space] [/L:locks] [/U] [/S] [/O] [/D] [/E]\n";
@@ -791,7 +808,7 @@ static const char msg_outofmemory[] NON_RES_RODATA = "%s: out of memory!\n";
791808
static const char msg_invalidhandler2f[] NON_RES_RODATA = "%s: invalid interrupt 2Fh handler!\n";
792809
static const char msg_installed[] NON_RES_RODATA = "%s: installed.\n";
793810

794-
#if defined(__GNUC__)
811+
#if defined(__GNUC__) || defined(__WATCOMC__)
795812
static const char msg_alreadyinstalled_no_amis[] NON_RES_RODATA = "%s: is already installed, but not found on AMIS interrupt!\n";
796813
static const char msg_enabled[] NON_RES_RODATA = "%s: enabled.\n";
797814
static const char msg_disabled[] NON_RES_RODATA = "%s: disabled.\n";
@@ -822,14 +839,14 @@ static const char msg_filetable_disabled[] NON_RES_RODATA = "File table: %u tota
822839
#endif
823840

824841
static void usage(void) {
825-
#if defined(__GNUC__)
842+
#if defined(__GNUC__) || defined(__WATCOMC__)
826843
PRINTF(catgets(cat, 0, 4, msg_usage_4), progname);
827844
#else
828845
PRINTF(catgets(cat, 0, 3, msg_usage_3), progname);
829846
#endif
830847
PRINTF(catgets(cat, 0, 1, msg_usage_1));
831848
PRINTF(catgets(cat, 0, 2, msg_usage_2));
832-
#if defined(__GNUC__)
849+
#if defined(__GNUC__) || defined(__WATCOMC__)
833850
PRINTF(catgets(cat, 0, 5, msg_usage_5));
834851
PRINTF(catgets(cat, 0, 6, msg_usage_6));
835852
PRINTF(catgets(cat, 0, 7, msg_usage_7));
@@ -843,7 +860,7 @@ static void bad_params(void) {
843860
PRINTF(catgets(cat, 1, 0, msg_badparams), progname);
844861
}
845862

846-
#if defined(__GNUC__)
863+
#if defined(__GNUC__) || defined(__WATCOMC__)
847864
/* Naive implementation of atol(), only decimal digits allowed, no signs */
848865
static long minimal_atol(const char *s) NON_RES_TEXT;
849866
static long minimal_atol(const char *s) {
@@ -916,7 +933,7 @@ int main(int argc, char **argv) {
916933
unsigned short far *usfptr;
917934
unsigned short top_of_tsr;
918935
int installed = 0;
919-
#if defined(__GNUC__)
936+
#if defined(__GNUC__) || defined(__WATCOMC__)
920937
status_struct s;
921938
uint8_t far * share_installed = NULL;
922939
uint8_t priorflag = 0;
@@ -928,7 +945,7 @@ int main(int argc, char **argv) {
928945
int i;
929946
uint8_t ii;
930947

931-
#if defined(__GNUC__)
948+
#if defined(__GNUC__) || defined(__WATCOMC__)
932949
file_table_size_bytes = 2048;
933950
#endif
934951

@@ -978,7 +995,7 @@ int main(int argc, char **argv) {
978995
case '?':
979996
usage();
980997
return 3;
981-
#if defined(__GNUC__)
998+
#if defined(__GNUC__) || defined(__WATCOMC__)
982999
case 'u':
9831000
case 'U':
9841001
case 'r':
@@ -1037,7 +1054,7 @@ int main(int argc, char **argv) {
10371054
}
10381055
}
10391056

1040-
#if defined(__GNUC__)
1057+
#if defined(__GNUC__) || defined(__WATCOMC__)
10411058
(void)asm_init();
10421059
mpx = asm_find_resident();
10431060
asm_get_status(mpx, &s);
@@ -1139,7 +1156,7 @@ int main(int argc, char **argv) {
11391156
/* Now try to install. */
11401157
#endif
11411158

1142-
#if defined(__GNUC__)
1159+
#if defined(__GNUC__) || defined(__WATCOMC__)
11431160
if (onlyoptions || disablerequested || enablerequested) {
11441161
PRINTF(catgets(cat, 1, 20, msg_prefixed_notresident), progname);
11451162
return 11;
@@ -1158,7 +1175,7 @@ int main(int argc, char **argv) {
11581175
return 5;
11591176
}
11601177

1161-
#if defined(__GNUC__)
1178+
#if defined(__GNUC__) || defined(__WATCOMC__)
11621179
top_of_tsr += 4; // Add 64 bytes for stack
11631180
top_of_stack = (top_of_tsr << 4);
11641181

@@ -1195,7 +1212,7 @@ int main(int argc, char **argv) {
11951212
/* Hook the interrupt for the handler routine. */
11961213
/* disable(); */
11971214
i2D_next = getvect(0x2D);
1198-
setvect(0x2D, i2D_handler);
1215+
setvect(0x2D, i2D_handler); /* TODO this causes relocation on TC & OW */
11991216
#endif
12001217
old_handler2f = getvect(MUX_INT_NO);
12011218
#if defined(__TURBOC__) && (__TURBOC__ >= 0x0300)
@@ -1212,7 +1229,7 @@ int main(int argc, char **argv) {
12121229

12131230
/* Let them know we're installed. */
12141231
PRINTF(catgets(cat, 1, 4, msg_installed), progname);
1215-
#if defined(__GNUC__)
1232+
#if defined(__GNUC__) || defined(__WATCOMC__)
12161233
if (statusrequested) {
12171234
(void)displaystatus(amisnum);
12181235
}

0 commit comments

Comments
 (0)