%% Released under the LaTeX Project Public License v1.3c or later
%% See http://www.latex-project.org/lppl.txt
%% --------------------------------------------------------------
%% Based on the gost package styles by
%% Maksym Polyakov      © 1996-2005, 
%% Leonid Sinev         © 2017,
%% Igor A. Kotelnikov   © 2012-2021.
%% --------------------------------------------------------------
%% Alexey V. Kuznetsov: mailtokuznetsov@gmail.com
%% Detailed author&year citation style with long author list
%% Version 2026/09/06
%% --------------------------------------------------------------

ENTRY{
  address         % alias for location
  archivePrefix   % alias for eprinttype
  author
  authorcountry
  booktitle
  chapter
  compiler
  credits
  date
  doi
  edition
  editor
  eid
  eprint
  eprinttype      % alias for archivePrefix
  eprintclass     % alias for primaryClass
  holder
  howpublished
  institution     % alias for organization and school
  ipc
  isbn
  issn
  journal
  key
  language        % alias for langid
  langid          % alias for language
  location        % alias for address
  media
  month
  note
  number
  organization    % alias for institution and school
  origlanguage
  pages
  pagetotal
  primaryClass    % alias for eprintclass
  prioritycountry
  prioritydate
  prioritynumber
  publication
  publicationdate
  publisher
  requestdate
  requestnumber
  school          % alias for institution and organization
  series
  shorttitle
  specialitycode
  title
  titleaddon
  translator
  type
  url
  urldate
  volume
  year
  }{}{label extra.label sort.label short.list}

INTEGERS{
  output.state
  before.all
  mid.sentence
  after.sentence
  after.block
  after.dblslash
  after.slash
  after.colon
  after.semicolon }

STRINGS{curlanguage}
STRINGS{s t}
STRINGS{y m d}

FUNCTION{init.state.consts}{
  #0 'before.all :=
  #1 'mid.sentence :=
  #2 'after.sentence :=
  #3 'after.block :=
  #4 'after.dblslash :=
  #5 'after.slash :=
  #6 'after.colon :=
  #7 'after.semicolon := }

FUNCTION {set.language}{
  langid empty$
    {language empty$ {"english" 'curlanguage :=} {language  'curlanguage :=} if$}
    {langid  'curlanguage :=}
  if$}

FUNCTION{output.nonnull}{
  swap$
  output.state mid.sentence    = {", " * write$}
 {output.state after.block     = {add.period$ write$ "~\BibDash " write$ newline$ "\newblock " write$}
 {output.state before.all      = 'write$
 {output.state after.dblslash  = {"~/\!/ " * write$}
 {output.state after.slash     = {"~/ " * write$}
 {output.state after.colon     = {"~: " * write$}
 {output.state after.semicolon = {"~; " * write$} {add.period$ " " * write$}
  if$}if$}if$}if$}if$}if$
  mid.sentence 'output.state := }
  if$}

FUNCTION{output}{duplicate$ empty$ 'pop$ 'output.nonnull if$}

FUNCTION{fin.entry}{add.period$ "\endgroup" * write$ newline$}
FUNCTION{add.blank}    {" " * before.all 'output.state :=}
FUNCTION{new.block}    {output.state before.all  = 'skip$ {after.block     'output.state :=} if$}
FUNCTION{new.dblslash} {output.state before.all  = 'skip$ {after.dblslash  'output.state :=} if$}
FUNCTION{new.slash}    {output.state before.all  = 'skip$ {after.slash     'output.state :=} if$}
FUNCTION{new.colon}    {output.state before.all  = 'skip$ {after.colon     'output.state :=} if$}
FUNCTION{new.semicolon}{output.state before.all  = 'skip$ {after.semicolon 'output.state :=} if$}
FUNCTION {new.sentence}{output.state after.block = 'skip$
  {output.state before.all = 'skip$ {after.sentence 'output.state :=} if$} if$}

FUNCTION{not}{{#0} {#1} if$}
FUNCTION{and}{'skip$ {pop$ #0} if$}
FUNCTION{or} {{pop$ #1} 'skip$ if$}

FUNCTION{bracify}      {duplicate$ empty$ {pop$ ""} {"{" swap$ * "}" *}      if$}
FUNCTION{bracketise}   {duplicate$ empty$ {pop$ ""} {"[" swap$ * "]" *}      if$}
FUNCTION{paranthesify} {duplicate$ empty$ {pop$ ""} {"(" swap$ * ")" *}      if$}
FUNCTION{emphasize}    {duplicate$ empty$ 'skip$ {"\emph{" swap$ * "}" *} if$}

FUNCTION{thinspace.connect}{"\," swap$ * *}

FUNCTION{n.dashify}{
  't := ""
  {t empty$ not}
    {t #1 #1 substring$ "-" =
       {t #1 #2 substring$ "--" = not
          {"--" * t #2 global.max$ substring$ 't :=}
          {{t #1 #1 substring$ "-" =}
              {"-" * t #2 global.max$ substring$ 't :=}
           while$}
        if$}
       {t #1 #1 substring$ * t #2 global.max$ substring$ 't :=}
     if$}
  while$}

INTEGERS{multiresult nameptr namesleft numnames}

FUNCTION{bbl.etal}{
  curlanguage "english"   = {" et~al."}
 {curlanguage "german"    = {" u.~a."}
 {curlanguage "ukrainian" = {" та~ін."}
 {curlanguage "russian"   = {" и~др."}
 {"language is not defined: " curlanguage  " in bbl.etal" * * warning$ " et~al."}
 if$}if$}if$}if$}

FUNCTION{fmt.names.brief}{
  's :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
  {namesleft #0 >}
     {s nameptr "{vv~}{ll}" format.name$ 't :=
      nameptr #1 >
        {namesleft #1 > {", " * t *}
           {t "others" =  t "~others" =  or {bbl.etal *} {", " * t *} if$}
         if$}
        't
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=}
  while$}

FUNCTION{make.name.list}{
  type$ "book" = type$ "inbook" = or
    {author empty$
       {compiler empty$ not {compiler fmt.names.brief}
          {translator empty$ not {translator fmt.names.brief}
             {editor empty$ {""} {editor fmt.names.brief}
        if$}if$}if$}
       {author fmt.names.brief}
     if$}
    {type$ "proceedings" =
       {compiler empty$ not {compiler fmt.names.brief}
          {editor empty$ {""} {editor fmt.names.brief}
        if$}if$}
       {author empty$ {""} {author fmt.names.brief} if$}
  if$}if$}

FUNCTION {output.bibitem}{
  set.language
  newline$
  "\bibitem[" write$ label write$ ")" make.name.list * "]{" * write$ cite$ write$ "}" write$
  newline$ "\begingroup\selectlanguageifdefined" curlanguage bracify * write$
  newline$ ""
  before.all 'output.state :=}

FUNCTION{bbl.and}{
  curlanguage "english"   = {" and "}
 {curlanguage "german"    = {" und "}
 {curlanguage "ukrainian" = {"~i "}
 {curlanguage "russian"   = {author empty$ {"~и "} {s author = not {"~и "} {", "} if$} if$}
 {"language is not defined: " curlanguage  " in bbl.and" * * warning$ " and "}
 if$}if$}if$}if$}

FUNCTION{format.names}{
  's :=
  #1 'nameptr :=
  s num.names$ 'namesleft :=
  {namesleft #0 >}
     {s nameptr "{vv~}{ll}{~jj}{~ff}"
      format.name$ 't :=
      nameptr #1 > not 't {namesleft #1 > {", " * t *} {bbl.and t * *} if$} if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=}
  while$}

FUNCTION{format.authors}{author empty$ {""}  {author format.names emphasize} if$}

FUNCTION{get.year}{
  year empty$ not 'year
    {type$ "patent" = 
       {prioritydate empty$ {"" 't :=} {prioritydate 't :=} if$}
       {date empty$ {"" 't :=} {date 't :=} if$} 
     if$
     t empty$ {""}
       {t text.length$ #4 < {""}
         {curlanguage "russian" = 
            {t t text.length$ #3 - t text.length$ substring$}
            {t #1 #4 substring$}
  if$}if$}if$}if$}

FUNCTION{format.date}{get.year empty$ {""}   {get.year extra.label *} if$}
FUNCTION{add.year}{format.date empty$ 'skip$ {" " format.date paranthesify * *} if$}

FUNCTION{bbl.vol}{
  curlanguage "english"   = {"Vol."}
 {curlanguage "german"    = {"Bd."} 
 {curlanguage "ukrainian" = curlanguage "russian" = or {"Т."}
 {"language is not defined: " curlanguage " in bbl.vol" * * warning$ "Vol."}
 if$}if$}if$}

FUNCTION{format.volume}{volume empty$ {""} {bbl.vol volume thinspace.connect} if$}

FUNCTION {bbl.nr}{
  curlanguage "english" = {"no."}
 {curlanguage "german"  = {"nr."} 
 {curlanguage "russian" = curlanguage "ukrainian" = or {"№"}
 {"language is not defined: " curlanguage " in bbl.no" * * warning$ "no."}
 if$}if$}if$}

FUNCTION {bbl.No}{
  curlanguage "english" = {"No."}
 {curlanguage "german"  = {"Nr."} 
 {curlanguage "russian" = curlanguage "ukrainian" = or {"№"}
 {"language is not defined: " curlanguage " in bbl.No" * * warning$ "No."}
 if$}if$}if$}

FUNCTION{format.number}{
  number empty$ {""} 
    {volume empty$ 'bbl.No 'bbl.nr if$ number thinspace.connect}
  if$}

FUNCTION{bbl.lcpages}{
  curlanguage "english"   = {"p."} 
 {curlanguage "german"    = {"s."}
 {curlanguage "ukrainian" = curlanguage "russian" = or {"с."}
 {"language is not defined: " curlanguage " in bbl.lcpages" * * warning$ "p."}
 if$}if$}if$}

FUNCTION{bbl.ucpages}{
  curlanguage "english"   = {"P."} 
 {curlanguage "german"    = {"S."}
 {curlanguage "ukrainian" = curlanguage "russian" = or {"С."}
 {"language is not defined: " curlanguage " in bbl.ucpages" * * warning$ "P."}
 if$}if$}if$}

FUNCTION{multi.page.check}{
  't :=
  #0 'multiresult :=
  {multiresult not t empty$ not and}
     {t #1 #1 substring$
      duplicate$ "-" = swap$ duplicate$ "," = swap$ "+" = or or
        {#1 'multiresult :=} {t #2 global.max$ substring$ 't :=} if$}
  while$
  multiresult}

FUNCTION{format.pages}{
  pages empty$ {""} 
    {type$ "article" = type$ "inbook" = or type$ "incollection" = or type$ "inproceedings" = or
       {pages multi.page.check {pages n.dashify} 'pages if$
        chapter empty$ 'bbl.ucpages 'bbl.lcpages if$
        swap$ thinspace.connect}
       {pages multi.page.check {pages n.dashify} 'pages if$ bbl.lcpages thinspace.connect}
  if$}if$}

FUNCTION{format.eid.pages}{
   eid empty$ 'format.pages 
     {type empty$ 'eid {type " " eid * *} if$
      pages empty$ 'skip$ 
        {pages multi.page.check
          {", " bbl.lcpages * * pages n.dashify thinspace.connect} 
          {", " pages * * bbl.lcpages thinspace.connect} 
  if$}if$}if$}

FUNCTION{bbl.urldate}{
  curlanguage "english"   = {"online; accessed "}
 {curlanguage "german"    = {"online; abgerufen "}
 {curlanguage "ukrainian" = {"дата звернення: "}
 {curlanguage "russian"   = {"дата обращения: "}
 {"language is not defined: " curlanguage " in bbl.urldate" * * warning$ "online; accessed "}
 if$}if$}if$}if$}

FUNCTION{doi.url}{
  doi empty$
    {url empty$ {""}
       {urldate empty$
          {"URL: \url{" url "}" * *}
          {"URL: \url{" url "} (" bbl.urldate urldate ")" * * * * *}
     if$}if$}
    {"DOI: \href{https://doi.org/" doi "}{" doi "}" * * * *}
  if$}

FUNCTION{eprintclass.or.primaryClass}{
  eprintclass empty$ {primaryClass empty$ {""} 'primaryClass if$} 'eprintclass if$}

FUNCTION{eprinttype.or.archivePrefix}{
  eprinttype empty$ {archivePrefix empty$ {""} 'archivePrefix if$} 'eprinttype if$}

FUNCTION{format.eprint}{
  eprint empty$ {""}
    {eprint 's :=
     eprintclass.or.primaryClass empty$ 'skip$ {eprintclass.or.primaryClass "\,/ " s * * 's :=} if$
     eprinttype.or.archivePrefix  empty$ 'skip$  {eprinttype  "\,: " s * * 's :=} if$
     doi empty$ not {"\href{https://doi.org/" doi "}{" s "}" * * * *}
    {url empty$ not {"\href{" url "}{" s "}" * * * *}
    {eprinttype.or.archivePrefix "arXiv" = eprinttype.or.archivePrefix "arxiv" = or not 's
       {"\href{https://arxiv.org/abs/" eprint "}{" s "}" * * * *}
  if$}if$}if$}if$}

FUNCTION{format.issn}{
  issn empty$ {""}
    {"ISSN: \href{https://portal.issn.org/search?search=" issn "}{" issn "}" * * * *} 
  if$}

FUNCTION{format.isbn}{
  isbn empty$ {""}
    {"ISBN: \href{https://isbnsearch.org/isbn/" isbn "}{" isbn "}" * * * *} 
  if$}

FUNCTION{doi.url.other}{
   issn empty$ {"" 's :=} {format.issn 's :=} if$
   isbn empty$    'skip$ 
     {s empty$ {format.isbn   's :=} {s "~; " format.isbn * *   's :=} if$} if$
   doi.url empty$ 'skip$ 
     {s empty$ {doi.url       's :=} {s "~; " doi.url * *       's :=} if$} if$
   eprint empty$  'skip$ 
     {s empty$ {format.eprint 's :=} {s "~; " format.eprint * * 's :=} if$} if$
   s }

FUNCTION{format.title}{
  title empty$ {""}
    {title
     type$ "article" = type$ "inproceedings" = type$ "incollection" = or or 'skip$
       {titleaddon empty$ 'skip$ {"~: " titleaddon * *       } if$
        media      empty$ 'skip$ {"~: " *  media bracketise *} if$}
  if$}if$}

FUNCTION{add.title}{title empty$ 'skip$ {add.period$ " " format.title * *} if$}

FUNCTION{author.title.year}{
  author empty$ title empty$ and  {""}
    {author empty$ not {format.authors add.year add.title} {format.title add.year}
 if$}if$}

FUNCTION{check.author}   {author      empty$ {"empty author in "    cite$ * warning$} 'skip$ if$}
FUNCTION{check.title}    {title       empty$ {"empty title in "     cite$ * warning$} 'skip$ if$}
FUNCTION{check.year}     {format.date empty$ {"empty year in "      cite$ * warning$} 'skip$ if$}
FUNCTION{check.publisher}{publisher   empty$ {"empty publisher in " cite$ * warning$} 'skip$ if$}  
FUNCTION{check.booktitle}{booktitle   empty$ {"empty booktitle in " cite$ * warning$} 'skip$ if$}
FUNCTION{check.type}     {type        empty$ {"empty type in "      cite$ * warning$} 'skip$ if$}

FUNCTION{check.journal}{
  journal empty$ {"empty journal in " cite$ * warning$} 'skip$ if$
  check.author check.year} 

FUNCTION{article}{
  output.bibitem    check.journal
  author.title.year output new.dblslash
  journal           output
  series            output new.sentence
  format.volume     output
  format.number     output new.sentence       
  format.eid.pages  output new.sentence  
  note              output new.block
  doi.url.other     output fin.entry}

FUNCTION{bbl.edition}{
  curlanguage "english"   = {"ed."}
 {curlanguage "german"    = {"aus."} 
 {curlanguage "ukrainian" = {"вид."}
 {curlanguage "russian"   = {"изд."}
 {"language is not defined: " curlanguage " in bbl.edition" * * warning$ "ed."}
 if$}if$}if$}if$}

FUNCTION{format.edition}{
  edition empty$ {""}
    {type$ "manual" = 'edition {edition bbl.edition thinspace.connect} if$}
  if$}

FUNCTION{address.or.location}{
  address empty$ {location empty$ {""} 'location if$} 'address if$}

FUNCTION{address.publisher}{
  publisher empty$ 'address.or.location 
    {address.or.location empty$ 'publisher {address.or.location ": " publisher * *} if$}
  if$}

FUNCTION{org.inst.school}{
  organization empty$ {institution empty$ 'school 'institution if$} 'organization if$}

FUNCTION{bbl.compiler}{
  curlanguage "english"   = {org.inst.school empty$ {"Comp. "} {"comp. "} if$}
 {curlanguage "german"    = {org.inst.school empty$ {"Hrsg. "} {"hrsg. "} if$}
 {curlanguage "ukrainian" = {org.inst.school empty$ {"Укл. "} {"укл. "} if$}
 {curlanguage "russian"   = {org.inst.school empty$ {"Сост. "} {"сост. "} if$}
 {"language is not defined: " curlanguage  " in bbl.compiler" * * warning$ 
  org.inst.school empty$ {"Comp. "} {"comp. "}
 if$}if$}if$}if$}if$}

FUNCTION{bbl.trans}{
  curlanguage "english" = 
              {org.inst.school empty$ compiler empty$ and {"Transl. "} {"transl. "} if$}
 {curlanguage "german"  = 
              {org.inst.school empty$ compiler empty$ and {"Übersetz. "} {"übersetz. "} if$}
 {curlanguage "ukrainian" = curlanguage "russian" = or
              {org.inst.school empty$ compiler empty$ and {"Пер. "} {"пер. "} if$}
 {"language is not defined: " curlanguage  " in bbl.trans" * * warning$ 
               org.inst.school empty$ compiler empty$ and {"Transl. "} {"transl. "}
 if$}if$}if$}if$
 origlanguage empty$ 'skip$ {origlanguage *} if$}

FUNCTION{bbl.edby}{
  curlanguage "english"   = {org.inst.school empty$ compiler empty$ and translator empty$ and
                               origlanguage empty$ and {"Ed.~by "} {"ed.~by "} if$}
 {curlanguage "german"    = {org.inst.school empty$ compiler empty$ and translator empty$ and
                               origlanguage empty$ and {"Ed.~"} {"ed.~"} if$}
 {curlanguage "ukrainian" = {org.inst.school empty$ compiler empty$ and translator empty$ and
                               origlanguage empty$ and {"За~ред. "} {"за~ред. "} if$}
 {curlanguage "russian"   = {org.inst.school empty$ compiler empty$ and translator empty$ and
                               origlanguage empty$ and {"Под ред. "} {"под ред. "} if$}
 {"language is not defined: " curlanguage " in bbl.edby" * * warning$ 
                             org.inst.school empty$ compiler empty$ translator empty$ and and 
                               origlanguage empty$ and {"Ed.~by "} {"ed.~by "}
 if$}if$}if$}if$}if$}

FUNCTION{format.compiler}  {compiler   empty$ {""} {bbl.compiler compiler format.names *} if$}
FUNCTION{format.editor}    {editor     empty$ {""} {bbl.edby editor       format.names *} if$}
FUNCTION{format.translator}{
  translator empty$ 'bbl.trans {bbl.trans " " translator format.names * *} if$}

FUNCTION{comp.trans.edit}{
  compiler empty$ {"" 's :=} {format.compiler 's :=} if$
  translator empty$ origlanguage empty$ and 'skip$ 
    {s empty$ {format.translator 's :=} {s "~; " format.translator * * 's :=} if$}
  if$
  editor empty$ 'skip$ 
    {s empty$ {format.editor 's :=} {s "~; " format.editor * * 's :=} if$}
  if$ s}

FUNCTION{bbl.of}{
  curlanguage "english" = {" of "}
 {curlanguage "german"  = {" von "}
 {curlanguage "russian" = curlanguage "ukrainian" = or {"~; "}
 {"language is not defined: " curlanguage " in bbl.of" * * warning$ " of "}
  if$}if$}if$}

FUNCTION{volume.series}{
  volume empty$ {""}
    {bbl.vol volume thinspace.connect
      series empty$ 'skip$ {bbl.of series * *} if$
      number empty$ 'skip$ {"can't use both volume and number fields in " * cite$ * warning$}
  if$}if$}

FUNCTION{series.number}{
  volume empty$ not {""}
    {series empty$ 
       {number empty$ {""} 
          {"there's a number but no series in " cite$ * warning$ 
            bbl.No number thinspace.connect} if$}
       {series "~; " *
        number empty$ 'skip$ {number *} if$
        paranthesify}
  if$}if$}

FUNCTION{check.book}{
  author empty$ editor empty$ compiler empty$ translator empty$ and and and
    {"empty author, compiler, editor and translator in " cite$ * warning$} 'skip$ if$
  check.title check.publisher check.year}

FUNCTION{book}{
  output.bibitem    check.book
  author.title.year output new.slash
  comp.trans.edit   output new.block
  address.publisher output new.sentence 
  format.edition    output new.sentence
  volume.series     output new.sentence
  format.pages      output new.sentence
  series.number     output new.sentence
  note              output new.block
  doi.url.other     output fin.entry}

FUNCTION{bbl.chapter}{
  curlanguage "english" = {"Сh."}
 {curlanguage "german"  = {"Kap."}
 {curlanguage "russian" = curlanguage "ukrainian" = or {"Гл."}
 {"language is not defined: " curlanguage " in bbl.chapter" * * warning$ "Ch."}
 if$}if$}if$}

FUNCTION{chapter.type}{
  chapter empty$ {""}
    {type empty$ 'bbl.chapter 'type if$ chapter thinspace.connect}
  if$}

FUNCTION{check.inbook}{
  pages empty$ chapter empty$ and not 'skip$
    {"empty pages and chapter in " cite$ * warning$} if$
  check.book}

FUNCTION{inbook}{
  output.bibitem    check.inbook
  author.title.year output new.slash
  comp.trans.edit   output new.block
  address.publisher output new.sentence 
  format.edition    output new.sentence
  volume.series     output new.sentence
  chapter.type      output
  format.pages      output new.sentence 
  series.number     output new.sentence
  note              output new.block
  doi.url.other     output fin.entry}

FUNCTION{format.booktitle}{
  booktitle empty$ {""}
    {booktitle
     titleaddon empty$ 'skip$ {"~: " titleaddon * *      } if$
     media      empty$ 'skip$ {"~: " * media bracketise *} if$}
  if$}

FUNCTION{check.incollection}{
  editor empty$ compiler empty$ translator empty$ and and not 'skip$
    {"empty compiler, editor and translator in " cite$ * warning$} if$
  check.booktitle check.author check.publisher check.year}

FUNCTION{incollection}{
  output.bibitem    check.incollection
  author.title.year output new.dblslash
  format.booktitle  output new.slash
  comp.trans.edit   output new.block
  address.publisher output new.sentence
  format.edition    output new.sentence
  volume.series     output new.sentence
  chapter.type      output 
  format.pages      output new.sentence
  series.number     output new.sentence
  note              output new.block
  doi.url.other     output fin.entry}

FUNCTION{title.year}{title empty$ {""} {format.title add.year} if$}

FUNCTION{creator}{
  org.inst.school empty$ 'format.editor
    {org.inst.school
     editor empty$ 'skip$ {"~; " format.editor * *} 
  if$}if$}

FUNCTION{check.proceedings}{check.title check.year} 
    
FUNCTION{proceedings}{
  output.bibitem    check.proceedings
  title.year        output new.slash
  creator           output new.block
  address.publisher output new.sentence
  volume.series     output new.sentence
  format.pages      output new.sentence  
  series.number     output new.sentence
  note              output new.block
  doi.url.other     output fin.entry}

FUNCTION{check.inproceedings}{check.proceedings check.booktitle check.author} 

FUNCTION{inproceedings}{
  output.bibitem    check.inproceedings
  author.title.year output new.dblslash
  format.booktitle  output new.slash
  creator           output new.block
  address.publisher output new.sentence
  volume.series     output new.sentence
  format.pages      output new.sentence  
  series.number     output new.sentence
  note              output new.block
  doi.url.other     output fin.entry}

FUNCTION{conference}{inproceedings}

FUNCTION{address.howpublished}{
  howpublished empty$ 'address.or.location 
    {address.or.location empty$ 'howpublished {address.or.location ": " howpublished * *} if$}
  if$}

FUNCTION{booklet}{
  output.bibitem       check.title
  author.title.year    output new.slash
  creator              output new.block
  address.howpublished output new.sentence
  format.pages         output new.sentence
  note                 output new.block
  doi.url.other        output fin.entry}

FUNCTION{author.org.title.year}{
  author.title.year empty$ 
   {org.inst.school empty$ {""} {org.inst.school add.year} if$}
   {author.title.year
    org.inst.school empty$ 'skip$ {"~/ " org.inst.school * *} 
  if$}if$}

FUNCTION{manual}{
  output.bibitem        check.title
  author.org.title.year output new.block
  address.or.location   output new.sentence
  format.edition        output new.sentence
  format.pages          output new.sentence
  note                  output new.block
  doi.url.other         output fin.entry}

FUNCTION{check.misc}{
  author        empty$ title empty$ date empty$ and and 
  howpublished  empty$ year  empty$ note empty$ and and and
    {"all relevant fields are empty in " cite$ * warning$} 'skip$
  if$}

FUNCTION{misc}{
  output.bibitem    check.misc
  author.title.year output new.block
  howpublished      output new.sentence
  note              output new.block
  doi.url.other     output fin.entry}

FUNCTION{check.unpublished}{
  note empty$ {"empty note in " cite$ * warning$} 'skip$ if$
  check.author} 

FUNCTION{unpublished}{
  output.bibitem    check.unpublished
  author.title.year output new.block
  note              output new.block 
  doi.url.other     output fin.entry}

FUNCTION{check.online}{
  doi empty$ url empty$ eprint empty$ and and not 'skip$ 
    {"empty doi, url and eprint in " cite$ * warning$}
  if$}
                           
FUNCTION{online}{
  output.bibitem    check.online
  author.title.year output new.block
  note              output new.block
  doi.url.other     output fin.entry}

FUNCTION{internet}  {online}
FUNCTION{www}       {online}
FUNCTION{webpage}   {online}
FUNCTION{electronic}{online}

FUNCTION{bbl.req}{
  curlanguage "english" = {"req. "}
 {curlanguage "german"  = {"ang. "}
 {curlanguage "russian" = curlanguage "ukrainian" = or {"заявл. "}
 {"language is not defined: " curlanguage " in bbl.req" * * warning$ "req. "}
 if$}if$}if$}

FUNCTION{format.type.number}{type        empty$ {""} {type " " number * *}  if$}
FUNCTION{format.requestdate}{requestdate empty$ {""} {bbl.req requestdate *} if$}
FUNCTION{format.pagetotal}  {pagetotal   empty$ {""} {pagetotal bbl.lcpages thinspace.connect} if$}

FUNCTION {bbl.publ}{
  curlanguage "english" = {"publ. "}
 {curlanguage "german"  = {"ausg. "}
 {curlanguage "russian" = curlanguage "ukrainian" = or {"опубл. "}
 {"language is not defined: " curlanguage " in bbl.publ" * * warning$ "publ. "}
 if$}if$}if$}

FUNCTION{format.publication}{
   publicationdate empty$ {""}
     {publication empty$
        {bbl.publ publicationdate *}
        {bbl.publ publicationdate * ", " * publication *}
   if$}if$}

FUNCTION {bbl.priority}{
  curlanguage "english"   = curlanguage "german" = or {"Prior. "}
 {curlanguage "ukrainian" = {"Прiор. "}
 {curlanguage "russian"   = {"Приор. "}
 {"language is not defined: " curlanguage " in bbl.priority" * * warning$ "Prior. "}
 if$}if$}if$}

FUNCTION{format.priority}{
  prioritynumber  empty$ prioritydate empty$ and {""}
    {prioritydate empty$ 
       {bbl.priority prioritynumber *}
       {bbl.priority prioritydate ", " prioritynumber * * *}
  if$}if$}

FUNCTION{format.requestnumber}{requestnumber empty$ {""} {bbl.nr requestnumber thinspace.connect} if$}

FUNCTION{author.country.year}{
  author empty$ {"empty author in " cite$ * warning$ ""} 
    {format.authors
     authorcountry empty$ 'skip$ {add.period$ " " authorcountry * *} if$
     add.year}
  if$}

FUNCTION{format.patent}{
  type            empty$  {""}  {type} if$
  number          empty$ 'skip$ {" " number * *} if$
  prioritycountry empty$ 'skip$ {" " prioritycountry * *} if$}

FUNCTION{check.patent}{
  number          empty$ {"empty number in "           cite$ * warning$} 'skip$ if$
  prioritycountry empty$ {"empty priority country in " cite$ * warning$} 'skip$ if$
  check.type}

FUNCTION{patent}{
  output.bibitem       check.patent
  author.country.year  output new.block
  format.patent        output
  ipc                  output new.block
  format.title         output new.colon
  format.requestnumber output new.colon
  format.requestdate   output new.colon
  format.publication   output new.colon
  format.priority      output new.slash
  holder               output new.semicolon
  address.or.location  output new.semicolon
  credits              output new.block
  format.pagetotal     output new.sentence
  note                 output new.block
  doi.url.other        output fin.entry }

FUNCTION{bbl.techreport}{
  curlanguage "english"   = {"Rep. "}
 {curlanguage "german"    = {"Bericht "}
 {curlanguage "ukrainian" = {"Звіт "}
 {curlanguage "russian"   = {"Отчет "}
 {"language is not defined: " curlanguage " in bbl.techreport" * * warning$ "Rep. "}
 if$}if$}if$}if$}

FUNCTION{techreport.type}{type empty$ {bbl.techreport} 'type if$}

FUNCTION{bbl.chief}{
  curlanguage "english"   = {org.inst.school empty$ {"Chief "} {"chief "} if$}
 {curlanguage "german"    = {org.inst.school empty$ {"Führ. "} {"führ. "} if$}
 {curlanguage "ukrainian" = {org.inst.school empty$ {"Укл. "} {"укл. "} if$}
 {curlanguage "russian"   = {org.inst.school empty$ {"Рук. "} {"рук. "} if$}
 {"language is not defined: " curlanguage  " in bbl.compiler" * * warning$ 
  org.inst.school empty$ {"Chief "} {"chief "}
 if$}if$}if$}if$}if$}

FUNCTION{format.chief}{editor empty$ {""} {bbl.chief editor format.names *} if$}

FUNCTION{institution.chief}{
  org.inst.school empty$ 'format.chief
    {org.inst.school
     editor empty$ 'skip$ {"~; " format.chief * *}
  if$}if$}

FUNCTION{check.report}{
  org.inst.school empty$ {"empty institution in " cite$ * warning$} 'skip$ if$
  check.type check.title check.year}

FUNCTION{report}{
  output.bibitem      check.report
  author.title.year   output new.sentence
  techreport.type     output add.blank
  number              output new.slash
  institution.chief   output new.block
  address.or.location output new.sentence
  format.pages        output new.sentence
  note                output new.block
  doi.url.other       output fin.entry}

FUNCTION{techreport}{report}

FUNCTION{check.thesis}{
  school empty$ publisher empty$ and
    {"empty school and publisher in " cite$ * warning$} 'skip$ if$
  check.author check.title check.type check.year}

FUNCTION{thesis}{
  output.bibitem    check.thesis
  author.title.year output new.colon
  type              output new.colon
  specialitycode    output new.slash
  org.inst.school   output new.block
  address.publisher output new.sentence
  format.pages      output new.sentence
  note              output new.block
  doi.url.other     output fin.entry}
   
FUNCTION{mastersthesis}{thesis}
FUNCTION{phdthesis}    {thesis}
FUNCTION{docthesis}    {thesis}

FUNCTION{default.type}{misc}

MACRO{jan}{"Jan."}
MACRO{feb}{"Feb."}
MACRO{mar}{"Mar."}
MACRO{apr}{"Apr."}
MACRO{may}{"May"}
MACRO{jun}{"Jun."}
MACRO{jul}{"Jul."}
MACRO{aug}{"Aug."}
MACRO{sep}{"Sep."}
MACRO{oct}{"Oct."}
MACRO{nov}{"Nov."}
MACRO{dec}{"Dec."}

READ

FUNCTION{sortify}{purify$}

INTEGERS{len}

FUNCTION{format.names.label}{
  's :=
  set.language
  s #1 "{vv~}{ll}" format.name$
  s num.names$ duplicate$ #2 > {pop$ bbl.etal *}
    {#2 < 'skip$
       {s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
          {bbl.etal *}
          {", " * s #2 "{vv~}{ll}" format.name$ *}
  if$}if$}if$}

FUNCTION{proc.label}{
  shorttitle      empty$ not {shorttitle " \dots~" *}
 {title           empty$ not 'title
 {org.inst.school empty$ not 'org.inst.school
 {key             empty$ not 'key {cite$ #1 entry.max$ substring$}
 if$}if$}if$}if$}

FUNCTION{booklet.label}{author empty$ 'proc.label {author format.names.label} if$}

FUNCTION{book.label}{
  author     empty$ not {author     format.names.label}
 {shorttitle empty$ not {shorttitle " \dots~" *}
 {title      empty$ not 'title
 {compiler   empty$ not {compiler   format.names.label}
 {translator empty$ not {translator format.names.label}
 {editor     empty$ not {editor     format.names.label}
 {key        empty$ not 'key {cite$ #1 entry.max$ substring$}
 if$}if$}if$}if$}if$}if$}if$}

FUNCTION{author.title.label}{
  author     empty$ not {author format.names.label}
 {shorttitle empty$ not {shorttitle " \dots~" *}
 {title      empty$ not 'title
 {key        empty$ not 'key {cite$ #1 entry.max$ substring$}
 if$}if$}if$}if$}

FUNCTION{author.title.type.label}{
  author          empty$ not {author format.names.label}
 {shorttitle      empty$ not {shorttitle " \dots~" *}
 {title           empty$ not 'title
 {type empty$ not {number empty$ 'type {type number thinspace.connect} if$}
 {number          empty$ not 'number
 {key             empty$ not 'key {cite$ #1 entry.max$ substring$}
 if$}if$}if$}if$}if$}if$}

FUNCTION{author.type.label}{
  author          empty$ not {author format.names.label}
 {type empty$ not {number empty$ 'type {type number thinspace.connect} if$}
 {number          empty$ not 'number
 {key             empty$ not 'key {cite$ #1 entry.max$ substring$}
 if$}if$}if$}if$}

FUNCTION{make.label}{
  type$ "book"        = 'book.label
 {type$ "proceedings" = 'proc.label 
 {type$ "patent"      = 'author.type.label
 {type$ "techreport"  = type$ "report" = or 'author.title.type.label
 {type$ "booklet"     = type$ "manual" = or 'booklet.label 'author.title.label
 if$}if$}if$}if$}if$
  "(" * get.year * 'label :=}

FUNCTION{sort.format.names}{
 's :=
  #1 'nameptr := ""
  s num.names$ 'numnames :=
  numnames 'namesleft :=
 {namesleft #0 >}
 {s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
  nameptr #1 >
    {"   "  *
     namesleft #1 = t "others" = and {"zzzzz" *}
       {numnames #2 > nameptr #2 = and {"zz" * get.year * "   " *} 'skip$ if$
        t sortify *}
     if$}
    {t sortify *}
  if$
  nameptr #1 + 'nameptr :=
  namesleft #1 - 'namesleft :=}
  while$}

FUNCTION{author.title.sort}{
  author       empty$ not {author sort.format.names}
 {title        empty$ not {title            sortify}
 {key          empty$ not {key              sortify}
 {"to sort, need author or title, or key in " cite$ * warning$ "яяяяяя"}
 if$}if$}if$}

FUNCTION{author.title.type.sort}{
  author          empty$ not {author sort.format.names}
 {title           empty$ not {title            sortify}
 {type empty$ not {type number empty$ 'skip$ {" " number * *} if$  sortify}
 {number          empty$ not {number           sortify}
 {key             empty$ not {key              sortify}
 {"to sort, need authot or title or type and number or key in " cite$ * warning$ "яяяяяя"}
 if$}if$}if$}if$}if$}

FUNCTION{title.org.sort}{
  title           empty$ not {title            sortify}
 {org.inst.school empty$ not {org.inst.school  sortify}
 {key             empty$ not {key              sortify}
 {"to sort, need title or key in " cite$ * warning$ "яяяяяя"}
 if$}if$}if$}

FUNCTION{author.title.org.sort}{
  author          empty$ not {author sort.format.names}
 {title           empty$ not {title            sortify}
 {org.inst.school empty$ not {org.inst.school  sortify}
 {key             empty$ not {key              sortify}
 {"to sort, need author or title, or organization, or  key in " cite$ * warning$ "яяяяяя"}
 if$}if$}if$}if$}

FUNCTION{entry.sort}{
  type$ "proceedings" = 'title.org.sort  
 {type$ "patent" = type$ "techreport"  = type$ "report" = or or 'author.title.type.sort
 {type$ "booklet" = type$ "manual" = or 'author.title.org.sort 'author.title.sort
 if$}if$}if$}
  
FUNCTION{presort}{
  set.language
  make.label
  label sortify "    " *
  entry.sort "    " * get.year sortify * "    " * cite$ sortify *
  #1 entry.max$ substring$
  'sort.label :=
  sort.label *
  #1 entry.max$ substring$
  'sort.key$ :=}

ITERATE{presort}
SORT
STRINGS {longest.label       last.label     next.extra}
INTEGERS{longest.label.width last.extra.num number.label}

FUNCTION{initialize.longest.label}{
  "" 'longest.label :=
  #0 int.to.chr$ 'last.label :=
  "" 'next.extra :=
  #0 'longest.label.width :=
  #0 'last.extra.num :=
  #0 'number.label :=}

FUNCTION{forward.pass}{
  last.label label =
    {last.extra.num #1 +        'last.extra.num :=
     last.extra.num int.to.chr$ 'extra.label    :=}
    {"1" chr.to.int$            'last.extra.num :=
     ""                         'extra.label    :=
     label 'last.label :=}
  if$
  number.label #1 + 'number.label :=}

FUNCTION{reverse.pass}{
  next.extra "2" = {"1" 'extra.label :=} 'skip$ if$
  extra.label 'next.extra :=
  extra.label duplicate$ empty$ 'skip$ {"{\natexlab{:" swap$ * "}}" *} if$ 'extra.label :=
  label extra.label * 'label :=}

FUNCTION {bib.sort.order}{sort.label 'sort.key$ :=}

EXECUTE{initialize.longest.label}
ITERATE{forward.pass}
REVERSE{reverse.pass}
ITERATE{bib.sort.order}
SORT

FUNCTION{begin.bib}{
  "\begin{thebibliography}{"  longest.label  * "}" *            write$ newline$
  "\providecommand*{\href}[2]{{\small #2}}"                     write$ newline$
  "\providecommand*{\url}[1]{{\small #1}}"                      write$ newline$
  "\providecommand{\natexlab}[1]{#1}"                           write$ newline$
  "\let\newblock\ignorespaces"                                  write$ newline$
  "\def\selectlanguageifdefined#1{%"                            write$ newline$
  "\expandafter\ifx\csname date#1\endcsname\relax"              write$ newline$
  "\else\selectlanguage{#1}\fi}"                                write$ newline$
  "\ProvideTextCommandDefault{\cyrdash}{%"                      write$ newline$
  "\iflanguage{russian}{\hbox to.8em{--\hss--}}{\textemdash}}"  write$ newline$
  "\providecommand*{\BibDash}{%"                                write$ newline$
  "\ifdim\lastskip>0pt\unskip\nobreak\hskip.2em plus 0.1em\fi%" write$ newline$
  "\cyrdash\hskip.2em plus 0.1em\ignorespaces}"                 write$ newline$
  preamble$ empty$ 'skip$ {preamble$ write$ newline$}  if$ }

FUNCTION{end.bib}{newline$ "\end{thebibliography}" write$ newline$}

EXECUTE{begin.bib}
EXECUTE{init.state.consts}
ITERATE{call.type$}
EXECUTE{end.bib}

%% End of file `gostdlns.bst'.
