-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support literals encoding conversions according to the literal type. #162
base: gcos4gnucobol-3.x
Are you sure you want to change the base?
Changes from all commits
ebc0e65
dfb449a
50aedb0
dd0e532
acc6b97
05bdc7b
270a5c6
b183d9f
45befa5
0e2b01c
85251d9
ecbb7d7
54e2a7a
f36a5c2
9163932
6019858
4bfd3d5
64a6827
7688453
f314e26
a0cc8e4
964d211
a5e2c4d
ad2d18d
5ebda12
a23df52
554e989
9dd561d
240441b
4906c62
3a3516b
066c355
310100e
ca01844
adb5437
b73d8d3
3b777ff
d846988
9d08bca
a43bb00
d5b040a
bb9ead6
5b29a10
cc0c49f
781bf47
a8ad25e
f784511
781e46f
94a4eb1
9c7a280
36fba80
6ee58b6
d3b1b92
a1d20ec
3cc645d
9d3cfc4
ad74341
327d82d
e9011f0
e1781b1
245c048
56a170a
641f231
3462d8d
b2d0299
1b19b11
3e23a11
ff901ac
63633a9
4137550
5fccee3
b34b927
e5c1164
5e1758a
c827f2e
fb224c2
a7a651a
11ccdb2
3fe593c
f2d146f
3bbf689
cf306be
0a3f455
36b7cd3
1dbbb4b
f0ac621
1ca9a64
800481b
97b48b0
b185d26
1c0e4c6
2589ee4
64f44d4
196872a
50d90e5
2e8d4a6
a98d666
0e5088c
217d418
7f58d1b
9274e03
a1f5a21
acbb10e
78e5b35
e61274d
396a049
af26d94
e23a8d6
3f9a1e7
80efab6
92415e1
47485d0
dfa9872
286c7ef
592deca
d5eca86
2cd946a
5a57502
cfc4d85
845037b
1053ead
362e616
6d288e2
629a36a
d375186
31a4548
9491db5
a9abdce
c1b5f45
736cb57
b5b1bb3
d533621
8ce5ae7
40fb88d
a4884df
f989b3b
cd348bb
5499c60
4fd32e8
a7a0b00
69d013d
fd4d1ef
69fb0c0
e397f4f
ca3adab
58327f0
30aaaef
c1c3f05
40a04b7
e3c59cc
44d306e
03d8e20
d8f5ce3
01743b3
0b8ae2a
91ead86
94c16d7
848146c
62e8245
edde333
cd1b3f9
32b50aa
1d2b225
cf63837
a65c5b0
beed135
4cb65f5
b29282e
2006da4
c97f8d2
576a0a6
9f5df14
4e7e9ee
047ac11
c133620
a1a8fc3
c2b488d
5ecd83a
9716d84
79ae168
8126cb3
11ed412
6691015
78b4b30
d9e22c6
01aab23
b95e404
44091e6
a9b05d2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
2022-03-20 Nicolas Berthier <[email protected]> | ||
|
||
* .github/workflows: improve CI setup | ||
|
||
2022-02-04 David Declerck <[email protected]> | ||
|
||
* config, cobc/cobc.h: add support for GCOS 7 dialect (Bull), both | ||
a strict variant (config/gcos-strict.conf) and a variant with | ||
GNUCobol extensions (config/gcos.conf) | ||
|
||
2024-12-08 Simon Sobisch <[email protected]> | ||
|
||
|
@@ -184,6 +193,10 @@ | |
|
||
* configure.ac: dropped extra check for GCC as done internally | ||
|
||
2022-09-30 Nicolas Berthier <[email protected]> | ||
|
||
* .github/workflows: fix ubuntu CI setup | ||
|
||
2022-09-08 Simon Sobisch <[email protected]> | ||
|
||
* configure.ac: cleanup curses library check | ||
|
@@ -201,6 +214,10 @@ | |
|
||
* configure.ac: check for PDC_free_memory_allocations | ||
|
||
2022-07-20 Nicolas Berthier <[email protected]> | ||
|
||
* .github/workflows: fix handling of quotes in testuite artifact name | ||
|
||
2022-07-07 Simon Sobisch <[email protected]> | ||
|
||
* .github/workflows: CI now emits a coverage report artifact | ||
|
@@ -239,7 +256,7 @@ | |
2022-03-29 Simon Sobisch <[email protected]> | ||
|
||
* configure.ac: dropped obsolete AC_PROG_CC_STD, AC_HEADER_STDC as | ||
already included in AC_PROG_CC and assumed otherwise | ||
already included in AC_PROG_CC and assumed otherwise | ||
|
||
2022-03-11 Simon Sobisch <[email protected]> | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,4 +110,4 @@ David Essex | |
Jeff Smith | ||
Jim Noeth | ||
Stephen Connolly | ||
Laura Tweedy | ||
Laura Tweedy |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,12 @@ | |
* typeck.c (cb_emit_move, cb_emit_set_to): do not check for incompatible | ||
data if no receiver field is of category numeric or numeric edited | ||
|
||
2024-09-09 Simon Sobisch <[email protected]> | ||
|
||
* cobc.c, codegen.c, tree.c: fixed C89 errors | ||
* typeck.c (trimmed_size, is_blank): minor refactorings | ||
* typeck.c: provide the original buffer if encoding cannot be applied | ||
|
||
2024-09-03 Simon Sobisch <[email protected]> | ||
|
||
* typeck.c (cb_emit_accept): always check position | ||
|
@@ -76,6 +82,21 @@ | |
* tree.c (char_to_precedence_idx, get_char_type_description, valid_char_order): | ||
adjusted size of precedence table and gave proper precedence to U | ||
|
||
2024-08-27 Simon Sobisch <[email protected]> | ||
|
||
* cobc.c, codegen.c, tree.c: fixed C89 errors | ||
* typeck.c (trimmed_size, is_blank): minor refactorings | ||
|
||
2024-08-10 Ahmed Maher <[email protected]> | ||
|
||
* cobc.c: added the locale option to specify the source | ||
file encoding if not specified with command line argument | ||
|
||
2024-08-10 Ahmed Maher <[email protected]> | ||
|
||
* cobc.h, cobc.c, flag.def: added command line argument for setting | ||
source file encoding | ||
|
||
2024-08-06 Simon Sobisch <[email protected]> | ||
|
||
* codegen.c (output_alphabet_name_definition): cater for national alphabet | ||
|
@@ -89,6 +110,14 @@ | |
national alphabets with increased size (max. 65535 instead of 255) | ||
* typeck.c (validate_alphabet): check that alphabet and literal types match | ||
|
||
|
||
2024-08-1 Ahmed Maher<[email protected]> | ||
|
||
* scanner.l, cobc.h, cobc.c, tree.c: added guards around iconv.h header and | ||
used it around the usages of the headers functions | ||
* tree.c (cb_build_utf8_literal): new function for UTF-8 literals | ||
* scanner.l (read_literal): changed to handle the utf8 literal reading | ||
|
||
2024-07-29 Chuck Haatvedt <[email protected]> | ||
|
||
* tree.c (cb_build_picture): added logic to find the valid floating | ||
|
@@ -103,6 +132,10 @@ | |
* tree.c (char_to_precedence_idx): changed to check penultimate and last | ||
symbols before the first and second symbols | ||
|
||
2024-07-27 Ahmed Maher <[email protected]> | ||
|
||
* scanner.l: refactor scan_x function | ||
|
||
2024-07-26 Simon Sobisch <[email protected]> | ||
|
||
* parser.y, config.def: rewrite ENVIRONMENT DIVISION parsing to allow | ||
|
@@ -111,10 +144,23 @@ | |
* reserved.c: make MENU context-sensitive | ||
* reserved.c, parser.y: added MODAL + MODELESS to acu extension windows | ||
|
||
|
||
2024-07-10 Chuck Haatvedt <[email protected]> | ||
|
||
* tree.c (cb_build_picture): fixed currency scale counting logic | ||
|
||
2024-07-09 Ahmed Maher <[email protected]> | ||
James K. Lowden <[email protected]> | ||
|
||
* typeck.c: refactor validate_move function | ||
|
||
2024-07-06 Ahmed Maher <[email protected]> | ||
|
||
* tree.c: added encoding conversion support to cb_build_national_literal and | ||
cb_build_alphanumeric_literal | ||
* cobc.h: declared struct cb_iconv used for encoding conversion | ||
* cobc.c: defined the struct cb_iconv with default values | ||
|
||
2024-06-19 David Declerck <[email protected]> | ||
|
||
* cobc.c (process_compile): fix MSVC build command | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,13 @@ | |
#include <unistd.h> | ||
#endif | ||
#include <stdio.h> /* for FILE* */ | ||
|
||
#ifdef HAVE_ICONV | ||
#include <iconv.h> | ||
#endif | ||
|
||
#include <errno.h> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. errno.h should only be included in the files directly using it, not in the main header |
||
|
||
|
||
#include "../libcob/common.h" | ||
|
||
|
@@ -322,6 +329,21 @@ enum cobc_name_type { | |
PROGRAM_ID_NAME | ||
}; | ||
|
||
|
||
#ifdef HAVE_ICONV | ||
/* Structure for a iconv conversion */ | ||
struct cb_iconv_t{ | ||
iconv_t alphanumeric; | ||
iconv_t national; | ||
iconv_t utf8; | ||
char source[100]; | ||
char alphanumeric_source[100]; | ||
}; | ||
|
||
extern struct cb_iconv_t cb_iconv; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move that line directly after the comment, use tabs for indenting within the structure, move complete part to tree.h if possible |
||
#endif | ||
|
||
|
||
/* Listing structures and externals */ | ||
|
||
#if 0 /* ancient OSVS registers that need special runtime handling - low priority */ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5205,7 +5205,24 @@ output_initialize_to_value (struct cb_field *f, cb_tree x, | |
from a string - we use a local buffer to set that up */ | ||
unsigned char litbuff[128]; | ||
memcpy (litbuff + litstart, l->data, l->size); | ||
memset (litbuff + padstart, ' ', padlen); | ||
|
||
if (l->common.category == CB_CATEGORY_NATIONAL || l->common.category == CB_CATEGORY_NATIONAL_EDITED){ | ||
/* Calculate the number of bytes to pad (multiply by 2 for UTF-16) */ | ||
const size_t padbytes = padlen * 2; | ||
size_t i; | ||
|
||
/* Get a pointer to the starting position for padding */ | ||
unsigned char *padptr = litbuff + padstart; | ||
|
||
/* Pad the rest of the string with UTF-16 space character */ | ||
for (i = 0; i < padbytes; i += 2) { | ||
padptr[i] = 0x20; | ||
padptr[i + 1] = 0x00; | ||
Comment on lines
+5219
to
+5220
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as |
||
} | ||
} else{ | ||
memset (litbuff + padstart, ' ', padlen); | ||
} | ||
|
||
output_prefix (); | ||
output ("memcpy ("); | ||
output_data (x); | ||
|
@@ -5247,7 +5264,23 @@ output_initialize_to_value (struct cb_field *f, cb_tree x, | |
} | ||
|
||
memcpy (litbuff + litstart, l->data, l->size); | ||
memset (litbuff + padstart, ' ', padlen); | ||
|
||
if(x->category == CB_CATEGORY_NATIONAL || x->category == CB_CATEGORY_NATIONAL_EDITED){ | ||
// Calculate the number of bytes to pad (multiply by 2 for UTF-16) | ||
size_t padbytes = padlen * 2; | ||
|
||
// Get a pointer to the starting position for padding | ||
unsigned char *padptr = litbuff + padstart; | ||
|
||
// Pad the rest of the string with UTF-16 space character | ||
for (size_t i = 0; i < padbytes; i += 2) { | ||
padptr[i] = 0x20; | ||
padptr[i + 1] = 0x00; | ||
} | ||
} | ||
else{ | ||
memset (litbuff + padstart, ' ', padlen); | ||
} | ||
Comment on lines
+5268
to
+5283
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you move the above code out to a static function before |
||
|
||
buffchar = *(litbuff + size - 1); | ||
n = 0; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent by two spaces