Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • 45ef561
  • /
  • LinkedBlockList.cpp
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge Iframe embedding
swh:1:cnt:c100a2e4131c33261d27ca86bc9f829985ec8a1c
directory badge Iframe embedding
swh:1:dir:45ef561aa9bb7cf13b9fd8057ce25f873848f634

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
LinkedBlockList.cpp
#include "LinkedBlockList.h"
#include <stdio.h>
#include <stdlib.h>

/*********************************************************************/

void LinkedBlockList::addFront(ListType item) {

	if ( m_head_block_size == GCLL_BLOCK_SIZE )
	{
		LLBlock *tmp      = (LLBlock *) new LLBlock;
		if ( !tmp ) {printf("\nOut of memory");exit(1);}
		tmp -> m_next     = m_head;
		m_head            = tmp;
		m_head_block_size = 0;
	}
	
	m_head ->m_item[m_head_block_size] = item;
	m_head_block_size++;
}

/*********************************************************************/

ListType LinkedBlockList::next()
{
	ListType toReturn = m_cursor -> m_item[m_cursor_ind];

	m_cursor_ind++;

	if ( m_cursor == m_head && m_cursor_ind >= m_head_block_size )
	{
		m_cursor     = m_cursor ->m_next;
		m_cursor_ind = 0;
	}
	else if ( m_cursor_ind == GCLL_BLOCK_SIZE )
	{
		m_cursor = m_cursor ->m_next;
		m_cursor_ind = 0;
	}
	return(toReturn);
}

/*********************************************************************/

bool LinkedBlockList::hasNext()
{
	if ( m_cursor != 0 ) return (true);
	else return(false);
}


/*********************************************************************/

LinkedBlockList::~LinkedBlockList()
{
	LLBlock *tmp;

	while ( m_head != 0 ) 
	{
		tmp = m_head;
		m_head = m_head->m_next;
		delete tmp;
	}
};

/*********************************************************************/

back to top

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API