// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathui.cpp
// Function: edit_error(char*)
int edit_error(char *s)
{
int x;
char out[256+1];
int row,col,width;

   rpn_break = 1;
   edit_err_flag = 1;

   if(reading_lla && (zoom_screen == 'L')) {
      row = TEXT_ROWS-4;
      col = TEXT_COLS/2;
      width = TEXT_COLS/2;
   }
   else {
      row = EDIT_ROW+3;
      col = EDIT_COL;
      width = 80;
   }

   // show an error message and wait for a key press
   vidstr(row+0, col, PROMPT_COLOR, &blanks[TEXT_COLS-width]);
   vidstr(row+1, col, PROMPT_COLOR, &blanks[TEXT_COLS-width]);
   vidstr(row+2, col, PROMPT_COLOR, &blanks[TEXT_COLS-width]);
   vidstr(row+3, col, PROMPT_COLOR, &blanks[TEXT_COLS-width]);
   vidstr(row+4, col, PROMPT_COLOR, &blanks[TEXT_COLS-width]);
   vidstr(row+5, col, PROMPT_COLOR, &blanks[TEXT_COLS-width]);

   if(script_file) {
      sprintf(out, "Error in script file %s: line %d, col %d: %s",
         script_name, script_line, script_col, s);
      vidstr(row+1, col, PROMPT_COLOR, out);
      vidstr(row+2, col, PROMPT_COLOR, "Press any key to stop script....");
   }
   else {
      vidstr(row+1, col, PROMPT_COLOR, s);
      vidstr(row+2, col, PROMPT_COLOR, "Press any key to continue....");
   }

   if(rpn_mode) {
      BEEP(6566);
   }

   refresh_page();

   //!!! just waiting for a key here would be bad news because
   //    gps data would not be processed and the queue can overflow
   wait_for_key(1);

   vidstr(row+1, col, PROMPT_COLOR, "                                ");
   refresh_page();

   if(KBHIT()) x = GETCH();
   else        x = 0;
   script_fault = 1;

   if(rpn_mode) {
      edit_buffer[0] = 0;
      edit_buffer[1] = 0;
      msg_field[0] = 0;
      nmea_msg[0] = 0;
      msg_col = 0;
      start_calc(123);
      rpn_mode = (-1);
      rpn_err_flag = 1;
   }
   return x;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdi, -0x38(%rbp)
movl $0x1, %eax
movl %eax, 0x31fabf(%rip)    # 0x342d50
movl %eax, 0x31f5a1(%rip)    # 0x342838
leaq 0x318039(%rip), %rax    # 0x33b2d7
cmpb $0x0, (%rax)
je 0x232d3
leaq 0x2e94fe(%rip), %rax    # 0x30c7a8
cmpb $0x4c, (%rax)
jne 0x232d3
leaq 0x1f5556(%rip), %rax    # 0x21880c
movl (%rax), %r12d
addl $-0x4, %r12d
leaq 0x1f5544(%rip), %rax    # 0x218808
movl (%rax), %eax
movl %eax, %ebx
shrl $0x1f, %ebx
addl %eax, %ebx
sarl %ebx
movl %ebx, %eax
jmp 0x232ef
leaq 0x31c332(%rip), %rax    # 0x33f60c
movl (%rax), %r12d
addl $0x3, %r12d
leaq 0x31c328(%rip), %rax    # 0x33f610
movl (%rax), %ebx
movl $0x50, %eax
leaq 0x1f5512(%rip), %r14    # 0x218808
movslq (%r14), %rcx
movslq %eax, %r13
subq %r13, %rcx
leaq 0x318d0a(%rip), %r15    # 0x33c010
addq %r15, %rcx
movl %r12d, %edi
movl %ebx, %esi
movl $0xb, %edx
callq 0xe7d0
leal 0x1(%r12), %edi
movslq (%r14), %rcx
subq %r13, %rcx
addq %r15, %rcx
movl %edi, -0x2c(%rbp)
movl %ebx, %esi
movl $0xb, %edx
callq 0xe7d0
leal 0x2(%r12), %edi
movslq (%r14), %rcx
subq %r13, %rcx
addq %r15, %rcx
movl %edi, -0x30(%rbp)
movl %ebx, %esi
movl $0xb, %edx
callq 0xe7d0
leal 0x3(%r12), %edi
movslq (%r14), %rcx
subq %r13, %rcx
addq %r15, %rcx
movl %ebx, %esi
movl $0xb, %edx
callq 0xe7d0
leal 0x4(%r12), %edi
movslq (%r14), %rcx
subq %r13, %rcx
addq %r15, %rcx
movl %ebx, %esi
movl $0xb, %edx
callq 0xe7d0
addl $0x5, %r12d
movslq (%r14), %rcx
subq %r13, %rcx
addq %r15, %rcx
movl %r12d, %edi
movl %ebx, %esi
movl $0xb, %edx
callq 0xe7d0
leaq 0x21bb0f(%rip), %rax    # 0x23eeb8
cmpq $0x0, (%rax)
je 0x23404
leaq 0x21bb0a(%rip), %rax    # 0x23eec0
movl (%rax), %ecx
leaq 0x21bb05(%rip), %rax    # 0x23eec4
movl (%rax), %r8d
leaq 0xf15c0(%rip), %rsi     # 0x114989
leaq 0x21ba60(%rip), %rdx    # 0x23ee30
leaq -0x140(%rbp), %r12
movq %r12, %rdi
movq -0x38(%rbp), %r9
xorl %eax, %eax
callq 0x9060
movl -0x2c(%rbp), %r15d
movl %r15d, %edi
movl %ebx, %esi
movl $0xb, %edx
movq %r12, %rcx
callq 0xe7d0
leaq 0xf15b4(%rip), %rcx     # 0x1149b6
jmp 0x23422
movl -0x2c(%rbp), %r15d
movl %r15d, %edi
movl %ebx, %esi
movl $0xb, %edx
movq -0x38(%rbp), %rcx
callq 0xe7d0
leaq 0xf15b5(%rip), %rcx     # 0x1149d7
movl -0x30(%rbp), %edi
movl %ebx, %esi
movl $0xb, %edx
callq 0xe7d0
leaq 0x3183f0(%rip), %r14    # 0x33b828
cmpl $0x0, (%r14)
je 0x23448
movl $0x19a6, %edi           # imm = 0x19A6
callq 0x9d80
callq 0xab5f
movl $0x1, %edi
callq 0x1cbca
leaq 0x1105f7(%rip), %rcx    # 0x133a55
movl %r15d, %edi
movl %ebx, %esi
movl $0xb, %edx
callq 0xe7d0
callq 0xab5f
callq 0xd561
testl %eax, %eax
je 0x23484
callq 0xd595
movl %eax, %ebx
jmp 0x23486
xorl %ebx, %ebx
leaq 0x21ba3f(%rip), %rax    # 0x23eecc
movl $0x1, (%rax)
cmpl $0x0, (%r14)
je 0x234dc
leaq 0x31be40(%rip), %rax    # 0x33f2e0
movw $0x0, (%rax)
leaq 0x318594(%rip), %rax    # 0x33ba40
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0x318379(%rip), %rax    # 0x33b830
movb %cl, (%rax)
leaq 0x318784(%rip), %rax    # 0x33bc44
movl $0x0, (%rax)
callq 0x20ef0
movl $0xffffffff, (%r14)     # imm = 0xFFFFFFFF
movl $0x1, 0x32123c(%rip)    # 0x344718
movl %ebx, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq