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

  • b41dddd
  • /
  • test7.cpp
Raw File Download
Permalinks

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:fe15c67696b70627ef8d350f3de83a40edabba16
directory badge Iframe embedding
swh:1:dir:b41dddd2eb7b13f8b7199d566241be68c78a83ab
Citations

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 ...
test7.cpp
#include "cmm.h"


#include <stdio.h>
#include <stdlib.h>
#include "tempheap.h"

struct  cell : CmmObject 
{
  cell  *car;
  cell  *cdr;
  int  value;
  cell(cell *initcar, cell *initcdr, int initvalue);
  void traverse();
};

typedef  cell* CP;

void cell::traverse()  
{
  CmmHeap *heap = Cmm::heap;
  heap->scavenge((CmmObject **)&car);
  heap->scavenge((CmmObject **)&cdr);
}


cell::cell(cell *initcar, cell *initcdr, int initvalue)
{
  car = initcar;
  cdr = initcdr;
  value = initvalue;
}

struct vector : CmmObject 
{
  vector  *car;
  vector  *cdr;
  int  value1;
  char bytes[1000];
  int  value2;
  vector(vector* x, vector* y, int v1, int v2);
  void traverse();
};

typedef  vector* VP;

void vector::traverse()
{
  CmmHeap *heap = Cmm::heap;
  heap->scavenge((CmmObject **)&car);
  heap->scavenge((CmmObject **)&cdr);
}

vector::vector(vector* x, vector* y, int v1, int v2)  
{
  car = x;
  cdr = y;
  value1 = v1;
  value2 = v2;
}


void  vectortest()
{
  int  i, j;
  VP  lp, zp;
  
  printf("Vector test\n");
  lp = NULL;
  for (i = 0; i <= 100 ; i++)  
    {
      if  (i % 15 != 14)
	printf("%d ", i);
      else
	printf("%d\n", i);
      zp = new vector[10](NULL, lp, i, i);
      lp = zp;
      Cmm::heap->collect();
      zp = lp;
      for (j = i; j >= 0 ; j--)  
	{
	  if ((zp == NULL) || (zp->value1 != j)  ||  (zp->value2 != j))
	    printf("LP is not a good list when j = %d\n", j);
	  zp = zp->cdr;
	}
    }
  printf("\n");		   
}

void
main()
{
  /* List of vectors > 1 page */
  vectortest();

  exit(0);
}

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— Contact— JavaScript license information— Web API

back to top