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

« back to all changes in this revision

Viewing changes to siod/slib_server.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:
37
37
        fwrite((const char *)m,sizeof(char),m.length(),fd);
38
38
        fwrite("\n",1,1,fd);
39
39
        fclose(fd);
 
40
#ifdef WIN32
 
41
        send(siod_server_socket,"LP\n",3,0);
 
42
#else
40
43
        write(siod_server_socket,"LP\n",3);
 
44
#endif
41
45
        socket_send_file(siod_server_socket,tmpfile);
42
46
        unlink(tmpfile);
43
47
    }
51
55
    // Thanks to mcb for pointing out this omission
52
56
    
53
57
    if (siod_server_socket != -1)
 
58
#ifdef WIN32
 
59
        send(siod_server_socket,"ER\n",3,0);
 
60
#else
54
61
        write(siod_server_socket,"ER\n",3);
 
62
#endif
55
63
 
56
64
}
57
65
    
59
67
{   // simple return "OK" -- used in server socket mode
60
68
 
61
69
    siod_send_lisp_to_client(x);
62
 
 
 
70
#ifdef WIN32
 
71
    send(siod_server_socket,"OK\n",3,0);
 
72
#else
63
73
    write(siod_server_socket,"OK\n",3);
 
74
#endif
64
75
}
65
76
 
66
77
static void ignore_puts(char *x)
73
84
    /* Read from given fd as stdin */
74
85
    struct repl_hooks hd;
75
86
 
 
87
#ifdef WIN32
 
88
    if (!SetStdHandle(STD_INPUT_HANDLE,(HANDLE)fd))
 
89
    {
 
90
        GetLastError();
 
91
        cerr << "repl_from_socket: couldn't set stdin to socket\n";
 
92
    }
 
93
#else
76
94
    dup2(fd,0);                     // make socket into stdin
77
95
    // dup2(fd,1);                     // make socket into stdout
 
96
#endif
78
97
    hd.repl_puts = ignore_puts;
79
98
    hd.repl_print = acknowledge_sock_print;
80
99
    hd.repl_eval = NULL;
 
100
#ifdef WIN32
 
101
    hd.repl_read = lreadwinsock;
 
102
#else
81
103
    hd.repl_read = NULL;
 
104
#endif
82
105
    siod_interactive = FALSE;
83
106
    siod_server_socket = fd;
84
107