mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-12-23 16:42:59 +02:00
sch2fig/: make the matrix (int m[6]) "const" everywhere
This commit is contained in:
parent
66ca318dbe
commit
6889fe8691
@ -102,7 +102,7 @@ static struct comp **next_comp = &comps;
|
||||
static struct obj **next_obj;
|
||||
|
||||
|
||||
static void draw_poly(const struct poly_obj *poly, int m[6])
|
||||
static void draw_poly(const struct poly_obj *poly, const int m[6])
|
||||
{
|
||||
int n = poly->points;
|
||||
int x[n];
|
||||
@ -133,7 +133,7 @@ static void draw_poly(const struct poly_obj *poly, int m[6])
|
||||
}
|
||||
|
||||
|
||||
static void draw_rect(const struct rect_obj *rect, int m[6])
|
||||
static void draw_rect(const struct rect_obj *rect, const int m[6])
|
||||
{
|
||||
int sx = mx(rect->sx, rect->sy, m);
|
||||
int sy = my(rect->sx, rect->sy, m);
|
||||
@ -159,7 +159,7 @@ static void draw_rect(const struct rect_obj *rect, int m[6])
|
||||
}
|
||||
|
||||
|
||||
static void draw_circ(const struct circ_obj *circ, int m[6])
|
||||
static void draw_circ(const struct circ_obj *circ, const int m[6])
|
||||
{
|
||||
int x = mx(circ->x, circ->y, m);
|
||||
int y = my(circ->x, circ->y, m);
|
||||
@ -184,7 +184,7 @@ static void draw_circ(const struct circ_obj *circ, int m[6])
|
||||
}
|
||||
|
||||
|
||||
static void draw_arc(const struct arc_obj *arc, int m[6])
|
||||
static void draw_arc(const struct arc_obj *arc, const int m[6])
|
||||
{
|
||||
int a = matrix_to_angle(m);
|
||||
int x = mx(arc->x, arc->y, m);
|
||||
@ -213,7 +213,7 @@ static void draw_arc(const struct arc_obj *arc, int m[6])
|
||||
|
||||
|
||||
static void draw_pin_name(const struct comp *comp, const struct pin_obj *pin,
|
||||
int m[6], int dx, int dy, int rot, enum text_align hor)
|
||||
const int m[6], int dx, int dy, int rot, enum text_align hor)
|
||||
{
|
||||
int ox, oy, sx, sy;
|
||||
|
||||
@ -264,7 +264,7 @@ static void draw_pin_name(const struct comp *comp, const struct pin_obj *pin,
|
||||
|
||||
|
||||
static void draw_pin_num(const struct comp *comp, const struct pin_obj *pin,
|
||||
int m[6], int dx, int dy, int rot, enum text_align hor)
|
||||
const int m[6], int dx, int dy, int rot, enum text_align hor)
|
||||
{
|
||||
int ox, oy, sx, sy;
|
||||
|
||||
@ -323,7 +323,7 @@ static void draw_pin_num(const struct comp *comp, const struct pin_obj *pin,
|
||||
|
||||
|
||||
static void draw_pin(const struct comp *comp, const struct pin_obj *pin,
|
||||
int m[6])
|
||||
const int m[6])
|
||||
{
|
||||
int x[2], y[2];
|
||||
int dx = 0, dy = 0;
|
||||
@ -368,7 +368,7 @@ static void draw_pin(const struct comp *comp, const struct pin_obj *pin,
|
||||
}
|
||||
|
||||
|
||||
static void draw_text(const struct text_obj *text, int m[6])
|
||||
static void draw_text(const struct text_obj *text, const int m[6])
|
||||
{
|
||||
struct text txt = {
|
||||
.s = text->s,
|
||||
@ -411,7 +411,7 @@ static void draw_text(const struct text_obj *text, int m[6])
|
||||
}
|
||||
|
||||
|
||||
static void draw(const struct comp *comp, const struct obj *obj, int m[6])
|
||||
static void draw(const struct comp *comp, const struct obj *obj, const int m[6])
|
||||
{
|
||||
switch (obj->type) {
|
||||
case obj_poly:
|
||||
@ -456,7 +456,7 @@ bool lib_field_visible(const struct comp *comp, int n)
|
||||
}
|
||||
|
||||
|
||||
void lib_exec(const struct comp *comp, unsigned unit, int m[4])
|
||||
void lib_exec(const struct comp *comp, unsigned unit, const int m[4])
|
||||
{
|
||||
const struct obj *obj;
|
||||
|
||||
|
@ -46,7 +46,7 @@ struct comp {
|
||||
|
||||
const struct comp *lib_find(const char *name);
|
||||
bool lib_field_visible(const struct comp *comp, int n);
|
||||
void lib_exec(const struct comp *comp, unsigned unit, int m[6]);
|
||||
void lib_exec(const struct comp *comp, unsigned unit, const int m[6]);
|
||||
|
||||
bool lib_parse(struct lib_ctx *ctx, const char *line);
|
||||
void lib_init(struct lib_ctx *ctx);
|
||||
|
@ -19,13 +19,13 @@
|
||||
#include "misc.h"
|
||||
|
||||
|
||||
static bool eq(int m[6], int xx, int xy, int yx, int yy)
|
||||
static bool eq(const int m[6], int xx, int xy, int yx, int yy)
|
||||
{
|
||||
return m[1] == xx && m[2] == xy && m[4] == yx && m[5] == yy;
|
||||
}
|
||||
|
||||
|
||||
unsigned matrix_to_angle(int m[6])
|
||||
unsigned matrix_to_angle(const int m[6])
|
||||
{
|
||||
if (eq(m, 1, 0, 0, -1))
|
||||
return 0;
|
||||
@ -47,7 +47,7 @@ unsigned matrix_to_angle(int m[6])
|
||||
}
|
||||
|
||||
|
||||
bool matrix_is_mirrored(int m[6])
|
||||
bool matrix_is_mirrored(const int m[6])
|
||||
{
|
||||
if (eq(m, 1, 0, 0, -1))
|
||||
return 0;
|
||||
|
@ -17,32 +17,32 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
|
||||
static inline int mxr(int x, int y, int m[6])
|
||||
static inline int mxr(int x, int y, const int m[6])
|
||||
{
|
||||
return x * m[1] + y * m[2];
|
||||
}
|
||||
|
||||
|
||||
static inline int myr(int x, int y, int m[6])
|
||||
static inline int myr(int x, int y, const int m[6])
|
||||
{
|
||||
return x * m[4] + y * m[5];
|
||||
}
|
||||
|
||||
|
||||
static inline int mx(int x, int y, int m[6])
|
||||
static inline int mx(int x, int y, const int m[6])
|
||||
{
|
||||
return m[0] + mxr(x, y, m);
|
||||
}
|
||||
|
||||
|
||||
static inline int my(int x, int y, int m[6])
|
||||
static inline int my(int x, int y, const int m[6])
|
||||
{
|
||||
return m[3] + myr(x, y, m);
|
||||
}
|
||||
|
||||
|
||||
unsigned matrix_to_angle(int m[6]);
|
||||
bool matrix_is_mirrored(int m[6]);
|
||||
unsigned matrix_to_angle(const int m[6]);
|
||||
bool matrix_is_mirrored(const int m[6]);
|
||||
int angle_add(int a, int b);
|
||||
|
||||
int rx(int x, int y, int rot);
|
||||
|
@ -31,7 +31,7 @@
|
||||
/* ----- Rendering --------------------------------------------------------- */
|
||||
|
||||
|
||||
static void dump_field(const struct comp_field *field, int m[6])
|
||||
static void dump_field(const struct comp_field *field, const int m[6])
|
||||
{
|
||||
struct text txt = field->txt;
|
||||
int dx, dy;
|
||||
|
Loading…
Reference in New Issue
Block a user