mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-15 22:32:19 +03:00
f81c37ea3a
To be able to use `C` functions for both Scheme and RefC: it was not possible for `Buffer` before this PR. As an example, `writeBufferData` and `readBufferData` functions are removed: generic C backend implementations are used instead.
28 lines
696 B
C
28 lines
696 B
C
#pragma once
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stdint.h>
|
|
|
|
typedef struct {
|
|
int size;
|
|
char data[];
|
|
} Buffer;
|
|
|
|
void* newBuffer(int bytes);
|
|
|
|
int getBufferSize(void* buffer);
|
|
|
|
void setBufferByte(void* buffer, int loc, int byte);
|
|
void setBufferInt(void* buffer, int loc, int64_t val);
|
|
void setBufferDouble(void* buffer, int loc, double val);
|
|
void setBufferString(void* buffer, int loc, char* str);
|
|
|
|
void copyBuffer(void* from, int start, int len,
|
|
void* to, int loc);
|
|
|
|
uint8_t getBufferByte(void* buffer, int loc);
|
|
int64_t getBufferInt(void* buffer, int loc);
|
|
double getBufferDouble(void* buffer, int loc);
|
|
char* getBufferString(void* buffer, int loc, int len);
|