Subversion Repositories SvarDOS

Rev

Rev 1742 | Rev 1744 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1742 Rev 1743
Line 478... Line 478...
478
    glob_sortcmp_dat.sortownia[i] = i;
478
    glob_sortcmp_dat.sortownia[i] = i;
479
    /* sorting should be case-insensitive */
479
    /* sorting should be case-insensitive */
480
    if ((i >= 'A') && (i <= 'Z')) glob_sortcmp_dat.sortownia[i] |= 32;
480
    if ((i >= 'A') && (i <= 'Z')) glob_sortcmp_dat.sortownia[i] |= 32;
481
  }
481
  }
482
 
482
 
-
 
483
  /* try to replace (or complement) my naive collation table with an NLS-aware
-
 
484
   * version provided by the kernel (or NLSFUNC) */
-
 
485
  {
-
 
486
    _Packed struct nlsseqtab {
-
 
487
      unsigned char id;
-
 
488
      unsigned short taboff;
-
 
489
      unsigned short tabseg;
-
 
490
    } collat;
-
 
491
    void *colptr = &collat;
-
 
492
    unsigned char errflag = 1;
-
 
493
    _asm {
-
 
494
      push ax
-
 
495
      push bx
-
 
496
      push cx
-
 
497
      push dx
-
 
498
      push di
-
 
499
      push es
-
 
500
 
-
 
501
      mov ax, 0x6506  /* DOS 3.3+ - Get collating sequence table */
-
 
502
      mov bx, 0xffff  /* code page, FFFFh = "current" */
-
 
503
      mov cx, 5       /* size of buffer at ES:DI */
-
 
504
      mov dx, 0xffff  /* country id, FFFFh = "current" */
-
 
505
      push ds
-
 
506
      pop es          /* ES:DI = address of buffer for the 5-bytes struct */
-
 
507
      mov di, colptr
-
 
508
      int 0x21
-
 
509
      jc FAIL
-
 
510
      xor al, al
-
 
511
      mov errflag, al
-
 
512
      FAIL:
-
 
513
 
-
 
514
      pop es
-
 
515
      pop di
-
 
516
      pop dx
-
 
517
      pop cx
-
 
518
      pop bx
-
 
519
      pop ax
-
 
520
    }
-
 
521
 
-
 
522
    if ((errflag == 0) && (collat.id == 6)) {
-
 
523
      unsigned char far *ptr = MK_FP(collat.tabseg, collat.taboff);
-
 
524
      unsigned short count = *(unsigned short far *)ptr;
-
 
525
      /* printf("NLS AT %04X:%04X (%u elements)\n", collat.tabseg, collat.taboff, count); */
-
 
526
      if (count <= 256) { /* you never know */
-
 
527
        ptr += 2; /* skip the count header */
-
 
528
        for (i = 0; i < count; i++) {
-
 
529
          glob_sortcmp_dat.sortownia[i] = ptr[i];
-
 
530
        }
-
 
531
      }
-
 
532
    }
-
 
533
  }
-
 
534
 
483
  i = nls_getpatterns(&(buf->nls));
535
  i = nls_getpatterns(&(buf->nls));
484
  if (i != 0) nls_outputnl_doserr(i);
536
  if (i != 0) nls_outputnl_doserr(i);
485
 
537
 
486
  /* disable usage of thousands separator on narrow screens */
538
  /* disable usage of thousands separator on narrow screens */
487
  if (screenw < 80) buf->nls.thousep[0] = 0;
539
  if (screenw < 80) buf->nls.thousep[0] = 0;