Fresh IDE . Check-in [cdd06b2935]
Not logged in

This repository is a mirror!

The original is located on: https://fresh.flatassembler.net/fossil/repo/fresh
If you want to follow the project, please update your remote-url

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fixed small bugs in bbcode parser. Added the function crypt() to the libc imported functions.
Timelines: family | ancestors | descendants | both | FreshLibDev
Files: files | file ages | folders
SHA1:cdd06b29356289f77c1aef5216e6bb9d5185acf8
User & Date: johnfound 2019-01-14 07:37:13
Context
2019-01-14
09:43
Fixed stupid bug in the 'minimag.asm' Leaf check-in: dfdcc94259 user: johnfound tags: FreshLibDev
07:37
Fixed small bugs in bbcode parser. Added the function crypt() to the libc imported functions. check-in: cdd06b2935 user: johnfound tags: FreshLibDev
2018-12-21
16:28
Fixed bug, causing infinite loop. More tests needed! check-in: 11de3f0cc1 user: johnfound tags: FreshLibDev
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to freshlib/data/bbcode.asm.

176
177
178
179
180
181
182



183
184
185
186
187
188
189
...
243
244
245
246
247
248
249



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
...
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
  emoTongue       onetag <'<img class="emoticon" src="', EMOTICONS_PATH, 'tongue.gif" alt=":P">'>,  0,              0,              0
  emoSad          onetag <'<img class="emoticon" src="', EMOTICONS_PATH, 'sad.gif" alt=":(">'>,     0,              0,              0
  emoCry          onetag <'<img class="emoticon" src="', EMOTICONS_PATH, 'cry.gif" alt=":`(">'>,    0,              0,              0
  emoAngry        onetag <'<img class="emoticon" src="', EMOTICONS_PATH, 'angry.gif" alt=">:(">'>,  0,              0,              0

endg





;--------------------------------------------------------------
; Converts BB code into HTML. Starts from the position [.from]
; and ends at the end of the text or at first NULL character.
;
; Arguments:
;    .pBBCode - pointer to the TText structure with the BBCode
................................................................................

        cmp     al, $0a
        je      .new_line

        cmp     al, $20
        jbe     .next           ; skip all whitespace




        cmp     [.fNewLine], 1
        mov     [.fNewLine], 0
        jbe     .paragraph_ok

        test    [.tagFlags], fDisableTags
        jnz     .continue

        push    eax
        stdcall TextMoveGap, edx, ebx
        stdcall TextSetGapSize, edx, 4
        mov     eax, [edx+TText.GapBegin]
        mov     dword [edx+eax], "<p>"
        add     [edx+TText.GapBegin], 3
        add     ebx, 3
        pop     eax

.paragraph_ok:
        cmp     al, "["
        je      .start_tag

.continue:

; html encoding from here

        test    al, al          ; all values > 127 are unicode and should not be encoded.
        js      .next
................................................................................
        pop     ecx esi

.copy:
        call    .copy_tag
        test    [.tagFlags], fBlockTag
        jz      .next

        mov     [.fNewLine], 2  ; after start of a block tag, the first text starts a paragraph.
        jmp     .next


.mono_open_tag:

        cmp     byte [.tagType], '='
        jne     .next







>
>
>







 







>
>
>
|

|


|











<
<







 







|







176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
...
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272


273
274
275
276
277
278
279
...
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
  emoTongue       onetag <'<img class="emoticon" src="', EMOTICONS_PATH, 'tongue.gif" alt=":P">'>,  0,              0,              0
  emoSad          onetag <'<img class="emoticon" src="', EMOTICONS_PATH, 'sad.gif" alt=":(">'>,     0,              0,              0
  emoCry          onetag <'<img class="emoticon" src="', EMOTICONS_PATH, 'cry.gif" alt=":`(">'>,    0,              0,              0
  emoAngry        onetag <'<img class="emoticon" src="', EMOTICONS_PATH, 'angry.gif" alt=">:(">'>,  0,              0,              0

endg

; 1 - paragraph starts on every new line.
; 2 - paragraph starts on every two consecutive new lines (like in MarkDown)
NEW_PARAGRAPH_EMPTY_LINES = 1

;--------------------------------------------------------------
; Converts BB code into HTML. Starts from the position [.from]
; and ends at the end of the text or at first NULL character.
;
; Arguments:
;    .pBBCode - pointer to the TText structure with the BBCode
................................................................................

        cmp     al, $0a
        je      .new_line

        cmp     al, $20
        jbe     .next           ; skip all whitespace

        cmp     al, "["
        je      .start_tag

        cmp     [.fNewLine], NEW_PARAGRAPH_EMPTY_LINES
        mov     [.fNewLine], 0
        jb      .paragraph_ok

        test    [.tagFlags], fDisableTags
        jnz     .paragraph_ok

        push    eax
        stdcall TextMoveGap, edx, ebx
        stdcall TextSetGapSize, edx, 4
        mov     eax, [edx+TText.GapBegin]
        mov     dword [edx+eax], "<p>"
        add     [edx+TText.GapBegin], 3
        add     ebx, 3
        pop     eax

.paragraph_ok:



.continue:

; html encoding from here

        test    al, al          ; all values > 127 are unicode and should not be encoded.
        js      .next
................................................................................
        pop     ecx esi

.copy:
        call    .copy_tag
        test    [.tagFlags], fBlockTag
        jz      .next

        mov     [.fNewLine], NEW_PARAGRAPH_EMPTY_LINES  ; after start of a block tag, the first text starts a paragraph.
        jmp     .next


.mono_open_tag:

        cmp     byte [.tagType], '='
        jne     .next

Changes to freshlib/imports/Linux/libc.inc.

21
22
23
24
25
26
27
28

  stime                                   ,<NONE>,                      'stime',        \
  strerror_r                              ,<.errnum, .pBuff, .BufLen>,  'strerror_r',   \
  shmget                                  ,<.key, .size, .flags>,       'shmget',       \
  shmat                                   ,<.shmid, .addr, .flags>,     'shmat',        \
  shmdt                                   ,<.addr>,                     'shmdt',        \
  shmctl                                  ,<.shmid, .cmd, .shmid_ds>,   'shmctl',       \
  getaddrinfo                             ,<.pHostName, .pService, .pHints, .pVarResult>, 'getaddrinfo',        \
  freeaddrinfo                            ,<.pAddrInfo>,                                  'freeaddrinfo'








|
>
21
22
23
24
25
26
27
28
29
  stime                                   ,<NONE>,                      'stime',        \
  strerror_r                              ,<.errnum, .pBuff, .BufLen>,  'strerror_r',   \
  shmget                                  ,<.key, .size, .flags>,       'shmget',       \
  shmat                                   ,<.shmid, .addr, .flags>,     'shmat',        \
  shmdt                                   ,<.addr>,                     'shmdt',        \
  shmctl                                  ,<.shmid, .cmd, .shmid_ds>,   'shmctl',       \
  getaddrinfo                             ,<.pHostName, .pService, .pHints, .pVarResult>, 'getaddrinfo',        \
  freeaddrinfo                            ,<.pAddrInfo>,                                  'freeaddrinfo',       \
  crypt                                   ,<.pKey, .pSalt>,             'crypt'