1 Commits

Author SHA1 Message Date
1e663f36c8 Docs: Added licensing to contributing guide
All checks were successful
Build system / Check kernel codestyle (pull_request) Successful in 27s
Build system / Build (pull_request) Successful in 12m40s
Also renamed COPYING.TXT to LICENSE

Signed-off-by: Max Logaev <maxlogaev@proton.me>
2025-04-04 11:27:53 +03:00
12 changed files with 45 additions and 317 deletions

View File

@@ -66,6 +66,17 @@ to the end commit message body on a new line.
Use **rebase** to keep your branch up to date. Use **rebase** to keep your branch up to date.
## Licensing
For new source code files and for existing ones without a license, you need to add the following header to the beginning of the file:
```asm
; SPDX-License-Identifier: GPL-2.0-only
; Program - Brief description.
; Copyright (C) 2011-2025 KolibriOS team
```
Be careful when setting copyright and date interval. Review the file's history to verify its origin.
## Conclusion ## Conclusion
We hope this small instructions will help you to get familiar with KolibriOS contribution rules and inspire you to participate in the life of our project. We hope this small instructions will help you to get familiar with KolibriOS contribution rules and inspire you to participate in the life of our project.

View File

@@ -1,6 +1,6 @@
# KolibriOS # KolibriOS
[![License](https://img.shields.io/badge/License-GPL%202.0-green)](./COPYING.TXT) [![License](https://img.shields.io/badge/License-GPL%202.0-green)](./LICENSE)
[![Build system](https://git.kolibrios.org/KolibriOS/kolibrios/actions/workflows/build.yaml/badge.svg)](https://git.kolibrios.org/KolibriOS/kolibrios/actions) [![Build system](https://git.kolibrios.org/KolibriOS/kolibrios/actions/workflows/build.yaml/badge.svg)](https://git.kolibrios.org/KolibriOS/kolibrios/actions)
KolibriOS is a hobby operating system for x86-compatible computers, which is currently being developed by a small but passionate team of enthusiasts. KolibriOS is a hobby operating system for x86-compatible computers, which is currently being developed by a small but passionate team of enthusiasts.

View File

@@ -119,7 +119,7 @@
45 <20><><EFBFBD><EFBFBD><20><><EFBFBD><E0A8AD><EFBFBD><EFBFBD><EFBFBD> |easyshot 45 <20><><EFBFBD><EFBFBD><20><><EFBFBD><E0A8AD><EFBFBD><EFBFBD><EFBFBD> |easyshot
29 FB2 <20><><EFBFBD><E2A0AB> |fb2read 29 FB2 <20><><EFBFBD><E2A0AB> |fb2read
16 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> |aclock 16 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> |aclock
21 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |/kolibrios/utils/period 21 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |period
59 <20><EFBFBD><E0A5AD><EFBFBD><EFBFBD> KJ|ABuIIIA |games/klavisha 59 <20><EFBFBD><E0A5AD><EFBFBD><EFBFBD> KJ|ABuIIIA |games/klavisha
16 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> |demos/bcdclk 16 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> |demos/bcdclk
53 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |timer 53 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |timer

View File

@@ -270,15 +270,11 @@ void TWebBrowser::tag_h1234_caption()
void TWebBrowser::tag_kosicon() void TWebBrowser::tag_kosicon()
{ {
dword imgbuf[44]; dword imgbuf[44];
dword maxicon;
dword shared_i18 = memopen("ICONS18", NULL, SHM_READ); dword shared_i18 = memopen("ICONS18", NULL, SHM_READ);
maxicon = EDX / 18 / 18 / 4;
if (shared_i18) && (tag.get_number_of("n")) { if (shared_i18) && (tag.get_number_of("n")) {
if (tag.number < maxicon) { if (draw_x + 18 > canvas.bufw) NewLine();
if (draw_x + 18 > canvas.bufw) NewLine(); canvas.DrawImage(draw_x, draw_y-2, 18, 18, 18*18*4*tag.number+shared_i18);
canvas.DrawImage(draw_x, draw_y-2, 18, 18, 18*18*4*tag.number+shared_i18); draw_x += 22;
draw_x += 22;
}
} }
} }

View File

@@ -571,10 +571,10 @@ void OpenPage(dword _open_URL)
//INTERNAL PAGE //INTERNAL PAGE
history.add(#new_url); history.add(#new_url);
WB1.custom_encoding = -1; WB1.custom_encoding = -1;
if (streq(#new_url, URL_SERVICE_HOMEPAGE)) LoadInternalPage(#buildin_page_home, sizeof(buildin_page_home)); if (streq(#new_url, URL_SERVICE_HOMEPAGE)) LoadInternalPage(#buildin_page_home, sizeof(buildin_page_home)-1);
else if (streq(#new_url, URL_SERVICE_TEST)) LoadInternalPage(#buildin_page_test, sizeof(buildin_page_test)); else if (streq(#new_url, URL_SERVICE_TEST)) LoadInternalPage(#buildin_page_test, sizeof(buildin_page_test)-1);
else if (streq(#new_url, URL_SERVICE_HISTORY)) ShowHistory(); else if (streq(#new_url, URL_SERVICE_HISTORY)) ShowHistory();
else LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error)); else LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error)-1);
} else if (!strncmp(#new_url,"http:",5)) || (!strncmp(#new_url,"https:",6)) { } else if (!strncmp(#new_url,"http:",5)) || (!strncmp(#new_url,"https:",6)) {
//WEB PAGE //WEB PAGE
@@ -589,7 +589,7 @@ void OpenPage(dword _open_URL)
if (!http.transfer) { if (!http.transfer) {
history.add(#new_url); history.add(#new_url);
LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error)); LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error)-1);
} }
} else { } else {
//LOCAL PAGE //LOCAL PAGE
@@ -712,7 +712,7 @@ void EventSubmitOmnibox()
void LoadInternalPage(dword _bufdata, _in_bufsize){ void LoadInternalPage(dword _bufdata, _in_bufsize){
if (!_bufdata) || (!_in_bufsize) { if (!_bufdata) || (!_in_bufsize) {
LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error)); LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error)-1);
} else { } else {
WB1.list.first = 0; //scroll page to the top WB1.list.first = 0; //scroll page to the top
DrawOmnibox(); DrawOmnibox();

View File

@@ -112,4 +112,4 @@ char editbox_icons[] = FROM "res/editbox_icons.raw";
#define DEFAULT_URL URL_SERVICE_HOMEPAGE #define DEFAULT_URL URL_SERVICE_HOMEPAGE
char version[]="WebView 3.9"; char version[]="WebView 3.85";

View File

@@ -1,49 +1,17 @@
<html><head><title>New tab</title></head> <html>
<body bgcolor=#fff> <head>
<title>Homepage</title>
</head>
<body><pre>Welcome to WebView a Text-Based Browser.
<table><tr><td width=20><td width=210><pre> KolibriOS Bookmarks:
___________________ 1. <a href=//kolibrios.org>Homepage</a>
|# : : #| 2. <a href="//builds.kolibrios.org">Night-builds</a>
| : WebView : | 3. <a href="//ftp.kolibrios.org">FTP Server</a>
| : TextBased : |
| : Browser : |
| : : |
| :_____________: |
| ___________ |
| | __ | |
| || | | |
\____||__|_______|__|<font color=#DDD>lc</font>
<font bg=#F8F15B> web <font bg=#FF5A7E color=#fff> 1.0 <font bg=#47D018> compatable <font bg=#F8F15B>By the way,</font>
<font bg=#3CE7FF> </font></font></font></font>
<td>
</pre>
<kosicon n=58><a href=//kolibrios.org>Homepage</a> &nbsp;
<kosicon n=50><a href="//builds.kolibrios.org">Night-builds</a> &nbsp;
<kosicon n=50><a href="//ftp.kolibrios.org">FTP Server</a>
<pre>
By the way,
<font color="#555555">&bull; You can check for browser updates from the main menu. <font color="#555555">&bull; You can check for browser updates from the main menu.
&bull; To run a web search, type a text in the adress box and press Ctrl+Enter. &bull; To run a web search, type a text in the adress box and press Ctrl+Enter.
&bull; Pressing F6 moves a text cursor to the omnibox. &bull; Pressing F6 moves a text cursor to the omnibox.
&bull; You can manually change the encoding of a page by clicking on a label in the bottom right corner. &bull; Click on a label in the bottom right corner to change the encoding of a page.
</font>
~+
* +
' |
() .-.,="``"=. - o -
'=/_ \ |
* | '=._ |
\ `=./`, '
. '=.__.=' `=' *
+ +
O * ' .<font color=#DDD>jgs</font>

View File

@@ -1,49 +1,15 @@
<html><head><title><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></title></head> <html><head><meta charset="cp-866">
<body bgcolor=#fff> <title><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E0A0AD><EFBFBD></title></head>
<body><pre><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><EFBFBD><E2AEA2> <20><><EFBFBD><EFBFBD> WebView!
<table><tr><td width=20><td width=210><pre> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> KolibriOS:<ol>
___________________ <li><a href=//kolibrios.org><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><></a>
|# : : #| <li><a href="//builds.kolibrios.org"><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ᡮન</a>
| : WebView : | <li><a href="//ftp.kolibrios.org">FTP <20><><EFBFBD></a></ol>
| : <20><><EFBFBD><EFBFBD><EFBFBD><E2AEA2> : |
| : <20><><EFBFBD><EFBFBD> : |
| : : |
| :_____________: |
| ___________ |
| | __ | |
| || | | |
\____||__|_______|__|<font color=#DDD>lc</font>
<font bg=#F8F15B> web <font bg=#FF5A7E color=#fff> 1.0 <font bg=#47D018> compatable <font bg=#F8F15B><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,</font>
<font bg=#3CE7FF> </font></font></font></font>
<td>
</pre>
<kosicon n=58><a href=//kolibrios.org><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><></a> &nbsp;
<kosicon n=50><a href="//builds.kolibrios.org"><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ᡮન</a> &nbsp;
<kosicon n=50><a href="//ftp.kolibrios.org">FTP <20><><EFBFBD></a>
<pre>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
<font color="#555555">&bull; <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0AEA2><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <font color="#555555">&bull; <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0AEA2><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
&bull; <20><><EFBFBD> <20><><EFBFBD><20> Google <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ctrl+Enter &bull; <20><><EFBFBD> <20><><EFBFBD><20> Google <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ctrl+Enter
&bull; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> F6 <20><><EFBFBD><EFBFBD><><EFBFBD><E2AEA2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. &bull; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> F6 <20><><EFBFBD><EFBFBD><><EFBFBD><E2AEA2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
&bull; <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E0AEA2> <20><><EFBFBD><E0A0AD><EFBFBD>, <20><><EFBFBD> <20><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><EFBFBD><E0A0A2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><> <20><><EFBFBD><EFBFBD>. &bull; <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E0AEA2> <20><><EFBFBD><E0A0AD><EFBFBD>, <20><><EFBFBD> <20><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><EFBFBD><E0A0A2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><> <20><><EFBFBD><EFBFBD>.
~+
* +
' |
() .-.,="``"=. - o -
'=/_ \ |
* | '=._ |
\ `=./`, '
. '=.__.=' `=' *
+ +
O * ' .<font color=#DDD>jgs</font>

View File

@@ -225,10 +225,8 @@ void draw_window()
// Main buttons to fill the board // Main buttons to fill the board
#define FILL_BUTTON_SIZE BUTTON_SIZE+8 #define FILL_BUTTON_SIZE BUTTON_SIZE+8
for (i=0;i<6;i++) { for (i=0;i<6;i++)
DefineButton(i%3*FILL_BUTTON_SIZE+17,calc(i/3)*FILL_BUTTON_SIZE+15, DefineButton(i%3*FILL_BUTTON_SIZE+17,i/3*FILL_BUTTON_SIZE+15,FILL_BUTTON_SIZE,FILL_BUTTON_SIZE, i+100,FIELD_COLORS[i]);
FILL_BUTTON_SIZE,FILL_BUTTON_SIZE, i+100,FIELD_COLORS[i]);
}
// Menu buttons // Menu buttons
for (i=0;i<3;i++) for (i=0;i<3;i++)

View File

@@ -27,8 +27,6 @@ dword I_Path = 0;
#define true 1 #define true 1
#define false 0 #define false 0
inline fastcall dword calc(EAX) { return EAX; }
//------------------------------------------------------------------------- //-------------------------------------------------------------------------

View File

@@ -1,209 +0,0 @@
; Now being rewritten from https://github.com/nayuki/QR-Code-generator/blob/master/c/qrcodegen.c
; __DEBUG__ = 1
; __DEBUG_LEVEL__ = DBG_ALL
; DBG_ALL = 0 ; all messages
; DBG_INFO = 1 ; info and errors
; DBG_ERR = 2 ; only errors
include '../../proc32.inc'
include '../../struct.inc'
include '../../if.inc'
; include '../../debug-fdo.inc'
; The error correction level in a QR Code symbol.
qrcodegen_Ecc_LOW = 0 ; The QR Code can tolerate about 7% erroneous codewords
qrcodegen_Ecc_MEDIUM = 1 ; The QR Code can tolerate about 15% erroneous codewords
qrcodegen_Ecc_QUARTILE = 2 ; The QR Code can tolerate about 25% erroneous codewords
qrcodegen_Ecc_HIGH = 3 ; The QR Code can tolerate about 30% erroneous codewords
; The mask pattern used in a QR Code symbol.
;
; A special value to tell the QR Code encoder to
; automatically select an appropriate mask pattern:
qrcodegen_Mask_AUTO = -1
; The eight actual mask patterns:
qrcodegen_Mask_0 = 0
qrcodegen_Mask_1 = 1
qrcodegen_Mask_2 = 2
qrcodegen_Mask_3 = 3
qrcodegen_Mask_4 = 4
qrcodegen_Mask_5 = 5
qrcodegen_Mask_6 = 6
qrcodegen_Mask_7 = 7
; Describes how a segment's data bits are interpreted.
qrcodegen_Mode_NUMERIC = 0x1
qrcodegen_Mode_ALPHANUMERIC = 0x2
qrcodegen_Mode_BYTE = 0x4
qrcodegen_Mode_KANJI = 0x8
qrcodegen_Mode_ECI = 0x7
; A segment of character/binary/control data in a QR Code symbol.
; The mid-level way to create a segment is to take the payload data
; and call a factory function such as qrcodegen_makeNumeric().
; The low-level way to create a segment is to custom-make the bit buffer
; and initialize a qrcodegen_Segment struct with appropriate values.
; Even in the most favorable conditions, a QR Code can only hold 7089 characters of data.
; Any segment longer than this is meaningless for the purpose of generating QR Codes.
; Moreover, the maximum allowed bit length is 32767 because
; the largest QR Code (version 40) has 31329 modules.
struct qrcodegen_Segment
; The mode indicator of this segment.
mode dd ? ; qrcodegen_Mode
; The length of this segment's unencoded data. Measured in characters for
; numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.
; Always zero or positive. Not the same as the data's bit length.
numChars dd ?
; The data bits of this segment, packed in bitwise big endian.
; Can be null if the bit length is zero.
data dd ?
; The number of valid data bits used in the buffer. Requires
; 0 <= bitLength <= 32767, and bitLength <= (capacity of data array) * 8.
; The character count (numChars) must agree with the mode and the bit buffer length.
bitLength dd ?
ends
; The minimum version number supported in the QR Code Model 2 standard
qrcodegen_VERSION_MIN = 1
; The maximum version number supported in the QR Code Model 2 standard
qrcodegen_VERSION_MAX = 40
; Calculates the number of bytes needed to store any QR Code up to and including the given version number,
; as a compile-time constant. For example, 'uint8_t buffer[qrcodegen_BUFFER_LEN_FOR_VERSION(25)];'
; can store any single QR Code from version 1 to 25 (inclusive). The result fits in an int (or int16).
; Requires qrcodegen_VERSION_MIN <= n <= qrcodegen_VERSION_MAX.
; TODO make this fasm macro:
; #define qrcodegen_BUFFER_LEN_FOR_VERSION(n) ((((n) * 4 + 17) * ((n) * 4 + 17) + 7) / 8 + 1)
; The worst-case number of bytes needed to store one QR Code, up to and including
; version 40. This value equals 3918, which is just under 4 kilobytes.
; Use this more convenient value to avoid calculating tighter memory bounds for buffers.
; TODO make this fasm macro:
; #define qrcodegen_BUFFER_LEN_MAX qrcodegen_BUFFER_LEN_FOR_VERSION(qrcodegen_VERSION_MAX)
INT16_MAX = 32767
; Sentinel value for use in only some functions
LENGTH_OVERFLOW = -1
; Based on the table ECC_CODEWORDS_PER_BLOCK
qrcodegen_REED_SOLOMON_DEGREE_MAX = 30
; For automatic mask pattern selection.
PENALTY_N1 = 3
PENALTY_N2 = 3
PENALTY_N3 = 40
PENALTY_N4 = 10
; CODE:
proc qrcodegen_encodeBinary, dataAndTemp, dataLen, qrcode, ecl, minVersion, maxVersion, mask, boostEcl
locals
seg qrcodegen_Segment
endl
mov [seg + qrcodegen_Segment.mode], qrcodegen_Mode_BYTE
stdcall calcSegmentBitLength, [seg + qrcodegen_Segment.mode], [dataLen]
mov [seg + qrcodegen_Segment.bitLength], eax
.if [seg + qrcodegen_Segment.bitLength] = LENGTH_OVERFLOW
mov byte [qrcode + 0], 0 ; Set size to invalid value for safety
jmp .ret
.endif
mov eax, [dataLen]
mov [seg + qrcodegen_Segment.numChars], eax
mov eax, [dataAndTemp]
mov [seg + qrcodegen_Segment.data], eax
lea eax, [seg]
stdcall qrcodegen_encodeSegmentsAdvanced, eax, 1, [ecl], [minVersion], [maxVersion], [mask], [boostEcl], [dataAndTemp], [qrcode]
.ret:
ret
endp
; Returns the number of data bits needed to represent a segment
; containing the given number of characters using the given mode. Notes:
; - Returns LENGTH_OVERFLOW on failure, i.e. numChars > INT16_MAX
; or the number of needed bits exceeds INT16_MAX (i.e. 32767).
; - Otherwise, all valid results are in the range [0, INT16_MAX].
; - For byte mode, numChars measures the number of bytes, not Unicode code points.
; - For ECI mode, numChars must be 0, and the worst-case number of bits is returned.
; An actual ECI segment can have shorter data. For non-ECI modes, the result is exact.
proc calcSegmentBitLength uses edx ebx, mode, numChars
.if [numChars] > INT16_MAX
mov eax, LENGTH_OVERFLOW
jmp .ret
.endif
mov eax, [numChars]
.if [mode] = qrcodegen_Mode_NUMERIC
; eax = ceil(10/3 * n)
xor edx, edx
mov ebx, 10
mul ebx
add eax, 2
mov ebx, 3
div eax, ebx
.elseif [mode] = qrcodegen_Mode_ALPHANUMERIC
; eax = ceil(11/2 * n)
xor edx, edx
mov ebx, 11
mul eax, ebx
inc eax
mov ebx, 2
div eax, ebx
.elseif [mode] = qrcodegen_Mode_BYTE
shl eax, 3 ; *8
.elseif [mode] = qrcodegen_Mode_KANJI
xor edx, edx
mov ebx, 13
mul ebx
.elseif [mode] = qrcodegen_Mode_ECI
.if [numChars] = 0
mov eax, 3*8
.endif
.else ; Invalid argument
mov eax, LENGTH_OVERFLOW
jmp .ret
.endif
; TODO assert(result >= 0)
.if eax > INT16_MAX
mov eax, LENGTH_OVERFLOW
.endif
.ret:
ret
endp
; DATA:
; include_debug_strings
; The set of all legal characters in alphanumeric mode, where each character
; value maps to the index in the string. For checking text and encoding segments.
ALPHANUMERIC_CHARSET db "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",0
; For generating error correction codes.
ECC_CODEWORDS_PER_BLOCK db \
\ ; Version: (note that index 0 is for padding, and is set to an illegal value)
\ ; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, \ ; Low
-1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, \ ; Medium
-1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, \ ; Quartile
-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 ; High
; For generating error correction codes.
NUM_ERROR_CORRECTION_BLOCKS db \
\ ; Version: (note that index 0 is for padding, and is set to an illegal value)
\ ; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25, \ ; Low
-1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49, \ ; Medium
-1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68, \ ; Quartile
-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81 ; High