[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Reply to: [list | sender only]
Re: CIF-JSON draft 2017-05-08
- Subject: Re: CIF-JSON draft 2017-05-08
- From: Marcin Wojdyr <wojdyr@xxxxxxxxx>
- Date: Thu, 11 May 2017 17:05:46 +0100
- DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;h=mime-version:in-reply-to:references:from:date:message-id:subject:to:content-transfer-encoding;bh=hYeOVKhv+y6n20gMycxfvEhkEllyqKZR7Dlu4Ab98VY=;b=lb5SjFszcreuIzXiF3AX6j487qZv5k3jUDaUhxmIwZ+viVF++pzPswkgvfX75h3w6oxUjhUemeXeCL0AiVfC9ZNNXbCiixeEc9xwS/ev7x+ORn8jlyOF6Y7cJU3pvHYPWfWZHtwOgCmaTm4K1kv9hffA9piIlWDuE2qNuyPF22AfcROkSjNrI8S92t9PtEdwAXDZEx3bCwxboYvHB/ZqxPdjGIhh9vEJAjuk+QeTB77UX5aijvcuHXZ+GVMlcMplrUluJz9JJRw8CJkAe+ZimvBSMj0xGrDz0yuPTjG3V8X4pt89H4TzTf17RvSZlLlunlxqZAGxKdAEdy8SsG8XqA==
- In-Reply-To: <MWHPR04MB05126FD3CD4A9BB054F648C7E0ED0@MWHPR04MB0512.namprd04.prod.outlook.com>
- References: <CAM+dB2cwoCG6LhPUePRup_hQtM9mXqwL4tULTPf-WGwJGtKrOA@mail.gmail.com><MWHPR04MB051220BFF5C7093CD86702CCE0EE0@MWHPR04MB0512.namprd04.prod.outlook.com><CAF_YUvW=i0XjfzmgA=m03a=X4Y03+FfH8_TAZ2dNPVAhCmuy5w@mail.gmail.com><MWHPR04MB0512E4FA07327A5E9103106CE0EE0@MWHPR04MB0512.namprd04.prod.outlook.com><CACaHzQVez_WUma3z2mAXYroiJtEDtxaUAS-n0Noz-R=nPBTF+w@mail.gmail.com><MWHPR04MB05120B2E2061754ABEBED31AE0EE0@MWHPR04MB0512.namprd04.prod.outlook.com><CACaHzQXKMAqo97iZ6ZdHP_yFhRVKiEBsyMbHZxkBxKwPPcc7LA@mail.gmail.com><MWHPR04MB0512A0D165506326550ED871E0EF0@MWHPR04MB0512.namprd04.prod.outlook.com><CAM+dB2fyQe2KSNRv-+q=Sq3NFWSCK72kBTsUiiJfeSa=PQfvNQ@mail.gmail.com><CACaHzQXxiB=eACzuxT+bqmYyCmcVa-ZABkKOLzm3C5-53xYFvA@mail.gmail.com><CAM+dB2d9G9Hxoz2BToMoVPRdY9_kDvjRBAuJaSgzFAw26fDBtA@mail.gmail.com><CACaHzQX2XURonZEb1gNyE8sqpMV72EN10SXx9=xOPs6oLR-xcQ@mail.gmail.com><MWHPR04MB05126FD3CD4A9BB054F648C7E0ED0@MWHPR04MB0512.namprd04.prod.outlook.com>
John,thanks for the historical perspective, it explains a lot.I think that this and the discussion about equivalence of looped andnot-looped values made me finally understand the CIF format. >> I meant that there is no simple way to a write numb parser in C/C++ otherwise.>> I suppose you were observing that conventional CIF numeric format is locale-insensitive, but the C standard library's `strtod()` is locale-sensitive, and the current locale on which it relies is a process-wide property. Indeed, if you want your C program to parse CIF numeric format in a manner that is both thread-safe and correctly locale-insensitive then you need either to do at least a bit more work or to rely on a suitable third-party library, such as the CIF API. How simple that is is a matter of opinion, I guess. Before the CIF API, I had written parse functions for CIF numeric format at least twice before, in C and Fortran, and maybe in Java as well. Yes, I also wrote a numb parser as part of CIF-parsing library:https://github.com/project-gemmi/gemmiBTW I considered using existing parsers, including cif_api, but in theend I decided that it's better to write a new one in C++11. The cifparsing part with Python bindings is <1KLOC. And thanks to the toolsused (C++11 compiler and a library named PEGTL) it happens to be oneof the fastest parsers without any clever optimizations. About 3xfaster than cif_api in the syntax validation mode. (it's not relevanthere but I couldn't resist) Still, I think that those who will work with JSON format will see itas unfortunate that the numbers are not given to them ready to use. That said, and after writing too much, I agree that with theseconstraints having numbers as strings may be the best solution. Cheers,Marcin_______________________________________________cif-developers mailing listcif-developers@iucr.orghttp://mailman.iucr.org/cgi-bin/mailman/listinfo/cif-developers
Reply to: [list | sender only]
- References:
- CIF-JSON draft 2017-05-08 (James Hester)
- RE: CIF-JSON draft 2017-05-08 (Bollinger, John C)
- Re: CIF-JSON draft 2017-05-08 (Robert Hanson)
- RE: CIF-JSON draft 2017-05-08 (Bollinger, John C)
- Re: CIF-JSON draft 2017-05-08 (Marcin Wojdyr)
- RE: CIF-JSON draft 2017-05-08 (Bollinger, John C)
- Re: CIF-JSON draft 2017-05-08 (Marcin Wojdyr)
- RE: CIF-JSON draft 2017-05-08 (Bollinger, John C)
- Re: CIF-JSON draft 2017-05-08 (James Hester)
- Re: CIF-JSON draft 2017-05-08 (Marcin Wojdyr)
- Re: CIF-JSON draft 2017-05-08 (James Hester)
- Re: CIF-JSON draft 2017-05-08 (Marcin Wojdyr)
- RE: CIF-JSON draft 2017-05-08 (Bollinger, John C)
- Prev by Date: RE: CIF-JSON draft 2017-05-08
- Next by Date: CIF-JSON draft 2017-05-15
- Prev by thread: RE: CIF-JSON draft 2017-05-08
- Next by thread: Re: CIF-JSON draft 2017-05-08
- Index(es):