Added rules to make tests

This commit is contained in:
David Capello 2007-12-05 03:29:17 +00:00
parent 0f23b3b3f0
commit 7a0913c2cf
36 changed files with 99 additions and 79 deletions

View File

@ -26,7 +26,6 @@ LIB = .a
EXE = .exe
SUBMAKEFILE = makefile.dj
OBJ_DIR = obj/djgpp
JINETE_SUFFIX = djgpp
include makefile.lst
include makefile.gcc

View File

@ -133,7 +133,8 @@ config.h.gch: config.h
$(CC) $(CFLAGS) -o $@ -c $<
endif
# rules to build the object files
######################################################################
# Rules to build the object files
$(OBJ_DIR)/%$(OBJ): %.c
$(CC) $(CFLAGS) -o $@ -c $<
@ -162,7 +163,8 @@ $(OBJ_DIR)/png.%$(OBJ): %.c
$(OBJ_DIR)/zlib.%$(OBJ): %.c
$(CC) $(CFLAGS) -o $@ -c $<
# application
######################################################################
# Application
ifndef WITHICON
$(ASE): $(ASE_DEPS)
@ -174,3 +176,19 @@ $(OBJ_DIR)/%.res: src/%.rc
$(ASE): $(ASE_DEPS) $(OBJ_DIR)/icon.res
$(CC) -o $@ $(ASE_OBJS) $(OBJ_DIR)/icon.res $(LFLAGS) $(LFLAGS_LAST)
endif
######################################################################
# Rules to make tests
TESTS = $(addsuffix $(EXE), \
$(basename \
$(wildcard src/test/raster/*.c) \
$(wildcard src/test/jinete/*.c)))
src/test/raster/%$(EXE): src/test/raster/%.c $(COMMON_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LFLAGS) $(LFLAGS_LAST)
src/test/jinete/%$(EXE): src/test/jinete/%.c $(COMMON_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LFLAGS) $(LFLAGS_LAST)
test: $(TESTS)

View File

@ -26,7 +26,6 @@ LIB = .a
EXE =
SUBMAKEFILE = makefile.lnx
OBJ_DIR = obj/unix
JINETE_SUFFIX = unix
include makefile.lst
include makefile.gcc

View File

@ -5,7 +5,7 @@
ASE = ase$(EXE)
ASE_SOURCES = \
COMMON_SOURCES = \
src/commands/cmd_about.c \
src/commands/cmd_advanced_mode.c \
src/commands/cmd_cel_properties.c \
@ -152,7 +152,6 @@ ASE_SOURCES = \
src/jinete/jxml.c \
src/jinete/themes/jsimple.c \
src/jinete/themes/jstand.c \
src/main.c \
src/modules/color.c \
src/modules/editors.c \
src/modules/gfx.c \
@ -215,6 +214,12 @@ ASE_SOURCES = \
src/widgets/target.c \
src/widgets/toolbar.c
COMMON_OBJS = $(addprefix $(OBJ_DIR)/, \
$(addsuffix $(OBJ), \
$(notdir $(basename $(COMMON_SOURCES)))))
ASE_SOURCES = src/main.c $(COMMON_SOURCES)
ASE_OBJS = $(addprefix $(OBJ_DIR)/, \
$(addsuffix $(OBJ), \
$(notdir $(basename $(ASE_SOURCES)))))

View File

@ -32,7 +32,6 @@ LIB = .a
EXE = .exe
SUBMAKEFILE = makefile.mgw
OBJ_DIR = obj/mingw32
JINETE_SUFFIX = mingw32
ifndef CROSSCOMPILE
DLLWRAP = dllwrap

View File

@ -6,7 +6,7 @@
#include <allegro.h>
#include "jinete.h"
#include "jinete/jinete.h"
int main(int argc, char *argv[])
{

View File

@ -31,7 +31,7 @@
#include <allegro.h>
#include "jinete.h"
#include "jinete/jinete.h"
int main (int argc, char *argv[])
{

View File

@ -32,7 +32,7 @@
#include <allegro.h>
#include <stdio.h>
#include "jinete.h"
#include "jinete/jinete.h"
int main (int argc, char *argv[])
{

View File

@ -31,7 +31,7 @@
#include <allegro.h>
#include "jinete.h"
#include "jinete/jinete.h"
int main(int argc, char *argv[])
{

View File

@ -31,7 +31,7 @@
#include <allegro.h>
#include "jinete.h"
#include "jinete/jinete.h"
int main (int argc, char *argv[])
{

View File

@ -31,7 +31,7 @@
#include <allegro.h>
#include "jinete.h"
#include "jinete/jinete.h"
static void show_file_select (const char *title, const char *exts);

View File

@ -31,7 +31,7 @@
#include <allegro.h>
#include "jinete.h"
#include "jinete/jinete.h"
int main (int argc, char *argv[])
{

View File

@ -31,7 +31,7 @@
#include <allegro.h>
#include "jinete.h"
#include "jinete/jinete.h"
int main (int argc, char *argv[])
{

View File

@ -31,7 +31,7 @@
#include <allegro.h>
#include "jinete.h"
#include "jinete/jinete.h"
void do_text (const char *title, int align)
{

View File

@ -31,7 +31,7 @@
#include <allegro.h>
#include "jinete.h"
#include "jinete/jinete.h"
JRect test1(void);
void test2(JRect pos);

View File

@ -32,7 +32,7 @@
#include <allegro.h>
#include <stdio.h>
#include "jinete.h"
#include "jinete/jinete/jinete.h"
static JWidget check, radio[12];
@ -84,7 +84,7 @@ int main (int argc, char *argv[])
radio[11] = jradio_new ("Bottom", 4);
for (c=0; c<12; c++)
jwidget_add_hook (radio[c], JI_WIDGET, hooked_check_msg_proc, NULL);
jwidget_add_hook(radio[c], JI_WIDGET, hooked_check_msg_proc, NULL);
jwidget_add_child (window, box1);
jwidget_add_child (box1, check);

View File

@ -31,7 +31,7 @@
#include <allegro.h>
#include "jinete.h"
#include "jinete/jinete.h"
static void poll_button (JWidget widget);

View File

@ -32,7 +32,7 @@
#include <allegro.h>
#include <stdio.h>
#include "jinete.h"
#include "jinete/jinete.h"
static void handle_menuitem_selected (JWidget widget, int user_data);

View File

@ -32,7 +32,7 @@
#include <allegro.h>
#include <stdio.h>
#include "jinete.h"
#include "jinete/jinete.h"
static JWidget new_menuitem(const char *text, const char *accel_string);
static bool hooked_menuitem_msg_proc(JWidget widget, JMessage msg);

View File

@ -30,7 +30,7 @@
*/
#include <allegro.h>
#include "jinete.h"
#include "jinete/jinete.h"
int main (int argc, char *argv[])
{
@ -86,7 +86,7 @@ int main (int argc, char *argv[])
sub_manager->rc->x1 + (rand () % (jrect_w(sub_manager->rc) - jrect_w(window->rc))),
sub_manager->rc->y1 + (rand () % (jrect_h(sub_manager->rc) - jrect_h(window->rc))));
_jmanager_open_window (sub_manager, window);
_jmanager_open_window(sub_manager, window);
}
jmanager_run (manager);

View File

@ -32,7 +32,7 @@
#include <allegro.h>
#include <stdio.h>
#include "jinete.h"
#include "jinete/jinete.h"
static JList windows;

View File

@ -31,7 +31,7 @@
#include <allegro.h>
#include "jinete.h"
#include "jinete/jinete.h"
void set_my_palette (void);
JTheme my_theme_new (void);

View File

@ -31,7 +31,7 @@
#include <allegro.h>
#include "jinete.h"
#include "jinete/jinete.h"
FONT *my_font = NULL;

View File

@ -32,7 +32,7 @@
#include <allegro.h>
#include <stdio.h>
#include "jinete.h"
#include "jinete/jinete.h"
void jwidget_add_tip (JWidget widget, const char *text);

View File

@ -32,7 +32,7 @@
#include <allegro.h>
#include <math.h>
#include "jinete.h"
#include "jinete/jinete.h"
/* GUI */
void init_gui(void);

View File

@ -31,7 +31,7 @@
#include <allegro.h>
#include "jinete.h"
#include "jinete/jinete.h"
int main (int argc, char *argv[])
{

View File

@ -31,7 +31,7 @@
#include <allegro.h>
#include "jinete.h"
#include "jinete/jinete.h"
int main (int argc, char *argv[])
{

View File

@ -6,7 +6,7 @@
#include <allegro.h>
#include "jinete.h"
#include "jinete/jinete.h"
static char *xml_src =
"<root>" "\n"

View File

@ -35,54 +35,54 @@ int main (int argc, char *argv[])
int mx, my, mb, ox, oy, ob;
int c;
allegro_init ();
set_color_depth (8);
set_gfx_mode (GFX_AUTODETECT, 320, 200, 0, 0);
install_timer ();
install_keyboard ();
install_mouse ();
allegro_init();
set_color_depth(8);
set_gfx_mode(GFX_AUTODETECT_WINDOWED, 320, 200, 0, 0);
install_timer();
install_keyboard();
install_mouse();
bmp = create_bitmap (SCREEN_W, SCREEN_H);
bmp = create_bitmap(SCREEN_W, SCREEN_H);
redraw = TRUE;
image = image_new (IMAGE_INDEXED, SCREEN_W, SCREEN_H);
dirty = dirty_new (image, 0, 0, image->w-1, image->h-1, FALSE);
brush1 = brush_new ();
brush2 = brush_new ();
image = image_new(IMAGE_INDEXED, SCREEN_W, SCREEN_H);
dirty = dirty_new(image, 0, 0, image->w-1, image->h-1, FALSE);
brush1 = brush_new();
brush2 = brush_new();
brush_set_size (brush1, 1);
brush_set_size (brush2, 8);
brush_set_size(brush1, 1);
brush_set_size(brush2, 8);
image_clear (image, 0);
for (c=128; c>0; c-=8)
image_ellipse (image,
image->w/2-c, image->h/2-c/2,
image->w/2+c, image->h/2+c/2, c);
image_ellipse(image,
image->w/2-c, image->h/2-c/2,
image->w/2+c, image->h/2+c/2, c);
ox = mouse_x;
oy = mouse_y;
show_mouse (screen);
show_mouse(screen);
do {
poll_mouse ();
poll_mouse();
mx = mouse_x;
my = mouse_y;
mb = mouse_b;
if (mx != ox || my != oy || mb != ob) {
poll_mouse ();
poll_mouse();
mx = mouse_x;
my = mouse_y;
mb = mouse_b;
if (mb) {
dirty_line_brush (dirty, (mb & 2) ? brush2: brush1,
ox, oy, mx, my);
dirty_line_brush(dirty, (mb & 2) ? brush2: brush1,
ox, oy, mx, my);
redraw = TRUE;
}
dirty_get (dirty);
algo_dirty (dirty, image, (AlgoHLine)draw_dirty);
dirty_get(dirty);
algo_dirty(dirty, image, (AlgoHLine)draw_dirty);
ox = mx;
oy = my;
@ -91,9 +91,9 @@ int main (int argc, char *argv[])
/* with R restore the image */
if (key[KEY_R]) {
dirty_put (dirty);
dirty_free (dirty);
dirty = dirty_new (image, 0, 0, image->w-1, image->h-1, FALSE);
dirty_put(dirty);
dirty_free(dirty);
dirty = dirty_new(image, 0, 0, image->w-1, image->h-1, FALSE);
while (key[KEY_P]);
redraw = TRUE;
}

View File

@ -27,7 +27,7 @@ int main(int argc, char *argv[])
int redraw;
allegro_init();
set_gfx_mode(GFX_AUTODETECT, 320, 200, 0, 0);
set_gfx_mode(GFX_AUTODETECT_WINDOWED, 320, 200, 0, 0);
install_timer();
install_keyboard();
install_mouse();

View File

@ -39,7 +39,7 @@ typedef struct BEZIER_PATH
BEZIER_NODE *first, *last;
} BEZIER_PATH;
BEZIER_PATH *create_bezier_path (void)
BEZIER_PATH *create_bezier_path(void)
{
BEZIER_PATH *path;
@ -50,7 +50,7 @@ BEZIER_PATH *create_bezier_path (void)
return path;
}
BEZIER_NODE *create_bezier_node (int tangent, float prev_x, float prev_y, float x, float y, float next_x, float next_y)
BEZIER_NODE *create_bezier_node(int tangent, float prev_x, float prev_y, float x, float y, float next_x, float next_y)
{
BEZIER_NODE *node;
@ -65,7 +65,7 @@ BEZIER_NODE *create_bezier_node (int tangent, float prev_x, float prev_y, float
return node;
}
void add_bezier_node (BEZIER_PATH *path, BEZIER_NODE *node)
void add_bezier_node(BEZIER_PATH *path, BEZIER_NODE *node)
{
if (!path->first) {
node->prev = NULL;
@ -84,7 +84,7 @@ void add_bezier_node (BEZIER_PATH *path, BEZIER_NODE *node)
#define DRAW_BEZIER_CONTROL_POINTS 4
#define DRAW_BEZIER_CONTROL_LINES 8
void draw_bezier_path (BITMAP *bmp, BEZIER_PATH *path, int flags, int color)
void draw_bezier_path(BITMAP *bmp, BEZIER_PATH *path, int flags, int color)
{
BEZIER_NODE *node;
int points[8];
@ -131,7 +131,7 @@ void draw_bezier_path (BITMAP *bmp, BEZIER_PATH *path, int flags, int color)
typedef struct Point { int x, y; } Point;
static void add_shape_seg (int x1, int y1, int x2, int y2, JList *shape)
static void add_shape_seg(int x1, int y1, int x2, int y2, JList *shape)
{
Point *point = jnew (Point, 1);
point->x = x2;
@ -139,7 +139,7 @@ static void add_shape_seg (int x1, int y1, int x2, int y2, JList *shape)
*shape = jlist_append (*shape, point);
}
void draw_filled_bezier_path (BITMAP *bmp, BEZIER_PATH *path, int color)
void draw_filled_bezier_path(BITMAP *bmp, BEZIER_PATH *path, int color)
{
BEZIER_NODE *node;
JList it, shape = NULL;
@ -149,34 +149,34 @@ void draw_filled_bezier_path (BITMAP *bmp, BEZIER_PATH *path, int color)
for (node=path->first; node; node=node->next) {
/* draw the bezier spline */
if (node->next) {
algo_spline (node->x,
node->y,
node->next_x,
node->next_y,
node->next->prev_x,
node->next->prev_y,
node->next->x,
node->next->y,
(void *)&shape, (AlgoLine)add_shape_seg);
algo_spline(node->x,
node->y,
node->next_x,
node->next_y,
node->next->prev_x,
node->next->prev_y,
node->next->x,
node->next->y,
(void *)&shape, (AlgoLine)add_shape_seg);
}
if (node == path->last)
break;
}
vertices = jlist_length (shape);
vertices = jlist_length(shape);
if (vertices > 0) {
points = jmalloc (sizeof (int) * vertices * 2);
points = jmalloc(sizeof (int) * vertices * 2);
for (c=0, it=shape; it; it=it->next) {
points[c++] = ((Point *)it->data)->x;
points[c++] = ((Point *)it->data)->y;
}
polygon (bmp, vertices, points, color);
ji_free (points);
polygon(bmp, vertices, points, color);
ji_free(points);
}
for (it=shape; it; it=it->next)
jfree (it->data);
jfree(it->data);
}
void draw_art_filled_bezier_path (BITMAP *bmp, BEZIER_PATH *path)