mirror of https://gitlab.com/nakst/essence
				
				
				
			scripting engine fix ExternalSystemSleepMs on mac
This commit is contained in:
		
							parent
							
								
									62eb94b1d2
								
							
						
					
					
						commit
						4f028a18b1
					
				| 
						 | 
					@ -595,6 +595,14 @@ const EsStyle styleListRowOdd = {
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const EsStyle styleTable = {
 | 
					const EsStyle styleTable = {
 | 
				
			||||||
 | 
						.metrics = {
 | 
				
			||||||
 | 
							.mask = ES_THEME_METRICS_CLIP_ENABLED | ES_THEME_METRICS_GAP_MAJOR,
 | 
				
			||||||
 | 
							.clipEnabled = true,
 | 
				
			||||||
 | 
							.gapMajor = 6,
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const EsStyle styleList = {
 | 
				
			||||||
	.metrics = {
 | 
						.metrics = {
 | 
				
			||||||
		.mask = ES_THEME_METRICS_CLIP_ENABLED,
 | 
							.mask = ES_THEME_METRICS_CLIP_ENABLED,
 | 
				
			||||||
		.clipEnabled = true,
 | 
							.clipEnabled = true,
 | 
				
			||||||
| 
						 | 
					@ -625,7 +633,7 @@ void AddREPLResult(ExecutionContext *context, EsElement *parent, Node *type, Val
 | 
				
			||||||
		const char *valueText;
 | 
							const char *valueText;
 | 
				
			||||||
		size_t valueBytes;
 | 
							size_t valueBytes;
 | 
				
			||||||
		ScriptHeapEntryToString(context, entry, &valueText, &valueBytes);
 | 
							ScriptHeapEntryToString(context, entry, &valueText, &valueBytes);
 | 
				
			||||||
		char *buffer = EsStringAllocateAndFormat(&bytes, "\"%s\"", valueBytes, valueText);
 | 
							char *buffer = EsStringAllocateAndFormat(&bytes, "\u201C%s\u201D", valueBytes, valueText);
 | 
				
			||||||
		EsTextDisplayCreate(parent, ES_CELL_H_FILL, &styleOutputData, buffer, bytes);
 | 
							EsTextDisplayCreate(parent, ES_CELL_H_FILL, &styleOutputData, buffer, bytes);
 | 
				
			||||||
	} else if (type->type == T_LIST && type->firstChild->type == T_STRUCT) {
 | 
						} else if (type->type == T_LIST && type->firstChild->type == T_STRUCT) {
 | 
				
			||||||
		EsAssert(context->heapEntriesAllocated > (uint64_t) value.i);
 | 
							EsAssert(context->heapEntriesAllocated > (uint64_t) value.i);
 | 
				
			||||||
| 
						 | 
					@ -669,7 +677,7 @@ void AddREPLResult(ExecutionContext *context, EsElement *parent, Node *type, Val
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else if (type->type == T_LIST) {
 | 
						} else if (type->type == T_LIST) {
 | 
				
			||||||
		normalList:;
 | 
							normalList:;
 | 
				
			||||||
		EsPanel *panel = EsPanelCreate(parent, ES_CELL_H_FILL | ES_PANEL_VERTICAL | ES_PANEL_STACK, &styleTable);
 | 
							EsPanel *panel = EsPanelCreate(parent, ES_CELL_H_FILL | ES_PANEL_VERTICAL | ES_PANEL_STACK, &styleList);
 | 
				
			||||||
		EsAssert(context->heapEntriesAllocated > (uint64_t) value.i);
 | 
							EsAssert(context->heapEntriesAllocated > (uint64_t) value.i);
 | 
				
			||||||
		HeapEntry *entry = &context->heap[value.i];
 | 
							HeapEntry *entry = &context->heap[value.i];
 | 
				
			||||||
		EsAssert(entry->type == T_LIST);
 | 
							EsAssert(entry->type == T_LIST);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5741,7 +5741,7 @@ int ExternalSystemSleepMs(ExecutionContext *context, Value *returnValue) {
 | 
				
			||||||
	return 4;
 | 
						return 4;
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
	struct timespec sleepTime;
 | 
						struct timespec sleepTime;
 | 
				
			||||||
	uint64_t x = 1000000 * coroutine->externalCoroutineData.i;
 | 
						uint64_t x = 1000000 * context->c->externalCoroutineData.i;
 | 
				
			||||||
	sleepTime.tv_sec = x / 1000000000;
 | 
						sleepTime.tv_sec = x / 1000000000;
 | 
				
			||||||
	sleepTime.tv_nsec = x % 1000000000;
 | 
						sleepTime.tv_nsec = x % 1000000000;
 | 
				
			||||||
	nanosleep(&sleepTime, NULL);
 | 
						nanosleep(&sleepTime, NULL);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue