X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Fsega.c;h=3a271cd2a94be177795a3fc0e4057fe7c38620f4;hb=81235413d6a56ca849923c4d425e976f6759a799;hp=d4d04d277de3f8a6768a4f9ffdca5af79a0920ac;hpb=f46812eee344744353471ae7dfd56abd9cb56ec4;p=16.git diff --git a/src/sega.c b/src/sega.c old mode 100644 new mode 100755 index d4d04d27..3a271cd2 --- a/src/sega.c +++ b/src/sega.c @@ -2,20 +2,33 @@ #include #include -struct list { - struct list __based(__self) *next; - int value; +struct list { +#ifdef __WATCOMC__ + struct list __based(__self) *next; +#endif +#ifdef __BORLANDC__ + struct list _seg *next; +#endif + int value; }; void main(int argc, char *argv[]) - { - int i; - __segment segu; - struct list __based(segu) *head; - struct list __based(segu) *p; +{ + int i; +#ifdef __WATCOMC__ + __segment segu; + void __based(__self) *pee; + struct list __based(segu) *head; + struct list __based(segu) *p; +#endif +#ifdef __BORLANDC__ + void _seg *pee; + struct list _seg *head; + struct list _seg *p; +#endif /* allocate based heap */ - segu = _bheapseg( 1024 ); + segu = _bheapseg( 65536 ); if( segu == _NULLSEG ) { printf( "Unable to allocate based heap\n" ); exit( 1 ); @@ -23,7 +36,7 @@ void main(int argc, char *argv[]) /* create a linked list in the based heap */ head = 0; - for( i = 1; i < 10; i++ ) { + for( i = 1; i < 4096; i++ ) { p = _bmalloc( segu, sizeof( struct list ) ); if( p == _NULLOFF ) { printf( "_bmalloc failed\n" ); @@ -36,9 +49,13 @@ void main(int argc, char *argv[]) /* traverse the linked list, printing out values */ for( p = head; p != 0; p = p->next ) { - printf("Segu = %04X %FP", p, p); - printf( " Value = %d\n", p->value ); + if(p==head || p->next==0 || p==pee){ + printf("Segu = %04X", p); printf( " Value = %d\n", p->value ); + } } + + printf("program=%FP\n", *argv[0]); + printf("seg=%04X\n", segu); /* free all the elements of the linked list */ for( ; p = head; ) { @@ -47,6 +64,4 @@ void main(int argc, char *argv[]) } /* free the based heap */ _bfreeseg( segu ); - printf("program=%P\n", *argv[0]); - printf("seg=%P\n", segu); }