fms-extensions removed from Makefile ;-). Also headers fixed
This commit is contained in:
parent
079b09287d
commit
4031ac31e0
6
Figure.h
6
Figure.h
|
@ -32,11 +32,11 @@ static inline void Figure_destroy (Figure *this)
|
||||||
{
|
{
|
||||||
this->vtable->destroy (this);
|
this->vtable->destroy (this);
|
||||||
}
|
}
|
||||||
static inline void Figure_draw (const struct Figure *this)
|
static inline void Figure_draw (const Figure *this)
|
||||||
{
|
{
|
||||||
this->vtable->draw (this);
|
this->vtable->draw (this);
|
||||||
}
|
}
|
||||||
static inline double (*area) (const struct Figure *this)
|
static inline double Figure_area (const Figure *this)
|
||||||
{
|
{
|
||||||
return this->vtable->area (this);
|
return this->vtable->area (this);
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,6 @@ static inline double (*area) (const struct Figure *this)
|
||||||
/* considered to be protected */
|
/* considered to be protected */
|
||||||
void Figure_constructor (Figure *this);
|
void Figure_constructor (Figure *this);
|
||||||
void Figure_destructor (Figure *this);
|
void Figure_destructor (Figure *this);
|
||||||
void Figure_copy (struct Figure *dest, const struct Figure *src);
|
void Figure_copy (Figure *dest, const Figure *src);
|
||||||
|
|
||||||
#endif // __FIGURE_H__
|
#endif // __FIGURE_H__
|
||||||
|
|
25
Makefile
25
Makefile
|
@ -1,4 +1,4 @@
|
||||||
# Makefile generated by command: smake.sh -t main --cflags=-fms-extensions
|
# Makefile generated by command: smake.sh -t main
|
||||||
# This file is generated with smake.sh.
|
# This file is generated with smake.sh.
|
||||||
# You can use this make file with instruction make to
|
# You can use this make file with instruction make to
|
||||||
# use one of build mode: debug, profile, develop, release.
|
# use one of build mode: debug, profile, develop, release.
|
||||||
|
@ -18,7 +18,7 @@ TARGET0=main
|
||||||
TARGETS= $(TARGET0)
|
TARGETS= $(TARGET0)
|
||||||
CC=cc
|
CC=cc
|
||||||
CXX=c++
|
CXX=c++
|
||||||
CFLAGS := -fms-extensions $(CFLAGS)
|
CFLAGS := $(CFLAGS)
|
||||||
CXXFLAGS := $(CXXFLAGS)
|
CXXFLAGS := $(CXXFLAGS)
|
||||||
LDFLAGS := $(LDFLAGS)
|
LDFLAGS := $(LDFLAGS)
|
||||||
LIBS=
|
LIBS=
|
||||||
|
@ -96,8 +96,7 @@ clean:
|
||||||
#________________________________|
|
#________________________________|
|
||||||
target_objs0 = \
|
target_objs0 = \
|
||||||
main.o \
|
main.o \
|
||||||
ColoredSquare.o \
|
Figure.o
|
||||||
Square.o
|
|
||||||
|
|
||||||
$(TARGET0): $(target_objs0)
|
$(TARGET0): $(target_objs0)
|
||||||
$(CC) $(LDFLAGS) -o $@ $(target_objs0)
|
$(CC) $(LDFLAGS) -o $@ $(target_objs0)
|
||||||
|
@ -105,21 +104,13 @@ $(TARGET0): $(target_objs0)
|
||||||
|
|
||||||
main.o: \
|
main.o: \
|
||||||
main.c \
|
main.c \
|
||||||
ColoredSquare.h \
|
|
||||||
Figure.h \
|
Figure.h \
|
||||||
Object.h \
|
Object.h \
|
||||||
Square.h
|
Polygon.h \
|
||||||
|
Rhomb.h
|
||||||
|
|
||||||
ColoredSquare.o: \
|
Figure.o: \
|
||||||
ColoredSquare.c \
|
Figure.c \
|
||||||
ColoredSquare.h \
|
|
||||||
Figure.h \
|
Figure.h \
|
||||||
Object.h \
|
Object.h
|
||||||
Square.h
|
|
||||||
|
|
||||||
Square.o: \
|
|
||||||
Square.c \
|
|
||||||
Figure.h \
|
|
||||||
Object.h \
|
|
||||||
Square.h
|
|
||||||
|
|
||||||
|
|
2
Object.h
2
Object.h
|
@ -7,7 +7,7 @@ typedef struct Object
|
||||||
{
|
{
|
||||||
/* Object methods */
|
/* Object methods */
|
||||||
const char* (*type) ();
|
const char* (*type) ();
|
||||||
struct Object* (*clone) (const Object *this);
|
struct Object* (*clone) (const struct Object *this);
|
||||||
void (*destroy) (struct Object *this);
|
void (*destroy) (struct Object *this);
|
||||||
|
|
||||||
} *vtable;
|
} *vtable;
|
||||||
|
|
|
@ -30,7 +30,7 @@ typedef struct Polygon
|
||||||
|
|
||||||
} Polygon;
|
} Polygon;
|
||||||
|
|
||||||
Polygon* Polygon_new (const struct *points);
|
Polygon* Polygon_new (const struct point *points);
|
||||||
|
|
||||||
static inline const char* Polygon_type (const Polygon *this)
|
static inline const char* Polygon_type (const Polygon *this)
|
||||||
{
|
{
|
||||||
|
@ -59,7 +59,7 @@ static inline double Polygon_area (const Polygon *this)
|
||||||
|
|
||||||
static inline double Polygon_max_diag (const Polygon *this)
|
static inline double Polygon_max_diag (const Polygon *this)
|
||||||
{
|
{
|
||||||
return this->max_diag (this);
|
return this->vtable->max_diag (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* considered to be protected */
|
/* considered to be protected */
|
||||||
|
|
19
Rhomb.h
19
Rhomb.h
|
@ -25,15 +25,11 @@ typedef struct Rhomb
|
||||||
} *vtable;
|
} *vtable;
|
||||||
|
|
||||||
/* derived from Polygon */
|
/* derived from Polygon */
|
||||||
struct point
|
struct point *points;
|
||||||
{
|
|
||||||
double x, y;
|
|
||||||
|
|
||||||
} *points;
|
|
||||||
|
|
||||||
} Rhomb;
|
} Rhomb;
|
||||||
|
|
||||||
Rhomb* Rhomb_new (const struct *points);
|
Rhomb* Rhomb_new (const struct point *points);
|
||||||
|
|
||||||
static inline const char* Rhomb_type (const Rhomb *this)
|
static inline const char* Rhomb_type (const Rhomb *this)
|
||||||
{
|
{
|
||||||
|
@ -55,17 +51,20 @@ static inline void Rhomb_draw (const Rhomb *this)
|
||||||
this->vtable->draw (this);
|
this->vtable->draw (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int double Rhomb_area (const Rhomb *this)
|
static inline double Rhomb_area (const Rhomb *this)
|
||||||
{
|
{
|
||||||
return this->vtable_area (this);
|
return this->vtable->area (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline double Rhomb_max_diag (const Rhomb *this)
|
static inline double Rhomb_max_diag (const Rhomb *this)
|
||||||
{
|
{
|
||||||
return this->max_diag (this);
|
return this->vtable->max_diag (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int Rhomb_is_square (const Rhomb *this);
|
static inline int Rhomb_is_square (const Rhomb *this)
|
||||||
|
{
|
||||||
|
return this->vtable->is_square (this);
|
||||||
|
}
|
||||||
|
|
||||||
/* considered to be protected */
|
/* considered to be protected */
|
||||||
void Rhomb_constructor (Rhomb *this);
|
void Rhomb_constructor (Rhomb *this);
|
||||||
|
|
7
main.c
7
main.c
|
@ -1,10 +1,10 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "ColoredSquare.h"
|
#include "Rhomb.h"
|
||||||
|
|
||||||
int main (void)
|
int main (void)
|
||||||
{
|
{
|
||||||
unsigned long i = 0;
|
/* unsigned long i = 0;
|
||||||
Figure *fig[3];
|
Figure *fig[3];
|
||||||
|
|
||||||
fig[0] = (Figure *) Square_new (1);
|
fig[0] = (Figure *) Square_new (1);
|
||||||
|
@ -38,10 +38,11 @@ int main (void)
|
||||||
/*goto end;
|
/*goto end;
|
||||||
err:
|
err:
|
||||||
end:*/
|
end:*/
|
||||||
for (i = 0; i < sizeof (fig) / sizeof (Figure *); i++)
|
/* for (i = 0; i < sizeof (fig) / sizeof (Figure *); i++)
|
||||||
{
|
{
|
||||||
fig[i]->vtable->destroy (fig[i]);
|
fig[i]->vtable->destroy (fig[i]);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue