/*****************************************************************************/
/* LibDWG - Free DWG read-only library */
/* Copyright (C) 2008, 2009 Free Software Foundation, Inc. */
/* */
/* This library is free software, licensed under the terms of the GNU */
/* General Public License as published by the Free Software Foundation, */
/* either version 3 of the License, or (at your option) any later version. */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/*****************************************************************************/
/// Dekodigo
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "komune.h"
#include "bite.h"
#include "dvg.h"
#include "dekodigo.h"
/*--------------------------------------------------------------------------------
* Privataj funkcioj
*/
static void dvg_dek_aldoni_objekto (Dvg_Strukturo * skt, Bit_Cxeno * dat, long unsigned int adreso);
/*--------------------------------------------------------------------------------
* Publikaj variabloj
*/
long unsigned int ktl_lastadreso;
/*--------------------------------------------------------------------------------
* Difino de publikaj funkcioj
*/
int
dvg_dek_strukturigi (Bit_Cxeno * dat, Dvg_Strukturo * skt)
{
unsigned char sig;
unsigned int sekgrandeco = 0;
unsigned char sgdc[2];
unsigned int i, j;
unsigned int ckr, ckr2, antckr;
long unsigned int kiom;
long unsigned int lasta;
long unsigned int maplasta;
long unsigned int duabajto;
long unsigned int obek;
long unsigned int obfin;
long unsigned int pvz;
/*-------------------------------------------------------------------------
* Kap-datenaro
*/
/* Versio
*/
dat->bajto = 0;
dat->bito = 0;
strncpy (skt->kapo.versio, dat->cxeno, 6);
skt->kapo.versio[6] = '\0';
if (strcmp (skt->kapo.versio, "AC1015") != 0)
{
printf ("Nur eblas dekodigi dvg-dosierojn laux la versio R2000 (AC1015). "
"La trovita versio kodo estas: %s\n", skt->kapo.versio);
return -1;
}
dat->bajto = 0x06;
// 6 Nuloj kaj valoro
for (i = 0; i < 7; i++)
{
sig = bit_legi_RC (dat);
//printf ("0x%02X ", sig);
}
//puts ("");
/* Bildadresilo
*/
pvz = bit_legi_RL (dat);
//printf ("0x%08X\n", pvz);
// Versio kaj lancxo
sig = bit_legi_RC (dat);
//printf ("Versio: %u\n", sig);
sig = bit_legi_RC (dat);
//printf ("Lancxo: %u\n", sig);
/* Kodpagxo
*/
dat->bajto = 0x13;
skt->kapo.kodpagxo = bit_legi_RS (dat);
//printf ("Kodpagxo: %u\n", skt->kapo.kodpagxo);
/* Sekcioj
*/
dat->bajto = 0x15;
skt->kapo.sekcio_kiom = bit_legi_RL (dat);
if (skt->kapo.sekcio_kiom > 6)
skt->kapo.sekcio_kiom = 6;
for (i = 0; i < skt->kapo.sekcio_kiom; i++)
{
skt->kapo.sekcio[i].adresilo = 0;
skt->kapo.sekcio[i].grandeco = 0;
skt->kapo.sekcio[i].numero = bit_legi_RC (dat);
skt->kapo.sekcio[i].adresilo = bit_legi_RL (dat);
skt->kapo.sekcio[i].grandeco = bit_legi_RL (dat);
}
// Kontroli CKR-on
/*
ckr = bit_legi_CRC (dat);
dat->bajto -= 2;
bit_krei_CRC (dat, 0, 0);
dat->bajto -= 2;
ckr2 = bit_legi_CRC (dat);
dat->bajto -= 2;
bit_skribi_RS (dat, ckr2 ^ 0x8461);
dat->bajto -= 2;
ckr2 = bit_legi_CRC (dat);
printf ("Legita CRC: %X\nKreita CRC: %X\n", ckr, ckr2);
*/
bit_sercxi_gardostaranto (dat, dvg_gardostaranto (DVG_GS_KAPO_FINO));
/*
if (bit_sercxi_gardostaranto (dat, dvg_gardostaranto (DVG_GS_KAPO_FINO)))
printf ("=======> KAPO (fino): %8X\n", dat->bajto);
*/
/*-------------------------------------------------------------------------
* Nekonata sekcio 1
*/
if (skt->kapo.sekcio_kiom == 6)
{
//printf ("========> NEKONATA 1: %8X\n", skt->kapo.sekcio[5].adresilo);
//printf (" NEKONATA 1 (fino): %8X\n", skt->kapo.sekcio[5].adresilo + skt->kapo.sekcio[5].grandeco);
dat->bajto = skt->kapo.sekcio[5].adresilo;
skt->nekonata1.kiom = DVG_NEKONATA1_KIOM;
skt->nekonata1.bajto = skt->nekonata1.bito = 0;
skt->nekonata1.cxeno = malloc (skt->nekonata1.kiom);
memcpy (skt->nekonata1.cxeno, &dat->cxeno[dat->bajto], skt->nekonata1.kiom);
//bit_esplori_cxeno ((Bit_Cxeno *) &skt->nekonata1, skt->nekonata1.kiom);
//bit_montri ((Bit_Cxeno *) &skt->nekonata1, skt->nekonata1.kiom);
}
/*-------------------------------------------------------------------------
* Antauxrigarda bildo
*/
if (bit_sercxi_gardostaranto (dat, dvg_gardostaranto (DVG_GS_BILDO_EKO)))
{
unsigned long int ekadreso;
dat->bito = 0;
ekadreso = dat->bajto;
//printf ("=============> BILDO: %8X\n", ekadreso - 16);
if (bit_sercxi_gardostaranto (dat, dvg_gardostaranto (DVG_GS_BILDO_FINO)))
{
//printf (" BILDO (fino): %8X\n", dat->bajto);
skt->bildo.kiom = (dat->bajto - 16) - ekadreso;
skt->bildo.cxeno = (char *) malloc (skt->bildo.kiom);
memcpy (skt->bildo.cxeno, &dat->cxeno[ekadreso], skt->bildo.kiom);
}
else
skt->bildo.kiom = 0;
}
/*-------------------------------------------------------------------------
* Kap-variabloj
*/
//printf ("=====> KAP-VARIABLOJ: %8X\n", skt->kapo.sekcio[0].adresilo);
//printf ("KAP-VARIABLOJ (fino): %8X\n", skt->kapo.sekcio[0].adresilo + skt->kapo.sekcio[0].grandeco);
dat->bajto = skt->kapo.sekcio[0].adresilo + 16;
pvz = bit_legi_RL (dat);
//printf ("Longeco: %lu\n", pvz);
dat->bito = 0;
/* Legi la kap-variablojn
*/
for (i = 0; i < DVG_KIOM_VARIABLOJ; i++)
{
//printf ("[%03i] - ", i + 1);
if (i == 221 && skt->var[220].dubitoko != 3)
{
skt->var[i].traktilo.kodo = 0;
skt->var[i].traktilo.valoro = 0;
//puts ("(NE EKZISTANTA)");
continue;
}
switch (dvg_varmapo (i))
{
case DVG_DT_B:
skt->var[i].bitoko = bit_legi_B (dat);
//printf ("B: %u", skt->var[i].bitoko);
break;
case DVG_DT_BS:
skt->var[i].dubitoko = bit_legi_BS (dat);
//printf ("BS: %u", skt->var[i].dubitoko);
break;
case DVG_DT_BL:
skt->var[i].kvarbitoko = bit_legi_BL (dat);
//printf ("BL: %lu", skt->var[i].kvarbitoko);
break;
case DVG_DT_BD:
skt->var[i].duglitajxo = bit_legi_BD (dat);
//printf ("BD: %lg", skt->var[i].duglitajxo);
break;
case DVG_DT_H:
bit_legi_H (dat, &skt->var[i].traktilo);
//printf ("H: %i.%i.0x%08X", skt->var[i].traktilo.kodo, skt->var[i].traktilo.kiom, skt->var[i].traktilo.valoro);
break;
case DVG_DT_T:
skt->var[i].teksto = bit_legi_T (dat);
//printf ("T: \"%s\"", skt->var[i].teksto);
break;
case DVG_DT_CMC:
skt->var[i].dubitoko = bit_legi_BS (dat);
//printf ("CMC: %u", skt->var[i].dubitoko);
break;
case DVG_DT_2RD:
skt->var[i].xy[0] = bit_legi_RD (dat);
skt->var[i].xy[1] = bit_legi_RD (dat);
//printf ("X: %lg\t", skt->var[i].xy[0]);
//printf ("Y: %lg", skt->var[i].xy[1]);
break;
case DVG_DT_3BD:
skt->var[i].xyz[0] = bit_legi_BD (dat);
skt->var[i].xyz[1] = bit_legi_BD (dat);
skt->var[i].xyz[2] = bit_legi_BD (dat);
//printf ("X: %lg\t", skt->var[i].xyz[0]);
//printf ("Y: %lg\t", skt->var[i].xyz[1]);
//printf ("Z: %lg", skt->var[i].xyz[2]);
break;
default:
printf ("Ne traktebla tipo: %i (var: %i)\n", dvg_varmapo (i), i);
}
//puts ("");
}
// Kontroli CKR-on
ckr = bit_legi_CRC (dat);
/*
for (i = 0xC001; i != 0xC000; i++)
{
dat->bajto -= 2;
bit_krei_CRC (dat, skt->kapo.sekcio[0].adresilo + 16, i);
dat->bajto -= 2;
ckr2 = bit_legi_CRC (dat);
if (ckr == ckr2)
{
printf ("Legita CRC: %X\nKreita CRC: %X\t SEMO: %02X\n", ckr, ckr2, i);
break;
}
}
*/
/*-------------------------------------------------------------------------
* Klasoj
*/
//printf ("============> KLASOJ: %8X\n", skt->kapo.sekcio[1].adresilo);
//printf (" KLASOJ (fino): %8X\n", skt->kapo.sekcio[1].adresilo + skt->kapo.sekcio[1].grandeco);
dat->bajto = skt->kapo.sekcio[1].adresilo
没有合适的资源?快使用搜索试试~ 我知道了~
libdwg_AutoCad_IntelliCad
共45个文件
c:10个
h:6个
in:5个
5星 · 超过95%的资源 需积分: 28 38 下载量 125 浏览量
2013-05-13
03:06:58
上传
评论 1
收藏 385KB RAR 举报
温馨提示
About DWG file format, OpenCAD given a format. I had a network up and down the C++ source code, not in English, is written in Esperanto. I tried to translate into C# version, we found only a part of the analysis of DWG data. And OpenCAD instructions given in reference format, I will share my research process. Also hope to get the results in this respect the guidance of a master. For friends who are interested are also welcome exchange. Here attached the network up and down the C++ source code, interested friends together under stud
资源推荐
资源详情
资源评论
收起资源包目录
libdwg-0.3.rar (45个子文件)
libdwg-0.3
LEGUMIN 2KB
acinclude.m4 10B
config.h.in 2KB
aclocal.m4 264KB
fontkodo
komune.h 2KB
dvg.h 19KB
enkodigo.h 993B
dekodigo.h 997B
enkodigo.c 17KB
bite.h 4KB
Makefile.am 409B
dvg.c 21KB
Makefile.in 16KB
dekodigo.c 44KB
montri.h 857B
komune.c 5KB
bite.c 22KB
testo.c 2KB
montri.c 24KB
ekzemplo.dwg 45KB
TODO 164B
Makefile.am 53B
agordo
depcomp 17KB
config.guess 43KB
config.sub 32KB
texinfo.tex 234KB
missing 11KB
install-sh 13KB
ltmain.sh 192KB
configure.in 957B
README 93B
Makefile.in 19KB
INSTALL 9KB
AUTHORS 56B
examples
get_bmp.c 2KB
load_dwg.c 2KB
dwg_ps.c 7KB
Courier.afm 15KB
Makefile.am 273B
Makefile.in 14KB
sample.dwg 45KB
configure 706KB
NEWS 272B
ChangeLog 2KB
COPYING 34KB
共 45 条
- 1
资源评论
- lxf08022013-08-15下载了,没什么作用
u010636348
- 粉丝: 0
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 数据库设计管理课程设计系统设计报告(powerdesign+sql+DreamweaverCS)医院管理系统设计与开发
- VMware 学习教程(入门到实践)
- 数据库设计管理课程设计系统设计报告(powerdesign+sql+DreamweaverCS)学生选课管理系统2
- LLMS&隐写术12345
- 关于内置谷歌中文输入法apk
- 数据库设计管理课程设计系统设计报告(powerdesign+sql+DreamweaverCS)学生选课管理系统
- 基于realsense d435i相机和yolov5的目标检测机器人项目含运行说明(自动返回位置信息).zip
- 2025年Gartner重要战略技术趋势及对企业数字化转型的影响
- 数据库设计管理课程设计系统设计报告(powerdesign+sql+DreamweaverCS)学生管理系统设计与开发2
- Java 学习教程(基础到实践)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功