*/}}
1
0

la_util.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. #pragma once
  2. /*
  3. NUL4.0 - Nick's Best - www.nicksbest.com
  4. Author(s):WuYiming - xp8110@outlook.com
  5. Want to join the development?
  6. Append your name in the authors list above.
  7. Send feedback to la_support@nicksbest.com
  8. */
  9. #define _CRT_SECURE_NO_WARNINGS
  10. #include "GL/glew.h"
  11. #include "GL/gl.h"
  12. #include "ft2build.h"
  13. #include "freetype/freetype.h"
  14. #include "la_icon.h"
  15. #include "pthread.h"
  16. #include <wchar.h>
  17. #define NEED_STRUCTURE(a)\
  18. typedef struct _##a a;
  19. #define STRUCTURE(a)\
  20. typedef struct _##a a;\
  21. struct _##a
  22. #define lengthof(a)\
  23. (sizeof(a)/sizeof(a[0]))
  24. #define DBL_TRIANGLE_LIM 1e-11
  25. #define DBL_EDGE_LIM 1e-9
  26. #define LA_HYPER_CREATED_TIME(hi)\
  27. hi->TimeCreated.Year,hi->TimeCreated.Month,hi->TimeCreated.Day,hi->TimeCreated.Hour,hi->TimeCreated.Minute,hi->TimeCreated.Second
  28. typedef double real;
  29. typedef unsigned long long u64bit;
  30. typedef unsigned int u32bit;
  31. typedef unsigned short u16bit;
  32. typedef unsigned short ushort;
  33. typedef unsigned char u8bit;
  34. typedef struct _laListSingle laListSingle;
  35. struct _laListSingle {
  36. void* pNext;
  37. };
  38. typedef struct _laListHandle laListHandle;
  39. struct _laListHandle {
  40. void* pFirst;
  41. void* pLast;
  42. };
  43. typedef struct _laListWithPivot laListWithPivot;
  44. struct _laListWithPivot {
  45. void* pFirst;
  46. void* pLast;
  47. void* Pivot;
  48. };
  49. typedef struct _laListItem laListItem;
  50. struct _laListItem {
  51. void* pPrev;
  52. void* pNext;
  53. };
  54. typedef struct _laListItem2 laListItem2;
  55. struct _laListItem2 {
  56. void* O1;
  57. void* O2;
  58. void* pPrev;
  59. void* pNext;
  60. };
  61. typedef struct _laListItem3 laListItem3;
  62. struct _laListItem3 {
  63. void* O1;
  64. void* O2;
  65. void* O3;
  66. void* O4;
  67. void* pPrev;
  68. void* pNext;
  69. };
  70. NEED_STRUCTURE(laSafeString);
  71. STRUCTURE(laAuthorInfo) {
  72. laListItem Item;
  73. laSafeString* Name;
  74. laSafeString* CopyrightString;
  75. };
  76. STRUCTURE(laTimeInfo) {
  77. u16bit Year;//Also Used As Timer [ms] counter
  78. u8bit Month;
  79. u8bit Day;
  80. u8bit Hour;
  81. u8bit Minute;
  82. u8bit Second;
  83. };
  84. NEED_STRUCTURE(laPropContainer);
  85. typedef struct _laUID laUID;
  86. struct _laUID {
  87. char String[32];//a simplified uuid, example: 0E3F9BA4802FDDC2-20160601123546 [\0]
  88. };
  89. typedef struct _laListItemPointer laListItemPointer;
  90. struct _laListItemPointer {
  91. void* pPrev;
  92. void* pNext;
  93. void* p;
  94. };
  95. typedef struct _laItemUserLinker laItemUserLinker;
  96. typedef void(*laUserRemoveFunc)(void* This, laItemUserLinker* iul);
  97. NEED_STRUCTURE(laProp);
  98. struct _laItemUserLinker {
  99. laListItemPointer Pointer;
  100. laUserRemoveFunc Remove;
  101. laProp* Which;
  102. void* Additional;
  103. unsigned int FrameDistinguish;
  104. int ForceRecalc;
  105. };
  106. typedef struct _laItemUserLinkerLocal laItemUserLinkerLocal;
  107. struct _laItemUserLinkerLocal {
  108. laItemUserLinker Link;
  109. void* Instance;
  110. };
  111. typedef struct _laElementListItem laElementListItem;
  112. struct _laElementListItem {
  113. laListItem Item;
  114. void* Ext;
  115. };
  116. typedef struct _laListNonRecursiveRoot laListNonRecursiveRoot;
  117. struct _laListNonRecursiveRoot {
  118. laListHandle NSItems;
  119. };
  120. typedef int(*laCompareFunc)(void*, void*);
  121. typedef void(*laListDoFunc)(void*);
  122. typedef void(*laListNonRecursiveDoFunc)(laListNonRecursiveRoot*, void*, void*);//item,custom
  123. typedef void(*laListNonRecursiveCopyFunc)(laListNonRecursiveRoot*, void*, void*, void*);//old,new,custom
  124. typedef void(*laListDoFuncArgp)(void*, void*);
  125. typedef void(*laCopyListFunc)(void*, void*);
  126. typedef void(*laListCustomDataRemover)(void*);
  127. //typedef void(*ListMatcherFunc)(void*,void*);//gotten value,enumed curent lst item.
  128. typedef struct _laListNonRecursiveItem laListNonRecursiveItem;
  129. struct _laListNonRecursiveItem {
  130. laListItem Item;
  131. laListHandle handle;
  132. laListHandle *ToHandle;//This Is Pointer!
  133. laListNonRecursiveDoFunc func;
  134. laListNonRecursiveCopyFunc CopyFunc;
  135. laListCustomDataRemover remover;
  136. void* CustomData;
  137. int bFreeList;
  138. int SizeEachNode;
  139. };
  140. typedef struct _laHash256 laHash256;
  141. struct _laHash256 {
  142. laListHandle Entries[256];
  143. };
  144. typedef struct _laHash65536 laHash65536;
  145. struct _laHash65536 {
  146. laListHandle Entries[65536];
  147. //laHash256 HashHandles[256];
  148. };
  149. typedef struct _laHash16M laHash16M;
  150. struct _laHash16M {
  151. laListHandle Entries[16777216];
  152. };
  153. typedef struct _laSafeString laSafeString;
  154. struct _laSafeString {
  155. laListItem Item;
  156. char * Ptr;
  157. };
  158. typedef struct _laSafeStringCollection laSafeStringCollection;
  159. struct _laSafeStringCollection {
  160. laListHandle SafeStrings;
  161. };
  162. typedef struct _laStringSplitor laStringSplitor;
  163. struct _laStringSplitor {
  164. int NumberParts;
  165. laListHandle parts;
  166. };
  167. typedef struct _laStringPart laStringPart;
  168. struct _laStringPart {
  169. laListItem Item;
  170. char * Content;
  171. int IntValue;
  172. real FloatValue;
  173. char Type;
  174. };
  175. STRUCTURE(laStringLine) {
  176. laListItem Item;
  177. wchar_t Buf[1024];//unicode
  178. };
  179. STRUCTURE(laStringEdit) {
  180. laListHandle Lines;
  181. int CursorLine, CursorBefore, CursorPreferBefore;
  182. int BeginLine, BeginBefore;
  183. int EndLine, EndBefore;
  184. int _BeginLine, _BeginBefore; // selection order
  185. int _EndLine, _EndBefore;
  186. int TotalLines;
  187. int ViewStartLine, ViewStartCol;
  188. int ViewHeight, ViewWidth;
  189. int MouseSelecting;
  190. };
  191. #define LA_SWAP(T,x,y)\
  192. { T SWAP = x; x = y; y = SWAP; }
  193. #define LA_MEMORY_POOL_1MB 1048576
  194. #define LA_MEMORY_POOL_128MB 134217728
  195. #define LA_MEMORY_POOL_256MB 268435456
  196. #define LA_MEMORY_POOL_512MB 536870912
  197. STRUCTURE(laMemoryPool) {
  198. laListItem Item;
  199. int NodeSize;
  200. int NextCount;
  201. int UsableCount;
  202. int Hyperlevel;
  203. laListHandle Pools;
  204. };
  205. STRUCTURE(laMemoryPoolPart) {
  206. laListItem Item;
  207. laListHandle FreeMemoryNodes;
  208. int UsedCount;
  209. laMemoryPool* PoolRoot;
  210. //<------Pool mem starts here
  211. };
  212. NEED_STRUCTURE(laDBInst);
  213. STRUCTURE(laMemNode0){
  214. laListItem Item;
  215. laMemoryPoolPart* InPool;//<---- Keep at the last
  216. //<------User mem starts here
  217. };
  218. STRUCTURE(laMemNode) {
  219. laListItem Item;
  220. laListHandle Users; //<---- Keep at the second
  221. void* ReadInstance;
  222. laMemoryPoolPart* InPool; //<---- Keep at the last
  223. //<------User mem starts here
  224. };
  225. NEED_STRUCTURE(laManagedUDF);
  226. STRUCTURE(laMemNodeHyper) {
  227. laListItem Item;
  228. laListHandle Users; //<---- Keep at the second
  229. laUID NUID;
  230. laTimeInfo TimeCreated;
  231. laManagedUDF* FromFile;
  232. int Modified;
  233. int UNUSEDUndoDirty;
  234. laMemoryPoolPart* InPool; //<---- Keep at the last
  235. //<------User mem starts here
  236. };
  237. STRUCTURE(laStaticMemoryPoolNode) {
  238. laListItem Item;
  239. int UsedByte;
  240. //<------User mem starts here
  241. };
  242. STRUCTURE(laStaticMemoryPool) {
  243. int EachSize;
  244. laListHandle Pools;
  245. //pthread_spinlock_t csMem;
  246. };
  247. STRUCTURE(laAVLNodeReal64) {
  248. laAVLNodeReal64* Parent;
  249. u64bit Index;
  250. real Value;
  251. //real SmallestValue;
  252. //real GreatestValue;
  253. laAVLNodeReal64* Smaller;
  254. laAVLNodeReal64* Greater;
  255. char Height;
  256. void* Pointer;
  257. };
  258. STRUCTURE(laAVLTreeReal64) {
  259. laAVLNodeReal64* Root;
  260. u64bit ItemCount;
  261. laMemoryPool MemoryPool;
  262. };
  263. STRUCTURE(laTimeRecorder) {
  264. //SYSTEMTIME Time;
  265. time_t At;
  266. };
  267. STRUCTURE(laTranslationNode) {
  268. laListItem Item;
  269. laSafeString* LanguageName;
  270. laHash256 Matches;
  271. };
  272. STRUCTURE(laTranslation) {
  273. int EnableTranslation;
  274. laListHandle Languages;
  275. laTranslationNode* CurrentLanguage;
  276. laHash256 MisMatches;
  277. };
  278. STRUCTURE(laTranslationMatch) {
  279. laListItem Item;
  280. char * Target;
  281. char * Replacement;
  282. };
  283. char * txtReadFileAsString(char * FileName);
  284. void laSendPanic(char * message);
  285. #define SEND_PANIC_ERROR(message)\
  286. laSendPanic(message)
  287. #define SEND_NORMAL_ERROR(message)
  288. #define SEND_USER_MESSAGE(message)
  289. //MessageBox(0,message, "Message here:",0)
  290. #define CreateNew(Type)\
  291. calloc(sizeof(Type),1)
  292. #define CreateNew_Size(size)\
  293. calloc(size,1)
  294. #define CreateNewBuffer(Type,Num)\
  295. calloc(sizeof(Type),Num);
  296. #define FreeMem(ptr)\
  297. nutFreeMem((&ptr))
  298. #define elif\
  299. else if
  300. #define LA_UNAVAILABLE_NAME "- Unknown -"
  301. uint32_t laToUnicode(const unsigned char* ch, int* advance);
  302. int laToUTF8(const uint32_t ch, char* out, char** next);
  303. int strToUnicode(uint32_t* target, unsigned char* const src);
  304. int strToUTF8(unsigned char* target, uint32_t* const src);
  305. int strlenU(uint32_t* const str);
  306. int strcpyU(uint32_t* target, uint32_t* const source );
  307. int strcatU(uint32_t* target, uint32_t* const source );
  308. struct tm* laGetFullTime();
  309. void laRecordTime(laTimeRecorder* tr);
  310. real laTimeElapsedSecondsf(laTimeRecorder* End, laTimeRecorder* Begin);
  311. int laTimeElapsedMilliseconds(laTimeRecorder* End, laTimeRecorder* Begin);
  312. void laSetAuthorInfo(char * Name, char * CopyrightString);
  313. void memCreateNUID(laMemNodeHyper* hi);
  314. NEED_STRUCTURE(laPropPack);
  315. int nutHyperUserCount(void* instance, laProp* p_optional, int *p_count);
  316. void memHyperInfo(laPropPack* pp, char* buf);
  317. void memMakeHyperData(laMemNodeHyper* hi);
  318. void nutFreeMem(void** ptr);
  319. int nutFloatCompare(real l, real r);
  320. int nutSameAddress(void* l, void* r);
  321. void* arrElement(void* head, int i, int size);
  322. int arrEnsureLength(void** head, int next, int* max, size_t ElementSize);
  323. int arrInitLength(void** head, int max, int* pmax, size_t ElementSize);
  324. void arrFree(void** head, int* max);
  325. void lstPushSingle(void** Head, laListSingle* Item);
  326. void* lstPopSingle(void** Head, laListSingle* Item);
  327. void lstClearPrevNext(laListItem* li);
  328. int lstCountElements(laListHandle* Handle);
  329. void lstAppendItem(laListHandle* Handle, void* Item);
  330. void lstPushItem(laListHandle* Handle, void* Item);
  331. void* lstPopItem(laListHandle* Handle) ;
  332. void lstAppendItem2(laListHandle* Handle, void* Item);
  333. void* lstPopItem2(laListHandle* Handle);
  334. void lstPushItem2(laListHandle* Handle, void* Item);
  335. void lstAppendItem3(laListHandle* Handle, void* Item);
  336. void* lstPopItem3(laListHandle* Handle);
  337. void lstPushItem3(laListHandle* Handle, void* Item);
  338. int lstRemoveItem(laListHandle* Handle, laListItem* li) ;
  339. int lstRemoveItem2(laListHandle* Handle, laListItem2* li);
  340. int lstRemoveSegment(laListHandle* Handle, laListItem* Begin, laListItem* End);
  341. void lstInsertItemBefore(laListHandle* Handle, laListItem* toIns, laListItem* pivot);
  342. void lstInsertItemAfter(laListHandle* Handle, laListItem* toIns, laListItem* pivot);
  343. void lstInsertSegmentBefore(laListHandle* Handle, laListItem* Begin, laListItem* End, laListItem* pivot);
  344. void lstInsertSegmentAfter(laListHandle* Handle, laListItem* Begin, laListItem* End, laListItem* pivot);
  345. int lstHaveItemInList(laListHandle* Handle);
  346. /**/ void* lstGetTop(laListHandle* Handle);
  347. void lstPushSimpleItem(void** first, laItemUserLinker* iul);
  348. void* lstPushItemUser(void** first, void* p);
  349. void* lstPushItemUsing(void** first, void* p);
  350. void* lstAppendPointerOnly(laListHandle* h, void* p);
  351. void* lstAppendPointerSizedOnly(laListHandle* h, void* p, int size);
  352. void* lstPushPointerOnly(laListHandle* h, void* p);
  353. void* lstPushPointerSizedOnly(laListHandle* h, void* p, int size);
  354. int lstHasPointer(laListHandle* h, void *p);
  355. void* lstAppendPointer(laListHandle* h, void* p);
  356. void* lstAppendPointerSized(laListHandle* h, void* p, int size);
  357. void* lstPushPointer(laListHandle* h, void* p);
  358. void* lstPushPointerSized(laListHandle* h, void* p, int size);
  359. void* lstAppendPointerStatic(laListHandle* h, laStaticMemoryPool* smp, void* p);
  360. void* lstAppendPointerStaticSized(laListHandle* h, laStaticMemoryPool* smp, void* p, int size);
  361. void* lstPushPointerStatic(laListHandle* h, laStaticMemoryPool* smp, void* p);
  362. void* lstPushPointerStaticSized(laListHandle* h, laStaticMemoryPool* smp, void* p, int size);
  363. void* lstPopPointerOnly(laListHandle* h);
  364. void lstRemovePointerItemOnly(laListHandle* h, laListItemPointer* lip);
  365. void lstRemovePointerOnly(laListHandle* h, void* p);
  366. void lstClearPointerOnly(laListHandle* h);
  367. void lstGeneratePointerListOnly(laListHandle* from1, laListHandle* from2, laListHandle* to);
  368. void* lstPopPointer(laListHandle* h);
  369. void lstRemovePointerItem(laListHandle* h, laListItemPointer* lip);
  370. void lstRemovePointer(laListHandle* h, void* p);
  371. void lstRemovePointerLeave(laListHandle *h, void *p);
  372. void lstClearPointer(laListHandle* h);
  373. void lstGeneratePointerList(laListHandle* from1, laListHandle* from2, laListHandle* to);
  374. void lstCopyHandle(laListHandle* target, laListHandle* src);
  375. void* lstAppendPointerStaticPool(laStaticMemoryPool* mph, laListHandle* h, void* p);
  376. void* lstPopPointerLeave(laListHandle* h);
  377. void lstRemovePointerItemNoFree(laListHandle* h, laListItemPointer* lip);
  378. void lstMoveUp(laListHandle* h, laListItem* li);
  379. void lstMoveDown(laListHandle* h, laListItem* li);
  380. void lstForAllItemsDo(laListDoFunc func, laListHandle* hList);
  381. void lstForAllItemsDoLNRR(laListNonRecursiveDoFunc func, laListHandle* hList);
  382. void lstForAllItemsDo_DirectFree(laListDoFunc func, laListHandle* hList);
  383. void lstForAllItemsDo_arg_ptr(laListDoFuncArgp func, laListHandle* hList, void* arg);
  384. void lstForAllItemsDo_NonRecursive_Root(laListHandle* FirstHandle, laListNonRecursiveDoFunc func, int bFreeItem, void* custom_data, laListCustomDataRemover remover);
  385. void lstCopy_NonRecursive_Root(laListHandle* FromHandle, laListHandle* ToHandle, int SizeEachNode, laListNonRecursiveCopyFunc func, void* custom_data, laListCustomDataRemover remover);
  386. void lstAddNonRecursiveListHandle(laListNonRecursiveRoot* root, laListHandle* newHandle, laListNonRecursiveDoFunc nrFunc, int bFreeList, void* custom_data, laListCustomDataRemover remover);
  387. void lstAddNonRecursiveListCopier(laListNonRecursiveRoot* root, laListHandle* oldHandle, laListHandle* newHandle, int sizeEach, laListNonRecursiveCopyFunc nrCpyFunc, void* custom_data, laListCustomDataRemover remover);
  388. void* lstFindItem(void* CmpData, laCompareFunc func, laListHandle* hList);
  389. void lstCombineLists(laListHandle* dest, laListHandle* src);
  390. void lstDestroyList(laListHandle* hlst);
  391. void* lstReMatch(laListHandle* SearchHandle, laListHandle* CurrentHandle, void* ItemToFind);
  392. typedef int(*MatcherFunc)(void*, void*);
  393. void* lstReMatchEx(laListHandle* SearchHandle, laListHandle* CurrentHandle, void* ItemToFind, MatcherFunc func);
  394. void lstAddElement(laListHandle* hlst, void* ext);
  395. void lstDestroyElementList(laListHandle* hlst);
  396. void hsh256InsertItemCSTR(laHash256* hash, laListItem* li, char * buckle);
  397. void hsh256InsertItem(laHash256* hash, laListItem* li, char buckle);
  398. void hsh65536InsertItem(laHash65536* hash, laListItem* li, long buckle);
  399. void hsh65536Init(laHash65536** h);
  400. void hshFree(laHash65536** h);
  401. laListHandle* hsh65536DoHashLongPtr(laHash65536* hash, unsigned long long buckle);
  402. laListHandle* hsh65536DoHashNUID(laHash65536* hash, char * NUID);
  403. laListHandle* hsh16MDoHashLongPtr(laHash16M* hash, long long buckle);
  404. laListHandle* hsh16MDoHashNUID(laHash16M* hash, char * NUID);
  405. laListItem* hsh256FindItemSTR(laHash256* hash, laCompareFunc func, char * buckle);
  406. unsigned char hsh256DoHashSTR(char * buckle);
  407. // Leave memory to undo system to free later.
  408. #define memLeave(data) (data)
  409. void memResetByteCount();
  410. int memGetByteCount();
  411. void* memGetHead(void* UserMem, int* HyperLevel);
  412. laListHandle* memGetUserList(void* UserMem);
  413. laMemoryPool *memInitPool(int NodeSize, int HyperLevel);
  414. void memInitPoolSmall(laMemoryPool* mph, int NodeSize);
  415. laMemoryPoolPart* memNewPoolPart(laMemoryPool* mph);
  416. void* memAcquireH(laMemoryPool* Handle);
  417. void* memAcquireSimple(int Size);
  418. void* memAcquireNoAppend(int Size);
  419. void* memAcquireHyperNoAppend(int Size);
  420. void* memAcquire(int Size);
  421. void* memAcquireHyper(int Size);
  422. void memFree(void* Data);
  423. void memDestroyPool(laMemoryPool* Handle);
  424. void memNoLonger();
  425. void memMarkClean(void* HyperUserMem);
  426. laStaticMemoryPoolNode* memNewStaticPool(laStaticMemoryPool* smp);
  427. void* memStaticAcquire(laStaticMemoryPool*smp, int size);
  428. void* memStaticAcquireThread(laStaticMemoryPool*smp, int size);
  429. void* memStaticDestroy(laStaticMemoryPool*smp);
  430. NEED_STRUCTURE(laSubProp);
  431. void memAssignRef(void* This, void** ptr, void* instance);
  432. void memAssignRefSafe(laSubProp* sp, void* This, void** ptr, void* instance);
  433. int strGetStringTerminateBy(char * content, char terminator, char * Out);
  434. int strHeadOfStringMatch(char * Str, char * SubStr);
  435. int strSkipSegmet(char ** pivot, char * content);
  436. char * strGetLastSegment(char * Content, char Seperator);
  437. void strDiscardLastSegmentSeperateBy(char * Content, char Seperator);
  438. void strDiscardSameBeginningSeperatedBy(char * s1, char * s2, char ** Result1, char ** Result2, char Seperator);
  439. int strCountSegmentSeperateBy(char * Content, char Seperator);
  440. void strMakeDifferentName(char * Target);
  441. void strReplaceCharacter(char * Str, char Find, char Replace);
  442. void strToUpperCase(char * Str);
  443. void strToLowerCase(char * Str);
  444. laStringSplitor* strSplitPath(char * path);
  445. int strMakeInstructions(laStringSplitor** result,char * content);
  446. laStringPart* strGetArgument(laStringSplitor* ss, char * content);
  447. char * strGetArgumentString(laStringSplitor* ss, char * content);
  448. int strArgumentMatch(laStringSplitor* ss, char * id, char * value);
  449. int strDestroyStringSplitor(laStringSplitor** ss);
  450. int strGetIntSimple(char * content);
  451. real strGetFloatSimple(char * content);
  452. void strConvInt_CString(int src, char * dest, int lenth);
  453. void strConvFloat_CString(real src, char * dest, int lenth);
  454. void strCopyFull(char * dest, char * src);
  455. void strCopySized(char * dest, int LenthLim, char * src);
  456. #define strAppend strcat
  457. void strPrintFloatAfter(char * dest, int LenthLim, int bits, real data);
  458. void strPrintIntAfter(char * dest, int LenthLim, int data);
  459. int strSame(char * src, char *dest);
  460. void strEscapePath(char* OutCanBeSame, char* path);
  461. void strSafeDestroy(laSafeString** ss);
  462. void strSafeSet(laSafeString** ss, char * Content);
  463. void strSafeAppend(laSafeString **ss, char *Content);
  464. void strSafePrint(laSafeString **ss, char *Format, ...);
  465. void strSafePrintV(laSafeString **ss, char *Format, va_list arg);
  466. void strSafeDump();
  467. void strBeginEdit(laStringEdit** se, char * FullStr);
  468. char* strGetEditString(laStringEdit *se, int SelectionOnly);
  469. char* strEndEdit(laStringEdit** se, int FreeString);
  470. void strSetEditViewRange(laStringEdit* se, int Lines, int Cols);
  471. void strEnsureCursorVisible(laStringEdit* se);
  472. void strRemoveLine(laStringEdit* se, laStringLine* sl);
  473. void strRemoveLineI(laStringEdit* se, int LineIndex);
  474. void strSetCursor(laStringEdit* se, int LineIndex, int BeforeIndex);
  475. void strMoveCursor(laStringEdit* se, int Left, int Select);
  476. void strMoveCursorLine(laStringEdit *se, int Up, int Select);
  477. int strHasSelection(laStringEdit* se);
  478. void strCancelSelect(laStringEdit *se);
  479. void strLazySelect(laStringEdit *se);
  480. void strEndSelect(laStringEdit *se);
  481. void strSelectLineAll(laStringEdit* se);
  482. void strDeselectAll(laStringEdit* se);
  483. void strPanFoward(uint32_t * str, int Before, int Offset);
  484. void strSquishBackward(uint32_t * str, int Before, int EndBefore);
  485. void strClearSelection(laStringEdit* se);
  486. laStringLine *strGetCursorLine(laStringEdit *se, int* IndexIfLast);
  487. laStringLine* strGetBeginLine(laStringEdit* se);
  488. void strInsertChar(laStringEdit* se, uint32_t a);
  489. void strBackspace(laStringEdit* se);
  490. void strMoveView(laStringEdit *se, int DownLines, int RightCharacters);
  491. void transNewLanguage(const char * LanguageID);
  492. void transSetLanguage(const char * LanguageID);
  493. void transDumpMissMatchRecord(const char * filename);
  494. void transNewEntry(const char * Target, const char * replacement);
  495. char * transLate(char * Target);
  496. void transState(void* UNUSED, int val);
  497. void transInitTranslation_zh_cn();
  498. void laOpenInternetLink(char * link);