fdoc

subroutineaddpure

pure subroutine add(b, text)

Append text to b.

Arguments

NameTypeIntentAttributesDescription
btype(buffer_t)inout

the buffer

textcharacter(len=*)in

the text

Source

Show the code
pure subroutine add(b, text)
    type(buffer_t), intent(inout) :: b      !! the buffer
    character(len=*), intent(in) :: text    !! the text
    character(len=:), allocatable :: grown
    integer :: capacity

    if (.not. allocated(b%s)) allocate (character(len=max(256, 2*len(text))) :: b%s)
    capacity = len(b%s)
    if (b%n + len(text) > capacity) then
        allocate (character(len=max(2*capacity, b%n + len(text))) :: grown)
        grown(1:b%n) = b%s(1:b%n)
        call move_alloc(grown, b%s)
    end if
    b%s(b%n + 1:b%n + len(text)) = text
    b%n = b%n + len(text)
end subroutine add

Graphs

Called by

addasset_fdoc_cssasset_fdoc_jshtml_escaperead_stringparse_primaryparse_fstringnext_tokenexpectparse_testparse_comprehensionparse_itemscompileread_line_directivewrite_valuearithmeticcall_methodformat_stringevaluateevaluate_argsrender_noderender_callrender_bodyrender_loopdefine_macrocall_macrofold_outputfold_regionfold_linewrite_call_formsform_keywrite_formdescriberank_labelshared_summarycall_textspecific_linklabel_resultsentity_anchorhighlight_fortranline_startnormalize_linessubstitute_aliasesunstashstash_fenced_codecode_block_htmlstash_html_blocksmarkdown_to_htmlcollect_definitionsrender_childrenrender_noderender_headingrender_tableinlinerender_codeunique_idinsert_toctable_rowrender_footnotesinline_codeinline_angleinline_entityinline_dollarinline_bracketinline_imageinline_emphasisinline_abbreviationinline_smartinline_backslashmathencodedwrite_linkford_linklink_towrite_typepage_headstatic_pagepage_linkspage_footsearch_pagesite_sideplain_textside_groupside_iconentity_titlebreadcrumbssignaturebadgeprocedure_badgesstats_cellsnumber_celladd_intsize_textstats_totalgroupedsignature_argumentsargument_tableargument_attributesanchorbinding_tableexplained_badgegraph_sectionswrite_graphsummary_sectionsummary_itemuses_sectioncalls_sectionsource_sectionentity_pageenum_sectionscommon_sectionsadd_wordsunit_bodyprocedure_bodyinterface_bodytype_bodyfile_bodypage_outlinesidebar_scriptadd_js_textlist_columnslist_pageindex_pageicon_linkmake_footerlicense_textwrite_sitesearch_indexwrite_entity_pagesparse_postfixparse_argumentsparse_subscriptparse_texthandle_directiveevaluate_fstringcall_builtinevaluate_callcompareevaluate_slicerun_clausefypp_processparse_fileexpand_file_includeswrite_entity_pagerunmarkdown_listrender_textrender_documentationload_project_sourcesload_pagesparse_listparse_orparse_andparse_notparse_compareparse_sumparse_productparse_unarydef_directivecall_directivefypp_sourcecontrol_directivefor_directiveset_directiveinclude_directiveload_sourcerender_entityread_pageread_sourceread_tree