1/* -*- c -*- */ 2/*****************************************************************************/ 3/* LibreDWG - free implementation of the DWG file format */ 4/* */ 5/* Copyright (C) 2018 Free Software Foundation, Inc. */ 6/* */ 7/* This library is free software, licensed under the terms of the GNU */ 8/* General Public License as published by the Free Software Foundation, */ 9/* either version 3 of the License, or (at your option) any later version. */ 10/* You should have received a copy of the GNU General Public License */ 11/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ 12/*****************************************************************************/ 13 14/* 15 * header.spec: DWG file header specification 16 * written by Reini Urban 17 */ 18 19#include "spec.h" 20 21// char version[6] handled separately. older releases just had a version[12] 22#ifdef IS_JSON 23 KEY (zero_5); 24 fprintf (dat->fh, "[ %d, %d, %d, %d, %d ]", 25 _obj->zero_5[0], _obj->zero_5[1], _obj->zero_5[2], _obj->zero_5[3], 26 _obj->zero_5[4]); 27#else 28 for (i = 0; i < 5; i++) { 29 FIELD_RC (zero_5[i], 0); 30 } 31#endif 32 FIELD_RC (is_maint, 0); 33 34 PRE (R_13) { 35 FIELD_RC (zero_one_or_three, 0); // 1,3,0,5,0,0x00cd,0 36 for (i = 0; i < 3; i++) { // 3, 5, 205 37 FIELD_RS (unknown_s[i], 0); 38 } 39 FIELD_RC (dwg_version, 0); // 0 40 } LATER_VERSIONS { 41 FIELD_RC (zero_one_or_three, 0); 42 FIELD_RL (thumbnail_address, 0); //@0x0d 43 FIELD_RC (dwg_version, 0); // of app which stored it. eg. SaveAs 44 FIELD_RC (maint_version, 0); 45 FIELD_RS (codepage, 0); //@0x13: 29/30 for ANSI_1252, since r2007 UTF-16 46 } 47 48 /* Until R_2004 here follows the sections */ 49 50 SINCE (R_2004) { 51 IF_ENCODE_FROM_EARLIER { 52 FIELD_VALUE (app_dwg_version) = FIELD_VALUE (dwg_version); 53 FIELD_VALUE (app_maint_version) = FIELD_VALUE (maint_version); 54 FIELD_VALUE (r2004_header_address) = 0x80; 55 } 56 FIELD_RC (unknown_0, 0); 57 FIELD_RC (app_dwg_version, 0); 58 FIELD_RC (app_maint_version, 0); 59 FIELD_RL (security_type, 0); 60 FIELD_RL (rl_1c_address, 0); /* mostly 0 */ 61 FIELD_RL (summaryinfo_address, 0); 62 FIELD_RL (vbaproj_address, 0); 63 FIELD_RL (r2004_header_address, 0); /* mostly 128/0x80 */ 64 ENCODER { 65 for (i = 0; i < 54; i++) 66 bit_write_RC (dat, 0); 67 } 68 else { 69 dat->byte += 54; // empty slack 70 } 71 /* at 0x80 follows the encrypted r2004_header */ 72 } 73