Library Design, f0dder's nightmare.



One of the important piece of criteria for a library module is that it
must work properly, IE, do the thing that such a module is expected to
do and among the thing that are normally expected with a command line
parser is that it can delimit not only on spaces but tabs as well.

For someone who has elected themselves as the critic of other peoples
library design, here is the alternative for any who are mislead by
nonsense of this type.

Here is the input and output from the command line parser that is the
leading edge of f0dder.lib.

H:\ASM2\ARCHIVE\F0DDERCL>main 1 2 3 4 5 6
Arg 0 == <MAIN>
Arg 1 == <1 2 3 4 5 6>

You will note here that the arguments delimited by tabs are all bunched
together as one argument.

Here is how its done using GetCL.

H:\asm2\archive\f0ddercl\stcl>stcl 1 2 3 4 5
6 7 8
1
2
3
4
5
6
7
8

The distinction is about this simple, f0dder.lib as demonstarted with
MAIN.EXE does not properly delimit on tabs where masm32.lib using GetCL
does.

Here is how simple the code is to do it.

;
=========================================================================
include \masm32\include\masm32rt.inc
;
=========================================================================

comment * -----------------------------------------------------
Build this template with
"CONSOLE ASSEMBLE AND LINK"
----------------------------------------------------- *

.code

start:

;
=========================================================================

call main

exit

;
=========================================================================

main proc

LOCAL clbuf :DWORD ; buffer pointer
LOCAL argnm :DWORD ; argument number counter
LOCAL buffer[128]:BYTE

mov clbuf, ptr$(buffer) ; set pointer to buffer
mov argnm, 1 ; start at argument 1

; ----------------------------
; test the command line length
; ----------------------------
cmp len(rv(GetCommandLine)), 128
jbe next
print "Command Line Exceeds 128 Bytes",13,10
ret

next:
invoke GetCL,argnm,clbuf ; get the argument
cmp eax, 1 ; test for valid argument
jne bye ; exit if not
print clbuf,13,10 ; display it at the console
add argnm, 1 ; increment the argument
jmp next

bye:
ret

main endp

;
=========================================================================

end start

Regards,

hutch at movsd dot com

.



Relevant Pages

  • Re: Variations 0.41c and renaming files to camera date
    ... a space to delimit additional parameters, and if you forget to specify ... Windows makes a complete pigs ear of implementing spaces in filenames, ... Take for example this command ...
    (comp.sys.acorn.apps)
  • Re: while (1) vs. for ( ;; )
    ... > if developers are prone to use tabs in the middle of lines.) ... difference because of a stupid Courier font. ... To go after poorly named variables, I would want to catch and flag all use of ... > to save you the trouble, here's a command for that: ...
    (comp.lang.c)
  • Re: DCL Coding Standards
    ... > Neither do certain versions of DCL. ... By exciting loop command I meant a ... typical command that would appear in a loop -- not a command that is ... the preview window and the tabs are still there. ...
    (comp.os.vms)
  • Tabs, etc. in 327x data stream
    ... OSHELL time cksum /etc/profile ... observed the data stream from the shell command contained HT ... tn3270 X shows colons). ... to separate output fields with tabs. ...
    (bit.listserv.ibm-main)
  • Is it correct that #queryCommand: doesnt propogate up levels of presenters?
    ... which is built up with several nestings of presenter. ... However I have noticed that in one of my tabs, that contains subtabs - even though I put my #queryCommand in the top level tab, some of the sub tabs don't correctly grey out menu items? ... I found this very conter intuitive, as if my menu item expects an #editItem selector, if I move it from an inner presenter to an outer presenter, Dolphin seems to understand this and propogate out its check for who can handle the command - and send it accordingly. ...
    (comp.lang.smalltalk.dolphin)