~ubuntu-branches/ubuntu/jaunty/speech-tools/jaunty

« back to all changes in this revision

Viewing changes to siod/slib.cc

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Urlichs
  • Date: 2004-07-16 09:25:39 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040716092539-5p1tzif55b8j924e
Tags: 1:1.2.3-8
Added alaw processing code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
#include "siod.h"
89
89
#include "siodp.h"
90
90
 
 
91
#ifdef WIN32
 
92
#include "winsock2.h"
 
93
#endif
 
94
 
91
95
static int restricted_function_call(LISP l);
92
96
static long repl(struct repl_hooks *h);
93
97
static void gc_mark_and_sweep(void);
232
236
 
233
237
void print_hs_2(void)
234
238
{if (gc_kind_copying == 1)
235
 
   printf("heap_1 at %p, heap_2 at %p\n",heap_1,heap_2);
 
239
   printf("heap_1 at %p, heap_2 at %p\n",(void *)heap_1,(void *)heap_2);
236
240
 else
237
 
   printf("heap_1 at %p\n",heap_1);}
 
241
   printf("heap_1 at %p\n",(void *)heap_1);}
238
242
 
239
243
/* I don't have a clean way to do this but need to reset this if */
240
244
/* ctrl-c occurs. */
604
608
    stack_limit_ptr = STACK_LIMIT(stack_start_ptr,stack_size);}
605
609
 if NULLP(silent)
606
610
   {sprintf(tkbuffer,"Stack_size = %ld bytes, [%p,%p]\n",
607
 
            stack_size,stack_start_ptr,stack_limit_ptr);
 
611
            stack_size,(void *)stack_start_ptr,(void *)stack_limit_ptr);
608
612
    put_st(tkbuffer);
609
613
    return(NIL);}
610
614
 else
1492
1496
void f_ungetc(int c, FILE *f)
1493
1497
{ungetc(c,f);}
1494
1498
 
 
1499
#ifdef WIN32
 
1500
int winsock_unget_buffer;
 
1501
bool winsock_unget_buffer_unused=true;
 
1502
bool use_winsock_unget_buffer;
 
1503
 
 
1504
int f_getc_winsock(HANDLE h)
 
1505
{long iflag,dflag;
 
1506
 char c;
 
1507
 DWORD lpNumberOfBytesRead;
 
1508
 iflag = no_interrupt(1);
 
1509
 if (use_winsock_unget_buffer)
 
1510
 {
 
1511
        use_winsock_unget_buffer = false;
 
1512
        return winsock_unget_buffer;
 
1513
 }
 
1514
 
 
1515
 if (SOCKET_ERROR == recv((SOCKET)h,&c,1,0))
 
1516
 {
 
1517
    if (WSAECONNRESET == GetLastError()) // The connection was closed.
 
1518
        c=EOF;
 
1519
    else
 
1520
        cerr << "f_getc_winsock(): error reading from socket\n";
 
1521
 }
 
1522
 
 
1523
 winsock_unget_buffer=c;
 
1524
 winsock_unget_buffer_unused = false;
 
1525
 
 
1526
 no_interrupt(iflag);
 
1527
 return(c);}
 
1528
 
 
1529
void f_ungetc_winsock(int c, HANDLE h)
 
1530
{
 
1531
 if (winsock_unget_buffer_unused)
 
1532
 {
 
1533
  cerr << "f_ungetc_winsock: tried to unget before reading socket\n";
 
1534
 }
 
1535
use_winsock_unget_buffer = true;}
 
1536
#endif
 
1537
 
1495
1538
int flush_ws(struct gen_readio *f,const char *eoferr)
1496
1539
{int c,commentp;
1497
1540
 commentp = 0;
1518
1561
 }
1519
1562
 return(readtl(&s));}
1520
1563
 
 
1564
#ifdef WIN32
 
1565
LISP lreadwinsock(void)
 
1566
{
 
1567
        struct gen_readio s;
 
1568
        s.getc_fcn = (int (*)(char *))f_getc_winsock;
 
1569
        s.ungetc_fcn = (void (*)(int, char *))f_ungetc_winsock;
 
1570
        s.cb_argument = (char *) siod_server_socket;
 
1571
        return(readtl(&s));}
 
1572
#endif
 
1573
 
1521
1574
LISP readtl(struct gen_readio *f)
1522
1575
{int c;
1523
1576
 c = flush_ws(f,(char *)NULL);