:: Re: [DNG] filosofies behind program…
Top Pagina
Delete this message
Reply to this message
Auteur: dvalin
Datum:  
Aan: dng
Nieuwe Onderwerpen: [DNG] Gimp sucks: was filosofies behind programming languages
Onderwerp: Re: [DNG] filosofies behind programming languages
On 03.11.24 22:02, the pterodactyl wrote:

> The only PostScript I've seen (destined for Apple LaserWriters) looks


> like it was written by a giant on a 8,192 column terminal and then loaded


> into Vim by a mere mortal.  I concur with the abuse, but have not


> discovered its beauty for myself.


After trying GIMP, and failing to find a way to draw a box, I gave up on

GUI drawing, and "drew" the eight sections, elevations, and plan views

for my owner-built off-grid retirement retreat - a 25m x 9.2m building

with internal masonry in the midst of timber framed walls - in

Postscript. It was easier.

With the help of a hierarchy of macros, beginning with "box", developing

to "window", "door", "wall", each taking size and orientation

parameters, the eight drawings took 896 lines of Postscript. OK, where a

25m run of wall included multiple windows and wall sections, I did put

several on a line, but kept that in check as comments were needed for

rapid location of the fiddly bits for a particular feature when editing.

Its power comes to the fore when features are repeated. Drawing 27 solar

panels in three rows on the roof, to dimension and precisely spaced, was

done with:

3 { 9 { 1728 292 box 50 0 rmoveto } repeat -16003 -400 rmoveto } repeat gstroke

< size >     <  >                  <         >

in mm     space                carriage return

(That did line up in Vim. Damn the ISP's GUI mail client.)

The only irritation is that Postscript debugging is exceedingly primitive. If a lot

has been added since the last successful output generation, then it can

be necessary to bisect the addition until the offending cause of the

crash is identified. I found that incremental editing, with frequent

output runs, was most productive. (Stack starvation, for example, can draw weird stuff.)

Incidentally, the drawings not only gained Planning Approval from local

council authorities, but also Building Approval from the licenced building

surveyor. I.e. they were good enough to build from. (OK, it was my

second owner-build, but I used an architectural draughtsman the first

time round, so this was a pleasing success.)

I did use Vim. Its folding feature presents the 896 lines of Postscript

source as an expandable TOC view:

------------------------------------------------------------------------

%!PS-Adobe-3.0

%%Creator: Erik Christiansen, using Vim, with folding. (Modelines at end)     %{{

%%BeginProlog  % In comments: % "S:" signifies stack contents, TOS to right.  %{{

%%EndProlog                                                                   %}}

<< /PageSize [842 1190] /Orientation 2 >> setpagedevice     % A3. This informs the printer.

%%BeginScript

%%Page: 1 4                                                                   %{{

% Accommodation Block:                                                        %{{

% Workshop Block:                                                             %{{

% Garage:                                                                     %{{

% Roof Outline:                                                               %{{

% Truss Placement:                                                            %{{

%%Page: 2 4                                                                   %{{

%Accommodation Block Section: AA                                              %{{

%Garage & Workshop Section:   BB                                              %{{

%East Elevation:                                                              %{{

%West Elevation:                                                              %{{

%%Page: 3 4                                                                   %{{

%North Elevation:                                                             %{{

%South Elevation:                                                             %{{

%%Page: 4 4                                                                   %{{

%Site Plan:                                                                   %{{

% vim: fdm=marker foldmarker=%{{,%}} foldlevel=0 commentstring=

%%EOF

------------------------------------------------------------------------

> As for assembler, one doesn't think like the computer--one *is* the


> computer, guts and glory.


I'm currently coding an off-grid power diverter, to use only excess

solar power for my HWS (USA: Boiler). When my 1/4 century old programmer

for the ATmega16 I've used here, convincingly played dead, I did a good

bit of code review while waiting for a replacement to arrive. With

assembler, that involves emulating each machine instruction mentally,

including any status register impact, when postponing a conditional

branch several instructions after the flag setting operation.

Fortunately, load and store operations have zero status impact, so a

variable save can be interposed between a subtraction (generating the

value to be saved) and a conditional branch to do stuff depending on the

result.

I've corrected over a dozen minute errors in nearly as many mental

emulations. Sharing data between an interrupt handler and the main loop requires mental alertness to what is "volatile", in C terms.

Assembler programming does offer amusements not otherwise easily

available. For example, the AVR core offers shifts and rotates through

the Carry bit, but no register-internal rotate. At 20 MIPS, it isn't

necessary to be maximally efficient, but that is the wont of an

assembler programmer, is it not?

We do have a couple of diverting threads at the moment. :-)