Subversion Repositories HelenOS

Rev

Rev 2479 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2479 Rev 2619
Line 115... Line 115...
115
    int newcol,newrow;
115
    int newcol,newrow;
116
    int fgcolor,bgcolor;
116
    int fgcolor,bgcolor;
117
    int i;
117
    int i;
118
 
118
 
119
    if (client_connected) {
119
    if (client_connected) {
120
        ipc_answer_fast(iid, ELIMIT, 0,0);
120
        ipc_answer_0(iid, ELIMIT);
121
        return;
121
        return;
122
    }
122
    }
123
   
123
   
124
    client_connected = 1;
124
    client_connected = 1;
125
    ipc_answer_fast(iid, 0, 0, 0); /* Accept connection */
125
    ipc_answer_0(iid, EOK); /* Accept connection */
126
    while (1) {
126
    while (1) {
127
        callid = async_get_call(&call);
127
        callid = async_get_call(&call);
128
        switch (IPC_GET_METHOD(call)) {
128
        switch (IPC_GET_METHOD(call)) {
129
            case IPC_M_PHONE_HUNGUP:
129
        case IPC_M_PHONE_HUNGUP:
130
                client_connected = 0;
130
            client_connected = 0;
131
                ipc_answer_fast(callid, 0, 0, 0);
131
            ipc_answer_0(callid, EOK);
132
                return; /* Exit thread */
132
            return; /* Exit thread */
133
            case FB_PUTCHAR:
133
        case FB_PUTCHAR:
134
                c = IPC_GET_ARG1(call);
134
            c = IPC_GET_ARG1(call);
135
                newrow = IPC_GET_ARG2(call);
135
            newrow = IPC_GET_ARG2(call);
136
                newcol = IPC_GET_ARG3(call);
136
            newcol = IPC_GET_ARG3(call);
137
                if ((lastcol != newcol) || (lastrow != newrow))
137
            if ((lastcol != newcol) || (lastrow != newrow))
138
                    curs_goto(newrow, newcol);
-
 
139
                lastcol = newcol + 1;
-
 
140
                lastrow = newrow;
-
 
141
                sysput(c);
-
 
142
                retval = 0;
-
 
143
                break;
-
 
144
            case FB_CURSOR_GOTO:
-
 
145
                newrow = IPC_GET_ARG1(call);
-
 
146
                newcol = IPC_GET_ARG2(call);
-
 
147
                curs_goto(newrow, newcol);
138
                curs_goto(newrow, newcol);
-
 
139
            lastcol = newcol + 1;
148
                lastrow = newrow;
140
            lastrow = newrow;
-
 
141
            sysput(c);
-
 
142
            retval = 0;
-
 
143
            break;
-
 
144
        case FB_CURSOR_GOTO:
-
 
145
            newrow = IPC_GET_ARG1(call);
-
 
146
            newcol = IPC_GET_ARG2(call);
-
 
147
            curs_goto(newrow, newcol);
-
 
148
            lastrow = newrow;
149
                lastcol = newcol;
149
            lastcol = newcol;
150
                retval = 0;
150
            retval = 0;
151
                break;
151
            break;
152
            case FB_GET_CSIZE:
152
        case FB_GET_CSIZE:
153
                ipc_answer_fast(callid, 0, HEIGHT, WIDTH);
153
            ipc_answer_2(callid, EOK, HEIGHT, WIDTH);
154
                continue;
154
            continue;
155
            case FB_CLEAR:
155
        case FB_CLEAR:
156
                clrscr();
156
            clrscr();
157
                retval = 0;
157
            retval = 0;
158
                break;
158
            break;
159
            case FB_SET_STYLE:
159
        case FB_SET_STYLE:
160
                fgcolor = IPC_GET_ARG1(call);
160
            fgcolor = IPC_GET_ARG1(call);
161
                bgcolor = IPC_GET_ARG2(call);
161
            bgcolor = IPC_GET_ARG2(call);
162
                if (fgcolor < bgcolor)
162
            if (fgcolor < bgcolor)
163
                    set_style(0);
163
                set_style(0);
164
                else
164
            else
165
                    set_style(7);
165
                set_style(7);
166
                retval = 0;
166
            retval = 0;
167
                break;
167
            break;
168
            case FB_SCROLL:
168
        case FB_SCROLL:
169
                i = IPC_GET_ARG1(call);
169
            i = IPC_GET_ARG1(call);
170
                if ((i > HEIGHT) || (i < -HEIGHT)) {
170
            if ((i > HEIGHT) || (i < -HEIGHT)) {
171
                    retval = EINVAL;
171
                retval = EINVAL;
172
                    break;
-
 
173
                }
-
 
174
                scroll(i);
-
 
175
                curs_goto(lastrow, lastcol);
-
 
176
                retval = 0;
-
 
177
                break;
172
                break;
-
 
173
            }
-
 
174
            scroll(i);
-
 
175
            curs_goto(lastrow, lastcol);
-
 
176
            retval = 0;
-
 
177
            break;
178
            default:
178
        default:
179
                retval = ENOENT;
179
            retval = ENOENT;
180
        }
180
        }
181
       
181
       
182
        ipc_answer_fast(callid, retval, 0, 0);
182
        ipc_answer_0(callid, retval);
183
    }
183
    }
184
}
184
}
185
 
185
 
186
/** ANSI terminal emulation initialization */
186
/** ANSI terminal emulation initialization */
187
void sysio_init(void)
187
void sysio_init(void)