pcb 4.1.1
An interactive printed circuit board layout editor.

curve.c File Reference

Private part of the path and curve data structures. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "potracelib.h"
#include "lists.h"
#include "curve.h"
Include dependency graph for curve.c:

Go to the source code of this file.

Defines

#define SAFE_MALLOC(var, n, typ)   if ((var = (typ *)malloc((n)*sizeof(typ))) == NULL) goto malloc_error

Typedefs

typedef dpoint_t dpoint3_t [3]

Functions

path_tpath_new (void)
 Create a new path.
static void privcurve_free_members (privcurve_t *curve)
 Free the members of the given curve structure.
void path_free (path_t *p)
 Free a path.
void pathlist_free (path_t *plist)
 Free a pathlist.
int privcurve_init (privcurve_t *curve, int n)
 Initialize the members of the given curve structure to size m.
void privcurve_to_curve (privcurve_t *pc, potrace_curve_t *c)
 Copy private to public curve structure.

Detailed Description

Private part of the path and curve data structures.


Copyright.


PCB, interactive printed circuit board design

Copyright (C) 2001-2007 Peter Selinger.

This file is part of Potrace. It is free software and it is covered by the GNU General Public License. See the file COPYING for details.

Definition in file curve.c.


Define Documentation

#define SAFE_MALLOC (   var,
  n,
  typ 
)    if ((var = (typ *)malloc((n)*sizeof(typ))) == NULL) goto malloc_error

Definition at line 28 of file curve.c.

Referenced by path_new(), and privcurve_init().


Typedef Documentation

typedef dpoint_t dpoint3_t[3]

Definition at line 114 of file curve.c.


Function Documentation

void path_free ( path_t p)

Free a path.

Leave errno untouched.

Definition at line 77 of file curve.c.

References potrace_privpath_s::curve, potrace_privpath_s::lon, potrace_privpath_s::ocurve, potrace_privpath_s::po, potrace_path_s::priv, privcurve_free_members(), potrace_privpath_s::pt, and potrace_privpath_s::sums.

Referenced by bm_to_pathlist(), and pathlist_free().

Here is the call graph for this function:

path_t* path_new ( void  )

Create a new path.

Definition at line 37 of file curve.c.

References potrace_path_s::priv, and SAFE_MALLOC.

Referenced by findpath().

void pathlist_free ( path_t plist)

Free a pathlist.

Leave errno untouched.

Definition at line 102 of file curve.c.

References list_forall_unlink, and path_free().

Referenced by gcode_do_export().

Here is the call graph for this function:

static void privcurve_free_members ( privcurve_t curve) [static]

Free the members of the given curve structure.

Leave errno unchanged.

Definition at line 61 of file curve.c.

References privcurve_s::alpha, privcurve_s::alpha0, privcurve_s::beta, privcurve_s::c, privcurve_s::tag, and privcurve_s::vertex.

Referenced by path_free().

int privcurve_init ( privcurve_t curve,
int  n 
)

Initialize the members of the given curve structure to size m.

Returns:
0 on success, 1 on error with errno set.

Definition at line 122 of file curve.c.

References privcurve_s::alpha, privcurve_s::alpha0, privcurve_s::beta, privcurve_s::c, n, privcurve_s::n, SAFE_MALLOC, privcurve_s::tag, and privcurve_s::vertex.

Referenced by adjust_vertices(), and opticurve().

void privcurve_to_curve ( privcurve_t pc,
potrace_curve_t c 
)

Copy private to public curve structure.

Definition at line 148 of file curve.c.

References privcurve_s::c, potrace_curve_s::c, privcurve_s::n, potrace_curve_s::n, privcurve_s::tag, and potrace_curve_s::tag.