biodiversity 5.9.1 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d8e703cc56923264e8e22f952cbd830ece8ea6e37424361a75e162bd365ea53
4
- data.tar.gz: 9abfa4a51256a13ef70fa66f22f4409aac2bd5b94701dff1518f8d273848d431
3
+ metadata.gz: 323ba157e2da0f89adff6455f76a193dfaf745e3ad2d93f8758aec1624fe97ee
4
+ data.tar.gz: aa54199f592c05913431b128e6396bafc7133ee23fad0c62e025e8fac8ae78de
5
5
  SHA512:
6
- metadata.gz: 7f78cad633fa010aa9c7973108b1e78c9e54d28160f2161906a8963e52c28d2baa5e62c47e675ffafe316dca6166f4d3c85c50432c92d57607bdb6d7c3d42ac2
7
- data.tar.gz: 20a063b9504f384da8c876fe8f9b64814b89b843622027ee81b8cfee79fe616ee78e130444808b264b766a2fb0d42b1dfa577d17e202f93fcac1bf59a22712e7
6
+ metadata.gz: 30fc1c8f31ba3ade55a09d31657939503bd7dc3bcd024fa5e9abf6dffbf11cf989bf13ab661ab41407e18c59bf912c9e259f173a1e4295183c49a50870d49214
7
+ data.tar.gz: 93c0282ccabbcc634ff226c78c01ca6f3285bcf03427fbef89db045fa7553c98b142f4d9278e6b5c14e1e7853c96f5c1b56b68b04896f59444d7b6a320ff5a2f
@@ -0,0 +1,44 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master, pipe_approach ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ${{ matrix.os }}
20
+ strategy:
21
+ matrix:
22
+ os: [ubuntu-latest, macos-latest, windows-latest]
23
+ ruby: [2.6, 2.7, 3.0, 3.1, 3.2, 3.3]
24
+ fail-fast: false
25
+
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+ - name: Set up Ruby
29
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
30
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
31
+ # uses: ruby/setup-ruby@v1
32
+ uses: ruby/setup-ruby@v1
33
+ with:
34
+ ruby-version: ${{ matrix.ruby }}
35
+ - name: Install dependencies
36
+ run: bundle install --jobs 4 --retry 3
37
+ - name: Show environment
38
+ run: gem environment
39
+ - name: Run tests
40
+ run: bundle exec rake
41
+ - name: Checking install works
42
+ run: rake install
43
+ - name: Check gem with IRB
44
+ run: cd && pwd && echo "require 'biodiversity'; Biodiversity::Parser.parse('Testidae')" | irb
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.3.0
1
+ 3.3.5
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2008-2020 Dmitry Mozzherin
3
+ Copyright (c) 2008-2024 Dmitry Mozzherin
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -95,9 +95,9 @@ Biodiversity::Parser.parse(" Plantago major ")[:normalized]
95
95
  # to get canonical form with or without infraspecies ranks, as well as
96
96
  # stemmed version.
97
97
  parsed = Biodiversity::Parser.parse("Seddera latifolia H. & S. var. latifolia")
98
- parsed[:canonicalName][:full]
99
- parsed[:canonicalName][:simple]
100
- parsed[:canonicalName][:stem]
98
+ parsed[:canonical][:full]
99
+ parsed[:canonical][:simple]
100
+ parsed[:canonical][:stem]
101
101
 
102
102
  # to get detailed information about elements of the name
103
103
  Biodiversity::Parser.parse("Pseudocercospora dendrobii (H.C. Burnett 1883) U. \
@@ -126,11 +126,11 @@ For example "Homo sapiens" should generate
126
126
 
127
127
  ## Copyright
128
128
 
129
- Authors: [Dmitry Mozzherin][dimus]
129
+ Authors: [Dmitry Mozzherin][dimus], [Hernán Lucas Pereira][hernan]
130
130
 
131
- Contributors: [Patrick Leary][pleary], [Hernán Lucas Pereira][hernan]
131
+ Contributors: [Patrick Leary][pleary]
132
132
 
133
- Copyright (c) 2008-2021 Dmitry Mozzherin. See [LICENSE][license]
133
+ Copyright (c) 2008-2024 Dmitry Mozzherin. See [LICENSE][license]
134
134
  for further details.
135
135
 
136
136
  [gem_svg]: https://badge.fury.io/rb/biodiversity.svg
data/biodiversity.gemspec CHANGED
@@ -20,10 +20,10 @@ Gem::Specification.new do |gem|
20
20
 
21
21
  gem.add_runtime_dependency 'ffi', '~> 1.15'
22
22
 
23
- gem.add_development_dependency 'bundler', '~> 2.4'
24
23
  gem.add_development_dependency 'byebug', '~> 11.1'
25
24
  gem.add_development_dependency 'rake', '~> 13.0'
26
25
  gem.add_development_dependency 'rspec', '~> 3.12'
27
26
  gem.add_development_dependency 'rubocop', '~> 1.50'
27
+ gem.add_development_dependency 'rubocop-rubycw', '~> 0.1.6'
28
28
  gem.add_development_dependency 'solargraph', '~> 0.49'
29
29
  end
Binary file
data/ext/gnparser-mac ADDED
Binary file
Binary file
@@ -0,0 +1,148 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'open3'
4
+ require 'csv'
5
+
6
+ module Biodiversity
7
+ # Parser provides a namespace for functions to parse scientific names.
8
+ module Parser
9
+ # gnparser abstract class interface
10
+ class GnParser
11
+ def parse(name)
12
+ sync do
13
+ push(name)
14
+ pull
15
+ end
16
+ end
17
+
18
+ def parse_ary(ary)
19
+ sync do
20
+ count = ary.count
21
+ Thread.new do
22
+ ary.each { |n| push(n) }
23
+ end
24
+
25
+ res = []
26
+ count.times { res << pull }
27
+ res
28
+ end
29
+ end
30
+
31
+ private
32
+
33
+ def initialize(extra_settings = '')
34
+ @semaphore = Mutex.new
35
+ @pid = nil
36
+ @extra_settings = extra_settings
37
+ end
38
+
39
+ def start_gnparser
40
+ platform_suffix =
41
+ case Gem.platforms[1].os
42
+ when 'linux'
43
+ 'linux'
44
+ when 'darwin'
45
+ 'mac'
46
+ when /^mingw\d{2}?$/
47
+ 'win.exe'
48
+ else
49
+ raise "Unsupported platform: #{Gem.platforms[1].os}"
50
+ end
51
+ path = File.join(__dir__, '..', '..', '..',
52
+ 'ext', "gnparser-#{platform_suffix}")
53
+
54
+ @stdin, @stdout = Open3.popen2(
55
+ "#{path} --format #{format} --details --quiet --stream --jobs 1 #{@extra_settings}"
56
+ )
57
+
58
+ init_gnparser
59
+
60
+ @pid = Process.pid
61
+ end
62
+
63
+ def sync
64
+ @semaphore.synchronize do
65
+ start_gnparser unless Process.pid == @pid
66
+ yield
67
+ end
68
+ end
69
+
70
+ def retry_pipe(retries = 1)
71
+ yield
72
+ rescue Errno::EPIPE
73
+ if retries.zero?
74
+ @pid = nil
75
+ raise
76
+ else
77
+ start_gnparser
78
+ retries -= 1
79
+ retry
80
+ end
81
+ end
82
+
83
+ def push(name)
84
+ name = clean_name(name)
85
+ retry_pipe { @stdin.puts(name) }
86
+ end
87
+
88
+ def pull
89
+ output = retry_pipe { @stdout.gets }
90
+ parse_output(output)
91
+ end
92
+
93
+ def clean_name(name)
94
+ name.gsub(/(\n|\r\n|\r)/, ' ')
95
+ end
96
+
97
+ def init_gnparser; end
98
+
99
+ # gnparser interface to CSV-formatted output
100
+ class Csv < self
101
+ def parse_output(output)
102
+ parsed = CSV.new(output).first
103
+ {
104
+ id: get_csv_value(parsed, 'Id'),
105
+ verbatim: get_csv_value(parsed, 'Verbatim'),
106
+ cardinality: get_csv_value(parsed, 'Cardinality'),
107
+ canonical: {
108
+ stemmed: get_csv_value(parsed, 'CanonicalStem'),
109
+ simple: get_csv_value(parsed, 'CanonicalSimple'),
110
+ full: get_csv_value(parsed, 'CanonicalFull')
111
+ },
112
+ authorship: get_csv_value(parsed, 'Authorship'),
113
+ year: get_csv_value(parsed, 'Year'),
114
+ quality: get_csv_value(parsed, 'Quality')&.to_i
115
+ }
116
+ end
117
+
118
+ def format
119
+ 'csv'
120
+ end
121
+
122
+ def init_gnparser
123
+ @csv_mapping = {}
124
+ CSV.new(@stdout.gets).read[0].each.with_index do |header, index|
125
+ @csv_mapping[header] = index
126
+ end
127
+ end
128
+
129
+ def get_csv_value(csv, field_name)
130
+ csv[@csv_mapping[field_name]]
131
+ end
132
+ end
133
+
134
+ # gnparser interface to JSON-formatted output
135
+ class Compact < self
136
+ def parse_output(output)
137
+ JSON.parse(output, symbolize_names: true).tap { |o| o&.dig(:parserVersion)&.sub!(/^/, 'GNparser ') }
138
+ end
139
+
140
+ def format
141
+ 'compact'
142
+ end
143
+ end
144
+ end
145
+
146
+ private_constant :GnParser
147
+ end
148
+ end
@@ -1,100 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # CLib is required to free memory after it is used by C
4
- module CLib
5
- extend FFI::Library
6
- ffi_lib FFI::Library::LIBC
7
- attach_function :free, [:pointer], :void
8
- end
3
+ require_relative 'parser/gnparser'
9
4
 
10
5
  module Biodiversity
11
6
  # Parser provides a namespace for functions to parse scientific names.
12
7
  module Parser
13
- extend FFI::Library
14
-
15
- platform = case Gem.platforms[1].os
16
- when 'linux'
17
- 'linux'
18
- when 'darwin'
19
- 'mac'
20
- when 'mingw32'
21
- 'win'
22
- else
23
- raise "Unsupported platform: #{Gem.platforms[1].os}"
24
- end
25
- ffi_lib File.join(__dir__, '..', '..', 'clib', platform, 'libgnparser.so')
26
- POINTER_SIZE = FFI.type_size(:pointer)
27
-
28
- callback(:parser_callback, %i[string], :void)
29
-
30
- attach_function(:parse_go, :ParseToString,
31
- %i[string string int int], :strptr)
32
- attach_function(:parse_ary_go, :ParseAryToString,
33
- %i[pointer int string int int], :strptr)
34
- attach_function(:free_mem, :FreeMemory, %i[pointer], :void)
8
+ @compact_gnparser = {
9
+ false => GnParser::Compact.new,
10
+ true => GnParser::Compact.new('--cultivar')
11
+ }
12
+ @csv_gnparser = {
13
+ false => GnParser::Csv.new,
14
+ true => GnParser::Csv.new('--cultivar')
15
+ }
35
16
 
36
17
  def self.parse(name, simple: false, with_cultivars: false)
37
- format = simple ? 'csv' : 'compact'
38
- with_details = simple ? 0 : 1
39
- with_cultivars = with_cultivars ? 1 : 0
40
-
41
- parsed, ptr = parse_go(name, format, with_details, with_cultivars)
42
- free_mem(ptr)
43
- output(parsed, simple)
18
+ (simple ? @csv_gnparser[!!with_cultivars] : @compact_gnparser[!!with_cultivars]).parse(name)
44
19
  end
45
20
 
46
21
  def self.parse_ary(ary, simple: false, with_cultivars: false)
47
- format = simple ? 'csv' : 'compact'
48
- with_details = simple ? 0 : 1
49
- with_cultivars = with_cultivars ? 1 : 0
50
-
51
- in_ptr = FFI::MemoryPointer.new(:pointer, ary.length)
52
- in_ptr.write_array_of_pointer(
53
- ary.map { |s| FFI::MemoryPointer.from_string(s) }
54
- )
55
-
56
- parsed, ptr = parse_ary_go(in_ptr, ary.length, format,
57
- with_details, with_cultivars)
58
- free_mem(ptr)
59
- if simple
60
- CSV.new(parsed.force_encoding('UTF-8')).map do |row|
61
- csv_row(row)
62
- end
63
- else
64
- JSON.parse(parsed, symbolize_names: true).map do |item|
65
- item[:parserVersion] = Biodiversity.gnparser_version
66
- item
67
- end
68
- end
69
- end
70
-
71
- def self.output(parsed, simple)
72
- if simple
73
- parsed = parsed.force_encoding('UTF-8')
74
- csv = CSV.new(parsed)
75
- row = csv.readlines[0]
76
- csv_row(row)
77
- else
78
- parsed = JSON.parse(parsed, symbolize_names: true)
79
- parsed[:parserVersion] = Biodiversity.gnparser_version
80
- parsed
81
- end
82
- end
83
-
84
- def self.csv_row(row)
85
- {
86
- id: row[0],
87
- verbatim: row[1],
88
- cardinality: row[2].to_i,
89
- canonical: {
90
- stem: row[3],
91
- simple: row[4],
92
- full: row[5]
93
- },
94
- authorship: row[6],
95
- year: row[7],
96
- quality: row[8].to_i
97
- }
22
+ (simple ? @csv_gnparser[!!with_cultivars] : @compact_gnparser[!!with_cultivars]).parse_ary(ary)
98
23
  end
99
24
  end
100
25
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  # Biodiversity module provides a namespace for scientific name parser.
4
4
  module Biodiversity
5
- VERSION = '5.9.1'
6
- GNPARSER_VERSION = 'GNparser 1.9.1'
5
+ VERSION = '6.0.0'
6
+ GNPARSER_VERSION = 'GNparser 1.10.1'
7
7
 
8
8
  def self.version
9
9
  VERSION
data/lib/biodiversity.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ffi'
4
3
  require 'json'
5
4
  require 'csv'
6
5
  require_relative 'biodiversity/version'
@@ -6,4 +6,10 @@ describe Biodiversity do
6
6
  expect(subject.version).to match(/\d+\.\d+\.\d+/)
7
7
  end
8
8
  end
9
+ describe 'gnparser_version' do
10
+ it 'matches bundled binary version' do
11
+ binary_version = Biodiversity::Parser.parse('')[:parserVersion].match(/\d.*$/).to_s
12
+ expect(subject.gnparser_version).to match("GNparser #{binary_version}")
13
+ end
14
+ end
9
15
  end
@@ -27,6 +27,12 @@ describe Biodiversity::Parser do
27
27
  expect(parsed[:normalized]).to be_nil
28
28
  end
29
29
 
30
+ it 'treats newlines as whitespaces' do # Requirement for IPC to work
31
+ parsed = subject.parse("\nHomo\r\nsapiens\nLinn.\r1758\n")
32
+ expect(parsed[:verbatim]).to eq ' Homo sapiens Linn. 1758 '
33
+ expect(parsed[:normalized]).to eq parsed[:verbatim].strip
34
+ end
35
+
30
36
  it 'parses botanical cultivars in full form' do
31
37
  parsed = subject.parse('Aus bus "White Russian"',
32
38
  simple: false, with_cultivars: true)
@@ -79,5 +85,13 @@ describe Biodiversity::Parser do
79
85
  expect(parsed[2][:quality]).to eq 1
80
86
  expect(parsed[2][:parserVersion]).to match(/GNparser/)
81
87
  end
88
+
89
+ it 'treats newlines as whitespaces' do # Requirement for IPC to work
90
+ parsed = subject.parse_ary(["\nHomo\r\nsapiens\nLinn.\r1758\n"])
91
+ expect(parsed.length).to eq 1
92
+ parsed = parsed.first
93
+ expect(parsed[:verbatim]).to eq ' Homo sapiens Linn. 1758 '
94
+ expect(parsed[:normalized]).to eq parsed[:verbatim].strip
95
+ end
82
96
  end
83
97
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: biodiversity
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.9.1
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Mozzherin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-22 00:00:00.000000000 Z
11
+ date: 2024-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.15'
27
- - !ruby/object:Gem::Dependency
28
- name: bundler
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '2.4'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '2.4'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: byebug
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +80,20 @@ dependencies:
94
80
  - - "~>"
95
81
  - !ruby/object:Gem::Version
96
82
  version: '1.50'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-rubycw
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.1.6
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.1.6
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: solargraph
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -114,6 +114,7 @@ executables: []
114
114
  extensions: []
115
115
  extra_rdoc_files: []
116
116
  files:
117
+ - ".github/workflows/ruby.yml"
117
118
  - ".gitignore"
118
119
  - ".rspec"
119
120
  - ".rubocop.yml"
@@ -125,14 +126,12 @@ files:
125
126
  - README.md
126
127
  - Rakefile
127
128
  - biodiversity.gemspec
128
- - clib/linux/libgnparser.h
129
- - clib/linux/libgnparser.so
130
- - clib/mac/libgnparser.h
131
- - clib/mac/libgnparser.so
132
- - clib/win/libgnparser.h
133
- - clib/win/libgnparser.so
129
+ - ext/gnparser-linux
130
+ - ext/gnparser-mac
131
+ - ext/gnparser-win.exe
134
132
  - lib/biodiversity.rb
135
133
  - lib/biodiversity/parser.rb
134
+ - lib/biodiversity/parser/gnparser.rb
136
135
  - lib/biodiversity/version.rb
137
136
  - spec/lib/biodiversity_spec.rb
138
137
  - spec/lib/parser_spec.rb
@@ -156,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
155
  - !ruby/object:Gem::Version
157
156
  version: '0'
158
157
  requirements: []
159
- rubygems_version: 3.5.3
158
+ rubygems_version: 3.5.16
160
159
  signing_key:
161
160
  specification_version: 4
162
161
  summary: Parser of scientific names
@@ -1,103 +0,0 @@
1
- /* Code generated by cmd/cgo; DO NOT EDIT. */
2
-
3
- /* package github.com/gnames/gnparser/binding */
4
-
5
-
6
- #line 1 "cgo-builtin-export-prolog"
7
-
8
- #include <stddef.h>
9
-
10
- #ifndef GO_CGO_EXPORT_PROLOGUE_H
11
- #define GO_CGO_EXPORT_PROLOGUE_H
12
-
13
- #ifndef GO_CGO_GOSTRING_TYPEDEF
14
- typedef struct { const char *p; ptrdiff_t n; } _GoString_;
15
- #endif
16
-
17
- #endif
18
-
19
- /* Start of preamble from import "C" comments. */
20
-
21
-
22
- #line 5 "main.go"
23
-
24
- #include "stdlib.h"
25
-
26
- #line 1 "cgo-generated-wrapper"
27
-
28
-
29
- /* End of preamble from import "C" comments. */
30
-
31
-
32
- /* Start of boilerplate cgo prologue. */
33
- #line 1 "cgo-gcc-export-header-prolog"
34
-
35
- #ifndef GO_CGO_PROLOGUE_H
36
- #define GO_CGO_PROLOGUE_H
37
-
38
- typedef signed char GoInt8;
39
- typedef unsigned char GoUint8;
40
- typedef short GoInt16;
41
- typedef unsigned short GoUint16;
42
- typedef int GoInt32;
43
- typedef unsigned int GoUint32;
44
- typedef long long GoInt64;
45
- typedef unsigned long long GoUint64;
46
- typedef GoInt64 GoInt;
47
- typedef GoUint64 GoUint;
48
- typedef size_t GoUintptr;
49
- typedef float GoFloat32;
50
- typedef double GoFloat64;
51
- #ifdef _MSC_VER
52
- #include <complex.h>
53
- typedef _Fcomplex GoComplex64;
54
- typedef _Dcomplex GoComplex128;
55
- #else
56
- typedef float _Complex GoComplex64;
57
- typedef double _Complex GoComplex128;
58
- #endif
59
-
60
- /*
61
- static assertion to make sure the file is being used on architecture
62
- at least with matching size of GoInt.
63
- */
64
- typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
65
-
66
- #ifndef GO_CGO_GOSTRING_TYPEDEF
67
- typedef _GoString_ GoString;
68
- #endif
69
- typedef void *GoMap;
70
- typedef void *GoChan;
71
- typedef struct { void *t; void *v; } GoInterface;
72
- typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
73
-
74
- #endif
75
-
76
- /* End of boilerplate cgo prologue. */
77
-
78
- #ifdef __cplusplus
79
- extern "C" {
80
- #endif
81
-
82
-
83
- // ParseToString function takes a name-string, desired format, a withDetails
84
- // flag as 0|1 integer. It parses the name-string to either JSON, or a CSV
85
- // string, depending on the desired format. Format argument can take values of
86
- // 'csv', 'compact', 'pretty'. If withDetails argument is 0, additional
87
- // parsed details are ommited, if it is 1 -- they are included.
88
- // true.
89
- extern char* ParseToString(char* name, char* f, int details, int cultivars, int diaereses);
90
-
91
- // FreeMemory takes a string pointer and frees its memory.
92
- extern void FreeMemory(char* p);
93
-
94
- // ParseAryToString function takes an array of names, parsing format, and a
95
- // withDetails flag as 0|1 integer. Parsed outputs are sent as a string in
96
- // either CSV or JSON format. Format argument can take values of 'csv',
97
- // 'compact', or 'pretty'. For withDetails argument 0 means false, 1 means
98
- // true.
99
- extern char* ParseAryToString(char** in, int length, char* f, int details, int cultivars, int diaereses);
100
-
101
- #ifdef __cplusplus
102
- }
103
- #endif
Binary file
@@ -1,103 +0,0 @@
1
- /* Code generated by cmd/cgo; DO NOT EDIT. */
2
-
3
- /* package github.com/gnames/gnparser/binding */
4
-
5
-
6
- #line 1 "cgo-builtin-export-prolog"
7
-
8
- #include <stddef.h>
9
-
10
- #ifndef GO_CGO_EXPORT_PROLOGUE_H
11
- #define GO_CGO_EXPORT_PROLOGUE_H
12
-
13
- #ifndef GO_CGO_GOSTRING_TYPEDEF
14
- typedef struct { const char *p; ptrdiff_t n; } _GoString_;
15
- #endif
16
-
17
- #endif
18
-
19
- /* Start of preamble from import "C" comments. */
20
-
21
-
22
- #line 5 "main.go"
23
-
24
- #include "stdlib.h"
25
-
26
- #line 1 "cgo-generated-wrapper"
27
-
28
-
29
- /* End of preamble from import "C" comments. */
30
-
31
-
32
- /* Start of boilerplate cgo prologue. */
33
- #line 1 "cgo-gcc-export-header-prolog"
34
-
35
- #ifndef GO_CGO_PROLOGUE_H
36
- #define GO_CGO_PROLOGUE_H
37
-
38
- typedef signed char GoInt8;
39
- typedef unsigned char GoUint8;
40
- typedef short GoInt16;
41
- typedef unsigned short GoUint16;
42
- typedef int GoInt32;
43
- typedef unsigned int GoUint32;
44
- typedef long long GoInt64;
45
- typedef unsigned long long GoUint64;
46
- typedef GoInt64 GoInt;
47
- typedef GoUint64 GoUint;
48
- typedef size_t GoUintptr;
49
- typedef float GoFloat32;
50
- typedef double GoFloat64;
51
- #ifdef _MSC_VER
52
- #include <complex.h>
53
- typedef _Fcomplex GoComplex64;
54
- typedef _Dcomplex GoComplex128;
55
- #else
56
- typedef float _Complex GoComplex64;
57
- typedef double _Complex GoComplex128;
58
- #endif
59
-
60
- /*
61
- static assertion to make sure the file is being used on architecture
62
- at least with matching size of GoInt.
63
- */
64
- typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
65
-
66
- #ifndef GO_CGO_GOSTRING_TYPEDEF
67
- typedef _GoString_ GoString;
68
- #endif
69
- typedef void *GoMap;
70
- typedef void *GoChan;
71
- typedef struct { void *t; void *v; } GoInterface;
72
- typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
73
-
74
- #endif
75
-
76
- /* End of boilerplate cgo prologue. */
77
-
78
- #ifdef __cplusplus
79
- extern "C" {
80
- #endif
81
-
82
-
83
- // ParseToString function takes a name-string, desired format, a withDetails
84
- // flag as 0|1 integer. It parses the name-string to either JSON, or a CSV
85
- // string, depending on the desired format. Format argument can take values of
86
- // 'csv', 'compact', 'pretty'. If withDetails argument is 0, additional
87
- // parsed details are ommited, if it is 1 -- they are included.
88
- // true.
89
- extern char* ParseToString(char* name, char* f, int details, int cultivars, int diaereses);
90
-
91
- // FreeMemory takes a string pointer and frees its memory.
92
- extern void FreeMemory(char* p);
93
-
94
- // ParseAryToString function takes an array of names, parsing format, and a
95
- // withDetails flag as 0|1 integer. Parsed outputs are sent as a string in
96
- // either CSV or JSON format. Format argument can take values of 'csv',
97
- // 'compact', or 'pretty'. For withDetails argument 0 means false, 1 means
98
- // true.
99
- extern char* ParseAryToString(char** in, int length, char* f, int details, int cultivars, int diaereses);
100
-
101
- #ifdef __cplusplus
102
- }
103
- #endif
Binary file
@@ -1,103 +0,0 @@
1
- /* Code generated by cmd/cgo; DO NOT EDIT. */
2
-
3
- /* package github.com/gnames/gnparser/binding */
4
-
5
-
6
- #line 1 "cgo-builtin-export-prolog"
7
-
8
- #include <stddef.h>
9
-
10
- #ifndef GO_CGO_EXPORT_PROLOGUE_H
11
- #define GO_CGO_EXPORT_PROLOGUE_H
12
-
13
- #ifndef GO_CGO_GOSTRING_TYPEDEF
14
- typedef struct { const char *p; ptrdiff_t n; } _GoString_;
15
- #endif
16
-
17
- #endif
18
-
19
- /* Start of preamble from import "C" comments. */
20
-
21
-
22
- #line 5 "main.go"
23
-
24
- #include "stdlib.h"
25
-
26
- #line 1 "cgo-generated-wrapper"
27
-
28
-
29
- /* End of preamble from import "C" comments. */
30
-
31
-
32
- /* Start of boilerplate cgo prologue. */
33
- #line 1 "cgo-gcc-export-header-prolog"
34
-
35
- #ifndef GO_CGO_PROLOGUE_H
36
- #define GO_CGO_PROLOGUE_H
37
-
38
- typedef signed char GoInt8;
39
- typedef unsigned char GoUint8;
40
- typedef short GoInt16;
41
- typedef unsigned short GoUint16;
42
- typedef int GoInt32;
43
- typedef unsigned int GoUint32;
44
- typedef long long GoInt64;
45
- typedef unsigned long long GoUint64;
46
- typedef GoInt64 GoInt;
47
- typedef GoUint64 GoUint;
48
- typedef size_t GoUintptr;
49
- typedef float GoFloat32;
50
- typedef double GoFloat64;
51
- #ifdef _MSC_VER
52
- #include <complex.h>
53
- typedef _Fcomplex GoComplex64;
54
- typedef _Dcomplex GoComplex128;
55
- #else
56
- typedef float _Complex GoComplex64;
57
- typedef double _Complex GoComplex128;
58
- #endif
59
-
60
- /*
61
- static assertion to make sure the file is being used on architecture
62
- at least with matching size of GoInt.
63
- */
64
- typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
65
-
66
- #ifndef GO_CGO_GOSTRING_TYPEDEF
67
- typedef _GoString_ GoString;
68
- #endif
69
- typedef void *GoMap;
70
- typedef void *GoChan;
71
- typedef struct { void *t; void *v; } GoInterface;
72
- typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
73
-
74
- #endif
75
-
76
- /* End of boilerplate cgo prologue. */
77
-
78
- #ifdef __cplusplus
79
- extern "C" {
80
- #endif
81
-
82
-
83
- // ParseToString function takes a name-string, desired format, a withDetails
84
- // flag as 0|1 integer. It parses the name-string to either JSON, or a CSV
85
- // string, depending on the desired format. Format argument can take values of
86
- // 'csv', 'compact', 'pretty'. If withDetails argument is 0, additional
87
- // parsed details are ommited, if it is 1 -- they are included.
88
- // true.
89
- extern __declspec(dllexport) char* ParseToString(char* name, char* f, int details, int cultivars, int diaereses);
90
-
91
- // FreeMemory takes a string pointer and frees its memory.
92
- extern __declspec(dllexport) void FreeMemory(char* p);
93
-
94
- // ParseAryToString function takes an array of names, parsing format, and a
95
- // withDetails flag as 0|1 integer. Parsed outputs are sent as a string in
96
- // either CSV or JSON format. Format argument can take values of 'csv',
97
- // 'compact', or 'pretty'. For withDetails argument 0 means false, 1 means
98
- // true.
99
- extern __declspec(dllexport) char* ParseAryToString(char** in, int length, char* f, int details, int cultivars, int diaereses);
100
-
101
- #ifdef __cplusplus
102
- }
103
- #endif
Binary file