Work on 64 bit support

parent f06f6190
......@@ -22,6 +22,7 @@
*
*/
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -138,7 +139,7 @@ static int bgDoLoad(void *d) {
/* --------------------------------------------------------------------------- */
// Maps curl_formadd
int bgd_curl_formadd(INSTANCE *my, int *params) {
int bgd_curl_formadd(INSTANCE *my, intptr_t *params) {
int retval = 0;
if (params[0] == -1 || params[0] > MAX_DOWNLOADS)
......@@ -156,7 +157,7 @@ int bgd_curl_formadd(INSTANCE *my, int *params) {
}
// Maps curl_formfree
int bgd_curl_formfree(INSTANCE *my, int *params) {
int bgd_curl_formfree(INSTANCE *my, intptr_t *params) {
if (params[0] == -1 || params[0] > MAX_DOWNLOADS)
return -1;
......@@ -167,7 +168,7 @@ int bgd_curl_formfree(INSTANCE *my, int *params) {
}
// Maps curl_easy_init
int bgd_curl_easy_init(INSTANCE *my, int *params) {
int bgd_curl_easy_init(INSTANCE *my, intptr_t *params) {
int i;
// Get the index of the connection
......@@ -183,7 +184,7 @@ int bgd_curl_easy_init(INSTANCE *my, int *params) {
}
// Maps curl_easy_cleanup
int bgd_curl_easy_cleanup(INSTANCE *my, int *params) {
int bgd_curl_easy_cleanup(INSTANCE *my, intptr_t *params) {
if (params[0] == -1 || params[0] > MAX_DOWNLOADS)
return -1;
......@@ -195,7 +196,7 @@ int bgd_curl_easy_cleanup(INSTANCE *my, int *params) {
}
// Maps curl_easy_setopt for options which require an integer
int bgd_curl_easy_setopt(INSTANCE *my, int *params) {
int bgd_curl_easy_setopt(INSTANCE *my, intptr_t *params) {
if (params[0] == -1 || params[0] > MAX_DOWNLOADS)
return -1;
......@@ -217,7 +218,7 @@ int bgd_curl_easy_setopt(INSTANCE *my, int *params) {
}
// Maps curl_easy_setopt for options which require a string
int bgd_curl_easy_setopt2(INSTANCE *my, int *params) {
int bgd_curl_easy_setopt2(INSTANCE *my, intptr_t *params) {
if (params[0] == -1 || params[0] > MAX_DOWNLOADS)
return -1;
......@@ -248,7 +249,7 @@ int bgd_curl_easy_setopt2(INSTANCE *my, int *params) {
}
// Maps curl_easy_setopt when downloading data to a string directly
int bgd_curl_easy_setopt3(INSTANCE *my, int *params) {
int bgd_curl_easy_setopt3(INSTANCE *my, intptr_t *params) {
if (params[0] == -1 || params[0] > MAX_DOWNLOADS)
return -1;
......@@ -305,7 +306,7 @@ int curl_perform(int id) {
}
// Map curl_easy_perform
int bgd_curl_easy_perform(INSTANCE *my, int *params) {
int bgd_curl_easy_perform(INSTANCE *my, intptr_t *params) {
bgdata *t = prep(params);
t->fn = curl_perform;
......
......@@ -25,18 +25,19 @@
#ifndef __MODCURL_SYMBOLS_H
#define __MODCURL_SYMBOLS_H
#include <stdint.h>
#include <curl/curl.h>
#include <pxtdl.h>
#ifndef __PXTB__
extern int bgd_curl_easy_init(INSTANCE * my, int * params);
extern int bgd_curl_easy_cleanup(INSTANCE * my, int * params);
extern int bgd_curl_formadd(INSTANCE * my, int * params);
extern int bgd_curl_formfree(INSTANCE * my, int * params);
extern int bgd_curl_easy_setopt(INSTANCE * my, int * params);
extern int bgd_curl_easy_setopt2(INSTANCE * my, int * params);
extern int bgd_curl_easy_setopt3(INSTANCE * my, int * params);
extern int bgd_curl_easy_perform(INSTANCE * my, int * params);
extern int bgd_curl_easy_init(INSTANCE * my, intptr_t * params);
extern int bgd_curl_easy_cleanup(INSTANCE * my, intptr_t * params);
extern int bgd_curl_formadd(INSTANCE * my, intptr_t * params);
extern int bgd_curl_formfree(INSTANCE * my, intptr_t * params);
extern int bgd_curl_easy_setopt(INSTANCE * my, intptr_t * params);
extern int bgd_curl_easy_setopt2(INSTANCE * my, intptr_t * params);
extern int bgd_curl_easy_setopt3(INSTANCE * my, intptr_t * params);
extern int bgd_curl_easy_perform(INSTANCE * my, intptr_t * params);
extern void __pxtexport( mod_curl, module_initialize )();
extern void __pxtexport( mod_curl, module_finalize )();
......
......@@ -27,6 +27,7 @@
*
*/
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -78,7 +79,7 @@ enum {
/* ----------------------------------------------------------------- */
/* DIRECTORY FUNCTIONS */
int moddir_cd(INSTANCE *my, int *params) {
int moddir_cd(INSTANCE *my, intptr_t *params) {
char *d = dir_current();
int r = string_new(d);
string_use(r);
......@@ -87,28 +88,28 @@ int moddir_cd(INSTANCE *my, int *params) {
return r;
}
int moddir_chdir(INSTANCE *my, int *params) {
int moddir_chdir(INSTANCE *my, intptr_t *params) {
const char *d = string_get(params[0]);
int ret = dir_change(d);
string_discard(params[0]);
return (ret);
}
int moddir_mkdir(INSTANCE *my, int *params) {
int moddir_mkdir(INSTANCE *my, intptr_t *params) {
const char *d = string_get(params[0]);
int ret = dir_create(d);
string_discard(params[0]);
return (ret);
}
int moddir_rmdir(INSTANCE *my, int *params) {
int moddir_rmdir(INSTANCE *my, intptr_t *params) {
const char *d = string_get(params[0]);
int ret = dir_delete(d);
string_discard(params[0]);
return (ret);
}
int moddir_rm(INSTANCE *my, int *params) {
int moddir_rm(INSTANCE *my, intptr_t *params) {
const char *d = string_get(params[0]);
int ret = dir_deletefile(d);
string_discard(params[0]);
......@@ -185,7 +186,7 @@ static int __moddir_read(__DIR_ST *dh) {
* until no more files exists. It then returns NIL.
*/
int moddir_glob(INSTANCE *my, int *params) {
int moddir_glob(INSTANCE *my, intptr_t *params) {
const char *path = string_get(params[0]);
static __DIR_ST *dh = NULL;
int result;
......@@ -215,7 +216,7 @@ int moddir_glob(INSTANCE *my, int *params) {
* return 0 if fail.
*/
int moddir_open(INSTANCE *my, int *params) {
int moddir_open(INSTANCE *my, intptr_t *params) {
int result = (int)dir_open(string_get(params[0]));
string_discard(params[0]);
return result;
......@@ -224,7 +225,7 @@ int moddir_open(INSTANCE *my, int *params) {
/* int DIRCLOSE (INT handle)
*/
int moddir_close(INSTANCE *my, int *params) {
int moddir_close(INSTANCE *my, intptr_t *params) {
if (params[0])
dir_close((__DIR_ST *)params[0]);
return 1;
......@@ -237,14 +238,14 @@ int moddir_close(INSTANCE *my, int *params) {
* until no more files exists. It then returns NIL.
*/
int moddir_read(INSTANCE *my, int *params) {
int moddir_read(INSTANCE *my, intptr_t *params) {
return (__moddir_read((__DIR_ST *)params[0]));
}
/* string
*
*/
int moddir_get_basepath(INSTANCE *my, int *params) {
int moddir_get_basepath(INSTANCE *my, intptr_t *params) {
int code;
char *path = SDL_GetBasePath();
if(! path) {
......@@ -258,7 +259,7 @@ int moddir_get_basepath(INSTANCE *my, int *params) {
return code;
}
int moddir_get_prefpath(INSTANCE *my, int *params) {
int moddir_get_prefpath(INSTANCE *my, intptr_t *params) {
int code;
char *path = SDL_GetPrefPath(string_get(params[0]), string_get(params[1]));
if(! path) {
......
......@@ -30,20 +30,21 @@
#ifndef __MODDIR_SYMBOLS_H
#define __MODDIR_SYMBOLS_H
#include <stdint.h>
#include <pxtdl.h>
#ifndef __PXTB__
extern int moddir_cd( INSTANCE * my, int * params );
extern int moddir_chdir( INSTANCE * my, int * params );
extern int moddir_mkdir( INSTANCE * my, int * params );
extern int moddir_rmdir( INSTANCE * my, int * params );
extern int moddir_glob( INSTANCE * my, int * params );
extern int moddir_rm( INSTANCE * my, int * params );
extern int moddir_open( INSTANCE * my, int * params );
extern int moddir_close( INSTANCE * my, int * params );
extern int moddir_read( INSTANCE * my, int * params );
extern int moddir_get_basepath( INSTANCE * my, int * params );
extern int moddir_get_prefpath( INSTANCE * my, int * params );
extern int moddir_cd( INSTANCE * my, intptr_t * params );
extern int moddir_chdir( INSTANCE * my, intptr_t * params );
extern int moddir_mkdir( INSTANCE * my, intptr_t * params );
extern int moddir_rmdir( INSTANCE * my, intptr_t * params );
extern int moddir_glob( INSTANCE * my, intptr_t * params );
extern int moddir_rm( INSTANCE * my, intptr_t * params );
extern int moddir_open( INSTANCE * my, intptr_t * params );
extern int moddir_close( INSTANCE * my, intptr_t * params );
extern int moddir_read( INSTANCE * my, intptr_t * params );
extern int moddir_get_basepath( INSTANCE * my, intptr_t * params );
extern int moddir_get_prefpath( INSTANCE * my, intptr_t * params );
DLVARFIXUP __pxtexport( mod_dir, globals_fixup)[] = {
/* varname, pointer (NULL), size, # elements */
......
......@@ -29,6 +29,7 @@
/* --------------------------------------------------------------------------- */
#include <stdint.h>
#include <string.h>
#include <math.h>
......@@ -346,14 +347,14 @@ static void _moddraw_object_move(int id, int x, int y) {
/* --------------------------------------------------------------------------- */
/* Exportable functions */
int moddraw_drawing_map(INSTANCE *my, int *params) {
int moddraw_drawing_map(INSTANCE *my, intptr_t *params) {
drawing_graph = bitmap_get(params[0], params[1]);
return 1;
}
/* --------------------------------------------------------------------------- */
int moddraw_drawing_at(INSTANCE *my, int *params) {
int moddraw_drawing_at(INSTANCE *my, intptr_t *params) {
drawing_graph = NULL;
drawing_z = params[0];
return 1;
......@@ -361,42 +362,42 @@ int moddraw_drawing_at(INSTANCE *my, int *params) {
/* --------------------------------------------------------------------------- */
int moddraw_drawing_stipple(INSTANCE *my, int *params) {
int moddraw_drawing_stipple(INSTANCE *my, intptr_t *params) {
drawing_stipple = params[0];
return 1;
}
/* --------------------------------------------------------------------------- */
int moddraw_delete_drawing(INSTANCE *my, int *params) {
int moddraw_delete_drawing(INSTANCE *my, intptr_t *params) {
_moddraw_object_destroy(params[0]);
return 1;
}
/* --------------------------------------------------------------------------- */
int moddraw_move_drawing(INSTANCE *my, int *params) {
int moddraw_move_drawing(INSTANCE *my, intptr_t *params) {
_moddraw_object_move(params[0], params[1], params[2]);
return 1;
}
/* --------------------------------------------------------------------------- */
int moddraw_drawing_color(INSTANCE *my, int *params) {
int moddraw_drawing_color(INSTANCE *my, intptr_t *params) {
gr_setcolor(params[0]);
return 1;
}
/* --------------------------------------------------------------------------- */
int moddraw_drawing_alpha(INSTANCE *my, int *params) {
int moddraw_drawing_alpha(INSTANCE *my, intptr_t *params) {
gr_setalpha(params[0]);
return 1;
}
/* --------------------------------------------------------------------------- */
int moddraw_box(INSTANCE *my, int *params) {
int moddraw_box(INSTANCE *my, intptr_t *params) {
if (!drawing_graph) {
DRAWING_OBJECT *dr = malloc(sizeof(DRAWING_OBJECT));
......@@ -414,7 +415,7 @@ int moddraw_box(INSTANCE *my, int *params) {
/* --------------------------------------------------------------------------- */
int moddraw_rect(INSTANCE *my, int *params) {
int moddraw_rect(INSTANCE *my, intptr_t *params) {
if (!drawing_graph) {
DRAWING_OBJECT *dr = malloc(sizeof(DRAWING_OBJECT));
......@@ -433,7 +434,7 @@ int moddraw_rect(INSTANCE *my, int *params) {
/* --------------------------------------------------------------------------- */
int moddraw_line(INSTANCE *my, int *params) {
int moddraw_line(INSTANCE *my, intptr_t *params) {
if (!drawing_graph) {
DRAWING_OBJECT *dr = malloc(sizeof(DRAWING_OBJECT));
......@@ -451,7 +452,7 @@ int moddraw_line(INSTANCE *my, int *params) {
/* --------------------------------------------------------------------------- */
int moddraw_circle(INSTANCE *my, int *params) {
int moddraw_circle(INSTANCE *my, intptr_t *params) {
if (!drawing_graph) {
DRAWING_OBJECT *dr = malloc(sizeof(DRAWING_OBJECT));
......@@ -468,7 +469,7 @@ int moddraw_circle(INSTANCE *my, int *params) {
/* --------------------------------------------------------------------------- */
int moddraw_fcircle(INSTANCE *my, int *params) {
int moddraw_fcircle(INSTANCE *my, intptr_t *params) {
if (!drawing_graph) {
DRAWING_OBJECT *dr = malloc(sizeof(DRAWING_OBJECT));
......@@ -485,7 +486,7 @@ int moddraw_fcircle(INSTANCE *my, int *params) {
/* --------------------------------------------------------------------------- */
int moddraw_bezier(INSTANCE *my, int *params) {
int moddraw_bezier(INSTANCE *my, intptr_t *params) {
if (!drawing_graph) {
DRAWING_OBJECT *dr = malloc(sizeof(DRAWING_OBJECT));
......@@ -509,20 +510,20 @@ int moddraw_bezier(INSTANCE *my, int *params) {
/* --------------------------------------------------------------------------- */
int moddraw_get_pixel(INSTANCE *my, int *params) {
int moddraw_get_pixel(INSTANCE *my, intptr_t *params) {
return gr_get_pixel(background, params[0], params[1]);
}
/* --------------------------------------------------------------------------- */
int moddraw_put_pixel(INSTANCE *my, int *params) {
int moddraw_put_pixel(INSTANCE *my, intptr_t *params) {
gr_put_pixel(background, params[0], params[1], params[2]);
return 1;
}
/* --------------------------------------------------------------------------- */
int moddraw_map_get_pixel(INSTANCE *my, int *params) {
int moddraw_map_get_pixel(INSTANCE *my, intptr_t *params) {
GRAPH *map = bitmap_get(params[0], params[1]);
if (!map)
return -1;
......@@ -531,7 +532,7 @@ int moddraw_map_get_pixel(INSTANCE *my, int *params) {
/* --------------------------------------------------------------------------- */
int moddraw_map_put_pixel(INSTANCE *my, int *params) {
int moddraw_map_put_pixel(INSTANCE *my, intptr_t *params) {
GRAPH *map = bitmap_get(params[0], params[1]);
if (!map)
return 0;
......
......@@ -30,26 +30,27 @@
#ifndef __MODDRAW_SYMBOLS_H
#define __MODDRAW_SYMBOLS_H
#include <stdint.h>
#include <pxtdl.h>
#ifndef __PXTB__
extern int moddraw_drawing_map( INSTANCE * my, int * params );
extern int moddraw_drawing_color( INSTANCE * my, int * params );
extern int moddraw_line( INSTANCE * my, int * params );
extern int moddraw_rect( INSTANCE * my, int * params );
extern int moddraw_box( INSTANCE * my, int * params );
extern int moddraw_circle( INSTANCE * my, int * params );
extern int moddraw_fcircle( INSTANCE * my, int * params );
extern int moddraw_bezier( INSTANCE * my, int * params );
extern int moddraw_drawing_at( INSTANCE * my, int * params );
extern int moddraw_delete_drawing( INSTANCE * my, int * params );
extern int moddraw_move_drawing( INSTANCE * my, int * params );
extern int moddraw_drawing_alpha( INSTANCE * my, int * params );
extern int moddraw_drawing_stipple( INSTANCE * my, int * params );
extern int moddraw_put_pixel( INSTANCE * my, int * params );
extern int moddraw_get_pixel( INSTANCE * my, int * params );
extern int moddraw_map_get_pixel( INSTANCE * my, int * params );
extern int moddraw_map_put_pixel( INSTANCE * my, int * params );
extern int moddraw_drawing_map( INSTANCE * my, intptr_t * params );
extern int moddraw_drawing_color( INSTANCE * my, intptr_t * params );
extern int moddraw_line( INSTANCE * my, intptr_t * params );
extern int moddraw_rect( INSTANCE * my, intptr_t * params );
extern int moddraw_box( INSTANCE * my, intptr_t * params );
extern int moddraw_circle( INSTANCE * my, intptr_t * params );
extern int moddraw_fcircle( INSTANCE * my, intptr_t * params );
extern int moddraw_bezier( INSTANCE * my, intptr_t * params );
extern int moddraw_drawing_at( INSTANCE * my, intptr_t * params );
extern int moddraw_delete_drawing( INSTANCE * my, intptr_t * params );
extern int moddraw_move_drawing( INSTANCE * my, intptr_t * params );
extern int moddraw_drawing_alpha( INSTANCE * my, intptr_t * params );
extern int moddraw_drawing_stipple( INSTANCE * my, intptr_t * params );
extern int moddraw_put_pixel( INSTANCE * my, intptr_t * params );
extern int moddraw_get_pixel( INSTANCE * my, intptr_t * params );
extern int moddraw_map_get_pixel( INSTANCE * my, intptr_t * params );
extern int moddraw_map_put_pixel( INSTANCE * my, intptr_t * params );
#endif
DLSYSFUNCS __pxtexport( mod_draw, exported_functions )[] = {
FUNC( "DRAWING_MAP" , "II" , TYPE_INT , moddraw_drawing_map ),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment