Subversion Repositories HelenOS-historic

Rev

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

Rev 1065 Rev 1073
Line 44... Line 44...
44
 
44
 
45
static void test_printf(void)
45
static void test_printf(void)
46
{
46
{
47
    printf("Simple text.\n");
47
    printf("Simple text.\n");
48
    printf("Now insert '%s' string.\n","this");
48
    printf("Now insert '%s' string.\n","this");
49
    printf("We are brave enought to print numbers like %%d = '%d'\n", 0x123456);
49
    printf("Signed formats on uns. numbers: '%d', '%+d', '% d', '%u' (,+, ,u)\n", 321, 321, 321, 321);
-
 
50
    printf("Signed formats on sig. numbers: '%d', '%+d', '% d', '%u' (,+, ,u)\n", -321, -321, -321, -321);
-
 
51
    printf("Signed with different sized: '%hhd', '%hd', '%d', '%ld', %lld;\n", -3, -32, -321, -32101l, -3210123ll);
50
    printf("And now... '%b' byte! '%w' word! '%W' Word! \n", 0x12, 0x1234, 0x1234);
52
    printf("And now... '%hhd' byte! '%hd' word! '%d' int! \n", 11, 11111, 1111111111);
-
 
53
    printf("Different bases: %#hx, %#hu, %#ho and %#hb\n", 123, 123, 123, 123);
-
 
54
    printf("Different bases signed: %#hx, %#hu, %#ho and %#hb\n", -123, -123, -123, -123);
51
    printf("'%Q' Q! Another '%q' q! \n", 0x1234567887654321ll, 0x1234567887654321ll);
55
    printf("'%llX' llX! Another '%llx' llx! \n", 0x1234567887654321ll, 0x1234567887654321ll);
52
    printf("'%Q' with 64bit value and '%p' with 32 bit value. \n", 0x1234567887654321ll, 0x12345678 );
56
    printf("'%llX' with 64bit value and '%x' with 32 bit value. \n", 0x1234567887654321ll, 0x12345678 );
53
    printf("'%Q' 64bit, '%p' 32bit, '%b' 8bit, '%w' 16bit, '%Q' 64bit and '%s' string.\n", 0x1234567887654321ll, 0x12345678, 0x12, 0x1234, 0x1234567887654321ull, "Lovely string" );
57
    printf("'%llx' 64bit, '%x' 32bit, '%hhx' 8bit, '%hx' 16bit, '%llX' 64bit and '%s' string.\n", 0x1234567887654321ll, 0x12345678, 0x12, 0x1234, 0x1234567887654321ull, "Lovely string" );
54
   
58
   
55
    printf("Thats all, folks!\n");
59
    printf("Thats all, folks!\n");
56
}
60
}
57
 
61
 
58
 
62
 
Line 110... Line 114...
110
    printf("Retval: %d - received: %P\n", retval, result);
114
    printf("Retval: %d - received: %P\n", retval, result);
111
}
115
}
112
 
116
 
113
static void got_answer(void *private, int retval, ipc_data_t *data)
117
static void got_answer(void *private, int retval, ipc_data_t *data)
114
{
118
{
115
    printf("Retval: %d...%s...%X, %X\n", retval, private,
119
    printf("Retval: %d...%s...%zX, %zX\n", retval, private,
116
           IPC_GET_ARG1(*data), IPC_GET_ARG2(*data));
120
           IPC_GET_ARG1(*data), IPC_GET_ARG2(*data));
117
}
121
}
118
static void test_async_ipc(void)
122
static void test_async_ipc(void)
119
{
123
{
120
    ipc_call_t data;
124
    ipc_call_t data;
Line 154... Line 158...
154
    ipc_call_t data;
158
    ipc_call_t data;
155
    int i;
159
    int i;
156
 
160
 
157
    printf("Asking 0 to connect to me...\n");
161
    printf("Asking 0 to connect to me...\n");
158
    res = ipc_connect_to_me(0, 1, 2, &taskid);
162
    res = ipc_connect_to_me(0, 1, 2, &taskid);
159
    printf("Result: %d - taskid: %Q\n", res, taskid);
163
    printf("Result: %d - taskid: %llu\n", res, taskid);
160
    for (i=0; i < 100; i++) {
164
    for (i=0; i < 100; i++) {
161
        printf("----------------\n");
165
        printf("----------------\n");
162
        ipc_call_async(PHONE_NS, NS_PING_SVC, 0, "prov",
166
        ipc_call_async(PHONE_NS, NS_PING_SVC, 0, "prov",
163
                   got_answer_2);
167
                   got_answer_2);
164
        callid = ipc_wait_for_call(&data, NULL);
168
        callid = ipc_wait_for_call(&data, NULL);
Line 176... Line 180...
176
    printf("Starting connect...\n");
180
    printf("Starting connect...\n");
177
    res = ipc_connect_me_to(PHONE_NS, 10, 20);
181
    res = ipc_connect_me_to(PHONE_NS, 10, 20);
178
    printf("Connected: %d\n", res);
182
    printf("Connected: %d\n", res);
179
    printf("pinging.\n");
183
    printf("pinging.\n");
180
    res = ipc_call_sync(res, NS_PING, 0xbeef,&result);
184
    res = ipc_call_sync(res, NS_PING, 0xbeef,&result);
181
    printf("Retval: %d - received: %P\n", res, result);
185
    printf("Retval: %d - received: %zd\n", res, result);
182
   
186
   
183
}
187
}
184
 
188
 
185
int main(int argc, char *argv[])
189
int main(int argc, char *argv[])
186
{
190
{