You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by su...@apache.org on 2003/09/01 15:36:24 UTC
cvs commit: xml-axis/c/src/server/samples/cservice Service.c Service.h
susantha 2003/09/01 06:36:24
Added: c/src/server/samples/cservice Service.c Service.h
Log:
new sample web services
Revision Changes Path
1.1 xml-axis/c/src/server/samples/cservice/Service.c
Index: Service.c
===================================================================
// Service.cpp: implementation of the Service functions.
//
//////////////////////////////////////////////////////////////////////
#include "Service.h"
#include <math.h>
int AddInt(int a, int b)
{
return a+b;
}
Point* AddPoint(Point *p1, Point *p2)
{
Point* ret = (Point*)malloc(sizeof(Point));
ret->x = p1->x + p2->x;
ret->y = p1->y + p2->y;
return ret;
}
double Distance(Point *p1, Point *p2)
{
return sqrt(pow((p1->x - p2->x),2) + pow((p1->y - p2->y),2));
}
double Perimeter(const Triangle* pTri)
{
double peri = 0;
peri = sqrt(pow((pTri->p1->x - pTri->p2->x),2) + pow((pTri->p1->y - pTri->p2->y),2));
peri += sqrt(pow((pTri->p3->x - pTri->p2->x),2) + pow((pTri->p3->y - pTri->p2->y),2));
peri += sqrt(pow((pTri->p1->x - pTri->p3->x),2) + pow((pTri->p1->y - pTri->p3->y),2));
return peri;
}
1.1 xml-axis/c/src/server/samples/cservice/Service.h
Index: Service.h
===================================================================
// Service.h: interface for the Service functions.
//
//////////////////////////////////////////////////////////////////////
#if !defined(__SERVICE_HEADERFILE_INCLUDED__)
#define __SERVICE_HEADERFILE_INCLUDED__
#include <malloc.h>
typedef struct PointTag
{
int x;
int y;
} Point;
typedef struct TriangleTag
{
Point* p1;
Point* p2;
Point* p3;
} Triangle;
//double Distance(Point* p1, Point* p2);
//Point* AddPoint(Point* p1, Point* p2);
//int AddInt(int a, int b);
#endif // !defined(__SERVICE_HEADERFILE_INCLUDED__)