~ubuntu-branches/ubuntu/vivid/tidy/vivid-updates

« back to all changes in this revision

Viewing changes to src/charsets.c

  • Committer: Bazaar Package Importer
  • Author(s): Jason Thomas
  • Date: 2008-01-20 21:46:03 UTC
  • mfrom: (0.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080120214603-oqicq5jwr1exrm55
Tags: 20080116cvs-2
* debian/control: build depends on xsltproc
  (closes: #461608)
* debian/tidy.preinst,postinst: add code to move old config file
  (closes: #461623)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* charsets.c -- character set information and mappings
2
2
 
3
 
  (c) 1998-2004 (W3C) MIT, ERCIM, Keio University
 
3
  (c) 1998-2006 (W3C) MIT, ERCIM, Keio University
4
4
  See tidy.h for the copyright notice.
5
5
 
6
 
  $Id: charsets.c,v 1.4 2004/08/02 02:22:48 terry_teague Exp $
 
6
  $Id: charsets.c,v 1.6 2006/09/18 09:52:33 arnaud02 Exp $
7
7
*/
8
8
 
 
9
#include "forward.h"
9
10
#include "tidy.h"
10
11
#include "tmbstr.h"
11
12
#include "charsets.h"
955
956
  {   0, NULL,                                                0,  no }
956
957
};
957
958
 
958
 
uint GetEncodingIdFromName(ctmbstr name)
959
 
{
960
 
    uint i;
961
 
 
962
 
    for (i = 0; charsetInfo[i].id; ++i)
963
 
        if (tmbstrcasecmp(name, charsetInfo[i].charset) == 0)
964
 
            return charsetInfo[i].id;
965
 
 
966
 
    return 0;
967
 
}
968
 
 
969
 
uint GetEncodingIdFromCodePage(uint cp)
970
 
{
971
 
    uint i;
972
 
 
973
 
    for (i = 0; charsetInfo[i].id; ++i)
974
 
        if (cp == charsetInfo[i].codepage)
975
 
            return charsetInfo[i].id;
976
 
 
977
 
    return 0;
978
 
}
979
 
 
980
 
uint GetEncodingCodePageFromName(ctmbstr name)
981
 
{
982
 
    uint i;
983
 
 
984
 
    for (i = 0; charsetInfo[i].id; ++i)
985
 
        if (tmbstrcasecmp(name, charsetInfo[i].charset) == 0)
986
 
            return charsetInfo[i].codepage;
987
 
 
988
 
    return 0;
989
 
}
990
 
 
991
 
uint GetEncodingCodePageFromId(uint id)
992
 
{
993
 
    uint i;
994
 
 
995
 
    for (i = 0; charsetInfo[i].id; ++i)
996
 
        if (id == charsetInfo[i].id)
997
 
            return charsetInfo[i].codepage;
998
 
 
999
 
    return 0;
1000
 
}
1001
 
 
1002
 
ctmbstr GetEncodingNameFromId(uint id)
1003
 
{
1004
 
    uint i;
1005
 
 
1006
 
    for (i = 0; charsetInfo[i].id; ++i)
1007
 
        if (id == charsetInfo[i].id)
1008
 
            return charsetInfo[i].charset;
1009
 
 
1010
 
    return NULL;
1011
 
}
1012
 
 
1013
 
ctmbstr GetEncodingNameFromCodePage(uint cp)
1014
 
{
1015
 
    uint i;
1016
 
 
1017
 
    for (i = 0; charsetInfo[i].id; ++i)
1018
 
        if (cp == charsetInfo[i].codepage)
1019
 
            return charsetInfo[i].charset;
1020
 
 
1021
 
    return NULL;
1022
 
}
 
959
uint TY_(GetEncodingIdFromName)(ctmbstr name)
 
960
{
 
961
    uint i;
 
962
 
 
963
    for (i = 0; charsetInfo[i].id; ++i)
 
964
        if (TY_(tmbstrcasecmp)(name, charsetInfo[i].charset) == 0)
 
965
            return charsetInfo[i].id;
 
966
 
 
967
    return 0;
 
968
}
 
969
 
 
970
uint TY_(GetEncodingIdFromCodePage)(uint cp)
 
971
{
 
972
    uint i;
 
973
 
 
974
    for (i = 0; charsetInfo[i].id; ++i)
 
975
        if (cp == charsetInfo[i].codepage)
 
976
            return charsetInfo[i].id;
 
977
 
 
978
    return 0;
 
979
}
 
980
 
 
981
uint TY_(GetEncodingCodePageFromName)(ctmbstr name)
 
982
{
 
983
    uint i;
 
984
 
 
985
    for (i = 0; charsetInfo[i].id; ++i)
 
986
        if (TY_(tmbstrcasecmp)(name, charsetInfo[i].charset) == 0)
 
987
            return charsetInfo[i].codepage;
 
988
 
 
989
    return 0;
 
990
}
 
991
 
 
992
uint TY_(GetEncodingCodePageFromId)(uint id)
 
993
{
 
994
    uint i;
 
995
 
 
996
    for (i = 0; charsetInfo[i].id; ++i)
 
997
        if (id == charsetInfo[i].id)
 
998
            return charsetInfo[i].codepage;
 
999
 
 
1000
    return 0;
 
1001
}
 
1002
 
 
1003
ctmbstr TY_(GetEncodingNameFromId)(uint id)
 
1004
{
 
1005
    uint i;
 
1006
 
 
1007
    for (i = 0; charsetInfo[i].id; ++i)
 
1008
        if (id == charsetInfo[i].id)
 
1009
            return charsetInfo[i].charset;
 
1010
 
 
1011
    return NULL;
 
1012
}
 
1013
 
 
1014
ctmbstr TY_(GetEncodingNameFromCodePage)(uint cp)
 
1015
{
 
1016
    uint i;
 
1017
 
 
1018
    for (i = 0; charsetInfo[i].id; ++i)
 
1019
        if (cp == charsetInfo[i].codepage)
 
1020
            return charsetInfo[i].charset;
 
1021
 
 
1022
    return NULL;
 
1023
}
 
1024
 
 
1025
/*
 
1026
 * local variables:
 
1027
 * mode: c
 
1028
 * indent-tabs-mode: nil
 
1029
 * c-basic-offset: 4
 
1030
 * eval: (c-set-offset 'substatement-open 0)
 
1031
 * end:
 
1032
 */