Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 5B37C632D4B for ; Mon, 6 Apr 2009 13:27:44 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 00297-08 for ; Mon, 6 Apr 2009 13:27:39 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.28]) by mail.postgresql.org (Postfix) with ESMTP id 4762E632B61 for ; Mon, 6 Apr 2009 13:27:40 -0300 (ADT) Received: by yw-out-2324.google.com with SMTP id 3so1502821ywj.73 for ; Mon, 06 Apr 2009 09:27:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=9Zbeg9VgTz6WUmB2KVBl1WsFBy11unfs8g8SwUpV768=; b=WfOVP6S+6EHBth4kxqLUMa22YuadRhfs5FLdnf919avU+K+n8wBWaKWH3vN+9jGYqA HWNoauuBFxLl7163BRtrtGkrksCoGcghxGd4Wpb/hc4qDI7rNhyMH+/EtojeJpfj20Nk TQL6MTV2/yxS86IpWAJdtjhH0x/wVk34ZcWEQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=eRATxH0YMn6truMwmtNTob3CucnPbtbA7Wa+rTJG7mJbo4Qie9AfTfusU8s6HWibGo RuiSgsW1uih93+/8KI/ZUXJFhvo1lXUBEXGlu6zgpqZu36daEJfs9F+PrbIV5TYbV7al 4R/QHcBC9l+pNqwiXkD3BswuQOI3EsjuDmwxI= MIME-Version: 1.0 Received: by 10.100.33.15 with SMTP id g15mr8676273ang.48.1239035259601; Mon, 06 Apr 2009 09:27:39 -0700 (PDT) In-Reply-To: References: Date: Mon, 6 Apr 2009 12:27:39 -0400 Message-ID: <603c8f070904060927v3731ec89v2dbb2ffe5c58b718@mail.gmail.com> Subject: Re: From: Robert Haas To: eehab hamzeh Cc: pgsql-committers@postgresql.org Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.148 tagged_above=0 required=5 tests=AWL=0.148 X-Spam-Level: X-Archive-Number: 200904/83 X-Sequence-Number: 36577 You are posting to the wrong mailing list. Please see: http://www.postgresql.org/community/lists/ ...Robert 2009/4/6 eehab hamzeh : > > here are the code and the error , i compile them using vc++ 6 and VC++ 20= 08 > and minGW the example below are for minGW > THANKS > > #include "postgres.h" > #include > #include "fmgr.h" > > #ifdef PG_MODULE_MAGIC > PG_MODULE_MAGIC; > #endif > > /* by value */ > > PG_FUNCTION_INFO_V1(add_one); > > Datum > add_one(PG_FUNCTION_ARGS) > { > =A0 =A0 int32 =A0 arg =3D PG_GETARG_INT32(0); > > =A0 =A0 PG_RETURN_INT32(arg + 1); > } > > /* by reference, fixed length */ > > PG_FUNCTION_INFO_V1(add_one_float8); > > Datum > add_one_float8(PG_FUNCTION_ARGS) > { > &nb sp; =A0 /* The macros for FLOAT8 hide its pass-by-reference nature. *= / > =A0 =A0 float8 =A0 arg =3D PG_GETARG_FLOAT8(0); > > =A0 =A0 PG_RETURN_FLOAT8(arg + 1.0); > } > > PG_FUNCTION_INFO_V1(makepoint); > > Datum > makepoint(PG_FUNCTION_ARGS) > { > =A0 =A0 /* Here, the pass-by-reference nature of Point is not hidden. */ > =A0 =A0 Point =A0 =A0 *pointx =3D PG_GETARG_POINT_P(0); > =A0 =A0 Point =A0 =A0 *pointy =3D PG_GETARG_POINT_P(1); > =A0 =A0 Point =A0 =A0 *new_point =3D (Point *) palloc(sizeof(Point)); > > =A0 =A0 new_point->x =3D pointx->x; > =A0 =A0 new_point->y =3D pointy->y; > > =A0 =A0 PG_RETURN_POINT_P(new_point); > } > > /* by reference, variable length */ > > PG_FUNCTION_INFO_V1(copytext); > > Datum > copytext(PG_FUNCTION_ARGS) > { > =A0 =A0 text =A0 =A0 *t =3D PG_GETARG_TEXT_P(0); > =A0 =A0 /* > =A0 =A0 =A0* VARSIZE is the total size of the struct in bytes. > =A0 =A0 =A0*/ > =A0 =A0 text =A0 =A0 *new_t =3D (text *) palloc(VARSIZE(t)); > =A0 =A0 VARATT_SIZEP(new_t) =3D VARSIZE(t); > =A0 =A0 /* > =A0 =A0 =A0* VARDATA is a pointer to the data region of the struct. > =A0 =A0 =A0*/ > =A0 =A0 memcpy((void *) VARDATA(new_t), /* destination */ > =A0 =A0 =A0 =A0 =A0 =A0(void *) VARDATA(t), =A0 =A0 /* source */ > =A0 =A0 =A0 =A0 =A0 =A0VARSIZE(t)-VARHDRSZ); =A0 =A0/* how many bytes */ > =A0 =A0 PG_RETURN_TEXT_P(new_t); > } > > PG_FUNCTION_INFO_V1(concat_text); > > Datum > concat_text(PG_FUNCTION_ARGS) > { > =A0 =A0 text =A0*arg1 =3D PG_GETARG_TEXT_P(0); > =A0 =A0 text =A0*arg2 =3D PG_GETARG_TEXT_P(1); > =A0 =A0 int32 new_text_size =3D VARSIZE(arg1) + VARSIZE(arg2) - VARHDRSZ; > =A0 =A0 text *new_text =3D (text *) palloc(new_text_size); > > =A0 =A0 VARATT_SIZEP(new_text) =3D new_text_size; > =A0 =A0 memcpy(VARDATA(new_text), VARDATA(arg1), VARSIZE(arg1)-VARHDRSZ); > =A0 =A0 memcpy(VARDATA(new_text) + (VARSIZE(arg1)-VARHDRSZ), > =A0 =A0 =A0 =A0 =A0 =A0VARDATA(arg2), VARSIZE(arg2)-VARHDRSZ); > =A0 &n bsp; PG_RETURN_TEXT_P(new_text); > } > > > the error > > in function 'makepoint': > error: 'Point' undeclared (first use in this function) > error: (each undeclared identifier is reported only one > error: for each function it appears in.) > error: 'pointx' undeclared (first use in =B4this function) > error: 'pointy' undeclared (first use in his fnction) > error 'new_point' undeclared (first use in his function) > error: syntax error befre ')' oken > in function 'copy text': > error: 'invalid lvalue in assinment > In function 'concat_text' > error: invalid lvalue in assignement > warning no new line at end of file > > Please any direction of how to solve the problem > > thanks > > < img alt=3D""> > > > > ________________________________ > check out the rest of the Windows Live=99. More than mail=96Windows Live= =99 goes > way beyond your inbox. More than messages