<commit_before>/* BoardFlip plug-in for PCB
   http://www.delorie.com/pcb/boardflip.c

   Copyright (C) 2008 <NAME> <<EMAIL>>

   Licensed under the terms of the GNU General Public License, version
   2 or later.

   Compile like this:

   gcc -I$HOME/geda/pcb-cvs/src -I$HOME/geda/pcb-cvs -O2 -shared boardflip.c -o boardflip.so

   The resulting boardflip.so goes in $HOME/.pcb/plugins/boardflip.so.

   Usage: Boardflip()

   All objects on the board are up-down flipped.

   Command line board flipping:

   pcb --action-string "BoardFlip() SaveTo(LayoutAs,$OUTFILE) Quit()" $INFILE

   To flip the board physically, use BoardFlip(sides)

*/

#include <stdio.h>
#include <math.h>

#include "global.h"
#include "data.h"
#include "hid.h"
#include "misc.h"
#include "create.h"
#include "rtree.h"
#include "undo.h"

/* Things that need to be flipped:

   lines
   text
   polygons
   arcs
   vias
   elements
       elementlines
       elementarcs
       pins
       pads
   rats
*/

#define FLIP(y) (y) = h - (y)
#define NEG(y) (y) = - (y)

static int
boardflip (int argc, char **argv, int x, int y)
{
  int h = PCB->MaxHeight;
  int sides = 0;

  if (argc > 0 && strcasecmp (argv[0], "sides") == 0)
    sides = 1;
  printf("argc %d argv %s sides %d\n", argc, argv[0], sides);

  LAYER_LOOP (PCB->Data, max_layer);
  {
    LINE_LOOP (layer);
    {
      FLIP (line->Point1.Y);
      FLIP (line->Point2.Y);
    }
    END_LOOP;<commit_msg>Bug fix in src/boardflip.c by <NAME>.<commit_after>/* BoardFlip plug-in for PCB
   http://www.delorie.com/pcb/boardflip.c

   Copyright (C) 2008 <NAME> <<EMAIL>>

   Licensed under the terms of the GNU General Public License, version
   2 or later.

   Compile like this:

   gcc -I$HOME/geda/pcb-cvs/src -I$HOME/geda/pcb-cvs -O2 -shared boardflip.c -o boardflip.so

   The resulting boardflip.so goes in $HOME/.pcb/plugins/boardflip.so.

   Usage: Boardflip()

   All objects on the board are up-down flipped.

   Command line board flipping:

   pcb --action-string "BoardFlip() SaveTo(LayoutAs,$OUTFILE) Quit()" $INFILE

   To flip the board physically, use BoardFlip(sides)

*/

#include <stdio.h>
#include <math.h>

#include "global.h"
#include "data.h"
#include "hid.h"
#include "misc.h"
#include "create.h"
#include "rtree.h"
#include "undo.h"

/* Things that need to be flipped:

   lines
   text
   polygons
   arcs
   vias
   elements
       elementlines
       elementarcs
       pins
       pads
   rats
*/

#define FLIP(y) (y) = h - (y)
#define NEG(y) (y) = - (y)

static int
boardflip (int argc, char **argv, int x, int y)
{
  int h = PCB->MaxHeight;
  int sides = 0;

  if (argc > 0 && strcasecmp (argv[0], "sides") == 0)
    sides = 1;
  printf("argc %d argv %s sides %d\n", argc, argv[0], sides);

  LAYER_LOOP (PCB->Data, max_layer + 2);
  {
    LINE_LOOP (layer);
    {
      FLIP (line->Point1.Y);
      FLIP (line->Point2.Y);
    }
    END_LOOP;
{'fraction_non_alphanumeric': 0.14118457300275483, 'fraction_numerical': 0.009986225895316805, 'mean_word_length': 2.777633289986996, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6563271', 'n_tokens_mistral': 1182, 'n_tokens_neox': 1103, 'n_words': 321}