From owner-freebsd-hackers@FreeBSD.ORG Wed Dec 10 20:36:52 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2F48EE0F; Wed, 10 Dec 2014 20:36:52 +0000 (UTC) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1on0113.outbound.protection.outlook.com [157.56.110.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "MSIT Machine Auth CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D227FF24; Wed, 10 Dec 2014 20:36:51 +0000 (UTC) Received: from BN1PR05MB437.namprd05.prod.outlook.com (10.141.58.11) by BN1PR05MB278.namprd05.prod.outlook.com (10.141.64.147) with Microsoft SMTP Server (TLS) id 15.1.31.17; Wed, 10 Dec 2014 20:36:49 +0000 Received: from BY2PR05CA033.namprd05.prod.outlook.com (10.141.250.23) by BN1PR05MB437.namprd05.prod.outlook.com (10.141.58.11) with Microsoft SMTP Server (TLS) id 15.1.31.17; Wed, 10 Dec 2014 20:36:48 +0000 Received: from BY2FFO11FD016.protection.gbl (2a01:111:f400:7c0c::110) by BY2PR05CA033.outlook.office365.com (2a01:111:e400:2c5f::23) with Microsoft SMTP Server (TLS) id 15.1.31.17 via Frontend Transport; Wed, 10 Dec 2014 20:36:47 +0000 Received: from P-EMF03-SAC.jnpr.net (66.129.239.17) by BY2FFO11FD016.mail.protection.outlook.com (10.1.14.148) with Microsoft SMTP Server (TLS) id 15.1.26.17 via Frontend Transport; Wed, 10 Dec 2014 20:36:47 +0000 Received: from magenta.juniper.net (172.17.27.123) by P-EMF03-SAC.jnpr.net (172.24.192.21) with Microsoft SMTP Server (TLS) id 14.3.146.0; Wed, 10 Dec 2014 12:36:45 -0800 Received: from idle.juniper.net (idleski.juniper.net [172.25.4.26]) by magenta.juniper.net (8.11.3/8.11.3) with ESMTP id sBAJVKR14747; Wed, 10 Dec 2014 11:31:21 -0800 (PST) (envelope-from phil@juniper.net) Received: from idle.juniper.net (localhost [127.0.0.1]) by idle.juniper.net (8.14.4/8.14.3) with ESMTP id sBAJV7uk076028; Wed, 10 Dec 2014 14:31:07 -0500 (EST) (envelope-from phil@idle.juniper.net) Message-ID: <201412101931.sBAJV7uk076028@idle.juniper.net> To: Stefan Esser Subject: Re: [Patch] updated: Add JSON and XML output to pciconf (libxo support - D1206) In-Reply-To: <548723D0.1000402@freebsd.org> Date: Wed, 10 Dec 2014 14:31:07 -0500 From: Phil Shafer MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:66.129.239.17; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(164054003)(199003)(189002)(87936001)(110136001)(50466002)(86362001)(50986999)(54356999)(69596002)(103666002)(62966003)(450100001)(77156002)(6806004)(48376002)(31966008)(4396001)(92566001)(84676001)(46102003)(68736005)(64706001)(47776003)(20776003)(97736003)(77096005)(120916001)(99396003)(76506005)(53416004)(105596002)(15975445007)(106466001)(21056001)(81156004)(107046002); DIR:OUT; SFP:1102; SCL:1; SRVR:BN1PR05MB437; H:P-EMF03-SAC.jnpr.net; FPR:; SPF:SoftFail; MLV:sfv; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Antispam: UriScan:;UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BN1PR05MB437; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(9)(10); SRVR:BN1PR05MB437; X-Forefront-PRVS: 0421BF7135 Received-SPF: SoftFail (protection.outlook.com: domain of transitioning juniper.net discourages use of 66.129.239.17 as permitted sender) Authentication-Results: spf=softfail (sender IP is 66.129.239.17) smtp.mailfrom=phil@juniper.net; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:BN1PR05MB437; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BN1PR05MB278; X-OriginatorOrg: juniper.net X-Mailman-Approved-At: Wed, 10 Dec 2014 21:47:41 +0000 Cc: "freebsd-hackers@freebsd.org" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Dec 2014 20:36:52 -0000 Stefan Esser writes: >It seems, that libxo/xo.h depends on stdio.h (or at least >stdarg.h) for functions that use FILE or varargs. This is >not mentioned in the respective man-pages for the affected >functions (and I think it should be ...). I'll fix that. >Is there a description of the rules, which decide whether >quotes are put around JSON formatted information elements. >It seems, for example, that use of %d in format strings >suppresses quotes, which was unexpected, if the format is >e.g. "xyz%d" (which is a string, despite the %d ...). >And formatted output that contains blanks within the field >is probably also a string (even "%d %d", hmmm, but "%d.%d" >might be a number ...). http://juniper.github.io/libxo/libxo-manual.html#the-quotes-modifier-q Quotes default to on for strings, off for others. >But I have to admit, that I do not really know the rules for >quotes around data fields in JSON. (E.g. must I write "true" >to represent a string value of "true", or could I also use >true without quotes to represent a truth value? What do >parsers do if there are unquoted words or words separated >by blanks?) JSON uses "true", "false", and "null" (without quotes) as unquoted tokens. If you want a boolean, you'll need: xo_emit("{n:valid/%s}", valid ? "true" : "false"); >Are there any plans for a versioning scheme for XO extended >programs. E.g. if I need to change some of the elements or >labels in pciconf, how do I include the information about the >file schema being the old or the new one in an output file. >I could f.i. just add an xo_emit(":e/schema-version/1") at >the head of the file, to make the file format version explicit >in the generated output ... No plans. In practice, your tags become an API, and changes to that API require an attitude of "don't break your users". Most users won't check versioning information. Please let me know what's unclear from the docs and I'll try to improve them. Thanks, Phil