Rev 7883 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7883 | Rev 7927 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #ifndef __jxl_Date_get_h__ |
1 | #ifndef __jxl_Date_get_h__ |
2 | #define __jxl_Date_get_h__ |
2 | #define __jxl_Date_get_h__ |
Line 3... | Line -... | ||
3 | - | ||
4 | typedef unsigned int uint32_t; |
3 | |
5 | typedef unsigned char uint8_t; |
- | |
6 | typedef unsigned short int uint16_t; |
- | |
7 | typedef unsigned long long uint64_t; |
- | |
8 | typedef char int8_t; |
- | |
9 | typedef short int int16_t; |
- | |
10 | typedef int int32_t; |
- | |
Line 11... | Line 4... | ||
11 | typedef long long int64_t; |
4 | #include |
12 | 5 | ||
13 | static inline uint32_t getDate(void) |
6 | static inline uint32_t getDate(void) |
14 | { |
7 | { |
Line 42... | Line 35... | ||
42 | static inline int32_t saveFile(uint32_t nbytes, uint8_t *data, uint32_t enc, uint8_t *path) |
35 | static inline int32_t saveFile(uint32_t nbytes, uint8_t *data, uint32_t enc, uint8_t *path) |
43 | { |
36 | { |
44 | int32_t val; |
37 | int32_t val; |
Line 45... | Line 38... | ||
45 | 38 | ||
46 | uint8_t dt[28]; // basic information structure. |
39 | struct file_op_t |
47 | 40 | { |
|
48 | (uint32_t) dt[0] = 2; // subfunction number. |
41 | uint32_t fn; |
49 | (uint32_t) dt[4] = 0; // reserved. |
42 | uint32_t reserved0; |
50 | (uint32_t) dt[8] = 0; // reserved. |
43 | uint32_t reserved1; |
51 | (uint32_t) dt[12] = nbytes; // number of bytes to write. |
44 | uint32_t number_of_bytes_to_write; |
52 | (uint8_t *) dt[16] = data; // pointer to data. |
45 | void * pointer_to_data; |
53 | (uint32_t) dt[20] = enc; // string encoding (0 = default, 1 = cp866, 2 = UTF-16LE, 3 = UTF-8). |
46 | char path[1]; |
54 | (uint8_t *) dt[24] = path; // pointer to path. |
47 | } *file_op = calloc(sizeof(*file_op) + strlen(path) + 2, 1); // FIXME: Not works on UTF16LE enc |
- | 48 | ||
55 | 49 | file_op->fn = 2; |
|
- | 50 | file_op->number_of_bytes_to_write = nbytes; |
|
- | 51 | file_op->pointer_to_data = data; |
|
- | 52 | if (enc != 0) |
|
- | 53 | { |
|
- | 54 | file_op->path[0] = enc; |
|
- | 55 | strcpy(file_op->path + 1, path); |
|
- | 56 | } |
|
- | 57 | else |
|
- | 58 | { |
|
- | 59 | strcpy(file_op->path, path); |
|
Line -... | Line 60... | ||
- | 60 | } |
|
56 | __asm__ __volatile__("int $0x40":"=a"(val):"a"(80), "b"(&dt)); |
61 | |
57 | 62 | asm volatile ("int $0x40":"=a"(val):"a"(80), "b"(file_op)); |
|
Line 58... | Line 63... | ||
58 | return val; |
63 | return val; |