Index: trunk/src/libcschem/Makefile.in =================================================================== --- trunk/src/libcschem/Makefile.in (revision 412) +++ trunk/src/libcschem/Makefile.in (revision 413) @@ -7,8 +7,13 @@ attrib.o buildin.o concrete.o + concrete_arc.o + concrete_bitmap.o + concrete_conn.o + concrete_grp.o concrete_line.o concrete_pen.o + concrete_poly.o compile.o fptr_cast.o libcschem.o Index: trunk/src/libcschem/concrete_arc.c =================================================================== --- trunk/src/libcschem/concrete_arc.c (nonexistent) +++ trunk/src/libcschem/concrete_arc.c (revision 413) @@ -0,0 +1,58 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - libcschem (core library) + * Copyright (C) 2018 Tibor 'Igor2' Palinkas + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version.* + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact: + * Project page: http://repo.hu/projects/cschem + * lead developer: email to cschem (at) igor2.repo.hu + * mailing list: cschem (at) list.repo.hu (send "subscribe") + */ + + +#include "config.h" +#include "concrete.h" +#include "concrete_arc.h" + +csch_carc_t *csch_carc_alloc(csch_sheet_t *sheet, csch_oid_t oid) +{ + csch_carc_t *arc; + + arc = htip_get(&sheet->id2obj, oid); + if (arc != NULL) + return NULL; + arc = calloc(sizeof(csch_carc_t), 1); + + csch_cobj_init(&arc->hdr, sheet, oid, CSCH_CTYPE_ARC, CSCH_INVALID_OID); + return arc; +} + +void csch_carc_free(csch_carc_t *arc) +{ + csch_cobj_uninit(&arc->hdr); + free(arc); +} + +csch_carc_t *csch_carc_get(csch_sheet_t *sheet, csch_oid_t oid) +{ + csch_carc_t *arc = htip_get(&sheet->id2obj, oid); + if ((arc != NULL) && (arc->hdr.type != CSCH_CTYPE_ARC)) + return NULL; + return arc; +} + Index: trunk/src/libcschem/concrete_arc.h =================================================================== --- trunk/src/libcschem/concrete_arc.h (revision 412) +++ trunk/src/libcschem/concrete_arc.h (revision 413) @@ -39,4 +39,8 @@ unsigned evalid:1; } csch_carc_t; +csch_carc_t *csch_carc_alloc(csch_sheet_t *sheet, csch_oid_t oid); +void csch_carc_free(csch_carc_t *arc); +csch_carc_t *csch_carc_get(csch_sheet_t *sheet, csch_oid_t oid); + #endif Index: trunk/src/libcschem/concrete_bitmap.c =================================================================== --- trunk/src/libcschem/concrete_bitmap.c (nonexistent) +++ trunk/src/libcschem/concrete_bitmap.c (revision 413) @@ -0,0 +1,58 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - libcschem (core library) + * Copyright (C) 2018 Tibor 'Igor2' Palinkas + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version.* + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact: + * Project page: http://repo.hu/projects/cschem + * lead developer: email to cschem (at) igor2.repo.hu + * mailing list: cschem (at) list.repo.hu (send "subscribe") + */ + + +#include "config.h" +#include "concrete.h" +#include "concrete_bitmap.h" + +csch_cbitmap_t *csch_cbitmap_alloc(csch_sheet_t *sheet, csch_oid_t oid) +{ + csch_cbitmap_t *bitmap; + + bitmap = htip_get(&sheet->id2obj, oid); + if (bitmap != NULL) + return NULL; + bitmap = calloc(sizeof(csch_cbitmap_t), 1); + + csch_cobj_init(&bitmap->hdr, sheet, oid, CSCH_CTYPE_BITMAP, CSCH_INVALID_OID); + return bitmap; +} + +void csch_cbitmap_free(csch_cbitmap_t *bitmap) +{ + csch_cobj_uninit(&bitmap->hdr); + free(bitmap); +} + +csch_cbitmap_t *csch_cbitmap_get(csch_sheet_t *sheet, csch_oid_t oid) +{ + csch_cbitmap_t *bitmap = htip_get(&sheet->id2obj, oid); + if ((bitmap != NULL) && (bitmap->hdr.type != CSCH_CTYPE_BITMAP)) + return NULL; + return bitmap; +} + Index: trunk/src/libcschem/concrete_bitmap.h =================================================================== --- trunk/src/libcschem/concrete_bitmap.h (revision 412) +++ trunk/src/libcschem/concrete_bitmap.h (revision 413) @@ -38,4 +38,8 @@ csch_pixel_t *bitmap; } csch_cbitmap_t; +csch_cbitmap_t *csch_cbitmap_alloc(csch_sheet_t *sheet, csch_oid_t oid); +void csch_cbitmap_free(csch_cbitmap_t *bitmap); +csch_cbitmap_t *csch_cbitmap_get(csch_sheet_t *sheet, csch_oid_t oid); + #endif Index: trunk/src/libcschem/concrete_conn.c =================================================================== --- trunk/src/libcschem/concrete_conn.c (nonexistent) +++ trunk/src/libcschem/concrete_conn.c (revision 413) @@ -0,0 +1,58 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - libcschem (core library) + * Copyright (C) 2018 Tibor 'Igor2' Palinkas + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version.* + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact: + * Project page: http://repo.hu/projects/cschem + * lead developer: email to cschem (at) igor2.repo.hu + * mailing list: cschem (at) list.repo.hu (send "subscribe") + */ + + +#include "config.h" +#include "concrete.h" +#include "concrete_conn.h" + +csch_conn_t *csch_conn_alloc(csch_sheet_t *sheet, csch_oid_t oid) +{ + csch_conn_t *conn; + + conn = htip_get(&sheet->id2obj, oid); + if (conn != NULL) + return NULL; + conn = calloc(sizeof(csch_conn_t), 1); + + csch_cobj_init(&conn->hdr, sheet, oid, CSCH_CTYPE_CONN, CSCH_INVALID_OID); + return conn; +} + +void csch_conn_free(csch_conn_t *conn) +{ + csch_cobj_uninit(&conn->hdr); + free(conn); +} + +csch_conn_t *csch_conn_get(csch_sheet_t *sheet, csch_oid_t oid) +{ + csch_conn_t *conn = htip_get(&sheet->id2obj, oid); + if ((conn != NULL) && (conn->hdr.type != CSCH_CTYPE_CONN)) + return NULL; + return conn; +} + Index: trunk/src/libcschem/concrete_conn.h =================================================================== --- trunk/src/libcschem/concrete_conn.h (revision 412) +++ trunk/src/libcschem/concrete_conn.h (revision 413) @@ -38,4 +38,8 @@ csch_oid_t gfx; } csch_conn_t; +csch_conn_t *csch_conn_alloc(csch_sheet_t *sheet, csch_oid_t oid); +void csch_conn_free(csch_conn_t *conn); +csch_conn_t *csch_conn_get(csch_sheet_t *sheet, csch_oid_t oid); + #endif Index: trunk/src/libcschem/concrete_grp.c =================================================================== --- trunk/src/libcschem/concrete_grp.c (nonexistent) +++ trunk/src/libcschem/concrete_grp.c (revision 413) @@ -0,0 +1,58 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - libcschem (core library) + * Copyright (C) 2018 Tibor 'Igor2' Palinkas + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version.* + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact: + * Project page: http://repo.hu/projects/cschem + * lead developer: email to cschem (at) igor2.repo.hu + * mailing list: cschem (at) list.repo.hu (send "subscribe") + */ + + +#include "config.h" +#include "concrete.h" +#include "concrete_grp.h" + +csch_cgrp_t *csch_cgrp_alloc(csch_sheet_t *sheet, csch_oid_t oid) +{ + csch_cgrp_t *grp; + + grp = htip_get(&sheet->id2obj, oid); + if (grp != NULL) + return NULL; + grp = calloc(sizeof(csch_cgrp_t), 1); + + csch_cobj_init(&grp->hdr, sheet, oid, CSCH_CTYPE_GRP, CSCH_INVALID_OID); + return grp; +} + +void csch_cgrp_free(csch_cgrp_t *grp) +{ + csch_cobj_uninit(&grp->hdr); + free(grp); +} + +csch_cgrp_t *csch_cgrp_get(csch_sheet_t *sheet, csch_oid_t oid) +{ + csch_cgrp_t *grp = htip_get(&sheet->id2obj, oid); + if ((grp != NULL) && (grp->hdr.type != CSCH_CTYPE_GRP)) + return NULL; + return grp; +} + Index: trunk/src/libcschem/concrete_grp.h =================================================================== --- trunk/src/libcschem/concrete_grp.h (revision 412) +++ trunk/src/libcschem/concrete_grp.h (revision 413) @@ -48,4 +48,8 @@ csch_coord_t xc, yc, x0, y0; } csch_cgrp_ref_t; +csch_cgrp_t *csch_cgrp_alloc(csch_sheet_t *sheet, csch_oid_t oid); +void csch_cgrp_free(csch_cgrp_t *grp); +csch_cgrp_t *csch_cgrp_get(csch_sheet_t *sheet, csch_oid_t oid); + #endif Index: trunk/src/libcschem/concrete_poly.c =================================================================== --- trunk/src/libcschem/concrete_poly.c (nonexistent) +++ trunk/src/libcschem/concrete_poly.c (revision 413) @@ -0,0 +1,58 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - libcschem (core library) + * Copyright (C) 2018 Tibor 'Igor2' Palinkas + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version.* + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Contact: + * Project page: http://repo.hu/projects/cschem + * lead developer: email to cschem (at) igor2.repo.hu + * mailing list: cschem (at) list.repo.hu (send "subscribe") + */ + + +#include "config.h" +#include "concrete.h" +#include "concrete_poly.h" + +csch_cpoly_t *csch_cpoly_alloc(csch_sheet_t *sheet, csch_oid_t oid) +{ + csch_cpoly_t *poly; + + poly = htip_get(&sheet->id2obj, oid); + if (poly != NULL) + return NULL; + poly = calloc(sizeof(csch_cpoly_t), 1); + + csch_cobj_init(&poly->hdr, sheet, oid, CSCH_CTYPE_POLY, CSCH_INVALID_OID); + return poly; +} + +void csch_cpoly_free(csch_cpoly_t *poly) +{ + csch_cobj_uninit(&poly->hdr); + free(poly); +} + +csch_cpoly_t *csch_cpoly_get(csch_sheet_t *sheet, csch_oid_t oid) +{ + csch_cpoly_t *poly = htip_get(&sheet->id2obj, oid); + if ((poly != NULL) && (poly->hdr.type != CSCH_CTYPE_POLY)) + return NULL; + return poly; +} + Index: trunk/src/libcschem/concrete_poly.h =================================================================== --- trunk/src/libcschem/concrete_poly.h (revision 412) +++ trunk/src/libcschem/concrete_poly.h (revision 413) @@ -37,4 +37,8 @@ csch_vtcoutline_t outline; } csch_cpoly_t; +csch_cpoly_t *csch_cpoly_alloc(csch_sheet_t *sheet, csch_oid_t oid); +void csch_cpoly_free(csch_cpoly_t *poly); +csch_cpoly_t *csch_cpoly_get(csch_sheet_t *sheet, csch_oid_t oid); + #endif