*/}}

la_util.h 20 KB

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