10void putStr(const char *str) {
14void putErr(const char *str) {
18void mpz_init_set_ull(mpz_t n, unsigned long long ull)
20 mpz_init_set_ui(n, (unsigned int)(ull >> 32)); /* n = (unsigned int)(ull >> 32) */
21 mpz_mul_2exp(n, n, 32); /* n <<= 32 */
22 mpz_add_ui(n, n, (unsigned int)ull); /* n += (unsigned int)ull */
25void mpz_init_set_sll(mpz_t n, long long sll)
27 mpz_init_set_si(n, (int)(sll >> 32)); /* n = (int)sll >> 32 */
28 mpz_mul_2exp(n, n, 32 ); /* n <<= 32 */
29 mpz_add_ui(n, n, (unsigned int)sll); /* n += (unsigned int)sll */
32void mpz_set_sll(mpz_t n, long long sll)
34 mpz_set_si(n, (int)(sll >> 32)); /* n = (int)sll >> 32 */
35 mpz_mul_2exp(n, n, 32 ); /* n <<= 32 */
36 mpz_add_ui(n, n, (unsigned int)sll); /* n += (unsigned int)sll */
39unsigned long long mpz_get_ull(mpz_t n)
45 mpz_mod_2exp( tmp, n, 64 ); /* tmp = (lower 64 bits of n) */
47 lo = mpz_get_ui( tmp ); /* lo = tmp & 0xffffffff */
48 mpz_div_2exp( tmp, tmp, 32 ); /* tmp >>= 32 */
49 hi = mpz_get_ui( tmp ); /* hi = tmp & 0xffffffff */
53 return (((unsigned long long)hi) << 32) + lo;
56char *__idris_strCons(char c, char *s) {
57 size_t len = strlen(s);
58 char *result = GC_malloc_atomic(len+2);
60 memcpy(result+1, s, len);
66char *__idris_readStr(FILE* h) {
67// Modified from 'safe-fgets.c' in the gdb distribution.
68// (see http://www.gnu.org/software/gdb/current/)
70 char* line_buf = (char *) GC_malloc (BUFSIZE);
71 int line_buf_size = BUFSIZE;
73 /* points to last byte */
74 line_ptr = line_buf + line_buf_size - 1;
76 /* so we can see if fgets put a 0 there */
78 if (fgets (line_buf, line_buf_size, h) == 0)
81 /* we filled the buffer? */
82 while (line_ptr[0] == 0 && line_ptr[-1] != '\n')
84 /* Make the buffer bigger and read more of the line */
85 line_buf_size += BUFSIZE;
86 line_buf = (char *) GC_realloc (line_buf, line_buf_size);
88 /* points to last byte again */
89 line_ptr = line_buf + line_buf_size - 1;
90 /* so we can see if fgets put a 0 there */
93 if (fgets (line_buf + line_buf_size - BUFSIZE - 1, BUFSIZE + 1, h) == 0)
100void* fileOpen(char* name, char* mode) {
101 FILE* f = fopen(name, mode);
105void fileClose(void* h) {
110int fileEOF(void* h) {
115int fileError(void* h) {
120void fputStr(void* h, char* str) {
125int isNull(void* ptr) {
129char* getEnvPair(int i) {
130 return *(environ + i);
133void idris_memset(void* ptr, size_t offset, uint8_t c, size_t size) {
134 memset(((uint8_t*)ptr) + offset, c, size);
137uint8_t idris_peek(void* ptr, size_t offset) {
138 return *(((uint8_t*)ptr) + offset);
141void idris_poke(void* ptr, size_t offset, uint8_t data) {
142 *(((uint8_t*)ptr) + offset) = data;
145void idris_memmove(void* dest, void* src, size_t dest_offset, size_t src_offset, size_t size) {
146 memmove(dest + dest_offset, src + src_offset, size);
149void *__idris_gmpMalloc(size_t size) {
150 return GC_malloc(size);
153void *__idris_gmpRealloc(void *ptr, size_t oldSize, size_t size) {
154 return GC_realloc(ptr, size);
157void __idris_gmpFree(void *ptr, size_t oldSize) {
161char *__idris_strRev(const char *s) {
164 char *t = GC_malloc(x+1);
180const char* idris_getArg(int i) {
181 return __idris_argv[i];
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list