Logo BCDDLogo CSC
BCDDBehavioural Contract-Driven Design
version 1.0-beta
ITEN

11. The bcdd new command

bcdd new NAME creates the file NAME.csc in the current folder.

Case Standard output Standard error Code File
created created NAME.csc nothing 0 created, with the text below
NAME.csc already exists (file, folder or link) nothing bcdd new: NAME.csc already exists: I am not overwriting it 1 not touched
NAME is not a Name (rule L7) nothing bcdd new: invalid name: NAME 2 none
missing or extra arguments nothing usage: bcdd new NAME 2 none
NAME is, in any combination of upper and lower case, a name that Windows reserves for a device (CON, PRN, AUX, NUL, COM1…COM9, LPT1…LPT9); on every system, because a folder of CSCs must be able to move from Linux to Windows nothing bcdd new: the name “NAME” cannot be used: Windows reserves it (reserved names: CON, PRN, AUX, NUL, COM1-9, LPT1-9). Choose another name 2 none
the file cannot be created or written: folder without write permission, disk full, any other system error nothing bcdd new: I cannot create NAME.csc: CAUSE 1 none, not even a temporary file

The file is created in full or not at all: it must never remain half-written.

Which names. “Not reserved” in rule L7 means: it is not one of the words of section 2.3, the same list as check. In this way bcdd new never creates a file whose header check rejects.

CAUSE is the description of the error given by the system (for example Permission denied), on one line. It is the only text of bcdd that this document does not fix character by character: it depends on the system. The text is fixed up to and including NAME.csc: ; after it there is at least one character and a single final LF. The code is 1, as for the file that already exists: in both cases the command was written correctly, but the file was not created; code 2 remains for incorrect usage.

Text of the skeleton. NAME is replaced by the given name; every line ends with LF, including the last; encoding UTF-8 without BOM:

-- CSC created by bcdd new. It is filled in by hand; bcdd check checks the form.
-- Without STATUS RATIFIED no line is part of the contract: it is pending approval until the operator approves it.

CSC NAME VERSION 0.1
  STATUS HYPOTHESIS
  PURPOSE "to be filled in: in one sentence, what NAME is responsible for"

  -- Inputs and outputs (uncomment and fill in):
  -- CAPABILITY Name(parameter: Type)        what can be requested
  -- EVENT IN   name(parameter: Type)        what arrives from outside
  -- EVENT OUT  name(parameter: Type)        what goes out
  -- STATE      name : Type INITIAL value    what is visible from outside

  -- Guarantees in words:
  -- GUARANTEE g1: VERBAL "what it guarantees"
  --               VERIFY BY JUDGEMENT "who judges, and on what"
END

The skeleton has only the mandatory lines (CSC, VERSION, PURPOSE, END) plus STATUS HYPOTHESIS, which makes explicit what would apply in any case. The rest is comment: it suggests the forms without creating lines to be checked.