From patchwork Wed Mar 6 19:52:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 225613 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 64A692C02BF for ; Thu, 7 Mar 2013 06:53:50 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1363204431; h=Comment: DomainKey-Signature:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=GAv5VUs 2qop7L00AqN4oi4yj9CM=; b=mez2cYGcSHLwIDiq0qdM40Je2V0YbtgaxKGuwF0 XnbHi4wkPo1/mtBI4pW0JH2szSpjXvjKKdJMMK3ZxtZRozWIhGd99IDX/vrsARKP 5t2zvV/xGXCkMCPjUcMP0ej9305YjFAGgTt19uqguNvBvJisybuKtQxJjrBkMC7p A9yc= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=r5fjX6/m9iho7ysRYcoJexjKPfY5TkmR4bDQcapxMwWj8fyM/D3DLysSTms4xP jJwckIErLxRcy7xFNFkFYgpCRv0r5CM3wjAQen32F2KA+PW6uYpVhm3QMWMJCgFJ AH97M+X0JjHkffHwWRuveKwGKoyTHF1EbzJBLDKEK9vpU=; Received: (qmail 31145 invoked by alias); 6 Mar 2013 19:53:28 -0000 Received: (qmail 31104 invoked by uid 22791); 6 Mar 2013 19:53:27 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mx01.qsc.de (HELO mx01.qsc.de) (213.148.129.14) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 06 Mar 2013 19:52:46 +0000 Received: from archimedes.net-b.de (port-92-195-1-51.dynamic.qsc.de [92.195.1.51]) by mx01.qsc.de (Postfix) with ESMTP id 154D53D185; Wed, 6 Mar 2013 20:52:44 +0100 (CET) Message-ID: <51379E8C.7090609@net-b.de> Date: Wed, 06 Mar 2013 20:52:44 +0100 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 MIME-Version: 1.0 To: gcc patches , gfortran Subject: [Fortran, Patch] Improve documentation of the non-implemented RECORD STRUCTURE extension Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org During the discussion of UNION, I decided to have a look at the current documentation. UNION is not mentioned (except for some commented lines), but record structures are. Attached is an attempted to improve the documentation. The current version is at http://gcc.gnu.org/onlinedocs/gfortran/STRUCTURE-and-RECORD.html I tested it with make pdf and make info and looked at the output. OK for the trunk? Tobias 2013-03-06 Tobias Burnus * gfortran.texi (STRUCTURE and RECORD): State more clearly how to convert them into derived types. diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi index 462b443..4f9008d 100644 --- a/gcc/fortran/gfortran.texi +++ b/gcc/fortran/gfortran.texi @@ -2004,10 +2004,19 @@ code that uses them running with the GNU Fortran compiler. @cindex @code{STRUCTURE} @cindex @code{RECORD} -Structures are user-defined aggregate data types; this functionality was -standardized in Fortran 90 with an different syntax, under the name of -``derived types''. Here is an example of code using the non portable -structure syntax: +Record structures are a pre-Fortran-90 vendor extension to create +user-defined aggregate data types. GNU Fortran does not support +record structures, only Fortran 90's ``derived types'', which have +a different syntax. + +In many cases, record structures can easily be converted to derived types. +To convert, replace @code{STRUCTURE /}@var{structure-name}@code{/} +by @code{TYPE} @var{type-name}. Additionally, replace +@code{RECORD /}@var{structure-name}@code{/} by +@code{TYPE(}@var{type-name}@code{)}. Finally, in the component access, +replace the period (@code{.}) by the percent sign (@code{%}). + +Here is an example of code using the non portable record structure syntax: @example ! Declaring a structure named ``item'' and containing three fields: