// File: /workspace/github_cpp_makefile_star2_O2/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)
pushq $0x1
popq %rax
movl %eax, 0x30b850(%rip)    # 0x32cd50
movl %eax, 0x30b332(%rip)    # 0x32c838
leaq 0x303dca(%rip), %rax    # 0x3252d7
cmpb $0x0, (%rax)
je 0x21544
leaq 0x2d528f(%rip), %rax    # 0x2f67a8
cmpb $0x4c, (%rax)
jne 0x21544
leaq 0x1e12e7(%rip), %rax    # 0x20280c
movl (%rax), %r12d
addl $-0x4, %r12d
leaq 0x1e12d5(%rip), %rax    # 0x202808
movl (%rax), %ecx
pushq $0x2
popq %rsi
movl %ecx, %eax
cltd
idivl %esi
movl %eax, %ebx
movl %eax, %r15d
jmp 0x21568
leaq 0x3080c1(%rip), %rax    # 0x32960c
movl (%rax), %r12d
addl $0x3, %r12d
leaq 0x3080b7(%rip), %rax    # 0x329610
movl (%rax), %ebx
leaq 0x1e12a6(%rip), %rax    # 0x202808
movl (%rax), %ecx
pushq $0x50
popq %r15
subl %r15d, %ecx
movslq %ecx, %rcx
addq 0x118a03(%rip), %rcx    # 0x139f78
pushq $0xb
popq %r13
movl %r12d, %edi
movl %ebx, %esi
movl %r13d, %edx
callq 0xe2d2
leal 0x1(%r12), %edi
leaq 0x1e1276(%rip), %r14    # 0x202808
movslq (%r14), %rcx
movslq %r15d, %r15
subq %r15, %rcx
addq 0x1189d6(%rip), %rcx    # 0x139f78
movl %edi, -0x30(%rbp)
movl %ebx, %esi
movl %r13d, %edx
callq 0xe2d2
leal 0x2(%r12), %edi
movslq (%r14), %rcx
subq %r15, %rcx
leaq 0x304a4f(%rip), %rax    # 0x326010
addq %rax, %rcx
movl %edi, -0x2c(%rbp)
movl %ebx, %esi
movl %r13d, %edx
callq 0xe2d2
leal 0x3(%r12), %edi
movslq (%r14), %rcx
subq %r15, %rcx
addq 0x118995(%rip), %rcx    # 0x139f78
movl %ebx, %esi
movl %r13d, %edx
callq 0xe2d2
leal 0x4(%r12), %edi
movslq (%r14), %rcx
subq %r15, %rcx
addq 0x118979(%rip), %rcx    # 0x139f78
movl %ebx, %esi
movl %r13d, %edx
callq 0xe2d2
addl $0x5, %r12d
movslq (%r14), %rcx
subq %r15, %rcx
addq 0x11895e(%rip), %rcx    # 0x139f78
movl %r12d, %edi
movl %ebx, %esi
movl %r13d, %edx
callq 0xe2d2
leaq 0x20788a(%rip), %rax    # 0x228eb8
cmpq $0x0, (%rax)
je 0x21693
leaq 0x207885(%rip), %rax    # 0x228ec0
movl (%rax), %ecx
leaq 0x207880(%rip), %rax    # 0x228ec4
movl (%rax), %r8d
leaq 0xdd44f(%rip), %rsi     # 0xfea9d
leaq 0x2077db(%rip), %rdx    # 0x228e30
leaq -0x140(%rbp), %r14
movq %r14, %rdi
movq -0x38(%rbp), %r9
xorl %eax, %eax
callq 0x9060
pushq $0xb
popq %r12
movl -0x30(%rbp), %r15d
movl %r15d, %edi
movl %ebx, %esi
movl %r12d, %edx
movq %r14, %rcx
callq 0xe2d2
leaq 0xdd441(%rip), %rcx     # 0xfeaca
movl -0x2c(%rbp), %edi
movl %ebx, %esi
movl %r12d, %edx
jmp 0x216bb
pushq $0xb
popq %r14
movl -0x30(%rbp), %r15d
movl %r15d, %edi
movl %ebx, %esi
movl %r14d, %edx
movq -0x38(%rbp), %rcx
callq 0xe2d2
leaq 0xdd438(%rip), %rcx     # 0xfeaeb
movl -0x2c(%rbp), %edi
movl %ebx, %esi
movl %r14d, %edx
callq 0xe2d2
leaq 0x304161(%rip), %r14    # 0x325828
cmpl $0x0, (%r14)
je 0x216d7
movl $0x19a6, %edi           # imm = 0x19A6
callq 0x9d23
callq 0xaa05
pushq $0x1
popq %rdi
callq 0x1bd13
leaq 0xfc37a(%rip), %rcx     # 0x11da65
pushq $0xb
popq %rdx
movl %r15d, %edi
movl %ebx, %esi
callq 0xe2d2
callq 0xaa05
callq 0xd1b9
testl %eax, %eax
je 0x2170f
callq 0xd1d5
movl %eax, %ebx
jmp 0x21711
xorl %ebx, %ebx
leaq 0x2077b4(%rip), %rax    # 0x228ecc
movl $0x1, (%rax)
cmpl $0x0, (%r14)
je 0x21760
leaq 0x307bb5(%rip), %rax    # 0x3292e0
andw $0x0, (%rax)
leaq 0x30430a(%rip), %rax    # 0x325a40
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0x3040ef(%rip), %rax    # 0x325830
movb %cl, (%rax)
leaq 0x3044fa(%rip), %rax    # 0x325c44
andl $0x0, (%rax)
callq 0x1f9c0
orl $-0x1, (%r14)
movl $0x1, 0x30cfb8(%rip)    # 0x32e718
movl %ebx, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq