Skip to content

Commit 672751d

Browse files
author
root
committed
1.10.0a
1 parent d470b9a commit 672751d

31 files changed

+1615
-395
lines changed

BREPLib/BrepLib.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,14 @@ int BrepSolidList::addSolid(MeshObjectData* mesh)
6262
BREP_SHELL* shell = new BREP_SHELL(solid);
6363

6464
MeshFacetNode* node = mesh->facet;
65-
6665
while (node!=NULL) {
6766
//
6867
for (int num = 0; num < node->num_index - 2; num += 3) {
6968
BREP_FACET* facet = new BREP_FACET(shell);
7069
//
71-
int idx0 = node->data_index[num];
72-
int idx1 = node->data_index[num+1];
73-
int idx2 = node->data_index[num+2];
70+
int idx0 = node->data_index[num];
71+
int idx1 = node->data_index[num+1];
72+
int idx2 = node->data_index[num+2];
7473

7574
vertex[0] = node->vertex_value[idx0];
7675
vertex[1] = node->vertex_value[idx1];

BREPLib/BrepLib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class BrepSolidList
3939
void free (void);
4040

4141
public:
42-
int addObject(MeshObjectData* mesh) { return addSolid(mesh);} // 有効なファセットの数を返す
42+
int addShell(MeshObjectData* mesh) { return addSolid(mesh);} // 有効なファセットの数を返す
4343
int addSolid (MeshObjectData* mesh); // 有効なファセットの数を返す
4444
void closeSolid(void) {}
4545
void outputFile(const char* fn, const char* path=NULL, bool asciifile=true);

BasicLib/Lib/buffer.cpp

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,48 @@ int ins_i2Buffer(int src, Buffer* dst)
698698
}
699699

700700

701+
/**
702+
int copy_r2Buffer(float src, Buffer* dst)
703+
704+
実数 srcを文字列に変換して,dstへ copyする.
705+
*/
706+
int copy_r2Buffer(float src, Buffer* dst)
707+
{
708+
char num[LEN_REAL];
709+
710+
snprintf(num, LEN_REAL-1, "%f", src);
711+
return copy_b2Buffer((void*)num, dst, (int)strlen(num));
712+
}
713+
714+
715+
/**
716+
int cat_r2Buffer(float src, Buffer* dst)
717+
718+
実数 srcを文字列に変換して,dstへ catする.
719+
*/
720+
int cat_r2Buffer(float src, Buffer* dst)
721+
{
722+
char num[LEN_REAL];
723+
724+
snprintf(num, LEN_REAL-1, "%f", src);
725+
return cat_b2Buffer((void*)num, dst, (int)strlen(num));
726+
}
727+
728+
729+
/**
730+
int ins_r2Buffer(float src, Buffer* dst)
731+
732+
実数 srcを文字列に変換して,dstの前に 挿入する.
733+
*/
734+
int ins_r2Buffer(float src, Buffer* dst)
735+
{
736+
char num[LEN_REAL];
737+
738+
snprintf(num, LEN_REAL-1, "%f", src);
739+
return ins_b2Buffer((void*)num, dst, (int)strlen(num));
740+
}
741+
742+
701743
/**
702744
int cmp_Buffer(Buffer src, Buffer dst, int n)
703745
@@ -830,6 +872,35 @@ Buffer decode_base64_Buffer(Buffer str)
830872
}
831873

832874

875+
/**
876+
Buffer encode_base64_Buffer_bin(unsigned char* bin, int sz, int nopad)
877+
878+
sz バイトの バイナリデータ binを Base64にエンコード する.
879+
nopad = TRUE の場合,データ末の パッド(=)は削除する.
880+
*/
881+
Buffer encode_base64_Buffer_bin(unsigned char* bin, int sz, int nopad)
882+
{
883+
unsigned char* str;
884+
Buffer enc = init_Buffer();
885+
886+
if (bin==NULL) return enc;
887+
if (sz<=0) sz = strlen((char*)bin);
888+
889+
str = encode_base64(bin, sz);
890+
if (str==NULL) return enc;
891+
892+
if (nopad) {
893+
int len = strlen((char*)str);
894+
if (str[len-2]=='=') str[len-2] = '\0';
895+
else if (str[len-1]=='=') str[len-1] = '\0';
896+
}
897+
enc = make_Buffer_bystr(str);
898+
free(str);
899+
900+
return enc;
901+
}
902+
903+
833904
/**
834905
Buffer encode_base64_filename_Buffer(Buffer buf, unsigned char cc)
835906
@@ -1301,7 +1372,8 @@ Buffer型変数 bufのバッファ部がテキストかどうか検査する.
13011372
*/
13021373
int isText_Buffer(Buffer buf)
13031374
{
1304-
for (int i=0; i<buf.vldsz; i++) {
1375+
int i;
1376+
for (i=0; i<buf.vldsz; i++) {
13051377
if (buf.buf[i]<0x20 && buf.buf[i]!=0x0a && buf.buf[i]!=0x0d
13061378
&& buf.buf[i]!=0x00 && buf.buf[i]!=0x09) return FALSE;
13071379
if (buf.buf[i]==0x7f) return FALSE; // DEL
@@ -1632,7 +1704,8 @@ void rewrite_Buffer_bychar(Buffer* buf, const char frm, const char toc)
16321704
{
16331705
if (buf==NULL) return;
16341706

1635-
for (int i=0; i<buf->vldsz; i++) {
1707+
int i;
1708+
for (i=0; i<buf->vldsz; i++) {
16361709
if (buf->buf[i]==frm) buf->buf[i] = toc;
16371710
}
16381711
return;

BasicLib/Lib/buffer.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ int copy_i2Buffer(int src, Buffer* dst); ///< 整数 srcを
9090
int cat_i2Buffer (int src, Buffer* dst); ///< 整数 srcを文字列に変換して,dstへ catする.
9191
int ins_i2Buffer (int src, Buffer* dst); ///< 整数 srcを文字列に変換して,dstの前に 挿入する.
9292

93+
int copy_r2Buffer(float src, Buffer* dst); ///< 実数 srcを文字列に変換して,dstへ copyする.
94+
int cat_r2Buffer (float src, Buffer* dst); ///< 実数 srcを文字列に変換して,dstへ catする.
95+
int ins_r2Buffer (float src, Buffer* dst); ///< 実数 srcを文字列に変換して,dstの前に 挿入する.
9396

9497
/** @def copy_s2Buffer
9598
@@ -124,6 +127,9 @@ char*変数 srcから Buffer型変数dstへ文字列を catする.@n
124127
void kanji_convert_Buffer(Buffer* mesg); ///< 大域変数 @b KanjiCode (tools.h) に従って漢字コードを変換する.@n
125128
Buffer encode_base64_Buffer(Buffer buf); ///< バイナリデータ buf.bufの buf.vldszバイトを Base64にエンコード する
126129
Buffer decode_base64_Buffer(Buffer buf); ///< strのバッファを Base64からデコードする
130+
131+
Buffer encode_base64_Buffer_bin(unsigned char* bin, int sz, int nopad); ///< sz バイトの バイナリデータ binを Base64にエンコード する.
132+
127133
Buffer encode_base64_filename_Buffer(Buffer buf, unsigned char cc); ///< バイナリデータ bufを Base64で encodeしてファイル名を作る.ただし '/' は cc として扱う.
128134
Buffer decode_base64_filename_Buffer(Buffer buf, unsigned char cc); ///< bufを Base64で decodeしてバイナリデータを取り出す.ただし cc は '/' として扱う.
129135

BasicLib/Lib/common.h

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@
160160
#define L_16 16
161161
#define L_OCT 8
162162

163+
#define LEN_REAL 32 ///< 15*2 + '@\0' + 1(予備)
163164
#define LEN_INT 22 ///< log 2^64 + '@\0' + 1(予備)
164165
#define LEN_IPADDR 17 ///< strlen("AAA.BBB.CCC.DDD") + '@\0' + 1(予備)
165166
#define LEN_IPADDR6 41 ///< strlen("1111:2222:333:4444:5555:6666:7777:8888") + '@\0' + 1(予備)
@@ -280,28 +281,45 @@
280281

281282

282283
// for 3D
283-
#define JBXL_3D_FORMAT_NONE 0
284-
#define JBXL_3D_FORMAT_DAE 1
285-
#define JBXL_3D_FORMAT_OBJ 2
286-
#define JBXL_3D_FORMAT_FBX 3
287-
#define JBXL_3D_FORMAT_GLTF 4
288-
#define JBXL_3D_FORMAT_STL 8
289-
#define JBXL_3D_FORMAT_STL_A 8 // ASCII
290-
#define JBXL_3D_FORMAT_STL_B 9 // Binary
291-
292-
#define JBXL_3D_ENGINE_NONE 0
293-
#define JBXL_3D_ENGINE_UNITY 1
294-
#define JBXL_3D_ENGINE_UE 2
284+
#define JBXL_3D_FORMAT_NONE 0
285+
#define JBXL_3D_FORMAT_DAE 1
286+
#define JBXL_3D_FORMAT_OBJ 2
287+
#define JBXL_3D_FORMAT_FBX 3
288+
#define JBXL_3D_FORMAT_GLTF 4
289+
#define JBXL_3D_FORMAT_GLB 5
290+
#define JBXL_3D_FORMAT_STL 8
291+
#define JBXL_3D_FORMAT_STL_A 8 ///< ASCII
292+
#define JBXL_3D_FORMAT_STL_B 9 ///< Binary
293+
294+
#define JBXL_3D_ENGINE_NONE 0
295+
#define JBXL_3D_ENGINE_UNITY 1
296+
#define JBXL_3D_ENGINE_UE 2
297+
298+
// Texture
299+
// see gLib/gheader.h
300+
#define JBXL_TEXTURE_UN_KNOWN 0
301+
#define JBXL_TEXTURE_MOON 3
302+
#define JBXL_TEXTURE_DICOM 4
303+
#define JBXL_TEXTURE_USERSET 5
304+
305+
#define JBXL_TEXTURE_CT 16 ///< 0x0010 CT (Moon)
306+
#define JBXL_TEXTURE_JPEG 32 ///< 0x0020
307+
#define JBXL_TEXTURE_JPG 32
308+
#define JBXL_TEXTURE_TIFF 48 ///< 0x0030
309+
#define JBXL_TEXTURE_PNG 64 ///< 0x0040
310+
#define JBXL_TEXTURE_TGA 80 ///< 0x0050
311+
#define JBXL_TEXTURE_JP2K 96 ///< 0x0060
312+
#define JBXL_TEXTURE_RAS 112 ///< 0x0070 SUN RASTER 8bit
295313

296314

297315
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
298316
//
299-
typedef unsigned char uByte;
300-
typedef char sByte;
301-
typedef unsigned short uWord;
302-
typedef short sWord;
303-
typedef unsigned int uDWord;
304-
typedef int sDWord;
317+
typedef unsigned char uByte; ///< 1Byte
318+
typedef char sByte; ///< 1Byte
319+
typedef unsigned short uWord; ///< 2Byte
320+
typedef short sWord; ///< 2Byte
321+
typedef unsigned int uDWord; ///< 4Byte
322+
typedef int sDWord; ///< 4Byte
305323

306324

307325
/** Parameter

BasicLib/Lib/jbxl_state.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,5 +122,6 @@ void jbxl_add_all_states(void)
122122
jbxl_add_state(JBXL_GRAPH_IVDPARAM_ERROR, "JBXL_GRAPH_IVDPARAM_ERROR", "無効なパラメータ");
123123
jbxl_add_state(JBXL_GRAPH_IVDDATA_ERROR, "JBXL_GRAPH_IVDDATA_ERROR", "無効なデータ");
124124
jbxl_add_state(JBXL_GRAPH_IVDFMT_ERROR, "JBXL_GRAPH_IVDFMT_ERROR", "無効なデータ形式");
125+
jbxl_add_state(JBXL_GRAPH_IVDCOLOR_ERROR, "JBXL_GRAPH_IVDCOLOR_ERROR", "無効なカラー指定");
125126
jbxl_add_state(JBXL_GRAPH_THROUGH_ERROR, "JBXL_GRAPH_THROUGH_ERROR", "エラー処理をスルーする");
126127
}

BasicLib/Lib/jbxl_state.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ void jbxl_add_state(int id, const char* smb, const char* str);
177177
#define JBXL_GRAPH_IVDPARAM_ERROR -2022 ///< 無効なパラメータ
178178
#define JBXL_GRAPH_IVDDATA_ERROR -2023 ///< 無効なデータ
179179
#define JBXL_GRAPH_IVDFMT_ERROR -2024 ///< 無効なデータ形式
180+
#define JBXL_GRAPH_IVDCOLOR_ERROR -2025 ///< 無効なカラー指定
180181

181182
#define JBXL_GRAPH_THROUGH_ERROR -2888 ///< エラー処理をスルーする
182183

0 commit comments

Comments
 (0)