Friday 19 August 2011

CompTIA Network+

CompTIA Network+ completed in 19 august. First try as usual. I read and studied like a maniac, but the points achieved were simply ordinary.

Monday 1 August 2011

R118 — R122: own string literals

Slow slow progress! I'm in the middle of a sequence of marketing improvement courses (CompTIA A+, Network+, ITIL, Windows 7, and Windows Server 2003/2008), so the progress at sternons mkmap is proceeding very slowly. I like learning courses, so there's no real trouble, but I also would like to develop my private astronomy book plans requiring star maps, and similar. Maybe also I'll be lucky enough to get a job that contains a little C programming beside the PC-administration or networking jobs I'm preparing for.

The releases r118 to r120 slowly continued the novel dynamical object system produced by "carving plaster" – let's call it the plaster object system – but then I realized how tedious it is lacking string literals for pure 32 bit int wide strings.

Lacking those, I hacked a converter (neither a parser nor scanner – more like an oversimplistic preprocessor) that scans a file, collects strings with the syntax u"example string" perusing an initial nonstandard u" as a string marker for my own string literals. Now the function ustring_to_attrib in file pointobj.uc is converted as follows

source pointobj.uc target pointobj.c
int ustring_to_attrib(uchar *ustr) {
  if (0 == ucscmp(ustr, u"RA"))
    return POA_RA;
  if (0 == ucscmp(ustr, u"R.A."))
    return POA_RA;
  if (0 == ucscmp(ustr, u"α"))
    return POA_RA;
  return POA_none;
}
int ustring_to_attrib(uchar *ustr) {
  if (0 == ucscmp(ustr, _UC_RA))
    return POA_RA;
  if (0 == ucscmp(ustr, _UC_R_2E_A_2E_))
    return POA_RA;
  if (0 == ucscmp(ustr, _UC__3B1_))
    return POA_RA;
  return POA_none;
}

All such 32 bits wide string constants are then collected into the file allstrings.h, containing (among others):

static uchar _UC_R_2E_A_2E_[] = {'R','.','A','.',0}; /* R.A. */
static uchar _UC_RA[] = {'R','A',0}; /* RA */
static uchar _UC__3B1_[] = {0x3B1,0}; /* α */

The releases in chronorder:

  • R118 (May 25, 2011): "More plaster carving towards dynamical classes" experimental refactorings directed from static defines to dynamic allocation
  • R119 (Jun 13, 2011): "In the middle of refactoring" more mature refactorings in the same direction
  • R120 (Jun 13, 2011): "More object class refactorings" more refactorings – removing a conceptual flaw: the object type identifier must (!) be stored at the same position in all objects, minor other code fixes
  • R121 (Jul 22, 2011): "Further walking around Windows wide C-string limitations" novel invention – half-way wide string literal converter implemented: demo conversion seems OK
  • R122 (Aug 1, 2011): "String literal converter - ucliterals" the above wide string literal converter implemented and perused in code generation