*/
#include <stdio.h>
+#ifndef _WIN32
#include <unistd.h>
+#else
+#include <io.h>
+typedef int ssize_t;
+#endif
#include <fcntl.h>
#include <sys/stat.h>
#include <string.h>
+#define PTB_CORE
#include "ptb.h"
-#include <glib.h>
int assert_is_fatal = 0;
#define ptb_assert(ptb, expr) \
if (!(expr)) { ptb_debug("---------------------------------------------"); \
- ptb_debug("file: %s, line: %d (%s): assertion failed: %s. Current position: 0x%lx", __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr, ptb->curpos); \
+ ptb_debug("file: %s, line: %d (%s): assertion failed: %s. Current position: 0x%lx", __FILE__, __LINE__, G_GNUC_PRETTY_FUNCTION, #expr, ptb->curpos); \
if(assert_is_fatal) abort(); \
}
void ptb_debug(const char *fmt, ...);
-#define read DONT_USE_READ
-
int debugging = 0;
-ssize_t ptb_read(struct ptbf *f, void *data, size_t length){
-#undef read
+ssize_t ptb_read(struct ptbf *f, void *data, size_t length)
+{
ssize_t ret = read(f->fd, data, length);
#define read DONT_USE_READ
char unknown[255];
ssize_t ret;
off_t oldpos = f->curpos;
- int i;
+ size_t i;
ret = ptb_read(f, unknown, length);
if(debugging) {
#include <glib.h>
#include <stdlib.h>
+#define PTB_VERSION "0.4"
+
+#if defined(_WIN32) && !defined(PTB_CORE)
+#pragma comment(lib,"ptb.lib")
+#endif
+
typedef guint8 ptb_chord;
typedef guint8 ptb_tone;
typedef guint8 ptb_note;
guint16 year;
} bootleg;
struct {
+ char empty;
} unreleased;
} release_info;
guint8 is_original_author_unknown;
void ptb_get_position_difference(struct ptb_section *, int start, int end, int *bars, int *length);
-#endif /* __PTB_H__ */
+#endif /* __PTB_H__ */
\ No newline at end of file
#include <string.h>
#include "ptb.h"
-#define LILYPOND_VERSION "2.4"
+#define LILYPOND_VERSION "0.4"
const char *num_to_string(int num, char *data)
{
const char *get_staff_name(int sec_num, int staff_num)
{
static char name[30], num[2][30];
- snprintf(name, sizeof(name), "staff%sx%s", num_to_string(sec_num, num[0]), num_to_string(staff_num, num[1]));
+ g_snprintf(name, sizeof(name), "staff%sx%s", num_to_string(sec_num, num[0]), num_to_string(staff_num, num[1]));
return name;
}
ly_write_chordtext_helper(out, name, length);
}
-static float previous = 0.0;
+static double previous = 0.0;
void ly_write_position(FILE *out, struct ptb_position *pos)
{
- float this = 0.0;
+ double this = 0.0;
char print_length = 0;
GList *gl = pos->linedatas;
int l = g_list_length(pos->linedatas);
#include <errno.h>
#include <string.h>
#include <popt.h>
-#include <sys/time.h>
+//#include <sys/time.h>
#include <time.h>
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
--- /dev/null
+EXPORTS\r
+ ptb_read_file\r
+ ptb_set_debug\r
+ ptb_set_asserts_fatal\r
+ ptb_get_tone\r
+ ptb_get_tone_full\r
+ ptb_get_position_difference\r