CWEB

1 program Added 2026-02-07T14:39:26Z Agent: claude-codeModel: sonnetWebSearch: disabled Evidence Report issue View issues
Aliases: —
Provenance: commit 4af3661a06 · authored 2026-02-07T15:40:11+01:00 · agent claude-code · model sonnet

Sources mentioning this language

6 sources · pl_id: pl/cweb
LLM (this repo) · 1PldbLinguistWikipediaHyperpolyglotWikidata · Q5014842

Extensions claimed by this language

2 claims. Each row is one upstream assertion with its strength. SWH column shows file occurrences with that extension across the entire archive.
ExtensionSourceStrengthSWH
.wlinguistprimary188.1K files
.wwikidataprimary188.1K files

Related languages

Noweb (0.30)Urweb (0.30)Crumb (0.18)FunnelWeb (0.17)WEB (0.17)

LLM-contributed programs

Hello World

Provenance: commit 4af3661a06 · authored 2026-02-07T15:40:11+01:00 · agent claude-code · model sonnet · WebSearch disabled
code.w · added: 2026-02-07T14:39:26Z
@* Hello World Program.
This is a simple CWEB program that prints "Hello, World!".

@c
#include <stdio.h>

@<Main program@>=
int main(void) {
    printf("Hello, World!\n");
    return 0;
}

@ The program structure.
@p
@<Main program@>

Real programs from Software Heritage

1 sample mined from derived_datasets/<date>/contents/*.parquet, byte-verified against the SWH archive. Citation-grade qualified SWHIDs preserved.
medsched.w · 2987 B · ext .w · seen 2× in SWH
via heuristicrule h/linguist/.w/1
swh:1:cnt:b4895ceb3eaaf0c305d6f907b03bca1041a8b497;origin=https://github.com/gchilders/lasieve5_nfsathome;anchor=swh:1:rev:3be451f1831f969899080b74602965df0cf57445;path=/athlon64/medsched.w
Open in SWH · Raw bytes (SWH) · GitHub raw
Show source
@* Scheduling function for the lattice siever.
Copyright (C) 2002 Jens Franke, T. Kleinjung.
This file is part of gnfs4linux, distributed under the terms of the 
GNU General Public Licence and WITHOUT ANY WARRANTY.

You should have received a copy of the GNU General Public License along
with this program; see the file COPYING.  If not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
@(medsched.h@>=
u32_t *medsched(u32_t*,u32_t*,u32_t*,u32_t**,u32_t,u32_t);
u32_t *medsched_1(u32_t*,u32_t*,u32_t*,u32_t,unsigned char *,
                  unsigned char);

@
@c
#include <sys/types.h>
#include <limits.h>

#include "siever-config.h"
#include "medsched.h"
#include "../if.h"

#define L1_SIZE (1<<L1_BITS)
#define i_bits (I_bits-1)
#define n_i (1<<i_bits)

#define U16_SHIFT (CHAR_BIT*sizeof(u16_t))

u32_t *medsched0(u32_t*,u32_t*,u32_t*,u32_t**,u32_t);
u32_t *medsched0_1(u32_t*,u32_t*,u32_t*,unsigned char*,unsigned char);

u32_t *
medsched_1(ri,ij_ptr,ij_ptr_ub,ot,si,lo)
     u32_t *ri,*ij_ptr,*ij_ptr_ub,ot;
     unsigned char *si,lo;
{
  u32_t ij;
  u32_t ot_mask,ot_tester;

  if(ot!=0) {
    ot_tester=(ot&1)|((ot&2)<<(i_bits-1));
    ot_mask=n_i|1;
  } else return medsched0_1(ri,ij_ptr,ij_ptr_ub,si,lo);

  while ( ij_ptr < ij_ptr_ub) {
    u16_t a,b;

    a=n_i-(ri[0]&(n_i-1));
    b=n_i-(ri[1]&(n_i-1));
    if(ot == 0) ij=*ij_ptr;
    else @<Calculate first sieving event from |ri|@>@;
    while(ij<L1_SIZE) {
      u16_t i;

      si[ij]+=lo;

      i=ij&(n_i-1);
      if(i<b) ij+=ri[0];
      if(i>=a) ij+=ri[1];
    }
    ri+=2;
    *(ij_ptr++)=ij-L1_SIZE;
  }
  return ri;
}


u32_t *
medsched(ri,ij_ptr,ij_ptr_ub,sched_ptr,fbi_offs,ot)
     u32_t *ri,*ij_ptr,*ij_ptr_ub,**sched_ptr,fbi_offs,ot;
{
  u32_t ij;
  u32_t ot_mask,ot_tester;
  u32_t *sched;

  sched=*sched_ptr;

  if(ot!=0) {
    ot_tester=(ot&1)|((ot&2)<<(i_bits-1));
    ot_mask=n_i|1;
  } else return medsched0(ri,ij_ptr,ij_ptr_ub,sched_ptr,fbi_offs);

  while ( ij_ptr < ij_ptr_ub) {
    u16_t a,b;

    a=n_i-(ri[0]&(n_i-1));
    b=n_i-(ri[1]&(n_i-1));
    if(ot == 0) ij=*ij_ptr;
    else @<Calculate first sieving event from |ri|@>@;
    while(ij<L1_SIZE) {
      u16_t i;

      *(sched++)=(fbi_offs<<U16_SHIFT)|ij;
      i=ij&(n_i-1);
      if(i<b) ij+=ri[0];
      if(i>=a) ij+=ri[1];
    }
    ri+=2;
    *(ij_ptr++)=ij-L1_SIZE;
    fbi_offs++;
  }
  *sched_ptr=sched;
  return ri;
}

@
@<Calculate first sieving event from |ri|@>=
{
  ij=0;
  if( (ri[0]&ot_mask) == ot_tester ) ij=ri[0];
  else {
    if( (ri[1]&ot_mask) == (ot_tester^n_i) ) ij=ri[1];
    else {
      if((ri[0]&(n_i-1))<=(ri[1]&(n_i-1)) && ri[0]<=ri[1]) {
	/* This corresponds to the line
	   |if(b+c<=A && s<=t)| in recurrence6.w */
	if((ri[0]&(n_i-1))==(ri[1]&(n_i-1))) ij=ri[1]-ri[0];
	else ij=n_i;
	if(ot != 2)
	  Schlendrian("Exceptional situation for oddness type %u ?\n",
		      ot);
      }
      else ij=ri[0]+ri[1];
    }
  }
  ij=(ij+((~ot_tester)&n_i))/2;
}

Disambiguation rules

Linguist heuristic rules that predict this language when one of its claimed extensions is shared with another.
RuleExtKindPredicates (truncated)
h/linguist/.w/1.wpredicates[{"kind": "any", "regexes": ["^@(<|\\w+\\.)"]}]

Contribute — propose a file extension

Tell us where to find evidence about CWEB (mapped to pl/cweb). A reference URL is required; at least one of extension or program code must be provided too. A maintainer reviews each submission via a draft PR before anything lands.
Optional: attach a program from that URL
If the reference URL points at a single source file you'd like to add as an example program, paste it below. The workflow will write it under languages/CWEB/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← cvs cwerg →