⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gwutil_1.pas

📁 在Windows NT使用I/O端口,包括装载,开始,卸载驱动程序的函数.
💻 PAS
字号:
unit GWUtil_1;
{----------------------------------------------
GW Utility functions

98-05-25 GW original

-----------------------------------------------}
interface

Function HexToIntDef(Hex: string; Def: integer): integer;

Const HexDigits = '0123456789ABCDEF';

Type
  IntAsBytes = packed record
    b0, b1, b2, b3: byte;
  end;


//------------------------------------------------------
implementation
//------------------------------------------------------

//------------------------------------------------------
Function HexToIntDef(Hex: string; Def: integer): integer;
//------------------------------------------------------
Var
  Total, Dig: integer;
  ChPos, L: integer;
  Ch: char;
Label Err;
Begin
  Total := 0;
  L := Length(Hex);
  For ChPos := 1 to L do
  Begin
    Ch := upcase(Hex[ChPos]);
    Dig := Pos(Ch, HexDigits) - 1;
    If Dig = -1 then
    Begin
      Total := Def;
      goto Err;
    end;
    Total := Total * 16 + Dig;
  end;
Err:
  result := Total;
end;

end.
 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -