*/}}

la_util.h 19 KB

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