Skip to content

Commit

Permalink
add support for Processing, #820
Browse files Browse the repository at this point in the history
  • Loading branch information
AlDanial committed Mar 14, 2024
1 parent 58f30df commit 2284b8c
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 2 deletions.
9 changes: 8 additions & 1 deletion Unix/cloc
Original file line number Diff line number Diff line change
Expand Up @@ -8512,7 +8512,8 @@ sub set_constants { # {{{1
'inc' => 'PHP/Pascal/Fortran' ,
'ino' => 'Arduino Sketch' ,
'ipf' => 'Igor Pro' ,
'pde' => 'Arduino Sketch' , # pre 1.0
#'pde' => 'Arduino Sketch' , # pre 1.0
'pde' => 'Processing' , # pre 1.0
'itk' => 'Tcl/Tk' ,
'java' => 'Java' ,
'jcl' => 'JCL' , # IBM Job Control Lang.
Expand Down Expand Up @@ -10203,6 +10204,11 @@ sub set_constants { # {{{1
'Prisma Schema' => [
[ 'remove_matches' , '^\s*//' ],
],
'Processing' => [
[ 'rm_comments_in_strings', '"', '/*', '*/' ],
[ 'rm_comments_in_strings', '"', '//', '' ],
[ 'call_regexp_common' , 'C++' ],
],
'ProGuard' => [
[ 'remove_matches' , '^\s*#' ],
[ 'remove_inline' , '#.*$' ],
Expand Down Expand Up @@ -11291,6 +11297,7 @@ sub set_constants { # {{{1
'PowerBuilder' => 3.33,
'PowerShell' => 3.00,
'Prisma Schema' => 2.50,
'Processing' => 2.50,
'ProGuard' => 2.50,
'Prolog' => 1.25,
'Properties' => 1.36,
Expand Down
5 changes: 5 additions & 0 deletions Unix/t/00_C.t
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,11 @@ my @Tests = (
'ref' => '../tests/outputs/schema.prisma.yaml',
'args' => '../tests/inputs/schema.prisma',
},
{
'name' => 'Processing',
'ref' => '../tests/outputs/pointillism.pde.yaml',
'args' => '../tests/inputs/pointillism.pde',
},
{
'name' => 'ProGuard',
'ref' => '../tests/outputs/proguard-project-app.pro.yaml',
Expand Down
9 changes: 8 additions & 1 deletion cloc
Original file line number Diff line number Diff line change
Expand Up @@ -8527,7 +8527,8 @@ sub set_constants { # {{{1
'inc' => 'PHP/Pascal/Fortran' ,
'ino' => 'Arduino Sketch' ,
'ipf' => 'Igor Pro' ,
'pde' => 'Arduino Sketch' , # pre 1.0
#'pde' => 'Arduino Sketch' , # pre 1.0
'pde' => 'Processing' , # pre 1.0
'itk' => 'Tcl/Tk' ,
'java' => 'Java' ,
'jcl' => 'JCL' , # IBM Job Control Lang.
Expand Down Expand Up @@ -10218,6 +10219,11 @@ sub set_constants { # {{{1
'Prisma Schema' => [
[ 'remove_matches' , '^\s*//' ],
],
'Processing' => [
[ 'rm_comments_in_strings', '"', '/*', '*/' ],
[ 'rm_comments_in_strings', '"', '//', '' ],
[ 'call_regexp_common' , 'C++' ],
],
'ProGuard' => [
[ 'remove_matches' , '^\s*#' ],
[ 'remove_inline' , '#.*$' ],
Expand Down Expand Up @@ -11306,6 +11312,7 @@ sub set_constants { # {{{1
'PowerBuilder' => 3.33,
'PowerShell' => 3.00,
'Prisma Schema' => 2.50,
'Processing' => 2.50,
'ProGuard' => 2.50,
'Prolog' => 1.25,
'Properties' => 1.36,
Expand Down
32 changes: 32 additions & 0 deletions tests/inputs/pointillism.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Pointillism
* by Daniel Shiffman.
*
* Mouse horizontal location controls size of dots.
* Creates a simple pointillist effect using ellipses colored
* according to pixels in an image.
*/

PImage img;
int smallPoint, largePoint;

void setup() {
size(640, 360);
img = loadImage("moonwalk.jpg");
smallPoint = 4;
largePoint = 40;
imageMode(CENTER);
noStroke();
background(255);
}

void draw() {
float pointillize = map(mouseX, 0, width, smallPoint, largePoint);
int x = int(random(img.width));
int y = int(random(img.height));
color pix = img.get(x, y);
fill(pix, 128);
ellipse(x, y, pointillize, pointillize);
}

// https://processing.org/examples/pointillism.html
21 changes: 21 additions & 0 deletions tests/outputs/pointillism.pde.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# github.com/AlDanial/cloc
header :
cloc_url : github.com/AlDanial/cloc
cloc_version : 2.01
elapsed_seconds : 0.00258994102478027
n_files : 1
n_lines : 32
files_per_second : 386.109177943478
lines_per_second : 12355.4936941913
report_file : ../outputs/pointillism.pde.yaml
'Processing' :
nFiles: 1
blank: 4
comment: 9
code: 19
SUM:
blank: 4
comment: 9
code: 19
nFiles: 1

0 comments on commit 2284b8c

Please sign in to comment.